Skip to content

Commit 2d985ff

Browse files
ardbiesheuvelherbertx
authored andcommitted
crypto: 842 - 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 980b570 commit 2d985ff

File tree

1 file changed

+2
-64
lines changed

1 file changed

+2
-64
lines changed

crypto/842.c

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818
* drivers/crypto/nx/nx-842-crypto.c
1919
*/
2020

21+
#include <crypto/internal/scompress.h>
2122
#include <linux/init.h>
2223
#include <linux/module.h>
23-
#include <linux/crypto.h>
2424
#include <linux/sw842.h>
25-
#include <crypto/internal/scompress.h>
2625

2726
struct crypto842_ctx {
2827
void *wmem; /* working memory for compress */
@@ -39,73 +38,25 @@ static void *crypto842_alloc_ctx(void)
3938
return ctx;
4039
}
4140

42-
static int crypto842_init(struct crypto_tfm *tfm)
43-
{
44-
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
45-
46-
ctx->wmem = crypto842_alloc_ctx();
47-
if (IS_ERR(ctx->wmem))
48-
return -ENOMEM;
49-
50-
return 0;
51-
}
52-
5341
static void crypto842_free_ctx(void *ctx)
5442
{
5543
kfree(ctx);
5644
}
5745

58-
static void crypto842_exit(struct crypto_tfm *tfm)
59-
{
60-
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
61-
62-
crypto842_free_ctx(ctx->wmem);
63-
}
64-
65-
static int crypto842_compress(struct crypto_tfm *tfm,
66-
const u8 *src, unsigned int slen,
67-
u8 *dst, unsigned int *dlen)
68-
{
69-
struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm);
70-
71-
return sw842_compress(src, slen, dst, dlen, ctx->wmem);
72-
}
73-
7446
static int crypto842_scompress(struct crypto_scomp *tfm,
7547
const u8 *src, unsigned int slen,
7648
u8 *dst, unsigned int *dlen, void *ctx)
7749
{
7850
return sw842_compress(src, slen, dst, dlen, ctx);
7951
}
8052

81-
static int crypto842_decompress(struct crypto_tfm *tfm,
82-
const u8 *src, unsigned int slen,
83-
u8 *dst, unsigned int *dlen)
84-
{
85-
return sw842_decompress(src, slen, dst, dlen);
86-
}
87-
8853
static int crypto842_sdecompress(struct crypto_scomp *tfm,
8954
const u8 *src, unsigned int slen,
9055
u8 *dst, unsigned int *dlen, void *ctx)
9156
{
9257
return sw842_decompress(src, slen, dst, dlen);
9358
}
9459

95-
static struct crypto_alg alg = {
96-
.cra_name = "842",
97-
.cra_driver_name = "842-generic",
98-
.cra_priority = 100,
99-
.cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
100-
.cra_ctxsize = sizeof(struct crypto842_ctx),
101-
.cra_module = THIS_MODULE,
102-
.cra_init = crypto842_init,
103-
.cra_exit = crypto842_exit,
104-
.cra_u = { .compress = {
105-
.coa_compress = crypto842_compress,
106-
.coa_decompress = crypto842_decompress } }
107-
};
108-
10960
static struct scomp_alg scomp = {
11061
.alloc_ctx = crypto842_alloc_ctx,
11162
.free_ctx = crypto842_free_ctx,
@@ -121,25 +72,12 @@ static struct scomp_alg scomp = {
12172

12273
static int __init crypto842_mod_init(void)
12374
{
124-
int ret;
125-
126-
ret = crypto_register_alg(&alg);
127-
if (ret)
128-
return ret;
129-
130-
ret = crypto_register_scomp(&scomp);
131-
if (ret) {
132-
crypto_unregister_alg(&alg);
133-
return ret;
134-
}
135-
136-
return ret;
75+
return crypto_register_scomp(&scomp);
13776
}
13877
subsys_initcall(crypto842_mod_init);
13978

14079
static void __exit crypto842_mod_exit(void)
14180
{
142-
crypto_unregister_alg(&alg);
14381
crypto_unregister_scomp(&scomp);
14482
}
14583
module_exit(crypto842_mod_exit);

0 commit comments

Comments
 (0)