Check-in FIPS 140-3 PILOT changes

v5.2.1-stable
kaleb-himes 2023-08-28 15:43:24 -07:00
parent ceae7d56fa
commit 844e961ff5
6 changed files with 26 additions and 5 deletions

View File

@ -4385,6 +4385,19 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
return 0;
}
int wc_AesCtrSetKey(Aes* aes, const byte* key, word32 len,
const byte* iv, int dir)
{
if (aes == NULL) {
return BAD_FUNC_ARG;
}
if (len > sizeof(aes->key)) {
return BAD_FUNC_ARG;
}
return wc_AesSetKeyLocal(aes, key, len, iv, dir, 0);
}
#endif /* NEED_AES_CTR_SOFT */
#endif /* WOLFSSL_AES_COUNTER */

View File

@ -1336,7 +1336,7 @@ static int GeneratePublicDh(DhKey* key, byte* priv, word32 privSz,
*pubSz = binSz;
mp_clear(y);
mp_clear(x);
mp_forcezero(x);
#ifdef WOLFSSL_SMALL_STACK
XFREE(y, key->heap, DYNAMIC_TYPE_DH);
XFREE(x, key->heap, DYNAMIC_TYPE_DH);

View File

@ -1196,6 +1196,7 @@ int wolfSSL_GetHmacMaxSize(void)
ret = wc_HmacUpdate(&myHmac, inKey, inKeySz);
if (ret == 0)
ret = wc_HmacFinal(&myHmac, out);
ForceZero(&myHmac, sizeof(myHmac));
wc_HmacFree(&myHmac);
}
@ -1261,6 +1262,7 @@ int wolfSSL_GetHmacMaxSize(void)
n++;
}
ForceZero(&myHmac, sizeof(myHmac));
wc_HmacFree(&myHmac);
return ret;

View File

@ -734,6 +734,7 @@ int wc_SSH_KDF(byte hashId, byte keyId, byte* key, word32 keySz,
}
}
ForceZero(&hash, sizeof(hash));
_HashFree(enmhashId, &hash);
return ret;

View File

@ -367,6 +367,9 @@ WOLFSSL_API int wc_AesEcbDecrypt(Aes* aes, byte* out,
#ifdef WOLFSSL_AES_COUNTER
WOLFSSL_API int wc_AesCtrEncrypt(Aes* aes, byte* out,
const byte* in, word32 sz);
WOLFSSL_API int wc_AesCtrSetKey(Aes* aes, const byte* key, word32 len,
const byte* iv, int dir);
#endif
/* AES-DIRECT */
#if defined(WOLFSSL_AES_DIRECT)

View File

@ -58,10 +58,10 @@ enum FipsCastStateId {
};
enum FipsModeId {
FIPS_MODE_INIT,
FIPS_MODE_NORMAL,
FIPS_MODE_DEGRADED,
FIPS_MODE_FAILED
FIPS_MODE_INIT = 0,
FIPS_MODE_NORMAL = 1,
FIPS_MODE_DEGRADED = 2,
FIPS_MODE_FAILED = 3
};
@ -73,6 +73,7 @@ WOLFSSL_API int wolfCrypt_SetCb_fips(wolfCrypt_fips_cb cbf);
/* Public get status functions */
WOLFSSL_API int wolfCrypt_GetStatus_fips(void);
WOLFSSL_API int wolfCrypt_GetMode_fips(void);
WOLFSSL_API const char* wolfCrypt_GetCoreHash_fips(void);
#ifdef HAVE_FORCE_FIPS_FAILURE
@ -87,6 +88,7 @@ WOLFSSL_LOCAL int DoKnownAnswerTests(char*, int); /* FIPSv1 and FIPSv2 */
WOLFSSL_API int wc_RunCast_fips(int);
WOLFSSL_API int wc_GetCastStatus_fips(int);
WOLFSSL_API int wc_RunAllCast_fips(void);
#ifdef __cplusplus
} /* extern "C" */