Skip to content

Commit a48a0e5

Browse files
committed
support AURIX hw accel
1 parent 2869d41 commit a48a0e5

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

arch.mk

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,15 +1633,13 @@ ifeq ($(ARCH), AURIX_TC3)
16331633
$(WOLFHSM_INFINEON_TC3XX)/port/server/io.o \
16341634
$(WOLFHSM_INFINEON_TC3XX)/port/server/sysmem.o \
16351635
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_hh_hsm.o \
1636-
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_utils.o
1637-
1638-
# SW only for now, as we dont have the right protection macros
1639-
#$(WOLFHSM_INFINEON_TC3XX)/port/server/ccb_hsm.o \
1640-
#$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_hash.o \
1641-
#$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_aes.o \
1642-
#$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_cmac.o \
1643-
#$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_pk.o \
1644-
#$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_trng.o
1636+
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_utils.o\
1637+
$(WOLFHSM_INFINEON_TC3XX)/port/server/ccb_hsm.o \
1638+
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_hash.o \
1639+
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_aes.o \
1640+
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_cmac.o \
1641+
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_pk.o \
1642+
$(WOLFHSM_INFINEON_TC3XX)/port/server/tchsm_trng.o
16451643
endif
16461644

16471645
# HSM BSP specific object files

hal/aurix_tc3xx.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#include "wolfhsm/wh_nvm_flash.h"
6969
#include "tchsm_hh_hsm.h"
7070
#include "port_halflash_df1.h"
71-
71+
#include "ccb_hsm.h"
7272
#endif
7373

7474
#endif /* WOLFBOOT_ENABLE_WOLFHSM_CLIENT || WOLFBOOT_ENABLE_WOLFHSM_SERVER */
@@ -117,8 +117,8 @@ const whNvmId hsmNvmIdCertRootCA = 1;
117117
#elif defined(WOLFBOOT_ENABLE_WOLFHSM_SERVER) /*WOLFBOOT_ENABLE_WOLFHSM_CLIENT*/
118118

119119
/* map wolfBoot HAL layer wofHSM exports to their tchsm config vals */
120-
const int hsmDevIdHash = INVALID_DEVID; /*HSM_DEVID once CCB enabled*/
121-
const int hsmDevIdPubKey = INVALID_DEVID; /*HSM_DEVID once CCB enabled*/
120+
const int hsmDevIdHash = HSM_DEVID;
121+
const int hsmDevIdPubKey = HSM_DEVID;
122122
const whNvmId hsmNvmIdCertRootCA = 1;
123123
#ifdef EXT_ENCRYPT
124124
#error "AURIX does not support firmware encryption with wolfHSM(yet)"
@@ -860,7 +860,7 @@ int hal_hsm_server_init(void)
860860
.comm_config = commServerConfig,
861861
.nvm = nvmCtx,
862862
.crypto = cryptoCtx,
863-
.devId = INVALID_DEVID, /*HSM_DEVID once CCB enabled */
863+
.devId = HSM_DEVID,
864864
}};
865865

866866
rc = wh_Nvm_Init(nvmCtx, nvmCfg);
@@ -869,6 +869,12 @@ int hal_hsm_server_init(void)
869869
}
870870

871871
(void)wolfCrypt_Init();
872+
rc = wc_CryptoCb_RegisterDevice(HSM_DEVID, hsmCryptoCb, NULL);
873+
if (rc != 0) {
874+
wolfBoot_printf(
875+
"[ERROR] cryptocb registration for HASH failed, rc=%d\n", rc);
876+
wolfBoot_panic();
877+
}
872878

873879
rc = wc_InitRng_ex(cryptoCtx->rng, NULL, INVALID_DEVID);
874880
if (rc != WH_ERROR_OK) {

0 commit comments

Comments
 (0)