Merge pull request #4336 from elms/sp_out_of_range

sp_math: error on multiplier larger than curve order
This commit is contained in:
John Safranek 2021-08-27 10:15:42 -07:00 committed by GitHub
commit 412528e18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3121,6 +3121,11 @@ exit:
(void)a;
/* k can't have more bits than modulus count plus 1 */
if (mp_count_bits(k) > mp_count_bits(modulus) + 1) {
return ECC_OUT_OF_RANGE_E;
}
#ifdef WOLFSSL_HAVE_SP_ECC
#ifndef WOLFSSL_SP_NO_256
if (mp_count_bits(modulus) == 256) {