forked from wolfSSL/wolfssl
FIPS Update
1. White space changes. Converting tabs to spaces. 2. Add some comments explaining where a loop bound came from. 3. Added parameter checks to a function.
This commit is contained in:
@@ -2120,6 +2120,9 @@ static int RsaGetValue(mp_int* in, byte* out, word32* outSz)
|
|||||||
word32 sz;
|
word32 sz;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (in == NULL || out == NULL || outSz == NULL)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
sz = (word32)mp_unsigned_bin_size(in);
|
sz = (word32)mp_unsigned_bin_size(in);
|
||||||
if (sz > *outSz)
|
if (sz > *outSz)
|
||||||
ret = RSA_BUFFER_E;
|
ret = RSA_BUFFER_E;
|
||||||
@@ -2339,7 +2342,6 @@ int wc_CheckProbablePrime(const byte* pRaw, word32 pRawSz,
|
|||||||
|
|
||||||
if (ret == MP_OKAY) {
|
if (ret == MP_OKAY) {
|
||||||
if (qRaw != NULL) {
|
if (qRaw != NULL) {
|
||||||
if (ret == MP_OKAY)
|
|
||||||
ret = mp_read_unsigned_bin(&q, qRaw, qRawSz);
|
ret = mp_read_unsigned_bin(&q, qRaw, qRawSz);
|
||||||
if (ret == MP_OKAY)
|
if (ret == MP_OKAY)
|
||||||
Q = &q;
|
Q = &q;
|
||||||
@@ -2402,6 +2404,8 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
|
|||||||
if (err == MP_OKAY)
|
if (err == MP_OKAY)
|
||||||
err = mp_set_int(&tmp3, e);
|
err = mp_set_int(&tmp3, e);
|
||||||
|
|
||||||
|
/* The failCount value comes from NIST FIPS 186-4, section B.3.3,
|
||||||
|
* process steps 4.7 and 5.8. */
|
||||||
failCount = 5 * (size / 2);
|
failCount = 5 * (size / 2);
|
||||||
primeSz = size / 16; /* size is the size of n in bits.
|
primeSz = size / 16; /* size is the size of n in bits.
|
||||||
primeSz is in bytes. */
|
primeSz is in bytes. */
|
||||||
|
Reference in New Issue
Block a user