OpenSSL 1.1.1-pre2
This commit is contained in:
+13
-13
@@ -33,12 +33,12 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
|
||||
if (num > 1 && a->top == num && b->top == num) {
|
||||
if (bn_wexpand(r, num) == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
|
||||
r->neg = a->neg ^ b->neg;
|
||||
r->top = num;
|
||||
bn_correct_top(r);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -68,7 +68,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
ret = 1;
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef MONT_WORD
|
||||
@@ -82,12 +82,12 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
|
||||
nl = n->top;
|
||||
if (nl == 0) {
|
||||
ret->top = 0;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
max = (2 * nl); /* carry is stored separately */
|
||||
if (bn_wexpand(r, max) == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
r->neg ^= n->neg;
|
||||
np = n->d;
|
||||
@@ -115,7 +115,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
|
||||
}
|
||||
|
||||
if (bn_wexpand(ret, nl) == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
ret->top = nl;
|
||||
ret->neg = r->neg;
|
||||
|
||||
@@ -142,7 +142,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
|
||||
bn_correct_top(ret);
|
||||
bn_check_top(ret);
|
||||
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
#endif /* MONT_WORD */
|
||||
|
||||
@@ -163,7 +163,7 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX_start(ctx);
|
||||
t1 = BN_CTX_get(ctx);
|
||||
t2 = BN_CTX_get(ctx);
|
||||
if (t1 == NULL || t2 == NULL)
|
||||
if (t2 == NULL)
|
||||
goto err;
|
||||
|
||||
if (!BN_copy(t1, a))
|
||||
@@ -190,7 +190,7 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
#endif /* MONT_WORD */
|
||||
return (retn);
|
||||
return retn;
|
||||
}
|
||||
|
||||
BN_MONT_CTX *BN_MONT_CTX_new(void)
|
||||
@@ -198,11 +198,11 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
|
||||
BN_MONT_CTX *ret;
|
||||
|
||||
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
BN_MONT_CTX_init(ret);
|
||||
ret->flags = BN_FLG_MALLOCED;
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
|
||||
@@ -369,7 +369,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
|
||||
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
|
||||
{
|
||||
if (to == from)
|
||||
return (to);
|
||||
return to;
|
||||
|
||||
if (!BN_copy(&(to->RR), &(from->RR)))
|
||||
return NULL;
|
||||
@@ -380,7 +380,7 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
|
||||
to->ri = from->ri;
|
||||
to->n0[0] = from->n0[0];
|
||||
to->n0[1] = from->n0[1];
|
||||
return (to);
|
||||
return to;
|
||||
}
|
||||
|
||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,
|
||||
|
||||
Reference in New Issue
Block a user