Skip to content
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

Keccak pulling std features #86

Closed
milosdjurica opened this issue Jan 24, 2025 · 7 comments
Closed

Keccak pulling std features #86

milosdjurica opened this issue Jan 24, 2025 · 7 comments

Comments

@milosdjurica
Copy link

As you can check, when running the following command, keccak includes std features via cpufeatures crate. It can cause problems later on for end users, in case they need fully no_std compatible library.

Command ->

 cargo tree -p keccak --no-default-features

Output ->

keccak v0.2.0-pre.0 (/Users/username/path/to/sponges/keccak) 
└── cpufeatures v0.2.16 
    └── libc v0.2.164 default,std

I will open a PR with a fix to make cpufeatures optional dependency and make it be included by default. This way users get the feature by default, but they can also opt out of it, if they need/want to.

@tarcieri
Copy link
Member

That seems like a bug in the cpufeatures crate, which shouldn't need std

@newpavlov
Copy link
Member

Yeah, cpufeatures should use default-features = false for libc. Honestly, I am a bit surprised that libc enables std by default.

@tarcieri
Copy link
Member

I am also surprised libc even has a std feature. I would've thought it was used by std.

Anyway, here's a PR to cpufeatures: RustCrypto/utils#1142

@milosdjurica
Copy link
Author

keccak crate still passes check on no_std targets e.g. cargo build --target thumbv7em-none-eabi , but as you can see, in cargo tree, it includes std features too. It is a bit tricky, I am not sure how this happends

@tarcieri
Copy link
Member

@milosdjurica the cpufeatures crate only links libc on Linux, Android, and macOS/iOS, so the only impact is when you're trying to compile a no_std crate on those targets

@milosdjurica
Copy link
Author

milosdjurica commented Jan 25, 2025

In Cargo.lock , Keccak still points on v0.2.16 of cpufeatures, I have opened PR that updates it to v0.2.17 , let me know if I should change anything else

@newpavlov
Copy link
Member

Cargo.lock committed in this repository has not effect on keccak users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants