All of lore.kernel.org
 help / color / mirror / Atom feed
* Is a crypto_ahash_init required before invoking crypto_ahash_import?
@ 2016-02-25 21:56 Tom Lendacky
  2016-02-25 22:11 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Lendacky @ 2016-02-25 21:56 UTC (permalink / raw)
  To: linux-crypto, Herbert Xu

I'm seeing an issue on one system that I wasn't seeing on another
system. It turns out that the testmgr sha testing exports an ahash
request context, allocates a new ahash request context and then imports
into that new ahash request context. Since crypto_ahash_init() is not
performed the driver request context could have random data in it,
which ends up causing an error. As part of the import/export support
that I added for the ccp driver I reduced the amount of data that was
exported, but I guess I always assumed that crypto_ahash_init() would
have been called before doing a crypto_ahash_import().

I can fix this in the driver by doing a memset to zero of the request
context area during the import. But I guess I'm also wondering if there
is an expectation/requirement that crypto_ahash_init() be called before
doing an import?  If there is the I can add that to the testmgr code
instead.

Thanks,
Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is a crypto_ahash_init required before invoking crypto_ahash_import?
  2016-02-25 21:56 Is a crypto_ahash_init required before invoking crypto_ahash_import? Tom Lendacky
@ 2016-02-25 22:11 ` Herbert Xu
  2016-02-25 22:26   ` Tom Lendacky
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2016-02-25 22:11 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: linux-crypto

On Thu, Feb 25, 2016 at 03:56:31PM -0600, Tom Lendacky wrote:
>
> I can fix this in the driver by doing a memset to zero of the request
> context area during the import. But I guess I'm also wondering if there
> is an expectation/requirement that crypto_ahash_init() be called before
> doing an import?  If there is the I can add that to the testmgr code
> instead.

No init means wiping out the hash state so that a new hash can be
computed.  Import means importing the hash state so that computation
can be continued from that point onwards.

So they're independent of each other and you must be able to handle
an import without an init and vice versa.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is a crypto_ahash_init required before invoking crypto_ahash_import?
  2016-02-25 22:11 ` Herbert Xu
@ 2016-02-25 22:26   ` Tom Lendacky
  2016-02-27  7:35     ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Lendacky @ 2016-02-25 22:26 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto

On 02/25/2016 04:11 PM, Herbert Xu wrote:
> On Thu, Feb 25, 2016 at 03:56:31PM -0600, Tom Lendacky wrote:
>>
>> I can fix this in the driver by doing a memset to zero of the request
>> context area during the import. But I guess I'm also wondering if there
>> is an expectation/requirement that crypto_ahash_init() be called before
>> doing an import?  If there is the I can add that to the testmgr code
>> instead.
> 
> No init means wiping out the hash state so that a new hash can be
> computed.  Import means importing the hash state so that computation
> can be continued from that point onwards.
> 
> So they're independent of each other and you must be able to handle
> an import without an init and vice versa.

Thanks for the clarification Herbert.  I'll send in a patch to perform
the memset during the import.  I know it's late in the cycle, but will
you be able to apply it to the current cryptodev-2.6 tree which contains
the ccp import/export patches?

Thanks,
Tom

> 
> Cheers,
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is a crypto_ahash_init required before invoking crypto_ahash_import?
  2016-02-25 22:26   ` Tom Lendacky
@ 2016-02-27  7:35     ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2016-02-27  7:35 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: linux-crypto

On Thu, Feb 25, 2016 at 04:26:54PM -0600, Tom Lendacky wrote:
>
> Thanks for the clarification Herbert.  I'll send in a patch to perform
> the memset during the import.  I know it's late in the cycle, but will
> you be able to apply it to the current cryptodev-2.6 tree which contains
> the ccp import/export patches?

Yes I will add it on top.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-27  7:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 21:56 Is a crypto_ahash_init required before invoking crypto_ahash_import? Tom Lendacky
2016-02-25 22:11 ` Herbert Xu
2016-02-25 22:26   ` Tom Lendacky
2016-02-27  7:35     ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.