mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
crypto: scomp - Remove tfm argument from alloc/free_ctx
The tfm argument is completely unused and meaningless as the same stream object is identical over all transforms of a given algorithm. Remove it. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
3d6979bf3b
commit
0af7304c06
10 changed files with 34 additions and 34 deletions
|
@ -28,7 +28,7 @@ struct crypto842_ctx {
|
||||||
void *wmem; /* working memory for compress */
|
void *wmem; /* working memory for compress */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *crypto842_alloc_ctx(struct crypto_scomp *tfm)
|
static void *crypto842_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
void *ctx;
|
void *ctx;
|
||||||
|
|
||||||
|
@ -43,14 +43,14 @@ static int crypto842_init(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
ctx->wmem = crypto842_alloc_ctx(NULL);
|
ctx->wmem = crypto842_alloc_ctx();
|
||||||
if (IS_ERR(ctx->wmem))
|
if (IS_ERR(ctx->wmem))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void crypto842_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void crypto842_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
kfree(ctx);
|
kfree(ctx);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ static void crypto842_exit(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
crypto842_free_ctx(NULL, ctx->wmem);
|
crypto842_free_ctx(ctx->wmem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int crypto842_compress(struct crypto_tfm *tfm,
|
static int crypto842_compress(struct crypto_tfm *tfm,
|
||||||
|
|
|
@ -112,7 +112,7 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *deflate_alloc_ctx(struct crypto_scomp *tfm)
|
static void *deflate_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
struct deflate_ctx *ctx;
|
struct deflate_ctx *ctx;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -143,7 +143,7 @@ static void __deflate_exit(void *ctx)
|
||||||
deflate_decomp_exit(ctx);
|
deflate_decomp_exit(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deflate_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void deflate_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
__deflate_exit(ctx);
|
__deflate_exit(ctx);
|
||||||
kfree_sensitive(ctx);
|
kfree_sensitive(ctx);
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct lz4_ctx {
|
||||||
void *lz4_comp_mem;
|
void *lz4_comp_mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *lz4_alloc_ctx(struct crypto_scomp *tfm)
|
static void *lz4_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
void *ctx;
|
void *ctx;
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ static int lz4_init(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
ctx->lz4_comp_mem = lz4_alloc_ctx(NULL);
|
ctx->lz4_comp_mem = lz4_alloc_ctx();
|
||||||
if (IS_ERR(ctx->lz4_comp_mem))
|
if (IS_ERR(ctx->lz4_comp_mem))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lz4_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void lz4_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
vfree(ctx);
|
vfree(ctx);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ static void lz4_exit(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
lz4_free_ctx(NULL, ctx->lz4_comp_mem);
|
lz4_free_ctx(ctx->lz4_comp_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __lz4_compress_crypto(const u8 *src, unsigned int slen,
|
static int __lz4_compress_crypto(const u8 *src, unsigned int slen,
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct lz4hc_ctx {
|
||||||
void *lz4hc_comp_mem;
|
void *lz4hc_comp_mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *lz4hc_alloc_ctx(struct crypto_scomp *tfm)
|
static void *lz4hc_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
void *ctx;
|
void *ctx;
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ static int lz4hc_init(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
ctx->lz4hc_comp_mem = lz4hc_alloc_ctx(NULL);
|
ctx->lz4hc_comp_mem = lz4hc_alloc_ctx();
|
||||||
if (IS_ERR(ctx->lz4hc_comp_mem))
|
if (IS_ERR(ctx->lz4hc_comp_mem))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lz4hc_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void lz4hc_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
vfree(ctx);
|
vfree(ctx);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ static void lz4hc_exit(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
lz4hc_free_ctx(NULL, ctx->lz4hc_comp_mem);
|
lz4hc_free_ctx(ctx->lz4hc_comp_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __lz4hc_compress_crypto(const u8 *src, unsigned int slen,
|
static int __lz4hc_compress_crypto(const u8 *src, unsigned int slen,
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct lzorle_ctx {
|
||||||
void *lzorle_comp_mem;
|
void *lzorle_comp_mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *lzorle_alloc_ctx(struct crypto_scomp *tfm)
|
static void *lzorle_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
void *ctx;
|
void *ctx;
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ static int lzorle_init(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
ctx->lzorle_comp_mem = lzorle_alloc_ctx(NULL);
|
ctx->lzorle_comp_mem = lzorle_alloc_ctx();
|
||||||
if (IS_ERR(ctx->lzorle_comp_mem))
|
if (IS_ERR(ctx->lzorle_comp_mem))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lzorle_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void lzorle_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
kvfree(ctx);
|
kvfree(ctx);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ static void lzorle_exit(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
lzorle_free_ctx(NULL, ctx->lzorle_comp_mem);
|
lzorle_free_ctx(ctx->lzorle_comp_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __lzorle_compress(const u8 *src, unsigned int slen,
|
static int __lzorle_compress(const u8 *src, unsigned int slen,
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct lzo_ctx {
|
||||||
void *lzo_comp_mem;
|
void *lzo_comp_mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *lzo_alloc_ctx(struct crypto_scomp *tfm)
|
static void *lzo_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
void *ctx;
|
void *ctx;
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ static int lzo_init(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
ctx->lzo_comp_mem = lzo_alloc_ctx(NULL);
|
ctx->lzo_comp_mem = lzo_alloc_ctx();
|
||||||
if (IS_ERR(ctx->lzo_comp_mem))
|
if (IS_ERR(ctx->lzo_comp_mem))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lzo_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void lzo_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
kvfree(ctx);
|
kvfree(ctx);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ static void lzo_exit(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
lzo_free_ctx(NULL, ctx->lzo_comp_mem);
|
lzo_free_ctx(ctx->lzo_comp_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __lzo_compress(const u8 *src, unsigned int slen,
|
static int __lzo_compress(const u8 *src, unsigned int slen,
|
||||||
|
|
|
@ -103,7 +103,7 @@ static int __zstd_init(void *ctx)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *zstd_alloc_ctx(struct crypto_scomp *tfm)
|
static void *zstd_alloc_ctx(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct zstd_ctx *ctx;
|
struct zstd_ctx *ctx;
|
||||||
|
@ -134,7 +134,7 @@ static void __zstd_exit(void *ctx)
|
||||||
zstd_decomp_exit(ctx);
|
zstd_decomp_exit(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zstd_free_ctx(struct crypto_scomp *tfm, void *ctx)
|
static void zstd_free_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
__zstd_exit(ctx);
|
__zstd_exit(ctx);
|
||||||
kfree_sensitive(ctx);
|
kfree_sensitive(ctx);
|
||||||
|
|
|
@ -236,7 +236,7 @@ int zip_comp_decompress(struct crypto_tfm *tfm,
|
||||||
} /* Legacy compress framework end */
|
} /* Legacy compress framework end */
|
||||||
|
|
||||||
/* SCOMP framework start */
|
/* SCOMP framework start */
|
||||||
void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm)
|
void *zip_alloc_scomp_ctx_deflate(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct zip_kernel_ctx *zip_ctx;
|
struct zip_kernel_ctx *zip_ctx;
|
||||||
|
@ -255,7 +255,7 @@ void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm)
|
||||||
return zip_ctx;
|
return zip_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm)
|
void *zip_alloc_scomp_ctx_lzs(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct zip_kernel_ctx *zip_ctx;
|
struct zip_kernel_ctx *zip_ctx;
|
||||||
|
@ -274,7 +274,7 @@ void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm)
|
||||||
return zip_ctx;
|
return zip_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zip_free_scomp_ctx(struct crypto_scomp *tfm, void *ctx)
|
void zip_free_scomp_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
struct zip_kernel_ctx *zip_ctx = ctx;
|
struct zip_kernel_ctx *zip_ctx = ctx;
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,9 @@ int zip_comp_decompress(struct crypto_tfm *tfm,
|
||||||
const u8 *src, unsigned int slen,
|
const u8 *src, unsigned int slen,
|
||||||
u8 *dst, unsigned int *dlen);
|
u8 *dst, unsigned int *dlen);
|
||||||
|
|
||||||
void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm);
|
void *zip_alloc_scomp_ctx_deflate(void);
|
||||||
void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm);
|
void *zip_alloc_scomp_ctx_lzs(void);
|
||||||
void zip_free_scomp_ctx(struct crypto_scomp *tfm, void *zip_ctx);
|
void zip_free_scomp_ctx(void *zip_ctx);
|
||||||
int zip_scomp_compress(struct crypto_scomp *tfm,
|
int zip_scomp_compress(struct crypto_scomp *tfm,
|
||||||
const u8 *src, unsigned int slen,
|
const u8 *src, unsigned int slen,
|
||||||
u8 *dst, unsigned int *dlen, void *ctx);
|
u8 *dst, unsigned int *dlen, void *ctx);
|
||||||
|
|
|
@ -31,8 +31,8 @@ struct crypto_scomp {
|
||||||
* @calg: Cmonn algorithm data structure shared with acomp
|
* @calg: Cmonn algorithm data structure shared with acomp
|
||||||
*/
|
*/
|
||||||
struct scomp_alg {
|
struct scomp_alg {
|
||||||
void *(*alloc_ctx)(struct crypto_scomp *tfm);
|
void *(*alloc_ctx)(void);
|
||||||
void (*free_ctx)(struct crypto_scomp *tfm, void *ctx);
|
void (*free_ctx)(void *ctx);
|
||||||
int (*compress)(struct crypto_scomp *tfm, const u8 *src,
|
int (*compress)(struct crypto_scomp *tfm, const u8 *src,
|
||||||
unsigned int slen, u8 *dst, unsigned int *dlen,
|
unsigned int slen, u8 *dst, unsigned int *dlen,
|
||||||
void *ctx);
|
void *ctx);
|
||||||
|
@ -73,13 +73,13 @@ static inline struct scomp_alg *crypto_scomp_alg(struct crypto_scomp *tfm)
|
||||||
|
|
||||||
static inline void *crypto_scomp_alloc_ctx(struct crypto_scomp *tfm)
|
static inline void *crypto_scomp_alloc_ctx(struct crypto_scomp *tfm)
|
||||||
{
|
{
|
||||||
return crypto_scomp_alg(tfm)->alloc_ctx(tfm);
|
return crypto_scomp_alg(tfm)->alloc_ctx();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void crypto_scomp_free_ctx(struct crypto_scomp *tfm,
|
static inline void crypto_scomp_free_ctx(struct crypto_scomp *tfm,
|
||||||
void *ctx)
|
void *ctx)
|
||||||
{
|
{
|
||||||
return crypto_scomp_alg(tfm)->free_ctx(tfm, ctx);
|
return crypto_scomp_alg(tfm)->free_ctx(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int crypto_scomp_compress(struct crypto_scomp *tfm,
|
static inline int crypto_scomp_compress(struct crypto_scomp *tfm,
|
||||||
|
|
Loading…
Add table
Reference in a new issue