This source file includes following definitions.
- crypto_stats_init
- crypto_stats_get
- crypto_stats_ablkcipher_encrypt
- crypto_stats_ablkcipher_decrypt
- crypto_stats_aead_encrypt
- crypto_stats_aead_decrypt
- crypto_stats_ahash_update
- crypto_stats_ahash_final
- crypto_stats_akcipher_encrypt
- crypto_stats_akcipher_decrypt
- crypto_stats_akcipher_sign
- crypto_stats_akcipher_verify
- crypto_stats_compress
- crypto_stats_decompress
- crypto_stats_kpp_set_secret
- crypto_stats_kpp_generate_public_key
- crypto_stats_kpp_compute_shared_secret
- crypto_stats_rng_seed
- crypto_stats_rng_generate
- crypto_stats_skcipher_encrypt
- crypto_stats_skcipher_decrypt
- crypto_wait_req
- crypto_init_wait
- crypto_free_tfm
- crypto_tfm_alg_name
- crypto_tfm_alg_driver_name
- crypto_tfm_alg_priority
- crypto_tfm_alg_type
- crypto_tfm_alg_blocksize
- crypto_tfm_alg_alignmask
- crypto_tfm_get_flags
- crypto_tfm_set_flags
- crypto_tfm_clear_flags
- crypto_tfm_ctx
- crypto_tfm_ctx_alignment
- __crypto_ablkcipher_cast
- crypto_skcipher_type
- crypto_skcipher_mask
- crypto_ablkcipher_tfm
- crypto_free_ablkcipher
- crypto_has_ablkcipher
- crypto_ablkcipher_crt
- crypto_ablkcipher_ivsize
- crypto_ablkcipher_blocksize
- crypto_ablkcipher_alignmask
- crypto_ablkcipher_get_flags
- crypto_ablkcipher_set_flags
- crypto_ablkcipher_clear_flags
- crypto_ablkcipher_setkey
- crypto_ablkcipher_reqtfm
- crypto_ablkcipher_encrypt
- crypto_ablkcipher_decrypt
- crypto_ablkcipher_reqsize
- ablkcipher_request_set_tfm
- ablkcipher_request_cast
- ablkcipher_request_alloc
- ablkcipher_request_free
- ablkcipher_request_set_callback
- ablkcipher_request_set_crypt
- __crypto_blkcipher_cast
- crypto_blkcipher_cast
- crypto_alloc_blkcipher
- crypto_blkcipher_tfm
- crypto_free_blkcipher
- crypto_has_blkcipher
- crypto_blkcipher_name
- crypto_blkcipher_crt
- crypto_blkcipher_alg
- crypto_blkcipher_ivsize
- crypto_blkcipher_blocksize
- crypto_blkcipher_alignmask
- crypto_blkcipher_get_flags
- crypto_blkcipher_set_flags
- crypto_blkcipher_clear_flags
- crypto_blkcipher_setkey
- crypto_blkcipher_encrypt
- crypto_blkcipher_encrypt_iv
- crypto_blkcipher_decrypt
- crypto_blkcipher_decrypt_iv
- crypto_blkcipher_set_iv
- crypto_blkcipher_get_iv
- __crypto_cipher_cast
- crypto_cipher_cast
- crypto_alloc_cipher
- crypto_cipher_tfm
- crypto_free_cipher
- crypto_has_cipher
- crypto_cipher_crt
- crypto_cipher_blocksize
- crypto_cipher_alignmask
- crypto_cipher_get_flags
- crypto_cipher_set_flags
- crypto_cipher_clear_flags
- crypto_cipher_setkey
- crypto_cipher_encrypt_one
- crypto_cipher_decrypt_one
- __crypto_comp_cast
- crypto_comp_cast
- crypto_alloc_comp
- crypto_comp_tfm
- crypto_free_comp
- crypto_has_comp
- crypto_comp_name
- crypto_comp_crt
- crypto_comp_compress
- crypto_comp_decompress
1
2
3
4
5
6
7
8
9
10
11
12 #ifndef _LINUX_CRYPTO_H
13 #define _LINUX_CRYPTO_H
14
15 #include <linux/atomic.h>
16 #include <linux/kernel.h>
17 #include <linux/list.h>
18 #include <linux/bug.h>
19 #include <linux/slab.h>
20 #include <linux/string.h>
21 #include <linux/uaccess.h>
22 #include <linux/completion.h>
23
24
25
26
27
28
29
30
31
32
33 #define MODULE_ALIAS_CRYPTO(name) \
34 __MODULE_INFO(alias, alias_userspace, name); \
35 __MODULE_INFO(alias, alias_crypto, "crypto-" name)
36
37
38
39
40 #define CRYPTO_ALG_TYPE_MASK 0x0000000f
41 #define CRYPTO_ALG_TYPE_CIPHER 0x00000001
42 #define CRYPTO_ALG_TYPE_COMPRESS 0x00000002
43 #define CRYPTO_ALG_TYPE_AEAD 0x00000003
44 #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
45 #define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
46 #define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005
47 #define CRYPTO_ALG_TYPE_KPP 0x00000008
48 #define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a
49 #define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b
50 #define CRYPTO_ALG_TYPE_RNG 0x0000000c
51 #define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d
52 #define CRYPTO_ALG_TYPE_HASH 0x0000000e
53 #define CRYPTO_ALG_TYPE_SHASH 0x0000000e
54 #define CRYPTO_ALG_TYPE_AHASH 0x0000000f
55
56 #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
57 #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e
58 #define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
59 #define CRYPTO_ALG_TYPE_ACOMPRESS_MASK 0x0000000e
60
61 #define CRYPTO_ALG_LARVAL 0x00000010
62 #define CRYPTO_ALG_DEAD 0x00000020
63 #define CRYPTO_ALG_DYING 0x00000040
64 #define CRYPTO_ALG_ASYNC 0x00000080
65
66
67
68
69
70 #define CRYPTO_ALG_NEED_FALLBACK 0x00000100
71
72
73
74
75
76
77
78 #define CRYPTO_ALG_TESTED 0x00000400
79
80
81
82
83 #define CRYPTO_ALG_INSTANCE 0x00000800
84
85
86
87
88 #define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000
89
90
91
92
93
94 #define CRYPTO_ALG_INTERNAL 0x00002000
95
96
97
98
99
100 #define CRYPTO_ALG_OPTIONAL_KEY 0x00004000
101
102
103
104
105 #define CRYPTO_NOLOAD 0x00008000
106
107
108
109
110 #define CRYPTO_TFM_NEED_KEY 0x00000001
111
112 #define CRYPTO_TFM_REQ_MASK 0x000fff00
113 #define CRYPTO_TFM_RES_MASK 0xfff00000
114
115 #define CRYPTO_TFM_REQ_FORBID_WEAK_KEYS 0x00000100
116 #define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
117 #define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400
118 #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000
119 #define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
120 #define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000
121 #define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000
122 #define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000
123
124
125
126
127 #define CRYPTO_MAX_ALG_NAME 128
128
129
130
131
132
133
134
135
136
137 #define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
138
139 #define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
140
141 struct scatterlist;
142 struct crypto_ablkcipher;
143 struct crypto_async_request;
144 struct crypto_blkcipher;
145 struct crypto_tfm;
146 struct crypto_type;
147
148 typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
149
150
151
152
153
154
155
156
157 struct crypto_async_request {
158 struct list_head list;
159 crypto_completion_t complete;
160 void *data;
161 struct crypto_tfm *tfm;
162
163 u32 flags;
164 };
165
166 struct ablkcipher_request {
167 struct crypto_async_request base;
168
169 unsigned int nbytes;
170
171 void *info;
172
173 struct scatterlist *src;
174 struct scatterlist *dst;
175
176 void *__ctx[] CRYPTO_MINALIGN_ATTR;
177 };
178
179 struct blkcipher_desc {
180 struct crypto_blkcipher *tfm;
181 void *info;
182 u32 flags;
183 };
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232 struct ablkcipher_alg {
233 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
234 unsigned int keylen);
235 int (*encrypt)(struct ablkcipher_request *req);
236 int (*decrypt)(struct ablkcipher_request *req);
237
238 unsigned int min_keysize;
239 unsigned int max_keysize;
240 unsigned int ivsize;
241 };
242
243
244
245
246
247
248
249
250
251
252
253
254 struct blkcipher_alg {
255 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
256 unsigned int keylen);
257 int (*encrypt)(struct blkcipher_desc *desc,
258 struct scatterlist *dst, struct scatterlist *src,
259 unsigned int nbytes);
260 int (*decrypt)(struct blkcipher_desc *desc,
261 struct scatterlist *dst, struct scatterlist *src,
262 unsigned int nbytes);
263
264 unsigned int min_keysize;
265 unsigned int max_keysize;
266 unsigned int ivsize;
267 };
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316 struct cipher_alg {
317 unsigned int cia_min_keysize;
318 unsigned int cia_max_keysize;
319 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key,
320 unsigned int keylen);
321 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
322 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
323 };
324
325
326
327
328
329
330
331
332
333
334
335
336 struct compress_alg {
337 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src,
338 unsigned int slen, u8 *dst, unsigned int *dlen);
339 int (*coa_decompress)(struct crypto_tfm *tfm, const u8 *src,
340 unsigned int slen, u8 *dst, unsigned int *dlen);
341 };
342
343 #ifdef CONFIG_CRYPTO_STATS
344
345
346
347
348
349
350
351
352 struct crypto_istat_aead {
353 atomic64_t encrypt_cnt;
354 atomic64_t encrypt_tlen;
355 atomic64_t decrypt_cnt;
356 atomic64_t decrypt_tlen;
357 atomic64_t err_cnt;
358 };
359
360
361
362
363
364
365
366
367
368
369
370 struct crypto_istat_akcipher {
371 atomic64_t encrypt_cnt;
372 atomic64_t encrypt_tlen;
373 atomic64_t decrypt_cnt;
374 atomic64_t decrypt_tlen;
375 atomic64_t verify_cnt;
376 atomic64_t sign_cnt;
377 atomic64_t err_cnt;
378 };
379
380
381
382
383
384
385
386
387
388 struct crypto_istat_cipher {
389 atomic64_t encrypt_cnt;
390 atomic64_t encrypt_tlen;
391 atomic64_t decrypt_cnt;
392 atomic64_t decrypt_tlen;
393 atomic64_t err_cnt;
394 };
395
396
397
398
399
400
401
402
403
404 struct crypto_istat_compress {
405 atomic64_t compress_cnt;
406 atomic64_t compress_tlen;
407 atomic64_t decompress_cnt;
408 atomic64_t decompress_tlen;
409 atomic64_t err_cnt;
410 };
411
412
413
414
415
416
417
418 struct crypto_istat_hash {
419 atomic64_t hash_cnt;
420 atomic64_t hash_tlen;
421 atomic64_t err_cnt;
422 };
423
424
425
426
427
428
429
430
431 struct crypto_istat_kpp {
432 atomic64_t setsecret_cnt;
433 atomic64_t generate_public_key_cnt;
434 atomic64_t compute_shared_secret_cnt;
435 atomic64_t err_cnt;
436 };
437
438
439
440
441
442
443
444
445 struct crypto_istat_rng {
446 atomic64_t generate_cnt;
447 atomic64_t generate_tlen;
448 atomic64_t seed_cnt;
449 atomic64_t err_cnt;
450 };
451 #endif
452
453 #define cra_ablkcipher cra_u.ablkcipher
454 #define cra_blkcipher cra_u.blkcipher
455 #define cra_cipher cra_u.cipher
456 #define cra_compress cra_u.compress
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550 struct crypto_alg {
551 struct list_head cra_list;
552 struct list_head cra_users;
553
554 u32 cra_flags;
555 unsigned int cra_blocksize;
556 unsigned int cra_ctxsize;
557 unsigned int cra_alignmask;
558
559 int cra_priority;
560 refcount_t cra_refcnt;
561
562 char cra_name[CRYPTO_MAX_ALG_NAME];
563 char cra_driver_name[CRYPTO_MAX_ALG_NAME];
564
565 const struct crypto_type *cra_type;
566
567 union {
568 struct ablkcipher_alg ablkcipher;
569 struct blkcipher_alg blkcipher;
570 struct cipher_alg cipher;
571 struct compress_alg compress;
572 } cra_u;
573
574 int (*cra_init)(struct crypto_tfm *tfm);
575 void (*cra_exit)(struct crypto_tfm *tfm);
576 void (*cra_destroy)(struct crypto_alg *alg);
577
578 struct module *cra_module;
579
580 #ifdef CONFIG_CRYPTO_STATS
581 union {
582 struct crypto_istat_aead aead;
583 struct crypto_istat_akcipher akcipher;
584 struct crypto_istat_cipher cipher;
585 struct crypto_istat_compress compress;
586 struct crypto_istat_hash hash;
587 struct crypto_istat_rng rng;
588 struct crypto_istat_kpp kpp;
589 } stats;
590 #endif
591
592 } CRYPTO_MINALIGN_ATTR;
593
594 #ifdef CONFIG_CRYPTO_STATS
595 void crypto_stats_init(struct crypto_alg *alg);
596 void crypto_stats_get(struct crypto_alg *alg);
597 void crypto_stats_ablkcipher_encrypt(unsigned int nbytes, int ret, struct crypto_alg *alg);
598 void crypto_stats_ablkcipher_decrypt(unsigned int nbytes, int ret, struct crypto_alg *alg);
599 void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret);
600 void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret);
601 void crypto_stats_ahash_update(unsigned int nbytes, int ret, struct crypto_alg *alg);
602 void crypto_stats_ahash_final(unsigned int nbytes, int ret, struct crypto_alg *alg);
603 void crypto_stats_akcipher_encrypt(unsigned int src_len, int ret, struct crypto_alg *alg);
604 void crypto_stats_akcipher_decrypt(unsigned int src_len, int ret, struct crypto_alg *alg);
605 void crypto_stats_akcipher_sign(int ret, struct crypto_alg *alg);
606 void crypto_stats_akcipher_verify(int ret, struct crypto_alg *alg);
607 void crypto_stats_compress(unsigned int slen, int ret, struct crypto_alg *alg);
608 void crypto_stats_decompress(unsigned int slen, int ret, struct crypto_alg *alg);
609 void crypto_stats_kpp_set_secret(struct crypto_alg *alg, int ret);
610 void crypto_stats_kpp_generate_public_key(struct crypto_alg *alg, int ret);
611 void crypto_stats_kpp_compute_shared_secret(struct crypto_alg *alg, int ret);
612 void crypto_stats_rng_seed(struct crypto_alg *alg, int ret);
613 void crypto_stats_rng_generate(struct crypto_alg *alg, unsigned int dlen, int ret);
614 void crypto_stats_skcipher_encrypt(unsigned int cryptlen, int ret, struct crypto_alg *alg);
615 void crypto_stats_skcipher_decrypt(unsigned int cryptlen, int ret, struct crypto_alg *alg);
616 #else
617 static inline void crypto_stats_init(struct crypto_alg *alg)
618 {}
619 static inline void crypto_stats_get(struct crypto_alg *alg)
620 {}
621 static inline void crypto_stats_ablkcipher_encrypt(unsigned int nbytes, int ret, struct crypto_alg *alg)
622 {}
623 static inline void crypto_stats_ablkcipher_decrypt(unsigned int nbytes, int ret, struct crypto_alg *alg)
624 {}
625 static inline void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret)
626 {}
627 static inline void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret)
628 {}
629 static inline void crypto_stats_ahash_update(unsigned int nbytes, int ret, struct crypto_alg *alg)
630 {}
631 static inline void crypto_stats_ahash_final(unsigned int nbytes, int ret, struct crypto_alg *alg)
632 {}
633 static inline void crypto_stats_akcipher_encrypt(unsigned int src_len, int ret, struct crypto_alg *alg)
634 {}
635 static inline void crypto_stats_akcipher_decrypt(unsigned int src_len, int ret, struct crypto_alg *alg)
636 {}
637 static inline void crypto_stats_akcipher_sign(int ret, struct crypto_alg *alg)
638 {}
639 static inline void crypto_stats_akcipher_verify(int ret, struct crypto_alg *alg)
640 {}
641 static inline void crypto_stats_compress(unsigned int slen, int ret, struct crypto_alg *alg)
642 {}
643 static inline void crypto_stats_decompress(unsigned int slen, int ret, struct crypto_alg *alg)
644 {}
645 static inline void crypto_stats_kpp_set_secret(struct crypto_alg *alg, int ret)
646 {}
647 static inline void crypto_stats_kpp_generate_public_key(struct crypto_alg *alg, int ret)
648 {}
649 static inline void crypto_stats_kpp_compute_shared_secret(struct crypto_alg *alg, int ret)
650 {}
651 static inline void crypto_stats_rng_seed(struct crypto_alg *alg, int ret)
652 {}
653 static inline void crypto_stats_rng_generate(struct crypto_alg *alg, unsigned int dlen, int ret)
654 {}
655 static inline void crypto_stats_skcipher_encrypt(unsigned int cryptlen, int ret, struct crypto_alg *alg)
656 {}
657 static inline void crypto_stats_skcipher_decrypt(unsigned int cryptlen, int ret, struct crypto_alg *alg)
658 {}
659 #endif
660
661
662
663 struct crypto_wait {
664 struct completion completion;
665 int err;
666 };
667
668
669
670
671 #define DECLARE_CRYPTO_WAIT(_wait) \
672 struct crypto_wait _wait = { \
673 COMPLETION_INITIALIZER_ONSTACK((_wait).completion), 0 }
674
675
676
677
678 void crypto_req_done(struct crypto_async_request *req, int err);
679
680 static inline int crypto_wait_req(int err, struct crypto_wait *wait)
681 {
682 switch (err) {
683 case -EINPROGRESS:
684 case -EBUSY:
685 wait_for_completion(&wait->completion);
686 reinit_completion(&wait->completion);
687 err = wait->err;
688 break;
689 };
690
691 return err;
692 }
693
694 static inline void crypto_init_wait(struct crypto_wait *wait)
695 {
696 init_completion(&wait->completion);
697 }
698
699
700
701
702 int crypto_register_alg(struct crypto_alg *alg);
703 int crypto_unregister_alg(struct crypto_alg *alg);
704 int crypto_register_algs(struct crypto_alg *algs, int count);
705 int crypto_unregister_algs(struct crypto_alg *algs, int count);
706
707
708
709
710 int crypto_has_alg(const char *name, u32 type, u32 mask);
711
712
713
714
715
716
717
718 struct ablkcipher_tfm {
719 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
720 unsigned int keylen);
721 int (*encrypt)(struct ablkcipher_request *req);
722 int (*decrypt)(struct ablkcipher_request *req);
723
724 struct crypto_ablkcipher *base;
725
726 unsigned int ivsize;
727 unsigned int reqsize;
728 };
729
730 struct blkcipher_tfm {
731 void *iv;
732 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
733 unsigned int keylen);
734 int (*encrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
735 struct scatterlist *src, unsigned int nbytes);
736 int (*decrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
737 struct scatterlist *src, unsigned int nbytes);
738 };
739
740 struct cipher_tfm {
741 int (*cit_setkey)(struct crypto_tfm *tfm,
742 const u8 *key, unsigned int keylen);
743 void (*cit_encrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
744 void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
745 };
746
747 struct compress_tfm {
748 int (*cot_compress)(struct crypto_tfm *tfm,
749 const u8 *src, unsigned int slen,
750 u8 *dst, unsigned int *dlen);
751 int (*cot_decompress)(struct crypto_tfm *tfm,
752 const u8 *src, unsigned int slen,
753 u8 *dst, unsigned int *dlen);
754 };
755
756 #define crt_ablkcipher crt_u.ablkcipher
757 #define crt_blkcipher crt_u.blkcipher
758 #define crt_cipher crt_u.cipher
759 #define crt_compress crt_u.compress
760
761 struct crypto_tfm {
762
763 u32 crt_flags;
764
765 union {
766 struct ablkcipher_tfm ablkcipher;
767 struct blkcipher_tfm blkcipher;
768 struct cipher_tfm cipher;
769 struct compress_tfm compress;
770 } crt_u;
771
772 void (*exit)(struct crypto_tfm *tfm);
773
774 struct crypto_alg *__crt_alg;
775
776 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
777 };
778
779 struct crypto_ablkcipher {
780 struct crypto_tfm base;
781 };
782
783 struct crypto_blkcipher {
784 struct crypto_tfm base;
785 };
786
787 struct crypto_cipher {
788 struct crypto_tfm base;
789 };
790
791 struct crypto_comp {
792 struct crypto_tfm base;
793 };
794
795 enum {
796 CRYPTOA_UNSPEC,
797 CRYPTOA_ALG,
798 CRYPTOA_TYPE,
799 CRYPTOA_U32,
800 __CRYPTOA_MAX,
801 };
802
803 #define CRYPTOA_MAX (__CRYPTOA_MAX - 1)
804
805
806 #define CRYPTO_MAX_ATTRS 32
807
808 struct crypto_attr_alg {
809 char name[CRYPTO_MAX_ALG_NAME];
810 };
811
812 struct crypto_attr_type {
813 u32 type;
814 u32 mask;
815 };
816
817 struct crypto_attr_u32 {
818 u32 num;
819 };
820
821
822
823
824
825 struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
826 void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm);
827
828 static inline void crypto_free_tfm(struct crypto_tfm *tfm)
829 {
830 return crypto_destroy_tfm(tfm, tfm);
831 }
832
833 int alg_test(const char *driver, const char *alg, u32 type, u32 mask);
834
835
836
837
838 static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm)
839 {
840 return tfm->__crt_alg->cra_name;
841 }
842
843 static inline const char *crypto_tfm_alg_driver_name(struct crypto_tfm *tfm)
844 {
845 return tfm->__crt_alg->cra_driver_name;
846 }
847
848 static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm)
849 {
850 return tfm->__crt_alg->cra_priority;
851 }
852
853 static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
854 {
855 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
856 }
857
858 static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm)
859 {
860 return tfm->__crt_alg->cra_blocksize;
861 }
862
863 static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
864 {
865 return tfm->__crt_alg->cra_alignmask;
866 }
867
868 static inline u32 crypto_tfm_get_flags(struct crypto_tfm *tfm)
869 {
870 return tfm->crt_flags;
871 }
872
873 static inline void crypto_tfm_set_flags(struct crypto_tfm *tfm, u32 flags)
874 {
875 tfm->crt_flags |= flags;
876 }
877
878 static inline void crypto_tfm_clear_flags(struct crypto_tfm *tfm, u32 flags)
879 {
880 tfm->crt_flags &= ~flags;
881 }
882
883 static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
884 {
885 return tfm->__crt_ctx;
886 }
887
888 static inline unsigned int crypto_tfm_ctx_alignment(void)
889 {
890 struct crypto_tfm *tfm;
891 return __alignof__(tfm->__crt_ctx);
892 }
893
894
895
896
897 static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
898 struct crypto_tfm *tfm)
899 {
900 return (struct crypto_ablkcipher *)tfm;
901 }
902
903 static inline u32 crypto_skcipher_type(u32 type)
904 {
905 type &= ~CRYPTO_ALG_TYPE_MASK;
906 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
907 return type;
908 }
909
910 static inline u32 crypto_skcipher_mask(u32 mask)
911 {
912 mask &= ~CRYPTO_ALG_TYPE_MASK;
913 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
914 return mask;
915 }
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947 static inline struct crypto_tfm *crypto_ablkcipher_tfm(
948 struct crypto_ablkcipher *tfm)
949 {
950 return &tfm->base;
951 }
952
953
954
955
956
957 static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
958 {
959 crypto_free_tfm(crypto_ablkcipher_tfm(tfm));
960 }
961
962
963
964
965
966
967
968
969
970
971
972 static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
973 u32 mask)
974 {
975 return crypto_has_alg(alg_name, crypto_skcipher_type(type),
976 crypto_skcipher_mask(mask));
977 }
978
979 static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(
980 struct crypto_ablkcipher *tfm)
981 {
982 return &crypto_ablkcipher_tfm(tfm)->crt_ablkcipher;
983 }
984
985
986
987
988
989
990
991
992
993
994 static inline unsigned int crypto_ablkcipher_ivsize(
995 struct crypto_ablkcipher *tfm)
996 {
997 return crypto_ablkcipher_crt(tfm)->ivsize;
998 }
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010 static inline unsigned int crypto_ablkcipher_blocksize(
1011 struct crypto_ablkcipher *tfm)
1012 {
1013 return crypto_tfm_alg_blocksize(crypto_ablkcipher_tfm(tfm));
1014 }
1015
1016 static inline unsigned int crypto_ablkcipher_alignmask(
1017 struct crypto_ablkcipher *tfm)
1018 {
1019 return crypto_tfm_alg_alignmask(crypto_ablkcipher_tfm(tfm));
1020 }
1021
1022 static inline u32 crypto_ablkcipher_get_flags(struct crypto_ablkcipher *tfm)
1023 {
1024 return crypto_tfm_get_flags(crypto_ablkcipher_tfm(tfm));
1025 }
1026
1027 static inline void crypto_ablkcipher_set_flags(struct crypto_ablkcipher *tfm,
1028 u32 flags)
1029 {
1030 crypto_tfm_set_flags(crypto_ablkcipher_tfm(tfm), flags);
1031 }
1032
1033 static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm,
1034 u32 flags)
1035 {
1036 crypto_tfm_clear_flags(crypto_ablkcipher_tfm(tfm), flags);
1037 }
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055 static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
1056 const u8 *key, unsigned int keylen)
1057 {
1058 struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
1059
1060 return crt->setkey(crt->base, key, keylen);
1061 }
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072 static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
1073 struct ablkcipher_request *req)
1074 {
1075 return __crypto_ablkcipher_cast(req->base.tfm);
1076 }
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089 static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
1090 {
1091 struct ablkcipher_tfm *crt =
1092 crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
1093 struct crypto_alg *alg = crt->base->base.__crt_alg;
1094 unsigned int nbytes = req->nbytes;
1095 int ret;
1096
1097 crypto_stats_get(alg);
1098 ret = crt->encrypt(req);
1099 crypto_stats_ablkcipher_encrypt(nbytes, ret, alg);
1100 return ret;
1101 }
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114 static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
1115 {
1116 struct ablkcipher_tfm *crt =
1117 crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
1118 struct crypto_alg *alg = crt->base->base.__crt_alg;
1119 unsigned int nbytes = req->nbytes;
1120 int ret;
1121
1122 crypto_stats_get(alg);
1123 ret = crt->decrypt(req);
1124 crypto_stats_ablkcipher_decrypt(nbytes, ret, alg);
1125 return ret;
1126 }
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145 static inline unsigned int crypto_ablkcipher_reqsize(
1146 struct crypto_ablkcipher *tfm)
1147 {
1148 return crypto_ablkcipher_crt(tfm)->reqsize;
1149 }
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159 static inline void ablkcipher_request_set_tfm(
1160 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
1161 {
1162 req->base.tfm = crypto_ablkcipher_tfm(crypto_ablkcipher_crt(tfm)->base);
1163 }
1164
1165 static inline struct ablkcipher_request *ablkcipher_request_cast(
1166 struct crypto_async_request *req)
1167 {
1168 return container_of(req, struct ablkcipher_request, base);
1169 }
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182 static inline struct ablkcipher_request *ablkcipher_request_alloc(
1183 struct crypto_ablkcipher *tfm, gfp_t gfp)
1184 {
1185 struct ablkcipher_request *req;
1186
1187 req = kmalloc(sizeof(struct ablkcipher_request) +
1188 crypto_ablkcipher_reqsize(tfm), gfp);
1189
1190 if (likely(req))
1191 ablkcipher_request_set_tfm(req, tfm);
1192
1193 return req;
1194 }
1195
1196
1197
1198
1199
1200 static inline void ablkcipher_request_free(struct ablkcipher_request *req)
1201 {
1202 kzfree(req);
1203 }
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230 static inline void ablkcipher_request_set_callback(
1231 struct ablkcipher_request *req,
1232 u32 flags, crypto_completion_t compl, void *data)
1233 {
1234 req->base.complete = compl;
1235 req->base.data = data;
1236 req->base.flags = flags;
1237 }
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255 static inline void ablkcipher_request_set_crypt(
1256 struct ablkcipher_request *req,
1257 struct scatterlist *src, struct scatterlist *dst,
1258 unsigned int nbytes, void *iv)
1259 {
1260 req->src = src;
1261 req->dst = dst;
1262 req->nbytes = nbytes;
1263 req->info = iv;
1264 }
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296 static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
1297 struct crypto_tfm *tfm)
1298 {
1299 return (struct crypto_blkcipher *)tfm;
1300 }
1301
1302 static inline struct crypto_blkcipher *crypto_blkcipher_cast(
1303 struct crypto_tfm *tfm)
1304 {
1305 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_BLKCIPHER);
1306 return __crypto_blkcipher_cast(tfm);
1307 }
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323 static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
1324 const char *alg_name, u32 type, u32 mask)
1325 {
1326 type &= ~CRYPTO_ALG_TYPE_MASK;
1327 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
1328 mask |= CRYPTO_ALG_TYPE_MASK;
1329
1330 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
1331 }
1332
1333 static inline struct crypto_tfm *crypto_blkcipher_tfm(
1334 struct crypto_blkcipher *tfm)
1335 {
1336 return &tfm->base;
1337 }
1338
1339
1340
1341
1342
1343 static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
1344 {
1345 crypto_free_tfm(crypto_blkcipher_tfm(tfm));
1346 }
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358 static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
1359 {
1360 type &= ~CRYPTO_ALG_TYPE_MASK;
1361 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
1362 mask |= CRYPTO_ALG_TYPE_MASK;
1363
1364 return crypto_has_alg(alg_name, type, mask);
1365 }
1366
1367
1368
1369
1370
1371
1372
1373 static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm)
1374 {
1375 return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm));
1376 }
1377
1378 static inline struct blkcipher_tfm *crypto_blkcipher_crt(
1379 struct crypto_blkcipher *tfm)
1380 {
1381 return &crypto_blkcipher_tfm(tfm)->crt_blkcipher;
1382 }
1383
1384 static inline struct blkcipher_alg *crypto_blkcipher_alg(
1385 struct crypto_blkcipher *tfm)
1386 {
1387 return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher;
1388 }
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399 static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm)
1400 {
1401 return crypto_blkcipher_alg(tfm)->ivsize;
1402 }
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414 static inline unsigned int crypto_blkcipher_blocksize(
1415 struct crypto_blkcipher *tfm)
1416 {
1417 return crypto_tfm_alg_blocksize(crypto_blkcipher_tfm(tfm));
1418 }
1419
1420 static inline unsigned int crypto_blkcipher_alignmask(
1421 struct crypto_blkcipher *tfm)
1422 {
1423 return crypto_tfm_alg_alignmask(crypto_blkcipher_tfm(tfm));
1424 }
1425
1426 static inline u32 crypto_blkcipher_get_flags(struct crypto_blkcipher *tfm)
1427 {
1428 return crypto_tfm_get_flags(crypto_blkcipher_tfm(tfm));
1429 }
1430
1431 static inline void crypto_blkcipher_set_flags(struct crypto_blkcipher *tfm,
1432 u32 flags)
1433 {
1434 crypto_tfm_set_flags(crypto_blkcipher_tfm(tfm), flags);
1435 }
1436
1437 static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm,
1438 u32 flags)
1439 {
1440 crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags);
1441 }
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459 static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm,
1460 const u8 *key, unsigned int keylen)
1461 {
1462 return crypto_blkcipher_crt(tfm)->setkey(crypto_blkcipher_tfm(tfm),
1463 key, keylen);
1464 }
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484 static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
1485 struct scatterlist *dst,
1486 struct scatterlist *src,
1487 unsigned int nbytes)
1488 {
1489 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
1490 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
1491 }
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512 static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
1513 struct scatterlist *dst,
1514 struct scatterlist *src,
1515 unsigned int nbytes)
1516 {
1517 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
1518 }
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537 static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
1538 struct scatterlist *dst,
1539 struct scatterlist *src,
1540 unsigned int nbytes)
1541 {
1542 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
1543 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
1544 }
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562 static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
1563 struct scatterlist *dst,
1564 struct scatterlist *src,
1565 unsigned int nbytes)
1566 {
1567 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
1568 }
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579 static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm,
1580 const u8 *src, unsigned int len)
1581 {
1582 memcpy(crypto_blkcipher_crt(tfm)->iv, src, len);
1583 }
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595 static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm,
1596 u8 *dst, unsigned int len)
1597 {
1598 memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len);
1599 }
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618 static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm)
1619 {
1620 return (struct crypto_cipher *)tfm;
1621 }
1622
1623 static inline struct crypto_cipher *crypto_cipher_cast(struct crypto_tfm *tfm)
1624 {
1625 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
1626 return __crypto_cipher_cast(tfm);
1627 }
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643 static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
1644 u32 type, u32 mask)
1645 {
1646 type &= ~CRYPTO_ALG_TYPE_MASK;
1647 type |= CRYPTO_ALG_TYPE_CIPHER;
1648 mask |= CRYPTO_ALG_TYPE_MASK;
1649
1650 return __crypto_cipher_cast(crypto_alloc_base(alg_name, type, mask));
1651 }
1652
1653 static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
1654 {
1655 return &tfm->base;
1656 }
1657
1658
1659
1660
1661
1662 static inline void crypto_free_cipher(struct crypto_cipher *tfm)
1663 {
1664 crypto_free_tfm(crypto_cipher_tfm(tfm));
1665 }
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677 static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask)
1678 {
1679 type &= ~CRYPTO_ALG_TYPE_MASK;
1680 type |= CRYPTO_ALG_TYPE_CIPHER;
1681 mask |= CRYPTO_ALG_TYPE_MASK;
1682
1683 return crypto_has_alg(alg_name, type, mask);
1684 }
1685
1686 static inline struct cipher_tfm *crypto_cipher_crt(struct crypto_cipher *tfm)
1687 {
1688 return &crypto_cipher_tfm(tfm)->crt_cipher;
1689 }
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701 static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm)
1702 {
1703 return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm));
1704 }
1705
1706 static inline unsigned int crypto_cipher_alignmask(struct crypto_cipher *tfm)
1707 {
1708 return crypto_tfm_alg_alignmask(crypto_cipher_tfm(tfm));
1709 }
1710
1711 static inline u32 crypto_cipher_get_flags(struct crypto_cipher *tfm)
1712 {
1713 return crypto_tfm_get_flags(crypto_cipher_tfm(tfm));
1714 }
1715
1716 static inline void crypto_cipher_set_flags(struct crypto_cipher *tfm,
1717 u32 flags)
1718 {
1719 crypto_tfm_set_flags(crypto_cipher_tfm(tfm), flags);
1720 }
1721
1722 static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm,
1723 u32 flags)
1724 {
1725 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags);
1726 }
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744 static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
1745 const u8 *key, unsigned int keylen)
1746 {
1747 return crypto_cipher_crt(tfm)->cit_setkey(crypto_cipher_tfm(tfm),
1748 key, keylen);
1749 }
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760 static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
1761 u8 *dst, const u8 *src)
1762 {
1763 crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm),
1764 dst, src);
1765 }
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776 static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
1777 u8 *dst, const u8 *src)
1778 {
1779 crypto_cipher_crt(tfm)->cit_decrypt_one(crypto_cipher_tfm(tfm),
1780 dst, src);
1781 }
1782
1783 static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm)
1784 {
1785 return (struct crypto_comp *)tfm;
1786 }
1787
1788 static inline struct crypto_comp *crypto_comp_cast(struct crypto_tfm *tfm)
1789 {
1790 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_COMPRESS) &
1791 CRYPTO_ALG_TYPE_MASK);
1792 return __crypto_comp_cast(tfm);
1793 }
1794
1795 static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,
1796 u32 type, u32 mask)
1797 {
1798 type &= ~CRYPTO_ALG_TYPE_MASK;
1799 type |= CRYPTO_ALG_TYPE_COMPRESS;
1800 mask |= CRYPTO_ALG_TYPE_MASK;
1801
1802 return __crypto_comp_cast(crypto_alloc_base(alg_name, type, mask));
1803 }
1804
1805 static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
1806 {
1807 return &tfm->base;
1808 }
1809
1810 static inline void crypto_free_comp(struct crypto_comp *tfm)
1811 {
1812 crypto_free_tfm(crypto_comp_tfm(tfm));
1813 }
1814
1815 static inline int crypto_has_comp(const char *alg_name, u32 type, u32 mask)
1816 {
1817 type &= ~CRYPTO_ALG_TYPE_MASK;
1818 type |= CRYPTO_ALG_TYPE_COMPRESS;
1819 mask |= CRYPTO_ALG_TYPE_MASK;
1820
1821 return crypto_has_alg(alg_name, type, mask);
1822 }
1823
1824 static inline const char *crypto_comp_name(struct crypto_comp *tfm)
1825 {
1826 return crypto_tfm_alg_name(crypto_comp_tfm(tfm));
1827 }
1828
1829 static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm)
1830 {
1831 return &crypto_comp_tfm(tfm)->crt_compress;
1832 }
1833
1834 static inline int crypto_comp_compress(struct crypto_comp *tfm,
1835 const u8 *src, unsigned int slen,
1836 u8 *dst, unsigned int *dlen)
1837 {
1838 return crypto_comp_crt(tfm)->cot_compress(crypto_comp_tfm(tfm),
1839 src, slen, dst, dlen);
1840 }
1841
1842 static inline int crypto_comp_decompress(struct crypto_comp *tfm,
1843 const u8 *src, unsigned int slen,
1844 u8 *dst, unsigned int *dlen)
1845 {
1846 return crypto_comp_crt(tfm)->cot_decompress(crypto_comp_tfm(tfm),
1847 src, slen, dst, dlen);
1848 }
1849
1850 #endif
1851