20260727-fips-dev-no-post - #11031
Conversation
|
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11031
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 5
4 finding(s) posted as inline comments (see file-level comments below)
Medium (1)
Unguarded verifyCore reference in non-PIE FIPS seg_map under WOLFSSL_FIPS_DEV_NO_POST
File: linuxkm/module_hooks.c:1291
Function: seg_map (file-scope, #elif defined(HAVE_FIPS) branch)
Category: Incorrect error handling
The extern declaration of verifyCore (line 119) is now gated with !defined(WOLFSSL_FIPS_DEV_NO_POST), and the primary seg_map initializer (line 1223) got the matching && !defined(WOLFSSL_FIPS_DEV_NO_POST) guard, but the parallel seg_map used when WC_SYM_RELOC_TABLES is undefined (line 1290) was not updated to match, so it references the undeclared verifyCore symbol when building with --enable-fips=dev-no-post and PIE reloc tables disabled.
Recommendation: Add && !defined(WOLFSSL_FIPS_DEV_NO_POST) to the #if at line 1290, matching line 1223.
Referenced code: linuxkm/module_hooks.c:1291-1294 (4 lines)
This review was generated automatically by Fenrir. Findings are non-blocking.
c212bc1 to
107fc6d
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11031
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
| int ret; | ||
| word32 flags = WC_RNG_BANK_FLAG_CAN_WAIT; | ||
|
|
||
| #if defined(HAVE_FIPS) && FIPS_VERSION3_LT(7,0,0) |
There was a problem hiding this comment.
🟠 [Medium] Default-RNG NO_VECTOR_OPS protection dropped for non-FIPS/FIPS-v7+ builds · Vector register state corruption
WC_RNG_BANK_FLAG_NO_VECTOR_OPS is now only set #if defined(HAVE_FIPS) && FIPS_VERSION3_LT(7,0,0), so for non-FIPS and FIPS v7+ linuxkm builds the default system DRBG bank (comment: wc_linuxkm_rng_initing_default_bank_flag, "forbidden from irq handlers") no longer forces vector-op-free SHA-256, letting its future wc_rng_bank_checkout()/generate calls attempt vector-register SHA-256 from softirq/hardirq contexts.
Fix: Set WC_RNG_BANK_FLAG_NO_VECTOR_OPS for the default bank unconditionally (or gate strictly on the actual dynamic-switch capability), not solely on old-FIPS version.
There was a problem hiding this comment.
False positive. SHA-2 now (with this PR) dynamically falls back to C on a call-by-call basis.
| int wc_AesGcmInit(Aes* aes, const byte* key, word32 len, const byte* iv, | ||
| word32 ivSz) | ||
| { | ||
| return wc_AesGcmInit_local(aes, key, len, iv, ivSz, 0 /* decrypt_p */); |
There was a problem hiding this comment.
🟠 [Medium] wc_AesGcmInit() always applies encrypt-only FIPS short-nonce check, even for decrypt reinit · Logic errors
wc_AesGcmInit() is documented as usable "for encryption or decryption" but hardcodes decrypt_p=0 when calling wc_AesGcmInit_local, so the new FIPS short-IV rejection (ivSz < GCM_NONCE_MID_SZ → FIPS_BAD_VALUE_E) is wrongly applied on decrypt paths too. evp.c calls wc_AesGcmInit() to reinitialize the cipher after both encrypt and decrypt Final, and wolfSSL_EVP_CIPHER_CTX_set_iv_length() lets callers set ctx->ivSz below 12 bytes, so a legitimate short-IV decrypt will now fail spuriously in FIPS builds.
Fix: Either drop the generic wc_AesGcmInit() FIPS short-nonce check or have it accept/propagate a decrypt flag instead of hardcoding 0.
| /* On error free handshake key */ | ||
| if (ret != 0) { | ||
| /* On error free handshake key if inited */ | ||
| if ((ret != 0) && key_inited) { |
There was a problem hiding this comment.
🔴 [High] AllocKey leaks XMALLOC'd key struct when wc_XXX_init_ex() itself fails · Resource leaks on error paths
key_inited is set only when the init call itself returns 0; if wc_InitRsaKey_ex/wc_ecc_init_ex/etc. fail directly, key_inited stays 0 so FreeKey() is skipped, leaking the XMALLOC'd struct and leaving *pKey non-NULL and unfreed.
Fix: Free the allocated *pKey buffer on any ret != 0 (via XFREE/FreeKey), regardless of key_inited, and reset *pKey to NULL.
tested with