mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
EC scalar mult with SP Math: fix scalar length check
The support curves in SP all have an order length the same as modulus length. The scalar cannot be larger than the order and so fix the check.
This commit is contained in:
@ -3465,8 +3465,10 @@ exit:
|
||||
|
||||
(void)a;
|
||||
|
||||
/* k can't have more bits than modulus count plus 1 */
|
||||
if (mp_count_bits(k) > mp_count_bits(modulus) + 1) {
|
||||
/* For supported curves the order is the same length in bits as the modulus.
|
||||
* Can't have more than order bits for the scalar.
|
||||
*/
|
||||
if (mp_count_bits(k) > mp_count_bits(modulus)) {
|
||||
return ECC_OUT_OF_RANGE_E;
|
||||
}
|
||||
if (mp_count_bits(G->x) > mp_count_bits(modulus) ||
|
||||
|
Reference in New Issue
Block a user