@@ -3,10 +3,11 @@
* Copyright (C) 2017-2019 Linaro Ltd <ard.biesheuvel@linaro.org>
*/
#include <crypto/aes.h>
#include <linux/crypto.h>
+#include <linux/export.h>
#include <linux/module.h>
#include <linux/unaligned.h>
/*
* Emit the sbox as volatile const to prevent the compiler from doing
@@ -3,16 +3,15 @@
* Minimal library implementation of AES in CFB mode
*
* Copyright 2023 Google LLC
*/
-#include <linux/module.h>
-
-#include <crypto/algapi.h>
-#include <crypto/aes.h>
-
#include <asm/irqflags.h>
+#include <crypto/aes.h>
+#include <crypto/algapi.h>
+#include <linux/export.h>
+#include <linux/module.h>
static void aescfb_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst,
const void *src)
{
unsigned long flags;
@@ -3,17 +3,16 @@
* Minimal library implementation of GCM
*
* Copyright 2022 Google LLC
*/
-#include <linux/module.h>
-
+#include <asm/irqflags.h>
#include <crypto/algapi.h>
#include <crypto/gcm.h>
#include <crypto/ghash.h>
-
-#include <asm/irqflags.h>
+#include <linux/export.h>
+#include <linux/module.h>
static void aesgcm_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst,
const void *src)
{
unsigned long flags;
@@ -6,10 +6,11 @@
*
* Jon Oberheide <jon@oberheide.org>
*/
#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)
{
int i, j = 0, k = 0;
@@ -7,15 +7,16 @@
* Information: https://blake2.net/
*
*/
#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] = {
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
@@ -7,16 +7,17 @@
* Information: https://blake2.net/
*
*/
#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)
{
state->f[0] = -1;
}
@@ -3,17 +3,18 @@
* The "hash function" used as the core of the ChaCha stream cipher (RFC7539)
*
* 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/export.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)
{
u32 *x = state->x;
int i;
@@ -5,20 +5,20 @@
* This is an implementation of the ChaCha20Poly1305 AEAD construction.
*
* 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)
{
k[0] = get_unaligned_le32(in);
k[1] = get_unaligned_le32(in + 4);
@@ -8,10 +8,11 @@
*
* Information: https://cr.yp.to/ecdh.html
*/
#include <crypto/curve25519.h>
+#include <linux/export.h>
#include <linux/module.h>
const u8 curve25519_null_point[CURVE25519_KEY_SIZE] __aligned(32) = { 0 };
const u8 curve25519_base_point[CURVE25519_KEY_SIZE] __aligned(32) = { 9 };
@@ -5,25 +5,24 @@
* DES & Triple DES EDE Cipher Algorithms.
*
* 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)))
/* Lookup tables for key expansion */
@@ -47,10 +47,11 @@
This file provides fast multiplication in GF(2^128) as required by several
cryptographic authentication modes
*/
#include <crypto/gf128mul.h>
+#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#define gf128mul_dat(q) { \
@@ -3,16 +3,15 @@
* The ChaCha stream cipher (RFC7539)
*
* 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)
{
/* aligned to potentially speed up crypto_xor() */
@@ -57,13 +57,14 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* 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
__crypto_memneq_generic(const void *a, const void *b, size_t size)
{
@@ -9,10 +9,12 @@
* way the data is stored; this is to support the abstraction
* of an optional secure memory allocation which may be used
* 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)
{
mpi_ptr_t wp, up, vp;
@@ -16,10 +16,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
+#include <linux/export.h>
+
#include "mpi-internal.h"
#include "longlong.h"
#define A_LIMB_1 ((mpi_limb_t) 1)
@@ -16,10 +16,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* 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)
{
mpi_limb_t limb = v;
@@ -9,10 +9,12 @@
* way the data is stored; this is to support the abstraction
* of an optional secure memory allocation which may be used
* 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)
{
mpi_size_t usize, vsize, wsize;
@@ -11,12 +11,14 @@
* to avoid revealing of sensitive data due to paging etc.
* The GNU MP Library itself is published under the LGPL;
* 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"
/****************
* RES = BASE ^ EXP mod MOD
@@ -30,10 +30,12 @@
* You should have received copies of the GNU General Public License and the
* GNU Lesser General Public License along with the GNU MP Library. If not,
* 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)
{
if (u->nlimbs == 0) {
@@ -17,12 +17,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#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"
#define MAX_EXTERN_MPI_BITS 16384
@@ -16,10 +16,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
+#include <linux/export.h>
+
#include "mpi-internal.h"
/****************
* Note: It was a bad idea to use the number of limbs to allocate
* because on a alpha the limbs are large but we normally need
@@ -4,13 +4,14 @@
*
* This is based in part on Andrew Moon's poly1305-donna, which is in the
* 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])
{
/* r &= 0xffffffc0ffffffc0ffffffc0fffffff */
@@ -4,13 +4,14 @@
*
* This is based in part on Andrew Moon's poly1305-donna, which is in the
* 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])
{
u64 t0, t1;
@@ -6,10 +6,11 @@
*
* Based on public domain code by Andrew Moon and Daniel J. Bernstein.
*/
#include <crypto/internal/poly1305.h>
+#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/module.h>
void poly1305_block_init_generic(struct poly1305_block_state *desc,
const u8 raw_key[POLY1305_BLOCK_SIZE])
@@ -7,10 +7,11 @@
* Based on public domain code by Andrew Moon and Daniel J. Bernstein.
*/
#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>
#include <linux/unaligned.h>
@@ -4,16 +4,16 @@
* and to avoid unnecessary copies into the context array.
*
* 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>
/*
* If you have 32 registers or more, the compiler can (and should)
* try to change the array[] accesses into registers. However, on
@@ -10,10 +10,11 @@
* Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
* Copyright (c) 2014 Red Hat Inc.
*/
#include <crypto/internal/sha2.h>
+#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/unaligned.h>
@@ -11,10 +11,11 @@
* Copyright (c) 2014 Red Hat Inc.
*/
#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>
/*
@@ -7,10 +7,11 @@
* Copyright (C) 2017 Gilad Ben-Yossef <gilad@benyossef.com>
* Copyright (C) 2021 Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
*/
#include <crypto/sm3.h>
+#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/unaligned.h>
@@ -3,13 +3,14 @@
* Crypto library utility functions
*
* 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
* (which may alias one of the sources). Don't call this directly; call
* crypto_xor() or crypto_xor_cpy() instead.