FIPS 140-3 Pilot Program Check-in

This commit is contained in:
kaleb-himes
2023-08-24 14:29:32 -07:00
parent ceae7d56fa
commit 5dcdc4a64d
5 changed files with 20 additions and 1 deletions

View File

@ -4385,6 +4385,19 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
return 0; 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 /* NEED_AES_CTR_SOFT */
#endif /* WOLFSSL_AES_COUNTER */ #endif /* WOLFSSL_AES_COUNTER */

View File

@ -1336,7 +1336,7 @@ static int GeneratePublicDh(DhKey* key, byte* priv, word32 privSz,
*pubSz = binSz; *pubSz = binSz;
mp_clear(y); mp_clear(y);
mp_clear(x); mp_forcezero(x);
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
XFREE(y, key->heap, DYNAMIC_TYPE_DH); XFREE(y, key->heap, DYNAMIC_TYPE_DH);
XFREE(x, 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); ret = wc_HmacUpdate(&myHmac, inKey, inKeySz);
if (ret == 0) if (ret == 0)
ret = wc_HmacFinal(&myHmac, out); ret = wc_HmacFinal(&myHmac, out);
ForceZero(&myHmac, sizeof(myHmac));
wc_HmacFree(&myHmac); wc_HmacFree(&myHmac);
} }
@ -1261,6 +1262,7 @@ int wolfSSL_GetHmacMaxSize(void)
n++; n++;
} }
ForceZero(&myHmac, sizeof(myHmac));
wc_HmacFree(&myHmac); wc_HmacFree(&myHmac);
return ret; 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); _HashFree(enmhashId, &hash);
return ret; return ret;

View File

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