diff options
author | Rich Salz <rsalz@akamai.com> | 2020-03-05 12:50:31 -0500 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-04-16 13:52:22 +0200 |
commit | 705536e2b5c4167dbda2e0046d83f9e0f4a65514 (patch) | |
tree | 5b76e00908f3d8c5dcbb75f094a4c06d989e97d5 /crypto | |
parent | 7165593ce5a07a6860d4d408ad640ee707172936 (diff) |
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')
-rw-r--r-- | crypto/aes/aes_ige.c | 5 | ||||
-rw-r--r-- | crypto/aes/build.info | 5 | ||||
-rw-r--r-- | crypto/asn1/build.info | 10 | ||||
-rw-r--r-- | crypto/asn1/n_pkey.c | 27 | ||||
-rw-r--r-- | crypto/asn1/x_long.c | 5 | ||||
-rw-r--r-- | crypto/bn/bn_depr.c | 13 | ||||
-rw-r--r-- | crypto/bn/build.info | 5 | ||||
-rw-r--r-- | crypto/dh/build.info | 5 | ||||
-rw-r--r-- | crypto/dh/dh_depr.c | 12 | ||||
-rw-r--r-- | crypto/dsa/build.info | 6 | ||||
-rw-r--r-- | crypto/dsa/dsa_depr.c | 18 | ||||
-rw-r--r-- | crypto/ec/build.info | 6 | ||||
-rw-r--r-- | crypto/ec/ecp_nistp224.c | 21 | ||||
-rw-r--r-- | crypto/ec/ecp_nistp256.c | 48 | ||||
-rw-r--r-- | crypto/ec/ecp_nistp521.c | 21 | ||||
-rw-r--r-- | crypto/ec/ecp_nistputil.c | 16 | ||||
-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 | ||||
-rw-r--r-- | crypto/rand/build.info | 5 | ||||
-rw-r--r-- | crypto/rand/rand_egd.c | 61 | ||||
-rw-r--r-- | crypto/rsa/build.info | 6 | ||||
-rw-r--r-- | crypto/rsa/rsa_depr.c | 15 |
25 files changed, 215 insertions, 254 deletions
diff --git a/crypto/aes/aes_ige.c b/crypto/aes/aes_ige.c index b40f4e53a6..6e72d2f7f4 100644 --- a/crypto/aes/aes_ige.c +++ b/crypto/aes/aes_ige.c @@ -15,10 +15,6 @@ #include "internal/cryptlib.h" -#ifdef OPENSSL_NO_DEPRECATED_3_0 -NON_EMPTY_TRANSLATION_UNIT -#else - #include <openssl/aes.h> #include "aes_local.h" @@ -301,4 +297,3 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, } } } -#endif diff --git a/crypto/aes/build.info b/crypto/aes/build.info index dc00df0cda..2b2053031f 100644 --- a/crypto/aes/build.info +++ b/crypto/aes/build.info @@ -60,7 +60,10 @@ IF[{- !$disabled{asm} -}] ENDIF $COMMON=aes_misc.c aes_ecb.c $AESASM -SOURCE[../../libcrypto]=$COMMON aes_cfb.c aes_ofb.c aes_ige.c aes_wrap.c +SOURCE[../../libcrypto]=$COMMON aes_cfb.c aes_ofb.c aes_wrap.c +IF[{- !$disabled{'deprecated-3.0'} -}] + SOURCE[../../libcrypto]=aes_ige.c +ENDIF SOURCE[../../providers/libfips.a]=$COMMON # Implementations are now spread across several libraries, so the defines diff --git a/crypto/asn1/build.info b/crypto/asn1/build.info index 32fdaaa1a9..a66c3084ce 100644 --- a/crypto/asn1/build.info +++ b/crypto/asn1/build.info @@ -4,14 +4,20 @@ SOURCE[../../libcrypto]=\ a_print.c a_type.c a_dup.c a_d2i_fp.c a_i2d_fp.c \ a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \ x_algor.c x_val.c x_sig.c x_bignum.c \ - x_long.c x_int64.c x_info.c x_spki.c nsseq.c \ + x_int64.c x_info.c x_spki.c nsseq.c \ d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\ t_pkey.c t_spki.c t_bitst.c \ tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \ tasn_prn.c tasn_scn.c ameth_lib.c \ - f_int.c f_string.c n_pkey.c \ + f_int.c f_string.c \ x_pkey.c bio_asn1.c bio_ndef.c asn_mime.c \ asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_strnid.c \ evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p5_scrypt.c p8_pkey.c \ asn_moid.c asn_mstbl.c asn1_item_list.c \ d2i_param.c i2d_param.c +IF[{- !$disabled{'rsa'} and !$disabled{'rc4'} -}] + SOURCE[../../libcrypto]=n_pkey.c +ENDIF +IF[{- !$disabled{'deprecated-3.0'} -}] + SOURCE[../../libcrypto]=x_long.c +ENDIF diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c index 71f78f7b26..88dabd265d 100644 --- a/crypto/asn1/n_pkey.c +++ b/crypto/asn1/n_pkey.c @@ -8,24 +8,19 @@ */ #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> -# include <openssl/evp.h> -# include <openssl/x509.h> +#include "internal/cryptlib.h" +#include <stdio.h> +#include <openssl/rsa.h> +#include <openssl/objects.h> +#include <openssl/asn1t.h> +#include <openssl/evp.h> +#include <openssl/x509.h> -# ifndef OPENSSL_NO_RC4 - -# define ASN1_BROKEN_SEQUENCE(tname) \ +#define ASN1_BROKEN_SEQUENCE(tname) \ static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ ASN1_SEQUENCE(tname) -# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ +#define static_ASN1_BROKEN_SEQUENCE_END(stname) \ static_ASN1_SEQUENCE_END_ref(stname, stname) typedef struct netscape_pkey_st { @@ -62,7 +57,3 @@ ASN1_SEQUENCE(NETSCAPE_PKEY) = { DECLARE_ASN1_FUNCTIONS(NETSCAPE_PKEY) DECLARE_ASN1_ENCODE_FUNCTIONS_name(NETSCAPE_PKEY, NETSCAPE_PKEY) IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_PKEY) - -# endif /* OPENSSL_NO_RC4 */ - -#endif diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c index 76d6674b50..414fd06e5e 100644 --- a/crypto/asn1/x_long.c +++ b/crypto/asn1/x_long.c @@ -11,10 +11,6 @@ #include "internal/cryptlib.h" #include <openssl/asn1t.h> -#ifdef OPENSSL_NO_DEPRECATED_3_0 -NON_EMPTY_TRANSLATION_UNIT -#else - #define COPY_SIZE(a, b) (sizeof(a) < sizeof(b) ? sizeof(a) : sizeof(b)) /* @@ -198,4 +194,3 @@ static int long_print(BIO *out, const ASN1_VALUE **pval, const ASN1_ITEM *it, memcpy(&l, pval, COPY_SIZE(*pval, l)); return BIO_printf(out, "%ld\n", l); } -#endif diff --git a/crypto/bn/bn_depr.c b/crypto/bn/bn_depr.c index 9c1c3d57c8..9a7a87e952 100644 --- a/crypto/bn/bn_depr.c +++ b/crypto/bn/bn_depr.c @@ -13,14 +13,11 @@ */ #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_DEPRECATED_0_9_8 -NON_EMPTY_TRANSLATION_UNIT -#else -# include <stdio.h> -# include <time.h> -# include "internal/cryptlib.h" -# include "bn_local.h" +#include <stdio.h> +#include <time.h> +#include "internal/cryptlib.h" +#include "bn_local.h" BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, @@ -64,5 +61,3 @@ int BN_is_prime_fasttest(const BIGNUM *a, int checks, BN_GENCB_set_old(&cb, callback, cb_arg); return bn_check_prime_int(a, checks, ctx_passed, do_trial_division, &cb); } - -#endif diff --git a/crypto/bn/build.info b/crypto/bn/build.info index bc3fb9b05b..5e04ed00ad 100644 --- a/crypto/bn/build.info +++ b/crypto/bn/build.info @@ -113,7 +113,10 @@ $COMMON=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \ bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ bn_x931p.c bn_intern.c bn_dh.c \ bn_rsa_fips186_4.c $BNDH $BNASM -SOURCE[../../libcrypto]=$COMMON bn_print.c bn_err.c bn_depr.c bn_srp.c +SOURCE[../../libcrypto]=$COMMON bn_print.c bn_err.c bn_srp.c +IF[{- !$disabled{'deprecated-3.0'} -}] + SOURCE[../../libcrypto]=bn_depr.c +ENDIF SOURCE[../../providers/libfips.a]=$COMMON # Implementations are now spread across several libraries, so the defines # need to be applied to all affected libraries and modules. diff --git a/crypto/dh/build.info b/crypto/dh/build.info index f4498f4d2b..656e6ea828 100644 --- a/crypto/dh/build.info +++ b/crypto/dh/build.info @@ -3,7 +3,10 @@ LIBS=../../libcrypto $COMMON=dh_lib.c dh_key.c dh_group_params.c dh_check.c dh_backend.c dh_gen.c SOURCE[../../libcrypto]=$COMMON\ - dh_asn1.c dh_err.c dh_depr.c \ + dh_asn1.c dh_err.c \ dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_meth.c +IF[{- !$disabled{'deprecated-0.9.8'} -}] + SOURCE[../../libcrypto]=dh_depr.c +ENDIF SOURCE[../../providers/libfips.a]=$COMMON diff --git a/crypto/dh/dh_depr.c b/crypto/dh/dh_depr.c index 33689d8e1c..0d21d97269 100644 --- a/crypto/dh/dh_depr.c +++ b/crypto/dh/dh_depr.c @@ -16,14 +16,11 @@ #include "internal/deprecated.h" #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_DEPRECATED_0_9_8 -NON_EMPTY_TRANSLATION_UNIT -#else -# include <stdio.h> -# include "internal/cryptlib.h" -# include <openssl/bn.h> -# include <openssl/dh.h> +#include <stdio.h> +#include "internal/cryptlib.h" +#include <openssl/bn.h> +#include <openssl/dh.h> DH *DH_generate_parameters(int prime_len, int generator, void (*callback) (int, int, void *), void *cb_arg) @@ -49,4 +46,3 @@ DH *DH_generate_parameters(int prime_len, int generator, DH_free(ret); return NULL; } -#endif diff --git a/crypto/dsa/build.info b/crypto/dsa/build.info index 7f621cb56b..9a7d275c35 100644 --- a/crypto/dsa/build.info +++ b/crypto/dsa/build.info @@ -4,7 +4,9 @@ $COMMON=dsa_sign.c dsa_vrf.c dsa_lib.c dsa_ossl.c dsa_check.c \ dsa_key.c dsa_backend.c dsa_gen.c SOURCE[../../libcrypto]=$COMMON\ - dsa_asn1.c \ - dsa_err.c dsa_depr.c dsa_ameth.c dsa_pmeth.c dsa_prn.c \ + dsa_asn1.c dsa_err.c dsa_ameth.c dsa_pmeth.c dsa_prn.c \ dsa_meth.c +IF[{- !$disabled{'deprecated-0.9.8'} -}] + SOURCE[../../libcrypto]=dsa_depr.c +ENDIF SOURCE[../../providers/libfips.a]=$COMMON diff --git a/crypto/dsa/dsa_depr.c b/crypto/dsa/dsa_depr.c index 5c8f9af2b9..93f5ad41e3 100644 --- a/crypto/dsa/dsa_depr.c +++ b/crypto/dsa/dsa_depr.c @@ -26,17 +26,14 @@ #define xxxHASH EVP_sha1() #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_DEPRECATED_0_9_8 -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/sha.h> +#include <stdio.h> +#include <time.h> +#include "internal/cryptlib.h" +#include <openssl/evp.h> +#include <openssl/bn.h> +#include <openssl/dsa.h> +#include <openssl/sha.h> DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len, @@ -65,4 +62,3 @@ err: DSA_free(ret); return NULL; } -#endif diff --git a/crypto/ec/build.info b/crypto/ec/build.info index 590bbbde53..a802beaa68 100644 --- a/crypto/ec/build.info +++ b/crypto/ec/build.info @@ -46,12 +46,16 @@ ENDIF $COMMON=ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c \ ec_curve.c ec_check.c ec_print.c ec_key.c ec_asn1.c \ ec2_smpl.c \ - ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c \ ecp_oct.c ec2_oct.c ec_oct.c ec_kmeth.c ecdh_ossl.c \ ecdsa_ossl.c ecdsa_sign.c ecdsa_vrf.c curve25519.c \ curve448/arch_32/f_impl.c curve448/f_generic.c curve448/scalar.c \ curve448/curve448_tables.c curve448/eddsa.c curve448/curve448.c \ $ECASM ec_backend.c ecx_backend.c + +IF[{- !$disabled{'ec_nistp_64_gcc_128'} -}] + $COMMON=$COMMON ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c +ENDIF + SOURCE[../../libcrypto]=$COMMON ec_ameth.c ec_pmeth.c ecx_meth.c ecx_key.c \ ec_err.c ecdh_kdf.c eck_prn.c ec_ctrl.c SOURCE[../../providers/libfips.a]=$COMMON diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c index f52e55b7ed..bf8e5db614 100644 --- a/crypto/ec/ecp_nistp224.c +++ b/crypto/ec/ecp_nistp224.c @@ -37,22 +37,19 @@ */ #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128 -NON_EMPTY_TRANSLATION_UNIT -#else -# include <stdint.h> -# include <string.h> -# include <openssl/err.h> -# include "ec_local.h" +#include <stdint.h> +#include <string.h> +#include <openssl/err.h> +#include "ec_local.h" -# if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16 +#if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16 /* even with gcc, the typedef won't work for 32-bit platforms */ typedef __uint128_t uint128_t; /* nonstandard; implemented by gcc on 64-bit * platforms */ -# else -# error "Your compiler doesn't appear to support 128-bit integer types" -# endif +#else +# error "Your compiler doesn't appear to support 128-bit integer types" +#endif typedef uint8_t u8; typedef uint64_t u64; @@ -1755,5 +1752,3 @@ int ec_GFp_nistp224_have_precompute_mult(const EC_GROUP *group) { return HAVEPRECOMP(group, nistp224); } - -#endif diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c index 624909d894..dd3c5d5878 100644 --- a/crypto/ec/ecp_nistp256.c +++ b/crypto/ec/ecp_nistp256.c @@ -38,23 +38,20 @@ */ #include <openssl/opensslconf.h> -#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128 -NON_EMPTY_TRANSLATION_UNIT -#else -# include <stdint.h> -# include <string.h> -# include <openssl/err.h> -# include "ec_local.h" +#include <stdint.h> +#include <string.h> +#include <openssl/err.h> +#include "ec_local.h" -# if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16 +#if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16 /* even with gcc, the typedef won't work for 32-bit platforms */ typedef __uint128_t uint128_t; /* nonstandard; implemented by gcc on 64-bit * platforms */ typedef __int128_t int128_t; -# else -# error "Your compiler doesn't appear to support 128-bit integer types" -# endif +#else +# error "Your compiler doesn't appear to support 128-bit integer types" +#endif typedef uint8_t u8; typedef uint32_t u32; @@ -116,7 +113,7 @@ static const felem_bytearray nistp256_curve_params[5] = { * values are used as intermediate values before multiplication. */ -# define NLIMBS 4 +#define NLIMBS 4 typedef uint128_t limb; typedef limb felem[NLIMBS]; @@ -248,9 +245,9 @@ static void longfelem_scalar(longfelem out, const u64 scalar) out[7] *= scalar; } -# define two105m41m9 (((limb)1) << 105) - (((limb)1) << 41) - (((limb)1) << 9) -# define two105 (((limb)1) << 105) -# define two105m41p9 (((limb)1) << 105) - (((limb)1) << 41) + (((limb)1) << 9) +#define two105m41m9 (((limb)1) << 105) - (((limb)1) << 41) - (((limb)1) << 9) +#define two105 (((limb)1) << 105) +#define two105m41p9 (((limb)1) << 105) - (((limb)1) << 41) + (((limb)1) << 9) /* zero105 is 0 mod p */ static const felem zero105 = @@ -293,9 +290,9 @@ static void felem_diff(felem out, const felem in) out[3] -= in[3]; } -# define two107m43m11 (((limb)1) << 107) - (((limb)1) << 43) - (((limb)1) << 11) -# define two107 (((limb)1) << 107) -# define two107m43p11 (((limb)1) << 107) - (((limb)1) << 43) + (((limb)1) << 11) +#define two107m43m11 (((limb)1) << 107) - (((limb)1) << 43) - (((limb)1) << 11) +#define two107 (((limb)1) << 107) +#define two107m43p11 (((limb)1) << 107) - (((limb)1) << 43) + (((limb)1) << 11) /* zero107 is 0 mod p */ static const felem zero107 = @@ -364,10 +361,10 @@ static void longfelem_diff(longfelem out, const longfelem in) out[7] -= in[7]; } -# define two64m0 (((limb)1) << 64) - 1 -# define two110p32m0 (((limb)1) << 110) + (((limb)1) << 32) - 1 -# define two64m46 (((limb)1) << 64) - (((limb)1) << 46) -# define two64m32 (((limb)1) << 64) - (((limb)1) << 32) +#define two64m0 (((limb)1) << 64) - 1 +#define two110p32m0 (((limb)1) << 110) + (((limb)1) << 32) - 1 +#define two64m46 (((limb)1) << 64) - (((limb)1) << 46) +#define two64m32 (((limb)1) << 64) - (((limb)1) << 32) /* zero110 is 0 mod p */ static const felem zero110 = { two64m0, two110p32m0, two64m46, two64m32 }; @@ -717,9 +714,9 @@ static void felem_small_mul(longfelem out, const smallfelem small1, smallfelem_mul(out, small1, small2); } -# define two100m36m4 (((limb)1) << 100) - (((limb)1) << 36) - (((limb)1) << 4) -# define two100 (((limb)1) << 100) -# define two100m36p4 (((limb)1) << 100) - (((limb)1) << 36) + (((limb)1) << 4) +#define two100m36m4 (((limb)1) << 100) - (((limb)1) << 36) - (((limb)1) << 4) +#define two100 (((limb)1) << 100) +#define two100m36p4 (((limb)1) << 100) - (((limb)1) << 36) + (((limb)1) << 4) /* zero100 is 0 mod p */ static const felem zero100 = { two100m36m4, two100, two100m36p4, two100m36p4 }; @@ -2387,4 +2384,3 @@ int ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group) { return HAVEPRECOMP(group, nistp256); } -#endif diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c index d09553fec8..9d22da6572 100644 --- a/crypto/ec/ecp_nistp521.c +++ b/crypto/ec/ecp_nistp521.c @@ -38,21 +38,18 @@ */ #include <openssl/e_os2.h> -#ifdef OPENSSL_NO_EC_NISTP_64_GCC_128 -NON_EMPTY_TRANSLATION_UNIT -#else -# include <string.h> -# include <openssl/err.h> -# include "ec_local.h" +#include <string.h> +#include <openssl/err.h> +#include "ec_local.h" -# if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16 +#if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__==16 /* even with gcc, the typedef won't work for 32-bit platforms */ typedef __uint128_t uint128_t; /* nonstandard; implemented by gcc on 64-bit * platforms */ -# else -# error "Your compiler doesn't appear to support 128-bit integer types" -# endif +#else +# error "Your compiler doesn't appear to support 128-bit integer types" +#endif typedef uint8_t u8; typedef uint64_t u64; @@ -131,7 +128,7 @@ static const felem_bytearray nistp521_curve_params[5] = { * A field element with 64-bit limbs is an 'felem'. One with 128-bit limbs is a * 'largefelem' */ -# define NLIMBS 9 +#define NLIMBS 9 typedef uint64_t limb; typedef limb felem[NLIMBS]; @@ -2193,5 +2190,3 @@ int ec_GFp_nistp521_have_precompute_mult(const EC_GROUP *group) { return HAVEPRECOMP(group, nistp521); } - -#endif diff --git a/crypto/ec/ecp_nistputil.c b/crypto/ec/ecp_nistputil.c index d3739a108c..52ce6ee879 100644 --- a/crypto/ec/ecp_nistputil.c +++ b/crypto/ec/ecp_nistputil.c @@ -30,16 +30,13 @@ #include "internal/deprecated.h" #include <openssl/opensslconf.h> -#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. */ -# include <stddef.h> -# include "ec_local.h" +#include <stddef.h> +#include "ec_local.h" /* * Convert an array of points into affine coordinates. (If the point at @@ -80,10 +77,10 @@ void ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array, { int i = 0; -# define tmp_felem(I) (&((char *)tmp_felems)[(I) * felem_size]) -# define X(I) (&((char *)point_array)[3*(I) * felem_size]) -# define Y(I) (&((char *)point_array)[(3*(I) + 1) * felem_size]) -# define Z(I) (&((char *)point_array)[(3*(I) + 2) * felem_size]) +#define tmp_felem(I) (&((char *)tmp_felems)[(I) * felem_size]) +#define X(I) (&((char *)point_array)[3*(I) * felem_size]) +#define Y(I) (&((char *)point_array)[(3*(I) + 1) * felem_size]) +#define Z(I) (&((char *)point_array)[(3*(I) + 2) * felem_size]) if (!felem_is_zero(Z(0))) felem_assign(tmp_felem(0), Z(0)); @@ -226,4 +223,3 @@ void ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, *sign = s & 1; *digit = d; } -#endif 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); |