aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/crypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r--include/linux/crypto.h48
1 files changed, 36 insertions, 12 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 5a5466d518e8..0be666b50463 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -20,7 +20,6 @@
20#include <asm/atomic.h> 20#include <asm/atomic.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/types.h>
24#include <linux/list.h> 23#include <linux/list.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
26#include <linux/string.h> 25#include <linux/string.h>
@@ -137,16 +136,16 @@ struct cipher_alg {
137 136
138 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, 137 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
139 u8 *dst, const u8 *src, 138 u8 *dst, const u8 *src,
140 unsigned int nbytes); 139 unsigned int nbytes) __deprecated;
141 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, 140 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
142 u8 *dst, const u8 *src, 141 u8 *dst, const u8 *src,
143 unsigned int nbytes); 142 unsigned int nbytes) __deprecated;
144 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, 143 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
145 u8 *dst, const u8 *src, 144 u8 *dst, const u8 *src,
146 unsigned int nbytes); 145 unsigned int nbytes) __deprecated;
147 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, 146 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
148 u8 *dst, const u8 *src, 147 u8 *dst, const u8 *src,
149 unsigned int nbytes); 148 unsigned int nbytes) __deprecated;
150}; 149};
151 150
152struct digest_alg { 151struct digest_alg {
@@ -358,18 +357,23 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
358 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; 357 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
359} 358}
360 359
360static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
361 __deprecated;
361static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) 362static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
362{ 363{
363 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 364 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
364 return tfm->__crt_alg->cra_cipher.cia_min_keysize; 365 return tfm->__crt_alg->cra_cipher.cia_min_keysize;
365} 366}
366 367
368static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
369 __deprecated;
367static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) 370static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
368{ 371{
369 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 372 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
370 return tfm->__crt_alg->cra_cipher.cia_max_keysize; 373 return tfm->__crt_alg->cra_cipher.cia_max_keysize;
371} 374}
372 375
376static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated;
373static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) 377static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm)
374{ 378{
375 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 379 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
@@ -622,6 +626,13 @@ static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm,
622 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags); 626 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags);
623} 627}
624 628
629static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
630 const u8 *key, unsigned int keylen)
631{
632 return crypto_cipher_crt(tfm)->cit_setkey(crypto_cipher_tfm(tfm),
633 key, keylen);
634}
635
625static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm, 636static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
626 u8 *dst, const u8 *src) 637 u8 *dst, const u8 *src)
627{ 638{
@@ -671,13 +682,10 @@ static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
671 return tfm->crt_digest.dit_setkey(tfm, key, keylen); 682 return tfm->crt_digest.dit_setkey(tfm, key, keylen);
672} 683}
673 684
674static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, 685static int crypto_cipher_encrypt(struct crypto_tfm *tfm,
675 const u8 *key, unsigned int keylen) 686 struct scatterlist *dst,
676{ 687 struct scatterlist *src,
677 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 688 unsigned int nbytes) __deprecated;
678 return tfm->crt_cipher.cit_setkey(tfm, key, keylen);
679}
680
681static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, 689static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
682 struct scatterlist *dst, 690 struct scatterlist *dst,
683 struct scatterlist *src, 691 struct scatterlist *src,
@@ -687,6 +695,10 @@ static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
687 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); 695 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
688} 696}
689 697
698static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
699 struct scatterlist *dst,
700 struct scatterlist *src,
701 unsigned int nbytes, u8 *iv) __deprecated;
690static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, 702static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
691 struct scatterlist *dst, 703 struct scatterlist *dst,
692 struct scatterlist *src, 704 struct scatterlist *src,
@@ -696,6 +708,10 @@ static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
696 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); 708 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
697} 709}
698 710
711static int crypto_cipher_decrypt(struct crypto_tfm *tfm,
712 struct scatterlist *dst,
713 struct scatterlist *src,
714 unsigned int nbytes) __deprecated;
699static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, 715static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
700 struct scatterlist *dst, 716 struct scatterlist *dst,
701 struct scatterlist *src, 717 struct scatterlist *src,
@@ -705,6 +721,10 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
705 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); 721 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
706} 722}
707 723
724static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
725 struct scatterlist *dst,
726 struct scatterlist *src,
727 unsigned int nbytes, u8 *iv) __deprecated;
708static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, 728static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
709 struct scatterlist *dst, 729 struct scatterlist *dst,
710 struct scatterlist *src, 730 struct scatterlist *src,
@@ -714,6 +734,8 @@ static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
714 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); 734 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
715} 735}
716 736
737static void crypto_cipher_set_iv(struct crypto_tfm *tfm,
738 const u8 *src, unsigned int len) __deprecated;
717static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, 739static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
718 const u8 *src, unsigned int len) 740 const u8 *src, unsigned int len)
719{ 741{
@@ -721,6 +743,8 @@ static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
721 memcpy(tfm->crt_cipher.cit_iv, src, len); 743 memcpy(tfm->crt_cipher.cit_iv, src, len);
722} 744}
723 745
746static void crypto_cipher_get_iv(struct crypto_tfm *tfm,
747 u8 *dst, unsigned int len) __deprecated;
724static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, 748static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
725 u8 *dst, unsigned int len) 749 u8 *dst, unsigned int len)
726{ 750{