20260618-FORCE_FAILURE_RDSEED-fixes#10732
Conversation
* in USE_WINDOWS_API wc_GenerateSeed(), recognize HAVE_AMD_RDSEED, and properly enforce FORCE_FAILURE_RDSEED when CPU support is missing; * in WOLFSSL_LINUXKM wc_GenerateSeed(), initialize ret to RNG_FAILURE_E, and properly enforce FORCE_FAILURE_RDSEED when CPU support is missing; * in WOLFSSL_BSDKM wc_GenerateSeed(), properly enforce FORCE_FAILURE_RDSEED when CPU support is missing;
992a3db to
296bfc8
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10732
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src
Findings: 1
Critical (1)
Default wc_GenerateSeed returns RNG_FAILURE_E on successful seed read
File: wolfcrypt/src/random.c:5515
Function: wc_GenerateSeed
Category: Incorrect error handling
ret is now initialized to RNG_FAILURE_E, but the getrandom and /dev/urandom read loops set ret only on error. On a successful read ret stays RNG_FAILURE_E, so return ret yields -199 and if (ret == 0) at 5417 never fires, breaking the default seed path.
Recommendation: Set ret = 0 on the getrandom and /dev/urandom success paths, or keep this function's ret initializer at 0.
Referenced code: wolfcrypt/src/random.c:5515-5520 (6 lines)
This review was generated automatically by Fenrir. Findings are non-blocking.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10732
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src
No new issues found in the changed files. ✅
|
retest this please |
|
Tests good on bsdkm with this PR: |
wolfcrypt/src/random.c:in
USE_WINDOWS_APIwc_GenerateSeed(), recognizeHAVE_AMD_RDSEED, and properly enforceFORCE_FAILURE_RDSEEDwhen CPU support is missing;in
WOLFSSL_LINUXKMwc_GenerateSeed(), initializerettoRNG_FAILURE_E, and properly enforceFORCE_FAILURE_RDSEEDwhen CPU support is missing;in
WOLFSSL_BSDKMwc_GenerateSeed(), properly enforceFORCE_FAILURE_RDSEEDwhen CPU support is missing;detected and tested with