ANDROID: fips140: fix the error injection module parameters

Commit 63f46b45dda2 ("ANDROID: fips140: eliminate crypto-fips.a build
step") made all fips140 source files other than fips140-module.c be
compiled in the "fake built-in code" mode.  This broke the fail_selftest
and fail_integrity_check module parameters, as they are defined in
fips140-eval-testing.c.  Fix this by making fips140-eval-testing.c be
compiled "normally", overriding fips140-defs.h.

Bug: 188620248
Fixes: 63f46b45dda2 ("ANDROID: fips140: eliminate crypto-fips.a build step")
Change-Id: Iebb70bdcbb698b92a7791fa7307e2325b1a9e4b6
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers 2023-08-24 16:58:19 +00:00
parent 71bedf9d9c
commit 63af84cffe
2 changed files with 11 additions and 3 deletions

View File

@ -17,9 +17,9 @@
* related macros to be expanded as they would be for built-in code; e.g., * related macros to be expanded as they would be for built-in code; e.g.,
* module_init() adds the function to the .initcalls section of the binary. * module_init() adds the function to the .initcalls section of the binary.
* *
* The .c file that contains the real module_init() for fips140.ko is then * The .c files that contain the real module_init, module license, and module
* responsible for redefining MODULE, and the real module_init() is responsible * parameters for fips140.ko are then responsible for redefining MODULE. The
* for executing all the initcalls that were collected into .initcalls. * real module_init executes all initcalls that were collected into .initcalls.
*/ */
#undef MODULE #undef MODULE

View File

@ -20,6 +20,14 @@
__inline_maybe_unused notrace __inline_maybe_unused notrace
#undef BUILD_FIPS140_KO #undef BUILD_FIPS140_KO
/*
* Since this .c file contains real module parameters for fips140.ko, it needs
* to be compiled normally, so undo the hacks that were done in fips140-defs.h.
*/
#define MODULE
#undef KBUILD_MODFILE
#undef __DISABLE_EXPORTS
#include <linux/cdev.h> #include <linux/cdev.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/module.h> #include <linux/module.h>