UMDF “UniversalDDI” compliance fails due to std using non-universal RNG (bcryptprimitives!ProcessPrng) #533
Unanswered
edvard-pettersen-elas-ai
asked this question in
Q&A
Replies: 1 comment
-
|
Thank you for reporting this issue in such great detail. We are discussing with internal teams about the appropriate next steps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When building UMDF drivers that must meet the DCHU “Universal driver” requirements, any use of Rust
stdthat touchessys::randomcauses the binary to fail ApiValidator. The root cause is that Ruststd(since rust-lang/rust#121337) callsProcessPrngfrombcryptprimitives.dll, which is not on the UniversalDDI whitelist. As a result, even trivial code that instantiates a default HashMap fails validation, blocking Windows Update publishing.Why this matters
Universal compliance is required to publish via Windows Update. If
windows-drivers-rsis intended for UMDF “Universal” scenarios, users currently must pin Rust to an older toolchain or avoidstdfeatures that depend onsys::random, both which are major limitations for production drivers.Environment
Minimal repro
Build & validate:
Observed behavior
stdrandomness on Windows callsProcessPrng(viastd::sys::random::windows::fill_bytes), which leads ApiValidator to flagbcryptprimitives.dll!ProcessPrngas unsupported for UniversalDDIs.std::collections::HashMaporDefaultRandomState) trigger the failure.Expected behavior
windows-drivers-rsin a UMDF Universal driver should not cause UniversalDDI violations solely due tostd’s RNG choice.std(or guidance/tooling around it) should use a Universal-allowed API (e.g.,BCryptGenRandomfrombcrypt.dll) when targeting Universal drivers, or avoid non-universal calls entirely.Workarounds we found
RandomStateby providing an explicit hasher (e.g.,hashbrown::HashMapwithBuildHasherDefault<...>): helps in some cases, butHashMap/RandomState);stdfeatures that might touch RNG; andWhat we’re asking from
windows-drivers-rsmaintainersCargo.tomlguidance,#![no_std]/allocrecommendations if applicable, hash map alternatives, etc.).windows-drivers-rsfeature (or companion crate) that:getrandom/std(if possible without forkingstd), orRandomState/other RNG-touchingstdfeatures that would importProcessPrng.std), would you be open to:BCryptGenRandominbcrypt.dllwhen building for a “Universal” target triple or cfg); and/orBeta Was this translation helpful? Give feedback.
All reactions