From 102a0743326a03cd1a1202ceda21e175b7d3575c Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Tue, 20 Feb 2024 01:20:52 +0000 Subject: [PATCH] add new system file --- kernel/crypto/fips.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/kernel/crypto/fips.c b/kernel/crypto/fips.c index 9d627c1..7b1d8ca 100644 --- a/kernel/crypto/fips.c +++ b/kernel/crypto/fips.c @@ -1,13 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * FIPS 200 support. * * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * */ #include <linux/export.h> @@ -16,9 +11,13 @@ #include <linux/module.h> #include <linux/kernel.h> #include <linux/sysctl.h> +#include <linux/notifier.h> int fips_enabled; EXPORT_SYMBOL_GPL(fips_enabled); + +ATOMIC_NOTIFIER_HEAD(fips_fail_notif_chain); +EXPORT_SYMBOL_GPL(fips_fail_notif_chain); /* Process kernel command-line parameter at boot time. fips=0 or fips=1 */ static int fips_enable(char *str) @@ -63,6 +62,13 @@ unregister_sysctl_table(crypto_sysctls); } +void fips_fail_notify(void) +{ + if (fips_enabled) + atomic_notifier_call_chain(&fips_fail_notif_chain, 0, NULL); +} +EXPORT_SYMBOL_GPL(fips_fail_notify); + static int __init fips_init(void) { crypto_proc_fips_init(); @@ -74,5 +80,5 @@ crypto_proc_fips_exit(); } -module_init(fips_init); +subsys_initcall(fips_init); module_exit(fips_exit); -- Gitblit v1.6.2