Skip to content

20251011-more-fips-optest-tweaks#9297

Merged
lealem47 merged 7 commits intowolfSSL:masterfrom
douzzer:20251011-more-fips-optest-tweaks
Oct 17, 2025
Merged

20251011-more-fips-optest-tweaks#9297
lealem47 merged 7 commits intowolfSSL:masterfrom
douzzer:20251011-more-fips-optest-tweaks

Conversation

@douzzer
Copy link
Copy Markdown
Contributor

@douzzer douzzer commented Oct 13, 2025

linuxkm/module_hooks.c and linuxkm/linuxkm_wc_port.h: finish implementation of FIPS_OPTEST glue code, including /sys/module/libwolfssl/FIPS_optest_run_code (FIPS_optest_trig_handler(), plus my_kallsyms_lookup_name() helper).

wolfcrypt/test/test.c: fix error-path uninitialized access defect in ecc_test_buffers().

tested with wolfssl-multi-test.sh with overrides and script hacks to test the new stuff. used crypto-only-intelasm-fips-dev-linuxkm-next-insmod as the base scenario for the tests.

@devin-ai-integration

This comment was marked as spam.

@douzzer
Copy link
Copy Markdown
Contributor Author

douzzer commented Oct 13, 2025

see related https://github.com/wolfSSL/fips/pull/359

not important to merge together, though FIPS_OPTEST=1 won't work until they're both merged.

dgarske
dgarske previously approved these changes Oct 14, 2025
@douzzer douzzer force-pushed the 20251011-more-fips-optest-tweaks branch from d2384bc to 66e9a1b Compare October 15, 2025 16:51
@douzzer douzzer mentioned this pull request Oct 15, 2025
@lealem47 lealem47 self-assigned this Oct 15, 2025
@lealem47
Copy link
Copy Markdown
Contributor

Seeing this build failure after the latest changes ./configure --enable-linuxkm --with-linux-source=/home/lealem/Projects/WOLFGUARD/linux-6.1.27 --enable-cryptonly --enable-linuxkm --enable-fips=v5 CFLAGS="-DHAVE_FORCE_FIPS_FAILURE -DDEBUG_LINUXKM_PIE_SUPPORT -DDEBUG_FIPS_VERBOSE"

  CC [M]  /home/lealem/Projects/OPTEST/XXX-fips-test/linuxkm/wolfcrypt/src/hmac.o
In file included from /home/lealem/Projects/OPTEST/XXX-fips-test/wolfssl/wolfcrypt/memory.h:37,
                 from /home/lealem/Projects/OPTEST/XXX-fips-test/wolfssl/wolfcrypt/../../linuxkm/linuxkm_wc_port.h:1458,
                 from /home/lealem/Projects/OPTEST/XXX-fips-test/wolfssl/wolfcrypt/wc_port.h:62,
                 from /home/lealem/Projects/OPTEST/XXX-fips-test/linuxkm/wolfcrypt/src/hmac.c:27:
/home/lealem/Projects/OPTEST/XXX-fips-test/wolfssl/wolfcrypt/types.h:468:12: error: unknown type name ‘WC_INLINE’
  468 |     static WC_INLINE WARN_UNUSED_RESULT int WC_WUR_INT(int x) { return x; }
      |            ^~~~~~~~~
/home/lealem/Projects/OPTEST/XXX-fips-test/wolfssl/wolfcrypt/types.h:468:40: error: expected ‘;’ before ‘int’
  468 |     static WC_INLINE WARN_UNUSED_RESULT int WC_WUR_INT(int x) { return x; }
      |                                        ^~~~
      |                                        ;
/home/lealem/Projects/OPTEST/XXX-fips-test/wolfssl/wolfcrypt/types.h:468:45: error: no previous prototype for ‘WC_WUR_INT’ [-Werror=missing-prototypes]
  468 |     static WC_INLINE WARN_UNUSED_RESULT int WC_WUR_INT(int x) { return x; }
      |                                             ^~~~~~~~~~

@douzzer
Copy link
Copy Markdown
Contributor Author

douzzer commented Oct 15, 2025

Seeing this build failure after the latest changes ./configure --enable-linuxkm --with-linux-source=/home/lealem/Projects/WOLFGUARD/linux-6.1.27 --enable-cryptonly --enable-linuxkm --enable-fips=v5 CFLAGS="-DHAVE_FORCE_FIPS_FAILURE -DDEBUG_LINUXKM_PIE_SUPPORT -DDEBUG_FIPS_VERBOSE"

bug was in master, fixed by #9307

@douzzer
Copy link
Copy Markdown
Contributor Author

douzzer commented Oct 16, 2025

retest this please

@lealem47
Copy link
Copy Markdown
Contributor

The lab's log parser requires the error code to be the second argument like this ./optest 0 -204. Patch below

diff --git a/linuxkm/module_hooks.c b/linuxkm/module_hooks.c
index d8d22ffa4..b8c4170fc 100644
--- a/linuxkm/module_hooks.c
+++ b/linuxkm/module_hooks.c
@@ -1646,7 +1646,7 @@ static ssize_t FIPS_optest_trig_handler(struct kobject *kobj, struct kobj_attrib
 {
     int ret;
     int argc;
-    const char *argv[2];
+    const char *argv[3];
     char code_buf[5];
     size_t corrected_count;
     int i;
@@ -1672,8 +1672,9 @@ static ssize_t FIPS_optest_trig_handler(struct kobject *kobj, struct kobj_attrib
         return -EINVAL;
 
     argv[0] = "./optest";
-    argv[1] = code_buf;
-    argc = 2;
+    argv[1] = "0";
+    argv[2] = code_buf;
+    argc = 3;
 
     printf("OK, testing code %s\n", buf);
 

@douzzer douzzer force-pushed the 20251011-more-fips-optest-tweaks branch from 66e9a1b to 5c3add6 Compare October 16, 2025 23:12
…tation of

FIPS_OPTEST glue code, including /sys/module/libwolfssl/FIPS_optest_run_code
(FIPS_optest_trig_handler(), plus my_kallsyms_lookup_name() helper).
…re of this), and add explicit fipsCastStatus[] reset code.
…and fix linuxkm_op_test_1() call to use argc==3 arg list.
…able_tlsv12=no -- they're needed for crypto-layer KDFs.
@douzzer douzzer force-pushed the 20251011-more-fips-optest-tweaks branch from 5c3add6 to 9cf08af Compare October 16, 2025 23:50
@douzzer
Copy link
Copy Markdown
Contributor Author

douzzer commented Oct 17, 2025

retest this please

FAIL scripts/openssl.test (exit status: 1)

@douzzer
Copy link
Copy Markdown
Contributor Author

douzzer commented Oct 17, 2025

retest this please

Comment thread linuxkm/module_hooks.c
@lealem47 lealem47 merged commit 5280bfb into wolfSSL:master Oct 17, 2025
259 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants