Skip to content

Failure with sha-1 crate due to cpuid #1173

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

Closed
vi opened this issue May 16, 2021 · 2 comments
Closed

Failure with sha-1 crate due to cpuid #1173

vi opened this issue May 16, 2021 · 2 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-x86_64 Target: x64 processors

Comments

@vi
Copy link
Contributor

vi commented May 16, 2021

It builds, but when running it fails:

trap at Instance { def: Item(WithOptConstParam { did: DefId(1:12896 ~ core[8231]::core_arch::x86::cpuid::__cpuid_count), const_param_did: None }), substs: [] } (_ZN4core9core_arch3x865cpuid13__cpuid_count17hcfa5bc63bfe66a21E): __cpuid_count arch intrinsic doesn't yet support specified

Workaround: use "force-soft" feature of sha-1:

sha-1={version="0.9", features=["force-soft"]}
@bjorn3 bjorn3 added C-enhancement Category: An issue proposing an enhancement or a PR with one. O-x86_64 Target: x64 processors labels May 16, 2021
@bjorn3
Copy link
Member

bjorn3 commented May 16, 2021

sha-1 uses cpufeatures which requests leaf 7 of the cpuid. std_detect (which provides is_*_feature_detected!()) only uses leaf 0, 1, 0x8000_0000 and 0x8000_0001, which means that I only implemented a fake cpuid for those leafs. cpufeatures also requires leaf 7 subleaf 0.

@bjorn3 bjorn3 closed this as completed in a9d033d May 16, 2021
@bjorn3
Copy link
Member

bjorn3 commented May 16, 2021

All subleaves of leaf 7 now return 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-x86_64 Target: x64 processors
Projects
None yet
Development

No branches or pull requests

2 participants