Is a crypto_ahash_init required before invoking crypto_ahash_import?
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
Herbert Xu
maintainerQuoted 6 lines · Tom Lendacky
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,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 8 lines · Herbert Xu
Quoted 6 lines · Tom Lendacky
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.
Quoted 6 lines
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
Quoted 3 lines
Cheers,
Herbert Xu
maintainerQuoted 5 lines · Tom Lendacky
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,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt