Re: [PATCH] crypto: doc - clarify hash callbacks state machine

From: Horia Geantă
Date: Mon Mar 19 2018 - 02:39:58 EST


On 3/16/2018 5:16 PM, Herbert Xu wrote:
> On Mon, Mar 05, 2018 at 12:39:45PM +0200, Horia Geantă wrote:
>> Even though it doesn't make too much sense, it is perfectly legal to:
>> - call .init() and then (as many times) .update()
>> - subseqently _not_ call any of .final(), .finup() or .export()
>
> Actually it makes perfect sense, because there can be an arbitrary
> number of requests for a given tfm. There is no requirement that
> you must finalise the first request before submitting new ones.
>
> IOW there can be an arbitrary number of outstanding requests even
> without the user intentionally abandoning any hash request.
>
The fact that there can be multiple requests in parallel (for a given tfm) is a
different topic.
Each request object has its state in its own state machine, independent from the
other request objects.
I assume this is clear enough.

Why I wanted to underline is that "abandoning" a hash request is allowed (even
though doing this is at least questionable), thus implementations must take
special care not to leak resources in this case.

If you think the commit message should be updated, then probably so should the
documentation update.

Thanks,
Horia