Merge pull request #3192 from ethanlooney/21st_branch

Added check for wolfmath.c for digits == 0 and test for api.c
pull/3211/head
Chris Conlon 2020-08-05 09:51:51 -06:00 committed by GitHub
commit d12b80abdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -33914,6 +33914,12 @@ static int test_mp_rand (void)
ret = 0;
}
}
if (ret == 0) {
ret = mp_rand(&a, 0, &rng);
if (ret == BAD_FUNC_ARG) {
ret = 0;
}
}
if (ret == 0) {
ret = mp_rand(&a, digits, &rng);
}

View File

@ -146,7 +146,7 @@ int mp_rand(mp_int* a, int digits, WC_RNG* rng)
if (rng == NULL) {
ret = MISSING_RNG_E;
}
else if (a == NULL) {
else if (a == NULL || digits == 0) {
ret = BAD_FUNC_ARG;
}