Conversation
2d21ffd to
4474ac2
Compare
5734789 to
23bdc9c
Compare
That would be pretty nice. I've made several attempts over the years at this and never got anything that worked (ie was actually cleaner/easier to understand and did not introduce perf issues somwhere) |
Just a pure gut feeling: it might be a good playground for C++20 coroutines. |
|
I would be concerned about using coroutines wrt baremetal systems, I don't know what degree of runtime support this requires. |
randombit
left a comment
There was a problem hiding this comment.
Seems basically fine. I checked and it does not seem to introduce any performance regressions.
I wonder for final if we should be checking the length of the span. This would be a new check in that the current approach just writes to the provided pointer and if you don't provide enough data we'll overwrite something we shouldn't. And I guess we can continue that here; it just feels a little unfriendly to do so given that we do know the length of the output span.
I deliberately didn't add checks to the Maybe we could replace the asserts with |
Sorry I missed this. Looks fine then.
Yeah concur on this. |
Pull Request Dependencies
This interferes with the Keccak refactoring, KMAC and the work done in
MDx_HashFunction. It shouldn't be too hard to fix those conflicts in any order, though.Description
This is upgrading the internal virtual methods of
Buffered_Computation(i.e.add_data()andfinal_result()) to usestd::span<>. Also some of the implementations in the "hash" and "mac" modules benefit fromBufferSlicerandBufferStufferto abstract some of the pointer/offset mangling.... courtesy of a long boring flight. :)
Future Work
buffer_insert,copy_mem,xor_buf, and friendsstd::span-aware to further improve on the expressiveness of those methodsMDx_HashFunction(see also Remove MDx_HashFunction #3550)Symmetric_Algorithm::key_schedule()(see std::span for SymmetricAlgorithm::key_schedule() #3684)