optimize domain check in wolfcrypt/src/integer.c and wolfcrypt/src/tfm.c.

This commit is contained in:
Daniel Pouzzner
2020-11-26 00:27:50 -06:00
parent 53cfa55941
commit 5286cb1a46
2 changed files with 8 additions and 8 deletions

View File

@@ -562,10 +562,10 @@ void mp_rshb (mp_int *c, int x)
mp_digit r, rr;
mp_digit D = x;
/* shifting by a negative number not supported */
if (x < 0) return;
/* shifting by zero changes nothing */
if (x == 0) return;
/* shifting by a negative number not supported, and shifting by
* zero changes nothing.
*/
if (x <= 0) return;
/* shift digits first if needed */
if (x >= DIGIT_BIT) {

View File

@@ -3903,10 +3903,10 @@ void fp_rshb(fp_int *c, int x)
fp_digit r, rr;
fp_digit D = x;
/* shifting by a negative number not supported */
if (x < 0) return;
/* shifting by zero changes nothing */
if (x == 0) return;
/* shifting by a negative number not supported, and shifting by
* zero changes nothing.
*/
if (x <= 0) return;
/* shift digits first if needed */
if (x >= DIGIT_BIT) {