Skip to content

fix(x509-tsp): add proper no-std support #1939

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0kPN1
Copy link

@0kPN1 0kPN1 commented Jul 11, 2025

x509-tsp: Add proper no-std support

Summary

The x509-tsp crate does not properly support no-std environments, despite being part of the RustCrypto ecosystem where no-std support is a core principle. Even when using default-features = false, the crate forces std features on its dependencies, making it unusable in embedded systems, WASM, and other no-std environments.

Current Behavior

When adding x509-tsp as a dependency with default-features = false:

[dependencies]
x509-tsp = { version = "0.1", default-features = false }

The dependency tree shows that std features are still enabled:

x509-tsp v0.1.0
├── cmpv2 feature "std"
│   ├── der feature "std"
│   └── spki feature "std"
└── cms feature "std"
    └── der feature "std"

Expected Behavior

The crate should respect default-features = false and work in no-std environments, following the pattern established by other RustCrypto crates.

Root Cause

Looking at the Cargo.toml (both v0.1.0 and current master), the dependencies are declared without default-features = false:

[dependencies]
der = { version = "0.8.0-rc.7", features = ["alloc", "derive", "oid", "pem"] }
cms = { version = "=0.3.0-pre.0" }
cmpv2 = { version = "=0.3.0-pre.0", features = ["alloc"] }
x509-cert = { version = "0.3.0-rc.0", default-features = false }

Note that only x509-cert properly uses default-features = false.

fix(x509-tsp): add proper no-std support

- Add default-features = false to all dependencies
- Create proper feature flag structure with std and alloc features
- Make std opt-in rather than mandatory
- Remove incorrect alloc features from cms and x509-cert

This allows the crate to be used in no-std environments like embedded
systems and WASM, following the RustCrypto ecosystem's no-std first
philosophy.

Fixes the issue where even with default-features = false, std features
were forced on dependencies.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant