Skip to content

F-4936 - Take parent DRBG lock around raw dispatch calls - #454

Open
ColtonWilley wants to merge 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix/f_4936
Open

F-4936 - Take parent DRBG lock around raw dispatch calls#454
ColtonWilley wants to merge 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix/f_4936

Conversation

@ColtonWilley

Copy link
Copy Markdown
Contributor

Child DRBGs called the parent's get_seed/clear_seed via raw dispatch pointers with no lock held, so concurrent child instantiations (e.g. two threads' first RAND_bytes) raced on the shared primary's WC_RNG.

Fix (mirrors OpenSSL's own PROV_DRBG):

  • capture parent ENABLE_LOCKING/LOCK/UNLOCK in newctx
  • take the parent lock around parentGetSeed/parentClearSeed
  • propagate enable_locking to the parent, one-shot; publish the local mutex only after init
  • scrub the seed in place if the clear_seed lock fails

F-5186 reviewed with this: works as designed — EVP_RAND locking is opt-in and core serializes generate/uninstantiate once enabled. Full suite green, default and --enable-seed-src.

wp_drbg_instantiate called the parent's get_seed/clear_seed through raw
dispatch pointers with no lock, racing concurrent child instantiations
on the shared primary's WC_RNG. Capture the parent's locking dispatch
functions, wrap the parent calls, and propagate enable_locking one-shot,
mirroring OpenSSL's PROV_DRBG. F-5186 analyzed alongside: works as
designed under the EVP_RAND locking contract.
@ColtonWilley

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please.

@ColtonWilley ColtonWilley added the ci:all PR OSP toggle: run all label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:all PR OSP toggle: run all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant