path: root/crypto/cipher.c
diff options
authorArd Biesheuvel <>2020-12-11 13:27:15 +0100
committerHerbert Xu <>2021-01-03 08:41:35 +1100
commit0eb76ba29d16df2951d37c54ca279c4e5630b071 (patch)
tree4e698726c2e03b2203e98ac45b714af4ef5533ce /crypto/cipher.c
parenta3b01ffddc210a836eda8aa751cfa911a2817a85 (diff)
crypto: remove cipher routines from public crypto API
The cipher routines in the crypto API are mostly intended for templates implementing skcipher modes generically in software, and shouldn't be used outside of the crypto subsystem. So move the prototypes and all related definitions to a new header file under include/crypto/internal. Also, let's use the new module namespace feature to move the symbol exports into a new namespace CRYPTO_INTERNAL. Signed-off-by: Ard Biesheuvel <> Acked-by: Eric Biggers <> Signed-off-by: Herbert Xu <>
Diffstat (limited to 'crypto/cipher.c')
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c
index fd78150deb1c..b47141ed4a9f 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -9,6 +9,7 @@
#include <crypto/algapi.h>
+#include <crypto/internal/cipher.h>
#include <linux/kernel.h>
#include <linux/crypto.h>
#include <linux/errno.h>
@@ -53,7 +54,7 @@ int crypto_cipher_setkey(struct crypto_cipher *tfm,
return cia->cia_setkey(crypto_cipher_tfm(tfm), key, keylen);
static inline void cipher_crypt_one(struct crypto_cipher *tfm,
u8 *dst, const u8 *src, bool enc)
@@ -81,11 +82,11 @@ void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
cipher_crypt_one(tfm, dst, src, true);
+EXPORT_SYMBOL_NS_GPL(crypto_cipher_encrypt_one, CRYPTO_INTERNAL);
void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
u8 *dst, const u8 *src)
cipher_crypt_one(tfm, dst, src, false);
+EXPORT_SYMBOL_NS_GPL(crypto_cipher_decrypt_one, CRYPTO_INTERNAL);