From cd88a8ae88bac13019689c087755d826145811bb Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 23 Dec 2025 11:41:59 -0600 Subject: [PATCH] peer review -- add !WC_NO_RNG gates around WC_RNG changes in wolfcrypt/src/rsa.c and wolfssl/wolfcrypt/rsa.h. --- wolfcrypt/src/rsa.c | 3 ++- wolfssl/wolfcrypt/rsa.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 0d19ae680..3e9299f15 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -5254,7 +5254,7 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng) #endif /* !FIPS || FIPS_VER >= 2 */ #endif /* WOLFSSL_KEY_GEN */ - +#ifndef WC_NO_RNG int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng) { if (key == NULL || rng == NULL) @@ -5264,6 +5264,7 @@ int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng) return 0; } +#endif /* !WC_NO_RNG */ #ifdef WC_RSA_NONBLOCK int wc_RsaSetNonBlock(RsaKey* key, RsaNb* nb) diff --git a/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfcrypt/rsa.h index a5a21ed65..e1447cf84 100644 --- a/wolfssl/wolfcrypt/rsa.h +++ b/wolfssl/wolfcrypt/rsa.h @@ -214,9 +214,11 @@ struct RsaKey { int type; /* public or private */ int state; word32 dataLen; +#ifndef WC_NO_RNG WC_RNG* rng; /* for PrivateDecrypt blinding and * _ifc_pairwise_consistency_test() */ +#endif #ifdef WOLFSSL_SE050 word32 keyId; byte keyIdSet; @@ -403,7 +405,9 @@ WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, WOLFSSL_API int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen); #endif +#ifndef WC_NO_RNG WOLFSSL_API int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng); +#endif #ifdef WC_RSA_NONBLOCK WOLFSSL_API int wc_RsaSetNonBlock(RsaKey* key, RsaNb* nb); #ifdef WC_RSA_NONBLOCK_TIME