Skip to content

Commit 12070eb

Browse files
authored
Merge pull request #10473 from douzzer/20260512-fips-gating-fixes
20260512-fips-gating-fixes
2 parents 58c41b6 + e1c7385 commit 12070eb

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

tests/api/test_dtls.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,8 +1932,9 @@ int test_dtls13_frag_ch2_with_ch1_rtx(void)
19321932
{
19331933
EXPECT_DECLS;
19341934
#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1935-
defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS) && \
1936-
defined(WOLFSSL_DTLS_MTU) && defined(WOLFSSL_DTLS_CH_FRAG)
1935+
defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS) && \
1936+
defined(WOLFSSL_DTLS_MTU) && defined(WOLFSSL_DTLS_CH_FRAG) && \
1937+
(!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0))
19371938
WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
19381939
WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
19391940
struct test_memio_ctx test_ctx;

wolfcrypt/test/test.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34317,6 +34317,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf2_test(void)
3431734317
if (XMEMCMP(derived, verify, sizeof(verify)) != 0)
3431834318
return WC_TEST_RET_ENC_NC;
3431934319

34320+
#if !defined(HAVE_SELFTEST) && \
34321+
(!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0))
3432034322
{
3432134323
int cur_pbkdf_limit = wc_PBKDF_max_iterations_set(iterations - 1);
3432234324
if (cur_pbkdf_limit <= 0)
@@ -34340,9 +34342,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf2_test(void)
3434034342
return WC_TEST_RET_ENC_EC(ret);
3434134343
ret = 0;
3434234344
}
34345+
#endif /* !HAVE_SELFTEST) && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
3434334346

3434434347
return ret;
34345-
3434634348
}
3434734349
#endif /* HAVE_PBKDF2 && !NO_SHA256 && !NO_HMAC */
3434834350

@@ -34397,7 +34399,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void)
3439734399
return ret;
3439834400
#endif
3439934401
#if defined(HAVE_PKCS12) && !defined(NO_ASN) && !defined(NO_PWDBASED) && \
34400-
!defined(NO_HMAC) && !defined(NO_CERTS) && !defined(WOLFSSL_NO_MALLOC)
34402+
!defined(NO_HMAC) && !defined(NO_CERTS) && !defined(WOLFSSL_NO_MALLOC) && \
34403+
!defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION_GE(7,0))
3440134404
/* Test that a crafted PKCS#12 with INT_MAX MAC iterations is rejected
3440234405
* immediately rather than hanging in DoPKCS12Hash(). */
3440334406
{
@@ -34445,7 +34448,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void)
3444534448
return ret;
3444634449
}
3444734450
#endif /* HAVE_PKCS12 && !NO_ASN && !NO_PWDBASED && !NO_HMAC && !NO_CERTS && */
34448-
/* !WOLFSSL_NO_MALLOC */
34451+
/* !WOLFSSL_NO_MALLOC && */
34452+
/* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION_GE(7,0)) */
3444934453
#ifdef HAVE_SCRYPT
3445034454
ret = scrypt_test();
3445134455
#endif
@@ -34543,6 +34547,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void)
3454334547
goto out;
3454434548
}
3454534549

34550+
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION_GE(7,0))
3454634551
/* Test that a crafted PKCS#12 with INT_MAX MAC iterations is rejected
3454734552
* immediately rather than hanging in DoPKCS12Hash(). This is a 90-byte
3454834553
* minimal PKCS#12 with mac->itt = 0x7FFFFFFF (2,147,483,647). */
@@ -34587,6 +34592,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void)
3458734592
ret = 0; /* rejection is the expected outcome */
3458834593
}
3458934594
}
34595+
#endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION_GE(7,0)) */
3459034596

3459134597
out:
3459234598

@@ -43255,13 +43261,16 @@ static wc_test_ret_t ecc_buffers_encrypt_test(ecc_key* cliKey, ecc_key* servKey,
4325543261
if (XMEMCMP(plain, in, inLen))
4325643262
return WC_TEST_RET_ENC_NC;
4325743263

43264+
#if !defined(HAVE_SELFTEST) && \
43265+
(!defined(HAVE_FIPS) || FIPS_VERSION3_GE(6,0,0))
4325843266
/* Negative test: corrupt HMAC tag in encrypted msg, expect
4325943267
* HASH_TYPE_E from wc_ecc_decrypt. */
4326043268
out[x - 1] ^= 0x01;
4326143269
y = 256;
4326243270
ret = wc_ecc_decrypt(servKey, tmpKey, out, x, plain, &y, NULL);
4326343271
if (ret != WC_NO_ERR_TRACE(HASH_TYPE_E))
4326443272
return WC_TEST_RET_ENC_EC(ret);
43273+
#endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(6,0,0)) */
4326543274

4326643275
(void)tmpKey;
4326743276
return 0;

wolfssl/wolfcrypt/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ WOLFSSL_LOCAL int wc_debug_CipherLifecycleFree(void **CipherLifecycleTag,
552552

553553
#if defined(WOLFSSL_LINUXKM) || defined(WC_SYM_RELOC_TABLES) || \
554554
defined(WC_SYM_RELOC_TABLES_SUPPORT)
555-
#include "linuxkm/linuxkm_memory.h"
555+
#include "../../linuxkm/linuxkm_memory.h"
556556
#endif
557557

558558
#ifdef __cplusplus

0 commit comments

Comments
 (0)