Change method_mont_p from (char *) to (BN_MONT_CTX *) and remove several
authorDr. Stephen Henson <steve@openssl.org>
Wed, 27 Apr 2005 00:04:59 +0000 (00:04 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 27 Apr 2005 00:04:59 +0000 (00:04 +0000)
casts.

crypto/dh/dh.h
crypto/dh/dh_key.c
crypto/dsa/dsa.h
crypto/dsa/dsa_ossl.c

index a933601..da44778 100644 (file)
@@ -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;
index 1439a7a..62d05a4 100644 (file)
@@ -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);
        }
index 8eec737..c7ba059 100644 (file)
@@ -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;
index 2f7fef1..8f7ecea 100644 (file)
@@ -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);
 }