lkml.org 
[lkml]   [2021]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/6] drivers: crypto: qce: sha: Restore/save sha1_state/sha256_state with qce_sha_reqctx in export/import
From
Date


On 1/2/21 4:25 PM, Herbert Xu wrote:
> On Fri, Dec 18, 2020 at 10:30:22PM -0500, Thara Gopinath wrote:
>> Export and import interfaces save and restore partial transformation
>> states. The partial states were being stored and restored in struct
>> sha1_state for sha1/hmac(sha1) transformations and sha256_state for
>> sha256/hmac(sha256) transformations.This led to a bunch of corner cases
>> where improper state was being stored and restored. A few of the corner
>> cases that turned up during testing are:
>>
>> - wrong byte_count restored if export/import is called twice without h/w
>> transaction in between
>> - wrong buflen restored back if the pending buffer
>> length is exactly the block size.
>> - wrong state restored if buffer length is 0.
>>
>> To fix these issues, save and restore the entire qce_sha_rctx structure
>> instead of parts of it in sha1_state and sha256_state structures.
>> This in turn simplifies the export and import apis.
>>
>> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
>> ---
>> drivers/crypto/qce/sha.c | 93 ++++------------------------------------
>> 1 file changed, 8 insertions(+), 85 deletions(-)
>
> How is this safe when the reqctx structure contains pointers?

Hi Herbert,

You are right. Also more I think about this, it is better to have
another struct to export and import the relevant pieces.
I will fix this and send across a v2.

>
> Cheers,
>

--
Warm Regards
Thara

\
 
 \ /
  Last update: 2021-01-08 16:52    [W:0.066 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site