From bd13216921bd6411fb194ba6fed0403ff668f7fa Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:40:40 -0600 Subject: [PATCH 1/8] passing unit tests with new Curve25519 unified funcitons --- src/wh_client_crypto.c | 10 +++----- src/wh_crypto.c | 55 ++++++++++++++++++++++++++++++++++++++++-- src/wh_server_crypto.c | 25 ++++++++++--------- wolfhsm/wh_crypto.h | 14 ++++++++--- 4 files changed, 80 insertions(+), 24 deletions(-) diff --git a/src/wh_client_crypto.c b/src/wh_client_crypto.c index 17f7544..04c2a7b 100644 --- a/src/wh_client_crypto.c +++ b/src/wh_client_crypto.c @@ -1185,8 +1185,8 @@ int wh_Client_Curve25519ImportKey(whClientContext* ctx, curve25519_key* key, key_id = *inout_keyId; } - ret = wh_Crypto_Curve25519SerializeKey(key, sizeof(buffer),buffer, - &buffer_len); + buffer_len = sizeof(buffer); + ret = wh_Crypto_Curve25519SerializeKey(key, buffer, &buffer_len); if (ret == 0) { /* Cache the key and get the keyID */ ret = wh_Client_KeyCache(ctx, @@ -1220,8 +1220,7 @@ int wh_Client_Curve25519ExportKey(whClientContext* ctx, whKeyId keyId, buffer, &buffer_len); if (ret == 0) { /* Update the key structure */ - ret = wh_Crypto_Curve25519DeserializeKey( - buffer_len, buffer, key); + ret = wh_Crypto_Curve25519DeserializeKey(buffer, buffer_len, key); } return ret; @@ -1311,8 +1310,7 @@ static int _Curve25519MakeKey(whClientContext* ctx, if (flags & WH_NVM_FLAGS_EPHEMERAL) { /* Response has the exported key */ - ret = wh_Crypto_Curve25519DeserializeKey( - der_size, key_der, key); + ret = wh_Crypto_Curve25519DeserializeKey(key_der, der_size, key); #ifdef DEBUG_CRYPTOCB_VERBOSE wh_Utils_Hexdump("[client] KeyGen export:", key_der, der_size); #endif diff --git a/src/wh_crypto.c b/src/wh_crypto.c index aa19128..e0201b2 100644 --- a/src/wh_crypto.c +++ b/src/wh_crypto.c @@ -36,6 +36,7 @@ #include "wolfssl/wolfcrypt/types.h" #include "wolfssl/wolfcrypt/error-crypt.h" #include "wolfssl/wolfcrypt/asn.h" +#include "wolfssl/wolfcrypt/asn_public.h" #include "wolfssl/wolfcrypt/rsa.h" #include "wolfssl/wolfcrypt/curve25519.h" #include "wolfssl/wolfcrypt/ecc.h" @@ -207,7 +208,57 @@ int wh_Crypto_EccUpdatePrivateOnlyKeyDer(ecc_key* key, uint16_t pub_size, #endif /* HAVE_ECC */ #ifdef HAVE_CURVE25519 - int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, + +#ifdef HAVE_CURVE25519 +#ifdef HAVE_CURVE25519_KEY_IMPORT +WOLFSSL_API int wc_Curve25519PrivateKeyDecode( + const byte* input, word32* inOutIdx, curve25519_key* key, word32 inSz); +WOLFSSL_API int wc_Curve25519PublicKeyDecode( + const byte* input, word32* inOutIdx, curve25519_key* key, word32 inSz); +#endif +#ifdef HAVE_CURVE25519_KEY_EXPORT +WOLFSSL_API int wc_Curve25519PrivateKeyToDer( + curve25519_key* key, byte* output, word32 inLen); +WOLFSSL_API int wc_Curve25519PublicKeyToDer( + curve25519_key* key, byte* output, word32 inLen, int withAlg); +#endif +#endif /* HAVE_CURVE25519 */ + + +/* TODO make input key const */ +int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, + uint16_t* derSize) +{ + int ret = 0; + + if ((key == NULL) || (buffer == NULL) || (derSize == NULL)) { + return WH_ERROR_BADARGS; + } + + ret = wc_Curve25519KeyToDer(key, buffer, *derSize, 0); + + /* ASN.1 functions return the size of the DER encoded key on success */ + if (ret > 0) { + *derSize = ret; + ret = WH_ERROR_OK; + } + return ret; +} + +int wh_Crypto_Curve25519DeserializeKey(const uint8_t* derBuffer, + uint16_t derSize, curve25519_key* key) +{ + int ret = WH_ERROR_OK; + word32 idx = 0; + + if ((derBuffer == NULL) || (key == NULL)) { + return WH_ERROR_BADARGS; + } + + return wc_Curve25519KeyDecode(derBuffer, &idx, key, derSize); +} + +int wh_Crypto_Curve25519SerializeKeyRaw(curve25519_key* key, uint16_t max_size, uint8_t* buffer, uint16_t *out_size) { int ret = 0; @@ -229,7 +280,7 @@ int wh_Crypto_EccUpdatePrivateOnlyKeyDer(ecc_key* key, uint16_t pub_size, return ret; } -int wh_Crypto_Curve25519DeserializeKey(uint16_t size, +int wh_Crypto_Curve25519DeserializeKeyRaw(uint16_t size, const uint8_t* buffer, curve25519_key* key) { int ret = 0; diff --git a/src/wh_server_crypto.c b/src/wh_server_crypto.c index d1c9b0a..0e28c6c 100644 --- a/src/wh_server_crypto.c +++ b/src/wh_server_crypto.c @@ -436,8 +436,9 @@ int wh_Server_CacheImportCurve25519Key(whServerContext* server, uint8_t* cacheBuf; whNvmMetadata* cacheMeta; int ret; - const uint16_t keySz = CURVE25519_KEYSIZE * 2; - uint16_t size = 0; + /* TODO: This should be enough, but does wolfCrypt have a macro for the max + * size of DER encoded key? Can we just use ECC? */ + uint16_t keySz = CURVE25519_KEYSIZE * 4; if ( (server == NULL) || (key == NULL) || @@ -447,15 +448,16 @@ int wh_Server_CacheImportCurve25519Key(whServerContext* server, } /* get a free slot */ + /* TODO: Should we serialize first, to get the size up front? */ ret = hsmCacheFindSlotAndZero(server, keySz, &cacheBuf, &cacheMeta); if (ret == 0) { - ret = wh_Crypto_Curve25519SerializeKey(key, keySz, cacheBuf, &size); + ret = wh_Crypto_Curve25519SerializeKey(key, cacheBuf, &keySz); } if (ret == 0) { /* set meta */ cacheMeta->id = keyId; - cacheMeta->len = size; + cacheMeta->len = keySz; cacheMeta->flags = flags; cacheMeta->access = WH_NVM_ACCESS_ANY; @@ -483,7 +485,7 @@ int wh_Server_CacheExportCurve25519Key(whServerContext* server, whKeyId keyId, ret = hsmFreshenKey(server, keyId, &cacheBuf, &cacheMeta); if (ret == 0) { - ret = wh_Crypto_Curve25519DeserializeKey(cacheMeta->len, cacheBuf, key); + ret = wh_Crypto_Curve25519DeserializeKey(cacheBuf, cacheMeta->len, key); #ifdef DEBUG_CRYPTOCB_VERBOSE printf("[server] Export25519Key id:%u ret:%d\n", keyId, ret); wh_Utils_Hexdump("[server] export key:", cacheBuf, cacheMeta->len); @@ -795,9 +797,9 @@ static int _HandleCurve25519KeyGen(whServerContext* server, whPacket* packet, /* Response Message */ uint8_t* out = (uint8_t*)(res + 1); - uint16_t max_size = (word32)(WOLFHSM_CFG_COMM_DATA_LEN - + /* Initialize the key size to the max size of the buffer */ + uint16_t ser_size = (word32)(WOLFHSM_CFG_COMM_DATA_LEN - (out - (uint8_t*)packet)); - uint16_t res_size = 0; /* init key */ ret = wc_curve25519_init_ex(key, NULL, server->crypto->devId); @@ -809,11 +811,10 @@ static int _HandleCurve25519KeyGen(whServerContext* server, whPacket* packet, if (flags & WH_NVM_FLAGS_EPHEMERAL) { /* Must serialize the key into the response packet */ key_id = WH_KEYID_ERASED; - ret = wh_Crypto_Curve25519SerializeKey(key, max_size, - out, &res_size); + ret = wh_Crypto_Curve25519SerializeKey(key, out, &ser_size); } else { + ser_size = 0; /* Must import the key into the cache and return keyid */ - res_size = 0; if (WH_KEYID_ISERASED(key_id)) { /* Generate a new id */ ret = hsmGetUniqueId(server, &key_id); @@ -836,8 +837,8 @@ static int _HandleCurve25519KeyGen(whServerContext* server, whPacket* packet, if (ret == 0) { res->keyId = WH_KEYID_ID(key_id); - res->len = res_size; - *out_size = WH_PACKET_STUB_SIZE + sizeof(*res) + res_size; + res->len = ser_size; + *out_size = WH_PACKET_STUB_SIZE + sizeof(*res) + ser_size; } return ret; } diff --git a/wolfhsm/wh_crypto.h b/wolfhsm/wh_crypto.h index 71fd765..73c678a 100644 --- a/wolfhsm/wh_crypto.h +++ b/wolfhsm/wh_crypto.h @@ -77,11 +77,17 @@ int wh_Crypto_EccUpdatePrivateOnlyKeyDer(ecc_key* key, uint16_t pub_size, #ifdef HAVE_CURVE25519 /* Store a curve25519_key to a byte sequence */ -int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, - uint16_t max_size, uint8_t* buffer, uint16_t *out_size); +int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, + uint16_t* out_size); /* Restore a curve25519_key from a byte sequence */ -int wh_Crypto_Curve25519DeserializeKey(uint16_t size, - const uint8_t* buffer, curve25519_key* key); +int wh_Crypto_Curve25519DeserializeKey(const uint8_t* derBuffer, + uint16_t derSize, curve25519_key* key); +/* Store a curve25519_key to a byte sequence in raw format */ +int wh_Crypto_Curve25519SerializeKeyRaw(curve25519_key* key, uint16_t max_size, + uint8_t* buffer, uint16_t* out_size); +/* Restore a curve25519_key from a byte sequence in raw format */ +int wh_Crypto_Curve25519DeserializeKeyRaw(uint16_t size, const uint8_t* buffer, + curve25519_key* key); #endif /* HAVE_CURVE25519 */ #endif /* !WOLFHSM_CFG_NO_CRYPTO */ From 74d47ba73eaadfbf590e072268f199a1c8c63a2c Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:16:18 -0600 Subject: [PATCH 2/8] cleanups --- src/wh_crypto.c | 4 ++-- src/wh_server_crypto.c | 54 ++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/wh_crypto.c b/src/wh_crypto.c index e0201b2..04d773c 100644 --- a/src/wh_crypto.c +++ b/src/wh_crypto.c @@ -225,7 +225,7 @@ WOLFSSL_API int wc_Curve25519PublicKeyToDer( #endif /* HAVE_CURVE25519 */ -/* TODO make input key const */ +/* Store a curve25519_key to a byte sequence in DER format */ int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, uint16_t* derSize) { @@ -245,10 +245,10 @@ int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, return ret; } +/* Restore a curve25519_key from a byte sequence in DER format */ int wh_Crypto_Curve25519DeserializeKey(const uint8_t* derBuffer, uint16_t derSize, curve25519_key* key) { - int ret = WH_ERROR_OK; word32 idx = 0; if ((derBuffer == NULL) || (key == NULL)) { diff --git a/src/wh_server_crypto.c b/src/wh_server_crypto.c index 0e28c6c..c67fa62 100644 --- a/src/wh_server_crypto.c +++ b/src/wh_server_crypto.c @@ -430,40 +430,42 @@ int wh_Server_EccKeyCacheExport(whServerContext* ctx, whKeyId keyId, #ifdef HAVE_CURVE25519 int wh_Server_CacheImportCurve25519Key(whServerContext* server, - curve25519_key* key, - whKeyId keyId, whNvmFlags flags, uint16_t label_len, uint8_t* label) + curve25519_key* key, whKeyId keyId, + whNvmFlags flags, uint16_t label_len, + uint8_t* label) { - uint8_t* cacheBuf; + uint8_t* cacheBuf; whNvmMetadata* cacheMeta; - int ret; - /* TODO: This should be enough, but does wolfCrypt have a macro for the max - * size of DER encoded key? Can we just use ECC? */ - uint16_t keySz = CURVE25519_KEYSIZE * 4; + int ret; + /* Max size of a DER encoded curve25519 keypair with SubjectPublicKeyInfo + * included. Determined by experiment */ + const uint16_t MAX_DER_SIZE = 128; + uint16_t keySz = keySz; - if ( (server == NULL) || - (key == NULL) || - (WH_KEYID_ISERASED(keyId)) || - ((label != NULL) && (label_len > sizeof(cacheMeta->label)))) { + uint8_t der_buf[MAX_DER_SIZE]; + + + if ((server == NULL) || (key == NULL) || (WH_KEYID_ISERASED(keyId)) || + ((label != NULL) && (label_len > sizeof(cacheMeta->label)))) { return WH_ERROR_BADARGS; } - /* get a free slot */ - /* TODO: Should we serialize first, to get the size up front? */ - ret = hsmCacheFindSlotAndZero(server, keySz, &cacheBuf, &cacheMeta); - if (ret == 0) { - ret = wh_Crypto_Curve25519SerializeKey(key, cacheBuf, &keySz); - } + /* Serialize the key into the temporary buffer so we can get the size */ + ret = wh_Crypto_Curve25519SerializeKey(key, der_buf, &keySz); + /* if successful, find a free cache slot and copy in the key data */ if (ret == 0) { - /* set meta */ - cacheMeta->id = keyId; - cacheMeta->len = keySz; - cacheMeta->flags = flags; - cacheMeta->access = WH_NVM_ACCESS_ANY; - - if ( (label != NULL) && - (label_len > 0) ) { - memcpy(cacheMeta->label, label, label_len); + ret = hsmCacheFindSlotAndZero(server, keySz, &cacheBuf, &cacheMeta); + if (ret == 0) { + memcpy(cacheBuf, der_buf, keySz); + /* Update metadata to cache the key */ + cacheMeta->id = keyId; + cacheMeta->len = keySz; + cacheMeta->flags = flags; + cacheMeta->access = WH_NVM_ACCESS_ANY; + if ((label != NULL) && (label_len > 0)) { + memcpy(cacheMeta->label, label, label_len); + } } } return ret; From 122d76d666a20572a40705826f1d40acb7b6e65c Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:28:22 -0600 Subject: [PATCH 3/8] remove unused functions --- src/wh_crypto.c | 45 --------------------------------------------- wolfhsm/wh_crypto.h | 6 ------ 2 files changed, 51 deletions(-) diff --git a/src/wh_crypto.c b/src/wh_crypto.c index 04d773c..5145480 100644 --- a/src/wh_crypto.c +++ b/src/wh_crypto.c @@ -257,51 +257,6 @@ int wh_Crypto_Curve25519DeserializeKey(const uint8_t* derBuffer, return wc_Curve25519KeyDecode(derBuffer, &idx, key, derSize); } - -int wh_Crypto_Curve25519SerializeKeyRaw(curve25519_key* key, - uint16_t max_size, uint8_t* buffer, uint16_t *out_size) -{ - int ret = 0; - word32 privSz = CURVE25519_KEYSIZE; - word32 pubSz = CURVE25519_KEYSIZE; - - if ( (key == NULL) || - (buffer == NULL)) { - return WH_ERROR_BADARGS; - } - - ret = wc_curve25519_export_key_raw(key, - buffer + CURVE25519_KEYSIZE, &privSz, - buffer, &pubSz); - if ( (ret == 0) && - (out_size != NULL)) { - *out_size = CURVE25519_KEYSIZE * 2; - } - return ret; -} - -int wh_Crypto_Curve25519DeserializeKeyRaw(uint16_t size, - const uint8_t* buffer, curve25519_key* key) -{ - int ret = 0; - word32 privSz = CURVE25519_KEYSIZE; - word32 pubSz = CURVE25519_KEYSIZE; - - if ( (size < (CURVE25519_KEYSIZE * 2)) || - (buffer == NULL) || - (key == NULL)) { - return WH_ERROR_BADARGS; - } - - /* decode the key */ - if (ret == 0) { - ret = wc_curve25519_import_private_raw( - buffer + CURVE25519_KEYSIZE, privSz, - buffer, pubSz, - key); - } - return ret; -} #endif /* HAVE_CURVE25519 */ #endif /* !WOLFHSM_CFG_NO_CRYPTO */ diff --git a/wolfhsm/wh_crypto.h b/wolfhsm/wh_crypto.h index 73c678a..c3a29be 100644 --- a/wolfhsm/wh_crypto.h +++ b/wolfhsm/wh_crypto.h @@ -82,12 +82,6 @@ int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, /* Restore a curve25519_key from a byte sequence */ int wh_Crypto_Curve25519DeserializeKey(const uint8_t* derBuffer, uint16_t derSize, curve25519_key* key); -/* Store a curve25519_key to a byte sequence in raw format */ -int wh_Crypto_Curve25519SerializeKeyRaw(curve25519_key* key, uint16_t max_size, - uint8_t* buffer, uint16_t* out_size); -/* Restore a curve25519_key from a byte sequence in raw format */ -int wh_Crypto_Curve25519DeserializeKeyRaw(uint16_t size, const uint8_t* buffer, - curve25519_key* key); #endif /* HAVE_CURVE25519 */ #endif /* !WOLFHSM_CFG_NO_CRYPTO */ From affda7703df6ed16df686e3a31cea589a92dea97 Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:28:07 -0700 Subject: [PATCH 4/8] added more debug printfs in verbose mode --- src/wh_client_crypto.c | 4 ++++ src/wh_server_crypto.c | 2 +- src/wh_server_keystore.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wh_client_crypto.c b/src/wh_client_crypto.c index 04c2a7b..fd7f6c6 100644 --- a/src/wh_client_crypto.c +++ b/src/wh_client_crypto.c @@ -1195,6 +1195,10 @@ int wh_Client_Curve25519ImportKey(whClientContext* ctx, curve25519_key* key, if (inout_keyId != NULL) { *inout_keyId = key_id; } +#if defined(DEBUG_CRYPTOCB) && defined(DEBUG_CRYPTOCB_VERBOSE) + printf("[client] importKey: cached keyid=%u\n", key_id); + wh_Utils_Hexdump("[client] importKey: key=", buffer, buffer_len); +#endif } return ret; } diff --git a/src/wh_server_crypto.c b/src/wh_server_crypto.c index c67fa62..794529f 100644 --- a/src/wh_server_crypto.c +++ b/src/wh_server_crypto.c @@ -1588,7 +1588,7 @@ static int _HandleSha256Dma(whServerContext* server, whPacket* packet, if (ret == WH_ERROR_OK) { #ifdef DEBUG_CRYPTOCB_VERBOSE printf("[server] wc_Sha256Update: inAddr=%p, sz=%llu\n", inAddr, - req->input.sz); + (long long unsigned int)req->input.sz); #endif ret = wc_Sha256Update(sha256, inAddr, req->input.sz); } diff --git a/src/wh_server_keystore.c b/src/wh_server_keystore.c index 31de301..b345580 100644 --- a/src/wh_server_keystore.c +++ b/src/wh_server_keystore.c @@ -220,6 +220,10 @@ int hsmCacheKey(whServerContext* server, whNvmMetadata* meta, uint8_t* in) } else { server->cache[foundIndex].commited = 1; } +#if defined(DEBUG_CRYPTOCB) && defined(DEBUG_CRYPTOCB_VERBOSE) + printf("[server] cacheKey: caching keyid=%u\n", meta->id); + wh_Utils_Hexdump("[server] cacheKey: key=", in, meta->len); +#endif } } else { /* try big key cache, don't put small keys into big cache if full */ From b634bc4cdc200002813e0d5c823871ac7d4fea4e Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:28:27 -0700 Subject: [PATCH 5/8] fixed CURVE25519 public key only serialization --- src/wh_crypto.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wh_crypto.c b/src/wh_crypto.c index 5145480..ac9b116 100644 --- a/src/wh_crypto.c +++ b/src/wh_crypto.c @@ -36,7 +36,6 @@ #include "wolfssl/wolfcrypt/types.h" #include "wolfssl/wolfcrypt/error-crypt.h" #include "wolfssl/wolfcrypt/asn.h" -#include "wolfssl/wolfcrypt/asn_public.h" #include "wolfssl/wolfcrypt/rsa.h" #include "wolfssl/wolfcrypt/curve25519.h" #include "wolfssl/wolfcrypt/ecc.h" @@ -230,12 +229,16 @@ int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, uint16_t* derSize) { int ret = 0; + /* We must include the algorithm identifier in the DER encoding, or we will + * not be able to deserialize it properly in the public key only case*/ + const int WITH_ALG_ENABLE_SUBJECT_PUBLIC_KEY_INFO = 1; if ((key == NULL) || (buffer == NULL) || (derSize == NULL)) { return WH_ERROR_BADARGS; } - ret = wc_Curve25519KeyToDer(key, buffer, *derSize, 0); + ret = wc_Curve25519KeyToDer(key, buffer, *derSize, + WITH_ALG_ENABLE_SUBJECT_PUBLIC_KEY_INFO); /* ASN.1 functions return the size of the DER encoded key on success */ if (ret > 0) { From e42ddcd4acdde679942d324712f87d6d5db0d497 Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:31:24 -0700 Subject: [PATCH 6/8] removed unused definitions --- src/wh_crypto.c | 16 ---------------- test/wh_test.c | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/wh_crypto.c b/src/wh_crypto.c index ac9b116..9c1ed51 100644 --- a/src/wh_crypto.c +++ b/src/wh_crypto.c @@ -208,22 +208,6 @@ int wh_Crypto_EccUpdatePrivateOnlyKeyDer(ecc_key* key, uint16_t pub_size, #ifdef HAVE_CURVE25519 -#ifdef HAVE_CURVE25519 -#ifdef HAVE_CURVE25519_KEY_IMPORT -WOLFSSL_API int wc_Curve25519PrivateKeyDecode( - const byte* input, word32* inOutIdx, curve25519_key* key, word32 inSz); -WOLFSSL_API int wc_Curve25519PublicKeyDecode( - const byte* input, word32* inOutIdx, curve25519_key* key, word32 inSz); -#endif -#ifdef HAVE_CURVE25519_KEY_EXPORT -WOLFSSL_API int wc_Curve25519PrivateKeyToDer( - curve25519_key* key, byte* output, word32 inLen); -WOLFSSL_API int wc_Curve25519PublicKeyToDer( - curve25519_key* key, byte* output, word32 inLen, int withAlg); -#endif -#endif /* HAVE_CURVE25519 */ - - /* Store a curve25519_key to a byte sequence in DER format */ int wh_Crypto_Curve25519SerializeKey(curve25519_key* key, uint8_t* buffer, uint16_t* derSize) diff --git a/test/wh_test.c b/test/wh_test.c index d69d522..00985ce 100644 --- a/test/wh_test.c +++ b/test/wh_test.c @@ -48,7 +48,7 @@ int whTest_Unit(void) /* Component Tests */ WH_TEST_ASSERT(0 == whTest_Flash_RamSim()); - WH_TEST_ASSERT(0 == whTest_NvmFlash()); + /* WH_TEST_ASSERT(0 == whTest_NvmFlash()); */ /* Comm tests */ WH_TEST_ASSERT(0 == whTest_Comm()); From d237a029299f3d9d65283655f3673a8b1dfe983f Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:31:48 -0700 Subject: [PATCH 7/8] removed erroneous comment out of test --- test/wh_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/wh_test.c b/test/wh_test.c index 00985ce..d69d522 100644 --- a/test/wh_test.c +++ b/test/wh_test.c @@ -48,7 +48,7 @@ int whTest_Unit(void) /* Component Tests */ WH_TEST_ASSERT(0 == whTest_Flash_RamSim()); - /* WH_TEST_ASSERT(0 == whTest_NvmFlash()); */ + WH_TEST_ASSERT(0 == whTest_NvmFlash()); /* Comm tests */ WH_TEST_ASSERT(0 == whTest_Comm()); From 9a879780811812ce134c94ba8f0f8f3789b47f21 Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:35:46 -0700 Subject: [PATCH 8/8] cleanup CI config --- .github/workflows/build-and-test.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9c7e582..3ee65bf 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -34,12 +34,10 @@ jobs: run: cd test && make clean && make WOLFSSL_DIR=../wolfssl run # Build and test ASAN build, with wolfCrypt tests enabled. - # since wolfCrypt tests aren't all passing yet - this is just a status indicator - - name: Build and test ASAN TESTWOLFCRYPT (wolfCrypt tests OK to fail) + - name: Build and test ASAN TESTWOLFCRYPT run: cd test && make clean && make ASAN=1 TESTWOLFCRYPT=1 WOLFSSL_DIR=../wolfssl run # Build and test ASAN build, with wolfCrypt tests enabled and using the DMA devId. - # since wolfCrypt tests aren't all passing yet - this is just a status indicator - name: Build and test ASAN TESTWOLFCRYPT TESTWOLFCRYPT_DMA run: cd test && make clean && make ASAN=1 TESTWOLFCRYPT=1 TESTWOLFCRYPT_DMA=1 WOLFSSL_DIR=../wolfssl run @@ -54,8 +52,3 @@ jobs: # Build and test debug build with SHE - name: Build and test SHE run: cd test && make clean && make SHE=1 WOLFSSL_DIR=../wolfssl run - - ## Test structure padding - #- name: Check structure padding - # run: cd test && make clean && make checkpadding -