From f8565f26e2f2a928a4711b7b460872d27cc8cb62 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Mon, 8 Nov 2021 13:56:04 -0600 Subject: [PATCH] fixes for --disable-harden. --- wolfcrypt/src/ecc.c | 4 ++++ wolfcrypt/test/test.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index ddce9dfae..13720a3b0 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -11749,7 +11749,11 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, #ifndef WOLFSSL_ECIES_OLD if (privKey->type == ECC_PRIVATEKEY_ONLY) { +#ifdef ECC_TIMING_RESISTANT ret = wc_ecc_make_pub_ex(privKey, NULL, privKey->rng); +#else + ret = wc_ecc_make_pub_ex(privKey, NULL, NULL); +#endif if (ret != 0) return ret; } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 97a4445b7..7c31a0605 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -24405,6 +24405,8 @@ static int ecc_encrypt_kat(WC_RNG *rng) ret = -10456; } } +#else + (void)rng; #endif if (ret == 0) { @@ -31136,7 +31138,9 @@ static int pkcs7enveloped_run_vectors(byte* rsaCert, word32 rsaCertSz, pkcs7EnvelopedVector *testVectors = NULL; +#ifdef ECC_TIMING_RESISTANT XMEMSET(&rng, 0, sizeof(rng)); +#endif testVectors = (pkcs7EnvelopedVector *)XMALLOC(MAX_TESTVECTORS_LEN * sizeof(*testVectors), HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);