From 3c27208fab1dc29f47f088490404df5abfcdfb05 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 18 Mar 2016 14:30:20 -0400 Subject: Remove #error from include files. Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte --- include/openssl/aes.h | 19 ++++++++----------- include/openssl/blowfish.h | 15 +++++++-------- include/openssl/bn.h | 2 +- include/openssl/camellia.h | 19 ++++++++----------- include/openssl/cast.h | 14 ++++++-------- include/openssl/cms.h | 18 +++++++++--------- include/openssl/comp.h | 15 ++++++++------- include/openssl/ct.h | 15 ++++++++------- include/openssl/des.h | 21 ++++++++++----------- include/openssl/dh.h | 30 ++++++++++-------------------- include/openssl/dsa.h | 24 ++++++++++-------------- include/openssl/ec.h | 22 +++++----------------- include/openssl/engine.h | 34 +++++++++++----------------------- include/openssl/idea.h | 14 ++++++-------- include/openssl/lhash.h | 4 ---- include/openssl/md2.h | 18 +++++++++--------- include/openssl/md4.h | 16 ++++++++-------- include/openssl/md5.h | 15 +++++++-------- include/openssl/mdc2.h | 15 +++++++-------- include/openssl/rc2.h | 15 +++++++-------- include/openssl/rc4.h | 12 +++++------- include/openssl/rc5.h | 14 ++++++-------- include/openssl/ripemd.h | 17 +++++++++-------- include/openssl/rsa.h | 22 ++++++++-------------- include/openssl/seed.h | 20 +++++++++----------- include/openssl/srp.h | 23 ++++++++++------------- include/openssl/ssl.h | 7 +------ include/openssl/ssl3.h | 4 +--- include/openssl/ts.h | 28 ++++++++++------------------ include/openssl/whrlpool.h | 15 ++++++++------- include/openssl/x509.h | 17 ++++------------- 31 files changed, 216 insertions(+), 308 deletions(-) (limited to 'include') diff --git a/include/openssl/aes.h b/include/openssl/aes.h index 8c36a4d64f..f81ec0dc51 100644 --- a/include/openssl/aes.h +++ b/include/openssl/aes.h @@ -53,11 +53,11 @@ # include -# ifdef OPENSSL_NO_AES -# error AES is disabled. -# endif - +#ifndef OPENSSL_NO_AES # include +# ifdef __cplusplus +extern "C" { +# endif # define AES_ENCRYPT 1 # define AES_DECRYPT 0 @@ -69,10 +69,6 @@ # define AES_MAXNR 14 # define AES_BLOCK_SIZE 16 -#ifdef __cplusplus -extern "C" { -#endif - /* This should be a hidden type, but EVP requires that the size be known */ struct aes_key_st { # ifdef AES_LONG @@ -131,8 +127,9 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, const unsigned char *in, unsigned int inlen); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif -#endif /* !HEADER_AES_H */ +#endif diff --git a/include/openssl/blowfish.h b/include/openssl/blowfish.h index ee4afa542d..5e0af533cf 100644 --- a/include/openssl/blowfish.h +++ b/include/openssl/blowfish.h @@ -58,14 +58,12 @@ #ifndef HEADER_BLOWFISH_H # define HEADER_BLOWFISH_H -# include +# include -#ifdef __cplusplus +# ifndef OPENSSL_NO_BF +# include +# ifdef __cplusplus extern "C" { -#endif - -# ifdef OPENSSL_NO_BF -# error BF is disabled. # endif # define BF_ENCRYPT 1 @@ -103,8 +101,9 @@ void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, unsigned char *ivec, int *num); const char *BF_options(void); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/bn.h b/include/openssl/bn.h index 8d2d5a8be0..315b99e748 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h @@ -126,7 +126,7 @@ # include # ifndef OPENSSL_NO_STDIO -# include /* FILE */ +# include # endif # include # include diff --git a/include/openssl/camellia.h b/include/openssl/camellia.h index d04d2a8b3a..d05b392549 100644 --- a/include/openssl/camellia.h +++ b/include/openssl/camellia.h @@ -53,11 +53,11 @@ # include -# ifdef OPENSSL_NO_CAMELLIA -# error CAMELLIA is disabled. -# endif - +# ifndef OPENSSL_NO_CAMELLIA # include +#ifdef __cplusplus +extern "C" { +#endif # define CAMELLIA_ENCRYPT 1 # define CAMELLIA_DECRYPT 0 @@ -67,10 +67,6 @@ * Both sizes are in bytes. */ -#ifdef __cplusplus -extern "C" { -#endif - /* This should be a hidden type, but EVP requires that the size be known */ # define CAMELLIA_BLOCK_SIZE 16 @@ -120,8 +116,9 @@ void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], unsigned int *num); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif -#endif /* !HEADER_Camellia_H */ +#endif diff --git a/include/openssl/cast.h b/include/openssl/cast.h index 87d1933a9b..c54d3c9219 100644 --- a/include/openssl/cast.h +++ b/include/openssl/cast.h @@ -58,14 +58,11 @@ #ifndef HEADER_CAST_H # define HEADER_CAST_H -#ifdef __cplusplus -extern "C" { -#endif - # include -# ifdef OPENSSL_NO_CAST -# error CAST is disabled. +# ifndef OPENSSL_NO_CAST +# ifdef __cplusplus +extern "C" { # endif # define CAST_ENCRYPT 1 @@ -96,8 +93,9 @@ void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *schedule, unsigned char *ivec, int *num); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/cms.h b/include/openssl/cms.h index f8d55d84d2..5ae701e585 100644 --- a/include/openssl/cms.h +++ b/include/openssl/cms.h @@ -54,16 +54,14 @@ #ifndef HEADER_CMS_H # define HEADER_CMS_H +# include + +# ifndef OPENSSL_NO_CMS # include # include - -# ifdef OPENSSL_NO_CMS -# error CMS is disabled. -# endif - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif +# endif typedef struct CMS_ContentInfo_st CMS_ContentInfo; typedef struct CMS_SignerInfo_st CMS_SignerInfo; @@ -551,7 +549,9 @@ void ERR_load_CMS_strings(void); # define CMS_R_VERIFICATION_FAILURE 158 # define CMS_R_WRAP_ERROR 159 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/comp.h b/include/openssl/comp.h index de16a9fcdb..de4eb32561 100644 --- a/include/openssl/comp.h +++ b/include/openssl/comp.h @@ -56,15 +56,14 @@ #ifndef HEADER_COMP_H # define HEADER_COMP_H -# include +# include -# ifdef OPENSSL_NO_COMP -# error COMP is disabled. +# ifndef OPENSSL_NO_COMP +# include +# ifdef __cplusplus +extern "C" { # endif -#ifdef __cplusplus -extern "C" { -#endif COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); @@ -110,5 +109,7 @@ void ERR_load_COMP_strings(void); #ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/ct.h b/include/openssl/ct.h index f148a270aa..0da3125d17 100644 --- a/include/openssl/ct.h +++ b/include/openssl/ct.h @@ -51,21 +51,20 @@ * ==================================================================== */ -#ifdef OPENSSL_NO_CT -# error "CT is disabled" -#endif - #ifndef HEADER_CT_H # define HEADER_CT_H +# include + +# ifndef OPENSSL_NO_CT # include # include # include - # ifdef __cplusplus extern "C" { # endif + /* Minimum RSA key size, from RFC6962 */ # define SCT_MIN_RSA_BITS 2048 @@ -601,7 +600,9 @@ void ERR_load_CT_strings(void); # define CT_R_UNSUPPORTED_ENTRY_TYPE 102 # define CT_R_UNSUPPORTED_VERSION 103 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/des.h b/include/openssl/des.h index 13ce232703..633d070b39 100644 --- a/include/openssl/des.h +++ b/include/openssl/des.h @@ -55,14 +55,16 @@ * [including the GNU Public Licence.] */ -#ifndef HEADER_NEW_DES_H -# define HEADER_NEW_DES_H +#ifndef HEADER_DES_H +# define HEADER_DES_H -# include +# include -# ifdef OPENSSL_NO_DES -# error DES is disabled. +# ifndef OPENSSL_NO_DES +# ifdef __cplusplus +extern "C" { # endif +# include typedef unsigned int DES_LONG; @@ -71,10 +73,6 @@ typedef unsigned int DES_LONG; # define OPENSSL_EXTERN OPENSSL_EXPORT # endif -#ifdef __cplusplus -extern "C" { -#endif - typedef unsigned char DES_cblock[8]; typedef /* const */ unsigned char const_DES_cblock[8]; /* @@ -228,8 +226,9 @@ int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, # define DES_fixup_key_parity DES_set_odd_parity -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/dh.h b/include/openssl/dh.h index e852cbe446..2e021e235b 100644 --- a/include/openssl/dh.h +++ b/include/openssl/dh.h @@ -58,13 +58,10 @@ #ifndef HEADER_DH_H # define HEADER_DH_H -# include # include -# ifdef OPENSSL_NO_DH -# error DH is disabled. -# endif - +# ifndef OPENSSL_NO_DH +# include # include # include # include @@ -72,6 +69,10 @@ # include # endif +# ifdef __cplusplus +extern "C" { +# endif + # ifndef OPENSSL_DH_MAX_MODULUS_BITS # define OPENSSL_DH_MAX_MODULUS_BITS 10000 # endif @@ -79,15 +80,6 @@ # define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 # define DH_FLAG_CACHE_MONT_P 0x01 - -/* - * new with 0.9.7h; the built-in DH - * implementation now uses constant time - * modular exponentiation for secret exponents - * by default. This flag causes the - * faster variable sliding window method to - * be used for all exponents. - */ # define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* @@ -107,10 +99,6 @@ # define DH_FLAG_NON_FIPS_ALLOW 0x0400 -#ifdef __cplusplus -extern "C" { -#endif - /* Already defined in ossl_typ.h */ /* typedef struct dh_st DH; */ /* typedef struct dh_method DH_METHOD; */ @@ -389,7 +377,9 @@ void ERR_load_DH_strings(void); # define DH_R_PEER_KEY_ERROR 111 # define DH_R_SHARED_INFO_ERROR 113 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h index 865344932f..240a1afa84 100644 --- a/include/openssl/dsa.h +++ b/include/openssl/dsa.h @@ -63,22 +63,20 @@ #ifndef HEADER_DSA_H # define HEADER_DSA_H -# include +# include -# ifdef OPENSSL_NO_DSA -# error DSA is disabled. +# ifndef OPENSSL_NO_DSA +# ifdef __cplusplus +extern "C" { # endif - +# include # include # include # include # include - # if OPENSSL_API_COMPAT < 0x10100000L # include -# ifndef OPENSSL_NO_DH -# include -# endif +# include # endif # ifndef OPENSSL_DSA_MAX_MODULUS_BITS @@ -113,10 +111,6 @@ # define DSA_FLAG_NON_FIPS_ALLOW 0x0400 # define DSA_FLAG_FIPS_CHECKED 0x0800 -#ifdef __cplusplus -extern "C" { -#endif - /* Already defined in ossl_typ.h */ /* typedef struct dsa_st DSA; */ /* typedef struct dsa_method DSA_METHOD; */ @@ -323,7 +317,9 @@ void ERR_load_DSA_strings(void); # define DSA_R_PARAMETER_ENCODING_ERROR 105 # define DSA_R_Q_NOT_PRIME 113 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/ec.h b/include/openssl/ec.h index 103f718208..892239dd87 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h @@ -1,12 +1,6 @@ - -/* crypto/ec/ec.h */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ -/** - * \file crypto/ec/ec.h Include file for the OpenSSL EC functions - * \author Originally written by Bodo Moeller for the OpenSSL project - */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * @@ -79,22 +73,14 @@ # include -# ifdef OPENSSL_NO_EC -# error EC is disabled. -# endif - +# ifndef OPENSSL_NO_EC # include # include # if OPENSSL_API_COMPAT < 0x10100000L # include # endif - # ifdef __cplusplus extern "C" { -# elif defined(__SUNPRO_C) -# if __SUNPRO_C >= 0x520 -# pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) -# endif # endif # ifndef OPENSSL_ECC_MAX_FIELD_BITS @@ -1650,7 +1636,9 @@ void ERR_load_EC_strings(void); # define EC_R_WRONG_CURVE_PARAMETERS 145 # define EC_R_WRONG_ORDER 130 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/engine.h b/include/openssl/engine.h index d1cd17a24c..c12e02755f 100644 --- a/include/openssl/engine.h +++ b/include/openssl/engine.h @@ -66,37 +66,23 @@ # include -# ifdef OPENSSL_NO_ENGINE -# error ENGINE is disabled. -# endif - +# ifndef OPENSSL_NO_ENGINE # if OPENSSL_API_COMPAT < 0x10100000L # include -# ifndef OPENSSL_NO_RSA -# include -# endif -# ifndef OPENSSL_NO_DSA -# include -# endif -# ifndef OPENSSL_NO_DH -# include -# endif -# ifndef OPENSSL_NO_EC -# include -# endif +# include +# include +# include +# include # include # include # include # endif - # include # include - # include - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif +# endif /* * These flags are used to control combinations of algorithm (methods) by @@ -905,7 +891,9 @@ void ERR_load_ENGINE_strings(void); # define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 # define ENGINE_R_VERSION_INCOMPATIBILITY 145 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/idea.h b/include/openssl/idea.h index 29b5094394..165ee405ac 100644 --- a/include/openssl/idea.h +++ b/include/openssl/idea.h @@ -60,8 +60,9 @@ # include -# ifdef OPENSSL_NO_IDEA -# error IDEA is disabled. +# ifndef OPENSSL_NO_IDEA +# ifdef __cplusplus +extern "C" { # endif typedef unsigned int IDEA_INT; @@ -72,10 +73,6 @@ typedef unsigned int IDEA_INT; # define IDEA_BLOCK 8 # define IDEA_KEY_LENGTH 16 -#ifdef __cplusplus -extern "C" { -#endif - typedef struct idea_key_st { IDEA_INT data[9][6]; } IDEA_KEY_SCHEDULE; @@ -95,8 +92,9 @@ void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h index 899544ce04..2edd738a8b 100644 --- a/include/openssl/lhash.h +++ b/include/openssl/lhash.h @@ -63,10 +63,6 @@ # define HEADER_LHASH_H # include -# ifndef OPENSSL_NO_STDIO -# include -# endif - # include #ifdef __cplusplus diff --git a/include/openssl/md2.h b/include/openssl/md2.h index 1dba7cf395..d77a4fac9c 100644 --- a/include/openssl/md2.h +++ b/include/openssl/md2.h @@ -59,20 +59,18 @@ # define HEADER_MD2_H # include -# ifdef OPENSSL_NO_MD2 -# error MD2 is disabled. -# endif + +# ifndef OPENSSL_NO_MD2 # include +# ifdef __cplusplus +extern "C" { +# endif typedef unsigned char MD2_INT; # define MD2_DIGEST_LENGTH 16 # define MD2_BLOCK 16 -#ifdef __cplusplus -extern "C" { -#endif - typedef struct MD2state_st { unsigned int num; unsigned char data[MD2_BLOCK]; @@ -85,8 +83,10 @@ int MD2_Init(MD2_CTX *c); int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); int MD2_Final(unsigned char *md, MD2_CTX *c); unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); -#ifdef __cplusplus + +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/md4.h b/include/openssl/md4.h index c937625f93..b40a839128 100644 --- a/include/openssl/md4.h +++ b/include/openssl/md4.h @@ -58,15 +58,13 @@ #ifndef HEADER_MD4_H # define HEADER_MD4_H +# include + +# ifndef OPENSSL_NO_MD4 # include # include - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif - -# ifdef OPENSSL_NO_MD4 -# error MD4 is disabled. # endif /*- @@ -92,8 +90,10 @@ int MD4_Update(MD4_CTX *c, const void *data, size_t len); int MD4_Final(unsigned char *md, MD4_CTX *c); unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); void MD4_Transform(MD4_CTX *c, const unsigned char *b); -#ifdef __cplusplus + +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/md5.h b/include/openssl/md5.h index 02ea76a54e..5b34b463e9 100644 --- a/include/openssl/md5.h +++ b/include/openssl/md5.h @@ -58,15 +58,13 @@ #ifndef HEADER_MD5_H # define HEADER_MD5_H +# include + +# ifndef OPENSSL_NO_MD5 # include # include - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif - -# ifdef OPENSSL_NO_MD5 -# error MD5 is disabled. # endif /* @@ -92,8 +90,9 @@ int MD5_Update(MD5_CTX *c, const void *data, size_t len); int MD5_Final(unsigned char *md, MD5_CTX *c); unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); void MD5_Transform(MD5_CTX *c, const unsigned char *b); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/mdc2.h b/include/openssl/mdc2.h index fc9784fa18..229b122719 100644 --- a/include/openssl/mdc2.h +++ b/include/openssl/mdc2.h @@ -58,14 +58,12 @@ #ifndef HEADER_MDC2_H # define HEADER_MDC2_H -# include +# include -#ifdef __cplusplus +#ifndef OPENSSL_NO_MDC2 +# include +# ifdef __cplusplus extern "C" { -#endif - -# ifdef OPENSSL_NO_MDC2 -# error MDC2 is disabled. # endif # define MDC2_BLOCK 8 @@ -83,8 +81,9 @@ int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); int MDC2_Final(unsigned char *md, MDC2_CTX *c); unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/rc2.h b/include/openssl/rc2.h index 0bf6ae31ec..50be22dcec 100644 --- a/include/openssl/rc2.h +++ b/include/openssl/rc2.h @@ -59,8 +59,10 @@ # define HEADER_RC2_H # include -# ifdef OPENSSL_NO_RC2 -# error RC2 is disabled. + +# ifndef OPENSSL_NO_RC2 +# ifdef __cplusplus +extern "C" { # endif typedef unsigned int RC2_INT; @@ -71,10 +73,6 @@ typedef unsigned int RC2_INT; # define RC2_BLOCK 8 # define RC2_KEY_LENGTH 16 -#ifdef __cplusplus -extern "C" { -#endif - typedef struct rc2_key_st { RC2_INT data[64]; } RC2_KEY; @@ -93,8 +91,9 @@ void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *schedule, unsigned char *ivec, int *num); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/rc4.h b/include/openssl/rc4.h index c938fdb92a..a5fdbfb92c 100644 --- a/include/openssl/rc4.h +++ b/include/openssl/rc4.h @@ -58,13 +58,10 @@ #ifndef HEADER_RC4_H # define HEADER_RC4_H -# include /* OPENSSL_NO_RC4, RC4_INT */ -# ifdef OPENSSL_NO_RC4 -# error RC4 is disabled. -# endif +# include +# ifndef OPENSSL_NO_RC4 # include - #ifdef __cplusplus extern "C" { #endif @@ -79,8 +76,9 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, unsigned char *outdata); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/rc5.h b/include/openssl/rc5.h index 026a1147a9..c1ff358ad3 100644 --- a/include/openssl/rc5.h +++ b/include/openssl/rc5.h @@ -58,14 +58,11 @@ #ifndef HEADER_RC5_H # define HEADER_RC5_H -# include /* OPENSSL_NO_RC5 */ +# include -#ifdef __cplusplus +# ifndef OPENSSL_NO_RC5 +# ifdef __cplusplus extern "C" { -#endif - -# ifdef OPENSSL_NO_RC5 -# error RC5 is disabled. # endif # define RC5_ENCRYPT 1 @@ -106,8 +103,9 @@ void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *schedule, unsigned char *ivec, int *num); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/ripemd.h b/include/openssl/ripemd.h index 8a098f66a6..97e5df7694 100644 --- a/include/openssl/ripemd.h +++ b/include/openssl/ripemd.h @@ -58,15 +58,13 @@ #ifndef HEADER_RIPEMD_H # define HEADER_RIPEMD_H +# include + +#ifndef OPENSSL_NO_RMD160 # include # include - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif - -# ifdef OPENSSL_NO_RMD160 -# error RMD160 is disabled. # endif # define RIPEMD160_LONG unsigned int @@ -87,8 +85,11 @@ int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); -#ifdef __cplusplus + +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h index adad0f144c..e7ae827715 100644 --- a/include/openssl/rsa.h +++ b/include/openssl/rsa.h @@ -59,26 +59,18 @@ # define HEADER_RSA_H # include -# include +# ifndef OPENSSL_NO_RSA +# include # include # include # include # if OPENSSL_API_COMPAT < 0x10100000L # include # endif - -# ifdef OPENSSL_NO_RSA -# error RSA is disabled. -# endif - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif - -/* Declared already in ossl_typ.h */ -/* typedef struct rsa_st RSA; */ -/* typedef struct rsa_meth_st RSA_METHOD; */ +# endif struct rsa_meth_st { const char *name; @@ -638,7 +630,9 @@ void ERR_load_RSA_strings(void); # define RSA_R_VALUE_MISSING 147 # define RSA_R_WRONG_SIGNATURE_LENGTH 119 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif + #endif diff --git a/include/openssl/seed.h b/include/openssl/seed.h index 918f70c658..e643e762ad 100644 --- a/include/openssl/seed.h +++ b/include/openssl/seed.h @@ -81,12 +81,14 @@ # define HEADER_SEED_H # include + +# ifndef OPENSSL_NO_SEED # include # include -# ifdef OPENSSL_NO_SEED -# error SEED is disabled. -# endif +#ifdef __cplusplus +extern "C" { +#endif /* look whether we need 'long' to get 32 bits */ # ifdef AES_LONG @@ -102,11 +104,6 @@ # define SEED_BLOCK_SIZE 16 # define SEED_KEY_LENGTH 16 - -#ifdef __cplusplus -extern "C" { -#endif - typedef struct seed_key_st { # ifdef SEED_LONG unsigned long data[32]; @@ -138,8 +135,9 @@ void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif -#endif /* HEADER_SEED_H */ +#endif diff --git a/include/openssl/srp.h b/include/openssl/srp.h index 4111d51827..37e7678863 100644 --- a/include/openssl/srp.h +++ b/include/openssl/srp.h @@ -56,26 +56,22 @@ * Hudson (tjh@cryptsoft.com). * */ -#ifndef __SRP_H__ -# define __SRP_H__ +#ifndef HEADER_SRP_H +# define HEADER_SRP_H #include -# ifdef OPENSSL_NO_SRP -# error SRP is disabled. -# endif - +#ifndef OPENSSL_NO_SRP # include # include - -#ifdef __cplusplus -extern "C" { -#endif - # include # include # include +# ifdef __cplusplus +extern "C" { +# endif + typedef struct SRP_gN_cache_st { char *b64_bn; BIGNUM *bn; @@ -175,8 +171,9 @@ int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N); # define SRP_MINIMAL_N 1024 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 92e0274aaa..3d440b68cb 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -144,10 +144,7 @@ # include # include - -#ifndef OPENSSL_NO_COMP # include -#endif # include # if OPENSSL_API_COMPAT < 0x10100000L # include @@ -161,9 +158,7 @@ # include # include -# ifndef OPENSSL_NO_CT -# include -# endif +# include #ifdef __cplusplus extern "C" { diff --git a/include/openssl/ssl3.h b/include/openssl/ssl3.h index ecbe24715d..6ff00bc970 100644 --- a/include/openssl/ssl3.h +++ b/include/openssl/ssl3.h @@ -116,9 +116,7 @@ #ifndef HEADER_SSL3_H # define HEADER_SSL3_H -# ifndef OPENSSL_NO_COMP -# include -# endif +# include # include # include # include diff --git a/include/openssl/ts.h b/include/openssl/ts.h index ca3969f8c5..2e1514ef5e 100644 --- a/include/openssl/ts.h +++ b/include/openssl/ts.h @@ -60,6 +60,7 @@ # define HEADER_TS_H # include + # ifndef OPENSSL_NO_TS # include # include @@ -68,22 +69,12 @@ # include # include # include - -# ifndef OPENSSL_NO_RSA -# include -# endif - -# ifndef OPENSSL_NO_DSA -# include -# endif - -# ifndef OPENSSL_NO_DH -# include -# endif - -#ifdef __cplusplus +# include +# include +# include +# ifdef __cplusplus extern "C" { -#endif +# endif # ifdef WIN32 /* Under Win32 this is defined in wincrypt.h */ @@ -697,8 +688,9 @@ void ERR_load_TS_strings(void); # define TS_R_VAR_LOOKUP_FAILURE 136 # define TS_R_WRONG_CONTENT_TYPE 114 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif -#endif +# endif +# endif + #endif diff --git a/include/openssl/whrlpool.h b/include/openssl/whrlpool.h index 31fc2ff132..bc460351d0 100644 --- a/include/openssl/whrlpool.h +++ b/include/openssl/whrlpool.h @@ -1,12 +1,14 @@ #ifndef HEADER_WHRLPOOL_H # define HEADER_WHRLPOOL_H +#include + +# ifndef OPENSSL_NO_WHIRLPOOL # include # include - -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif +# endif # define WHIRLPOOL_DIGEST_LENGTH (512/8) # define WHIRLPOOL_BBLOCK 512 @@ -23,16 +25,15 @@ typedef struct { size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; } WHIRLPOOL_CTX; -# ifndef OPENSSL_NO_WHIRLPOOL int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); -# endif -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif +# endif #endif diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 5c138ca971..d21460a33e 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -72,21 +72,12 @@ # include # include # include - -# ifndef OPENSSL_NO_EC -# include -# endif +# include # if OPENSSL_API_COMPAT < 0x10100000L -# ifndef OPENSSL_NO_RSA -# include -# endif -# ifndef OPENSSL_NO_DSA -# include -# endif -# ifndef OPENSSL_NO_DH -# include -# endif +# include +# include +# include # endif # include -- cgit v1.2.3