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.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index ef7642ed3e42..d6962b409489 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -528,16 +528,26 @@ static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
528 return (struct crypto_ablkcipher *)tfm; 528 return (struct crypto_ablkcipher *)tfm;
529} 529}
530 530
531static inline struct crypto_ablkcipher *crypto_alloc_ablkcipher( 531static inline u32 crypto_skcipher_type(u32 type)
532 const char *alg_name, u32 type, u32 mask)
533{ 532{
534 type &= ~CRYPTO_ALG_TYPE_MASK; 533 type &= ~CRYPTO_ALG_TYPE_MASK;
535 mask &= ~CRYPTO_ALG_TYPE_MASK;
536 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 534 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
535 return type;
536}
537
538static inline u32 crypto_skcipher_mask(u32 mask)
539{
540 mask &= ~CRYPTO_ALG_TYPE_MASK;
537 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK; 541 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
542 return mask;
543}
538 544
545static inline struct crypto_ablkcipher *crypto_alloc_ablkcipher(
546 const char *alg_name, u32 type, u32 mask)
547{
539 return __crypto_ablkcipher_cast( 548 return __crypto_ablkcipher_cast(
540 crypto_alloc_base(alg_name, type, mask)); 549 crypto_alloc_base(alg_name, crypto_skcipher_type(type),
550 crypto_skcipher_mask(mask)));
541} 551}
542 552
543static inline struct crypto_tfm *crypto_ablkcipher_tfm( 553static inline struct crypto_tfm *crypto_ablkcipher_tfm(
@@ -554,12 +564,8 @@ static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
554static inline int crypto_has_ablkcipher(const char *alg_name, u32 type, 564static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
555 u32 mask) 565 u32 mask)
556{ 566{
557 type &= ~CRYPTO_ALG_TYPE_MASK; 567 return crypto_has_alg(alg_name, crypto_skcipher_type(type),
558 mask &= ~CRYPTO_ALG_TYPE_MASK; 568 crypto_skcipher_mask(mask));
559 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
560 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
561
562 return crypto_has_alg(alg_name, type, mask);
563} 569}
564 570
565static inline struct ablkcipher_tfm *crypto_ablkcipher_crt( 571static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(