mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Test Fixes
1. When building on VS, it didn't like using a variable for an array size. Fixed it so it was a constant. 2. In dh.c, there were a few #if that should have been #ifdef. 3. Tweaked a return value in the wolfCrypt test so it was read after being set.
This commit is contained in:
@ -202,7 +202,7 @@ static const byte dh_ffdhe3072_p[] = {
|
|||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||||
};
|
};
|
||||||
static const byte dh_ffdhe3072_g[] = { 0x02 };
|
static const byte dh_ffdhe3072_g[] = { 0x02 };
|
||||||
#if HAVE_FFDHE_Q
|
#ifdef HAVE_FFDHE_Q
|
||||||
static const byte dh_ffdhe3072_q[] = {
|
static const byte dh_ffdhe3072_q[] = {
|
||||||
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
||||||
@ -336,7 +336,7 @@ static const byte dh_ffdhe4096_p[] = {
|
|||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||||
};
|
};
|
||||||
static const byte dh_ffdhe4096_g[] = { 0x02 };
|
static const byte dh_ffdhe4096_g[] = { 0x02 };
|
||||||
#if HAVE_FFDHE_Q
|
#ifdef HAVE_FFDHE_Q
|
||||||
static const byte dh_ffdhe4096_q[] = {
|
static const byte dh_ffdhe4096_q[] = {
|
||||||
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
||||||
@ -518,7 +518,7 @@ static const byte dh_ffdhe6144_p[] = {
|
|||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||||
};
|
};
|
||||||
static const byte dh_ffdhe6144_g[] = { 0x02 };
|
static const byte dh_ffdhe6144_g[] = { 0x02 };
|
||||||
#if HAVE_FFDHE_Q
|
#ifdef HAVE_FFDHE_Q
|
||||||
static const byte dh_ffdhe6144_q[] = {
|
static const byte dh_ffdhe6144_q[] = {
|
||||||
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
||||||
@ -764,7 +764,7 @@ static const byte dh_ffdhe8192_p[] = {
|
|||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||||
};
|
};
|
||||||
static const byte dh_ffdhe8192_g[] = { 0x02 };
|
static const byte dh_ffdhe8192_g[] = { 0x02 };
|
||||||
#if HAVE_FFDHE_Q
|
#ifdef HAVE_FFDHE_Q
|
||||||
static const byte dh_ffdhe8192_g[] = {
|
static const byte dh_ffdhe8192_g[] = {
|
||||||
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
0xD6, 0xFC, 0x2A, 0x2C, 0x51, 0x5D, 0xA5, 0x4D,
|
||||||
|
@ -177,6 +177,7 @@ int wc_RNG_GenerateByte(WC_RNG* rng, byte* b)
|
|||||||
#define RESEED_INTERVAL WC_RESEED_INTERVAL
|
#define RESEED_INTERVAL WC_RESEED_INTERVAL
|
||||||
#define SECURITY_STRENGTH (2048)
|
#define SECURITY_STRENGTH (2048)
|
||||||
#define ENTROPY_SZ (SECURITY_STRENGTH/8)
|
#define ENTROPY_SZ (SECURITY_STRENGTH/8)
|
||||||
|
#define MAX_ENTROPY_SZ (ENTROPY_SZ + ENTROPY_SZ/2)
|
||||||
|
|
||||||
/* Internal return codes */
|
/* Internal return codes */
|
||||||
#define DRBG_SUCCESS 0
|
#define DRBG_SUCCESS 0
|
||||||
@ -586,10 +587,10 @@ static int _InitRng(WC_RNG* rng, byte* nonce, word32 nonceSz,
|
|||||||
#else
|
#else
|
||||||
#ifdef HAVE_HASHDRBG
|
#ifdef HAVE_HASHDRBG
|
||||||
if (nonceSz == 0)
|
if (nonceSz == 0)
|
||||||
entropySz += (entropySz / 2);
|
entropySz = MAX_ENTROPY_SZ;
|
||||||
|
|
||||||
if (wc_RNG_HealthTestLocal(0) == 0) {
|
if (wc_RNG_HealthTestLocal(0) == 0) {
|
||||||
DECLARE_VAR(entropy, byte, entropySz, rng->heap);
|
DECLARE_VAR(entropy, byte, MAX_ENTROPY_SZ, rng->heap);
|
||||||
|
|
||||||
rng->drbg =
|
rng->drbg =
|
||||||
(struct DRBG*)XMALLOC(sizeof(DRBG), rng->heap,
|
(struct DRBG*)XMALLOC(sizeof(DRBG), rng->heap,
|
||||||
|
@ -10778,7 +10778,7 @@ static int dh_fips_generate_test(WC_RNG *rng)
|
|||||||
ret = wc_AsyncWait(ret, &key.asyncDev, WC_ASYNC_FLAG_NONE);
|
ret = wc_AsyncWait(ret, &key.asyncDev, WC_ASYNC_FLAG_NONE);
|
||||||
#endif
|
#endif
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = -5727;
|
ERROR_OUT(-5727, exit_gen_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wc_DhCheckKeyPair(&key, pub, pubSz, priv, privSz);
|
ret = wc_DhCheckKeyPair(&key, pub, pubSz, priv, privSz);
|
||||||
@ -10792,8 +10792,6 @@ static int dh_fips_generate_test(WC_RNG *rng)
|
|||||||
if (ret != MP_CMP_E) {
|
if (ret != MP_CMP_E) {
|
||||||
ERROR_OUT(-8230, exit_gen_test);
|
ERROR_OUT(-8230, exit_gen_test);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
#ifdef WOLFSSL_KEY_GEN
|
#ifdef WOLFSSL_KEY_GEN
|
||||||
|
|
||||||
@ -10812,6 +10810,8 @@ static int dh_fips_generate_test(WC_RNG *rng)
|
|||||||
|
|
||||||
#endif /* WOLFSSL_KEY_GEN */
|
#endif /* WOLFSSL_KEY_GEN */
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit_gen_test:
|
exit_gen_test:
|
||||||
wc_FreeDhKey(&key);
|
wc_FreeDhKey(&key);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user