diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2024-04-29 22:27:58 +0200 |
---|---|---|
committer | Jarkko Sakkinen <jarkko@kernel.org> | 2024-05-09 21:30:51 +0200 |
commit | f135440447af5156de91272ee52ccedcf0796e94 (patch) | |
tree | 019ed7cf4620c93b2963cdbe5b982ac3039e6576 /include/crypto/aes.h | |
parent | KEYS: trusted: tpm2: Use struct tpm_buf for sized buffers (diff) | |
download | linux-f135440447af5156de91272ee52ccedcf0796e94.tar.xz linux-f135440447af5156de91272ee52ccedcf0796e94.zip |
crypto: lib - implement library version of AES in CFB mode
Implement AES in CFB mode using the existing, mostly constant-time
generic AES library implementation. This will be used by the TPM code
to encrypt communications with TPM hardware, which is often a discrete
component connected using sniffable wires or traces.
While a CFB template does exist, using a skcipher is a major pain for
non-performance critical synchronous crypto where the algorithm is known
at compile time and the data is in contiguous buffers with valid kernel
virtual addresses.
Tested-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/all/20230216201410.15010-1-James.Bottomley@HansenPartnership.com/
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'include/crypto/aes.h')
-rw-r--r-- | include/crypto/aes.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/crypto/aes.h b/include/crypto/aes.h index 2090729701ab..9339da7c20a8 100644 --- a/include/crypto/aes.h +++ b/include/crypto/aes.h @@ -87,4 +87,9 @@ void aes_decrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); extern const u8 crypto_aes_sbox[]; extern const u8 crypto_aes_inv_sbox[]; +void aescfb_encrypt(const struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src, + int len, const u8 iv[AES_BLOCK_SIZE]); +void aescfb_decrypt(const struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src, + int len, const u8 iv[AES_BLOCK_SIZE]); + #endif |