diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2011-09-27 01:41:07 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-10-21 08:24:04 -0400 |
commit | 6238cbaec429c98d1a280014839c934107c7c8f6 (patch) | |
tree | 8f81fe70579a08068cf8a90ad7a032e3c756b8a9 | |
parent | f4d663ce6357e533f107ce3789bd8848c94bea81 (diff) |
crypto: Add userspace report for ahash type algorithms
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/ahash.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c index f669822a7a44..a3e6ef99394a 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
24 | #include <linux/cryptouser.h> | ||
25 | #include <net/netlink.h> | ||
24 | 26 | ||
25 | #include "internal.h" | 27 | #include "internal.h" |
26 | 28 | ||
@@ -397,6 +399,24 @@ static unsigned int crypto_ahash_extsize(struct crypto_alg *alg) | |||
397 | return sizeof(struct crypto_shash *); | 399 | return sizeof(struct crypto_shash *); |
398 | } | 400 | } |
399 | 401 | ||
402 | static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
403 | { | ||
404 | struct crypto_report_hash rhash; | ||
405 | |||
406 | snprintf(rhash.type, CRYPTO_MAX_ALG_NAME, "%s", "ahash"); | ||
407 | |||
408 | rhash.blocksize = alg->cra_blocksize; | ||
409 | rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize; | ||
410 | |||
411 | NLA_PUT(skb, CRYPTOCFGA_REPORT_HASH, | ||
412 | sizeof(struct crypto_report_hash), &rhash); | ||
413 | |||
414 | return 0; | ||
415 | |||
416 | nla_put_failure: | ||
417 | return -EMSGSIZE; | ||
418 | } | ||
419 | |||
400 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | 420 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) |
401 | __attribute__ ((unused)); | 421 | __attribute__ ((unused)); |
402 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | 422 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) |
@@ -415,6 +435,7 @@ const struct crypto_type crypto_ahash_type = { | |||
415 | #ifdef CONFIG_PROC_FS | 435 | #ifdef CONFIG_PROC_FS |
416 | .show = crypto_ahash_show, | 436 | .show = crypto_ahash_show, |
417 | #endif | 437 | #endif |
438 | .report = crypto_ahash_report, | ||
418 | .maskclear = ~CRYPTO_ALG_TYPE_MASK, | 439 | .maskclear = ~CRYPTO_ALG_TYPE_MASK, |
419 | .maskset = CRYPTO_ALG_TYPE_AHASH_MASK, | 440 | .maskset = CRYPTO_ALG_TYPE_AHASH_MASK, |
420 | .type = CRYPTO_ALG_TYPE_AHASH, | 441 | .type = CRYPTO_ALG_TYPE_AHASH, |