mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
SP math all: div handling of length of dividend
Fail when dividend is maximum size as we may be shifting left and overflow when divisor is not on a word boundary.
This commit is contained in:
@ -4614,6 +4614,10 @@ int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem)
|
||||
if ((err == MP_OKAY) && (rem != NULL) && (rem->size < a->used + 1)) {
|
||||
err = MP_VAL;
|
||||
}
|
||||
/* May need to shift number being divided left into a new word. */
|
||||
if ((err == MP_OKAY) && (a->used == SP_INT_DIGITS)) {
|
||||
err = MP_VAL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (err == MP_OKAY) {
|
||||
|
Reference in New Issue
Block a user