mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-13 16:40:22 +00:00
[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>
This commit is contained in:
parent
6b701dde8e
commit
78a1fe4f24
@ -311,13 +311,18 @@ struct crypto_tfm {
|
|||||||
void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
|
void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define crypto_cipher crypto_tfm
|
|
||||||
#define crypto_comp crypto_tfm
|
|
||||||
|
|
||||||
struct crypto_blkcipher {
|
struct crypto_blkcipher {
|
||||||
struct crypto_tfm base;
|
struct crypto_tfm base;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct crypto_cipher {
|
||||||
|
struct crypto_tfm base;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct crypto_comp {
|
||||||
|
struct crypto_tfm base;
|
||||||
|
};
|
||||||
|
|
||||||
struct crypto_hash {
|
struct crypto_hash {
|
||||||
struct crypto_tfm base;
|
struct crypto_tfm base;
|
||||||
};
|
};
|
||||||
@ -576,7 +581,7 @@ static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
|
|||||||
|
|
||||||
static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
|
static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
|
||||||
{
|
{
|
||||||
return tfm;
|
return &tfm->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void crypto_free_cipher(struct crypto_cipher *tfm)
|
static 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,
|
|||||||
|
|
||||||
static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
|
static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
|
||||||
{
|
{
|
||||||
return tfm;
|
return &tfm->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void crypto_free_comp(struct crypto_comp *tfm)
|
static inline void crypto_free_comp(struct crypto_comp *tfm)
|
||||||
@ -807,14 +812,16 @@ static inline int crypto_comp_compress(struct crypto_comp *tfm,
|
|||||||
const u8 *src, unsigned int slen,
|
const u8 *src, unsigned int slen,
|
||||||
u8 *dst, unsigned int *dlen)
|
u8 *dst, unsigned int *dlen)
|
||||||
{
|
{
|
||||||
return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen);
|
return crypto_comp_crt(tfm)->cot_compress(crypto_comp_tfm(tfm),
|
||||||
|
src, slen, dst, dlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int crypto_comp_decompress(struct crypto_comp *tfm,
|
static inline int crypto_comp_decompress(struct crypto_comp *tfm,
|
||||||
const u8 *src, unsigned int slen,
|
const u8 *src, unsigned int slen,
|
||||||
u8 *dst, unsigned int *dlen)
|
u8 *dst, unsigned int *dlen)
|
||||||
{
|
{
|
||||||
return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen);
|
return crypto_comp_crt(tfm)->cot_decompress(crypto_comp_tfm(tfm),
|
||||||
|
src, slen, dst, dlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _LINUX_CRYPTO_H */
|
#endif /* _LINUX_CRYPTO_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user