Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/crypto: Explicitly include <linux/export.h>

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>

+67 -41
+1
lib/crypto/aes.c
··· 5 5 6 6 #include <crypto/aes.h> 7 7 #include <linux/crypto.h> 8 + #include <linux/export.h> 8 9 #include <linux/module.h> 9 10 #include <linux/unaligned.h> 10 11
+3 -4
lib/crypto/aescfb.c
··· 5 5 * Copyright 2023 Google LLC 6 6 */ 7 7 8 - #include <linux/module.h> 9 - 10 - #include <crypto/algapi.h> 11 8 #include <crypto/aes.h> 12 - 9 + #include <crypto/algapi.h> 10 + #include <linux/export.h> 11 + #include <linux/module.h> 13 12 #include <asm/irqflags.h> 14 13 15 14 static void aescfb_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst,
+2 -3
lib/crypto/aesgcm.c
··· 5 5 * Copyright 2022 Google LLC 6 6 */ 7 7 8 - #include <linux/module.h> 9 - 10 8 #include <crypto/algapi.h> 11 9 #include <crypto/gcm.h> 12 10 #include <crypto/ghash.h> 13 - 11 + #include <linux/export.h> 12 + #include <linux/module.h> 14 13 #include <asm/irqflags.h> 15 14 16 15 static void aesgcm_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst,
+1
lib/crypto/arc4.c
··· 8 8 */ 9 9 10 10 #include <crypto/arc4.h> 11 + #include <linux/export.h> 11 12 #include <linux/module.h> 12 13 13 14 int arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len)
+5 -4
lib/crypto/blake2s-generic.c
··· 9 9 */ 10 10 11 11 #include <crypto/internal/blake2s.h> 12 - #include <linux/types.h> 13 - #include <linux/string.h> 14 - #include <linux/kernel.h> 15 - #include <linux/init.h> 16 12 #include <linux/bug.h> 13 + #include <linux/export.h> 14 + #include <linux/init.h> 15 + #include <linux/kernel.h> 16 + #include <linux/string.h> 17 + #include <linux/types.h> 17 18 #include <linux/unaligned.h> 18 19 19 20 static const u8 blake2s_sigma[10][16] = {
+5 -4
lib/crypto/blake2s.c
··· 9 9 */ 10 10 11 11 #include <crypto/internal/blake2s.h> 12 - #include <linux/types.h> 13 - #include <linux/string.h> 12 + #include <linux/bug.h> 13 + #include <linux/export.h> 14 + #include <linux/init.h> 14 15 #include <linux/kernel.h> 15 16 #include <linux/module.h> 16 - #include <linux/init.h> 17 - #include <linux/bug.h> 17 + #include <linux/string.h> 18 + #include <linux/types.h> 18 19 19 20 static inline void blake2s_set_lastblock(struct blake2s_state *state) 20 21 {
+4 -4
lib/crypto/chacha.c
··· 5 5 * Copyright (C) 2015 Martin Willi 6 6 */ 7 7 8 - #include <linux/bug.h> 9 - #include <linux/kernel.h> 10 - #include <linux/export.h> 8 + #include <crypto/chacha.h> 11 9 #include <linux/bitops.h> 10 + #include <linux/bug.h> 11 + #include <linux/export.h> 12 + #include <linux/kernel.h> 12 13 #include <linux/string.h> 13 14 #include <linux/unaligned.h> 14 - #include <crypto/chacha.h> 15 15 16 16 static void chacha_permute(struct chacha_state *state, int nrounds) 17 17 {
+4 -4
lib/crypto/chacha20poly1305.c
··· 7 7 * Information: https://tools.ietf.org/html/rfc8439 8 8 */ 9 9 10 - #include <crypto/chacha20poly1305.h> 11 10 #include <crypto/chacha.h> 11 + #include <crypto/chacha20poly1305.h> 12 12 #include <crypto/poly1305.h> 13 13 #include <crypto/utils.h> 14 - 15 - #include <linux/unaligned.h> 16 - #include <linux/kernel.h> 14 + #include <linux/export.h> 17 15 #include <linux/init.h> 16 + #include <linux/kernel.h> 18 17 #include <linux/mm.h> 19 18 #include <linux/module.h> 19 + #include <linux/unaligned.h> 20 20 21 21 static void chacha_load_key(u32 *k, const u8 *in) 22 22 {
+1
lib/crypto/curve25519-generic.c
··· 10 10 */ 11 11 12 12 #include <crypto/curve25519.h> 13 + #include <linux/export.h> 13 14 #include <linux/module.h> 14 15 15 16 const u8 curve25519_null_point[CURVE25519_KEY_SIZE] __aligned(32) = { 0 };
+3 -4
lib/crypto/des.c
··· 7 7 * Copyright (c) 2005 Dag Arne Osvik <da@osvik.no> 8 8 */ 9 9 10 + #include <crypto/des.h> 11 + #include <crypto/internal/des.h> 10 12 #include <linux/bitops.h> 11 13 #include <linux/compiler.h> 12 14 #include <linux/crypto.h> 13 15 #include <linux/errno.h> 16 + #include <linux/export.h> 14 17 #include <linux/fips.h> 15 18 #include <linux/init.h> 16 19 #include <linux/module.h> 17 20 #include <linux/string.h> 18 21 #include <linux/types.h> 19 - 20 22 #include <linux/unaligned.h> 21 - 22 - #include <crypto/des.h> 23 - #include <crypto/internal/des.h> 24 23 25 24 #define ROL(x, r) ((x) = rol32((x), (r))) 26 25 #define ROR(x, r) ((x) = ror32((x), (r)))
+1
lib/crypto/gf128mul.c
··· 49 49 */ 50 50 51 51 #include <crypto/gf128mul.h> 52 + #include <linux/export.h> 52 53 #include <linux/kernel.h> 53 54 #include <linux/module.h> 54 55 #include <linux/slab.h>
+3 -4
lib/crypto/libchacha.c
··· 5 5 * Copyright (C) 2015 Martin Willi 6 6 */ 7 7 8 - #include <linux/kernel.h> 9 - #include <linux/export.h> 10 - #include <linux/module.h> 11 - 12 8 #include <crypto/algapi.h> // for crypto_xor_cpy 13 9 #include <crypto/chacha.h> 10 + #include <linux/export.h> 11 + #include <linux/kernel.h> 12 + #include <linux/module.h> 14 13 15 14 void chacha_crypt_generic(struct chacha_state *state, u8 *dst, const u8 *src, 16 15 unsigned int bytes, int nrounds)
+2 -1
lib/crypto/memneq.c
··· 59 59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 60 */ 61 61 62 - #include <linux/unaligned.h> 63 62 #include <crypto/algapi.h> 63 + #include <linux/export.h> 64 64 #include <linux/module.h> 65 + #include <linux/unaligned.h> 65 66 66 67 /* Generic path for arbitrary size */ 67 68 static inline unsigned long
+2
lib/crypto/mpi/mpi-add.c
··· 11 11 * to avoid revealing of sensitive data due to paging etc. 12 12 */ 13 13 14 + #include <linux/export.h> 15 + 14 16 #include "mpi-internal.h" 15 17 16 18 int mpi_add(MPI w, MPI u, MPI v)
+2
lib/crypto/mpi/mpi-bit.c
··· 18 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 19 */ 20 20 21 + #include <linux/export.h> 22 + 21 23 #include "mpi-internal.h" 22 24 #include "longlong.h" 23 25
+2
lib/crypto/mpi/mpi-cmp.c
··· 18 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 19 */ 20 20 21 + #include <linux/export.h> 22 + 21 23 #include "mpi-internal.h" 22 24 23 25 int mpi_cmp_ui(MPI u, unsigned long v)
+2
lib/crypto/mpi/mpi-mul.c
··· 11 11 * to avoid revealing of sensitive data due to paging etc. 12 12 */ 13 13 14 + #include <linux/export.h> 15 + 14 16 #include "mpi-internal.h" 15 17 16 18 int mpi_mul(MPI w, MPI u, MPI v)
+2
lib/crypto/mpi/mpi-pow.c
··· 13 13 * however I decided to publish this code under the plain GPL. 14 14 */ 15 15 16 + #include <linux/export.h> 16 17 #include <linux/sched.h> 17 18 #include <linux/string.h> 19 + 18 20 #include "mpi-internal.h" 19 21 #include "longlong.h" 20 22
+2
lib/crypto/mpi/mpi-sub-ui.c
··· 32 32 * see https://www.gnu.org/licenses/. 33 33 */ 34 34 35 + #include <linux/export.h> 36 + 35 37 #include "mpi-internal.h" 36 38 37 39 int mpi_sub_ui(MPI w, MPI u, unsigned long vval)
+2 -1
lib/crypto/mpi/mpicoder.c
··· 19 19 */ 20 20 21 21 #include <linux/bitops.h> 22 - #include <linux/count_zeros.h> 23 22 #include <linux/byteorder/generic.h> 23 + #include <linux/count_zeros.h> 24 + #include <linux/export.h> 24 25 #include <linux/scatterlist.h> 25 26 #include <linux/string.h> 26 27 #include "mpi-internal.h"
+2
lib/crypto/mpi/mpiutil.c
··· 18 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 19 */ 20 20 21 + #include <linux/export.h> 22 + 21 23 #include "mpi-internal.h" 22 24 23 25 /****************
+2 -1
lib/crypto/poly1305-donna32.c
··· 6 6 * public domain. 7 7 */ 8 8 9 + #include <crypto/internal/poly1305.h> 10 + #include <linux/export.h> 9 11 #include <linux/kernel.h> 10 12 #include <linux/unaligned.h> 11 - #include <crypto/internal/poly1305.h> 12 13 13 14 void poly1305_core_setkey(struct poly1305_core_key *key, 14 15 const u8 raw_key[POLY1305_BLOCK_SIZE])
+2 -1
lib/crypto/poly1305-donna64.c
··· 6 6 * public domain. 7 7 */ 8 8 9 + #include <crypto/internal/poly1305.h> 10 + #include <linux/export.h> 9 11 #include <linux/kernel.h> 10 12 #include <linux/unaligned.h> 11 - #include <crypto/internal/poly1305.h> 12 13 13 14 void poly1305_core_setkey(struct poly1305_core_key *key, 14 15 const u8 raw_key[POLY1305_BLOCK_SIZE])
+1
lib/crypto/poly1305-generic.c
··· 8 8 */ 9 9 10 10 #include <crypto/internal/poly1305.h> 11 + #include <linux/export.h> 11 12 #include <linux/kernel.h> 12 13 #include <linux/module.h> 13 14
+1
lib/crypto/poly1305.c
··· 9 9 10 10 #include <crypto/internal/blockhash.h> 11 11 #include <crypto/internal/poly1305.h> 12 + #include <linux/export.h> 12 13 #include <linux/kernel.h> 13 14 #include <linux/module.h> 14 15 #include <linux/string.h>
+5 -5
lib/crypto/sha1.c
··· 6 6 * This was based on the git SHA1 implementation. 7 7 */ 8 8 9 - #include <linux/kernel.h> 10 - #include <linux/export.h> 11 - #include <linux/module.h> 12 - #include <linux/bitops.h> 13 - #include <linux/string.h> 14 9 #include <crypto/sha1.h> 10 + #include <linux/bitops.h> 11 + #include <linux/export.h> 12 + #include <linux/kernel.h> 13 + #include <linux/module.h> 14 + #include <linux/string.h> 15 15 #include <linux/unaligned.h> 16 16 17 17 /*
+1
lib/crypto/sha256-generic.c
··· 12 12 */ 13 13 14 14 #include <crypto/internal/sha2.h> 15 + #include <linux/export.h> 15 16 #include <linux/kernel.h> 16 17 #include <linux/module.h> 17 18 #include <linux/string.h>
+1
lib/crypto/sha256.c
··· 13 13 14 14 #include <crypto/internal/blockhash.h> 15 15 #include <crypto/internal/sha2.h> 16 + #include <linux/export.h> 16 17 #include <linux/kernel.h> 17 18 #include <linux/module.h> 18 19 #include <linux/string.h>
+1
lib/crypto/sm3.c
··· 9 9 */ 10 10 11 11 #include <crypto/sm3.h> 12 + #include <linux/export.h> 12 13 #include <linux/kernel.h> 13 14 #include <linux/module.h> 14 15 #include <linux/string.h>
+2 -1
lib/crypto/utils.c
··· 5 5 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> 6 6 */ 7 7 8 - #include <linux/unaligned.h> 9 8 #include <crypto/utils.h> 9 + #include <linux/export.h> 10 10 #include <linux/module.h> 11 + #include <linux/unaligned.h> 11 12 12 13 /* 13 14 * XOR @len bytes from @src1 and @src2 together, writing the result to @dst