-
Notifications
You must be signed in to change notification settings - Fork 1k
20260729 Coverity fixes #11006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
20260729 Coverity fixes #11006
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2165,13 +2165,37 @@ void AddSession(WOLFSSL* ssl) | |
| if (ssl->rng != NULL) | ||
| rng = ssl->rng; | ||
| #if defined(HAVE_GLOBAL_RNG) && defined(OPENSSL_EXTRA) | ||
|
Frauschi marked this conversation as resolved.
|
||
| else if (initGlobalRNG == 1 || wolfSSL_RAND_Init() == WOLFSSL_SUCCESS) { | ||
| else if (initGlobalRNG == 1 || | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't find a code path where ssl->rng would ever be null. Are we sure this isn't dead code? We could also try to use a local rng first, and only fallback to the global RNG on error. We follow this pattern in src/pk.c and other places: Then we would only hit the global lock when the local temp rng init fails (which should be rare). |
||
| wolfSSL_RAND_Init() == WOLFSSL_SUCCESS) { | ||
| rng = &globalRNG; | ||
| } | ||
| if (rng == &globalRNG) { | ||
| if (wc_LockMutex(&globalRNGMutex) != 0) { | ||
| WOLFSSL_MSG("Bad Lock Mutex rng"); | ||
| return; | ||
| } | ||
| /* The above access requires initGlobalRNG recheck now | ||
| * that we have the lock. */ | ||
| if (initGlobalRNG == 0) { | ||
| wc_UnLockMutex(&globalRNGMutex); | ||
| return; | ||
| } | ||
| } | ||
| #endif | ||
| if (wc_RNG_GenerateBlock(rng, ssl->session->altSessionID, | ||
| ID_LEN) != 0) | ||
| ID_LEN) != 0) { | ||
| #if defined(HAVE_GLOBAL_RNG) && defined(OPENSSL_EXTRA) | ||
| if (rng == &globalRNG) { | ||
| wc_UnLockMutex(&globalRNGMutex); | ||
| } | ||
| #endif | ||
| return; | ||
| } | ||
| #if defined(HAVE_GLOBAL_RNG) && defined(OPENSSL_EXTRA) | ||
| if (rng == &globalRNG) { | ||
| wc_UnLockMutex(&globalRNGMutex); | ||
| } | ||
| #endif | ||
| ssl->session->haveAltSessionID = 1; | ||
| id = ssl->session->altSessionID; | ||
| idSz = ID_LEN; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.