mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Merge pull request #1754 from dgarske/fix_fipsv2
Fix for FIPS PRB error with CAVP test
This commit is contained in:
@@ -200,8 +200,6 @@ int wc_RsaFlattenPublicKey(RsaKey* key, byte* a, word32* aSz, byte* b,
|
|||||||
#include <wolfcrypt/src/misc.c>
|
#include <wolfcrypt/src/misc.c>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ERROR_OUT(x) { ret = (x); goto done;}
|
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RSA_STATE_NONE = 0,
|
RSA_STATE_NONE = 0,
|
||||||
@@ -2616,6 +2614,9 @@ int wc_RsaFlattenPublicKey(RsaKey* key, byte* e, word32* eSz, byte* n,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HAVE_FIPS */
|
||||||
|
|
||||||
|
|
||||||
static int RsaGetValue(mp_int* in, byte* out, word32* outSz)
|
static int RsaGetValue(mp_int* in, byte* out, word32* outSz)
|
||||||
{
|
{
|
||||||
word32 sz;
|
word32 sz;
|
||||||
@@ -2890,7 +2891,8 @@ int wc_CheckProbablePrime(const byte* pRaw, word32 pRawSz,
|
|||||||
eRaw, eRawSz, nlen, isPrime, NULL);
|
eRaw, eRawSz, nlen, isPrime, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS) && \
|
||||||
|
defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||||
/* Make an RSA key for size bits, with e specified, 65537 is a good e */
|
/* Make an RSA key for size bits, with e specified, 65537 is a good e */
|
||||||
int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
||||||
{
|
{
|
||||||
@@ -3087,6 +3089,7 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* !FIPS || FIPS_VER >= 2 */
|
||||||
#endif /* WOLFSSL_KEY_GEN */
|
#endif /* WOLFSSL_KEY_GEN */
|
||||||
|
|
||||||
|
|
||||||
@@ -3105,7 +3108,4 @@ int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng)
|
|||||||
#endif /* WC_RSA_BLINDING */
|
#endif /* WC_RSA_BLINDING */
|
||||||
|
|
||||||
|
|
||||||
#undef ERROR_OUT
|
|
||||||
|
|
||||||
#endif /* HAVE_FIPS */
|
|
||||||
#endif /* NO_RSA */
|
#endif /* NO_RSA */
|
||||||
|
@@ -70,6 +70,11 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum {
|
||||||
|
RSA_MIN_SIZE = 512,
|
||||||
|
RSA_MAX_SIZE = 4096,
|
||||||
|
};
|
||||||
|
|
||||||
/* avoid redefinition of structs */
|
/* avoid redefinition of structs */
|
||||||
#if !defined(HAVE_FIPS) || \
|
#if !defined(HAVE_FIPS) || \
|
||||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||||
@@ -94,9 +99,6 @@ enum {
|
|||||||
RSA_BLOCK_TYPE_1 = 1,
|
RSA_BLOCK_TYPE_1 = 1,
|
||||||
RSA_BLOCK_TYPE_2 = 2,
|
RSA_BLOCK_TYPE_2 = 2,
|
||||||
|
|
||||||
RSA_MIN_SIZE = 512,
|
|
||||||
RSA_MAX_SIZE = 4096,
|
|
||||||
|
|
||||||
RSA_MIN_PAD_SZ = 11, /* separator + 0 + pad value + 8 pads */
|
RSA_MIN_PAD_SZ = 11, /* separator + 0 + pad value + 8 pads */
|
||||||
|
|
||||||
RSA_PSS_PAD_SZ = 8,
|
RSA_PSS_PAD_SZ = 8,
|
||||||
|
Reference in New Issue
Block a user