]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lib/crypto: Explicitly include <linux/export.h>
authorEric Biggers <ebiggers@kernel.org>
Fri, 13 Jun 2025 18:48:14 +0000 (11:48 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 30 Jun 2025 16:26:19 +0000 (09:26 -0700)
Fix build warnings with W=1 that started appearing after
commit a934a57a42f6 ("scripts/misc-check: check missing #include
<linux/export.h> when W=1").

While at it, also sort the include lists alphabetically.  (Keep
asm/irqflags.h last, as otherwise it doesn't build on alpha.)

This handles all of lib/crypto/, but not arch/*/lib/crypto/.  The
exports in arch/*/lib/crypto/ will go away when the code is properly
integrated into lib/crypto/ as planned.

Link: https://lore.kernel.org/r/20250613184814.50173-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
30 files changed:
lib/crypto/aes.c
lib/crypto/aescfb.c
lib/crypto/aesgcm.c
lib/crypto/arc4.c
lib/crypto/blake2s-generic.c
lib/crypto/blake2s.c
lib/crypto/chacha.c
lib/crypto/chacha20poly1305.c
lib/crypto/curve25519-generic.c
lib/crypto/des.c
lib/crypto/gf128mul.c
lib/crypto/libchacha.c
lib/crypto/memneq.c
lib/crypto/mpi/mpi-add.c
lib/crypto/mpi/mpi-bit.c
lib/crypto/mpi/mpi-cmp.c
lib/crypto/mpi/mpi-mul.c
lib/crypto/mpi/mpi-pow.c
lib/crypto/mpi/mpi-sub-ui.c
lib/crypto/mpi/mpicoder.c
lib/crypto/mpi/mpiutil.c
lib/crypto/poly1305-donna32.c
lib/crypto/poly1305-donna64.c
lib/crypto/poly1305-generic.c
lib/crypto/poly1305.c
lib/crypto/sha1.c
lib/crypto/sha256-generic.c
lib/crypto/sha256.c
lib/crypto/sm3.c
lib/crypto/utils.c

index eafe14d021f5aa09c4a3ce334cc21a1a0ce2c196..b57fda3460f1b3b2546683414379a482ec504fe9 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <crypto/aes.h>
 #include <linux/crypto.h>
+#include <linux/export.h>
 #include <linux/module.h>
 #include <linux/unaligned.h>
 
index 2f09ae92ffa0e916ae649c50f27af5fe2feb3ddd..0f294c8cbf3c25124691cd5386bbc530553f4efe 100644 (file)
@@ -5,11 +5,10 @@
  * Copyright 2023 Google LLC
  */
 
-#include <linux/module.h>
-
-#include <crypto/algapi.h>
 #include <crypto/aes.h>
-
+#include <crypto/algapi.h>
+#include <linux/export.h>
+#include <linux/module.h>
 #include <asm/irqflags.h>
 
 static void aescfb_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst,
index faa4dee9bb1b3a88ffffe447cd12c9c01641bada..ac0b2fcfd6069a5f96c0b858e34b415193677cab 100644 (file)
@@ -5,12 +5,11 @@
  * Copyright 2022 Google LLC
  */
 
-#include <linux/module.h>
-
 #include <crypto/algapi.h>
 #include <crypto/gcm.h>
 #include <crypto/ghash.h>
-
+#include <linux/export.h>
+#include <linux/module.h>
 #include <asm/irqflags.h>
 
 static void aesgcm_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst,
index 838812d182164993558a83d6e333b4ed8ac81d9b..4e950e1e66d08b5aaadf4f037d2461e48297c671 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <crypto/arc4.h>
+#include <linux/export.h>
 #include <linux/module.h>
 
 int arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len)
index 09682136b57c691ba3c6a6029d6396318cfad64f..9828176a2efec7a6431fea4dfad05a0979bce8b5 100644 (file)
@@ -9,11 +9,12 @@
  */
 
 #include <crypto/internal/blake2s.h>
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/bug.h>
+#include <linux/export.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/types.h>
 #include <linux/unaligned.h>
 
 static const u8 blake2s_sigma[10][16] = {
index b0f9a678300b34527654885cd91a28a69111e9e0..f6ec68c3dcdae6fa95d2738e93152746a0e0e33c 100644 (file)
@@ -9,12 +9,13 @@
  */
 
 #include <crypto/internal/blake2s.h>
-#include <linux/types.h>
-#include <linux/string.h>
+#include <linux/bug.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
-#include <linux/bug.h>
+#include <linux/string.h>
+#include <linux/types.h>
 
 static inline void blake2s_set_lastblock(struct blake2s_state *state)
 {
index ced87dd31a97fdaceae296048b8d8d78171e058b..77f68de71066a9fc952ba96e8ed9304ef0887d1f 100644 (file)
@@ -5,13 +5,13 @@
  * Copyright (C) 2015 Martin Willi
  */
 
+#include <crypto/chacha.h>
+#include <linux/bitops.h>
 #include <linux/bug.h>
-#include <linux/kernel.h>
 #include <linux/export.h>
-#include <linux/bitops.h>
+#include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/unaligned.h>
-#include <crypto/chacha.h>
 
 static void chacha_permute(struct chacha_state *state, int nrounds)
 {
index e29eed49a5a14e8d7e01c1d697587457b59b6bd9..0b49d6aedefdd9cb819b49a1e8883785f79e530d 100644 (file)
@@ -7,16 +7,16 @@
  * Information: https://tools.ietf.org/html/rfc8439
  */
 
-#include <crypto/chacha20poly1305.h>
 #include <crypto/chacha.h>
+#include <crypto/chacha20poly1305.h>
 #include <crypto/poly1305.h>
 #include <crypto/utils.h>
-
-#include <linux/unaligned.h>
-#include <linux/kernel.h>
+#include <linux/export.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/unaligned.h>
 
 static void chacha_load_key(u32 *k, const u8 *in)
 {
index de7c99172fa25312cfb24111bcecd2ae48c4c9c4..f8aa70c9f559881d5d823524705191b3bf6fe4bf 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <crypto/curve25519.h>
+#include <linux/export.h>
 #include <linux/module.h>
 
 const u8 curve25519_null_point[CURVE25519_KEY_SIZE] __aligned(32) = { 0 };
index d3423b34a8e9b7fb95fd2c74bdbd2ef02cbb348d..a906070136dc3cffcb0b182fd4dc595f7cbd82b3 100644 (file)
@@ -7,21 +7,20 @@
  * Copyright (c) 2005 Dag Arne Osvik <da@osvik.no>
  */
 
+#include <crypto/des.h>
+#include <crypto/internal/des.h>
 #include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <linux/crypto.h>
 #include <linux/errno.h>
+#include <linux/export.h>
 #include <linux/fips.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/types.h>
-
 #include <linux/unaligned.h>
 
-#include <crypto/des.h>
-#include <crypto/internal/des.h>
-
 #define ROL(x, r) ((x) = rol32((x), (r)))
 #define ROR(x, r) ((x) = ror32((x), (r)))
 
index fbe72cb3453a5a9870afed69fdd5c00aa6b246cb..2a34590fe3f10f0a920d8b342c0c71d564335a38 100644 (file)
@@ -49,6 +49,7 @@
 */
 
 #include <crypto/gf128mul.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
index ebcca381e248acb2254743f499544bd92d0dcfe9..26862ad90a9640027737f3af3d9c763bad9771aa 100644 (file)
@@ -5,12 +5,11 @@
  * Copyright (C) 2015 Martin Willi
  */
 
-#include <linux/kernel.h>
-#include <linux/export.h>
-#include <linux/module.h>
-
 #include <crypto/algapi.h> // for crypto_xor_cpy
 #include <crypto/chacha.h>
+#include <linux/export.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
 
 void chacha_crypt_generic(struct chacha_state *state, u8 *dst, const u8 *src,
                          unsigned int bytes, int nrounds)
index a2afd10349c9254c9cda1a5cab38aa45eabef5f6..44daacb8cb5130c5e8a8db55103487b6475c9337 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <linux/unaligned.h>
 #include <crypto/algapi.h>
+#include <linux/export.h>
 #include <linux/module.h>
+#include <linux/unaligned.h>
 
 /* Generic path for arbitrary size */
 static inline unsigned long
index 3015140d486023f7eac73fe3e9ec87ce303f1552..c0375c1672fa31fe75ac4537df1804945325404e 100644 (file)
@@ -11,6 +11,8 @@
  *      to avoid revealing of sensitive data due to paging etc.
  */
 
+#include <linux/export.h>
+
 #include "mpi-internal.h"
 
 int mpi_add(MPI w, MPI u, MPI v)
index 934d8131136061115e9b7e6d35e8c87713d96e4f..b3d0e7ddbc03dbabb69d3e79f421e5bb04b20aff 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#include <linux/export.h>
+
 #include "mpi-internal.h"
 #include "longlong.h"
 
index ceaebe181cd7092f8918be6d7a8a0123fa4602ec..b42929296bcefc40c2f882b1e644a5bf0faf426f 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#include <linux/export.h>
+
 #include "mpi-internal.h"
 
 int mpi_cmp_ui(MPI u, unsigned long v)
index 7e6ff1ce3e9b63fb4fdfbbf43355f97d25fb005e..d79f186ad90bce2e53a988c1f8ee27de4867ed98 100644 (file)
@@ -11,6 +11,8 @@
  *      to avoid revealing of sensitive data due to paging etc.
  */
 
+#include <linux/export.h>
+
 #include "mpi-internal.h"
 
 int mpi_mul(MPI w, MPI u, MPI v)
index 67fbd4c2503d08e5e8f63c0e59810d053362bce5..9e695a3bda3a074ffa9b358901ae6f1628c7f5b3 100644 (file)
  *      however I decided to publish this code under the plain GPL.
  */
 
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/string.h>
+
 #include "mpi-internal.h"
 #include "longlong.h"
 
index b41b082b5f3e3eb306885cdacf6cb948b63e4d8f..0edcdbd24833a88bd919d2b76ae26b9e9b592f3c 100644 (file)
@@ -32,6 +32,8 @@
  * see https://www.gnu.org/licenses/.
  */
 
+#include <linux/export.h>
+
 #include "mpi-internal.h"
 
 int mpi_sub_ui(MPI w, MPI u, unsigned long vval)
index dde01030807de3ba9cdfdca39ef1ac342a52e27d..47f6939599b33a7e6fdd2a3055c0bb5c82ee2b14 100644 (file)
@@ -19,8 +19,9 @@
  */
 
 #include <linux/bitops.h>
-#include <linux/count_zeros.h>
 #include <linux/byteorder/generic.h>
+#include <linux/count_zeros.h>
+#include <linux/export.h>
 #include <linux/scatterlist.h>
 #include <linux/string.h>
 #include "mpi-internal.h"
index 979ece5a81d253675694154e4d7ba9d33872edb9..7f2db830f4043691e9425f802846154269064ec9 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#include <linux/export.h>
+
 #include "mpi-internal.h"
 
 /****************
index 0a4a2d99e36549d9056ae0adfc4acc95bbd7002d..b66131b3f6d4b691e13858149c9d1694ac3cd01a 100644 (file)
@@ -6,9 +6,10 @@
  * public domain.
  */
 
+#include <crypto/internal/poly1305.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/unaligned.h>
-#include <crypto/internal/poly1305.h>
 
 void poly1305_core_setkey(struct poly1305_core_key *key,
                          const u8 raw_key[POLY1305_BLOCK_SIZE])
index 530287531b2ee2b23210f74212928d2c7b0410a5..8a72a5a849446b9bfa4e0df5090e61032c7a7df6 100644 (file)
@@ -6,9 +6,10 @@
  * public domain.
  */
 
+#include <crypto/internal/poly1305.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/unaligned.h>
-#include <crypto/internal/poly1305.h>
 
 void poly1305_core_setkey(struct poly1305_core_key *key,
                          const u8 raw_key[POLY1305_BLOCK_SIZE])
index a73f700fa1fb86f19d8ffb6e0dc7ebb576d77b36..71a16c5c538b402044cb2921e0d6537f161335f1 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <crypto/internal/poly1305.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 
index 5f2f2af3b59f8412549bc5ee324cc3af1fd35e67..a6dc182b6c22d71fe3156825381d609b3264e8fc 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <crypto/internal/blockhash.h>
 #include <crypto/internal/poly1305.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
index ebb60519ae93912ae939fcec581bd1c5b314bbd6..6d809c3088be3ec9c23e8f6798518f101114ef32 100644 (file)
@@ -6,12 +6,12 @@
  * This was based on the git SHA1 implementation.
  */
 
-#include <linux/kernel.h>
+#include <crypto/sha1.h>
+#include <linux/bitops.h>
 #include <linux/export.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/bitops.h>
 #include <linux/string.h>
-#include <crypto/sha1.h>
 #include <linux/unaligned.h>
 
 /*
index a16ad4f25ebb723b49812de031454930cb8c9f33..2968d95d04038aabc8f2cddf578e0547c14417e3 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <crypto/internal/sha2.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
index 107e5162507a7f1db171ba28f9fbc2faeb73c8d4..6bfa4ae8dfb59aa78136720cc9bb8b96458c8f9d 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <crypto/internal/blockhash.h>
 #include <crypto/internal/sha2.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
index efff0e267d84d02ed441cbc13215f33402fe9c74..c6b9ad8a3ac6678e09232ebdc4395978eef8fa1a 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <crypto/sm3.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
index 87da2a6dd161e1c8b7313fe691055f1591fcb7f3..dec381d5e90651dad075607754f98caa8d9a9dc2 100644 (file)
@@ -5,9 +5,10 @@
  * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
  */
 
-#include <linux/unaligned.h>
 #include <crypto/utils.h>
+#include <linux/export.h>
 #include <linux/module.h>
+#include <linux/unaligned.h>
 
 /*
  * XOR @len bytes from @src1 and @src2 together, writing the result to @dst