-
Notifications
You must be signed in to change notification settings - Fork 238
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
Can't build with no_std on Windows because of BCryptGenRandom
import
#247
Comments
The I think one easy workaround, assuming you don't need |
Unfortunately, I need to use And there's no need for a second feature flag, because rustc doesn't compile |
I just checked and iced/src/rust/iced-x86/src/block_enc.rs Lines 166 to 183 in 1fb4876
If this can be converted into an efficient Adding all instructions to a new vec. Sorting it. Verifying that there are no dupes (except ip==0) should work. Block encoder perf would have to be checked as well to make sure it's still acceptable. |
- Replaced jump with a long jump that doesn't use `mov rax` - Updated trampoline setup - Fixed `iced-x86` compilation. See: icedland/iced#247
My situation: I'm building a kernel driver and decided to use this crate. When I was building my driver, I noticed a weird import:
BCryptGenRandom
.I managed to track down the issue: The import comes from the
getrandom
crate. It's used byahash
, which is used byhashbrown
which is used byiced-x86
. The problem is, thatahash
doesn't hide thegetrandom
dependency behind a feature flag, so it's always used even though you might have enabled thecompile-time-rng
feature. See: https://github.com/tkaitchuck/aHash/blob/e77cab8c1e15bfc9f54dfd28bd8820c2a7bb27c4/src/random_state.rs#L95-L104They added a
runtime-rng
feature, but that's only available in thesimplification
branch.And this is the issue. Because
getrandom
always detects windows as platform, it'll importBCryptGenRandom
, even though we are inside a kernel driver where we don't have access tobcrypt.dll
.How to fix (in this library):
Hashbrown has a feature that enables the compile time rng. Once the next version of
ahash
/hashbrown
has been released, you could either enable the compile time feature by default or forward it to the user.How to fix (on your own):
Add this to your Cargo.toml to use the updated version of
aHash
wheregetrandom
is disabled:You also need to clone this repository and manually enable the compile time rng for
hashbrown
insrc\rust\iced-x86\Cargo.toml
:References
compile-time-rng
on a platform withgetrandom
tkaitchuck/aHash#94The text was updated successfully, but these errors were encountered: