On 30.11.2017 13:41, Antoine Tenart wrote:
> On Thu, Nov 30, 2017 at 12:52:42PM +0100, Kamil Konieczny wrote:
>> On 30.11.2017 10:29, Antoine Tenart wrote:
>>> On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote:
>>>> can the driver get request for final/finup/digest with null req->result ?
>>>
>>> I don't think that can happen. But having an update called without
>>> req->result provided is a valid call (though it's not well documented).
Yes, this field may be unset until finup/final.
One more to watch out is that in final, you can have areq->nsize != 0 so
you should not use areq->nsize nor areq->src
>> so maybe:
>>
>> if (sreq->finish) {
>> result_sz = crypto_ahash_digestsize(ahash);
>> memcpy(sreq->state, areq->result, result_sz);
>> }
>
> No, if we do this we'll lose the ability to export the current state.
So maybe save it into request context:
result_sz = crypto_ahash_digestsize(ahash);
ctx = ahash_request_ctx(areq);
if (sreq->finish)
memcpy(sreq->state, areq->result, result_sz);
else
memcpy(sreq->state, ctx->state, result_sz);
--
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland