diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 21ae2353a..dadfeb4ee 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -5358,6 +5358,9 @@ int mp_read_radix (mp_int * a, const char *str, int radix) ++str; } + /* Skip whitespace at end of str */ + while (CharIsWhiteSpace(*str)) + ++str; /* if digit in isn't null term, then invalid character was found */ if (*str != '\0') { mp_zero (a); diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index ff895c8ac..65d92ffa1 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -6029,7 +6029,13 @@ static int fp_read_radix(fp_int *a, const char *str, int radix) } } if (y >= radix) { - return FP_VAL; + /* Check if whitespace at end of line */ + while (CharIsWhiteSpace(*str)) + ++str; + if (*str) + return FP_VAL; + else + break; } /* if the char was found in the map