fips module header inclusion fine-tunning
authorTomas Mraz <tomas@openssl.org>
Thu, 1 Jul 2021 15:41:02 +0000 (17:41 +0200)
committerPauli <pauli@openssl.org>
Tue, 6 Jul 2021 00:52:27 +0000 (10:52 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15974)

35 files changed:
crypto/dh/dh_backend.c
crypto/dh/dh_lib.c
crypto/dsa/dsa_backend.c
crypto/dsa/dsa_lib.c
crypto/ec/ec_backend.c
crypto/ec/ec_key.c
crypto/ec/ec_kmeth.c
crypto/ec/ecx_backend.c
crypto/evp/digest.c
crypto/evp/evp_enc.c
crypto/evp/evp_lib.c
crypto/evp/evp_rand.c
crypto/evp/kdf_lib.c
crypto/evp/keymgmt_lib.c
crypto/evp/m_sigver.c
crypto/evp/p_lib.c
crypto/evp/pmeth_check.c
crypto/evp/pmeth_gn.c
crypto/evp/pmeth_lib.c
crypto/rsa/rsa_backend.c
crypto/rsa/rsa_lib.c
crypto/rsa/rsa_sign.c
include/crypto/dh.h
include/crypto/dsa.h
include/crypto/ec.h
include/crypto/ecx.h
include/crypto/rsa.h
providers/common/include/prov/provider_util.h
providers/common/provider_util.c
providers/implementations/keymgmt/mac_legacy_kmgmt.c
providers/implementations/macs/cmac_prov.c
providers/implementations/macs/gmac_prov.c
providers/implementations/macs/hmac_prov.c
providers/implementations/signature/mac_legacy_sig.c
ssl/s3_cbc.c

index a727d5c87b8c1d6fcd5b1194b23bed9ba47705f3..7bd5c617debc1ddd71c6dce4592a3fe0665e5441 100644 (file)
@@ -15,6 +15,9 @@
 
 #include <openssl/err.h>
 #include <openssl/core_names.h>
+#ifndef FIPS_MODULE
+# include <openssl/x509.h>
+#endif
 #include "internal/param_build_set.h"
 #include "crypto/dh.h"
 #include "dh_local.h"
index 7154f8c2abee77667f1995cb25dcf015b732b998..29cda5d7bfa845272f45aaa71d55321e28146ea6 100644 (file)
@@ -15,7 +15,9 @@
 
 #include <stdio.h>
 #include <openssl/bn.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/obj_mac.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
index e4fa070f23779af7e8d6012362f28195e88887c4..5e3ff851544ec7f6fd567c8a2541e4c60b716626 100644 (file)
@@ -15,6 +15,9 @@
 
 #include <openssl/core_names.h>
 #include <openssl/err.h>
+#ifndef FIPS_MODULE
+# include <openssl/x509.h>
+#endif
 #include "crypto/dsa.h"
 #include "dsa_local.h"
 
index 5512b99ef100799defc97238670dfa7227ec1154..ccc70165921764f6d34a4fafa93a4242b4d68934 100644 (file)
@@ -14,7 +14,9 @@
 #include "internal/deprecated.h"
 
 #include <openssl/bn.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include "internal/cryptlib.h"
 #include "internal/refcount.h"
 #include "crypto/dsa.h"
index 9b4467f2bea8e76204eeab151d021dcae46887ce..381da71f33a836535a53fb8882c4849d245d3af4 100644 (file)
 #include <openssl/objects.h>
 #include <openssl/params.h>
 #include <openssl/err.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+# include <openssl/x509.h>
+#endif
 #include "crypto/bn.h"
 #include "crypto/ec.h"
 #include "ec_local.h"
index ba6b8df514006cdc337dcc398572fba04db89c82..eb14f4e409035b85e862065ef3d31fa12e528f67 100644 (file)
@@ -19,7 +19,9 @@
 #include "ec_local.h"
 #include "internal/refcount.h"
 #include <openssl/err.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/self_test.h>
 #include "prov/providercommon.h"
 #include "crypto/bn.h"
index 91b7a4408251e3569f8bad417756a958152f48af..8c011635cb4283d79bc614546f35f73c9738da57 100644 (file)
@@ -15,7 +15,9 @@
 
 #include <string.h>
 #include <openssl/ec.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/err.h>
 #include "ec_local.h"
 
index 14278592cda1c37458e26dadd8e750875c57cb01..a0144d5a86bc2ba014b342fb4842011419508332 100644 (file)
@@ -13,6 +13,9 @@
 #include <openssl/ec.h>
 #include <openssl/rand.h>
 #include <openssl/err.h>
+#ifndef FIPS_MODULE
+# include <openssl/x509.h>
+#endif
 #include "crypto/ecx.h"
 #include "ecx_backend.h"
 
index 4a5c926103f2c839a1a8b6d38e4cada8f18e2715..1f2910bc695f6059a8577260086fd289e59d2a2e 100644 (file)
@@ -14,7 +14,9 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include <openssl/ec.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/params.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
index 3a8e2c643e48f102c702ad89064d13dd16472b1c..e0f411aa063a069c35730099efcc9876c1e3542d 100644 (file)
@@ -16,7 +16,9 @@
 #include <openssl/evp.h>
 #include <openssl/err.h>
 #include <openssl/rand.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/params.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
index 0b08c9adfd1d321390f7f0cd58b0a91a6eff7a9a..f78df52ab1953c905728ff8acfe60041d56e2ac7 100644 (file)
 #include <openssl/dh.h>
 #include <openssl/ec.h>
 #include "crypto/evp.h"
-#include "crypto/asn1.h"
 #include "internal/provider.h"
 #include "evp_local.h"
 
 #if !defined(FIPS_MODULE)
+# include "crypto/asn1.h"
 
 int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
 {
index 7b1a44241ecbe43322d0d36cd53cb7a0d1c234c9..0db755e06b40efda2cfda174e747a4143e608fa0 100644 (file)
@@ -7,13 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/evp.h>
-
 #include <stdio.h>
 #include <stdlib.h>
-#include <openssl/engine.h>
 #include <openssl/evp.h>
-#include <openssl/x509v3.h>
 #include <openssl/rand.h>
 #include <openssl/core.h>
 #include <openssl/core_names.h>
@@ -22,7 +18,6 @@
 #include "internal/numbers.h"
 #include "internal/provider.h"
 #include "internal/core.h"
-#include "crypto/asn1.h"
 #include "crypto/evp.h"
 #include "evp_local.h"
 
index 5552b2660114b1c735bbcc0f8dd13b436e2432f2..8177626ae0627df7ee627ac45b41a1f40e3148ff 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include "internal/cryptlib.h"
-#include <openssl/engine.h>
 #include <openssl/evp.h>
-#include <openssl/x509v3.h>
 #include <openssl/kdf.h>
 #include <openssl/core.h>
 #include <openssl/core_names.h>
-#include "crypto/asn1.h"
 #include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "internal/provider.h"
index f3dd876cfdf2cc5c06563a8d96497badf4bda83e..32e4fbcbaa0bb7410ed3911de6b67fa5f1a9419f 100644 (file)
@@ -11,7 +11,6 @@
 #include "internal/cryptlib.h"
 #include "internal/nelem.h"
 #include "crypto/evp.h"
-#include "crypto/asn1.h"
 #include "internal/core.h"
 #include "internal/provider.h"
 #include "evp_local.h"
index 0da6498030b6fa2b2c88718784e56a2350a879a6..5c5ed05876475226f760f520acf29e592f84911f 100644 (file)
@@ -11,7 +11,6 @@
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/objects.h>
-#include <openssl/x509.h>
 #include "crypto/evp.h"
 #include "internal/provider.h"
 #include "internal/numbers.h"   /* includes SIZE_MAX */
index 07be8884febe929d7536e7e4e5ec07d15d27517f..fa3a0258fabf7bf77337b896d884b3d057cbcfb1 100644 (file)
 #include <openssl/err.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
-#include <openssl/x509.h>
 #include <openssl/rsa.h>
 #include <openssl/dsa.h>
 #include <openssl/dh.h>
 #include <openssl/ec.h>
 #include <openssl/cmac.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/params.h>
 #include <openssl/param_build.h>
 #include <openssl/encoder.h>
 
 #include "internal/numbers.h"   /* includes SIZE_MAX */
 #include "internal/ffc.h"
-#include "crypto/asn1.h"
 #include "crypto/evp.h"
 #include "crypto/dh.h"
 #include "crypto/dsa.h"
 #include "crypto/ec.h"
 #include "crypto/ecx.h"
 #include "crypto/rsa.h"
-#include "crypto/x509.h"
+#ifndef FIPS_MODULE
+# include "crypto/asn1.h"
+# include "crypto/x509.h"
+#endif
 #include "internal/provider.h"
 #include "evp_local.h"
 
index 112965e79449bf83517874d3877ac4ce2008fd55..2ecf2d025188e7535bdf9e4aa3f591d0961ca991 100644 (file)
@@ -13,7 +13,9 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include "crypto/bn.h"
-#include "crypto/asn1.h"
+#ifndef FIPS_MODULE
+# include "crypto/asn1.h"
+#endif
 #include "crypto/evp.h"
 #include "evp_local.h"
 
index 2d96e3c227fc3601c95109edbb03ea46dcbe84ed..af3d990869d8894bd0e950702e03906b3267f157 100644 (file)
@@ -16,7 +16,9 @@
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include "crypto/bn.h"
-#include "crypto/asn1.h"
+#ifndef FIPS_MODULE
+# include "crypto/asn1.h"
+#endif
 #include "crypto/evp.h"
 #include "evp_local.h"
 
index 1256e981eb8ccdb03d142e8aebcead1c6d0ab511..c214163588c38555b0c11c2e522aaa8771c3b50b 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/evp.h>
-#include <openssl/x509v3.h>
 #include <openssl/core_names.h>
 #include <openssl/dh.h>
 #include <openssl/rsa.h>
 #include <openssl/kdf.h>
 #include "internal/cryptlib.h"
-#include "crypto/asn1.h"
+#ifndef FIPS_MODULE
+# include "crypto/asn1.h"
+#endif
 #include "crypto/evp.h"
 #include "crypto/dh.h"
 #include "crypto/ec.h"
index e824dcaf3cd79eb792d12a289596fd3aa1d4e8c8..85ad54e4cfdbc85cad5d0e0fa3a4122ad5d9d954 100644 (file)
 #include <openssl/params.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
+#ifndef FIPS_MODULE
+# include <openssl/x509.h>
+# include "crypto/asn1.h"
+#endif
 #include "internal/sizes.h"
 #include "internal/param_build_set.h"
-#include "crypto/asn1.h"
 #include "crypto/rsa.h"
 #include "rsa_local.h"
 
index 70eaa59a8b386df0a1d96bfbd0754e0b86f24e65..6433282597091f4e489e91cb24fc270599064408 100644 (file)
@@ -15,7 +15,9 @@
 
 #include <openssl/crypto.h>
 #include <openssl/core_names.h>
-#include <openssl/engine.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include <openssl/evp.h>
 #include <openssl/param_build.h>
 #include "internal/cryptlib.h"
index 21a2e9d727b5d5016c753b500acf80502cf1b2da..c5a664dc0b0dd6522a05a6546db2b3c36be5cdff 100644 (file)
 #include <openssl/bn.h>
 #include <openssl/rsa.h>
 #include <openssl/objects.h>
-#include <openssl/x509.h>
-#include "crypto/x509.h"
-#ifndef OPENSSL_NO_MD2
-# include <openssl/md2.h> /* uses MD2_DIGEST_LENGTH */
-#endif
-#ifndef OPENSSL_NO_MD4
-# include <openssl/md4.h> /* uses MD4_DIGEST_LENGTH */
-#endif
-#ifndef OPENSSL_NO_MD5
-# include <openssl/md5.h> /* uses MD5_DIGEST_LENGTH */
-#endif
-#ifndef OPENSSL_NO_MDC2
-# include <openssl/mdc2.h> /* uses MDC2_DIGEST_LENGTH */
-#endif
-#ifndef OPENSSL_NO_RMD160
-# include <openssl/ripemd.h> /* uses RIPEMD160_DIGEST_LENGTH */
+#ifndef FIPS_MODULE
+# ifndef OPENSSL_NO_MD2
+#  include <openssl/md2.h> /* uses MD2_DIGEST_LENGTH */
+# endif
+# ifndef OPENSSL_NO_MD4
+#  include <openssl/md4.h> /* uses MD4_DIGEST_LENGTH */
+# endif
+# ifndef OPENSSL_NO_MD5
+#  include <openssl/md5.h> /* uses MD5_DIGEST_LENGTH */
+# endif
+# ifndef OPENSSL_NO_MDC2
+#  include <openssl/mdc2.h> /* uses MDC2_DIGEST_LENGTH */
+# endif
+# ifndef OPENSSL_NO_RMD160
+#  include <openssl/ripemd.h> /* uses RIPEMD160_DIGEST_LENGTH */
+# endif
 #endif
 #include <openssl/sha.h> /* uses SHA???_DIGEST_LENGTH */
 #include "crypto/rsa.h"
index 8613f9038e89a4d3d1aa981160c36be1a1c68488..f6be4ae006af15be4d9c381560a04677af68b333 100644 (file)
@@ -14,7 +14,6 @@
 # include <openssl/core.h>
 # include <openssl/params.h>
 # include <openssl/dh.h>
-# include <openssl/x509.h>
 # include "internal/ffc.h"
 
 DH *ossl_dh_new_by_nid_ex(OSSL_LIB_CTX *libctx, int nid);
index dad056bb28a5e41652f08a8723451e08efe297fc..eedbd8c7d1049e1be52e7fa219f75062c05eadde 100644 (file)
@@ -13,7 +13,6 @@
 
 # include <openssl/core.h>
 # include <openssl/dsa.h>
-# include <openssl/x509.h>
 # include "internal/ffc.h"
 
 #define DSA_PARAMGEN_TYPE_FIPS_186_4   0   /* Use FIPS186-4 standard */
index 77972c3650b89c99448576e583732447136c7926..62163b31ac13e94d2f78e7c015b6e1a774da0fd8 100644 (file)
@@ -24,7 +24,6 @@ int evp_pkey_ctx_set_ec_param_enc_prov(EVP_PKEY_CTX *ctx, int param_enc);
 # ifndef OPENSSL_NO_EC
 #  include <openssl/core.h>
 #  include <openssl/ec.h>
-#  include <openssl/x509.h>
 #  include "crypto/types.h"
 
 /*-
index 82671a8f4dca61506fa9321685c53e6027ac4d43..48b95fa5bac81f32c1c937b212b0907820457266 100644 (file)
@@ -20,7 +20,6 @@
 #  include <openssl/core.h>
 #  include <openssl/e_os2.h>
 #  include <openssl/crypto.h>
-#  include <openssl/x509.h>
 #  include "internal/refcount.h"
 #  include "crypto/types.h"
 
index cc67e1f70985434fd1e006cf632efff765918ef2..100e7ceb0590a64df7e3e0a31afc504972cbac77 100644 (file)
@@ -13,7 +13,6 @@
 
 # include <openssl/core.h>
 # include <openssl/rsa.h>
-# include <openssl/x509.h>
 # include "crypto/types.h"
 
 #define RSA_MIN_MODULUS_BITS    512
index 1f6f4687ad50c6fa044f1a1a121d3b7c02621cab..fa73e4650672e3e49f48469ec77c0bba56efd3f8 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <openssl/provider.h>
-#include <openssl/engine.h>
+#include <openssl/types.h>
 
 typedef struct {
     /*
index 30fe7c6b213338c4984ad627d20b16ab7ad28cea..662175c2f3be4a7657534ff44b13a815261f2e9e 100644 (file)
@@ -14,6 +14,9 @@
 #include <openssl/core_names.h>
 #include <openssl/err.h>
 #include <openssl/proverr.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include "prov/provider_util.h"
 #include "internal/nelem.h"
 
index e1e2609dfa3485920f33dbbbf9aa7f63d537b1f6..63553996bd993db307561f39e0bf90ab8fc41873 100644 (file)
@@ -18,6 +18,9 @@
 #include <openssl/evp.h>
 #include <openssl/proverr.h>
 #include <openssl/param_build.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include "internal/param_build_set.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
index 229127603511f87b8929b79aa2c3a7cf3b737d4d..b44f13b5faec3694213de8019ad319b3077bb781 100644 (file)
@@ -16,7 +16,6 @@
 #include <openssl/core_dispatch.h>
 #include <openssl/core_names.h>
 #include <openssl/params.h>
-#include <openssl/engine.h>
 #include <openssl/evp.h>
 #include <openssl/cmac.h>
 
@@ -111,7 +110,7 @@ static int cmac_setkey(struct cmac_data_st *macctx,
                        ossl_prov_cipher_cipher(&macctx->cipher),
                        ossl_prov_cipher_engine(&macctx->cipher));
     ossl_prov_cipher_reset(&macctx->cipher);
-    return rv;    
+    return rv;
 }
 
 static int cmac_init(void *vmacctx, const unsigned char *key,
index 29fb9f87df3b37eb44dd99f481a138fd105afc5d..89904fc89d40785dfa409387627f4254399c93fe 100644 (file)
@@ -11,7 +11,6 @@
 #include <openssl/core_dispatch.h>
 #include <openssl/core_names.h>
 #include <openssl/params.h>
-#include <openssl/engine.h>
 #include <openssl/evp.h>
 #include <openssl/err.h>
 #include <openssl/proverr.h>
index 3a0679ce8f80a69339d3e7ab4fbc9f0c7a9cebcb..78c4924a38c086fccd56b3c6f22733525086cec1 100644 (file)
@@ -18,7 +18,6 @@
 #include <openssl/core_dispatch.h>
 #include <openssl/core_names.h>
 #include <openssl/params.h>
-#include <openssl/engine.h>
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 
index d9fd1052890c5153d1c36767e24592a6a7d03e31..06f79505ff4c827fdb701dca5878e7bf7afc832d 100644 (file)
@@ -16,6 +16,9 @@
 #include <openssl/core_names.h>
 #include <openssl/params.h>
 #include <openssl/err.h>
+#ifndef FIPS_MODULE
+# include <openssl/engine.h>
+#endif
 #include "prov/implementations.h"
 #include "prov/provider_ctx.h"
 #include "prov/macsignature.h"
index b0e3496ba225faf10fec19df3e8766126994ed55..85f296b8078398c083cb69b498e9f71af31ffd82 100644 (file)
@@ -27,7 +27,9 @@
 #include "internal/cryptlib.h"
 
 #include <openssl/evp.h>
-#include <openssl/md5.h>
+#ifndef FIPS_MODULE
+# include <openssl/md5.h>
+#endif
 #include <openssl/sha.h>
 
 char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx);