1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/auto_init: add security module and cryptoauth init

This commit is contained in:
Einhornhool 2020-01-28 18:34:32 +01:00 committed by PeterKietzmann
parent 83de1cf0c8
commit 3dae0ddde5
4 changed files with 56 additions and 0 deletions

View File

@ -22,4 +22,8 @@ ifneq (,$(filter auto_init_usbus,$(USEMODULE)))
DIRS += usb
endif
ifneq (,$(filter auto_init_security,$(USEMODULE)))
DIRS += security
endif
include $(RIOTBASE)/Makefile.base

View File

@ -619,6 +619,15 @@ void auto_init(void)
suit_init_conditions();
#endif /* MODULE_SUIT */
#ifdef MODULE_AUTO_INIT_SECURITY
#ifdef MODULE_CRYPTOAUTHLIB
extern void auto_init_atca(void);
auto_init_atca();
#endif /* MODULE_CRYPTOAUTHLIB */
#endif /* MODULE_AUTO_INIT_SECURITY */
#ifdef MODULE_TEST_UTILS_INTERACTIVE_SYNC
#if !defined(MODULE_SHELL_COMMANDS) || !defined(MODULE_SHELL)
test_utils_interactive_sync();

View File

@ -0,0 +1,3 @@
MODULE = auto_init_security
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2019 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup sys_auto_init
* @{
* @file
* @brief Initializes cryptoauth devices
*
* @author Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
* @}
*/
#ifdef MODULE_CRYPTOAUTHLIB
#include "log.h"
#include "atca.h"
#include "atca_params.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
#define ATCA_NUMOF (ARRAY_SIZE(atca_params))
void auto_init_atca(void)
{
for (unsigned i = 0; i < ATCA_NUMOF; i++) {
if (atcab_init((ATCAIfaceCfg *)&atca_params[i]) != ATCA_SUCCESS) {
LOG_ERROR("[auto_init_atca] error initializing cryptoauth device #%u\n", i);
continue;
}
}
}
#else
typedef int dont_be_pedantic;
#endif