Make unpredictableSeed use BCryptGenRandom (CNG) on Windows#10624
Make unpredictableSeed use BCryptGenRandom (CNG) on Windows#10624dlang-bot merged 1 commit intodlang:masterfrom
unpredictableSeed use BCryptGenRandom (CNG) on Windows#10624Conversation
|
Thanks for your pull request, @0xEAB! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#10624" |
a3b6342 to
499bfa0
Compare
20c2a61 to
345d936
Compare
std/random.d
Outdated
| import core.sys.windows.wincrypt : | ||
| CryptAcquireContext, | ||
| CryptGenRandom, | ||
| CryptReleaseContext, | ||
| CRYPT_VERIFYCONTEXT, | ||
| MS_STRONG_PROV, | ||
| PROV_RSA_FULL; |
There was a problem hiding this comment.
Blame D-Scanner for this monstrosity :)
345d936 to
9a3cdea
Compare
I was pretty surprised that DRuntime didn't already have BCrypt bindings. It shouldn't be much work for me to add them. What do you think? |
Yes please. |
Will do. EDIT: found it |
|
dlang/dmd#20740 has been merged – great! |
unpredictableSeed use CryptGenRandom (CryptoAPI) on WindowsunpredictableSeed use BCryptGenRandom (CNG) on Windows
6b6bd3c to
ad93bd7
Compare
|
I suppose this needs dlang/dmd#20780 to have a chance of working. |
Whoops, sorry! 😣 |
|
Attribute soup got a bit too salty. |
|
Merged dependant PR |
19914df to
5a80f7d
Compare
5a80f7d to
5294b6a
Compare
This patch changesunpredictableSeedto callCryptGenRandomon Windows.This patch changes
unpredictableSeedto callBCryptGenRandomon Windows.Analogous to #10623 (Linux).
On the one hand, the legacy CryptoAPI might be deprecated, on the other hand using it does not introduce a new DLL dependency.advapi32is already required bystd.registryand Phobos is linked against as seen in the currentMakefile.Using the more modern CNG (BCryptGenRandom) would not only introduce a new dependency, but also require us to add the corresponding bindings to druntime. I figured that wouldn’t be worth the effort for now.