From d749e1080a4ec0ae6af5edc4851379fbc2a5ebca Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 16 Feb 2011 14:40:06 +0000 Subject: [PATCH] Experimental symbol renaming to avoid clashes with regular OpenSSL. Make sure crypto.h is included first in any affected files. --- crypto/aes/aes_cbc.c | 1 + crypto/aes/aes_cfb.c | 1 + crypto/aes/aes_core.c | 1 + crypto/aes/aes_ecb.c | 1 + crypto/aes/aes_ofb.c | 1 + crypto/aes/aes_x86core.c | 1 + crypto/bn/bn_asm.c | 7 ++++++- crypto/crypto.h | 8 ++++++++ crypto/des/cfb64ede.c | 1 + crypto/des/cfb64enc.c | 1 + crypto/des/cfb_enc.c | 1 + crypto/des/des_enc.c | 1 + crypto/des/ecb3_enc.c | 1 + crypto/des/ecb_enc.c | 1 + crypto/des/fcrypt.c | 2 ++ crypto/des/fcrypt_b.c | 1 + crypto/des/ofb64ede.c | 1 + crypto/des/set_key.c | 1 + crypto/des/str2key.c | 2 +- crypto/modes/cbc128.c | 1 + crypto/modes/cfb128.c | 1 + crypto/modes/ctr128.c | 1 + crypto/modes/ofb128.c | 1 + crypto/rand/md_rand.c | 4 ++-- crypto/rand/rand_egd.c | 1 + crypto/sha/sha1_one.c | 2 +- crypto/sha/sha1dgst.c | 1 + crypto/sha/sha_dgst.c | 1 + 28 files changed, 42 insertions(+), 5 deletions(-) diff --git a/crypto/aes/aes_cbc.c b/crypto/aes/aes_cbc.c index 227f75625d..87545c34da 100644 --- a/crypto/aes/aes_cbc.c +++ b/crypto/aes/aes_cbc.c @@ -49,6 +49,7 @@ * */ +#include #include #include diff --git a/crypto/aes/aes_cfb.c b/crypto/aes/aes_cfb.c index 0c6d058ce7..7f19555603 100644 --- a/crypto/aes/aes_cfb.c +++ b/crypto/aes/aes_cfb.c @@ -49,6 +49,7 @@ * */ +#include #include #include diff --git a/crypto/aes/aes_core.c b/crypto/aes/aes_core.c index a7ec54f4da..ba90952829 100644 --- a/crypto/aes/aes_core.c +++ b/crypto/aes/aes_core.c @@ -36,6 +36,7 @@ #include #include +#include #include #include "aes_locl.h" diff --git a/crypto/aes/aes_ecb.c b/crypto/aes/aes_ecb.c index 28aa561c2d..f342bbdf87 100644 --- a/crypto/aes/aes_ecb.c +++ b/crypto/aes/aes_ecb.c @@ -56,6 +56,7 @@ #endif #include +#include #include #include "aes_locl.h" diff --git a/crypto/aes/aes_ofb.c b/crypto/aes/aes_ofb.c index 50bf0b8325..7a87608a68 100644 --- a/crypto/aes/aes_ofb.c +++ b/crypto/aes/aes_ofb.c @@ -49,6 +49,7 @@ * */ +#include #include #include diff --git a/crypto/aes/aes_x86core.c b/crypto/aes/aes_x86core.c index d323e265c0..c1c94d7a3e 100644 --- a/crypto/aes/aes_x86core.c +++ b/crypto/aes/aes_x86core.c @@ -43,6 +43,7 @@ #include #include +#include #include #include "aes_locl.h" diff --git a/crypto/bn/bn_asm.c b/crypto/bn/bn_asm.c index c43c91cc09..7b1280ae61 100644 --- a/crypto/bn/bn_asm.c +++ b/crypto/bn/bn_asm.c @@ -63,6 +63,7 @@ #include #include +#include #include "cryptlib.h" #include "bn_lcl.h" @@ -428,10 +429,12 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) #if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT) +#ifndef OPENSSL_FIPSCANISTER #undef bn_mul_comba8 #undef bn_mul_comba4 #undef bn_sqr_comba8 #undef bn_sqr_comba4 +#endif /* mul_add_c(a,b,c0,c1,c2) -- c+=a*b for three word number c=(c2,c1,c0) */ /* mul_add_c2(a,b,c0,c1,c2) -- c+=2*a*b for three word number c=(c2,c1,c0) */ @@ -946,14 +949,16 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_U #else /* !BN_MUL_COMBA */ /* hmm... is it faster just to do a multiply? */ +#ifndef OPENSSL_FIPSCANISTER #undef bn_sqr_comba4 +#undef bn_sqr_comba8 +#endif void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) { BN_ULONG t[8]; bn_sqr_normal(r,a,4,t); } -#undef bn_sqr_comba8 void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a) { BN_ULONG t[16]; diff --git a/crypto/crypto.h b/crypto/crypto.h index 938c2bc144..443486d70e 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -143,6 +143,14 @@ one way or another */ #include +/* For FIPS mode rename all OpenSSL symbols to avoid clashes with a + * non-FIPS OpenSSL. + */ + +#if defined(OPENSSL_FIPSCANISTER) && defined(OPENSSL_FIPSSYMS) +#include +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/crypto/des/cfb64ede.c b/crypto/des/cfb64ede.c index de34ecceb9..40da95888c 100644 --- a/crypto/des/cfb64ede.c +++ b/crypto/des/cfb64ede.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include "des_locl.h" #include "e_os.h" diff --git a/crypto/des/cfb64enc.c b/crypto/des/cfb64enc.c index 5ec8683e40..45fa518936 100644 --- a/crypto/des/cfb64enc.c +++ b/crypto/des/cfb64enc.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include "des_locl.h" /* The input and output encrypted as though 64bit cfb mode is being diff --git a/crypto/des/cfb_enc.c b/crypto/des/cfb_enc.c index 720f29a28e..d8c195e1d6 100644 --- a/crypto/des/cfb_enc.c +++ b/crypto/des/cfb_enc.c @@ -57,6 +57,7 @@ */ #include "e_os.h" +#include #include "des_locl.h" #include diff --git a/crypto/des/des_enc.c b/crypto/des/des_enc.c index 828feba208..efe35aa3c5 100644 --- a/crypto/des/des_enc.c +++ b/crypto/des/des_enc.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include "des_locl.h" #include "spr.h" diff --git a/crypto/des/ecb3_enc.c b/crypto/des/ecb3_enc.c index c3437bc606..420c5d13f4 100644 --- a/crypto/des/ecb3_enc.c +++ b/crypto/des/ecb3_enc.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include "des_locl.h" void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, diff --git a/crypto/des/ecb_enc.c b/crypto/des/ecb_enc.c index 0684e769b3..de4ede1a7b 100644 --- a/crypto/des/ecb_enc.c +++ b/crypto/des/ecb_enc.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include "des_locl.h" #include "des_ver.h" #include diff --git a/crypto/des/fcrypt.c b/crypto/des/fcrypt.c index ccbdff250f..04f95fa5b0 100644 --- a/crypto/des/fcrypt.c +++ b/crypto/des/fcrypt.c @@ -9,6 +9,8 @@ #include #endif +#include + /* This version of crypt has been developed from my MIT compatible * DES library. * Eric Young (eay@cryptsoft.com) diff --git a/crypto/des/fcrypt_b.c b/crypto/des/fcrypt_b.c index 8822816938..18d7ffc18c 100644 --- a/crypto/des/fcrypt_b.c +++ b/crypto/des/fcrypt_b.c @@ -57,6 +57,7 @@ */ #include +#include /* This version of crypt has been developed from my MIT compatible * DES library. diff --git a/crypto/des/ofb64ede.c b/crypto/des/ofb64ede.c index 26bbf9a6a7..089407b69f 100644 --- a/crypto/des/ofb64ede.c +++ b/crypto/des/ofb64ede.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include "des_locl.h" /* The input and output encrypted as though 64bit ofb mode is being diff --git a/crypto/des/set_key.c b/crypto/des/set_key.c index 3004cc3ab3..ce4faf2322 100644 --- a/crypto/des/set_key.c +++ b/crypto/des/set_key.c @@ -63,6 +63,7 @@ * 1.1 added norm_expand_bits * 1.0 First working version */ +#include #include "des_locl.h" OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ diff --git a/crypto/des/str2key.c b/crypto/des/str2key.c index 9c2054bda6..1077f99d1b 100644 --- a/crypto/des/str2key.c +++ b/crypto/des/str2key.c @@ -56,8 +56,8 @@ * [including the GNU Public Licence.] */ -#include "des_locl.h" #include +#include "des_locl.h" void DES_string_to_key(const char *str, DES_cblock *key) { diff --git a/crypto/modes/cbc128.c b/crypto/modes/cbc128.c index dbf5b45a21..3d3782cbe1 100644 --- a/crypto/modes/cbc128.c +++ b/crypto/modes/cbc128.c @@ -48,6 +48,7 @@ * */ +#include #include "modes_lcl.h" #include diff --git a/crypto/modes/cfb128.c b/crypto/modes/cfb128.c index b76514b9b5..4e6f5d35e1 100644 --- a/crypto/modes/cfb128.c +++ b/crypto/modes/cfb128.c @@ -48,6 +48,7 @@ * */ +#include #include "modes_lcl.h" #include diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c index 087b1b6866..ee642c5863 100644 --- a/crypto/modes/ctr128.c +++ b/crypto/modes/ctr128.c @@ -48,6 +48,7 @@ * */ +#include #include "modes_lcl.h" #include diff --git a/crypto/modes/ofb128.c b/crypto/modes/ofb128.c index 4b5b4ec648..01c01702c4 100644 --- a/crypto/modes/ofb128.c +++ b/crypto/modes/ofb128.c @@ -48,6 +48,7 @@ * */ +#include #include "modes_lcl.h" #include diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index b17ad5203d..f9583324e9 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -123,10 +123,10 @@ #include "e_os.h" +#include #include #include "rand_lcl.h" -#include #include #ifdef OPENSSL_FIPS @@ -168,7 +168,7 @@ static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num); static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num); static int ssleay_rand_status(void); -RAND_METHOD rand_ssleay_meth={ +static RAND_METHOD rand_ssleay_meth={ ssleay_rand_seed, ssleay_rand_nopseudo_bytes, ssleay_rand_cleanup, diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index d53b916ebe..9674219769 100644 --- a/crypto/rand/rand_egd.c +++ b/crypto/rand/rand_egd.c @@ -54,6 +54,7 @@ * */ +#include #include #include #include diff --git a/crypto/sha/sha1_one.c b/crypto/sha/sha1_one.c index 7c65b60276..c56ec94020 100644 --- a/crypto/sha/sha1_one.c +++ b/crypto/sha/sha1_one.c @@ -58,8 +58,8 @@ #include #include -#include #include +#include #ifndef OPENSSL_NO_SHA1 unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) diff --git a/crypto/sha/sha1dgst.c b/crypto/sha/sha1dgst.c index 50d1925cde..a98690225f 100644 --- a/crypto/sha/sha1dgst.c +++ b/crypto/sha/sha1dgst.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) diff --git a/crypto/sha/sha_dgst.c b/crypto/sha/sha_dgst.c index 70eb56032c..fb63b17ff2 100644 --- a/crypto/sha/sha_dgst.c +++ b/crypto/sha/sha_dgst.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) -- 2.25.1