-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open a BCrypt algorithm handle #101476
Open a BCrypt algorithm handle #101476
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
65b32b1
to
b2e4f9d
Compare
Thanks, looks great! @bors r+ |
@bors p=1 so the fix is sure to be in the next nightly |
…omcc Open a BCrypt algorithm handle Fixes rust-lang#101474, supplants rust-lang#101456. Replaces use of a pseduo handle with manually opening a algorithm handle. Most interesting thing here is the atomics. r? `@thomcc`
📌 Commit a68ba39e7733dbb427708ef164164c2c55705a3c has been approved by It is now in the queue for this repository. |
@thomcc I pushed small commit so that miri won't be broken by this. The weirdness is a little hack to avoid having to use a bunch of |
⌛ Testing commit a68ba39e7733dbb427708ef164164c2c55705a3c with merge d27cb8dad98c06b510106bd299076341741ca0e1... |
💔 Test failed - checks-actions |
a68ba39
to
832c7af
Compare
fixed formatting @bors r=thomcc |
🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened. |
This comment has been minimized.
This comment has been minimized.
☀️ Test successful - checks-actions |
Finished benchmarking commit (9682b5d): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Footnotes |
#[cfg(miri)] | ||
fn open() -> Result<Self, c::NTSTATUS> { | ||
const BCRYPT_RNG_ALG_HANDLE: c::BCRYPT_ALG_HANDLE = ptr::invalid_mut(0x81); | ||
let _ = ( | ||
c::BCryptOpenAlgorithmProvider, | ||
c::BCryptCloseAlgorithmProvider, | ||
c::BCRYPT_RNG_ALGORITHM, | ||
c::STATUS_NOT_SUPPORTED, | ||
); | ||
Ok(Self(BCRYPT_RNG_ALG_HANDLE)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised to see a Miri special path here; usually we try to execute the real thing where feasible (and BCryptOpenAlgorithmProvider
looks easy enough to fake). Also please Cc @rust-lang/miri when adding such a codepath, and always add a comment explaining why Miri uses a different codepath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, for this I'd say it's better to just add the shims to miri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry! My intent was for this to be temporary until I was confident that the crash issue was addressed. Then we can go back to using BCRYPT_USE_SYSTEM_PREFERRED_RNG
as the default and BCryptOpenAlgorithmProvider
would be the fallback. I can submit a PR to undo tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, if this is just temporary then implementing the shims in Miri would indeed not be worth it.
Fixes #101474, supplants #101456.
Replaces use of a pseduo handle with manually opening a algorithm handle.
Most interesting thing here is the atomics.
r? @thomcc