Skip to content

Commit 33335af

Browse files
ardbiesheuvelherbertx
authored andcommitted
crypto: lz4 - drop obsolete 'comp' implementation
The 'comp' API is obsolete and will be removed, so remove this comp implementation. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 0fd4863 commit 33335af

File tree

1 file changed

+1
-60
lines changed

1 file changed

+1
-60
lines changed

crypto/lz4.c

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,11 @@ static void *lz4_alloc_ctx(void)
2727
return ctx;
2828
}
2929

30-
static int lz4_init(struct crypto_tfm *tfm)
31-
{
32-
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
33-
34-
ctx->lz4_comp_mem = lz4_alloc_ctx();
35-
if (IS_ERR(ctx->lz4_comp_mem))
36-
return -ENOMEM;
37-
38-
return 0;
39-
}
40-
4130
static void lz4_free_ctx(void *ctx)
4231
{
4332
vfree(ctx);
4433
}
4534

46-
static void lz4_exit(struct crypto_tfm *tfm)
47-
{
48-
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
49-
50-
lz4_free_ctx(ctx->lz4_comp_mem);
51-
}
52-
5335
static int __lz4_compress_crypto(const u8 *src, unsigned int slen,
5436
u8 *dst, unsigned int *dlen, void *ctx)
5537
{
@@ -70,14 +52,6 @@ static int lz4_scompress(struct crypto_scomp *tfm, const u8 *src,
7052
return __lz4_compress_crypto(src, slen, dst, dlen, ctx);
7153
}
7254

73-
static int lz4_compress_crypto(struct crypto_tfm *tfm, const u8 *src,
74-
unsigned int slen, u8 *dst, unsigned int *dlen)
75-
{
76-
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
77-
78-
return __lz4_compress_crypto(src, slen, dst, dlen, ctx->lz4_comp_mem);
79-
}
80-
8155
static int __lz4_decompress_crypto(const u8 *src, unsigned int slen,
8256
u8 *dst, unsigned int *dlen, void *ctx)
8357
{
@@ -97,26 +71,6 @@ static int lz4_sdecompress(struct crypto_scomp *tfm, const u8 *src,
9771
return __lz4_decompress_crypto(src, slen, dst, dlen, NULL);
9872
}
9973

100-
static int lz4_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
101-
unsigned int slen, u8 *dst,
102-
unsigned int *dlen)
103-
{
104-
return __lz4_decompress_crypto(src, slen, dst, dlen, NULL);
105-
}
106-
107-
static struct crypto_alg alg_lz4 = {
108-
.cra_name = "lz4",
109-
.cra_driver_name = "lz4-generic",
110-
.cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
111-
.cra_ctxsize = sizeof(struct lz4_ctx),
112-
.cra_module = THIS_MODULE,
113-
.cra_init = lz4_init,
114-
.cra_exit = lz4_exit,
115-
.cra_u = { .compress = {
116-
.coa_compress = lz4_compress_crypto,
117-
.coa_decompress = lz4_decompress_crypto } }
118-
};
119-
12074
static struct scomp_alg scomp = {
12175
.alloc_ctx = lz4_alloc_ctx,
12276
.free_ctx = lz4_free_ctx,
@@ -131,24 +85,11 @@ static struct scomp_alg scomp = {
13185

13286
static int __init lz4_mod_init(void)
13387
{
134-
int ret;
135-
136-
ret = crypto_register_alg(&alg_lz4);
137-
if (ret)
138-
return ret;
139-
140-
ret = crypto_register_scomp(&scomp);
141-
if (ret) {
142-
crypto_unregister_alg(&alg_lz4);
143-
return ret;
144-
}
145-
146-
return ret;
88+
return crypto_register_scomp(&scomp);
14789
}
14890

14991
static void __exit lz4_mod_fini(void)
15092
{
151-
crypto_unregister_alg(&alg_lz4);
15293
crypto_unregister_scomp(&scomp);
15394
}
15495

0 commit comments

Comments
 (0)