diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/Kconfig | 2 | ||||
-rw-r--r-- | crypto/ablkcipher.c | 14 | ||||
-rw-r--r-- | crypto/aead.c | 14 | ||||
-rw-r--r-- | crypto/ahash.c | 7 | ||||
-rw-r--r-- | crypto/algapi.c | 35 | ||||
-rw-r--r-- | crypto/blkcipher.c | 7 | ||||
-rw-r--r-- | crypto/crypto_user.c | 5 | ||||
-rw-r--r-- | crypto/pcompress.c | 7 | ||||
-rw-r--r-- | crypto/rng.c | 7 | ||||
-rw-r--r-- | crypto/shash.c | 7 |
10 files changed, 99 insertions, 6 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index 7ae0d0f6d753..e6cfe1a25137 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -327,7 +327,6 @@ config CRYPTO_CRC32C_INTEL | |||
327 | 327 | ||
328 | config CRYPTO_GHASH | 328 | config CRYPTO_GHASH |
329 | tristate "GHASH digest algorithm" | 329 | tristate "GHASH digest algorithm" |
330 | select CRYPTO_SHASH | ||
331 | select CRYPTO_GF128MUL | 330 | select CRYPTO_GF128MUL |
332 | help | 331 | help |
333 | GHASH is message digest algorithm for GCM (Galois/Counter Mode). | 332 | GHASH is message digest algorithm for GCM (Galois/Counter Mode). |
@@ -475,7 +474,6 @@ config CRYPTO_WP512 | |||
475 | config CRYPTO_GHASH_CLMUL_NI_INTEL | 474 | config CRYPTO_GHASH_CLMUL_NI_INTEL |
476 | tristate "GHASH digest algorithm (CLMUL-NI accelerated)" | 475 | tristate "GHASH digest algorithm (CLMUL-NI accelerated)" |
477 | depends on X86 && 64BIT | 476 | depends on X86 && 64BIT |
478 | select CRYPTO_SHASH | ||
479 | select CRYPTO_CRYPTD | 477 | select CRYPTO_CRYPTD |
480 | help | 478 | help |
481 | GHASH is message digest algorithm for GCM (Galois/Counter Mode). | 479 | GHASH is message digest algorithm for GCM (Galois/Counter Mode). |
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index a816f24f2d52..a0f768c1d9aa 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
@@ -383,6 +383,7 @@ static int crypto_init_ablkcipher_ops(struct crypto_tfm *tfm, u32 type, | |||
383 | return 0; | 383 | return 0; |
384 | } | 384 | } |
385 | 385 | ||
386 | #ifdef CONFIG_NET | ||
386 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | 387 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
387 | { | 388 | { |
388 | struct crypto_report_blkcipher rblkcipher; | 389 | struct crypto_report_blkcipher rblkcipher; |
@@ -404,6 +405,12 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
404 | nla_put_failure: | 405 | nla_put_failure: |
405 | return -EMSGSIZE; | 406 | return -EMSGSIZE; |
406 | } | 407 | } |
408 | #else | ||
409 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
410 | { | ||
411 | return -ENOSYS; | ||
412 | } | ||
413 | #endif | ||
407 | 414 | ||
408 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 415 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
409 | __attribute__ ((unused)); | 416 | __attribute__ ((unused)); |
@@ -457,6 +464,7 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type, | |||
457 | return 0; | 464 | return 0; |
458 | } | 465 | } |
459 | 466 | ||
467 | #ifdef CONFIG_NET | ||
460 | static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | 468 | static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
461 | { | 469 | { |
462 | struct crypto_report_blkcipher rblkcipher; | 470 | struct crypto_report_blkcipher rblkcipher; |
@@ -478,6 +486,12 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
478 | nla_put_failure: | 486 | nla_put_failure: |
479 | return -EMSGSIZE; | 487 | return -EMSGSIZE; |
480 | } | 488 | } |
489 | #else | ||
490 | static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
491 | { | ||
492 | return -ENOSYS; | ||
493 | } | ||
494 | #endif | ||
481 | 495 | ||
482 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) | 496 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) |
483 | __attribute__ ((unused)); | 497 | __attribute__ ((unused)); |
diff --git a/crypto/aead.c b/crypto/aead.c index 701556ffaaef..04add3dca6fe 100644 --- a/crypto/aead.c +++ b/crypto/aead.c | |||
@@ -111,6 +111,7 @@ static int crypto_init_aead_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | #ifdef CONFIG_NET | ||
114 | static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | 115 | static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) |
115 | { | 116 | { |
116 | struct crypto_report_aead raead; | 117 | struct crypto_report_aead raead; |
@@ -132,6 +133,12 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
132 | nla_put_failure: | 133 | nla_put_failure: |
133 | return -EMSGSIZE; | 134 | return -EMSGSIZE; |
134 | } | 135 | } |
136 | #else | ||
137 | static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
138 | { | ||
139 | return -ENOSYS; | ||
140 | } | ||
141 | #endif | ||
135 | 142 | ||
136 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) | 143 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) |
137 | __attribute__ ((unused)); | 144 | __attribute__ ((unused)); |
@@ -190,6 +197,7 @@ static int crypto_init_nivaead_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
190 | return 0; | 197 | return 0; |
191 | } | 198 | } |
192 | 199 | ||
200 | #ifdef CONFIG_NET | ||
193 | static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | 201 | static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) |
194 | { | 202 | { |
195 | struct crypto_report_aead raead; | 203 | struct crypto_report_aead raead; |
@@ -210,6 +218,12 @@ static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
210 | nla_put_failure: | 218 | nla_put_failure: |
211 | return -EMSGSIZE; | 219 | return -EMSGSIZE; |
212 | } | 220 | } |
221 | #else | ||
222 | static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
223 | { | ||
224 | return -ENOSYS; | ||
225 | } | ||
226 | #endif | ||
213 | 227 | ||
214 | 228 | ||
215 | static void crypto_nivaead_show(struct seq_file *m, struct crypto_alg *alg) | 229 | static void crypto_nivaead_show(struct seq_file *m, struct crypto_alg *alg) |
diff --git a/crypto/ahash.c b/crypto/ahash.c index a3e6ef99394a..ac93c99cfae8 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
@@ -399,6 +399,7 @@ static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) | |||
399 | return sizeof(struct crypto_shash *); | 399 | return sizeof(struct crypto_shash *); |
400 | } | 400 | } |
401 | 401 | ||
402 | #ifdef CONFIG_NET | ||
402 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | 403 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) |
403 | { | 404 | { |
404 | struct crypto_report_hash rhash; | 405 | struct crypto_report_hash rhash; |
@@ -416,6 +417,12 @@ static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
416 | nla_put_failure: | 417 | nla_put_failure: |
417 | return -EMSGSIZE; | 418 | return -EMSGSIZE; |
418 | } | 419 | } |
420 | #else | ||
421 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
422 | { | ||
423 | return -ENOSYS; | ||
424 | } | ||
425 | #endif | ||
419 | 426 | ||
420 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | 427 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) |
421 | __attribute__ ((unused)); | 428 | __attribute__ ((unused)); |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 9d4a9fe913f8..056571b85445 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -405,6 +405,41 @@ int crypto_unregister_alg(struct crypto_alg *alg) | |||
405 | } | 405 | } |
406 | EXPORT_SYMBOL_GPL(crypto_unregister_alg); | 406 | EXPORT_SYMBOL_GPL(crypto_unregister_alg); |
407 | 407 | ||
408 | int crypto_register_algs(struct crypto_alg *algs, int count) | ||
409 | { | ||
410 | int i, ret; | ||
411 | |||
412 | for (i = 0; i < count; i++) { | ||
413 | ret = crypto_register_alg(&algs[i]); | ||
414 | if (ret) | ||
415 | goto err; | ||
416 | } | ||
417 | |||
418 | return 0; | ||
419 | |||
420 | err: | ||
421 | for (--i; i >= 0; --i) | ||
422 | crypto_unregister_alg(&algs[i]); | ||
423 | |||
424 | return ret; | ||
425 | } | ||
426 | EXPORT_SYMBOL_GPL(crypto_register_algs); | ||
427 | |||
428 | int crypto_unregister_algs(struct crypto_alg *algs, int count) | ||
429 | { | ||
430 | int i, ret; | ||
431 | |||
432 | for (i = 0; i < count; i++) { | ||
433 | ret = crypto_unregister_alg(&algs[i]); | ||
434 | if (ret) | ||
435 | pr_err("Failed to unregister %s %s: %d\n", | ||
436 | algs[i].cra_driver_name, algs[i].cra_name, ret); | ||
437 | } | ||
438 | |||
439 | return 0; | ||
440 | } | ||
441 | EXPORT_SYMBOL_GPL(crypto_unregister_algs); | ||
442 | |||
408 | int crypto_register_template(struct crypto_template *tmpl) | 443 | int crypto_register_template(struct crypto_template *tmpl) |
409 | { | 444 | { |
410 | struct crypto_template *q; | 445 | struct crypto_template *q; |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 2572d2600136..1e61d1a888b2 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -494,6 +494,7 @@ static int crypto_init_blkcipher_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
494 | return crypto_init_blkcipher_ops_async(tfm); | 494 | return crypto_init_blkcipher_ops_async(tfm); |
495 | } | 495 | } |
496 | 496 | ||
497 | #ifdef CONFIG_NET | ||
497 | static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | 498 | static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
498 | { | 499 | { |
499 | struct crypto_report_blkcipher rblkcipher; | 500 | struct crypto_report_blkcipher rblkcipher; |
@@ -515,6 +516,12 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
515 | nla_put_failure: | 516 | nla_put_failure: |
516 | return -EMSGSIZE; | 517 | return -EMSGSIZE; |
517 | } | 518 | } |
519 | #else | ||
520 | static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
521 | { | ||
522 | return -ENOSYS; | ||
523 | } | ||
524 | #endif | ||
518 | 525 | ||
519 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 526 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
520 | __attribute__ ((unused)); | 527 | __attribute__ ((unused)); |
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index edeebe1a84bb..3e61cc101e83 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
@@ -44,9 +44,6 @@ static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) | |||
44 | 44 | ||
45 | down_read(&crypto_alg_sem); | 45 | down_read(&crypto_alg_sem); |
46 | 46 | ||
47 | if (list_empty(&crypto_alg_list)) | ||
48 | return NULL; | ||
49 | |||
50 | list_for_each_entry(q, &crypto_alg_list, cra_list) { | 47 | list_for_each_entry(q, &crypto_alg_list, cra_list) { |
51 | int match = 0; | 48 | int match = 0; |
52 | 49 | ||
@@ -307,7 +304,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
307 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | 304 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, |
308 | struct nlattr **attrs) | 305 | struct nlattr **attrs) |
309 | { | 306 | { |
310 | int exact; | 307 | int exact = 0; |
311 | const char *name; | 308 | const char *name; |
312 | struct crypto_alg *alg; | 309 | struct crypto_alg *alg; |
313 | struct crypto_user_alg *p = nlmsg_data(nlh); | 310 | struct crypto_user_alg *p = nlmsg_data(nlh); |
diff --git a/crypto/pcompress.c b/crypto/pcompress.c index fefda78a6a2a..2e458e5482d0 100644 --- a/crypto/pcompress.c +++ b/crypto/pcompress.c | |||
@@ -48,6 +48,7 @@ static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm) | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | #ifdef CONFIG_NET | ||
51 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | 52 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) |
52 | { | 53 | { |
53 | struct crypto_report_comp rpcomp; | 54 | struct crypto_report_comp rpcomp; |
@@ -62,6 +63,12 @@ static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
62 | nla_put_failure: | 63 | nla_put_failure: |
63 | return -EMSGSIZE; | 64 | return -EMSGSIZE; |
64 | } | 65 | } |
66 | #else | ||
67 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
68 | { | ||
69 | return -ENOSYS; | ||
70 | } | ||
71 | #endif | ||
65 | 72 | ||
66 | static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg) | 73 | static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg) |
67 | __attribute__ ((unused)); | 74 | __attribute__ ((unused)); |
diff --git a/crypto/rng.c b/crypto/rng.c index feb7de00f437..64f864fa8043 100644 --- a/crypto/rng.c +++ b/crypto/rng.c | |||
@@ -60,6 +60,7 @@ static int crypto_init_rng_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | #ifdef CONFIG_NET | ||
63 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | 64 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) |
64 | { | 65 | { |
65 | struct crypto_report_rng rrng; | 66 | struct crypto_report_rng rrng; |
@@ -76,6 +77,12 @@ static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
76 | nla_put_failure: | 77 | nla_put_failure: |
77 | return -EMSGSIZE; | 78 | return -EMSGSIZE; |
78 | } | 79 | } |
80 | #else | ||
81 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
82 | { | ||
83 | return -ENOSYS; | ||
84 | } | ||
85 | #endif | ||
79 | 86 | ||
80 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) | 87 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) |
81 | __attribute__ ((unused)); | 88 | __attribute__ ((unused)); |
diff --git a/crypto/shash.c b/crypto/shash.c index ea8a9c6e21e3..9100912716ae 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
@@ -524,6 +524,7 @@ static unsigned int crypto_shash_extsize(struct crypto_alg *alg) | |||
524 | return alg->cra_ctxsize; | 524 | return alg->cra_ctxsize; |
525 | } | 525 | } |
526 | 526 | ||
527 | #ifdef CONFIG_NET | ||
527 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | 528 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) |
528 | { | 529 | { |
529 | struct crypto_report_hash rhash; | 530 | struct crypto_report_hash rhash; |
@@ -541,6 +542,12 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
541 | nla_put_failure: | 542 | nla_put_failure: |
542 | return -EMSGSIZE; | 543 | return -EMSGSIZE; |
543 | } | 544 | } |
545 | #else | ||
546 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
547 | { | ||
548 | return -ENOSYS; | ||
549 | } | ||
550 | #endif | ||
544 | 551 | ||
545 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 552 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
546 | __attribute__ ((unused)); | 553 | __attribute__ ((unused)); |