aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/crypto.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-12-23 18:02:00 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2007-02-06 17:21:02 -0500
commit78a1fe4f242cbe6b4578e072b75e171b92745afa (patch)
tree846b74e476273f21e89d6e22a794ed49a3d5d572 /include/linux/crypto.h
parent6b701dde8e0584f3bf0b6857d0e92f7ed15ed6f9 (diff)
[CRYPTO] api: Use structs for cipher/compression
Now that all cipher/compression users have switched over to the new allocation scheme, we can get rid of the compatility defines and use proper structs for them. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r--include/linux/crypto.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 95936a5e7c12..779aa78ee643 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -311,13 +311,18 @@ struct crypto_tfm {
311 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; 311 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
312}; 312};
313 313
314#define crypto_cipher crypto_tfm
315#define crypto_comp crypto_tfm
316
317struct crypto_blkcipher { 314struct crypto_blkcipher {
318 struct crypto_tfm base; 315 struct crypto_tfm base;
319}; 316};
320 317
318struct crypto_cipher {
319 struct crypto_tfm base;
320};
321
322struct crypto_comp {
323 struct crypto_tfm base;
324};
325
321struct crypto_hash { 326struct crypto_hash {
322 struct crypto_tfm base; 327 struct crypto_tfm base;
323}; 328};
@@ -576,7 +581,7 @@ static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
576 581
577static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm) 582static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
578{ 583{
579 return tfm; 584 return &tfm->base;
580} 585}
581 586
582static inline void crypto_free_cipher(struct crypto_cipher *tfm) 587static inline void crypto_free_cipher(struct crypto_cipher *tfm)
@@ -776,7 +781,7 @@ static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,
776 781
777static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm) 782static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
778{ 783{
779 return tfm; 784 return &tfm->base;
780} 785}
781 786
782static inline void crypto_free_comp(struct crypto_comp *tfm) 787static inline void crypto_free_comp(struct crypto_comp *tfm)
@@ -807,14 +812,16 @@ static inline int crypto_comp_compress(struct crypto_comp *tfm,
807 const u8 *src, unsigned int slen, 812 const u8 *src, unsigned int slen,
808 u8 *dst, unsigned int *dlen) 813 u8 *dst, unsigned int *dlen)
809{ 814{
810 return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen); 815 return crypto_comp_crt(tfm)->cot_compress(crypto_comp_tfm(tfm),
816 src, slen, dst, dlen);
811} 817}
812 818
813static inline int crypto_comp_decompress(struct crypto_comp *tfm, 819static inline int crypto_comp_decompress(struct crypto_comp *tfm,
814 const u8 *src, unsigned int slen, 820 const u8 *src, unsigned int slen,
815 u8 *dst, unsigned int *dlen) 821 u8 *dst, unsigned int *dlen)
816{ 822{
817 return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen); 823 return crypto_comp_crt(tfm)->cot_decompress(crypto_comp_tfm(tfm),
824 src, slen, dst, dlen);
818} 825}
819 826
820#endif /* _LINUX_CRYPTO_H */ 827#endif /* _LINUX_CRYPTO_H */