mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
crypto: aes - Replace aes-generic with wrapper around lib
Now that the AES library's performance has been improved, replace aes_generic.c with a new file aes.c which wraps the AES library. In preparation for making the AES library actually utilize the kernel's existing architecture-optimized AES code including AES instructions, set the driver name to "aes-lib" instead of "aes-generic". This mirrors what's been done for the hash algorithms. Update testmgr.c accordingly. Since this removes the crypto_aes_set_key() helper function, add temporary replacements for it to arch/arm/crypto/aes-cipher-glue.c and arch/arm64/crypto/aes-cipher-glue.c. This is temporary, as that code will be migrated into lib/crypto/ in later commits. Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20260112192035.10427-10-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
This commit is contained in:
parent
641e70563a
commit
a248447427
9 changed files with 117 additions and 1353 deletions
|
|
@ -14,6 +14,14 @@
|
||||||
EXPORT_SYMBOL_GPL(__aes_arm_encrypt);
|
EXPORT_SYMBOL_GPL(__aes_arm_encrypt);
|
||||||
EXPORT_SYMBOL_GPL(__aes_arm_decrypt);
|
EXPORT_SYMBOL_GPL(__aes_arm_decrypt);
|
||||||
|
|
||||||
|
static int aes_arm_setkey(struct crypto_tfm *tfm, const u8 *in_key,
|
||||||
|
unsigned int key_len)
|
||||||
|
{
|
||||||
|
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
|
return aes_expandkey(ctx, in_key, key_len);
|
||||||
|
}
|
||||||
|
|
||||||
static void aes_arm_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
static void aes_arm_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||||
{
|
{
|
||||||
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
@ -41,7 +49,7 @@ static struct crypto_alg aes_alg = {
|
||||||
|
|
||||||
.cra_cipher.cia_min_keysize = AES_MIN_KEY_SIZE,
|
.cra_cipher.cia_min_keysize = AES_MIN_KEY_SIZE,
|
||||||
.cra_cipher.cia_max_keysize = AES_MAX_KEY_SIZE,
|
.cra_cipher.cia_max_keysize = AES_MAX_KEY_SIZE,
|
||||||
.cra_cipher.cia_setkey = crypto_aes_set_key,
|
.cra_cipher.cia_setkey = aes_arm_setkey,
|
||||||
.cra_cipher.cia_encrypt = aes_arm_encrypt,
|
.cra_cipher.cia_encrypt = aes_arm_encrypt,
|
||||||
.cra_cipher.cia_decrypt = aes_arm_decrypt,
|
.cra_cipher.cia_decrypt = aes_arm_decrypt,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,14 @@
|
||||||
asmlinkage void __aes_arm64_encrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
|
asmlinkage void __aes_arm64_encrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
|
||||||
asmlinkage void __aes_arm64_decrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
|
asmlinkage void __aes_arm64_decrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
|
||||||
|
|
||||||
|
static int aes_arm64_setkey(struct crypto_tfm *tfm, const u8 *in_key,
|
||||||
|
unsigned int key_len)
|
||||||
|
{
|
||||||
|
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
|
return aes_expandkey(ctx, in_key, key_len);
|
||||||
|
}
|
||||||
|
|
||||||
static void aes_arm64_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
static void aes_arm64_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||||
{
|
{
|
||||||
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
@ -39,7 +47,7 @@ static struct crypto_alg aes_alg = {
|
||||||
|
|
||||||
.cra_cipher.cia_min_keysize = AES_MIN_KEY_SIZE,
|
.cra_cipher.cia_min_keysize = AES_MIN_KEY_SIZE,
|
||||||
.cra_cipher.cia_max_keysize = AES_MAX_KEY_SIZE,
|
.cra_cipher.cia_max_keysize = AES_MAX_KEY_SIZE,
|
||||||
.cra_cipher.cia_setkey = crypto_aes_set_key,
|
.cra_cipher.cia_setkey = aes_arm64_setkey,
|
||||||
.cra_cipher.cia_encrypt = aes_arm64_encrypt,
|
.cra_cipher.cia_encrypt = aes_arm64_encrypt,
|
||||||
.cra_cipher.cia_decrypt = aes_arm64_decrypt
|
.cra_cipher.cia_decrypt = aes_arm64_decrypt
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
|
||||||
obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
|
obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
|
||||||
obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
|
obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
|
||||||
CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
|
CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
|
||||||
obj-$(CONFIG_CRYPTO_AES) += aes_generic.o
|
obj-$(CONFIG_CRYPTO_AES) += aes.o
|
||||||
CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356
|
|
||||||
obj-$(CONFIG_CRYPTO_SM4) += sm4.o
|
obj-$(CONFIG_CRYPTO_SM4) += sm4.o
|
||||||
obj-$(CONFIG_CRYPTO_SM4_GENERIC) += sm4_generic.o
|
obj-$(CONFIG_CRYPTO_SM4_GENERIC) += sm4_generic.o
|
||||||
obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
|
obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
|
||||||
|
|
|
||||||
66
crypto/aes.c
Normal file
66
crypto/aes.c
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
/*
|
||||||
|
* Crypto API support for AES block cipher
|
||||||
|
*
|
||||||
|
* Copyright 2026 Google LLC
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <crypto/aes.h>
|
||||||
|
#include <crypto/algapi.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
|
||||||
|
static_assert(__alignof__(struct aes_key) <= CRYPTO_MINALIGN);
|
||||||
|
|
||||||
|
static int crypto_aes_setkey(struct crypto_tfm *tfm, const u8 *in_key,
|
||||||
|
unsigned int key_len)
|
||||||
|
{
|
||||||
|
struct aes_key *key = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
|
return aes_preparekey(key, in_key, key_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void crypto_aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||||
|
{
|
||||||
|
const struct aes_key *key = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
|
aes_encrypt(key, out, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void crypto_aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||||
|
{
|
||||||
|
const struct aes_key *key = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
|
aes_decrypt(key, out, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct crypto_alg alg = {
|
||||||
|
.cra_name = "aes",
|
||||||
|
.cra_driver_name = "aes-lib",
|
||||||
|
.cra_priority = 100,
|
||||||
|
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
|
||||||
|
.cra_blocksize = AES_BLOCK_SIZE,
|
||||||
|
.cra_ctxsize = sizeof(struct aes_key),
|
||||||
|
.cra_module = THIS_MODULE,
|
||||||
|
.cra_u = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE,
|
||||||
|
.cia_max_keysize = AES_MAX_KEY_SIZE,
|
||||||
|
.cia_setkey = crypto_aes_setkey,
|
||||||
|
.cia_encrypt = crypto_aes_encrypt,
|
||||||
|
.cia_decrypt = crypto_aes_decrypt } }
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init crypto_aes_mod_init(void)
|
||||||
|
{
|
||||||
|
return crypto_register_alg(&alg);
|
||||||
|
}
|
||||||
|
module_init(crypto_aes_mod_init);
|
||||||
|
|
||||||
|
static void __exit crypto_aes_mod_exit(void)
|
||||||
|
{
|
||||||
|
crypto_unregister_alg(&alg);
|
||||||
|
}
|
||||||
|
module_exit(crypto_aes_mod_exit);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("Crypto API support for AES block cipher");
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_ALIAS_CRYPTO("aes");
|
||||||
|
MODULE_ALIAS_CRYPTO("aes-lib");
|
||||||
1320
crypto/aes_generic.c
1320
crypto/aes_generic.c
File diff suppressed because it is too large
Load diff
|
|
@ -293,7 +293,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||||
if (!alg)
|
if (!alg)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
/* We can not unregister core algorithms such as aes-generic.
|
/* We can not unregister core algorithms such as aes.
|
||||||
* We would loose the reference in the crypto_alg_list to this algorithm
|
* We would loose the reference in the crypto_alg_list to this algorithm
|
||||||
* if we try to unregister. Unregistering such an algorithm without
|
* if we try to unregister. Unregistering such an algorithm without
|
||||||
* removing the module is not possible, so we restrict to crypto
|
* removing the module is not possible, so we restrict to crypto
|
||||||
|
|
|
||||||
|
|
@ -4061,14 +4061,14 @@ static int alg_test_null(const struct alg_test_desc *desc,
|
||||||
static const struct alg_test_desc alg_test_descs[] = {
|
static const struct alg_test_desc alg_test_descs[] = {
|
||||||
{
|
{
|
||||||
.alg = "adiantum(xchacha12,aes)",
|
.alg = "adiantum(xchacha12,aes)",
|
||||||
.generic_driver = "adiantum(xchacha12-lib,aes-generic)",
|
.generic_driver = "adiantum(xchacha12-lib,aes-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.suite = {
|
.suite = {
|
||||||
.cipher = __VECS(adiantum_xchacha12_aes_tv_template)
|
.cipher = __VECS(adiantum_xchacha12_aes_tv_template)
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
.alg = "adiantum(xchacha20,aes)",
|
.alg = "adiantum(xchacha20,aes)",
|
||||||
.generic_driver = "adiantum(xchacha20-lib,aes-generic)",
|
.generic_driver = "adiantum(xchacha20-lib,aes-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.suite = {
|
.suite = {
|
||||||
.cipher = __VECS(adiantum_xchacha20_aes_tv_template)
|
.cipher = __VECS(adiantum_xchacha20_aes_tv_template)
|
||||||
|
|
@ -4088,7 +4088,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "authenc(hmac(sha1),cbc(aes))",
|
.alg = "authenc(hmac(sha1),cbc(aes))",
|
||||||
.generic_driver = "authenc(hmac-sha1-lib,cbc(aes-generic))",
|
.generic_driver = "authenc(hmac-sha1-lib,cbc(aes-lib))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4139,7 +4139,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "authenc(hmac(sha256),cbc(aes))",
|
.alg = "authenc(hmac(sha256),cbc(aes))",
|
||||||
.generic_driver = "authenc(hmac-sha256-lib,cbc(aes-generic))",
|
.generic_driver = "authenc(hmac-sha256-lib,cbc(aes-lib))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4165,7 +4165,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
}, {
|
}, {
|
||||||
.alg = "authenc(hmac(sha256),cts(cbc(aes)))",
|
.alg = "authenc(hmac(sha256),cts(cbc(aes)))",
|
||||||
.generic_driver = "authenc(hmac-sha256-lib,cts(cbc(aes-generic)))",
|
.generic_driver = "authenc(hmac-sha256-lib,cts(cbc(aes-lib)))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.suite = {
|
.suite = {
|
||||||
.aead = __VECS(krb5_test_aes128_cts_hmac_sha256_128)
|
.aead = __VECS(krb5_test_aes128_cts_hmac_sha256_128)
|
||||||
|
|
@ -4194,7 +4194,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
}, {
|
}, {
|
||||||
.alg = "authenc(hmac(sha384),cts(cbc(aes)))",
|
.alg = "authenc(hmac(sha384),cts(cbc(aes)))",
|
||||||
.generic_driver = "authenc(hmac-sha384-lib,cts(cbc(aes-generic)))",
|
.generic_driver = "authenc(hmac-sha384-lib,cts(cbc(aes-lib)))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.suite = {
|
.suite = {
|
||||||
.aead = __VECS(krb5_test_aes256_cts_hmac_sha384_192)
|
.aead = __VECS(krb5_test_aes256_cts_hmac_sha384_192)
|
||||||
|
|
@ -4205,7 +4205,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
}, {
|
}, {
|
||||||
.alg = "authenc(hmac(sha512),cbc(aes))",
|
.alg = "authenc(hmac(sha512),cbc(aes))",
|
||||||
.generic_driver = "authenc(hmac-sha512-lib,cbc(aes-generic))",
|
.generic_driver = "authenc(hmac-sha512-lib,cbc(aes-lib))",
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4267,6 +4267,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "cbc(aes)",
|
.alg = "cbc(aes)",
|
||||||
|
.generic_driver = "cbc(aes-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4362,6 +4363,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}, {
|
}, {
|
||||||
#endif
|
#endif
|
||||||
.alg = "cbcmac(aes)",
|
.alg = "cbcmac(aes)",
|
||||||
|
.generic_driver = "cbcmac(aes-lib)",
|
||||||
.test = alg_test_hash,
|
.test = alg_test_hash,
|
||||||
.suite = {
|
.suite = {
|
||||||
.hash = __VECS(aes_cbcmac_tv_template)
|
.hash = __VECS(aes_cbcmac_tv_template)
|
||||||
|
|
@ -4374,7 +4376,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "ccm(aes)",
|
.alg = "ccm(aes)",
|
||||||
.generic_driver = "ccm_base(ctr(aes-generic),cbcmac(aes-generic))",
|
.generic_driver = "ccm_base(ctr(aes-lib),cbcmac(aes-lib))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4402,6 +4404,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
.alg = "cmac(aes)",
|
.alg = "cmac(aes)",
|
||||||
|
.generic_driver = "cmac(aes-lib)",
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.test = alg_test_hash,
|
.test = alg_test_hash,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4443,6 +4446,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "ctr(aes)",
|
.alg = "ctr(aes)",
|
||||||
|
.generic_driver = "ctr(aes-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4533,6 +4537,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}, {
|
}, {
|
||||||
#endif
|
#endif
|
||||||
.alg = "cts(cbc(aes))",
|
.alg = "cts(cbc(aes))",
|
||||||
|
.generic_driver = "cts(cbc(aes-lib))",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4689,6 +4694,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
.test = alg_test_null,
|
.test = alg_test_null,
|
||||||
}, {
|
}, {
|
||||||
.alg = "ecb(aes)",
|
.alg = "ecb(aes)",
|
||||||
|
.generic_driver = "ecb(aes-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4881,7 +4887,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "essiv(authenc(hmac(sha256),cbc(aes)),sha256)",
|
.alg = "essiv(authenc(hmac(sha256),cbc(aes)),sha256)",
|
||||||
.generic_driver = "essiv(authenc(hmac-sha256-lib,cbc(aes-generic)),sha256-lib)",
|
.generic_driver = "essiv(authenc(hmac-sha256-lib,cbc(aes-lib)),sha256-lib)",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4889,7 +4895,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "essiv(cbc(aes),sha256)",
|
.alg = "essiv(cbc(aes),sha256)",
|
||||||
.generic_driver = "essiv(cbc(aes-generic),sha256-lib)",
|
.generic_driver = "essiv(cbc(aes-lib),sha256-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4934,7 +4940,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}, {
|
}, {
|
||||||
#endif /* CONFIG_CRYPTO_DH_RFC7919_GROUPS */
|
#endif /* CONFIG_CRYPTO_DH_RFC7919_GROUPS */
|
||||||
.alg = "gcm(aes)",
|
.alg = "gcm(aes)",
|
||||||
.generic_driver = "gcm_base(ctr(aes-generic),ghash-generic)",
|
.generic_driver = "gcm_base(ctr(aes-lib),ghash-generic)",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -4962,7 +4968,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "hctr2(aes)",
|
.alg = "hctr2(aes)",
|
||||||
.generic_driver = "hctr2_base(xctr(aes-generic),polyval-lib)",
|
.generic_driver = "hctr2_base(xctr(aes-lib),polyval-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.suite = {
|
.suite = {
|
||||||
.cipher = __VECS(aes_hctr2_tv_template)
|
.cipher = __VECS(aes_hctr2_tv_template)
|
||||||
|
|
@ -5080,7 +5086,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
.suite.aead = __VECS(krb5_test_camellia_cts_cmac)
|
.suite.aead = __VECS(krb5_test_camellia_cts_cmac)
|
||||||
}, {
|
}, {
|
||||||
.alg = "lrw(aes)",
|
.alg = "lrw(aes)",
|
||||||
.generic_driver = "lrw(ecb(aes-generic))",
|
.generic_driver = "lrw(ecb(aes-lib))",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.suite = {
|
.suite = {
|
||||||
.cipher = __VECS(aes_lrw_tv_template)
|
.cipher = __VECS(aes_lrw_tv_template)
|
||||||
|
|
@ -5269,6 +5275,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
}, {
|
}, {
|
||||||
.alg = "rfc3686(ctr(aes))",
|
.alg = "rfc3686(ctr(aes))",
|
||||||
|
.generic_driver = "rfc3686(ctr(aes-lib))",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -5282,7 +5289,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "rfc4106(gcm(aes))",
|
.alg = "rfc4106(gcm(aes))",
|
||||||
.generic_driver = "rfc4106(gcm_base(ctr(aes-generic),ghash-generic))",
|
.generic_driver = "rfc4106(gcm_base(ctr(aes-lib),ghash-generic))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -5294,7 +5301,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "rfc4309(ccm(aes))",
|
.alg = "rfc4309(ccm(aes))",
|
||||||
.generic_driver = "rfc4309(ccm_base(ctr(aes-generic),cbcmac(aes-generic)))",
|
.generic_driver = "rfc4309(ccm_base(ctr(aes-lib),cbcmac(aes-lib)))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
@ -5306,7 +5313,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "rfc4543(gcm(aes))",
|
.alg = "rfc4543(gcm(aes))",
|
||||||
.generic_driver = "rfc4543(gcm_base(ctr(aes-generic),ghash-generic))",
|
.generic_driver = "rfc4543(gcm_base(ctr(aes-lib),ghash-generic))",
|
||||||
.test = alg_test_aead,
|
.test = alg_test_aead,
|
||||||
.suite = {
|
.suite = {
|
||||||
.aead = {
|
.aead = {
|
||||||
|
|
@ -5483,6 +5490,7 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "xcbc(aes)",
|
.alg = "xcbc(aes)",
|
||||||
|
.generic_driver = "xcbc(aes-lib)",
|
||||||
.test = alg_test_hash,
|
.test = alg_test_hash,
|
||||||
.suite = {
|
.suite = {
|
||||||
.hash = __VECS(aes_xcbc128_tv_template)
|
.hash = __VECS(aes_xcbc128_tv_template)
|
||||||
|
|
@ -5509,13 +5517,14 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
.alg = "xctr(aes)",
|
.alg = "xctr(aes)",
|
||||||
|
.generic_driver = "xctr(aes-lib)",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.suite = {
|
.suite = {
|
||||||
.cipher = __VECS(aes_xctr_tv_template)
|
.cipher = __VECS(aes_xctr_tv_template)
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
.alg = "xts(aes)",
|
.alg = "xts(aes)",
|
||||||
.generic_driver = "xts(ecb(aes-generic))",
|
.generic_driver = "xts(ecb(aes-lib))",
|
||||||
.test = alg_test_skcipher,
|
.test = alg_test_skcipher,
|
||||||
.fips_allowed = 1,
|
.fips_allowed = 1,
|
||||||
.suite = {
|
.suite = {
|
||||||
|
|
|
||||||
|
|
@ -983,27 +983,27 @@ static int starfive_aes_ccm_decrypt(struct aead_request *req)
|
||||||
|
|
||||||
static int starfive_aes_ecb_init_tfm(struct crypto_skcipher *tfm)
|
static int starfive_aes_ecb_init_tfm(struct crypto_skcipher *tfm)
|
||||||
{
|
{
|
||||||
return starfive_aes_init_tfm(tfm, "ecb(aes-generic)");
|
return starfive_aes_init_tfm(tfm, "ecb(aes-lib)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int starfive_aes_cbc_init_tfm(struct crypto_skcipher *tfm)
|
static int starfive_aes_cbc_init_tfm(struct crypto_skcipher *tfm)
|
||||||
{
|
{
|
||||||
return starfive_aes_init_tfm(tfm, "cbc(aes-generic)");
|
return starfive_aes_init_tfm(tfm, "cbc(aes-lib)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int starfive_aes_ctr_init_tfm(struct crypto_skcipher *tfm)
|
static int starfive_aes_ctr_init_tfm(struct crypto_skcipher *tfm)
|
||||||
{
|
{
|
||||||
return starfive_aes_init_tfm(tfm, "ctr(aes-generic)");
|
return starfive_aes_init_tfm(tfm, "ctr(aes-lib)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int starfive_aes_ccm_init_tfm(struct crypto_aead *tfm)
|
static int starfive_aes_ccm_init_tfm(struct crypto_aead *tfm)
|
||||||
{
|
{
|
||||||
return starfive_aes_aead_init_tfm(tfm, "ccm_base(ctr(aes-generic),cbcmac(aes-generic))");
|
return starfive_aes_aead_init_tfm(tfm, "ccm_base(ctr(aes-lib),cbcmac(aes-lib))");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int starfive_aes_gcm_init_tfm(struct crypto_aead *tfm)
|
static int starfive_aes_gcm_init_tfm(struct crypto_aead *tfm)
|
||||||
{
|
{
|
||||||
return starfive_aes_aead_init_tfm(tfm, "gcm_base(ctr(aes-generic),ghash-generic)");
|
return starfive_aes_aead_init_tfm(tfm, "gcm_base(ctr(aes-lib),ghash-generic)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct skcipher_engine_alg skcipher_algs[] = {
|
static struct skcipher_engine_alg skcipher_algs[] = {
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,6 @@ struct crypto_aes_ctx {
|
||||||
u32 key_length;
|
u32 key_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const u32 crypto_ft_tab[4][256] ____cacheline_aligned;
|
|
||||||
extern const u32 crypto_it_tab[4][256] ____cacheline_aligned;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* validate key length for AES algorithms
|
* validate key length for AES algorithms
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,9 +99,6 @@ static inline int aes_check_keylen(size_t keylen)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
|
|
||||||
unsigned int key_len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aes_expandkey - Expands the AES key as described in FIPS-197
|
* aes_expandkey - Expands the AES key as described in FIPS-197
|
||||||
* @ctx: The location where the computed key will be stored.
|
* @ctx: The location where the computed key will be stored.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue