@@ -121,13 +121,6 @@ static void *zstd_alloc_ctx(void)
121121 return ctx ;
122122}
123123
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-
131124static void __zstd_exit (void * ctx )
132125{
133126 zstd_comp_exit (ctx );
@@ -140,13 +133,6 @@ static void zstd_free_ctx(void *ctx)
140133 kfree_sensitive (ctx );
141134}
142135
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-
150136static int __zstd_compress (const u8 * src , unsigned int slen ,
151137 u8 * dst , unsigned int * dlen , void * ctx )
152138{
@@ -161,14 +147,6 @@ static int __zstd_compress(const u8 *src, unsigned int slen,
161147 return 0 ;
162148}
163149
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-
172150static int zstd_scompress (struct crypto_scomp * tfm , const u8 * src ,
173151 unsigned int slen , u8 * dst , unsigned int * dlen ,
174152 void * ctx )
@@ -189,34 +167,13 @@ static int __zstd_decompress(const u8 *src, unsigned int slen,
189167 return 0 ;
190168}
191169
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-
200170static int zstd_sdecompress (struct crypto_scomp * tfm , const u8 * src ,
201171 unsigned int slen , u8 * dst , unsigned int * dlen ,
202172 void * ctx )
203173{
204174 return __zstd_decompress (src , slen , dst , dlen , ctx );
205175}
206176
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-
220177static struct scomp_alg scomp = {
221178 .alloc_ctx = zstd_alloc_ctx ,
222179 .free_ctx = zstd_free_ctx ,
@@ -231,22 +188,11 @@ static struct scomp_alg scomp = {
231188
232189static int __init zstd_mod_init (void )
233190{
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 );
245192}
246193
247194static void __exit zstd_mod_fini (void )
248195{
249- crypto_unregister_alg (& alg );
250196 crypto_unregister_scomp (& scomp );
251197}
252198
0 commit comments