From 422d81a2b45b79ad5de3bab4344f777eb6373559 Mon Sep 17 00:00:00 2001 From: Lena Boeckmann Date: Wed, 25 May 2022 15:04:32 +0200 Subject: [PATCH] pkg/cryptoauthlib: Update package to latest version --- boards/common/saml1x/include/board.h | 9 ++ pkg/cryptoauthlib/Kconfig | 20 ++++ pkg/cryptoauthlib/Makefile | 9 +- pkg/cryptoauthlib/Makefile.dep | 5 + pkg/cryptoauthlib/Makefile.include | 6 ++ pkg/cryptoauthlib/contrib/atca.c | 87 ++++++++---------- pkg/cryptoauthlib/include/atca_config.h | 52 +++++++++++ pkg/cryptoauthlib/include/atca_params.h | 7 +- .../include/cryptoauthlib_test.h | 10 +- ...-include-dirs-to-target-include-dirs.patch | Bin 0 -> 1041 bytes ...irectories-to-target_include_directo.patch | Bin 889 -> 0 bytes .../0002-Add-parseCmd-function-for-RIOT.patch | Bin 0 -> 758 bytes ...defines-and-functions-for-riot-usage.patch | Bin 1743 -> 0 bytes .../0003-Cast-DEVICE_MASK-to-32-bit.patch | Bin 0 -> 842 bytes .../pkg_cryptoauthlib_internal-tests/Makefile | 1 + .../README.md | 5 + tests/pkg_cryptoauthlib_internal-tests/main.c | 13 ++- 17 files changed, 156 insertions(+), 68 deletions(-) create mode 100644 pkg/cryptoauthlib/include/atca_config.h create mode 100644 pkg/cryptoauthlib/patches/0001-Change-include-dirs-to-target-include-dirs.patch delete mode 100644 pkg/cryptoauthlib/patches/0001-change-include_directories-to-target_include_directo.patch create mode 100644 pkg/cryptoauthlib/patches/0002-Add-parseCmd-function-for-RIOT.patch delete mode 100644 pkg/cryptoauthlib/patches/0002-add-defines-and-functions-for-riot-usage.patch create mode 100644 pkg/cryptoauthlib/patches/0003-Cast-DEVICE_MASK-to-32-bit.patch create mode 100644 tests/pkg_cryptoauthlib_internal-tests/README.md diff --git a/boards/common/saml1x/include/board.h b/boards/common/saml1x/include/board.h index afa934b7de..9e35340646 100644 --- a/boards/common/saml1x/include/board.h +++ b/boards/common/saml1x/include/board.h @@ -28,6 +28,15 @@ extern "C" { #endif +/** + * @brief ATCA device type on SAML11 XPro boards + * @{ + */ +#ifdef BOARD_SAML11_XPRO +#define ATCA_DEVTYPE (ATECC508A) +#endif +/** @} */ + /** * @name PORT selection macros * @{ diff --git a/pkg/cryptoauthlib/Kconfig b/pkg/cryptoauthlib/Kconfig index abbfdf29e8..7c74e16fb9 100644 --- a/pkg/cryptoauthlib/Kconfig +++ b/pkg/cryptoauthlib/Kconfig @@ -23,6 +23,11 @@ config MODULE_CRYPTOAUTHLIB_CONTRIB config MODULE_CRYPTOAUTHLIB_TEST bool "Module for cryptoauthlib tests" depends on TEST_KCONFIG + select MODULE_CRYPTOAUTHLIB_TEST_THIRD_PARTY_UNITY + select MODULE_CRYPTOAUTHLIB_TEST_API_ATCAB + select MODULE_CRYPTOAUTHLIB_TEST_API_CALIB + select MODULE_CRYPTOAUTHLIB_TEST_API_CRYPTO + select MODULE_CRYPTOAUTHLIB_TEST_VECTORS select MODULE_CRYPTOAUTHLIB_TEST_JWT select MODULE_CRYPTOAUTHLIB_TEST_TNG select MODULE_CRYPTOAUTHLIB_TEST_ATCACERT @@ -36,4 +41,19 @@ config MODULE_CRYPTOAUTHLIB_TEST_TNG config MODULE_CRYPTOAUTHLIB_TEST_ATCACERT bool +config MODULE_CRYPTOAUTHLIB_TEST_THIRD_PARTY_UNITY + bool + +config MODULE_CRYPTOAUTHLIB_TEST_API_ATCAB + bool + +config MODULE_CRYPTOAUTHLIB_TEST_API_CALIB + bool + +config MODULE_CRYPTOAUTHLIB_TEST_API_CRYPTO + bool + +config MODULE_CRYPTOAUTHLIB_TEST_VECTORS + bool + endif diff --git a/pkg/cryptoauthlib/Makefile b/pkg/cryptoauthlib/Makefile index 587e115549..b6eebf6efb 100644 --- a/pkg/cryptoauthlib/Makefile +++ b/pkg/cryptoauthlib/Makefile @@ -1,6 +1,6 @@ PKG_NAME=cryptoauthlib PKG_URL=https://github.com/MicrochipTech/cryptoauthlib -PKG_VERSION=af8187776cd3f3faf8bed412eaf6ff7221862e19 +PKG_VERSION=055dd4afafb019db1f4d61880aa441832139faa2 PKG_LICENSE=LGPL-2.1 PKG_TEST_NAME=cryptoauthlib_test @@ -23,6 +23,7 @@ CFLAGS += -Wno-type-limits CFLAGS += -Wno-unused-function CFLAGS += -Wno-unused-parameter CFLAGS += -Wno-unused-variable +CFLAGS += -Wno-format-nonliteral TOOLCHAIN_FILE=$(PKG_SOURCE_DIR)/xcompile-toolchain.cmake @@ -39,7 +40,6 @@ cryptoauth: $(PKG_BUILD_DIR)/Makefile $(PKG_BUILD_DIR)/Makefile: $(TOOLCHAIN_FILE) cmake -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \ -Wno-dev \ - -DATCA_HAL_I2C:BOOL=TRUE \ -B$(PKG_BUILD_DIR) \ -H$(PKG_SOURCE_DIR)/lib @@ -47,10 +47,15 @@ $(TOOLCHAIN_FILE): git-download $(RIOTTOOLS)/cmake/generate-xcompile-toolchain.sh > $(TOOLCHAIN_FILE) build_tests: + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/third_party/unity -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_third_party_unity $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME) $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/jwt -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_jwt $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/tng -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_tng $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/atcacert -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_atcacert + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/api_atcab -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_api_atcab + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/api_calib -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_api_calib + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/api_crypto -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_api_crypto + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/test/vectors -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_TEST_NAME)_vectors git-download: | ..cmake_version_supported diff --git a/pkg/cryptoauthlib/Makefile.dep b/pkg/cryptoauthlib/Makefile.dep index 4da9094721..0544351a58 100644 --- a/pkg/cryptoauthlib/Makefile.dep +++ b/pkg/cryptoauthlib/Makefile.dep @@ -9,6 +9,11 @@ ifneq (,$(filter cryptoauthlib_test,$(USEMODULE))) USEMODULE += cryptoauthlib_test_jwt USEMODULE += cryptoauthlib_test_tng USEMODULE += cryptoauthlib_test_atcacert + USEMODULE += cryptoauthlib_test_api_atcab + USEMODULE += cryptoauthlib_test_api_calib + USEMODULE += cryptoauthlib_test_api_crypto + USEMODULE += cryptoauthlib_test_vectors + USEMODULE += cryptoauthlib_test_third_party_unity endif # Some EFM32 CPU families define AES_COUNT, which is also defined by this diff --git a/pkg/cryptoauthlib/Makefile.include b/pkg/cryptoauthlib/Makefile.include index 82cd2a0a39..cf37947461 100644 --- a/pkg/cryptoauthlib/Makefile.include +++ b/pkg/cryptoauthlib/Makefile.include @@ -4,6 +4,7 @@ PKG_TESTINCLDIR = $(PKG_SOURCE_DIR)/test INCLUDES += -I$(PKG_SOURCE_DIR) INCLUDES += -I$(PKG_SOURCE_DIR)/lib INCLUDES += -I$(PKG_SOURCE_DIR)/app +INCLUDES += -I$(PKG_SOURCE_DIR)/lib/calib INCLUDES += -I$(RIOTPKG)/cryptoauthlib/include DIRS += $(RIOTPKG)/cryptoauthlib/contrib @@ -14,4 +15,9 @@ ifneq (,$(filter cryptoauthlib_test,$(USEMODULE))) INCLUDES += -I$(PKG_TESTINCLDIR)/jwt INCLUDES += -I$(PKG_TESTINCLDIR)/tng INCLUDES += -I$(PKG_TESTINCLDIR)/atcacert + INCLUDES += -I$(PKG_TESTINCLDIR)/api_atcab + INCLUDES += -I$(PKG_TESTINCLDIR)/api_calib + INCLUDES += -I$(PKG_TESTINCLDIR)/api_crypto + INCLUDES += -I$(PKG_TESTINCLDIR)/vectors + INCLUDES += -I$(PKG_SOURCE_DIR)/third_party/unity endif diff --git a/pkg/cryptoauthlib/contrib/atca.c b/pkg/cryptoauthlib/contrib/atca.c index 78aaa522cc..9670909a7a 100644 --- a/pkg/cryptoauthlib/contrib/atca.c +++ b/pkg/cryptoauthlib/contrib/atca.c @@ -27,6 +27,7 @@ #include "atca.h" #include "atca_params.h" + /* Timer functions */ void atca_delay_us(uint32_t delay) { @@ -44,9 +45,9 @@ void atca_delay_ms(uint32_t delay) } /* Hal I2C implementation */ -ATCA_STATUS hal_i2c_init(void *hal, ATCAIfaceCfg *cfg) +ATCA_STATUS hal_i2c_init(ATCAIface iface, ATCAIfaceCfg *cfg) { - (void)hal; + (void)iface; if (cfg->iface_type != ATCA_I2C_IFACE) { return ATCA_BAD_PARAM; } @@ -62,17 +63,15 @@ ATCA_STATUS hal_i2c_post_init(ATCAIface iface) return ATCA_SUCCESS; } -ATCA_STATUS hal_i2c_send(ATCAIface iface, uint8_t *txdata, int txlength) +ATCA_STATUS hal_i2c_send(ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength) { + (void) word_address; ATCAIfaceCfg *cfg = atgetifacecfg(iface); int ret; - /* The first byte of the command package contains the word address */ - txdata[0] = ATCA_DATA_ADDR; - i2c_acquire(cfg->atcai2c.bus); - ret = i2c_write_bytes(cfg->atcai2c.bus, (cfg->atcai2c.slave_address >> 1), - txdata, txlength + 1, 0); + ret = i2c_write_bytes(cfg->atcai2c.bus, (cfg->atcai2c.address >> 1), + txdata, txlength, 0); i2c_release(cfg->atcai2c.bus); if (ret != 0) { @@ -82,53 +81,20 @@ ATCA_STATUS hal_i2c_send(ATCAIface iface, uint8_t *txdata, int txlength) return ATCA_SUCCESS; } -ATCA_STATUS hal_i2c_receive(ATCAIface iface, uint8_t *rxdata, +ATCA_STATUS hal_i2c_receive(ATCAIface iface, uint8_t word_address, uint8_t *rxdata, uint16_t *rxlength) { + (void) word_address; ATCAIfaceCfg *cfg = atgetifacecfg(iface); uint8_t retries = cfg->rx_retries; - uint8_t length_package = 0; - uint8_t bytes_to_read; int ret = -1; - /* Every command needs some time to be executed. We check whether the device is done - by polling, so we don't have to wait for the max execution time. For that there's - a number of retries (specified in the device descriptor). If polling is not successful - this function returns an error code. */ - - i2c_acquire(cfg->atcai2c.bus); - while (retries-- > 0 && ret != 0) { - /* read first byte (size of output data) and store it in variable length_package - to check if output will fit into rxdata */ - ret = i2c_read_byte(cfg->atcai2c.bus, (cfg->atcai2c.slave_address >> 1), - &length_package, 0); - } - i2c_release(cfg->atcai2c.bus); - - if (ret != 0) { - return ATCA_RX_TIMEOUT; - } - - bytes_to_read = length_package - 1; - - if (bytes_to_read > *rxlength) { - return ATCA_SMALL_BUFFER; - } - - /* CRC function calculates value of the whole output package, so to get a correct - result we need to include the length of the package we got before into rxdata as first byte. */ - rxdata[0] = length_package; - - /* reset ret and retries to read the rest of the output */ - ret = -1; - retries = cfg->rx_retries; - /* read rest of output and insert into rxdata array after first byte */ i2c_acquire(cfg->atcai2c.bus); while (retries-- > 0 && ret != 0) { ret = i2c_read_bytes(cfg->atcai2c.bus, - (cfg->atcai2c.slave_address >> 1), (rxdata + 1), - bytes_to_read, 0); + (cfg->atcai2c.address >> 1), (rxdata), + *rxlength, 0); } i2c_release(cfg->atcai2c.bus); @@ -136,8 +102,6 @@ ATCA_STATUS hal_i2c_receive(ATCAIface iface, uint8_t *rxdata, return ATCA_RX_TIMEOUT; } - *rxlength = length_package; - return ATCA_SUCCESS; } @@ -173,7 +137,7 @@ ATCA_STATUS hal_i2c_wake(ATCAIface iface) i2c_acquire(cfg->atcai2c.bus); while (retries-- > 0 && status != 0) { status = i2c_read_bytes(cfg->atcai2c.bus, - (cfg->atcai2c.slave_address >> 1), + (cfg->atcai2c.address >> 1), &data[0], 4, 0); } i2c_release(cfg->atcai2c.bus); @@ -181,7 +145,6 @@ ATCA_STATUS hal_i2c_wake(ATCAIface iface) if (status != ATCA_SUCCESS) { return ATCA_COMM_FAIL; } - return hal_check_wake(data, 4); } @@ -190,7 +153,7 @@ ATCA_STATUS hal_i2c_idle(ATCAIface iface) ATCAIfaceCfg *cfg = atgetifacecfg(iface); i2c_acquire(cfg->atcai2c.bus); - i2c_write_byte(cfg->atcai2c.bus, (cfg->atcai2c.slave_address >> 1), + i2c_write_byte(cfg->atcai2c.bus, (cfg->atcai2c.address >> 1), ATCA_IDLE_ADDR, 0); i2c_release(cfg->atcai2c.bus); return ATCA_SUCCESS; @@ -201,12 +164,34 @@ ATCA_STATUS hal_i2c_sleep(ATCAIface iface) ATCAIfaceCfg *cfg = atgetifacecfg(iface); i2c_acquire(cfg->atcai2c.bus); - i2c_write_byte(cfg->atcai2c.bus, (cfg->atcai2c.slave_address >> 1), + i2c_write_byte(cfg->atcai2c.bus, (cfg->atcai2c.address >> 1), ATCA_SLEEP_ADDR, 0); i2c_release(cfg->atcai2c.bus); return ATCA_SUCCESS; } +ATCA_STATUS hal_i2c_control(ATCAIface iface, uint8_t option, void* param, size_t paramlen) +{ + (void) param; + (void) paramlen; + switch (option) { + case ATCA_HAL_CONTROL_WAKE: + return hal_i2c_wake(iface); + case ATCA_HAL_CONTROL_IDLE: + return hal_i2c_idle(iface); + case ATCA_HAL_CONTROL_SLEEP: + return hal_i2c_sleep(iface); + case ATCA_HAL_CHANGE_BAUD: + return ATCA_UNIMPLEMENTED; + case ATCA_HAL_CONTROL_SELECT: + case ATCA_HAL_CONTROL_DESELECT: + return ATCA_SUCCESS; + default: + return ATCA_BAD_PARAM; + } + return ATCA_UNIMPLEMENTED; +} + ATCA_STATUS hal_i2c_release(void *hal_data) { (void)hal_data; diff --git a/pkg/cryptoauthlib/include/atca_config.h b/pkg/cryptoauthlib/include/atca_config.h new file mode 100644 index 0000000000..de9491b4d9 --- /dev/null +++ b/pkg/cryptoauthlib/include/atca_config.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2022 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 pkg_cryptoauthlib + * @{ + * + * @file + * @brief Minimal configuration for the library build. + * For documentation please see https://github.com/MicrochipTech/cryptoauthlib#readme + * + * @author Lena Boeckmann + * + */ + +#ifndef ATCA_CONFIG_H +#define ATCA_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief ATECC508A device support + */ +#define ATCA_ATECC508A_SUPPORT + +/** + * @brief ATECC608A device support + */ +#define ATCA_ATECC608A_SUPPORT + +/** + * @brief Map atca delay function to hal delay ms implementation + */ +#define atca_delay_ms hal_delay_ms + +/** + * @brief Map atca delay function to hal delay us implementation + */ +#define atca_delay_us hal_delay_us + +#ifdef __cplusplus +} +#endif +#endif /* ATCA_CONFIG_H */ +/** @} */ \ No newline at end of file diff --git a/pkg/cryptoauthlib/include/atca_params.h b/pkg/cryptoauthlib/include/atca_params.h index 96d8c9deb3..3a49d585f7 100644 --- a/pkg/cryptoauthlib/include/atca_params.h +++ b/pkg/cryptoauthlib/include/atca_params.h @@ -21,6 +21,7 @@ #define ATCA_PARAMS_H #include "board.h" +#include "periph/i2c.h" #include "cryptoauthlib.h" #ifdef __cplusplus @@ -53,15 +54,15 @@ extern "C" { #define ATCA_RX_RETRIES (20) #endif #ifndef ATCA_DEVTYPE -#define ATCA_DEVTYPE (ATECC508A) +#define ATCA_DEVTYPE (ATECC608A) #endif #ifndef ATCA_PARAMS #define ATCA_PARAMS { .iface_type = ATCA_I2C_IFACE, \ .devtype = ATCA_DEVTYPE, \ - .atcai2c.slave_address = ATCA_PARAM_ADDR, \ + .atcai2c.address = ATCA_PARAM_ADDR, \ .atcai2c.bus = ATCA_PARAM_I2C, \ - .atcai2c.baud = -1, /**< Not used in RIOT */ \ + .atcai2c.baud = -1, /**< Not used in RIOT */ \ .wake_delay = 1500, \ .rx_retries = ATCA_RX_RETRIES } #endif diff --git a/pkg/cryptoauthlib/include/cryptoauthlib_test.h b/pkg/cryptoauthlib/include/cryptoauthlib_test.h index 8a66d58091..bbb2d7aa24 100644 --- a/pkg/cryptoauthlib/include/cryptoauthlib_test.h +++ b/pkg/cryptoauthlib/include/cryptoauthlib_test.h @@ -32,15 +32,7 @@ extern "C" { * This function is defined in the cryptoauth library via patch. * It is used to pass commands to run built-in unit tests of the library. */ -int atca_run_cmd(const char *command); - -/** - * @brief Function switches the default cfg in cryptoauthlib test to RIOT cfg - */ -void riot_switch_cfg(ATCAIfaceCfg *cfg) -{ - *cfg = atca_params[0]; -} +int atca_run_cmd(char *command, size_t len); #ifdef __cplusplus } diff --git a/pkg/cryptoauthlib/patches/0001-Change-include-dirs-to-target-include-dirs.patch b/pkg/cryptoauthlib/patches/0001-Change-include-dirs-to-target-include-dirs.patch new file mode 100644 index 0000000000000000000000000000000000000000..b06401b369371056d648204b8e954348b9f70182 GIT binary patch literal 1041 zcmdUuZI7Bj5P-k$ub2=0py7B~KsZU$sOY8k)HA-Mxik$~V34i25LnZ@wD;e;s7X_6 ze?XJn%+5@B=9P!KJOHz?pY>^)C5}Tg%VXGMiRbtpwQR?`&w4TSY(`y}mjc#U0rkPM zg3|%pvM6~_m;h!d7>r6x_6H^eyhkqbvR1b&28S}{4mG$yY2@s?p0h)ItanC=AIO+V z4B#`ScW@7%jzTeQ8>kbwZs2;LSt$VJ1Y^bpi#C&2Y~4IOC0M4EZAAC)l7V7ln)$2+0YlQlaYm25ZSn(b2lC zo??L~Rqqm#@+<>g-*E}dyn&5x7zr0CzJTxc5q;Y?44SyU%UlbnWqGdK=6I7vG);q> z#K8b`r{~`Jpq+&>B&Eps?pR~gR@ABXNkgf57SY*hHL1;o~Flg}!LN%(R9z?%PDN<8XgDh)~ zO(&^eD_OFm%wf45&8BUzf8zi0t)I55aB>O_hGDX*GNstHPnq*NjVe~l*DKY`dCDq& z5em6okJ>6{+wqyyCE9s^qW>mgAfTG8ev4r=A5F%a*;+OHQbfVUK2rNxv+IT*VoYVx Pbk)`Yu??qZP(pqIOrl3P literal 0 HcmV?d00001 diff --git a/pkg/cryptoauthlib/patches/0001-change-include_directories-to-target_include_directo.patch b/pkg/cryptoauthlib/patches/0001-change-include_directories-to-target_include_directo.patch deleted file mode 100644 index 03d4eb1297de755840bebaef98d0448291377224..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 889 zcmcIiZHwAK5dOZuVm|bPl1tp(Xndg*H7drWIz7N1+tFN2$uHHorQIk5wvN=17IwDa8-F6vy;j@0}b!keSdp zg6$dapbzBR`tbw{o@qC>DKqm;zw^gCvH1Yb9kt^W~Nhkt{t6l#wkRdzV%nB=lH zE>$hD0bPL>^&WL{10}?^Z2||GcKoGy#85W6arBdhU%>Ao zWwkGQjt6{E?KUB~EDEsgz0@E&H)zuvMj};?Pmr=6W}fFboOuK6_Q7=Pb-R}eZ*mdK zvfw7)cnmhwu?3ak>^Q{g;erVeABXL7yK`b%Czz}gxEJG z*vjhXldi;Bm$2DQ!@!4kKmFz8(>(EaQ8Zs|lX$(0{CP49qTk>+9bL*gPfnuN&z(}{ z;v}!a1n%N#60H1iH+%JO6YJm0``@X_WoQq<%H?KUjX9ueDW|$RT`mBdHx)$d%{qn8aU}({&hwuFu#uD<$0Fu0sj=19&4BO#lD@ diff --git a/pkg/cryptoauthlib/patches/0002-Add-parseCmd-function-for-RIOT.patch b/pkg/cryptoauthlib/patches/0002-Add-parseCmd-function-for-RIOT.patch new file mode 100644 index 0000000000000000000000000000000000000000..64512c48b0b22a2fcc1e11d639281b2945a53159 GIT binary patch literal 758 zcmZ`%ZBN@U5dMC@;>5nRq)GGEGz|!~>xAgUMl~w!145N!Um9EywRmhqChILLCt>nHEYVw>;ge&@PSz> z@GFTC=J>Hw4l|B1N{TcsCNuOxR|BrQ@*8nm;LUomSzcf~j&E@x1l}>z(y|d)b&6Z* zC|26wm(|quq}_5Y=mhWyymz#h6$+}{ zjKrYVZ@XBpFIUUOW_9&>=n|yj`%Vy^wpK_T)Mx+2_Og5#JbI~meFPqO2XdCPt?AU( zB@B9wc+7R<@!rIM_(Zd)+>IelPBI`a_R*I)fpPedO`LlW?19 zSm7T0K6u`!`as}$KD!~A5iC%1c$cC0XUDaMx2SZI<@C+c@h;n_w(ly9#!dL=X2N%y zGT*u}Ua@O#a0FqA4d}z~T$5(tf!`Um`y<~2$MZdpt;)^cD9i{xE+^siJp`@b6Yw~O z7$vC|z;z6=)WWDt7a+47a+Mh<3%*6hn$0EygN12{UEJK~nZTmRa#z5=;CI1!HeTME z&{pulVGw{+DIF;iuD2LBtb)=7=GECXr%o2~D@FTWYt|Wym6XtIZj}MvdeM!|i)N;D zjE@j((ChJm>xxd-+XNDbNUzheQN5zaC?I%6b3BG-Flh9_sh;C8gH{XHbdn_rCP8{p z<_p|R<_p+yk!Mh3K)%Nr7W!8MBGWQe!oX)`lIjnW)y*Lj%Erv#ytHza0>M955`H`G%h6i;la+B`R&J-^}G<`t(XR3O|YcMj*Ol1yH$DE-){(s4I+6-|H?Y*{*|*FMVYD?~n7kC` z5R2SLJJe-F?J-U<2YNqFZAj*@sI<&338qbH)v8Z9SqyW@1ro0d0>-LBuytjVSyb1+ P&g>F(_P`C=uE*GaI(ihb diff --git a/pkg/cryptoauthlib/patches/0003-Cast-DEVICE_MASK-to-32-bit.patch b/pkg/cryptoauthlib/patches/0003-Cast-DEVICE_MASK-to-32-bit.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d6777d71bbac225b63bc8996be6bc0d598d38ef GIT binary patch literal 842 zcmb7?U2mH(6o&8pD~^;K5P=$#K$1pNGD^30t27m~n`uG@A1B@t6A`lysr&CUtgWJ@ zyO?Dio!9U2Bm3CbZL^0c!U>HgvxqaSq8izJKA+5!mBCWny`?;U85n#1B3}s zx)>%fN<(sOF$;K)n#1b`>#uvRH7s{l2i22aZTWY9%lB2+ZUTX?$Q3uZfTF`OOyRcM zSrlUs#yyxN;8BYvc~^bG+AQGHhjo#@{R}BT8o0_n-lSQ1x6a>zX&_=yDMN_w`veRg z%>_3#FZ(Rm!UHhytPz4#JA``6^#;Y*YNe0Z8r5jWb9*gthlBK8LWGhMe1D@1@QX8O zb+$y57We~XCFd1V76dZFIt(R3NNGHo^rw4)L_E)f7ig;$_|w_g_F;%tnx6+0DB)<@ zt~LbvArIvqbywOui5<4ReoQY3`~vgGRa!Qewml=eU1>aRpCj;_s?i;2r@?VLrOm7~ zZV1bzZOu?dy#HrJ>~9D>LGH6RH+hlWmqnHrWxCEYXVW&_VGNq@9}hKHFdD(&^hw!= zzF-h-rwMr`p8Sk5OViUEJ?G9zk+UvrSx9GV*M5{UWBM;6rZd;IPfA!2B>^SmH>Lya A^Z)<= literal 0 HcmV?d00001 diff --git a/tests/pkg_cryptoauthlib_internal-tests/Makefile b/tests/pkg_cryptoauthlib_internal-tests/Makefile index 09ec1d9b34..61a9ae576f 100644 --- a/tests/pkg_cryptoauthlib_internal-tests/Makefile +++ b/tests/pkg_cryptoauthlib_internal-tests/Makefile @@ -2,6 +2,7 @@ BOARD ?= nucleo-f767zi include ../Makefile.tests_common +CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(3*THREAD_STACKSIZE_DEFAULT\) # Test fails to build for these boards fails due to # redefinition of define AES_COUNT in library, which # is also defined in board header files diff --git a/tests/pkg_cryptoauthlib_internal-tests/README.md b/tests/pkg_cryptoauthlib_internal-tests/README.md new file mode 100644 index 0000000000..142c511012 --- /dev/null +++ b/tests/pkg_cryptoauthlib_internal-tests/README.md @@ -0,0 +1,5 @@ +Tests provided by the cryptoauthlib driver +========================================== + +Some of the tests require the device config zone to be locked. +Test that require the use of key slots will fail, if the slot configuration differs from the default configuration. diff --git a/tests/pkg_cryptoauthlib_internal-tests/main.c b/tests/pkg_cryptoauthlib_internal-tests/main.c index 2377ebebf6..2974a3da0a 100644 --- a/tests/pkg_cryptoauthlib_internal-tests/main.c +++ b/tests/pkg_cryptoauthlib_internal-tests/main.c @@ -20,22 +20,29 @@ #include #include "cryptoauthlib_test.h" +#include "atca_test.h" + +const char atecc508[] = "ecc508"; +const char atecc608[] = "ecc608"; +const char unit[] = "basic"; int main(void) { + atca_test_config_set_ifacecfg((ATCAIfaceCfg *) &atca_params[0]); + /* Set device to ATECC508A */ if (ATCA_DEVTYPE == ATECC608A) { - atca_run_cmd("608"); + atca_run_cmd((char *) atecc608, sizeof(atecc608)); } else if (ATCA_DEVTYPE == ATECC508A) { - atca_run_cmd("508"); + atca_run_cmd((char *) atecc508, sizeof(atecc508)); } else { printf("This device is currently not supported."); return 0; } - atca_run_cmd("unit"); + atca_run_cmd((char *) unit, sizeof(unit)); return 0; }