formats icon indicating copy to clipboard operation
formats copied to clipboard

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

Open 0kPN1 opened this issue 7 months ago • 1 comments

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.

0kPN1 avatar Jul 11 '25 06:07 0kPN1

I'm a little confused how this build is succeeding, then:

  • https://github.com/RustCrypto/formats/blob/6892620/.github/workflows/x509-tsp.yml#L44
  • https://github.com/RustCrypto/formats/actions/runs/16305626646/job/46050946801

It would be good to first capture std linkage as a build failure in CI.

tarcieri avatar Jul 16 '25 13:07 tarcieri

Closing as stale

tarcieri avatar Feb 11 '26 20:02 tarcieri