diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2011-09-27 01:26:10 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-10-21 08:24:04 -0400 |
commit | f4d663ce6357e533f107ce3789bd8848c94bea81 (patch) | |
tree | dededa6ed501f8d6a0d141c4c94b72ec2395ea2c /crypto | |
parent | 6c5a86f529a9e9ca4c9aca5fa477e9557d4a3d3d (diff) |
crypto: Add userspace report for shash type algorithms
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/shash.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index 76f74b963151..ea8a9c6e21e3 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | #include <linux/cryptouser.h> | ||
21 | #include <net/netlink.h> | ||
20 | 22 | ||
21 | #include "internal.h" | 23 | #include "internal.h" |
22 | 24 | ||
@@ -522,6 +524,24 @@ static unsigned int crypto_shash_extsize(struct crypto_alg *alg) | |||
522 | return alg->cra_ctxsize; | 524 | return alg->cra_ctxsize; |
523 | } | 525 | } |
524 | 526 | ||
527 | static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
528 | { | ||
529 | struct crypto_report_hash rhash; | ||
530 | struct shash_alg *salg = __crypto_shash_alg(alg); | ||
531 | |||
532 | snprintf(rhash.type, CRYPTO_MAX_ALG_NAME, "%s", "shash"); | ||
533 | rhash.blocksize = alg->cra_blocksize; | ||
534 | rhash.digestsize = salg->digestsize; | ||
535 | |||
536 | NLA_PUT(skb, CRYPTOCFGA_REPORT_HASH, | ||
537 | sizeof(struct crypto_report_hash), &rhash); | ||
538 | |||
539 | return 0; | ||
540 | |||
541 | nla_put_failure: | ||
542 | return -EMSGSIZE; | ||
543 | } | ||
544 | |||
525 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 545 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
526 | __attribute__ ((unused)); | 546 | __attribute__ ((unused)); |
527 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 547 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
@@ -541,6 +561,7 @@ static const struct crypto_type crypto_shash_type = { | |||
541 | #ifdef CONFIG_PROC_FS | 561 | #ifdef CONFIG_PROC_FS |
542 | .show = crypto_shash_show, | 562 | .show = crypto_shash_show, |
543 | #endif | 563 | #endif |
564 | .report = crypto_shash_report, | ||
544 | .maskclear = ~CRYPTO_ALG_TYPE_MASK, | 565 | .maskclear = ~CRYPTO_ALG_TYPE_MASK, |
545 | .maskset = CRYPTO_ALG_TYPE_MASK, | 566 | .maskset = CRYPTO_ALG_TYPE_MASK, |
546 | .type = CRYPTO_ALG_TYPE_SHASH, | 567 | .type = CRYPTO_ALG_TYPE_SHASH, |