diff --git a/wolfcrypt/src/falcon.c b/wolfcrypt/src/falcon.c index ab529f7e2..c19bb01e6 100644 --- a/wolfcrypt/src/falcon.c +++ b/wolfcrypt/src/falcon.c @@ -62,6 +62,10 @@ int wc_falcon_sign_msg(const byte* in, word32 inLen, falcon_key* key, WC_RNG* rng) { int ret = 0; +#ifdef HAVE_LIBOQS + OQS_SIG *oqssig = NULL; + size_t localOutLen = 0; +#endif /* sanity check on arguments */ if ((in == NULL) || (out == NULL) || (outLen == NULL) || (key == NULL)) { @@ -83,9 +87,6 @@ int wc_falcon_sign_msg(const byte* in, word32 inLen, #endif #ifdef HAVE_LIBOQS - OQS_SIG *oqssig = NULL; - size_t localOutLen = 0; - if ((ret == 0) && (!key->prvKeySet)) { ret = BAD_FUNC_ARG; } @@ -161,6 +162,9 @@ int wc_falcon_verify_msg(const byte* sig, word32 sigLen, const byte* msg, word32 msgLen, int* res, falcon_key* key) { int ret = 0; +#ifdef HAVE_LIBOQS + OQS_SIG *oqssig = NULL; +#endif if (key == NULL || sig == NULL || msg == NULL || res == NULL) { return BAD_FUNC_ARG; @@ -181,8 +185,6 @@ int wc_falcon_verify_msg(const byte* sig, word32 sigLen, const byte* msg, #endif #ifdef HAVE_LIBOQS - OQS_SIG *oqssig = NULL; - if ((ret == 0) && (!key->pubKeySet)) { ret = BAD_FUNC_ARG; } @@ -708,12 +710,12 @@ int wc_falcon_export_key(falcon_key* key, byte* priv, word32 *privSz, */ int wc_falcon_check_key(falcon_key* key) { + int ret = 0; + if (key == NULL) { return BAD_FUNC_ARG; } - int ret = 0; - /* The public key is also decoded and stored within the private key buffer * behind the private key. Hence, we can compare both stored public keys. */ if (key->level == 1) { diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 9f8db5f24..51f695441 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -6547,6 +6547,11 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha_test(void) wc_test_ret_t ret; int times = sizeof(test_hmac) / sizeof(testVector), i; + +#if FIPS_VERSION3_GE(6,0,0) + int allowShortKeyWithFips = 1; +#endif + WOLFSSL_ENTER("hmac_sha_test"); /* Following test vectors are from RFC 2202 section 3 */ @@ -6581,9 +6586,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha_test(void) test_hmac[1] = b; test_hmac[2] = c; test_hmac[3] = d; -#if FIPS_VERSION3_GE(6,0,0) - int allowShortKeyWithFips = 1; -#endif for (i = 0; i < times; ++i) { #if defined(HAVE_CAVIUM) || (defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0))