Skip to content

20260907-RNG-extras - #11435

Merged
JacobBarthelmeh merged 102 commits into
wolfSSL:masterfrom
douzzer:20260907-RNG-extras
Sep 17, 2026
Merged

JacobBarthelmeh merged 102 commits into
wolfSSL:masterfrom
douzzer:20260907-RNG-extras

Conversation

@douzzer

@douzzer douzzer commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Expansion of core RNG facility to add kernel-facing semantics.

The SP 800-90 compliance report is the best introduction to the expansion:

rng-extras-compliance-report (2).pdf

Also expands rng_bank facility with corresponding functionalities, and refactors corresponding portions of linuxkm/lkcapi_sha_glue.c to follow suit.

Tested with full run wolfssl-multi-test.sh (530 scenarios).

Relevant new scenarios:


    all-rng-debug-stats-cryptonly
    all-rng-no-bank-cryptonly
    all-rng-no-lock-cryptonly
    all-rng-lock-full-mutex-cryptonly
    all-rng-no-next-seed-cryptonly
    all-rng-no-pool-cryptonly
    all-rng-no-rbgc-cryptonly
    all-rng-no-free-hook
    all-rng-no-extras
    all-rng-only-lock-cryptonly
    all-rng-only-next-seed-cryptonly
    all-rng-only-pool-cryptonly
    all-rng-only-rbgc-cryptonly
    all-rng-only-free-hook
    all-rng-no-hashdrbg

Note, tested atop #11382, and must merge after #11382 merges.

@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 #11435

Scan targets checked: none
Failed targets: linuxkm-src, linuxkm-bugs, wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs

⚠️ Review incomplete — one or more scan targets failed before findings could be produced. See the Fenrir PR review detail page for logs.

@douzzer

douzzer commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Note the kernel module build failures are expected, and will resolve once #11382 merges.

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m0plus

  • FLASH: .text +704 B (+1.0%, 67,803 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m3

  • FLASH: .text +732 B (+0.6%, 127,251 B / 262,144 B, total: 49% used)
  • RAM: .bss +4 B (+0.5%, 820 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m4

  • FLASH: .rodata.CSWTCH.1 +8 B, .rodata.str1.1 +61 B, .text +768 B (+0.4%, 206,050 B / 262,144 B, total: 79% used)
  • RAM: .bss +4 B (+0.5%, 840 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +640 B (+0.9%, 70,179 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .rodata.CSWTCH.1 +8 B, .rodata.str1.1 +61 B, .text +640 B (+0.4%, 179,549 B / 262,144 B, total: 68% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +704 B (+0.4%, 188,604 B / 1,048,576 B, total: 18% used)
  • RAM: .bss +4 B (+0.5%, 856 B / 262,144 B, total: 0% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +640 B (+1.0%, 65,029 B / 262,144 B, total: 25% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +64 B, .text +768 B (+0.1%, 786,084 B / 1,048,576 B, total: 75% used)
  • RAM: .bss +4 B (+0.0%, 136,948 B / 262,144 B, total: 52% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .rodata.CSWTCH.1 +8 B, .rodata.str1.1 +61 B, .text +768 B (+0.4%, 218,526 B / 262,144 B, total: 83% used)

gcc-arm-cortex-m4-pq

  • FLASH: .rodata +72 B, .text +832 B (+0.3%, 303,568 B / 1,048,576 B, total: 29% used)
  • RAM: .bss +4 B (+0.0%, 33,428 B / 262,144 B, total: 13% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .rodata +72 B, .text +704 B (+0.2%, 334,824 B / 1,048,576 B, total: 32% used)
  • RAM: .bss +4 B (+0.0%, 33,424 B / 262,144 B, total: 13% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +640 B (+1.0%, 65,029 B / 262,144 B, total: 25% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +704 B (+0.6%, 127,987 B / 262,144 B, total: 49% used)
  • RAM: .bss +4 B (+0.5%, 820 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .rodata.CSWTCH.1 +8 B, .rodata.str1.1 +61 B, .text +768 B (+0.3%, 243,988 B / 262,144 B, total: 93% used)
  • RAM: .bss +4 B (+0.0%, 33,376 B / 65,536 B, total: 51% used)

gcc-arm-cortex-m7

  • FLASH: .rodata.CSWTCH.1 +8 B, .rodata.str1.1 +61 B, .text +768 B (+0.4%, 206,050 B / 262,144 B, total: 79% used)
  • RAM: .bss +4 B (+0.5%, 840 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m7-pq

  • FLASH: .rodata +72 B, .text +768 B (+0.3%, 304,464 B / 1,048,576 B, total: 29% used)
  • RAM: .bss +4 B (+0.0%, 33,428 B / 262,144 B, total: 13% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .rodata.CSWTCH.1 +8 B, .rodata.str1.1 +61 B, .text +768 B (+0.3%, 244,052 B / 262,144 B, total: 93% used)
  • RAM: .bss +4 B (+0.0%, 33,376 B / 65,536 B, total: 51% used)

linuxkm-pie

  • Data: __patchable_function_entries +624 B (+2.3%, 27,752 B)

linuxkm-standard

  • Data: __patchable_function_entries +640 B (+1.3%, 50,600 B)

stm32-sim-stm32h753

  • FLASH: .text +1,016 B (+0.5%, 190,692 B / 2,097,152 B, total: 9% used)

Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfssl/wolfcrypt/rng_bank.h Outdated
Comment thread wolfssl/wolfcrypt/rng_bank.h Outdated
Comment thread wolfcrypt/src/random.c
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread wolfcrypt/src/rsa.c

@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 #11435

Scan targets checked: linuxkm-src, linuxkm-bugs, wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs

Findings: 17
17 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 linuxkm/lkcapi_glue.c
Comment thread linuxkm/lkcapi_sha_glue.c Outdated
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread linuxkm/lkcapi_sha_glue.c Outdated
Comment thread linuxkm/lkcapi_glue.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfssl/wolfcrypt/rng_bank.h Outdated
Comment thread wolfcrypt/test/test.c Outdated
Comment thread wolfcrypt/test/test.c
@douzzer douzzer added the For This Release Release version 5.9.4 label Sep 11, 2026
@douzzer
douzzer force-pushed the 20260907-RNG-extras branch from 71f1f6b to 97bdcee Compare September 11, 2026 18:40
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c Outdated
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c Outdated
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread wolfcrypt/src/random.c
* add NO_DEFAULT_FOUND_E "No default object registered for request type".
* add missing #include <wolfssl/wolfcrypt/logging.h> in WOLFSSL_DEBUG_TRACE_ERROR_CODES path.
* add __func__ to __GNUC__ WC_ERR_TRACE().

wolfcrypt/src/rng_bank.c, wolfssl/wolfcrypt/rng_bank.h, wolfcrypt/test/test.c:
* add wc_rng_bank_inst.bank for parent access from the children.
* add wc_rng_bank_inst_checkin().
* improve thread safety, error checking, and default bank support in wc_rng_bank_checkout(), wc_local_rng_bank_checkout_for_bankref(), wc_rng_bank_inst_reinit(), wc_rng_bank_seed(), wc_rng_bank_reseed(), and wc_InitRng_BankRef_local().
* orthogonalize common code in wc_InitRng_BankRef() and wc_rng_new_bankref() into wc_InitRng_BankRef_local().

wolfcrypt/test/test.c:
* fix typo in PRINT_HEAP_CHECKPOINT().
* add wc_rng_bank_inst_checkin() tests to random_bank_test(), update expected failure codes, and remove obsolete test clauses.
* add missing !HAVE_FIPS gates in cryptocb_test().

wolfcrypt/src/random.c:
* in WC_RNG_BANK_SUPPORT variant of wc_RNG_GenerateBlock(), use the new wc_rng_bank_inst_checkin(), not wc_rng_bank_checkin().
* tweaks to WOLFSSL_DEBUG_TRACE_ERROR_CODES code wrappers to mollify clang-tidy and -Wconversion.
* fix a spelling error in _InitRng().

linuxkm/lkcapi_sha_glue.c:
* in wc_linuxkm_drbg_generate(), opportunistically reseed once half way to WC_RESEED_INTERVAL and wc_linuxkm_can_block().  Also properly inhibit the recovery call to wc_rng_bank_inst_reinit() if ! wc_linuxkm_can_block().
* refactor wc_mix_pool_bytes() to use wc_RNG_DRBG_Reseed(), and only on the CPU-local RNG.

wolfcrypt/src/asn.c, wolfcrypt/src/curve25519.c, wolfcrypt/src/evp.c, wolfcrypt/src/pkcs7.c, wolfcrypt/src/pkcs12.c, wolfcrypt/src/srp.c: at each existing wc_InitRng(), attempt wc_InitRng_BankRef() if WC_RNG_BANK_DEFAULT_SUPPORT && WC_HAVE_RNG_BANKREF.
… wolfcrypt/src/pkcs7.c, wolfcrypt/src/pkcs12.c, wolfcrypt/src/srp.c: revert wc_InitRng_BankRef() airdrops.
* supply WC_DRBG_OK for HAVE_FIPS with FIPS_VERSION3 < 5.2.4 or == 6.0.0,
  for the DRBG health tests in wc_rng_bank_checkout(), wc_rng_bank_seed(),
  and wc_rng_bank_reseed();
* in rng_inst_matches_bank(), compare integer addresses (wc_ptr_t), and
  compute the mid-instance alignment check on the integer difference --
  the negative tests deliberately supply fabricated pointers, for which
  pointer relationals and subtraction are undefined (C11 6.5.8p5 /
  6.5.6p9), while integer comparisons are defined for any value.
wc_rng_bank checkin and seed edge cases from the 20260820 review batch:
duplicate (stale-copy) checkin through both wc_rng_bank_checkin() and
wc_rng_bank_inst_checkin(), asserting BAD_STATE_E without bank mutation;
seedSz == 0 no-op success for an explicit inited bank and for the default
form while a default is set; and seedSz == 0 with no default bank set,
asserting NO_DEFAULT_FOUND_E.
blockability into can_wait before the DRBG checkout, and gate the
opportunistic reseed and the RNG_FAILURE_E reinit recovery on it --
wc_linuxkm_can_block() is false whenever the affinity lock is held (the
lock callback is SAVE_VECTOR_REGISTERS_MAYBE_INHIBIT()), so the previous
live-sampled guards were unsatisfiable in every reachable state and both
features were dead.  For each of the two blocking operations, bracket it
to restore preemptibility while keeping the instance checked out:
migrate_disable() (CONFIG_SMP && >= 5.11.0 -- on earlier kernels
migrate_disable() is absent or maps to preempt_disable(), so migration
during the operation is simply tolerated there), then
RESTORE_VECTOR_REGISTERS_MAYBE_INHIBITED() keyed on the lock's
_AFFINITY_LOCKED/_VEC_OPS_INH bits, then the blocking operation
preemptibly (wc_rng_bank_inst_reinit()'s WC_RELAX_LONG_LOOP now sees
can_block() true and actually yields), then re-establish the vector state
flavor-matched (SAVE_VECTOR_REGISTERS2() for the affinity hold,
DISABLE_VECTOR_REGISTERS() for the inhibit hold), then migrate_enable().
If re-establishment fails, clear the corresponding lock bits so checkin
doesn't double-restore; the cleared bits also make a failed bracket a
valid entry state for the subsequent one.  Plain (non-atomic) accesses to
drbg->lock are sound across the span: WC_RNG_BANK_INST_LOCK_HELD is
invariantly held, and it is the only bit considered by contending
threads.  (root defect identified in 20260820 review batch; see PR
discussion for why the review's proposed fix -- pre-captured blockability
alone, without releasing the holds -- would have converted the dead code
into sleep-in-atomic / bh-off stalls)
…r message on failed wc_rng_bank_default_checkout(), and rework the error message when wc_linuxkm_drbg_generate() fails.
@douzzer
douzzer requested a review from kaleb-himes September 16, 2026 07:07
kaleb-himes
kaleb-himes previously approved these changes Sep 16, 2026

@kaleb-himes kaleb-himes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved as is for functionality, there are still some open compliance items we need to discuss with the CSTL but we can address them after we split the v7 branch from the master branch.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved critical and moderate issues affect RNG correctness, compatibility, and kernel integration.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR expands wolfSSL’s RNG and RNG-bank facilities with lifecycle, recovery, locking, pooling, and Linux kernel integration support.

Changes:

  • Adds expanded RNG and RNG-bank APIs, configuration, and lifecycle features.
  • Updates kernel integration, tests, documentation, and supporting cryptographic code.
  • Adds configuration macros and workflow updates.
File summaries
File Change
wolfssl/wolfcrypt/wc_port.h Adds CAS retry and timing abstractions.
wolfssl/wolfcrypt/types.h Updates constructor and no-malloc configuration behavior.
wolfssl/wolfcrypt/settings.h Updates RNG defaults and debug-stat configuration.
wolfssl/wolfcrypt/rsa.h Declares RSA RNG-detachment support.
wolfssl/wolfcrypt/rng_bank.h Defines expanded RNG-bank flags, state, and APIs.
wolfssl/wolfcrypt/random.h Defines expanded RNG features and APIs.
wolfssl/wolfcrypt/error-crypt.h Supports related cryptographic error handling.
wolfssl/wolfcrypt/ecc.h Updates ECC declarations for the RNG expansion.
wolfssl/wolfcrypt/curve25519.h Updates Curve25519 declarations for the RNG expansion.
wolfcrypt/test/test.h Extends test declarations for RNG coverage.
wolfcrypt/src/rsa.c Implements RSA RNG detachment.
wolfcrypt/src/error.c Updates related error handling.
wolfcrypt/src/ecc.c Integrates ECC implementation changes.
wolfcrypt/src/curve25519.c Integrates Curve25519 implementation changes.
tests/unit-mcdc/test_random_whitebox.c Adds white-box RNG coverage.
tests/unit-mcdc/test_random_fault_whitebox.c Adds RNG fault-path coverage.
linuxkm/patches/7.3/WOLFSSL_LINUXKM_HAVE_GET_RANDOM_CALLBACKS-7v3.patch Updates kernel random callback integration.
linuxkm/lkcapi_glue.c Updates kernel RNG glue, controls, and statistics.
linuxkm/linuxkm_wc_port.h Adds Linux-kernel portability support.
linuxkm/include.am Updates kernel build integration.
doc/dox_comments/header_files/rng_bank.h Documents expanded RNG-bank APIs.
doc/dox_comments/header_files/random.h Documents expanded RNG APIs.
configure.ac Adds RNG-extras configuration.
.wolfssl_known_macro_extras Registers RNG configuration macros.
.github/workflows/codespell.yml Updates spelling-check workflow configuration.
Review details

Suppressed comments (6)

doc/dox_comments/header_files/random.h:923

  • wc_RNG_DRBG_Reseed_Now() returns 0 when no DRBG is present (for example, RDRAND-backed RNGs); the implementation explicitly treats that as nothing to reseed. This return-value documentation incorrectly promises WRONG_TYPE_OBJECT_E for that case.
    \return WRONG_TYPE_OBJECT_E rng has no DRBG (RDRAND et al.).

doc/dox_comments/header_files/random.h:1619

  • The public header explicitly says a null free_hook unregisters an existing hook, but this Doxygen return description says null free_hook is invalid. Correct the documentation so API consumers are not told that the documented unregister operation is an error.
    \return BAD_FUNC_ARG rng or free_hook is null.

doc/dox_comments/header_files/rng_bank.h:695

  • The parameter list documents nonce and nonceSz before first_inst/last_inst, but the declaration immediately below takes the instance range first and the nonce afterward. Generated API documentation therefore presents the arguments in the wrong order.
    \param bank The bank to reseed.
    \param nonce Optional per-instance nonce material (may be null).
    \param nonceSz Length of nonce in bytes.
    \param first_inst The first instance offset.

doc/dox_comments/header_files/rng_bank.h:697

  • This says the wait budget is per instance, but wc_rng_bank_reseed_range() initializes its timer once before the whole range and reuses it for every instance. A slow earlier instance can therefore consume the budget and cause later instances to time out early. Either reset the timer for each instance or document this as a walk-wide budget.
    \param timeout_secs Wait budget per instance.

linuxkm/patches/7.3/WOLFSSL_LINUXKM_HAVE_GET_RANDOM_CALLBACKS-7v3.patch:470

  • When callback ownership is live but the callback reports not-ready, this fallback still returns readable whenever the native CRNG is ready. random_read_iter() now gates nonblocking reads on crng_ready_by_cb() and can return -EAGAIN, so poll/select may wake readers that immediately fail. Make poll use callback readiness whenever callbacks are live, and consult native readiness only when they are not.
 	return crng_ready() ? EPOLLIN | EPOLLRDNORM : EPOLLOUT | EPOLLWRNORM;

wolfssl/wolfcrypt/rng_bank.h:65

  • WC_16BIT_CPU builds define word32 as unsigned long while unsigned int can remain 16 bits. Consequently, 1U << 16 is not a valid 32-bit flag expression on those supported targets; use a 32-bit operand for this new bit.
#define WC_RNG_BANK_FLAG_AUTO_RECOVER_AND_PROMOTE  (1U << 16)
  • Files reviewed: 25/29 changed files
  • Comments generated: 9
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/rng_bank.c Outdated
Comment thread wolfcrypt/src/rng_bank.c
Comment thread wolfcrypt/src/rng_bank.c
Comment thread wolfssl/wolfcrypt/random.h
Comment thread wolfssl/wolfcrypt/rng_bank.h
Comment thread wolfcrypt/src/random.c
Comment thread wolfssl/wolfcrypt/settings.h 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 #11435

Scan targets checked: linuxkm-src, linuxkm-bugs, wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs

Findings: 18
18 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 linuxkm/lkcapi_sha_glue.c Outdated
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread linuxkm/lkcapi_sha_glue.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/test/test.c
  wolfssl/wolfcrypt/settings.h: fixes for a batch of static-analysis findings.

* complete the WC_CAS_WITH_RETRY post-loop dispositions in rng_bank.c and the
  lock_put()s: aborted releases percolate before the lock word (and, in
  wc_RNG_lock_put(), the mutex) is reported free, keeping ownership with the
  caller for retry; the inst_lock_*_extra() setters return the CAS result;
  wc_rng_bank_inst_invalidate_entropy() latches or condemns, mirroring
  wc_RNG_invalidate_entropy().

* wc_RNG_invalidate_entropy(): tolerate WRONG_TYPE_OBJECT_E from
  wc_RNG_DRBG_ScheduleReseed() -- a no-DRBG (direct-RDRAND) instance has
  nothing to schedule and nothing whose staleness the latch would mark;
  don't condemn it.

* wc_rng_bank_reseed_range(): fix undeclared identifier (inst -> drbg) in the
  HAVE_FIPS && FIPS_VERSION3_LT(7,0,0) && WC_RNG_HAVE_RBGC branch.

* _InitRng(): free and clear the full mutex when wc_LockMutex() fails after
  successful wc_InitMutex() (WC_RNG_INIT_FLAG_LOCK_INITIALLY).

* settings.h: WC_RESEED_INTERVAL (1UL << 48UL) -> (W64LIT(1) << 48) --
  unsigned long is 32 bits on LLP64 targets (64-bit MinGW), making the
  shift undefined.

* test.c: silence unused i in random_bank_test() when the reseed-interval
  check is configured out.
Comment thread wolfcrypt/src/random.c
…bank.c,

  wolfcrypt/test/test.c, wolfssl/wolfcrypt/random.h: fixes for a second batch
  of static-analysis findings.

* vmgenid fallback poller: search the ACPI IDs the kernel vmgenid driver
  matches -- "VMGENCTR" and "VM_GEN_COUNTER" -- rather than the spec's
  mixed-case spellings.  ACPICA upcases _HID/_CID strings when building
  the namespace and acpi_get_devices() matches by strcmp, so the old walk
  found QEMU only by its _HID and missed CID-only devices (Hyper-V, VMware).

* wc_linuxkm_drbg_generate(): in non-vector builds, drop local_bh_disable()
  around the blockable CAN_WAIT reseed and reinit operations and retake it
  after, mirroring the vector arm's release/reacquire bracket; the
  checkout's migrate_disable() persists across the sleep, preserving CPU
  pinning preemptibly.

* entropy daemon and sysfs stats dumps: gate the next-stir format fragments
  and arguments on WC_RNG_HAVE_NEXT_SEED.

* new WC_LKM_BANK_RBGC_FLAG (WC_RNG_BANK_FLAG_RBGC when WC_RNG_HAVE_RBGC,
  else WC_RNG_BANK_FLAG_NONE): keep LKCAPI functional without RBGC support
  compiled in.

* wc_rng_bank_init_nonce(): use (size_t)(-1) rather than SIZE_MAX in the
  allocation overflow check (C90 and NO_STDINT_H builds).

* wc_rng_bank_fini(): pre-scan all instances for WC_RNG_LOCK_HELD before any
  mutation, returning BUSY_E (retryable) with refcount untouched, free hook
  unfired, and root intact.

* random.h: #error on WC_RNG_DEBUG_STATS without the RNG lock facility.

* wc_RNG_DRBG_Stir_Nonce(): reject nonce == NULL with nonzero nonceSz
  (BAD_FUNC_ARG), matching the other nonce-bearing APIs.

* random_bank_test(): hoist held_inst to function scope and check it in
  from the shared teardown path, closing a leak on failing assertions.

* wc_RNG_DRBG_NextSeedGenerate_local(): pointer declaration style cleanup.
Comment thread wolfcrypt/src/rng_bank.c
@douzzer douzzer removed their assignment Sep 17, 2026
@douzzer
douzzer requested a review from philljj September 17, 2026 15:46
@JacobBarthelmeh
JacobBarthelmeh merged commit 6f47529 into wolfSSL:master Sep 17, 2026
403 of 404 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants