lkml.org 
[lkml]   [2015]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator
Le 15/05/2015 08:52, Herbert Xu a écrit :
> On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote:
>>
>> +int sun4i_hash_export(struct ahash_request *areq, void *out)
>> +{
>> + struct sun4i_req_ctx *op = ahash_request_ctx(areq);
>> +
>> + memcpy(out, op, sizeof(struct sun4i_req_ctx));
>> + return 0;
>> +}
>> +
>> +int sun4i_hash_import(struct ahash_request *areq, const void *in)
>> +{
>> + struct sun4i_req_ctx *op = ahash_request_ctx(areq);
>> +
>> + memcpy(op, in, sizeof(struct sun4i_req_ctx));
>
> This is very wrong. You're importing an arbitrary ss pointer. The
> whole point of having an import function instead of just a simple
> memcpy is to deal with such problems.
>
> Cheers,
>

Hello

You are right, I have totally mis-understood the export/import functions by just reading them from crypto/md5.c.
Reading them from drivers/crypto/* is better.

Incidental question, I need to use the MD5 IV for export_md5 function, but they are not defined anywhere (unlike SHAxx ones), does this is voluntary or do you will accept a patch for adding them.

Regards



\
 
 \ /
  Last update: 2015-05-16 20:21    [W:0.121 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site