Hash hardware cant do “only” final. How to implement?
I'm writing a device driver for a hardware-crypto engine. This engine has a limitation so that I need to implement the ".finup" part of the hash api because it can't "just" finalise with a "0" length request.
Should I implement only ".finup" and register "NULL" for ".final" or should I return some kind of error ?
Solved: (its clearly written in the /include/hash.h that .final is Mandatory!)
Solution is to "leave" the final block during an "update" request out of the engine. This last block will be used together with the "final" bit set in the hardware registers. In cause there would be consecutive "update" request, this block will be processed together with the request except that last block again. Since I need a buffer anyway for this, I am not even passing the request to the hardware until I have at least 1 page worth off data the be processed. For the ".export" call I will process this buffer except the last block so I don't need to export a bigger block of data.
Last edited by drbrains; 11-26-2018 at 09:25 AM.
Reason: as requested by @MensaWater
|