Skip to content

Commit d32da55

Browse files
ardbiesheuvelherbertx
authored andcommitted
crypto: lzo-rle - 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 dbae965 commit d32da55

File tree

1 file changed

+4
-64
lines changed

1 file changed

+4
-64
lines changed

crypto/lzo-rle.c

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
* Cryptographic API.
44
*/
55

6+
#include <crypto/internal/scompress.h>
67
#include <linux/init.h>
7-
#include <linux/module.h>
8-
#include <linux/crypto.h>
9-
#include <linux/vmalloc.h>
10-
#include <linux/mm.h>
118
#include <linux/lzo.h>
12-
#include <crypto/internal/scompress.h>
9+
#include <linux/module.h>
10+
#include <linux/slab.h>
1311

1412
struct lzorle_ctx {
1513
void *lzorle_comp_mem;
@@ -26,29 +24,11 @@ static void *lzorle_alloc_ctx(void)
2624
return ctx;
2725
}
2826

29-
static int lzorle_init(struct crypto_tfm *tfm)
30-
{
31-
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
32-
33-
ctx->lzorle_comp_mem = lzorle_alloc_ctx();
34-
if (IS_ERR(ctx->lzorle_comp_mem))
35-
return -ENOMEM;
36-
37-
return 0;
38-
}
39-
4027
static void lzorle_free_ctx(void *ctx)
4128
{
4229
kvfree(ctx);
4330
}
4431

45-
static void lzorle_exit(struct crypto_tfm *tfm)
46-
{
47-
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
48-
49-
lzorle_free_ctx(ctx->lzorle_comp_mem);
50-
}
51-
5232
static int __lzorle_compress(const u8 *src, unsigned int slen,
5333
u8 *dst, unsigned int *dlen, void *ctx)
5434
{
@@ -64,14 +44,6 @@ static int __lzorle_compress(const u8 *src, unsigned int slen,
6444
return 0;
6545
}
6646

67-
static int lzorle_compress(struct crypto_tfm *tfm, const u8 *src,
68-
unsigned int slen, u8 *dst, unsigned int *dlen)
69-
{
70-
struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm);
71-
72-
return __lzorle_compress(src, slen, dst, dlen, ctx->lzorle_comp_mem);
73-
}
74-
7547
static int lzorle_scompress(struct crypto_scomp *tfm, const u8 *src,
7648
unsigned int slen, u8 *dst, unsigned int *dlen,
7749
void *ctx)
@@ -94,32 +66,13 @@ static int __lzorle_decompress(const u8 *src, unsigned int slen,
9466
return 0;
9567
}
9668

97-
static int lzorle_decompress(struct crypto_tfm *tfm, const u8 *src,
98-
unsigned int slen, u8 *dst, unsigned int *dlen)
99-
{
100-
return __lzorle_decompress(src, slen, dst, dlen);
101-
}
102-
10369
static int lzorle_sdecompress(struct crypto_scomp *tfm, const u8 *src,
10470
unsigned int slen, u8 *dst, unsigned int *dlen,
10571
void *ctx)
10672
{
10773
return __lzorle_decompress(src, slen, dst, dlen);
10874
}
10975

110-
static struct crypto_alg alg = {
111-
.cra_name = "lzo-rle",
112-
.cra_driver_name = "lzo-rle-generic",
113-
.cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
114-
.cra_ctxsize = sizeof(struct lzorle_ctx),
115-
.cra_module = THIS_MODULE,
116-
.cra_init = lzorle_init,
117-
.cra_exit = lzorle_exit,
118-
.cra_u = { .compress = {
119-
.coa_compress = lzorle_compress,
120-
.coa_decompress = lzorle_decompress } }
121-
};
122-
12376
static struct scomp_alg scomp = {
12477
.alloc_ctx = lzorle_alloc_ctx,
12578
.free_ctx = lzorle_free_ctx,
@@ -134,24 +87,11 @@ static struct scomp_alg scomp = {
13487

13588
static int __init lzorle_mod_init(void)
13689
{
137-
int ret;
138-
139-
ret = crypto_register_alg(&alg);
140-
if (ret)
141-
return ret;
142-
143-
ret = crypto_register_scomp(&scomp);
144-
if (ret) {
145-
crypto_unregister_alg(&alg);
146-
return ret;
147-
}
148-
149-
return ret;
90+
return crypto_register_scomp(&scomp);
15091
}
15192

15293
static void __exit lzorle_mod_fini(void)
15394
{
154-
crypto_unregister_alg(&alg);
15595
crypto_unregister_scomp(&scomp);
15696
}
15797

0 commit comments

Comments
 (0)