Skip to content

Commit c0f9e01

Browse files
committed
crypto: api - Check CRYPTO_USER instead of NET for report
The report function is currently conditionalised on CONFIG_NET. As it's only used by CONFIG_CRYPTO_USER, conditionalising on that instead of CONFIG_NET makes more sense. This gets rid of a rarely used code-path. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 0c0edf6 commit c0f9e01

File tree

9 files changed

+36
-72
lines changed

9 files changed

+36
-72
lines changed

crypto/acompress.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ static inline struct acomp_alg *crypto_acomp_alg(struct crypto_acomp *tfm)
3333
return __crypto_acomp_alg(crypto_acomp_tfm(tfm)->__crt_alg);
3434
}
3535

36-
#ifdef CONFIG_NET
37-
static int crypto_acomp_report(struct sk_buff *skb, struct crypto_alg *alg)
36+
static int __maybe_unused crypto_acomp_report(
37+
struct sk_buff *skb, struct crypto_alg *alg)
3838
{
3939
struct crypto_report_acomp racomp;
4040

@@ -44,12 +44,6 @@ static int crypto_acomp_report(struct sk_buff *skb, struct crypto_alg *alg)
4444

4545
return nla_put(skb, CRYPTOCFGA_REPORT_ACOMP, sizeof(racomp), &racomp);
4646
}
47-
#else
48-
static int crypto_acomp_report(struct sk_buff *skb, struct crypto_alg *alg)
49-
{
50-
return -ENOSYS;
51-
}
52-
#endif
5347

5448
static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
5549
__maybe_unused;
@@ -131,7 +125,9 @@ static const struct crypto_type crypto_acomp_type = {
131125
#ifdef CONFIG_PROC_FS
132126
.show = crypto_acomp_show,
133127
#endif
128+
#ifdef CONFIG_CRYPTO_USER
134129
.report = crypto_acomp_report,
130+
#endif
135131
#ifdef CONFIG_CRYPTO_STATS
136132
.report_stat = crypto_acomp_report_stat,
137133
#endif

crypto/aead.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ static int crypto_aead_init_tfm(struct crypto_tfm *tfm)
175175
return 0;
176176
}
177177

178-
#ifdef CONFIG_NET
179-
static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg)
178+
static int __maybe_unused crypto_aead_report(
179+
struct sk_buff *skb, struct crypto_alg *alg)
180180
{
181181
struct crypto_report_aead raead;
182182
struct aead_alg *aead = container_of(alg, struct aead_alg, base);
@@ -192,12 +192,6 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg)
192192

193193
return nla_put(skb, CRYPTOCFGA_REPORT_AEAD, sizeof(raead), &raead);
194194
}
195-
#else
196-
static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg)
197-
{
198-
return -ENOSYS;
199-
}
200-
#endif
201195

202196
static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
203197
__maybe_unused;
@@ -248,7 +242,9 @@ static const struct crypto_type crypto_aead_type = {
248242
#ifdef CONFIG_PROC_FS
249243
.show = crypto_aead_show,
250244
#endif
245+
#ifdef CONFIG_CRYPTO_USER
251246
.report = crypto_aead_report,
247+
#endif
252248
#ifdef CONFIG_CRYPTO_STATS
253249
.report_stat = crypto_aead_report_stat,
254250
#endif

crypto/ahash.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ static void crypto_ahash_free_instance(struct crypto_instance *inst)
469469
ahash->free(ahash);
470470
}
471471

472-
#ifdef CONFIG_NET
473-
static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg)
472+
static int __maybe_unused crypto_ahash_report(
473+
struct sk_buff *skb, struct crypto_alg *alg)
474474
{
475475
struct crypto_report_hash rhash;
476476

@@ -483,12 +483,6 @@ static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg)
483483

484484
return nla_put(skb, CRYPTOCFGA_REPORT_HASH, sizeof(rhash), &rhash);
485485
}
486-
#else
487-
static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg)
488-
{
489-
return -ENOSYS;
490-
}
491-
#endif
492486

493487
static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
494488
__maybe_unused;
@@ -515,7 +509,9 @@ static const struct crypto_type crypto_ahash_type = {
515509
#ifdef CONFIG_PROC_FS
516510
.show = crypto_ahash_show,
517511
#endif
512+
#ifdef CONFIG_CRYPTO_USER
518513
.report = crypto_ahash_report,
514+
#endif
519515
#ifdef CONFIG_CRYPTO_STATS
520516
.report_stat = crypto_ahash_report_stat,
521517
#endif

crypto/akcipher.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
#include "internal.h"
1919

20-
#ifdef CONFIG_NET
21-
static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
20+
static int __maybe_unused crypto_akcipher_report(
21+
struct sk_buff *skb, struct crypto_alg *alg)
2222
{
2323
struct crypto_report_akcipher rakcipher;
2424

@@ -29,12 +29,6 @@ static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
2929
return nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER,
3030
sizeof(rakcipher), &rakcipher);
3131
}
32-
#else
33-
static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
34-
{
35-
return -ENOSYS;
36-
}
37-
#endif
3832

3933
static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg)
4034
__maybe_unused;
@@ -104,7 +98,9 @@ static const struct crypto_type crypto_akcipher_type = {
10498
#ifdef CONFIG_PROC_FS
10599
.show = crypto_akcipher_show,
106100
#endif
101+
#ifdef CONFIG_CRYPTO_USER
107102
.report = crypto_akcipher_report,
103+
#endif
108104
#ifdef CONFIG_CRYPTO_STATS
109105
.report_stat = crypto_akcipher_report_stat,
110106
#endif

crypto/kpp.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
#include "internal.h"
1919

20-
#ifdef CONFIG_NET
21-
static int crypto_kpp_report(struct sk_buff *skb, struct crypto_alg *alg)
20+
static int __maybe_unused crypto_kpp_report(
21+
struct sk_buff *skb, struct crypto_alg *alg)
2222
{
2323
struct crypto_report_kpp rkpp;
2424

@@ -28,12 +28,6 @@ static int crypto_kpp_report(struct sk_buff *skb, struct crypto_alg *alg)
2828

2929
return nla_put(skb, CRYPTOCFGA_REPORT_KPP, sizeof(rkpp), &rkpp);
3030
}
31-
#else
32-
static int crypto_kpp_report(struct sk_buff *skb, struct crypto_alg *alg)
33-
{
34-
return -ENOSYS;
35-
}
36-
#endif
3731

3832
static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg)
3933
__maybe_unused;
@@ -102,7 +96,9 @@ static const struct crypto_type crypto_kpp_type = {
10296
#ifdef CONFIG_PROC_FS
10397
.show = crypto_kpp_show,
10498
#endif
99+
#ifdef CONFIG_CRYPTO_USER
105100
.report = crypto_kpp_report,
101+
#endif
106102
#ifdef CONFIG_CRYPTO_STATS
107103
.report_stat = crypto_kpp_report_stat,
108104
#endif

crypto/rng.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ static unsigned int seedsize(struct crypto_alg *alg)
6969
return ralg->seedsize;
7070
}
7171

72-
#ifdef CONFIG_NET
73-
static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg)
72+
static int __maybe_unused crypto_rng_report(
73+
struct sk_buff *skb, struct crypto_alg *alg)
7474
{
7575
struct crypto_report_rng rrng;
7676

@@ -82,12 +82,6 @@ static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg)
8282

8383
return nla_put(skb, CRYPTOCFGA_REPORT_RNG, sizeof(rrng), &rrng);
8484
}
85-
#else
86-
static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg)
87-
{
88-
return -ENOSYS;
89-
}
90-
#endif
9185

9286
static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
9387
__maybe_unused;
@@ -124,7 +118,9 @@ static const struct crypto_type crypto_rng_type = {
124118
#ifdef CONFIG_PROC_FS
125119
.show = crypto_rng_show,
126120
#endif
121+
#ifdef CONFIG_CRYPTO_USER
127122
.report = crypto_rng_report,
123+
#endif
128124
#ifdef CONFIG_CRYPTO_STATS
129125
.report_stat = crypto_rng_report_stat,
130126
#endif

crypto/scompress.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ static const struct crypto_type crypto_scomp_type;
3737
static int scomp_scratch_users;
3838
static DEFINE_MUTEX(scomp_lock);
3939

40-
#ifdef CONFIG_NET
41-
static int crypto_scomp_report(struct sk_buff *skb, struct crypto_alg *alg)
40+
static int __maybe_unused crypto_scomp_report(
41+
struct sk_buff *skb, struct crypto_alg *alg)
4242
{
4343
struct crypto_report_comp rscomp;
4444

@@ -49,12 +49,6 @@ static int crypto_scomp_report(struct sk_buff *skb, struct crypto_alg *alg)
4949
return nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS,
5050
sizeof(rscomp), &rscomp);
5151
}
52-
#else
53-
static int crypto_scomp_report(struct sk_buff *skb, struct crypto_alg *alg)
54-
{
55-
return -ENOSYS;
56-
}
57-
#endif
5852

5953
static void crypto_scomp_show(struct seq_file *m, struct crypto_alg *alg)
6054
__maybe_unused;
@@ -246,7 +240,9 @@ static const struct crypto_type crypto_scomp_type = {
246240
#ifdef CONFIG_PROC_FS
247241
.show = crypto_scomp_show,
248242
#endif
243+
#ifdef CONFIG_CRYPTO_USER
249244
.report = crypto_scomp_report,
245+
#endif
250246
#ifdef CONFIG_CRYPTO_STATS
251247
.report_stat = crypto_acomp_report_stat,
252248
#endif

crypto/shash.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ static void crypto_shash_free_instance(struct crypto_instance *inst)
490490
shash->free(shash);
491491
}
492492

493-
#ifdef CONFIG_NET
494-
static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg)
493+
static int __maybe_unused crypto_shash_report(
494+
struct sk_buff *skb, struct crypto_alg *alg)
495495
{
496496
struct crypto_report_hash rhash;
497497
struct shash_alg *salg = __crypto_shash_alg(alg);
@@ -505,12 +505,6 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg)
505505

506506
return nla_put(skb, CRYPTOCFGA_REPORT_HASH, sizeof(rhash), &rhash);
507507
}
508-
#else
509-
static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg)
510-
{
511-
return -ENOSYS;
512-
}
513-
#endif
514508

515509
static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg)
516510
__maybe_unused;
@@ -536,7 +530,9 @@ static const struct crypto_type crypto_shash_type = {
536530
#ifdef CONFIG_PROC_FS
537531
.show = crypto_shash_show,
538532
#endif
533+
#ifdef CONFIG_CRYPTO_USER
539534
.report = crypto_shash_report,
535+
#endif
540536
#ifdef CONFIG_CRYPTO_STATS
541537
.report_stat = crypto_shash_report_stat,
542538
#endif

crypto/skcipher.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg)
727727
seq_printf(m, "walksize : %u\n", skcipher->walksize);
728728
}
729729

730-
#ifdef CONFIG_NET
731-
static int crypto_skcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
730+
static int __maybe_unused crypto_skcipher_report(
731+
struct sk_buff *skb, struct crypto_alg *alg)
732732
{
733733
struct skcipher_alg *skcipher = __crypto_skcipher_alg(alg);
734734
struct crypto_report_blkcipher rblkcipher;
@@ -746,12 +746,6 @@ static int crypto_skcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
746746
return nla_put(skb, CRYPTOCFGA_REPORT_BLKCIPHER,
747747
sizeof(rblkcipher), &rblkcipher);
748748
}
749-
#else
750-
static int crypto_skcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
751-
{
752-
return -ENOSYS;
753-
}
754-
#endif
755749

756750
static int __maybe_unused crypto_skcipher_report_stat(
757751
struct sk_buff *skb, struct crypto_alg *alg)
@@ -782,7 +776,9 @@ static const struct crypto_type crypto_skcipher_type = {
782776
#ifdef CONFIG_PROC_FS
783777
.show = crypto_skcipher_show,
784778
#endif
779+
#ifdef CONFIG_CRYPTO_USER
785780
.report = crypto_skcipher_report,
781+
#endif
786782
#ifdef CONFIG_CRYPTO_STATS
787783
.report_stat = crypto_skcipher_report_stat,
788784
#endif

0 commit comments

Comments
 (0)