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

crypto-common: remove std feature #1680

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Conversation

tarcieri
Copy link
Member

As of #1660, the crypto-common crate stopped linking std entirely by switching to core::error::Error.

That PR didn't remove the std feature however, which was retained to transitively activate the std features of getrandom and rand_core optioinally in the event their corresponding features are enabled.

This PR goes ahead and removes it entirely, which also unblocks being able to remove the std feature from other crates like aead, cipher, digest, and universal-hash.

As of #1660, the `crypto-common` crate stopped linking `std` entirely by
switching to `core::error::Error`.

That PR didn't remove the `std` feature however, which was retained to
transitively activate the `std` features of `getrandom` and `rand_core`
optioinally in the event their corresponding features are enabled.

This PR goes ahead and removes it entirely, which also unblocks being
able to remove the `std` feature from other crates like `aead`,
`cipher`, `digest`, and `universal-hash`.
@newpavlov
Copy link
Member

That PR didn't remove the std feature however, which was retained to transitively activate the std features of getrandom and rand_core optioinally in the event their corresponding features are enabled.

I don't think it works like this with the current code. In my understanding, the std feature in aead, cipher, universal-hash will not have such effect.

@tarcieri
Copy link
Member Author

tarcieri commented Sep 30, 2024

@newpavlov that text is referring to this line here: https://github.com/RustCrypto/traits/pull/1680/files#diff-8c9f78f3e1ed48579936f1e2a5dfc44cd937e3af9aaf4a53ae6fb0f009c81cd1L24

That is the only function of the std feature in the current crypto-common code (prior to this PR).

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can ignore passing std feature to the getrandom and rand_core? Users which need implementation of the Error trait from those crates will be able to enable it explicitly.

@tarcieri
Copy link
Member Author

Sure, that's gone from crypto-common in this PR, and we can remove it in all the other crates that do it as well

@newpavlov
Copy link
Member

that test is referring to this line here

But this PR does remove the std feature for crypto-common. Thus IIUC enabling std for aead will not enable it for rand_core.

@newpavlov
Copy link
Member

we can remove it in all the other crates that do it as well

Unfortunately, at least for digest we will not be able to do that since it has code which relies on std::io.

@tarcieri
Copy link
Member Author

Yeah, crates that use actual std features like std::io have a reason to retain a std feature

@tarcieri tarcieri merged commit 6077990 into master Sep 30, 2024
35 checks passed
@tarcieri tarcieri deleted the crypto-common/remove-std-feature branch September 30, 2024 19:55
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 this pull request may close these issues.

2 participants