Skip to content

Commit a75df8b

Browse files
committed
Final cleanups. Will rebase.
1 parent 26e5adc commit a75df8b

File tree

5 files changed

+23
-37
lines changed

5 files changed

+23
-37
lines changed

src/wh_flash_ramsim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int whFlashRamsim_Cleanup(void* context)
9999

100100
return WH_ERROR_OK;
101101
}
102-
#include <stdio.h>
102+
103103
int whFlashRamsim_Program(void* context, uint32_t offset, uint32_t size,
104104
const uint8_t* data)
105105
{

src/wh_server_crypto.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,9 @@ int wh_Server_CacheImportCurve25519Key(whServerContext* server,
453453
whNvmMetadata* cacheMeta;
454454
int ret;
455455

456-
#ifndef CURVE25519_MAX_KEY_TO_DER_SZ
457-
#define CURVE25519_MAX_KEY_TO_DER_SZ 128
458-
#endif
459-
uint8_t der_buf[CURVE25519_MAX_KEY_TO_DER_SZ];
460-
uint16_t keySz = sizeof(der_buf);
456+
/* CURVE2219_MAX_KEY_TO_DER_SZ should be 82 */
457+
uint8_t der_buf[CURVE25519_MAX_KEY_TO_DER_SZ];
458+
uint16_t keySz = sizeof(der_buf);
461459

462460

463461
if ((server == NULL) || (key == NULL) || (WH_KEYID_ISERASED(keyId)) ||

test/wh_test.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ int whTest_Unit(void)
6464
WH_TEST_ASSERT(0 == whTest_Comm());
6565
WH_TEST_ASSERT(0 == whTest_ClientServer());
6666

67-
/* TEMP Force flush out put streams */
68-
fflush(NULL);
69-
/* TEMP End */
70-
7167
#ifndef WOLFHSM_CFG_NO_CRYPTO
7268
/* Crypto Tests */
7369
WH_TEST_ASSERT(0 == whTest_Crypto());

test/wh_test_crypto.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,7 +2199,6 @@ int whTest_CryptoClientConfig(whClientConfig* config)
21992199
}
22002200

22012201
WH_TEST_RETURN_ON_FAIL(wh_Client_Init(client, config));
2202-
printf("%s:%u Ret:%d\n", __func__, __LINE__, ret);
22032202

22042203
ret = wh_Client_CommInit(client, NULL, NULL);
22052204
if (ret != 0) {
@@ -2226,7 +2225,6 @@ int whTest_CryptoClientConfig(whClientConfig* config)
22262225
ret = whTestCrypto_Aes(client, WH_DEV_ID, rng);
22272226
}
22282227
#endif /* !NO_AES */
2229-
printf("%s:%u Ret:%d\n", __func__, __LINE__, ret);
22302228

22312229
#if defined(WOLFSSL_CMAC) && !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT)
22322230
i = 0;
@@ -2249,7 +2247,6 @@ int whTest_CryptoClientConfig(whClientConfig* config)
22492247
ret = whTest_CryptoEcc(client, WH_DEV_ID, rng);
22502248
}
22512249
#endif /* HAVE_ECC */
2252-
printf("%s:%u Ret:%d\n", __func__, __LINE__, ret);
22532250

22542251
#ifdef HAVE_CURVE25519
22552252
/* test curve25519 */
@@ -2288,7 +2285,6 @@ int whTest_CryptoClientConfig(whClientConfig* config)
22882285
i++;
22892286
}
22902287
}
2291-
printf("%s:%u Ret:%d\n", __func__, __LINE__, ret);
22922288

22932289
#ifdef WOLFHSM_CFG_DMA
22942290
if (ret == 0) {
@@ -2323,8 +2319,6 @@ int whTest_CryptoClientConfig(whClientConfig* config)
23232319
(void)wh_Client_CommClose(client);
23242320
(void)wh_Client_Cleanup(client);
23252321

2326-
printf("%s:%u Final Ret:%d\n", __func__, __LINE__, ret);
2327-
fflush(NULL);
23282322
return ret;
23292323
}
23302324
#ifndef NO_WOLFHSM_CFG_TEST_CRYPTSVR_CFG

wolfhsm/wh_error.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,29 @@ enum WH_ERROR_ENUM {
4040
WH_ERROR_CERT_VERIFY = -2005, /* Certificate verification failed */
4141
WH_ERROR_BUFFER_SIZE = -2006, /* Generic buffer size mismatch. Buffer
4242
* length is not what was expected */
43+
WH_ERROR_NOHANDLER = -2007, /* No customcb handler registered */
4344

4445
/* NVM-specific status returns */
45-
WH_ERROR_LOCKED = -2010, /* Unlock and retry if necessary */
46-
WH_ERROR_ACCESS = -2011, /* Update access and retry */
47-
WH_ERROR_NOTVERIFIED = -2012, /* Backing store does not match */
48-
WH_ERROR_NOTBLANK = -2013, /* Area is no blank */
49-
WH_ERROR_NOTFOUND = -2014, /* Matching object not found */
50-
WH_ERROR_NOSPACE = -2015, /* No available space */
51-
52-
/* Custom-callback status returns */
53-
WH_ERROR_NOHANDLER = -2020, /* No handler registered for action */
46+
WH_ERROR_LOCKED = -2100, /* Unlock and retry if necessary */
47+
WH_ERROR_ACCESS = -2101, /* Update access and retry */
48+
WH_ERROR_NOTVERIFIED = -2102, /* Backing store does not match */
49+
WH_ERROR_NOTBLANK = -2103, /* Area is no blank */
50+
WH_ERROR_NOTFOUND = -2104, /* Matching object not found */
51+
WH_ERROR_NOSPACE = -2105, /* No available space */
5452

5553
/* SHE-specific error codes */
56-
WH_SHE_ERC_SEQUENCE_ERROR = -2100,
57-
WH_SHE_ERC_KEY_NOT_AVAILABLE = -2101,
58-
WH_SHE_ERC_KEY_INVALID = -2102,
59-
WH_SHE_ERC_KEY_EMPTY = -2103,
60-
WH_SHE_ERC_NO_SECURE_BOOT = -2104,
61-
WH_SHE_ERC_WRITE_PROTECTED = -2105,
62-
WH_SHE_ERC_KEY_UPDATE_ERROR = -2106,
63-
WH_SHE_ERC_RNG_SEED = -2107,
64-
WH_SHE_ERC_NO_DEBUGGING = -2108,
65-
WH_SHE_ERC_BUSY = -2109,
66-
WH_SHE_ERC_MEMORY_FAILURE = -2110,
67-
WH_SHE_ERC_GENERAL_ERROR = -2111,
54+
WH_SHE_ERC_SEQUENCE_ERROR = -2200,
55+
WH_SHE_ERC_KEY_NOT_AVAILABLE = -2201,
56+
WH_SHE_ERC_KEY_INVALID = -2202,
57+
WH_SHE_ERC_KEY_EMPTY = -2203,
58+
WH_SHE_ERC_NO_SECURE_BOOT = -2204,
59+
WH_SHE_ERC_WRITE_PROTECTED = -2205,
60+
WH_SHE_ERC_KEY_UPDATE_ERROR = -2206,
61+
WH_SHE_ERC_RNG_SEED = -2207,
62+
WH_SHE_ERC_NO_DEBUGGING = -2208,
63+
WH_SHE_ERC_BUSY = -2209,
64+
WH_SHE_ERC_MEMORY_FAILURE = -2210,
65+
WH_SHE_ERC_GENERAL_ERROR = -2211,
6866
};
6967

7068
#define WH_SHE_ERC_NO_ERROR WH_ERROR_OK

0 commit comments

Comments
 (0)