diff options
author | Rich Salz <rsalz@akamai.com> | 2020-03-05 18:50:31 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-04-16 13:52:22 +0200 |
commit | 705536e2b5c4167dbda2e0046d83f9e0f4a65514 (patch) | |
tree | 5b76e00908f3d8c5dcbb75f094a4c06d989e97d5 /crypto/evp | |
parent | Add DH keygen to providers (diff) | |
download | openssl-705536e2b5c4167dbda2e0046d83f9e0f4a65514.tar.xz openssl-705536e2b5c4167dbda2e0046d83f9e0f4a65514.zip |
Use build.info, not ifdef for crypto modules
Don't wrap conditionally-compiled files in global ifndef tests.
Instead, test if the feature is disabled and, if so, do not
compile it.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11263)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/build.info | 23 | ||||
-rw-r--r-- | crypto/evp/e_camellia.c | 52 | ||||
-rw-r--r-- | crypto/evp/e_old.c | 53 | ||||
-rw-r--r-- | crypto/evp/e_seed.c | 17 | ||||
-rw-r--r-- | crypto/evp/p_open.c | 14 |
5 files changed, 76 insertions, 83 deletions
diff --git a/crypto/evp/build.info b/crypto/evp/build.info index 846cd65513..82669c1816 100644 --- a/crypto/evp/build.info +++ b/crypto/evp/build.info @@ -6,14 +6,14 @@ $COMMON=digest.c evp_enc.c evp_lib.c evp_fetch.c cmeth_lib.c evp_utils.c \ SOURCE[../../libcrypto]=$COMMON\ encode.c evp_key.c evp_cnf.c \ - e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ - e_rc4.c e_aes.c names.c e_seed.c e_aria.c e_sm4.c \ + e_des.c e_bf.c e_idea.c e_des3.c \ + e_rc4.c e_aes.c names.c e_aria.c e_sm4.c \ e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c m_null.c \ - p_open.c p_seal.c p_sign.c p_verify.c \ + p_seal.c p_sign.c p_verify.c \ bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ c_allc.c c_alld.c bio_ok.c \ evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c pbe_scrypt.c \ - pkey_kdf.c e_old.c pmeth_fn.c\ + pkey_kdf.c pmeth_fn.c\ e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c e_rc4_hmac_md5.c \ e_chacha20_poly1305.c \ pkey_mac.c \ @@ -22,7 +22,12 @@ SOURCE[../../libcrypto]=$COMMON\ IF[{- !$disabled{'deprecated-3.0'} -}] SOURCE[../../libcrypto]=p_enc.c p_dec.c ENDIF - +IF[{- !$disabled{'deprecated-0.9.8'} -}] + SOURCE[../../libcrypto]=e_old.c +ENDIF +IF[{- !$disabled{'rsa'} -}] + SOURCE[../../libcrypto]=p_open.c +ENDIF IF[{- !$disabled{md2} -}] SOURCE[../../libcrypto]=legacy_md2.c ENDIF @@ -44,6 +49,13 @@ ENDIF IF[{- !$disabled{rmd160} -}] SOURCE[../../libcrypto]=legacy_ripemd.c ENDIF +IF[{- !$disabled{seed} -}] + SOURCE[../../libcrypto]=e_seed.c +ENDIF +IF[{- !$disabled{camellia} -}] + SOURCE[../../libcrypto]=e_camellia.c + INCLUDE[e_camellia.o]=.. ../modes +ENDIF SOURCE[../../providers/libfips.a]=$COMMON @@ -51,7 +63,6 @@ INCLUDE[e_aes.o]=.. ../modes INCLUDE[e_aes_cbc_hmac_sha1.o]=../modes INCLUDE[e_aes_cbc_hmac_sha256.o]=../modes INCLUDE[e_aria.o]=.. ../modes -INCLUDE[e_camellia.o]=.. ../modes INCLUDE[e_sm4.o]=.. ../modes INCLUDE[e_des.o]=.. INCLUDE[e_des3.o]=.. diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c index b063821924..26dbe0ecae 100644 --- a/crypto/evp/e_camellia.c +++ b/crypto/evp/e_camellia.c @@ -14,18 +14,15 @@ #include "internal/deprecated.h" #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_CAMELLIA -NON_EMPTY_TRANSLATION_UNIT -#else -# include <openssl/evp.h> -# include <openssl/err.h> -# include <string.h> -# include <assert.h> -# include <openssl/camellia.h> -# include "crypto/evp.h" -# include "crypto/modes.h" -# include "crypto/cmll_platform.h" +#include <openssl/evp.h> +#include <openssl/err.h> +#include <string.h> +#include <assert.h> +#include <openssl/camellia.h> +#include "crypto/evp.h" +#include "crypto/modes.h" +#include "crypto/cmll_platform.h" static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); @@ -40,15 +37,15 @@ typedef struct { } stream; } EVP_CAMELLIA_KEY; -# define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) +#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) /* Attribute operation for Camellia */ -# define data(ctx) EVP_C_DATA(EVP_CAMELLIA_KEY,ctx) +#define data(ctx) EVP_C_DATA(EVP_CAMELLIA_KEY,ctx) -# if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__)) +#if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__)) /* ---------^^^ this is not a typo, just a way to detect that * assembler support was in general requested... */ -# include "sparc_arch.h" +# include "sparc_arch.h" static int cmll_t4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, @@ -114,35 +111,35 @@ static int cmll_t4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, return 1; } -# define cmll_t4_cbc_cipher camellia_cbc_cipher +# define cmll_t4_cbc_cipher camellia_cbc_cipher static int cmll_t4_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define cmll_t4_ecb_cipher camellia_ecb_cipher +# define cmll_t4_ecb_cipher camellia_ecb_cipher static int cmll_t4_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define cmll_t4_ofb_cipher camellia_ofb_cipher +# define cmll_t4_ofb_cipher camellia_ofb_cipher static int cmll_t4_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define cmll_t4_cfb_cipher camellia_cfb_cipher +# define cmll_t4_cfb_cipher camellia_cfb_cipher static int cmll_t4_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define cmll_t4_cfb8_cipher camellia_cfb8_cipher +# define cmll_t4_cfb8_cipher camellia_cfb8_cipher static int cmll_t4_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define cmll_t4_cfb1_cipher camellia_cfb1_cipher +# define cmll_t4_cfb1_cipher camellia_cfb1_cipher static int cmll_t4_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define cmll_t4_ctr_cipher camellia_ctr_cipher +# define cmll_t4_ctr_cipher camellia_ctr_cipher static int cmll_t4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \ +# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \ static const EVP_CIPHER cmll_t4_##keylen##_##mode = { \ nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \ flags|EVP_CIPH_##MODE##_MODE, \ @@ -163,9 +160,9 @@ static const EVP_CIPHER camellia_##keylen##_##mode = { \ const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \ { return SPARC_CMLL_CAPABLE?&cmll_t4_##keylen##_##mode:&camellia_##keylen##_##mode; } -# else +#else -# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \ +# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \ static const EVP_CIPHER camellia_##keylen##_##mode = { \ nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \ flags|EVP_CIPH_##MODE##_MODE, \ @@ -177,9 +174,9 @@ static const EVP_CIPHER camellia_##keylen##_##mode = { \ const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \ { return &camellia_##keylen##_##mode; } -# endif +#endif -# define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \ +#define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \ BLOCK_CIPHER_generic(nid,keylen,16,16,cbc,cbc,CBC,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \ BLOCK_CIPHER_generic(nid,keylen,16,0,ecb,ecb,ECB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \ BLOCK_CIPHER_generic(nid,keylen,1,16,ofb128,ofb,OFB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \ @@ -342,4 +339,3 @@ 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) -#endif diff --git a/crypto/evp/e_old.c b/crypto/evp/e_old.c index 82e0c1282c..0a74b050c9 100644 --- a/crypto/evp/e_old.c +++ b/crypto/evp/e_old.c @@ -8,11 +8,8 @@ */ #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_DEPRECATED_0_9_8 -NON_EMPTY_TRANSLATION_UNIT -#else -# include <openssl/evp.h> +#include <openssl/evp.h> /* * Define some deprecated functions, so older programs don't crash and burn @@ -21,93 +18,91 @@ NON_EMPTY_TRANSLATION_UNIT * location, not by name. */ -# ifndef OPENSSL_NO_BF -# undef EVP_bf_cfb +#ifndef OPENSSL_NO_BF +# undef EVP_bf_cfb const EVP_CIPHER *EVP_bf_cfb(void); const EVP_CIPHER *EVP_bf_cfb(void) { return EVP_bf_cfb64(); } -# endif +#endif -# ifndef OPENSSL_NO_DES -# undef EVP_des_cfb +#ifndef OPENSSL_NO_DES +# undef EVP_des_cfb const EVP_CIPHER *EVP_des_cfb(void); const EVP_CIPHER *EVP_des_cfb(void) { return EVP_des_cfb64(); } -# undef EVP_des_ede3_cfb +# undef EVP_des_ede3_cfb const EVP_CIPHER *EVP_des_ede3_cfb(void); const EVP_CIPHER *EVP_des_ede3_cfb(void) { return EVP_des_ede3_cfb64(); } -# undef EVP_des_ede_cfb +# undef EVP_des_ede_cfb const EVP_CIPHER *EVP_des_ede_cfb(void); const EVP_CIPHER *EVP_des_ede_cfb(void) { return EVP_des_ede_cfb64(); } -# endif +#endif -# ifndef OPENSSL_NO_IDEA -# undef EVP_idea_cfb +#ifndef OPENSSL_NO_IDEA +# undef EVP_idea_cfb const EVP_CIPHER *EVP_idea_cfb(void); const EVP_CIPHER *EVP_idea_cfb(void) { return EVP_idea_cfb64(); } -# endif +#endif -# ifndef OPENSSL_NO_RC2 -# undef EVP_rc2_cfb +#ifndef OPENSSL_NO_RC2 +# undef EVP_rc2_cfb const EVP_CIPHER *EVP_rc2_cfb(void); const EVP_CIPHER *EVP_rc2_cfb(void) { return EVP_rc2_cfb64(); } -# endif +#endif -# ifndef OPENSSL_NO_CAST -# undef EVP_cast5_cfb +#ifndef OPENSSL_NO_CAST +# undef EVP_cast5_cfb const EVP_CIPHER *EVP_cast5_cfb(void); const EVP_CIPHER *EVP_cast5_cfb(void) { return EVP_cast5_cfb64(); } -# endif +#endif -# ifndef OPENSSL_NO_RC5 -# undef EVP_rc5_32_12_16_cfb +#ifndef OPENSSL_NO_RC5 +# undef EVP_rc5_32_12_16_cfb const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void) { return EVP_rc5_32_12_16_cfb64(); } -# endif +#endif -# undef EVP_aes_128_cfb +#undef EVP_aes_128_cfb const EVP_CIPHER *EVP_aes_128_cfb(void); const EVP_CIPHER *EVP_aes_128_cfb(void) { return EVP_aes_128_cfb128(); } -# undef EVP_aes_192_cfb +#undef EVP_aes_192_cfb const EVP_CIPHER *EVP_aes_192_cfb(void); const EVP_CIPHER *EVP_aes_192_cfb(void) { return EVP_aes_192_cfb128(); } -# undef EVP_aes_256_cfb +#undef EVP_aes_256_cfb const EVP_CIPHER *EVP_aes_256_cfb(void); const EVP_CIPHER *EVP_aes_256_cfb(void) { return EVP_aes_256_cfb128(); } - -#endif diff --git a/crypto/evp/e_seed.c b/crypto/evp/e_seed.c index 224003d9dd..e66abdbc71 100644 --- a/crypto/evp/e_seed.c +++ b/crypto/evp/e_seed.c @@ -14,15 +14,12 @@ #include "internal/deprecated.h" #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_SEED -NON_EMPTY_TRANSLATION_UNIT -#else -# include <openssl/evp.h> -# include <openssl/err.h> -# include <string.h> -# include <assert.h> -# include <openssl/seed.h> -# include "crypto/evp.h" +#include <openssl/evp.h> +#include <openssl/err.h> +#include <string.h> +#include <assert.h> +#include <openssl/seed.h> +#include "crypto/evp.h" static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); @@ -41,5 +38,3 @@ static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, SEED_set_key(key, &EVP_C_DATA(EVP_SEED_KEY,ctx)->ks); return 1; } - -#endif diff --git a/crypto/evp/p_open.c b/crypto/evp/p_open.c index bcc01a7817..14b8065424 100644 --- a/crypto/evp/p_open.c +++ b/crypto/evp/p_open.c @@ -8,15 +8,12 @@ */ #include "internal/cryptlib.h" -#ifdef OPENSSL_NO_RSA -NON_EMPTY_TRANSLATION_UNIT -#else -# include <stdio.h> -# include <openssl/evp.h> -# include <openssl/objects.h> -# include <openssl/x509.h> -# include <openssl/rsa.h> +#include <stdio.h> +#include <openssl/evp.h> +#include <openssl/objects.h> +#include <openssl/x509.h> +#include <openssl/rsa.h> int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, const unsigned char *ek, int ekl, const unsigned char *iv, @@ -73,4 +70,3 @@ int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) i = EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL); return i; } -#endif |