diff options
Diffstat (limited to 'crypto/rng.c')
-rw-r--r-- | crypto/rng.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/crypto/rng.c b/crypto/rng.c index f93cb5311182..64f864fa8043 100644 --- a/crypto/rng.c +++ b/crypto/rng.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <asm/atomic.h> | 15 | #include <linux/atomic.h> |
16 | #include <crypto/internal/rng.h> | 16 | #include <crypto/internal/rng.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/string.h> | 23 | #include <linux/string.h> |
24 | #include <linux/cryptouser.h> | ||
25 | #include <net/netlink.h> | ||
24 | 26 | ||
25 | static DEFINE_MUTEX(crypto_default_rng_lock); | 27 | static DEFINE_MUTEX(crypto_default_rng_lock); |
26 | struct crypto_rng *crypto_default_rng; | 28 | struct crypto_rng *crypto_default_rng; |
@@ -58,6 +60,30 @@ static int crypto_init_rng_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
58 | return 0; | 60 | return 0; |
59 | } | 61 | } |
60 | 62 | ||
63 | #ifdef CONFIG_NET | ||
64 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
65 | { | ||
66 | struct crypto_report_rng rrng; | ||
67 | |||
68 | snprintf(rrng.type, CRYPTO_MAX_ALG_NAME, "%s", "rng"); | ||
69 | |||
70 | rrng.seedsize = alg->cra_rng.seedsize; | ||
71 | |||
72 | NLA_PUT(skb, CRYPTOCFGA_REPORT_RNG, | ||
73 | sizeof(struct crypto_report_rng), &rrng); | ||
74 | |||
75 | return 0; | ||
76 | |||
77 | nla_put_failure: | ||
78 | return -EMSGSIZE; | ||
79 | } | ||
80 | #else | ||
81 | static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
82 | { | ||
83 | return -ENOSYS; | ||
84 | } | ||
85 | #endif | ||
86 | |||
61 | 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) |
62 | __attribute__ ((unused)); | 88 | __attribute__ ((unused)); |
63 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) | 89 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) |
@@ -78,6 +104,7 @@ const struct crypto_type crypto_rng_type = { | |||
78 | #ifdef CONFIG_PROC_FS | 104 | #ifdef CONFIG_PROC_FS |
79 | .show = crypto_rng_show, | 105 | .show = crypto_rng_show, |
80 | #endif | 106 | #endif |
107 | .report = crypto_rng_report, | ||
81 | }; | 108 | }; |
82 | EXPORT_SYMBOL_GPL(crypto_rng_type); | 109 | EXPORT_SYMBOL_GPL(crypto_rng_type); |
83 | 110 | ||