linux/lib/crypto/aes.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2017-2019 Linaro Ltd <[email protected]>
 */

#include <crypto/aes.h>
#include <linux/crypto.h>
#include <linux/module.h>
#include <asm/unaligned.h>

/*
 * Emit the sbox as volatile const to prevent the compiler from doing
 * constant folding on sbox references involving fixed indexes.
 */
static volatile const u8 __cacheline_aligned aes_sbox[] =;

static volatile const u8 __cacheline_aligned aes_inv_sbox[] =;

extern const u8 crypto_aes_sbox[256] __alias();
extern const u8 crypto_aes_inv_sbox[256] __alias();

EXPORT_SYMBOL();
EXPORT_SYMBOL();

static u32 mul_by_x(u32 w)
{}

static u32 mul_by_x2(u32 w)
{}

static u32 mix_columns(u32 x)
{}

static u32 inv_mix_columns(u32 x)
{}

static __always_inline u32 subshift(u32 in[], int pos)
{}

static __always_inline u32 inv_subshift(u32 in[], int pos)
{}

static u32 subw(u32 in)
{}

/**
 * aes_expandkey - Expands the AES key as described in FIPS-197
 * @ctx:	The location where the computed key will be stored.
 * @in_key:	The supplied key.
 * @key_len:	The length of the supplied key.
 *
 * Returns 0 on success. The function fails only if an invalid key size (or
 * pointer) is supplied.
 * The expanded key size is 240 bytes (max of 14 rounds with a unique 16 bytes
 * key schedule plus a 16 bytes key which is used before the first round).
 * The decryption key is prepared for the "Equivalent Inverse Cipher" as
 * described in FIPS-197. The first slot (16 bytes) of each key (enc or dec) is
 * for the initial combination, the second slot for the first round and so on.
 */
int aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key,
		  unsigned int key_len)
{}
EXPORT_SYMBOL();

/**
 * aes_encrypt - Encrypt a single AES block
 * @ctx:	Context struct containing the key schedule
 * @out:	Buffer to store the ciphertext
 * @in:		Buffer containing the plaintext
 */
void aes_encrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in)
{}
EXPORT_SYMBOL();

/**
 * aes_decrypt - Decrypt a single AES block
 * @ctx:	Context struct containing the key schedule
 * @out:	Buffer to store the plaintext
 * @in:		Buffer containing the ciphertext
 */
void aes_decrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in)
{}
EXPORT_SYMBOL();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();