Commit e990b4f8 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Remove dependency of dsa_sign.o and dsa_vrf.o: new functions FIPS_dsa_sig_new

and FIPS_dsa_sig_free, reimplment DSA_SIG_new and DSA_SIG_free from ASN1
library.
parent e47af46c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -308,8 +308,6 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
	../crypto/dsa/dsa_gen.o \
	../crypto/dsa/dsa_key.o \
	../crypto/dsa/dsa_ossl.o \
	../crypto/dsa/dsa_sign.o \
	../crypto/dsa/dsa_vrf.o \
	../crypto/evp/e_aes.o \
	../crypto/evp/e_des3.o \
	../crypto/evp/m_sha1.o \
+0 −2
Original line number Diff line number Diff line
@@ -307,8 +307,6 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
	../crypto/dsa/dsa_gen.o \
	../crypto/dsa/dsa_key.o \
	../crypto/dsa/dsa_ossl.o \
	../crypto/dsa/dsa_sign.o \
	../crypto/dsa/dsa_vrf.o \
	../crypto/evp/e_aes.o \
	../crypto/evp/e_des3.o \
	../crypto/evp/m_sha1.o \
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ ASN1_SEQUENCE_cb(DSA_SIG, sig_cb) = {
	ASN1_SIMPLE(DSA_SIG, s, CBIGNUM)
} ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG)

IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA_SIG, DSA_SIG, DSA_SIG)
IMPLEMENT_ASN1_FUNCTIONS_const(DSA_SIG)

/* Override the default free and new methods */
static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+1 −2
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
redo:
	if ((dsa->kinv == NULL) || (dsa->r == NULL))
		{
		if (!DSA_sign_setup(dsa,ctx,&kinv,&r)) goto err;
		if (!dsa->meth->dsa_sign_setup(dsa,ctx,&kinv,&r)) goto err;
		}
	else
		{
@@ -199,7 +199,6 @@ redo:
	if (BN_cmp(s,dsa->q) > 0)
		if (!BN_sub(s,s,dsa->q)) goto err;
	if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;

	ret=DSA_SIG_new();
	if (ret == NULL) goto err;
	/* Redo if r or s is zero as required by FIPS 186-3: this is
+0 −24
Original line number Diff line number Diff line
@@ -74,27 +74,3 @@ int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
	{
	return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
	}

DSA_SIG *DSA_SIG_new(void)
	{
	DSA_SIG *sig;
	sig = OPENSSL_malloc(sizeof(DSA_SIG));
	if (!sig)
		return NULL;
	sig->r = NULL;
	sig->s = NULL;
	return sig;
	}

void DSA_SIG_free(DSA_SIG *sig)
	{
	if (sig)
		{
		if (sig->r)
			BN_free(sig->r);
		if (sig->s)
			BN_free(sig->s);
		OPENSSL_free(sig);
		}
	}
Loading