-
Notifications
You must be signed in to change notification settings - Fork 159
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
core-only "heapless" support #51
Comments
it will be hard, but very valuable to be able to make the bigint lib usable with genericarray, |
You could potentially use Unfortunately they haven't updated to |
Yes |
IIUC it should be possible to do completely on stack, with something like: fn mul<const N: usize>(a: [Word; N], b: [Word; N]) -> [Word; 2*N] { .. } |
For what it's worth, I started working on a crate with traits to abstract over the details between containers like
Not using it for anything yet and it could probably use some work, but I think it has a similar inspiration to this sort of use case. |
@newpavlov it is possible, but as we don't have const generics yet this gets quite ugly and complex quickly, especially if your interfaces have to rely on the certain size, as they would for RSA given a fixed bitwitdth |
@dignifiedquire if you'd like any help doing https://docs.rs/ecdsa/0.6.0/ecdsa/asn1_signature/struct.Asn1Signature.html |
It might be interesting to switch to that if it also provided a heap-allocated type like |
With the switch to crypto-bigint merged, how feasible is this now? I looked a little at what it would take to template everything on traits from crypto-bigint to allow using either heap or stack versions, and it seems like crypto-bigint isn't quite designed for this use case (e.g. inv_mod is implemented on the types and not as part of a trait). |
There's an Though I would probably suggest holding off until we land RustCrypto/crypto-bigint#755 which should simplify some things (and even make it possible to add the |
Right now, there is a PR open (#22) that will allow the RSA crate to be used in core+alloc environments (e.g. environments without libstd, but where a dynamic allocator is available).
The next step is for the RSA crate to support core-only environments. This would require multiple changes:
num-bigint-dig
would need to be represented either as a stack-allocated array (GenericArray? ArrayVec?) or a slice reference (wooo lifetimes) instead of a heap-allocated vector. Furthermore, we'll need to make extra sure that all the operations are bounded within a certain numeric range.The text was updated successfully, but these errors were encountered: