diff --git a/openssl-1.0.1e-compat-symbols.patch b/openssl-1.0.1e-compat-symbols.patch new file mode 100644 index 0000000..25a9d02 --- /dev/null +++ b/openssl-1.0.1e-compat-symbols.patch @@ -0,0 +1,46 @@ +diff -up openssl-1.0.1e/crypto/dsa/dsa_key.c.compat openssl-1.0.1e/crypto/dsa/dsa_key.c +--- openssl-1.0.1e/crypto/dsa/dsa_key.c.compat 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/dsa/dsa_key.c 2013-12-11 16:34:58.638549687 +0100 +@@ -68,6 +68,11 @@ + #include + #include + ++/* just a compatibility symbol - no-op */ ++void FIPS_corrupt_dsa_keygen(void) ++ { ++ } ++ + static int fips_check_dsa(DSA *dsa) + { + EVP_PKEY *pk; +diff -up openssl-1.0.1e/crypto/engine/eng_all.c.compat openssl-1.0.1e/crypto/engine/eng_all.c +--- openssl-1.0.1e/crypto/engine/eng_all.c.compat 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/engine/eng_all.c 2013-12-11 16:32:13.512820424 +0100 +@@ -62,6 +62,11 @@ + #include + #endif + ++/* just backwards compatibility symbol - no-op */ ++void ENGINE_load_aesni (void) ++{ ++} ++ + void ENGINE_load_builtin_engines(void) + { + /* Some ENGINEs need this */ +diff -up openssl-1.0.1e/crypto/fips/fips.c.compat openssl-1.0.1e/crypto/fips/fips.c +--- openssl-1.0.1e/crypto/fips/fips.c.compat 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/fips/fips.c 2013-12-11 16:38:52.524831858 +0100 +@@ -111,6 +111,12 @@ int FIPS_module_mode(void) + return ret; + } + ++/* just a compat symbol - return NULL */ ++const void *FIPS_rand_check(void) ++ { ++ return NULL; ++ } ++ + int FIPS_selftest_failed(void) + { + int ret = 0; diff --git a/openssl-1.0.1e-new-fips-reqs.patch b/openssl-1.0.1e-new-fips-reqs.patch index cdc042b..d438490 100644 --- a/openssl-1.0.1e-new-fips-reqs.patch +++ b/openssl-1.0.1e-new-fips-reqs.patch @@ -1,6 +1,131 @@ +diff -up openssl-1.0.1e/crypto/bn/bn.h.fips-reqs openssl-1.0.1e/crypto/bn/bn.h +--- openssl-1.0.1e/crypto/bn/bn.h.fips-reqs 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/bn/bn.h 2013-12-13 11:58:58.623821669 +0100 +@@ -386,9 +386,11 @@ int BN_GENCB_call(BN_GENCB *cb, int a, i + * of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996]; + * original paper: Damgaard, Landrock, Pomerance: Average case error estimates + * for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */ +-#define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \ +- (b) >= 850 ? 3 : \ +- (b) >= 650 ? 4 : \ ++/* FIPS 186-4 specifies error rate given the security strength of the ++ * resulting RSA key bit size. So the error rate is 2^-112 or 2^-128 for ++ * 1024 and 1536 bit keys. ++ */ ++#define BN_prime_checks_for_size(b) ((b) >= 1300 ? 4 : \ + (b) >= 550 ? 5 : \ + (b) >= 450 ? 6 : \ + (b) >= 400 ? 7 : \ +diff -up openssl-1.0.1e/crypto/dh/dh_gen.c.fips-reqs openssl-1.0.1e/crypto/dh/dh_gen.c +--- openssl-1.0.1e/crypto/dh/dh_gen.c.fips-reqs 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/dh/dh_gen.c 2013-12-11 16:50:54.181130000 +0100 +@@ -125,7 +125,7 @@ static int dh_builtin_genparams(DH *ret, + return 0; + } + +- if (FIPS_mode() && (prime_len < OPENSSL_DH_FIPS_MIN_MODULUS_BITS)) ++ if (FIPS_mode() && (prime_len < OPENSSL_DH_FIPS_MIN_MODULUS_BITS_GEN)) + { + DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_KEY_SIZE_TOO_SMALL); + goto err; +diff -up openssl-1.0.1e/crypto/dh/dh.h.fips-reqs openssl-1.0.1e/crypto/dh/dh.h +--- openssl-1.0.1e/crypto/dh/dh.h.fips-reqs 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/dh/dh.h 2013-12-11 16:51:18.345675737 +0100 +@@ -78,6 +78,7 @@ + #endif + + #define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 ++#define OPENSSL_DH_FIPS_MIN_MODULUS_BITS_GEN 2048 + + #define DH_FLAG_CACHE_MONT_P 0x01 + #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH +diff -up openssl-1.0.1e/crypto/dh/dh_check.c.fips-reqs openssl-1.0.1e/crypto/dh/dh_check.c +--- openssl-1.0.1e/crypto/dh/dh_check.c.fips-reqs 2013-02-11 16:26:04.000000000 +0100 ++++ openssl-1.0.1e/crypto/dh/dh_check.c 2013-12-11 18:02:26.759075219 +0100 +@@ -134,7 +134,33 @@ int DH_check_pub_key(const DH *dh, const + BN_sub_word(q,1); + if (BN_cmp(pub_key,q)>=0) + *ret|=DH_CHECK_PUBKEY_TOO_LARGE; ++#ifdef OPENSSL_FIPS ++ if (FIPS_mode()) ++ { ++ BN_CTX *ctx = NULL; + ++ ctx = BN_CTX_new(); ++ if (ctx == NULL) ++ goto err; ++ ++ if (BN_mod_exp_mont(q, pub_key, dh->q, dh->p, ctx, NULL) <= 0) ++ { ++ BN_CTX_free(ctx); ++ goto err; ++ } ++ if (!BN_is_one(q)) ++ { ++ /* it would be more correct to add new return flag ++ * for this test, but we do not want to do it ++ * so just error out ++ */ ++ BN_CTX_free(ctx); ++ goto err; ++ } ++ ++ BN_CTX_free(ctx); ++ } ++#endif + ok = 1; + err: + if (q != NULL) BN_free(q); +diff -up openssl-1.0.1e/crypto/dsa/dsa_gen.c.fips-reqs openssl-1.0.1e/crypto/dsa/dsa_gen.c +--- openssl-1.0.1e/crypto/dsa/dsa_gen.c.fips-reqs 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/dsa/dsa_gen.c 2013-12-11 16:47:25.882425812 +0100 +@@ -159,7 +159,6 @@ int dsa_builtin_paramgen(DSA *ret, size_ + } + + if (FIPS_module_mode() && +- (bits != 1024 || qbits != 160) && + (bits != 2048 || qbits != 224) && + (bits != 2048 || qbits != 256) && + (bits != 3072 || qbits != 256)) +diff -up openssl-1.0.1e/crypto/dsa/dsa.h.fips-reqs openssl-1.0.1e/crypto/dsa/dsa.h +--- openssl-1.0.1e/crypto/dsa/dsa.h.fips-reqs 2013-11-26 14:36:35.000000000 +0100 ++++ openssl-1.0.1e/crypto/dsa/dsa.h 2013-12-13 11:53:04.637827187 +0100 +@@ -89,6 +89,7 @@ + #endif + + #define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 ++#define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS_GEN 2048 + + #define DSA_FLAG_CACHE_MONT_P 0x01 + #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA +@@ -254,9 +255,9 @@ int DSAparams_print_fp(FILE *fp, const D + int DSA_print_fp(FILE *bp, const DSA *x, int off); + #endif + +-#define DSS_prime_checks 50 +-/* Primality test according to FIPS PUB 186[-1], Appendix 2.1: +- * 50 rounds of Rabin-Miller */ ++#define DSS_prime_checks 64 ++/* Primality test according to FIPS PUB 186[-4], Appendix 2.1: ++ * 64 rounds of Rabin-Miller */ + #define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +diff -up openssl-1.0.1e/crypto/dsa/dsa_key.c.fips-reqs openssl-1.0.1e/crypto/dsa/dsa_key.c +--- openssl-1.0.1e/crypto/dsa/dsa_key.c.fips-reqs 2013-12-11 16:34:58.000000000 +0100 ++++ openssl-1.0.1e/crypto/dsa/dsa_key.c 2013-12-11 16:47:57.815146894 +0100 +@@ -127,7 +127,7 @@ static int dsa_builtin_keygen(DSA *dsa) + + #ifdef OPENSSL_FIPS + if (FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW) +- && (BN_num_bits(dsa->p) < OPENSSL_DSA_FIPS_MIN_MODULUS_BITS)) ++ && (BN_num_bits(dsa->p) < OPENSSL_DSA_FIPS_MIN_MODULUS_BITS_GEN)) + { + DSAerr(DSA_F_DSA_BUILTIN_KEYGEN, DSA_R_KEY_SIZE_TOO_SMALL); + goto err; diff -up openssl-1.0.1e/crypto/fips/fips_drbg_rand.c.fips-reqs openssl-1.0.1e/crypto/fips/fips_drbg_rand.c ---- openssl-1.0.1e/crypto/fips/fips_drbg_rand.c.fips-reqs 2013-11-15 16:54:49.000000000 +0100 -+++ openssl-1.0.1e/crypto/fips/fips_drbg_rand.c 2013-11-19 14:48:38.935251819 +0100 +--- openssl-1.0.1e/crypto/fips/fips_drbg_rand.c.fips-reqs 2013-11-26 14:36:35.551708593 +0100 ++++ openssl-1.0.1e/crypto/fips/fips_drbg_rand.c 2013-11-26 14:36:35.601709689 +0100 @@ -77,7 +77,8 @@ static int fips_drbg_bytes(unsigned char int rv = 0; unsigned char *adin = NULL; @@ -50,8 +175,8 @@ diff -up openssl-1.0.1e/crypto/fips/fips_drbg_rand.c.fips-reqs openssl-1.0.1e/cr } diff -up openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c.fips-reqs openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c ---- openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c.fips-reqs 2013-11-15 16:54:49.390224209 +0100 -+++ openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c 2013-11-15 16:54:49.427225021 +0100 +--- openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c.fips-reqs 2013-11-26 14:36:35.555708680 +0100 ++++ openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c 2013-11-26 14:36:35.601709689 +0100 @@ -340,6 +340,42 @@ static const unsigned char kat_RSA_X931_ 0x60, 0x83, 0x18, 0x88, 0xA3, 0xF5, 0x59, 0xC3 }; @@ -123,7 +248,7 @@ diff -up openssl-1.0.1e/crypto/fips/fips_rsa_selftest.c.fips-reqs openssl-1.0.1e } diff -up openssl-1.0.1e/crypto/modes/gcm128.c.fips-reqs openssl-1.0.1e/crypto/modes/gcm128.c --- openssl-1.0.1e/crypto/modes/gcm128.c.fips-reqs 2013-02-11 16:26:04.000000000 +0100 -+++ openssl-1.0.1e/crypto/modes/gcm128.c 2013-11-15 16:54:49.427225021 +0100 ++++ openssl-1.0.1e/crypto/modes/gcm128.c 2013-11-26 14:36:35.601709689 +0100 @@ -898,6 +898,10 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT # endif #endif @@ -147,8 +272,8 @@ diff -up openssl-1.0.1e/crypto/modes/gcm128.c.fips-reqs openssl-1.0.1e/crypto/mo if (mlen>((U64(1)<<36)-32) || (sizeof(len)==8 && mlen 1.0.1e-35 +- drop weak ciphers from the default TLS ciphersuite list +- add back some symbols that were dropped with update to 1.0.1 branch +- more FIPS validation requirement changes + * Tue Nov 19 2013 Tomáš Mráz 1.0.1e-34 - fix locking and reseeding problems with FIPS drbg