diff --git a/benchmark/wh_bench.c b/benchmark/wh_bench.c index 63aa2fe0..3caeffda 100644 --- a/benchmark/wh_bench.c +++ b/benchmark/wh_bench.c @@ -562,6 +562,7 @@ int wh_Bench_ClientServer_Posix(void) { uint8_t req[BUFFER_SIZE] = {0}; uint8_t resp[BUFFER_SIZE] = {0}; + uint8_t memory[FLASH_RAM_SIZE] = {0}; /* Transport memory configuration */ whTransportMemConfig tmcf[1] = {{ @@ -601,6 +602,7 @@ int wh_Bench_ClientServer_Posix(void) .sectorSize = FLASH_RAM_SIZE / 2, .pageSize = 8, .erasedByte = (uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; @@ -679,4 +681,4 @@ int wh_Bench_ClientServer_Posix(void) #endif /* WOLFHSM_CFG_TEST_POSIX */ -#endif /* WOLFHSM_CFG_BENCH_ENABLE */ \ No newline at end of file +#endif /* WOLFHSM_CFG_BENCH_ENABLE */ diff --git a/examples/posix/tcp/wh_server_tcp/wh_server_tcp.c b/examples/posix/tcp/wh_server_tcp/wh_server_tcp.c index cbd53184..26ae2acf 100644 --- a/examples/posix/tcp/wh_server_tcp/wh_server_tcp.c +++ b/examples/posix/tcp/wh_server_tcp/wh_server_tcp.c @@ -607,6 +607,8 @@ int main(int argc, char** argv) const char* nvmInitFilePath = NULL; int keyId = WH_KEYID_ERASED; /* Default key ID if none provided */ int clientId = 12; /* Default client ID if none provided */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; + /* Parse command-line arguments */ for (int i = 1; i < argc; i++) { @@ -645,6 +647,7 @@ int main(int argc, char** argv) .sectorSize = FLASH_RAM_SIZE / 2, .pageSize = 8, .erasedByte = (uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; diff --git a/src/wh_flash_ramsim.c b/src/wh_flash_ramsim.c index 3f4b0e10..e364be99 100644 --- a/src/wh_flash_ramsim.c +++ b/src/wh_flash_ramsim.c @@ -26,7 +26,7 @@ #include #include /* For NULL */ -#include /* For malloc/free */ + #include #include @@ -59,21 +59,19 @@ int whFlashRamsim_Init(void* context, const void* config) const whFlashRamsimCfg* cfg = (const whFlashRamsimCfg*)config; if (ctx == NULL || cfg == NULL || (cfg->sectorSize == 0) || - (cfg->pageSize == 0) || (cfg->sectorSize % cfg->pageSize != 0)) { + (cfg->pageSize == 0) || (cfg->sectorSize % cfg->pageSize != 0) || + cfg->memory == NULL || cfg->size == 0) { return WH_ERROR_BADARGS; } + memset(ctx, 0, sizeof(*ctx)); ctx->size = cfg->size; ctx->sectorSize = cfg->sectorSize; ctx->pageSize = cfg->pageSize; - ctx->memory = (uint8_t*)malloc(ctx->size); + ctx->memory = cfg->memory; ctx->erasedByte = cfg->erasedByte; ctx->writeLocked = 0; - if (!ctx->memory) { - return WH_ERROR_BADARGS; - } - /* Initialize memory based on initData or simulate starting from erased flash */ if (cfg->initData != NULL) { memcpy(ctx->memory, cfg->initData, ctx->size); @@ -92,11 +90,6 @@ int whFlashRamsim_Cleanup(void* context) return WH_ERROR_BADARGS; } - if (ctx->memory != NULL) { - free(ctx->memory); - ctx->memory = NULL; - } - return WH_ERROR_OK; } diff --git a/src/wh_nvm_flash.c b/src/wh_nvm_flash.c index 04a1c1a2..2df53e72 100644 --- a/src/wh_nvm_flash.c +++ b/src/wh_nvm_flash.c @@ -121,8 +121,8 @@ static int nfPartition_CheckDataRange(whNvmFlashContext* context, uint32_t byte_offset, uint32_t byte_count); -static uint32_t nfObject_Offset(whNvmFlashContext* context, int partition, - int object_index); +static int nfObject_Offset(whNvmFlashContext* context, int partition, + int object_index, uint32_t *out_object_offset); static int nfObject_ProgramBegin(whNvmFlashContext* context, int partition, int object_index, uint32_t epoch, uint32_t start, whNvmMetadata* meta); static int nfObject_ProgramDataBytes(whNvmFlashContext* context, int partition, @@ -512,16 +512,19 @@ static int nfPartition_CheckDataRange(whNvmFlashContext* context, return WH_ERROR_OK; } -static uint32_t nfObject_Offset(whNvmFlashContext* context, int partition, - int object_index) +static int nfObject_Offset(whNvmFlashContext* context, int partition, + int object_index, uint32_t *out_object_offset) { - if (context == NULL) { + if (context == NULL || out_object_offset == NULL) { return WH_ERROR_BADARGS; } - return nfPartition_Offset(context,partition) + - NF_PARTITION_DIRECTORY_OFFSET + - NF_DIRECTORY_OBJECT_OFFSET(object_index); + + *out_object_offset = nfPartition_Offset(context,partition) + + NF_PARTITION_DIRECTORY_OFFSET + + NF_DIRECTORY_OBJECT_OFFSET(object_index); + + return WH_ERROR_OK; } static int nfObject_ProgramBegin(whNvmFlashContext* context, int partition, @@ -539,7 +542,10 @@ static int nfObject_ProgramBegin(whNvmFlashContext* context, int partition, return WH_ERROR_BADARGS; } - object_offset = nfObject_Offset(context, partition, object_index); + rc = nfObject_Offset(context, partition, object_index, &object_offset); + if (rc != WH_ERROR_OK) { + return rc; + } /* Program the object epoch */ rc = wh_FlashUnit_Program( @@ -601,6 +607,7 @@ static int nfObject_ProgramDataBytes(whNvmFlashContext* context, int partition, static int nfObject_ProgramFinish(whNvmFlashContext* context, int partition, int object_index, uint32_t byte_count) { + int rc; uint32_t object_offset = 0; whFlashUnit state_count = BASE_STATE | WHFU_BYTES2UNITS(byte_count); @@ -608,7 +615,10 @@ static int nfObject_ProgramFinish(whNvmFlashContext* context, int partition, return WH_ERROR_BADARGS; } - object_offset = nfObject_Offset(context, partition, object_index); + rc = nfObject_Offset(context, partition, object_index, &object_offset); + if (rc != WH_ERROR_OK) { + return rc; + } /* Program the object flag->state_count */ return wh_FlashUnit_Program( diff --git a/test/wh_test_cert.c b/test/wh_test_cert.c index 3950b89a..4a3a2aa5 100644 --- a/test/wh_test_cert.c +++ b/test/wh_test_cert.c @@ -53,6 +53,10 @@ static int whTest_CertNonExportable(whClientContext* client); #endif +#define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */ +#define FLASH_SECTOR_SIZE (128 * 1024) /* 128KB */ +#define FLASH_PAGE_SIZE (8) /* 8B */ + #ifdef WOLFHSM_CFG_ENABLE_SERVER /* Run certificate configuration tests */ int whTest_CertServerCfg(whServerConfig* serverCfg) @@ -599,12 +603,14 @@ int whTest_CertRamSim(void) .server_id = 124, }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ - .size = 1024 * 1024, /* 1MB Flash */ - .sectorSize = 128 * 1024, /* 128KB Sector Size */ - .pageSize = 8, /* 8B Page Size */ + .size = FLASH_RAM_SIZE, /* 1MB Flash */ + .sectorSize = FLASH_SECTOR_SIZE, /* 128KB Sector Size */ + .pageSize = FLASH_PAGE_SIZE, /* 8B Page Size */ .erasedByte = ~(uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; diff --git a/test/wh_test_clientserver.c b/test/wh_test_clientserver.c index 9e218eda..8e953f61 100644 --- a/test/wh_test_clientserver.c +++ b/test/wh_test_clientserver.c @@ -61,6 +61,8 @@ #define REPEAT_COUNT 10 #define ONE_MS 1000 #define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */ +#define FLASH_SECTOR_SIZE (128 * 1024) /* 128KB */ +#define FLASH_PAGE_SIZE (8) /* 8B */ #ifdef WOLFHSM_CFG_DMA #define DMA_TEST_MEM_NWORDS 3 @@ -708,12 +710,14 @@ int whTest_ClientServerSequential(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ - .size = 1024 * 1024, /* 1MB Flash */ - .sectorSize = 128 * 1024, /* 128KB Sector Size */ - .pageSize = 8, /* 8B Page Size */ + .size = FLASH_RAM_SIZE, /* 1MB Flash */ + .sectorSize = FLASH_SECTOR_SIZE, /* 128KB Sector Size */ + .pageSize = FLASH_PAGE_SIZE, /* 8B Page Size */ .erasedByte = ~(uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; @@ -1734,12 +1738,14 @@ static int wh_ClientServer_MemThreadTest(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ .size = FLASH_RAM_SIZE, .sectorSize = FLASH_RAM_SIZE/2, .pageSize = 8, .erasedByte = (uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; @@ -1825,12 +1831,14 @@ static int wh_ClientServer_PosixMemMapThreadTest(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ .size = FLASH_RAM_SIZE, .sectorSize = FLASH_RAM_SIZE / 2, .pageSize = 8, .erasedByte = (uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; diff --git a/test/wh_test_crypto.c b/test/wh_test_crypto.c index f90ba44d..37f307ca 100644 --- a/test/wh_test_crypto.c +++ b/test/wh_test_crypto.c @@ -64,6 +64,10 @@ #include "port/posix/posix_flash_file.h" #endif +#define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */ +#define FLASH_SECTOR_SIZE (128 * 1024) /* 128KB */ +#define FLASH_PAGE_SIZE (8) /* 8B */ + enum { /* Total size needs to fit: * - Transport CSR (whTransportMemCsr) @@ -3028,12 +3032,14 @@ static int wh_ClientServer_MemThreadTest(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ - .size = 1024 * 1024, /* 1MB Flash */ - .sectorSize = 128 * 1024, /* 128KB Sector Size */ - .pageSize = 8, /* 8B Page Size */ + .size = FLASH_RAM_SIZE, /* 1MB Flash */ + .sectorSize = FLASH_SECTOR_SIZE, /* 128KB Sector Size */ + .pageSize = FLASH_PAGE_SIZE, /* 8B Page Size */ .erasedByte = ~(uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; diff --git a/test/wh_test_flash_ramsim.c b/test/wh_test_flash_ramsim.c index adb6c95c..bec38e65 100644 --- a/test/wh_test_flash_ramsim.c +++ b/test/wh_test_flash_ramsim.c @@ -62,10 +62,13 @@ int whTest_Flash_RamSim(void) { int ret; whFlashRamsimCtx ctx; + uint8_t memory[TEST_FLASH_SIZE] = {0}; whFlashRamsimCfg cfg = {.size = TEST_FLASH_SIZE, .sectorSize = TEST_SECTOR_SIZE, .pageSize = TEST_PAGE_SIZE, - .erasedByte = 0xFF}; + .erasedByte = 0xFF, + .memory = memory, + }; uint8_t testData[TEST_PAGE_SIZE] = {0}; uint8_t readData[TEST_PAGE_SIZE] = {0}; @@ -201,4 +204,4 @@ int whTest_Flash_RamSim(void) return 0; } -#endif /* WOLFHSM_CFG_ENABLE_SERVER */ \ No newline at end of file +#endif /* WOLFHSM_CFG_ENABLE_SERVER */ diff --git a/test/wh_test_nvm_flash.c b/test/wh_test_nvm_flash.c index 6c2ec5da..2f83934a 100644 --- a/test/wh_test_nvm_flash.c +++ b/test/wh_test_nvm_flash.c @@ -41,6 +41,10 @@ #include "port/posix/posix_flash_file.h" #endif +#define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */ +#define FLASH_SECTOR_SIZE (4096) /* 4KB */ +#define FLASH_PAGE_SIZE (8) /* 8B */ + #if defined(WOLFHSM_CFG_TEST_VERBOSE) static void _HexDump(const char* p, size_t data_len) { @@ -469,13 +473,15 @@ int whTest_NvmFlashCfg(whNvmFlashConfig* cfg) int whTest_NvmFlash_RamSim(void) { /* HAL Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; const whFlashCb myCb[1] = {WH_FLASH_RAMSIM_CB}; whFlashRamsimCtx myHalFlashCtx[1] = {0}; whFlashRamsimCfg myHalFlashCfg[1] = {{ - .size = 1024 * 1024, /* 1MB Flash */ - .sectorSize = 4096, /* 4KB Sector Size */ - .pageSize = 8, /* 8B Page Size */ + .size = FLASH_RAM_SIZE, /* 1MB Flash */ + .sectorSize = FLASH_SECTOR_SIZE, /* 4KB Sector Size */ + .pageSize = FLASH_PAGE_SIZE, /* 8B Page Size */ .erasedByte = (uint8_t)0, + .memory = memory, }}; WH_TEST_RETURN_ON_FAIL(whTest_Flash(myCb, myHalFlashCtx, myHalFlashCfg)); @@ -538,4 +544,4 @@ int whTest_NvmFlash(void) return 0; } -#endif /* WOLFHSM_CFG_ENABLE_SERVER */ \ No newline at end of file +#endif /* WOLFHSM_CFG_ENABLE_SERVER */ diff --git a/test/wh_test_server_img_mgr.c b/test/wh_test_server_img_mgr.c index f901b58d..45b50d4b 100644 --- a/test/wh_test_server_img_mgr.c +++ b/test/wh_test_server_img_mgr.c @@ -54,6 +54,10 @@ #include "wh_test_common.h" +#define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */ +#define FLASH_SECTOR_SIZE (128 * 1024) /* 128KB */ +#define FLASH_PAGE_SIZE (8) /* 8B */ + /* Test data to be "verified" */ static const uint8_t testData[] = { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, @@ -1214,12 +1218,14 @@ int whTest_ServerImgMgr(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ - .size = 1024 * 1024, /* 1MB Flash */ - .sectorSize = 128 * 1024, /* 128KB Sector Size */ - .pageSize = 8, /* 8B Page Size */ + .size = FLASH_RAM_SIZE, /* 1MB Flash */ + .sectorSize = FLASH_SECTOR_SIZE, /* 128KB Sector Size */ + .pageSize = FLASH_PAGE_SIZE, /* 8B Page Size */ .erasedByte = ~(uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; @@ -1297,4 +1303,4 @@ int whTest_ServerImgMgr(void) #endif /* WOLFHSM_CFG_NO_CRYPTO */ #endif /* WOLFHSM_CFG_SERVER_IMG_MGR && WOLFHSM_CFG_ENABLE_SERVER && - !WOLFHSM_CFG_NO_CRYPTO */ \ No newline at end of file + !WOLFHSM_CFG_NO_CRYPTO */ diff --git a/test/wh_test_she.c b/test/wh_test_she.c index 171de40f..7e577782 100644 --- a/test/wh_test_she.c +++ b/test/wh_test_she.c @@ -77,6 +77,10 @@ enum { BUFFER_SIZE = 4096, }; +#define FLASH_RAM_SIZE (1024 * 1024) /* 1MB */ +#define FLASH_SECTOR_SIZE (128 * 1024) /* 128KB */ +#define FLASH_PAGE_SIZE (8) /* 8B */ + #ifdef WOLFHSM_CFG_ENABLE_CLIENT /* Helper function to destroy a SHE key so the unit tests don't * leak NVM objects across invocations. Necessary, as SHE doesn't expose a @@ -535,12 +539,14 @@ static int wh_ClientServer_MemThreadTest(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ - .size = 1024 * 1024, /* 1MB Flash */ - .sectorSize = 128 * 1024, /* 128KB Sector Size */ - .pageSize = 8, /* 8B Page Size */ + .size = FLASH_RAM_SIZE, /* 1MB Flash */ + .sectorSize = FLASH_SECTOR_SIZE, /* 128KB Sector Size */ + .pageSize = FLASH_PAGE_SIZE, /* 8B Page Size */ .erasedByte = ~(uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; diff --git a/test/wh_test_wolfcrypt_test.c b/test/wh_test_wolfcrypt_test.c index 8fba34d1..6eae7a62 100644 --- a/test/wh_test_wolfcrypt_test.c +++ b/test/wh_test_wolfcrypt_test.c @@ -205,12 +205,14 @@ static int wh_ClientServer_MemThreadTest(void) }}; /* RamSim Flash state and configuration */ + uint8_t memory[FLASH_RAM_SIZE] = {0}; whFlashRamsimCtx fc[1] = {0}; whFlashRamsimCfg fc_conf[1] = {{ .size = FLASH_RAM_SIZE, .sectorSize = FLASH_RAM_SIZE / 2, .pageSize = 8, .erasedByte = (uint8_t)0, + .memory = memory, }}; const whFlashCb fcb[1] = {WH_FLASH_RAMSIM_CB}; diff --git a/tools/whnvmtool/test/test_whnvmtool.c b/tools/whnvmtool/test/test_whnvmtool.c index d766fd34..da550884 100644 --- a/tools/whnvmtool/test/test_whnvmtool.c +++ b/tools/whnvmtool/test/test_whnvmtool.c @@ -79,6 +79,7 @@ whCommServerConfig gCommServerConfig[1] = {{ /* Global NVM Configurations that should be checked */ /* RamSim Flash state and configuration */ +uint8_t memory[FLASH_PARTITION_SIZE * 2] = {0}; whFlashRamsimCtx gFlashRamsimContext[1] = {0}; whFlashRamsimCfg gFlashRamsimConfig[1] = {{ .size = FLASH_PARTITION_SIZE * 2, @@ -86,6 +87,7 @@ whFlashRamsimCfg gFlashRamsimConfig[1] = {{ .pageSize = 8, .erasedByte = FLASH_ERASED_BYTE, .initData = NULL, /* Init data will be set dynamically */ + .memory = memory, }}; const whFlashCb gFlashRamsimCb[1] = {WH_FLASH_RAMSIM_CB}; #define INIT_RAMSIM_NVM_FLASH_CONFIG \ diff --git a/wolfhsm/wh_flash_ramsim.h b/wolfhsm/wh_flash_ramsim.h index 562e4c35..501ab1f1 100644 --- a/wolfhsm/wh_flash_ramsim.h +++ b/wolfhsm/wh_flash_ramsim.h @@ -26,6 +26,7 @@ /* Configuration and context structures */ typedef struct { + uint8_t* memory; uint32_t size; uint32_t sectorSize; uint32_t pageSize; diff --git a/wolfhsm/wh_message_she.h b/wolfhsm/wh_message_she.h index ad3e0879..0e28ee78 100644 --- a/wolfhsm/wh_message_she.h +++ b/wolfhsm/wh_message_she.h @@ -43,7 +43,7 @@ typedef struct { /* Set UID Response */ typedef struct { - uint32_t rc; + int32_t rc; uint8_t WH_PAD[4]; } whMessageShe_SetUidResponse; @@ -64,8 +64,8 @@ typedef struct { /* Secure Boot Init Response */ typedef struct { - uint32_t rc; - uint32_t status; + int32_t rc; + int32_t status; } whMessageShe_SecureBootInitResponse; /* Secure Boot Init translation functions */ @@ -88,8 +88,8 @@ typedef struct { /* Secure Boot Update Response */ typedef struct { - uint32_t rc; - uint32_t status; + int32_t rc; + int32_t status; } whMessageShe_SecureBootUpdateResponse; /* Secure Boot Update translation functions */ @@ -103,8 +103,8 @@ int wh_MessageShe_TranslateSecureBootUpdateResponse( /* Secure Boot Finish Response */ typedef struct { - uint32_t rc; - uint32_t status; + int32_t rc; + int32_t status; } whMessageShe_SecureBootFinishResponse; /* Secure Boot Finish translation function */ @@ -114,7 +114,7 @@ int wh_MessageShe_TranslateSecureBootFinishResponse( /* Get Status Response */ typedef struct { - uint32_t rc; + int32_t rc; uint8_t sreg; uint8_t WH_PAD[7]; } whMessageShe_GetStatusResponse; @@ -133,7 +133,7 @@ typedef struct { /* Load Key Response */ typedef struct { - uint32_t rc; + int32_t rc; uint8_t messageFour[WH_SHE_M4_SZ]; uint8_t messageFive[WH_SHE_M5_SZ]; } whMessageShe_LoadKeyResponse; @@ -154,7 +154,7 @@ typedef struct { /* Load Plain Key Response */ typedef struct { - uint32_t rc; + int32_t rc; } whMessageShe_LoadPlainKeyResponse; /* Load Plain Key translation function */ @@ -168,7 +168,7 @@ int wh_MessageShe_TranslateLoadPlainKeyResponse( /* Export RAM Key Response */ typedef struct { - uint32_t rc; + int32_t rc; uint8_t messageOne[WH_SHE_M1_SZ]; uint8_t messageTwo[WH_SHE_M2_SZ]; uint8_t messageThree[WH_SHE_M3_SZ]; @@ -183,8 +183,8 @@ int wh_MessageShe_TranslateExportRamKeyResponse( /* Init RNG Response */ typedef struct { - uint32_t rc; - uint32_t status; + int32_t rc; + int32_t status; } whMessageShe_InitRngResponse; /* Init RNG translation function */ @@ -194,7 +194,7 @@ int wh_MessageShe_TranslateInitRngResponse( /* RND Response */ typedef struct { - uint32_t rc; + int32_t rc; uint8_t rnd[WH_SHE_KEY_SZ]; } whMessageShe_RndResponse; @@ -210,8 +210,8 @@ typedef struct { /* Extend Seed Response */ typedef struct { - uint32_t rc; - uint32_t status; + int32_t rc; + int32_t status; } whMessageShe_ExtendSeedResponse; /* Extend Seed translation functions */ @@ -235,7 +235,7 @@ typedef struct { /* Encrypt ECB Response */ typedef struct { - uint32_t rc; + int32_t rc; uint32_t sz; /* Data follows: * uint8_t out[sz] @@ -264,7 +264,7 @@ typedef struct { /* Encrypt CBC Response */ typedef struct { - uint32_t rc; + int32_t rc; uint32_t sz; /* Data follows: * uint8_t out[sz] @@ -292,7 +292,7 @@ typedef struct { /* Decrypt ECB Response */ typedef struct { - uint32_t rc; + int32_t rc; uint32_t sz; /* Data follows: * uint8_t out[sz] @@ -321,7 +321,7 @@ typedef struct { /* Decrypt CBC Response */ typedef struct { - uint32_t rc; + int32_t rc; uint32_t sz; /* Data follows: * uint8_t out[sz] @@ -348,7 +348,7 @@ typedef struct { /* Generate MAC Response */ typedef struct { - uint32_t rc; + int32_t rc; uint8_t mac[WH_SHE_KEY_SZ]; } whMessageShe_GenMacResponse; @@ -375,8 +375,8 @@ typedef struct { /* Verify MAC Response */ typedef struct { - uint32_t rc; - uint8_t status; + int32_t rc; + int8_t status; uint8_t WH_PAD[7]; } whMessageShe_VerifyMacResponse; @@ -391,4 +391,4 @@ int wh_MessageShe_TranslateVerifyMacResponse( #endif /* WOLFHSM_CFG_SHE_EXTENSION */ -#endif /* !WOLFHSM_WH_MESSAGE_SHE_H_ */ \ No newline at end of file +#endif /* !WOLFHSM_WH_MESSAGE_SHE_H_ */