From 5c8597e891c31996a1fa6043647f68409bcea79c Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Fri, 12 Apr 2024 11:30:34 -0600 Subject: [PATCH] JNI: call wc_RunAllCast_fips() when used with FIPS 140-3 pilot --- jni/jni_wolfobject.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jni/jni_wolfobject.c b/jni/jni_wolfobject.c index 52a33ada..48b7460f 100644 --- a/jni/jni_wolfobject.c +++ b/jni/jni_wolfobject.c @@ -49,7 +49,17 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_wolfcrypt_WolfObject_init } #endif -#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION == 5) +#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \ + (HAVE_FIPS_VERSION >= 7) + + ret = wc_RunAllCast_fips(); + if (ret != 0) { + printf("FIPS CASTs failed to run"); + } + +#elif defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \ + (HAVE_FIPS_VERSION == 5) + /* run FIPS 140-3 conditional algorithm self tests early to prevent * multi threaded issues later on */ #if !defined(NO_AES) && !defined(NO_AES_CBC)