From 75f648aa06933a5b5436d2ae4a764be68ab22c4d Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Mon, 28 Sep 2015 17:00:00 -0400 Subject: [PATCH] Make update / libeay.num fix Looks like someone forgot to do a "make update" since crypto/ts/Makefile keeps changing. So include that. Second is that the declare_dh_bn macro fools the libeay.num script. The declarations are only needed in one file (dh_rfc5114) so remove them from the header and put the "raw" declarations directly into that file. Reviewed-by: Richard Levitte --- crypto/dh/dh_rfc5114.c | 38 ++++++++++++++++++++------------------ include/openssl/dh.h | 11 ----------- test/Makefile | 17 +++++++++++++++-- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/crypto/dh/dh_rfc5114.c b/crypto/dh/dh_rfc5114.c index 61cd9ad4d1..8819ac087b 100644 --- a/crypto/dh/dh_rfc5114.c +++ b/crypto/dh/dh_rfc5114.c @@ -63,27 +63,29 @@ /* * Macro to make a DH structure from BIGNUM data. NB: although just copying - * the BIGNUM static pointers would be more efficient we can't as they get - * wiped using BN_clear_free() when DH_free() is called. + * the BIGNUM static pointers would be more efficient, we can't do that + * because they get wiped using BN_clear_free() when DH_free() is called. */ #define make_dh(x) \ -DH * DH_get_##x(void) \ - { \ - DH *dh; \ - dh = DH_new(); \ - if (!dh) \ - return NULL; \ - dh->p = BN_dup(&_bignum_dh##x##_p); \ - dh->g = BN_dup(&_bignum_dh##x##_g); \ - dh->q = BN_dup(&_bignum_dh##x##_q); \ - if (!dh->p || !dh->q || !dh->g) \ - { \ - DH_free(dh); \ - return NULL; \ - } \ - return dh; \ - } +\ +extern const BIGNUM _bignum_dh##x##_p, _bignum_dh##x##_g, _bignum_dh##x##_q; \ +\ +DH *DH_get_##x(void) \ +{ \ + DH *dh = DH_new(); \ +\ + if (dh == NULL) \ + return NULL; \ + dh->p = BN_dup(&_bignum_dh##x##_p); \ + dh->g = BN_dup(&_bignum_dh##x##_g); \ + dh->q = BN_dup(&_bignum_dh##x##_q); \ + if (dh->p == NULL || dh->q == NULL || dh->g == NULL) {\ + DH_free(dh); \ + return NULL; \ + } \ + return dh; \ +} make_dh(1024_160) make_dh(2048_224) diff --git a/include/openssl/dh.h b/include/openssl/dh.h index 0957a5892c..f5b03d32f5 100644 --- a/include/openssl/dh.h +++ b/include/openssl/dh.h @@ -342,17 +342,6 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, # define EVP_PKEY_DH_KDF_X9_42 2 # endif -#define declare_dh_bn(x) \ - const extern BIGNUM _bignum_dh##x##_p;\ - const extern BIGNUM _bignum_dh##x##_g;\ - const extern BIGNUM _bignum_dh##x##_q; - -declare_dh_bn(1024_160) -declare_dh_bn(2048_224) -declare_dh_bn(2048_256) - -#undef declare_dh_bn - /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes diff --git a/test/Makefile b/test/Makefile index 5c695cd66b..6f32758074 100644 --- a/test/Makefile +++ b/test/Makefile @@ -524,8 +524,21 @@ gmdifftest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h gmdifftest.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h gmdifftest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h gmdifftest.o: gmdifftest.c -gost2814789test.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h -gost2814789test.o: gost2814789test.c +gost2814789test.o: ../e_os.h ../engines/ccgost/gost89.h +gost2814789test.o: ../include/openssl/asn1.h ../include/openssl/bio.h +gost2814789test.o: ../include/openssl/buffer.h ../include/openssl/conf.h +gost2814789test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h +gost2814789test.o: ../include/openssl/ec.h ../include/openssl/ecdh.h +gost2814789test.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h +gost2814789test.o: ../include/openssl/err.h ../include/openssl/evp.h +gost2814789test.o: ../include/openssl/hmac.h ../include/openssl/lhash.h +gost2814789test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h +gost2814789test.o: ../include/openssl/opensslconf.h +gost2814789test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h +gost2814789test.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h +gost2814789test.o: ../include/openssl/sha.h ../include/openssl/stack.h +gost2814789test.o: ../include/openssl/symhacks.h ../include/openssl/x509.h +gost2814789test.o: ../include/openssl/x509_vfy.h gost2814789test.c heartbeat_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h heartbeat_test.o: ../include/openssl/bn.h ../include/openssl/buffer.h heartbeat_test.o: ../include/openssl/comp.h ../include/openssl/crypto.h -- 2.34.1