hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/crypto/fips.c
....@@ -1,13 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * FIPS 200 support.
34 *
45 * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
5
- *
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.
10
- *
116 */
127
138 #include <linux/export.h>
....@@ -16,9 +11,13 @@
1611 #include <linux/module.h>
1712 #include <linux/kernel.h>
1813 #include <linux/sysctl.h>
14
+#include <linux/notifier.h>
1915
2016 int fips_enabled;
2117 EXPORT_SYMBOL_GPL(fips_enabled);
18
+
19
+ATOMIC_NOTIFIER_HEAD(fips_fail_notif_chain);
20
+EXPORT_SYMBOL_GPL(fips_fail_notif_chain);
2221
2322 /* Process kernel command-line parameter at boot time. fips=0 or fips=1 */
2423 static int fips_enable(char *str)
....@@ -63,6 +62,13 @@
6362 unregister_sysctl_table(crypto_sysctls);
6463 }
6564
65
+void fips_fail_notify(void)
66
+{
67
+ if (fips_enabled)
68
+ atomic_notifier_call_chain(&fips_fail_notif_chain, 0, NULL);
69
+}
70
+EXPORT_SYMBOL_GPL(fips_fail_notify);
71
+
6672 static int __init fips_init(void)
6773 {
6874 crypto_proc_fips_init();
....@@ -74,5 +80,5 @@
7480 crypto_proc_fips_exit();
7581 }
7682
77
-module_init(fips_init);
83
+subsys_initcall(fips_init);
7884 module_exit(fips_exit);