@@ -121,13 +121,6 @@ static void *zstd_alloc_ctx(void)
121
121
return ctx ;
122
122
}
123
123
124
- static int zstd_init (struct crypto_tfm * tfm )
125
- {
126
- struct zstd_ctx * ctx = crypto_tfm_ctx (tfm );
127
-
128
- return __zstd_init (ctx );
129
- }
130
-
131
124
static void __zstd_exit (void * ctx )
132
125
{
133
126
zstd_comp_exit (ctx );
@@ -140,13 +133,6 @@ static void zstd_free_ctx(void *ctx)
140
133
kfree_sensitive (ctx );
141
134
}
142
135
143
- static void zstd_exit (struct crypto_tfm * tfm )
144
- {
145
- struct zstd_ctx * ctx = crypto_tfm_ctx (tfm );
146
-
147
- __zstd_exit (ctx );
148
- }
149
-
150
136
static int __zstd_compress (const u8 * src , unsigned int slen ,
151
137
u8 * dst , unsigned int * dlen , void * ctx )
152
138
{
@@ -161,14 +147,6 @@ static int __zstd_compress(const u8 *src, unsigned int slen,
161
147
return 0 ;
162
148
}
163
149
164
- static int zstd_compress (struct crypto_tfm * tfm , const u8 * src ,
165
- unsigned int slen , u8 * dst , unsigned int * dlen )
166
- {
167
- struct zstd_ctx * ctx = crypto_tfm_ctx (tfm );
168
-
169
- return __zstd_compress (src , slen , dst , dlen , ctx );
170
- }
171
-
172
150
static int zstd_scompress (struct crypto_scomp * tfm , const u8 * src ,
173
151
unsigned int slen , u8 * dst , unsigned int * dlen ,
174
152
void * ctx )
@@ -189,34 +167,13 @@ static int __zstd_decompress(const u8 *src, unsigned int slen,
189
167
return 0 ;
190
168
}
191
169
192
- static int zstd_decompress (struct crypto_tfm * tfm , const u8 * src ,
193
- unsigned int slen , u8 * dst , unsigned int * dlen )
194
- {
195
- struct zstd_ctx * ctx = crypto_tfm_ctx (tfm );
196
-
197
- return __zstd_decompress (src , slen , dst , dlen , ctx );
198
- }
199
-
200
170
static int zstd_sdecompress (struct crypto_scomp * tfm , const u8 * src ,
201
171
unsigned int slen , u8 * dst , unsigned int * dlen ,
202
172
void * ctx )
203
173
{
204
174
return __zstd_decompress (src , slen , dst , dlen , ctx );
205
175
}
206
176
207
- static struct crypto_alg alg = {
208
- .cra_name = "zstd" ,
209
- .cra_driver_name = "zstd-generic" ,
210
- .cra_flags = CRYPTO_ALG_TYPE_COMPRESS ,
211
- .cra_ctxsize = sizeof (struct zstd_ctx ),
212
- .cra_module = THIS_MODULE ,
213
- .cra_init = zstd_init ,
214
- .cra_exit = zstd_exit ,
215
- .cra_u = { .compress = {
216
- .coa_compress = zstd_compress ,
217
- .coa_decompress = zstd_decompress } }
218
- };
219
-
220
177
static struct scomp_alg scomp = {
221
178
.alloc_ctx = zstd_alloc_ctx ,
222
179
.free_ctx = zstd_free_ctx ,
@@ -231,22 +188,11 @@ static struct scomp_alg scomp = {
231
188
232
189
static int __init zstd_mod_init (void )
233
190
{
234
- int ret ;
235
-
236
- ret = crypto_register_alg (& alg );
237
- if (ret )
238
- return ret ;
239
-
240
- ret = crypto_register_scomp (& scomp );
241
- if (ret )
242
- crypto_unregister_alg (& alg );
243
-
244
- return ret ;
191
+ return crypto_register_scomp (& scomp );
245
192
}
246
193
247
194
static void __exit zstd_mod_fini (void )
248
195
{
249
- crypto_unregister_alg (& alg );
250
196
crypto_unregister_scomp (& scomp );
251
197
}
252
198
0 commit comments