Skip to content

drbg: add thread-safe option, --disable-threadsafe-drbg to opt out - #11210

Open
kaleb-himes wants to merge 12 commits into
wolfSSL:masterfrom
kaleb-himes:DRBG-Threading
Open

drbg: add thread-safe option, --disable-threadsafe-drbg to opt out#11210
kaleb-himes wants to merge 12 commits into
wolfSSL:masterfrom
kaleb-himes:DRBG-Threading

Conversation

@kaleb-himes

Copy link
Copy Markdown
Contributor

Description

Feature addition

Testing

Test case added in wolfcrypt/test/test.c

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Comment thread wolfcrypt/src/random.c Outdated
@douzzer

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

@kaleb-himes

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed stale reviews from themself August 22, 2026 06:04

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

wolfSSL-Fenrir-bot

This comment was marked as outdated.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #11210

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Comment thread wolfcrypt/src/random.c
if (ret != 0)
return ret;
if (!rngAtForkSet) {
if (pthread_atfork(RngAtForkPrepare, RngAtForkParent,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fork handlers registered before the dlclose pin, and pin failure is ignored · Use-after-free / double-free

wc_RngAtForkInit() registers the irrevocable pthread_atfork handlers before pinning, and wc_RngPinImage() returns void and only logs on failure (including the build where RTLD_NODELETE/RTLD_NOLOAD are absent). If the pin fails, a dlclosed libwolfssl leaves the handlers pointing into unmapped memory, which the next fork() executes.

Fix: Pin the image before calling pthread_atfork(), have wc_RngPinImage() return a status, and skip registration when the pin fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants