]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Clean up some unnecessary includes
authorMatt Caswell <matt@openssl.org>
Wed, 7 Jan 2026 10:24:10 +0000 (10:24 +0000)
committerMatt Caswell <matt@openssl.org>
Mon, 12 Jan 2026 08:31:38 +0000 (08:31 +0000)
Now that we have removed lots of deadcode various files are including
more than they need to. We can slim down the list of includes.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)

19 files changed:
crypto/evp/e_aes.c
crypto/evp/e_aes_cbc_hmac_sha1.c
crypto/evp/e_aes_cbc_hmac_sha256.c
crypto/evp/e_aria.c
crypto/evp/e_bf.c
crypto/evp/e_camellia.c
crypto/evp/e_cast.c
crypto/evp/e_chacha20_poly1305.c
crypto/evp/e_des.c
crypto/evp/e_des3.c
crypto/evp/e_idea.c
crypto/evp/e_null.c
crypto/evp/e_rc2.c
crypto/evp/e_rc4.c
crypto/evp/e_rc4_hmac_md5.c
crypto/evp/e_rc5.c
crypto/evp/e_seed.c
crypto/evp/e_sm4.c
crypto/evp/e_xcbc_d.c

index ce880c8b4d20a2847d6bcff50fb014ad5b610cc4..edea4c8763fefe0b3ca6dd8e3a538755bfd4c1f8 100644 (file)
@@ -7,27 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-/*
- * This file uses the low-level AES functions (which are deprecated for
- * non-internal use) in order to implement the EVP AES ciphers.
- */
-#include "internal/deprecated.h"
-
-#include <string.h>
-#include <assert.h>
-#include <openssl/opensslconf.h>
-#include <openssl/crypto.h>
-#include <openssl/evp.h>
-#include <openssl/err.h>
-#include <openssl/aes.h>
-#include <openssl/rand.h>
-#include <openssl/cmac.h>
 #include "crypto/evp.h"
-#include "internal/cryptlib.h"
-#include "crypto/modes.h"
-#include "crypto/siv.h"
-#include "crypto/aes_platform.h"
-#include "evp_local.h"
 
 #define BLOCK_CIPHER_generic(nid, keylen, blocksize, ivlen, nmode, mode, MODE, flags) \
     static const EVP_CIPHER aes_##keylen##_##mode = {                                 \
index 0b0f7ee1c41ac059a1c3eaa1e7fdc6f35db1a8df..09d2783381788742778f1e98799037bd87cce3bf 100644 (file)
@@ -7,19 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include <string.h>
-#include <openssl/opensslconf.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include <openssl/aes.h>
-#include <openssl/sha.h>
-#include <openssl/rand.h>
 #include "internal/cryptlib.h"
-#include "crypto/modes.h"
 #include "crypto/evp.h"
-#include "internal/constant_time.h"
-#include "evp_local.h"
 
 #if defined(AES_ASM) && (defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64))
 
index c027af88d3a1a18629b117dc08963d11a41ab37a..28a622fdaf1494a06fd240edceac12d5c13b26d4 100644 (file)
  */
 #include "internal/deprecated.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <openssl/opensslconf.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include <openssl/aes.h>
 #include <openssl/sha.h>
-#include <openssl/rand.h>
 #include "internal/cryptlib.h"
-#include "crypto/modes.h"
-#include "internal/constant_time.h"
 #include "crypto/evp.h"
-#include "evp_local.h"
 
 #if defined(AES_ASM) && (defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64))
 
index f6fcbe3f50d1199df8bd0f4e1e21ba40651f1cef..064d2500eb2b2dc042307333aebe569a93a898bd 100644 (file)
@@ -8,17 +8,10 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/deprecated.h"
+#include <openssl/macros.h>
 
-#include "internal/cryptlib.h"
 #ifndef OPENSSL_NO_ARIA
-#include <openssl/evp.h>
-#include <openssl/modes.h>
-#include <openssl/rand.h>
-#include "crypto/aria.h"
 #include "crypto/evp.h"
-#include "crypto/modes.h"
-#include "evp_local.h"
 
 IMPLEMENT_BLOCK_CIPHER(aria_128, ks, aria, EVP_ARIA_KEY,
     NID_aria_128, 16, 16, 16, 128,
@@ -80,4 +73,6 @@ BLOCK_CIPHER_aead(128, ccm, CCM)
 BLOCK_CIPHER_aead(192, ccm, CCM)
 BLOCK_CIPHER_aead(256, ccm, CCM)
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 444145d10949b17e8dd61ecf2d93a4d72fc6fa90..542f536fd050b6b49b17770024220eac926043bd 100644 (file)
@@ -7,15 +7,13 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
+
 #ifndef OPENSSL_NO_BF
-#include <openssl/evp.h>
 #include "crypto/evp.h"
-#include <openssl/objects.h>
-#include <openssl/blowfish.h>
-#include "evp_local.h"
 
 IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
     EVP_CIPH_VARIABLE_LENGTH)
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 99b69802ae81d515d410ad1d520c766d021bdbf6..4e3349b1d8c6853b5c23e3323b5efdd80c875420 100644 (file)
@@ -7,17 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/opensslconf.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"
-#include "evp_local.h"
 
 #define BLOCK_CIPHER_generic(nid, keylen, blocksize, ivlen, nmode, mode, MODE, flags) \
     static const EVP_CIPHER camellia_##keylen##_##mode = {                            \
index 18c2611e769dedf2759c316aa9d7897b3ee9db44..dbef50227299d18e1d05d1cb365ac1e56a24f170 100644 (file)
@@ -7,18 +7,16 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_CAST
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include "crypto/evp.h"
 #include <openssl/cast.h>
-#include "evp_local.h"
+#include "crypto/evp.h"
 
 IMPLEMENT_BLOCK_CIPHER(cast5, ks, CAST, EVP_CAST_KEY,
     NID_cast5, 8, CAST_KEY_LENGTH, 8, 64,
     EVP_CIPH_VARIABLE_LENGTH)
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 1aa70268c59413da6d7e4f17569c79310bee9c2f..babc3c1888b99c82e80c669649a04e9b770ea465 100644 (file)
@@ -7,16 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
-#include "internal/endian.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_CHACHA
 
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include "crypto/evp.h"
-#include "evp_local.h"
 #include "crypto/chacha.h"
 
 static const EVP_CIPHER chacha20 = {
@@ -49,4 +44,6 @@ const EVP_CIPHER *EVP_chacha20_poly1305(void)
     return (&chacha20_poly1305);
 }
 #endif
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index ba4a21442468eeeb2ac5a7886013cd81548b36e3..3549c09fc30ad4c4700ddaa320bd710e195e98eb 100644 (file)
@@ -6,15 +6,11 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-#include <stdio.h>
-#include "internal/cryptlib.h"
+
+#include <openssl/macros.h>
+
 #ifndef OPENSSL_NO_DES
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include "crypto/evp.h"
-#include <openssl/des.h>
-#include <openssl/rand.h>
-#include "evp_local.h"
 
 BLOCK_CIPHER_defs(des, EVP_DES_KEY, NID_des, 8, 8, 8, 64,
     EVP_CIPH_RAND_KEY)
@@ -25,4 +21,6 @@ BLOCK_CIPHER_def_cfb(des, EVP_DES_KEY, NID_des, 8, 8, 1,
 BLOCK_CIPHER_def_cfb(des, EVP_DES_KEY, NID_des, 8, 8, 8,
     EVP_CIPH_RAND_KEY)
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 2557360ff765682c9cc5e8ba04538b331f085322..c0d6e4abde3394261ba156e90e8fd0a9b7ead740 100644 (file)
@@ -7,14 +7,10 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
+
 #ifndef OPENSSL_NO_DES
-#include <openssl/objects.h>
 #include "crypto/evp.h"
-#include <openssl/des.h>
-#include <openssl/rand.h>
-#include "evp_local.h"
 
 BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
     EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1)
@@ -51,4 +47,6 @@ const EVP_CIPHER *EVP_des_ede3_wrap(void)
     return &des3_wrap;
 }
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index c789b3bc890899c8bf6287d49c1221220aa978c6..86e4ee12aa8cac8eb96472bea7ea2a876bb50b5a 100644 (file)
@@ -7,17 +7,14 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_IDEA
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include "crypto/evp.h"
-#include <openssl/idea.h>
-#include "evp_local.h"
 
 BLOCK_CIPHER_defs(idea, IDEA_KEY_SCHEDULE, NID_idea, 8, 16, 8, 64,
     0)
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index c4005f19a6f7aa5c986d38fc920b2e5c1af9c4b1..7ae34e4d64aeefa14a3c7cb0eb572af5facb6f62 100644 (file)
@@ -7,10 +7,6 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include "crypto/evp.h"
 
 static const EVP_CIPHER n_cipher = {
index d3db95527be3f38cc65f84fc94a3020b2dcb06ae..ec7c8a30fb82e425ac89eba25b4246b2abd20f43 100644 (file)
@@ -6,16 +6,11 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_RC2
-
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include "crypto/evp.h"
 #include <openssl/rc2.h>
-#include "evp_local.h"
 
 IMPLEMENT_BLOCK_CIPHER(rc2, ks, RC2, EVP_RC2_KEY, NID_rc2,
     8,
@@ -46,4 +41,6 @@ const EVP_CIPHER *EVP_rc2_40_cbc(void)
     return &r2_40_cbc_cipher;
 }
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 6cab17c27b37bb1aa8617b508491847f61290f4f..69b525a3c324ecc5d741c647d68f33c0bda9a75d 100644 (file)
@@ -7,15 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_RC4
-
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/rc4.h>
-
 #include "crypto/evp.h"
 
 static const EVP_CIPHER r4_cipher = {
@@ -41,4 +35,6 @@ const EVP_CIPHER *EVP_rc4_40(void)
 {
     return &r4_40_cipher;
 }
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 65adc8ea79ee7e766af2437b5f07e0336de838cb..86752a30b76828c26553831ed478db2b8175d9a1 100644 (file)
@@ -7,17 +7,9 @@
  * https://www.openssl.org/source/license.html
  */
 
-/*
- * MD5 and RC4 low level APIs are deprecated for public use, but still ok for
- * internal use.
- */
-#include "internal/deprecated.h"
-
-#include "internal/cryptlib.h"
-#include <openssl/opensslconf.h>
+#include <openssl/macros.h>
 
 #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_MD5)
-
 #include "crypto/evp.h"
 
 static const EVP_CIPHER r4_hmac_md5_cipher = {
@@ -35,4 +27,6 @@ const EVP_CIPHER *EVP_rc4_hmac_md5(void)
 {
     return &r4_hmac_md5_cipher;
 }
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 48b011a6978964482df9126e50e5d66f280b97c7..64a4823cb930c3438f36d33f4ad6b93d9ec78c8f 100644 (file)
@@ -7,19 +7,16 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_RC5
-
-#include <openssl/evp.h>
 #include "crypto/evp.h"
-#include <openssl/objects.h>
-#include "evp_local.h"
 #include <openssl/rc5.h>
 
 IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, ks, RC5_32, EVP_RC5_KEY, NID_rc5,
     8, RC5_32_KEY_LENGTH, 8, 64,
     EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT)
 
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 7a7713020c08d9da725ae4850ac2864b02807b6c..dd1b23a84346dcc720555c23f9faa080bcbd5bc7 100644 (file)
@@ -7,14 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/opensslconf.h>
-#include <openssl/evp.h>
-#include <openssl/err.h>
-#include <string.h>
-#include <assert.h>
-#include <openssl/seed.h>
 #include "crypto/evp.h"
-#include "evp_local.h"
 
 IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
     16, 16, 16, 128, EVP_CIPH_FLAG_DEFAULT_ASN1)
index 18477798d7d8b25763c306852a82f0f035e06d41..91f8a043468f9a0e1a699d4b89bfca054e0feea5 100644 (file)
@@ -9,16 +9,10 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "internal/deprecated.h"
+#include <openssl/macros.h>
 
-#include "internal/cryptlib.h"
 #ifndef OPENSSL_NO_SM4
-#include <openssl/evp.h>
-#include <openssl/modes.h>
-#include "crypto/sm4.h"
 #include "crypto/evp.h"
-#include "crypto/sm4_platform.h"
-#include "evp_local.h"
 
 #define BLOCK_CIPHER_generic(nid, blocksize, ivlen, nmode, mode, MODE, flags) \
     static const EVP_CIPHER sm4_##mode = {                                    \
@@ -39,4 +33,6 @@
     BLOCK_CIPHER_generic(nid, 1, 16, ctr, ctr, CTR, flags)
 
 DEFINE_BLOCK_CIPHERS(NID_sm4, 0)
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif
index 9903f3197feb09945f4f2d7489b82cfe7d998c95..8f281c90f4762a3e51de171b8f6d74af66b72045 100644 (file)
@@ -7,16 +7,10 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
+#include <openssl/macros.h>
 
 #ifndef OPENSSL_NO_DES
-
-#include <openssl/evp.h>
-#include <openssl/objects.h>
 #include "crypto/evp.h"
-#include <openssl/des.h>
-#include "evp_local.h"
 
 static const EVP_CIPHER d_xcbc_cipher = {
     NID_desx_cbc,
@@ -29,4 +23,6 @@ const EVP_CIPHER *EVP_desx_cbc(void)
 {
     return &d_xcbc_cipher;
 }
+#else
+NON_EMPTY_TRANSLATION_UNIT
 #endif