aes.h (c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2) aes.h (e59c1c98745637796df824c0177f279b6e9cad94)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Common values for AES algorithms
4 */
5
6#ifndef _CRYPTO_AES_H
7#define _CRYPTO_AES_H
8

--- 23 unchanged lines hidden (view full) ---

32extern const u32 crypto_fl_tab[4][256] ____cacheline_aligned;
33extern const u32 crypto_it_tab[4][256] ____cacheline_aligned;
34extern const u32 crypto_il_tab[4][256] ____cacheline_aligned;
35
36int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
37 unsigned int key_len);
38int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key,
39 unsigned int key_len);
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Common values for AES algorithms
4 */
5
6#ifndef _CRYPTO_AES_H
7#define _CRYPTO_AES_H
8

--- 23 unchanged lines hidden (view full) ---

32extern const u32 crypto_fl_tab[4][256] ____cacheline_aligned;
33extern const u32 crypto_it_tab[4][256] ____cacheline_aligned;
34extern const u32 crypto_il_tab[4][256] ____cacheline_aligned;
35
36int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
37 unsigned int key_len);
38int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key,
39 unsigned int key_len);
40
41/**
42 * aes_expandkey - Expands the AES key as described in FIPS-197
43 * @ctx: The location where the computed key will be stored.
44 * @in_key: The supplied key.
45 * @key_len: The length of the supplied key.
46 *
47 * Returns 0 on success. The function fails only if an invalid key size (or
48 * pointer) is supplied.
49 * The expanded key size is 240 bytes (max of 14 rounds with a unique 16 bytes
50 * key schedule plus a 16 bytes key which is used before the first round).
51 * The decryption key is prepared for the "Equivalent Inverse Cipher" as
52 * described in FIPS-197. The first slot (16 bytes) of each key (enc or dec) is
53 * for the initial combination, the second slot for the first round and so on.
54 */
55int aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key,
56 unsigned int key_len);
57
58/**
59 * aes_encrypt - Encrypt a single AES block
60 * @ctx: Context struct containing the key schedule
61 * @out: Buffer to store the ciphertext
62 * @in: Buffer containing the plaintext
63 */
64void aes_encrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
65
66/**
67 * aes_decrypt - Decrypt a single AES block
68 * @ctx: Context struct containing the key schedule
69 * @out: Buffer to store the plaintext
70 * @in: Buffer containing the ciphertext
71 */
72void aes_decrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
73
40#endif
74#endif