summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-01-31 19:08:23 +0100
committerRich Salz <rsalz@openssl.org>2016-02-10 02:13:29 +0100
commiteffaf4dee90beff07bb40f21d81352304a5e8152 (patch)
tree4bc77d1b1998e6fac62b3a5967a223376cb47111 /crypto
parentMake some global variables static (diff)
downloadopenssl-effaf4dee90beff07bb40f21d81352304a5e8152.tar.xz
openssl-effaf4dee90beff07bb40f21d81352304a5e8152.zip
Use NON_EMPTY_TRANSLATION_UNIT, consistently.
This also closes RT 4123 Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/Makefile.in4
-rw-r--r--crypto/asn1/n_pkey.c16
-rw-r--r--crypto/bn/bn_depr.c15
-rw-r--r--crypto/bn/rsaz_exp.c10
-rw-r--r--crypto/build.info2
-rw-r--r--crypto/crypto-lib.com2
-rw-r--r--crypto/dh/dh_depr.c13
-rw-r--r--crypto/dsa/dsa_depr.c23
-rw-r--r--crypto/ebcdic.c11
-rw-r--r--crypto/ec/ecp_nistp224.c6
-rw-r--r--crypto/ec/ecp_nistp256.c6
-rw-r--r--crypto/ec/ecp_nistp521.c6
-rw-r--r--crypto/ec/ecp_nistputil.c6
-rw-r--r--crypto/evp/e_camellia.c11
-rw-r--r--crypto/evp/e_old.c3
-rw-r--r--crypto/evp/p_open.c13
-rw-r--r--crypto/fips_ers.c6
-rw-r--r--crypto/rand/rand_egd.c17
-rw-r--r--crypto/rsa/rsa_depr.c15
19 files changed, 84 insertions, 101 deletions
diff --git a/crypto/Makefile.in b/crypto/Makefile.in
index de98f4a1a7..4727e0aa75 100644
--- a/crypto/Makefile.in
+++ b/crypto/Makefile.in
@@ -33,10 +33,10 @@ GENERAL=Makefile README crypto-lib.com install.com
LIB= $(TOP)/libcrypto.a
SHARED_LIB= libcrypto$(SHLIB_EXT)
LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
- ebcdic.c uid.c o_time.c o_str.c o_dir.c thr_id.c lock.c fips_ers.c \
+ ebcdic.c uid.c o_time.c o_str.c o_dir.c thr_id.c lock.c \
o_init.c o_fips.c mem_sec.c init.c
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o \
- ebcdic.o uid.o o_time.o o_str.o o_dir.o thr_id.o lock.o fips_ers.o \
+ ebcdic.o uid.o o_time.o o_str.o o_dir.o thr_id.o lock.o \
o_init.o o_fips.o mem_sec.o init.o $(CPUID_OBJ)
SRC= $(LIBSRC)
diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
index 90ea32c527..c7382bd944 100644
--- a/crypto/asn1/n_pkey.c
+++ b/crypto/asn1/n_pkey.c
@@ -55,9 +55,13 @@
* [including the GNU Public Licence.]
*/
-#include <stdio.h>
-#include "internal/cryptlib.h"
-#ifndef OPENSSL_NO_RSA
+#include "openssl/opensslconf.h"
+#ifdef OPENSSL_NO_RSA
+NON_EMPTY_TRANSLATION_UNIT
+#else
+
+# include "internal/cryptlib.h"
+# include <stdio.h>
# include <openssl/rsa.h>
# include <openssl/objects.h>
# include <openssl/asn1t.h>
@@ -103,10 +107,4 @@ IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
# endif /* OPENSSL_NO_RC4 */
-#else /* !OPENSSL_NO_RSA */
-
-# if PEDANTIC
-static void *dummy = &dummy;
-# endif
-
#endif
diff --git a/crypto/bn/bn_depr.c b/crypto/bn/bn_depr.c
index 9e6b08f72c..debed8dc83 100644
--- a/crypto/bn/bn_depr.c
+++ b/crypto/bn/bn_depr.c
@@ -57,16 +57,17 @@
* slurp this code if applications are using them directly.
*/
-#include <stdio.h>
-#include <time.h>
-#include "internal/cryptlib.h"
-#include "bn_lcl.h"
#include <openssl/opensslconf.h>
-#include <openssl/rand.h>
+#if OPENSSL_API_COMPAT >= 0x00908000L
+NON_EMPTY_TRANSLATION_UNIT
+#else
-static void *dummy = &dummy;
+# include <stdio.h>
+# include <time.h>
+# include "internal/cryptlib.h"
+# include "bn_lcl.h"
+# include <openssl/rand.h>
-#if OPENSSL_API_COMPAT < 0x00908000L
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
const BIGNUM *add, const BIGNUM *rem,
void (*callback) (int, int, void *), void *cb_arg)
diff --git a/crypto/bn/rsaz_exp.c b/crypto/bn/rsaz_exp.c
index c54c6feb51..7fb70e4afd 100644
--- a/crypto/bn/rsaz_exp.c
+++ b/crypto/bn/rsaz_exp.c
@@ -42,7 +42,9 @@
#include "rsaz_exp.h"
-#ifdef RSAZ_ENABLED
+#ifndef RSAZ_ENABLED
+NON_EMPTY_TRANSLATION_UNIT
+#else
/*
* See crypto/bn/asm/rsaz-avx2.pl for further details.
@@ -337,10 +339,4 @@ void RSAZ_512_mod_exp(BN_ULONG result[8],
OPENSSL_cleanse(storage, sizeof(storage));
}
-#else
-
-# if defined(PEDANTIC) || defined(__DECC) || defined(__clang__)
-static void *dummy = &dummy;
-# endif
-
#endif
diff --git a/crypto/build.info b/crypto/build.info
index f8ae4bd462..90f301a327 100644
--- a/crypto/build.info
+++ b/crypto/build.info
@@ -1,7 +1,7 @@
LIBS=../libcrypto
SOURCE[../libcrypto]=\
cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
- ebcdic.c uid.c o_time.c o_str.c o_dir.c thr_id.c lock.c fips_ers.c \
+ ebcdic.c uid.c o_time.c o_str.c o_dir.c thr_id.c lock.c \
o_init.c o_fips.c mem_sec.c init.c {- $target{cpuid_asm_src} -}
EXTRA= ../ms/uplink-x86.pl ../ms/uplink.c ../ms/applink.c \
x86cpuid.pl x86_64cpuid.pl ia64cpuid.S \
diff --git a/crypto/crypto-lib.com b/crypto/crypto-lib.com
index b31564ff9c..12b820432b 100644
--- a/crypto/crypto-lib.com
+++ b/crypto/crypto-lib.com
@@ -217,7 +217,7 @@ $!
$! Define The Different Encryption "library" Strings.
$!
$ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,cpt_err,"+ -
- "ebcdic,uid,o_time,o_str,o_dir,thr_id,lock,fips_ers,"+ -
+ "ebcdic,uid,o_time,o_str,o_dir,thr_id,lock,"+ -
"o_init,o_fips"
$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref"
$ LIB_MD2 = "md2_dgst,md2_one"
diff --git a/crypto/dh/dh_depr.c b/crypto/dh/dh_depr.c
index 4b38570d5e..90ce0b0d89 100644
--- a/crypto/dh/dh_depr.c
+++ b/crypto/dh/dh_depr.c
@@ -54,15 +54,16 @@
/* This file contains deprecated functions as wrappers to the new ones */
-#include <stdio.h>
-#include "internal/cryptlib.h"
-#include <openssl/bn.h>
-#include <openssl/dh.h>
#include <openssl/opensslconf.h>
+#if OPENSSL_API_COMPAT >= 0x00908000L
+NON_EMPTY_TRANSLATION_UNIT
+#else
-static void *dummy = &dummy;
+# include <stdio.h>
+# include "internal/cryptlib.h"
+# include <openssl/bn.h>
+# include <openssl/dh.h>
-#if OPENSSL_API_COMPAT < 0x00908000L
DH *DH_generate_parameters(int prime_len, int generator,
void (*callback) (int, int, void *), void *cb_arg)
{
diff --git a/crypto/dsa/dsa_depr.c b/crypto/dsa/dsa_depr.c
index e02c10296c..f50fcc01ee 100644
--- a/crypto/dsa/dsa_depr.c
+++ b/crypto/dsa/dsa_depr.c
@@ -64,19 +64,20 @@
*/
#define xxxHASH EVP_sha1()
-static void *dummy = &dummy;
-
-#include <stdio.h>
-#include <time.h>
-#include "internal/cryptlib.h"
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-#include <openssl/dsa.h>
-#include <openssl/rand.h>
-#include <openssl/sha.h>
#include <openssl/opensslconf.h>
+#if OPENSSL_API_COMPAT >= 0x00908000L
+NON_EMPTY_TRANSLATION_UNIT
+#else
+
+# include <stdio.h>
+# include <time.h>
+# include "internal/cryptlib.h"
+# include <openssl/evp.h>
+# include <openssl/bn.h>
+# include <openssl/dsa.h>
+# include <openssl/rand.h>
+# include <openssl/sha.h>
-#if OPENSSL_API_COMPAT < 0x00908000L
DSA *DSA_generate_parameters(int bits,
unsigned char *seed_in, int seed_len,
int *counter_ret, unsigned long *h_ret,
diff --git a/crypto/ebcdic.c b/crypto/ebcdic.c
index 0f1255a470..1248cba260 100644
--- a/crypto/ebcdic.c
+++ b/crypto/ebcdic.c
@@ -1,14 +1,11 @@
-#ifndef CHARSET_EBCDIC
-
# include <openssl/e_os2.h>
-# if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX) || defined(__clang__)
-static void *dummy = &dummy;
-# endif
-
-#else /* CHARSET_EBCDIC */
+#ifndef CHARSET_EBCDIC
+NON_EMPTY_TRANSLATION_UNIT
+#else
# include "ebcdic.h"
+
/*-
* Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De>
* Adapted for OpenSSL-0.9.4 by <Martin.Kraemer@Mch.SNI.De>
diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c
index 173ef5faea..a76b60fc31 100644
--- a/crypto/ec/ecp_nistp224.c
+++ b/crypto/ec/ecp_nistp224.c
@@ -25,7 +25,9 @@
*/
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128
+NON_EMPTY_TRANSLATION_UNIT
+#else
# include <stdint.h>
# include <string.h>
@@ -1677,6 +1679,4 @@ int ec_GFp_nistp224_have_precompute_mult(const EC_GROUP *group)
return HAVEPRECOMP(group, nistp224);
}
-#else
-static void *dummy = &dummy;
#endif
diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c
index 9e33acf0cd..d4bff1ad6d 100644
--- a/crypto/ec/ecp_nistp256.c
+++ b/crypto/ec/ecp_nistp256.c
@@ -26,7 +26,9 @@
*/
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128
+NON_EMPTY_TRANSLATION_UNIT
+#else
# include <stdint.h>
# include <string.h>
@@ -2311,6 +2313,4 @@ int ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group)
{
return HAVEPRECOMP(group, nistp256);
}
-#else
-static void *dummy = &dummy;
#endif
diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c
index 4fff85a7e6..de61a8ab5e 100644
--- a/crypto/ec/ecp_nistp521.c
+++ b/crypto/ec/ecp_nistp521.c
@@ -26,7 +26,9 @@
*/
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128
+NON_EMPTY_TRANSLATION_UNIT
+#else
# ifndef OPENSSL_SYS_VMS
# include <stdint.h>
@@ -2106,6 +2108,4 @@ int ec_GFp_nistp521_have_precompute_mult(const EC_GROUP *group)
return HAVEPRECOMP(group, nistp521);
}
-#else
-static void *dummy = &dummy;
#endif
diff --git a/crypto/ec/ecp_nistputil.c b/crypto/ec/ecp_nistputil.c
index 67808e2a6d..01c88d8e5b 100644
--- a/crypto/ec/ecp_nistputil.c
+++ b/crypto/ec/ecp_nistputil.c
@@ -18,7 +18,9 @@
*/
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
+#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128
+NON_EMPTY_TRANSLATION_UNIT
+#else
/*
* Common utility functions for ecp_nistp224.c, ecp_nistp256.c, ecp_nistp521.c.
@@ -212,6 +214,4 @@ void ec_GFp_nistp_recode_scalar_bits(unsigned char *sign,
*sign = s & 1;
*digit = d;
}
-#else
-static void *dummy = &dummy;
#endif
diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c
index 924df8d0ec..8ebd226762 100644
--- a/crypto/evp/e_camellia.c
+++ b/crypto/evp/e_camellia.c
@@ -53,7 +53,10 @@
*/
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_CAMELLIA
+#ifdef OPENSSL_NO_CAMELLIA
+NON_EMPTY_TRANSLATION_UNIT
+#else
+
# include <openssl/evp.h>
# include <openssl/err.h>
# include <string.h>
@@ -402,10 +405,4 @@ static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
BLOCK_CIPHER_generic_pack(NID_camellia, 128, 0)
BLOCK_CIPHER_generic_pack(NID_camellia, 192, 0)
BLOCK_CIPHER_generic_pack(NID_camellia, 256, 0)
-#else
-
-# ifdef PEDANTIC
-static void *dummy = &dummy;
-# endif
-
#endif
diff --git a/crypto/evp/e_old.c b/crypto/evp/e_old.c
index 759856a8eb..c3185377dc 100644
--- a/crypto/evp/e_old.c
+++ b/crypto/evp/e_old.c
@@ -57,9 +57,8 @@
*/
#include <openssl/opensslconf.h>
-
#if OPENSSL_API_COMPAT >= 0x00908000L
-static void *dummy = &dummy;
+NON_EMPTY_TRANSLATION_UNIT
#else
# include <openssl/evp.h>
diff --git a/crypto/evp/p_open.c b/crypto/evp/p_open.c
index 41a721eea5..7f9c7337b2 100644
--- a/crypto/evp/p_open.c
+++ b/crypto/evp/p_open.c
@@ -55,11 +55,12 @@
* [including the GNU Public Licence.]
*/
-#include <stdio.h>
#include "internal/cryptlib.h"
+#ifdef OPENSSL_NO_RSA
+NON_EMPTY_TRANSLATION_UNIT
+#else
-#ifndef OPENSSL_NO_RSA
-
+# include <stdio.h>
# include <openssl/evp.h>
# include <openssl/objects.h>
# include <openssl/x509.h>
@@ -117,10 +118,4 @@ int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
i = EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL);
return (i);
}
-#else /* !OPENSSL_NO_RSA */
-
-# ifdef PEDANTIC
-static void *dummy = &dummy;
-# endif
-
#endif
diff --git a/crypto/fips_ers.c b/crypto/fips_ers.c
index 1788ed2884..ad6935f7fe 100644
--- a/crypto/fips_ers.c
+++ b/crypto/fips_ers.c
@@ -1,7 +1,7 @@
#include <openssl/opensslconf.h>
-#ifdef OPENSSL_FIPS
-# include "fips_err.h"
+#ifndef OPENSSL_FIPS
+NON_EMPTY_TRANSLATION_UNIT
#else
-static void *dummy = &dummy;
+# include "fips_err.h"
#endif
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index f0d2e55a48..6f13717b5a 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -53,9 +53,14 @@
*
*/
-#include <openssl/crypto.h>
-#include <openssl/e_os2.h>
-#include <openssl/rand.h>
+#include <openssl/opensslconf.h>
+#ifdef OPENSSL_NO_EGD
+NON_EMPTY_TRANSLATION_UNIT
+#else
+
+# include <openssl/crypto.h>
+# include <openssl/e_os2.h>
+# include <openssl/rand.h>
/*-
* Query the EGD <URL: http://www.lothar.com/tech/crypto/>.
@@ -94,8 +99,6 @@
* RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
*/
-#ifndef OPENSSL_NO_EGD
-
# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_UEFI)
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{
@@ -288,8 +291,4 @@ int RAND_egd(const char *path)
# endif
-#else /* OPENSSL_NO_EGD */
-# if PEDANTIC
-static void *dummy = &dummy;
-# endif
#endif
diff --git a/crypto/rsa/rsa_depr.c b/crypto/rsa/rsa_depr.c
index 50b0bb697e..18e406594a 100644
--- a/crypto/rsa/rsa_depr.c
+++ b/crypto/rsa/rsa_depr.c
@@ -57,19 +57,18 @@
* "new" versions).
*/
-#include <stdio.h>
-#include <time.h>
-#include "internal/cryptlib.h"
#include <openssl/opensslconf.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-
#if OPENSSL_API_COMPAT >= 0x00908000L
-
-static void *dummy = &dummy;
+NON_EMPTY_TRANSLATION_UNIT
#else
+# include <stdio.h>
+# include <time.h>
+# include "internal/cryptlib.h"
+# include <openssl/bn.h>
+# include <openssl/rsa.h>
+
RSA *RSA_generate_key(int bits, unsigned long e_value,
void (*callback) (int, int, void *), void *cb_arg)
{