heartsucker / derp

DER Parser (and Writer)
https://crates.io/crates/derp
Other
1 stars 6 forks source link

no_std #6

Open nickray opened 4 years ago

nickray commented 4 years ago

Hiya, any plans for no_std compatibility? I'm looking for a DER writer in the context of FIDO2 authenticators (on microcontrollers), and this seems the most minimal implementation I've found.

There are two issues:

Possibly having a default-feature std would go against the "minimal" intent of this library. My alternative plan is to fork this into derpy and do things there.

heartsucker commented 4 years ago

I don't have plans for that at the moment, but that is entirely because I threw this crate together to have something minimal for other work I was doing. That said, I think that should be doable, and it would also force me to clean up the API some since it's not super ergonomic. Is this something you could possible help with?

nickray commented 4 years ago

Maybe! 😊 Although not likely soon, it turns out all I needed is formatting a sequence of two integers: https://github.com/nickray/usbd-ctaphid/blob/main/src/insecure.rs#L105-L147.

I will revisit when I move from "make it work" to "make it right".

heartsucker commented 4 years ago

I'll see if I can get this done if a few hours. If so, I can close this. Otherwise, I'll have to get to it another time.

nickray commented 4 years ago

I did some work in https://github.com/nickray/usbd-ctaphid/blob/e1c02114d1c816d5b65770e70b84790ea677b45d/src/derpy.rs, covers my use case of sequences of integers for ASN.1 DER formatting of ECDSA signatures. I'm not sure this merits inclusion here (apart from being written a bit more understandably), mainly because there's no real i.e. agreed-upon equivalent for Write in no_std.

heartsucker commented 4 years ago

I think what may be reasonable is tidying up the current API and then adding a no_std features that disables all the heap things and leaves only the stack-only things. Because I agree that some of your use cases apply to others, and I think the minimal nature of this crate makes inclusion natural.