diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 8ab5e7b78..e6808b338 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -1305,7 +1305,7 @@ static void wc_ecc_curve_free(ecc_curve_spec* curve) if (curve) { #ifdef ECC_CACHE_CURVE #ifdef WOLFSSL_CUSTOM_CURVES - /* only free custom curves (reset are globally cached) */ + /* only free custom curves (rest are globally cached) */ if (curve->dp && curve->dp->id == ECC_CURVE_CUSTOM) { wc_ecc_curve_cache_free_spec(curve); XFREE(curve, NULL, DYNAMIC_TYPE_ECC); diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 8d07e1e53..b4d3e605a 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -5336,7 +5336,7 @@ int chacha20_poly1305_aead_test(void) } - /* AEAD init/update/final */ + /* AEAD init/update/final - bad argument tests */ err = wc_ChaCha20Poly1305_Init(NULL, key1, iv1, CHACHA20_POLY1305_AEAD_DECRYPT); if (err != BAD_FUNC_ARG) @@ -5374,7 +5374,12 @@ int chacha20_poly1305_aead_test(void) if (err != BAD_FUNC_ARG) return -4727; - /* AEAD init/update/final - state tests */ + /* AEAD init/update/final - bad state tests */ + /* clear struct - make valgrind happy to resolve + "Conditional jump or move depends on uninitialised value(s)". + The enum is "int" size and aead.state is "byte" */ + /* The wc_ChaCha20Poly1305_Init function does this normally */ + XMEMSET(&aead, 0, sizeof(aead)); aead.state = CHACHA20_POLY1305_STATE_INIT; err = wc_ChaCha20Poly1305_UpdateAad(&aead, aad1, sizeof(aad1)); if (err != BAD_STATE_E)