Merge branch 'akpm' (patches from Andrew)
[linux/fpc-iii.git] / crypto / fips.c
blob9d627c1cf8bc78a173248e82ce58135c1f306d44
1 /*
2 * FIPS 200 support.
4 * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
13 #include <linux/export.h>
14 #include <linux/fips.h>
15 #include <linux/init.h>
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/sysctl.h>
20 int fips_enabled;
21 EXPORT_SYMBOL_GPL(fips_enabled);
23 /* Process kernel command-line parameter at boot time. fips=0 or fips=1 */
24 static int fips_enable(char *str)
26 fips_enabled = !!simple_strtol(str, NULL, 0);
27 printk(KERN_INFO "fips mode: %s\n",
28 fips_enabled ? "enabled" : "disabled");
29 return 1;
32 __setup("fips=", fips_enable);
34 static struct ctl_table crypto_sysctl_table[] = {
36 .procname = "fips_enabled",
37 .data = &fips_enabled,
38 .maxlen = sizeof(int),
39 .mode = 0444,
40 .proc_handler = proc_dointvec
45 static struct ctl_table crypto_dir_table[] = {
47 .procname = "crypto",
48 .mode = 0555,
49 .child = crypto_sysctl_table
54 static struct ctl_table_header *crypto_sysctls;
56 static void crypto_proc_fips_init(void)
58 crypto_sysctls = register_sysctl_table(crypto_dir_table);
61 static void crypto_proc_fips_exit(void)
63 unregister_sysctl_table(crypto_sysctls);
66 static int __init fips_init(void)
68 crypto_proc_fips_init();
69 return 0;
72 static void __exit fips_exit(void)
74 crypto_proc_fips_exit();
77 module_init(fips_init);
78 module_exit(fips_exit);