formats icon indicating copy to clipboard operation
formats copied to clipboard

Builder feature on no-std and no getrandom supported targets

Open MihaelBercic opened this issue 11 months ago • 4 comments

Would it be possible to have the "builder" feature be without the "std" feature and without the "getrandom" dependency?

For usage on no-std targets and no getrandom supported targets (esp32).

MihaelBercic avatar Mar 07 '25 18:03 MihaelBercic

It looks like the one usage of std is for SystemTime to build the signing time attribute.

That can potentially be replaced by an explicit parameter, similar to how the ssh-key crate works.

Offhand I don't see where the builder is pulling in getrandom though.

tarcieri avatar Mar 07 '25 18:03 tarcieri

That'd be awesome.

Regarding the getrandom, it seems to be:

cargo tree --edges all

│   │   │   ├── rsa feature "std"
│   │   │   │   ├── rsa v0.9.7 (*)
│   │   │   │   ├── rand_core feature "std"
│   │   │   │   │   ├── rand_core v0.6.4 (*)
│   │   │   │   │   ├── rand_core feature "alloc"
│   │   │   │   │   │   └── rand_core v0.6.4 (*)
│   │   │   │   │   ├── rand_core feature "getrandom"
│   │   │   │   │   │   └── rand_core v0.6.4 (*)
│   │   │   │   │   └── getrandom feature "std"
│   │   │   │   │       └── getrandom v0.2.15 (*)

and

── cms feature "builder"
│   ├── cms v0.2.3
│   │   ├── aes feature "default"
│   │   │   └── aes v0.8.4
│   │   │       ├── cfg-if feature "default"
│   │   │       │   └── cfg-if v1.0.0
│   │   │       └── cipher feature "default"
│   │   │           └── cipher v0.4.4
│   │   │               ├── crypto-common feature "default"
│   │   │               │   └── crypto-common v0.1.6
│   │   │               │       ├── generic-array feature "default"
│   │   │               │       │   └── generic-array v0.14.7
│   │   │               │       │       └── typenum feature "default"
│   │   │               │       │           └── typenum v1.18.0
│   │   │               │       │       [build-dependencies]
│   │   │               │       │       └── version_check feature "default"
│   │   │               │       │           └── version_check v0.9.5
│   │   │               │       ├── generic-array feature "more_lengths"
│   │   │               │       │   └── generic-array v0.14.7 (*)
│   │   │               │       ├── typenum feature "default" (*)
│   │   │               │       └── rand_core feature "default"
│   │   │               │           └── rand_core v0.6.4
│   │   │               │               └── getrandom feature "default"
│   │   │               │                   └── getrandom v0.2.15
│   │   │               │                       └── cfg-if feature "default" (*)

MihaelBercic avatar Mar 07 '25 18:03 MihaelBercic

Might need to add default-features = false to rsa and possibly aes too

tarcieri avatar Mar 07 '25 18:03 tarcieri

Might need to add default-features = false to rsa and possibly aes too

Thank you

MihaelBercic avatar Mar 07 '25 19:03 MihaelBercic