Change void cast(s) to be non-conditional and consolidate condition logic

This commit is contained in:
kaleb-himes
2022-04-13 10:25:43 -06:00
parent 947c72937f
commit d706e2be32

View File

@ -2912,6 +2912,8 @@ static int wc_RsaFunction_ex(const byte* in, word32 inLen, byte* out,
int checkSmallCt) int checkSmallCt)
{ {
int ret = 0; int ret = 0;
(void)rng;
(void)checkSmallCt;
if (key == NULL || in == NULL || inLen == 0 || out == NULL || if (key == NULL || in == NULL || inLen == 0 || out == NULL ||
outLen == NULL || *outLen == 0 || type == RSA_TYPE_UNKNOWN) { outLen == NULL || *outLen == 0 || type == RSA_TYPE_UNKNOWN) {
@ -2940,9 +2942,8 @@ static int wc_RsaFunction_ex(const byte* in, word32 inLen, byte* out,
#ifndef WOLF_CRYPTO_CB_ONLY_RSA #ifndef WOLF_CRYPTO_CB_ONLY_RSA
SAVE_VECTOR_REGISTERS(return _svr_ret;); SAVE_VECTOR_REGISTERS(return _svr_ret;);
#ifndef WOLFSSL_RSA_VERIFY_ONLY #if !defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(TEST_UNPAD_CONSTANT_TIME) && \
#ifndef TEST_UNPAD_CONSTANT_TIME !defined(NO_RSA_BOUNDS_CHECK)
#ifndef NO_RSA_BOUNDS_CHECK
if (type == RSA_PRIVATE_DECRYPT && if (type == RSA_PRIVATE_DECRYPT &&
key->state == RSA_STATE_DECRYPT_EXPTMOD) { key->state == RSA_STATE_DECRYPT_EXPTMOD) {
@ -2992,11 +2993,8 @@ static int wc_RsaFunction_ex(const byte* in, word32 inLen, byte* out,
return ret; return ret;
} }
} }
#endif /* NO_RSA_BOUNDS_CHECK */ #endif /* !WOLFSSL_RSA_VERIFY_ONLY && !TEST_UNPAD_CONSTANT_TIME && \
#endif * !NO_RSA_BOUNDS_CHECK */
#else
(void)checkSmallCt;
#endif
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_RSA) #if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_RSA)
if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_RSA && if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_RSA &&
@ -3032,9 +3030,6 @@ static int wc_RsaFunction_ex(const byte* in, word32 inLen, byte* out,
wc_RsaCleanup(key); wc_RsaCleanup(key);
} }
return ret; return ret;
#else
(void)rng;
(void)checkSmallCt;
#endif /* WOLF_CRYPTO_CB_ONLY_RSA */ #endif /* WOLF_CRYPTO_CB_ONLY_RSA */
} }