heartsucker/derp

no_std

Opened this issue · 5 comments

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:

  • lack of core::io::Writer (but there's e.g. core_io)
  • lack of Vec and friends (but there's heapless)

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.

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?

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".

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.

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.

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.