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

x509-cert: no_std Builder - Replace std::collections::HashSet with an alternative? #1641

Closed
juliankrieger opened this issue Jan 28, 2025 · 5 comments · Fixed by #1642
Closed

Comments

@juliankrieger
Copy link

juliankrieger commented Jan 28, 2025

I'm currently looking into a library which can create CSR in no_std envs. Is there any interest in replacing HashSet with a no_std alternative?

@tarcieri
Copy link
Member

Related: #689, #1603

@tarcieri tarcieri changed the title no_std Builder - Replace std::collections::HashSet with an alternative? x509-cert: no_std Builder - Replace std::collections::HashSet with an alternative? Jan 28, 2025
@juliankrieger
Copy link
Author

juliankrieger commented Feb 1, 2025

@tarcieri I've read the issues and I am interested in a no-alloc version. However, what I need most is for x509-cert (or any x509 parsing and/or verification crate) to work in no_std + alloc. AFAIK there is little use of std in x509-cert. I would be open to creating a PR where I replace HashSet with hashbrown or something similar.

Alternatively, is there any other crate I can use for this usecase? I must admit, I'm not quite up-to-date on X509 handling in the rust ecosystem.

@tarcieri
Copy link
Member

tarcieri commented Feb 1, 2025

Aah, I see what you're saying. We should probably enable the clippy::std_instead_of_alloc and clippy::std_instead_of_core lints.

tarcieri added a commit that referenced this issue Feb 1, 2025
The former is available in liballoc.

Closes #1641
tarcieri added a commit that referenced this issue Feb 1, 2025
The former is available in liballoc.

Closes #1641
@juliankrieger
Copy link
Author

juliankrieger commented Feb 1, 2025

very cool! Yes, I agree with the lints :) I actually use those myself. For Sans-IO libraries I have only yet found a few cases where std was actually needed :) Additionally, I build against a no_std target in GH actions to check for transitive std dependencies, but that's probably overkill for x509-cert.

@tarcieri
Copy link
Member

tarcieri commented Feb 1, 2025

I build against a no_std target in GH actions to check for transitive std dependencies, but that's probably overkill for x509-cert.

We already do that (on pretty much every crate we develop):

https://github.com/RustCrypto/formats/blob/master/.github/workflows/x509-cert.yml#L24-L42

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.

2 participants