forked from wolfSSL/wolfssl
Merge branch 'master' of https://github.com/wolfSSL/wolfssl
Fix DSA key generation
This commit is contained in:
@@ -963,7 +963,7 @@ top:
|
||||
|
||||
/* if not zero goto step 4 */
|
||||
if (mp_iszero (&u) == 0) {
|
||||
if (++loop_check > 1024) {
|
||||
if (++loop_check > 4096) {
|
||||
res = MP_VAL;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
@@ -2501,33 +2501,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d)
|
||||
}
|
||||
|
||||
|
||||
/* computes a = 2**b
|
||||
*
|
||||
* Simple algorithm which zeroes the int, grows it then just sets one bit
|
||||
* as required.
|
||||
*/
|
||||
int
|
||||
mp_2expt (mp_int * a, int b)
|
||||
{
|
||||
int res;
|
||||
|
||||
/* zero a as per default */
|
||||
mp_zero (a);
|
||||
|
||||
/* grow a to accomodate the single bit */
|
||||
if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
|
||||
/* set the used count of where the bit will go */
|
||||
a->used = b / DIGIT_BIT + 1;
|
||||
|
||||
/* put the single bit in its place */
|
||||
a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT);
|
||||
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
/* set the b bit of a */
|
||||
int
|
||||
mp_set_bit (mp_int * a, int b)
|
||||
@@ -2550,6 +2523,19 @@ mp_set_bit (mp_int * a, int b)
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
/* computes a = 2**b
|
||||
*
|
||||
* Simple algorithm which zeroes the int, set the required bit
|
||||
*/
|
||||
int
|
||||
mp_2expt (mp_int * a, int b)
|
||||
{
|
||||
/* zero a as per default */
|
||||
mp_zero (a);
|
||||
|
||||
return mp_set_bit(a, b);
|
||||
}
|
||||
|
||||
/* multiply by a digit */
|
||||
int
|
||||
mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
|
||||
Reference in New Issue
Block a user