mirror of https://github.com/wolfSSL/wolfssl.git
Merge pull request #3135 from SparkiDev/fp_set_bit
fp_set_bit: return error when bit offset is too largepull/2713/head^2
commit
ab7535c3f6
|
@ -3311,9 +3311,9 @@ int fp_is_bit_set (fp_int *a, fp_digit b)
|
||||||
fp_digit i;
|
fp_digit i;
|
||||||
|
|
||||||
if (b > FP_MAX_BITS)
|
if (b > FP_MAX_BITS)
|
||||||
return 0;
|
return FP_VAL;
|
||||||
else
|
|
||||||
i = b/DIGIT_BIT;
|
i = b/DIGIT_BIT;
|
||||||
|
|
||||||
if ((fp_digit)a->used < i)
|
if ((fp_digit)a->used < i)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3327,9 +3327,9 @@ int fp_set_bit (fp_int * a, fp_digit b)
|
||||||
fp_digit i;
|
fp_digit i;
|
||||||
|
|
||||||
if (b > FP_MAX_BITS)
|
if (b > FP_MAX_BITS)
|
||||||
return 0;
|
return FP_VAL;
|
||||||
else
|
|
||||||
i = b/DIGIT_BIT;
|
i = b/DIGIT_BIT;
|
||||||
|
|
||||||
/* set the used count of where the bit will go if required */
|
/* set the used count of where the bit will go if required */
|
||||||
if (a->used < (int)(i+1))
|
if (a->used < (int)(i+1))
|
||||||
|
|
Loading…
Reference in New Issue