linuxkm/module_hooks.c: fix whitespace, and update code around WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE and updateFipsHash().

This commit is contained in:
Daniel Pouzzner 2021-11-05 18:29:41 -05:00
parent 8b3048a0ea
commit beebd1411d

View File

@ -25,6 +25,8 @@
#define FIPS_NO_WRAPPERS #define FIPS_NO_WRAPPERS
#define WOLFSSL_NEED_LINUX_CURRENT
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -100,9 +102,12 @@ static void lkmFipsCb(int ok, int err, const char* hash)
} }
#endif #endif
#if defined(WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE) && !defined(CONFIG_MODULE_SIG) #ifdef WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE
#ifndef CONFIG_MODULE_SIG
#error WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE requires a CONFIG_MODULE_SIG kernel. #error WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE requires a CONFIG_MODULE_SIG kernel.
#endif #endif
static int updateFipsHash(void);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
static int __init wolfssl_init(void) static int __init wolfssl_init(void)
@ -120,9 +125,16 @@ static int wolfssl_init(void)
#else #else
"FIPS dynamic hash" "FIPS dynamic hash"
#endif #endif
".\n"); ".\n");
return -ECANCELED; return -ECANCELED;
} }
#ifdef WOLFCRYPT_FIPS_CORE_DYNAMIC_HASH_VALUE
ret = updateFipsHash();
if (ret < 0) {
pr_err("wolfSSL module load aborted -- updateFipsHash: %s\n",wc_GetErrorString(ret));
return -ECANCELED;
}
#endif
#endif #endif
#ifdef USE_WOLFSSL_LINUXKM_PIE_REDIRECT_TABLE #ifdef USE_WOLFSSL_LINUXKM_PIE_REDIRECT_TABLE
@ -267,7 +279,7 @@ static int wolfssl_init(void)
#else #else
"" ""
#endif #endif
); );
#else #else
pr_info("wolfSSL " LIBWOLFSSL_VERSION_STRING " loaded%s" pr_info("wolfSSL " LIBWOLFSSL_VERSION_STRING " loaded%s"
".\nSee https://www.wolfssl.com/ for more information.\n" ".\nSee https://www.wolfssl.com/ for more information.\n"