-
Notifications
You must be signed in to change notification settings - Fork 1
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
Using dcaf without alloc #29
Comments
Hi, and thanks for the feature suggestion. Using
Personally, I think that the latter option would probably be more elegant in the long term (considering that the original intention is to get away from dynamic allocation), although we should try not to complicate the API for users that do have an allocator available. Just some of my observations/thoughts regarding this:
We're very much open to contributions if you want to work on this, even though it might take some time for us to review pull requests (as AFAIK both @falko17 and I are currently busy with some other stuff). |
I agree with most of @pulsastrix's points. Some short comments on this:
I'm not sure if we'd really want to decouple from the COSE library. At first glance, I think the complexity this brings into dcaf-rs is only worth it if coset cannot be made
In principle, I think this is a good idea. Ideally, dcaf-rs should support both environments that have allocators and those that don't, so an abstraction like this (assuming it's possible without complicating its use too much) would be a good fit.
Yes, agreed, contributions are always welcome—it'll probably be some time before either of us can implement a big feature like this ourselves. Starting next year, I should at least have enough time for reviews, though. |
Is your feature request related to a problem? Please describe.
dcaf provides many convenient tools for constrained devices, but requires an allocator.
An allocator is rarely used in OSes such as RIOT OS and Ariel OS, and handling unbounded memory requirements makes it hard to get reliable statements such as "the system can establish and maintain a security association of an administrator while under attack by users who are authorized to establish their connections", which is desirable at least in Ariel.
Describe the solution you'd like
Ideally, dcaf should work with no_alloc – at least in a subset of features.
Describe alternatives you've considered
allocator_api
, and would require threading an allocator quite far through about everything.Additional context
There are some parts where I know this will be hard:
dcaf builds strongly on ciborium, which itself requires alloc for everything but its low-level parts.
I think that the parsing / generating side would work well with a no-alloc CBOR library (such as cborium-ll or minicbor), but that'll mean replacing what is currently a
Vec<ciborium::Value>
or similar (at extension points, where ciborium presents parts that it could not parse) with iterators over parsable CBOR.dcaf builds on coset; not sure what can be done there.
Some COSE structures are not well bounded; for example, creating a serialized
Sig_structure
in linear memory requires a buffer larger than the original message. (That's also the case with allocation, but there, it can "just allocate" that). Operations therefore either need access to a sufficiently sized buffer, or crypto back-ends that support scatter-gather operations. (Fortunately, not for AEAD operations, where implementers are particularly averse to streaming interfaces: there, ciphertext is already in one place, and only the AAD needs to be composed and streamed).I know this is a large request. If this is something you like to start exploring, I'm happy to contribute. If it is something you don't regard as feasible, are you open to moving parts where it is possible easily (or that are already no-alloc) into a utility crate sharable both by dcaf and tools that operate in no-alloc space?
The text was updated successfully, but these errors were encountered: