btrfs: use file:line format for assertion report
[linux/fpc-iii.git] / crypto / fips.c
blobc0b3a3c3452dd49da5756c8568706356ee7be4ed
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * FIPS 200 support.
5 * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
6 */
8 #include <linux/export.h>
9 #include <linux/fips.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/sysctl.h>
15 int fips_enabled;
16 EXPORT_SYMBOL_GPL(fips_enabled);
18 /* Process kernel command-line parameter at boot time. fips=0 or fips=1 */
19 static int fips_enable(char *str)
21 fips_enabled = !!simple_strtol(str, NULL, 0);
22 printk(KERN_INFO "fips mode: %s\n",
23 fips_enabled ? "enabled" : "disabled");
24 return 1;
27 __setup("fips=", fips_enable);
29 static struct ctl_table crypto_sysctl_table[] = {
31 .procname = "fips_enabled",
32 .data = &fips_enabled,
33 .maxlen = sizeof(int),
34 .mode = 0444,
35 .proc_handler = proc_dointvec
40 static struct ctl_table crypto_dir_table[] = {
42 .procname = "crypto",
43 .mode = 0555,
44 .child = crypto_sysctl_table
49 static struct ctl_table_header *crypto_sysctls;
51 static void crypto_proc_fips_init(void)
53 crypto_sysctls = register_sysctl_table(crypto_dir_table);
56 static void crypto_proc_fips_exit(void)
58 unregister_sysctl_table(crypto_sysctls);
61 static int __init fips_init(void)
63 crypto_proc_fips_init();
64 return 0;
67 static void __exit fips_exit(void)
69 crypto_proc_fips_exit();
72 subsys_initcall(fips_init);
73 module_exit(fips_exit);