From e1d9f1ab39eeab0c3c2b9415e0aaaa8c05858f77 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 7 Mar 2016 17:31:00 +0000 Subject: [PATCH] Remove kinv/r fields from DSA structure. The kinv/r fields in the DSA structure are not used by OpenSSL internally and should not be used in general. Reviewed-by: Rich Salz --- crypto/dsa/dsa_lib.c | 2 -- crypto/dsa/dsa_ossl.c | 12 ++---------- include/openssl/dsa.h | 2 -- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index f89297313a..f7795b27bd 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -180,8 +180,6 @@ void DSA_free(DSA *r) BN_clear_free(r->g); BN_clear_free(r->pub_key); BN_clear_free(r->priv_key); - BN_clear_free(r->kinv); - BN_clear_free(r->r); OPENSSL_free(r); } diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index cbc1e41bb9..0874e89141 100644 --- a/crypto/dsa/dsa_ossl.c +++ b/crypto/dsa/dsa_ossl.c @@ -158,16 +158,8 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) if (ctx == NULL) goto err; redo: - if ((dsa->kinv == NULL) || (dsa->r == NULL)) { - if (!dsa_sign_setup(dsa, ctx, &kinv, &r, dgst, dlen)) - goto err; - } else { - kinv = dsa->kinv; - dsa->kinv = NULL; - r = dsa->r; - dsa->r = NULL; - noredo = 1; - } + if (!dsa_sign_setup(dsa, ctx, &kinv, &r, dgst, dlen)) + goto err; if (dlen > BN_num_bytes(dsa->q)) /* diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h index 643fee4731..a338eaedca 100644 --- a/include/openssl/dsa.h +++ b/include/openssl/dsa.h @@ -164,8 +164,6 @@ struct dsa_st { BIGNUM *g; BIGNUM *pub_key; /* y public key */ BIGNUM *priv_key; /* x private key */ - BIGNUM *kinv; /* Signing pre-calc */ - BIGNUM *r; /* Signing pre-calc */ int flags; /* Normally used to cache montgomery values */ BN_MONT_CTX *method_mont_p; -- 2.25.1