提交 879b1980 编写于 作者: D Dr. Stephen Henson

Change method_mont_p from (char *) to (BN_MONT_CTX *) and remove several

casts.
上级 6ec8e63a
......@@ -114,7 +114,7 @@ struct dh_st
BIGNUM *priv_key; /* x */
int flags;
char *method_mont_p;
BN_MONT_CTX *method_mont_p;
/* Place holders if we want to do X9.42 DH */
BIGNUM *q;
BIGNUM *j;
......
......@@ -130,8 +130,7 @@ static int generate_key(DH *dh)
if (dh->flags & DH_FLAG_CACHE_MONT_P)
{
mont = BN_MONT_CTX_set_locked(
(BN_MONT_CTX **)&dh->method_mont_p,
mont = BN_MONT_CTX_set_locked(&dh->method_mont_p,
CRYPTO_LOCK_DH, dh->p, ctx);
if (!mont)
goto err;
......@@ -178,8 +177,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
if (dh->flags & DH_FLAG_CACHE_MONT_P)
{
mont = BN_MONT_CTX_set_locked(
(BN_MONT_CTX **)&dh->method_mont_p,
mont = BN_MONT_CTX_set_locked(&dh->method_mont_p,
CRYPTO_LOCK_DH, dh->p, ctx);
if (!mont)
goto err;
......@@ -222,6 +220,6 @@ static int dh_init(DH *dh)
static int dh_finish(DH *dh)
{
if(dh->method_mont_p)
BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p);
BN_MONT_CTX_free(dh->method_mont_p);
return(1);
}
......@@ -146,7 +146,7 @@ struct dsa_st
int flags;
/* Normally used to cache montgomery values */
char *method_mont_p;
BN_MONT_CTX *method_mont_p;
int references;
CRYPTO_EX_DATA ex_data;
const DSA_METHOD *meth;
......
......@@ -230,7 +230,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
{
if (!BN_MONT_CTX_set_locked((BN_MONT_CTX **)&dsa->method_mont_p,
if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p,
CRYPTO_LOCK_DSA,
dsa->p, ctx))
goto err;
......@@ -238,7 +238,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
/* Compute r = (g^k mod p) mod q */
DSA_BN_MOD_EXP(goto err, dsa, r, dsa->g, &k, dsa->p, ctx,
(BN_MONT_CTX *)dsa->method_mont_p);
dsa->method_mont_p);
if (!BN_mod(r,r,dsa->q,ctx)) goto err;
/* Compute part of 's = inv(k) (m + xr) mod q' */
......@@ -311,8 +311,7 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
{
mont = BN_MONT_CTX_set_locked(
(BN_MONT_CTX **)&dsa->method_mont_p,
mont = BN_MONT_CTX_set_locked(&dsa->method_mont_p,
CRYPTO_LOCK_DSA, dsa->p, ctx);
if (!mont)
goto err;
......@@ -348,7 +347,7 @@ static int dsa_init(DSA *dsa)
static int dsa_finish(DSA *dsa)
{
if(dsa->method_mont_p)
BN_MONT_CTX_free((BN_MONT_CTX *)dsa->method_mont_p);
BN_MONT_CTX_free(dsa->method_mont_p);
return(1);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册