diff options
Diffstat (limited to 'crypto/proc.c')
-rw-r--r-- | crypto/proc.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/crypto/proc.c b/crypto/proc.c index 02ff5670c158..37a13d05636d 100644 --- a/crypto/proc.c +++ b/crypto/proc.c | |||
@@ -19,8 +19,53 @@ | |||
19 | #include <linux/rwsem.h> | 19 | #include <linux/rwsem.h> |
20 | #include <linux/proc_fs.h> | 20 | #include <linux/proc_fs.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/sysctl.h> | ||
22 | #include "internal.h" | 23 | #include "internal.h" |
23 | 24 | ||
25 | #ifdef CONFIG_CRYPTO_FIPS | ||
26 | static struct ctl_table crypto_sysctl_table[] = { | ||
27 | { | ||
28 | .ctl_name = CTL_UNNUMBERED, | ||
29 | .procname = "fips_enabled", | ||
30 | .data = &fips_enabled, | ||
31 | .maxlen = sizeof(int), | ||
32 | .mode = 0444, | ||
33 | .proc_handler = &proc_dointvec | ||
34 | }, | ||
35 | { | ||
36 | .ctl_name = 0, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | static struct ctl_table crypto_dir_table[] = { | ||
41 | { | ||
42 | .ctl_name = CTL_UNNUMBERED, | ||
43 | .procname = "crypto", | ||
44 | .mode = 0555, | ||
45 | .child = crypto_sysctl_table | ||
46 | }, | ||
47 | { | ||
48 | .ctl_name = 0, | ||
49 | }, | ||
50 | }; | ||
51 | |||
52 | static struct ctl_table_header *crypto_sysctls; | ||
53 | |||
54 | static void crypto_proc_fips_init(void) | ||
55 | { | ||
56 | crypto_sysctls = register_sysctl_table(crypto_dir_table); | ||
57 | } | ||
58 | |||
59 | static void crypto_proc_fips_exit(void) | ||
60 | { | ||
61 | if (crypto_sysctls) | ||
62 | unregister_sysctl_table(crypto_sysctls); | ||
63 | } | ||
64 | #else | ||
65 | #define crypto_proc_fips_init() | ||
66 | #define crypto_proc_fips_exit() | ||
67 | #endif | ||
68 | |||
24 | static void *c_start(struct seq_file *m, loff_t *pos) | 69 | static void *c_start(struct seq_file *m, loff_t *pos) |
25 | { | 70 | { |
26 | down_read(&crypto_alg_sem); | 71 | down_read(&crypto_alg_sem); |
@@ -46,8 +91,11 @@ static int c_show(struct seq_file *m, void *p) | |||
46 | seq_printf(m, "module : %s\n", module_name(alg->cra_module)); | 91 | seq_printf(m, "module : %s\n", module_name(alg->cra_module)); |
47 | seq_printf(m, "priority : %d\n", alg->cra_priority); | 92 | seq_printf(m, "priority : %d\n", alg->cra_priority); |
48 | seq_printf(m, "refcnt : %d\n", atomic_read(&alg->cra_refcnt)); | 93 | seq_printf(m, "refcnt : %d\n", atomic_read(&alg->cra_refcnt)); |
94 | seq_printf(m, "selftest : %s\n", | ||
95 | (alg->cra_flags & CRYPTO_ALG_TESTED) ? | ||
96 | "passed" : "unknown"); | ||
49 | 97 | ||
50 | switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) { | 98 | switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) { |
51 | case CRYPTO_ALG_TYPE_CIPHER: | 99 | case CRYPTO_ALG_TYPE_CIPHER: |
52 | seq_printf(m, "type : cipher\n"); | 100 | seq_printf(m, "type : cipher\n"); |
53 | seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); | 101 | seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); |
@@ -67,7 +115,10 @@ static int c_show(struct seq_file *m, void *p) | |||
67 | seq_printf(m, "type : compression\n"); | 115 | seq_printf(m, "type : compression\n"); |
68 | break; | 116 | break; |
69 | default: | 117 | default: |
70 | if (alg->cra_type && alg->cra_type->show) | 118 | if (alg->cra_flags & CRYPTO_ALG_LARVAL) { |
119 | seq_printf(m, "type : larval\n"); | ||
120 | seq_printf(m, "flags : 0x%x\n", alg->cra_flags); | ||
121 | } else if (alg->cra_type && alg->cra_type->show) | ||
71 | alg->cra_type->show(m, alg); | 122 | alg->cra_type->show(m, alg); |
72 | else | 123 | else |
73 | seq_printf(m, "type : unknown\n"); | 124 | seq_printf(m, "type : unknown\n"); |
@@ -100,9 +151,11 @@ static const struct file_operations proc_crypto_ops = { | |||
100 | void __init crypto_init_proc(void) | 151 | void __init crypto_init_proc(void) |
101 | { | 152 | { |
102 | proc_create("crypto", 0, NULL, &proc_crypto_ops); | 153 | proc_create("crypto", 0, NULL, &proc_crypto_ops); |
154 | crypto_proc_fips_init(); | ||
103 | } | 155 | } |
104 | 156 | ||
105 | void __exit crypto_exit_proc(void) | 157 | void __exit crypto_exit_proc(void) |
106 | { | 158 | { |
159 | crypto_proc_fips_exit(); | ||
107 | remove_proc_entry("crypto", NULL); | 160 | remove_proc_entry("crypto", NULL); |
108 | } | 161 | } |