add unique RNG missing error

This commit is contained in:
toddouska
2016-07-18 18:10:38 -07:00
parent 1c71fb4ad1
commit f88f501923
3 changed files with 8 additions and 1 deletions

View File

@ -386,6 +386,9 @@ const char* wc_GetErrorString(int error)
case ASN_COUNTRY_SIZE_E: case ASN_COUNTRY_SIZE_E:
return "Country code size error, either too small or large"; return "Country code size error, either too small or large";
case MISSING_RNG_E:
return "RNG required but not provided";
default: default:
return "unknown error number"; return "unknown error number";

View File

@ -812,7 +812,10 @@ static int mp_rand(mp_int* a, int digits, WC_RNG* rng)
int ret; int ret;
mp_digit d; mp_digit d;
if (a == NULL || rng == NULL) if (rng == NULL)
return MISSING_RNG_E;
if (a == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
mp_zero(a); mp_zero(a);

View File

@ -173,6 +173,7 @@ enum {
WC_KEY_SIZE_E = -234, /* Key size error, either too small or large */ WC_KEY_SIZE_E = -234, /* Key size error, either too small or large */
ASN_COUNTRY_SIZE_E = -235, /* ASN Cert Gen, invalid country code size */ ASN_COUNTRY_SIZE_E = -235, /* ASN Cert Gen, invalid country code size */
MISSING_RNG_E = -236, /* RNG required but not provided */
MIN_CODE_E = -300 /* errors -101 - -299 */ MIN_CODE_E = -300 /* errors -101 - -299 */