* [PATCH] crypto: sahara: Fill the statesize field
@ 2016-01-13 12:10 Fabio Estevam
2016-01-13 16:42 ` Fabio Estevam
0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2016-01-13 12:10 UTC (permalink / raw)
To: herbert; +Cc: s.trumtrar, linux-crypto, Fabio Estevam
From: Fabio Estevam <fabio.estevam@nxp.com>
Currently the sahara driver fails to probe:
sahara: probe of 63ff8000.crypto failed with error -22
This happens since commit 8996eafdcbad ("crypto: ahash - ensure statesize
is non-zero"), which requires statesize to be filled.
Pass the statesize members for sha1 and sha256, so we can probe
the driver successfully again.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Hi Steffen,
Only 'probe' tested. Haven't run any crypto operations yet.
drivers/crypto/sahara.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index f68c24a..d05d849 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -1260,6 +1260,7 @@ static struct ahash_alg sha_v3_algs[] = {
.export = sahara_sha_export,
.import = sahara_sha_import,
.halg.digestsize = SHA1_DIGEST_SIZE,
+ .halg.statesize = sizeof(struct sahara_ctx),
.halg.base = {
.cra_name = "sha1",
.cra_driver_name = "sahara-sha1",
@@ -1287,6 +1288,7 @@ static struct ahash_alg sha_v4_algs[] = {
.export = sahara_sha_export,
.import = sahara_sha_import,
.halg.digestsize = SHA256_DIGEST_SIZE,
+ .halg.statesize = sizeof(struct sahara_ctx),
.halg.base = {
.cra_name = "sha256",
.cra_driver_name = "sahara-sha256",
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: sahara: Fill the statesize field
2016-01-13 12:10 [PATCH] crypto: sahara: Fill the statesize field Fabio Estevam
@ 2016-01-13 16:42 ` Fabio Estevam
2016-01-13 17:00 ` Tom Lendacky
0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2016-01-13 16:42 UTC (permalink / raw)
To: Herbert Xu; +Cc: Steffen Trumtrar, linux-crypto, Fabio Estevam
On Wed, Jan 13, 2016 at 10:10 AM, Fabio Estevam <festevam@gmail.com> wrote:
> diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
> index f68c24a..d05d849 100644
> --- a/drivers/crypto/sahara.c
> +++ b/drivers/crypto/sahara.c
> @@ -1260,6 +1260,7 @@ static struct ahash_alg sha_v3_algs[] = {
> .export = sahara_sha_export,
> .import = sahara_sha_import,
> .halg.digestsize = SHA1_DIGEST_SIZE,
> + .halg.statesize = sizeof(struct sahara_ctx),
Or should this be sizeof(struct sha1_state) instead?
> .halg.base = {
> .cra_name = "sha1",
> .cra_driver_name = "sahara-sha1",
> @@ -1287,6 +1288,7 @@ static struct ahash_alg sha_v4_algs[] = {
> .export = sahara_sha_export,
> .import = sahara_sha_import,
> .halg.digestsize = SHA256_DIGEST_SIZE,
> + .halg.statesize = sizeof(struct sahara_ctx),
Or should this be sizeof(struct sha256_state) instead?
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: sahara: Fill the statesize field
2016-01-13 16:42 ` Fabio Estevam
@ 2016-01-13 17:00 ` Tom Lendacky
2016-01-13 17:24 ` Fabio Estevam
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lendacky @ 2016-01-13 17:00 UTC (permalink / raw)
To: Fabio Estevam, Herbert Xu; +Cc: Steffen Trumtrar, linux-crypto, Fabio Estevam
On 01/13/2016 10:42 AM, Fabio Estevam wrote:
> On Wed, Jan 13, 2016 at 10:10 AM, Fabio Estevam <festevam@gmail.com> wrote:
>
>> diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
>> index f68c24a..d05d849 100644
>> --- a/drivers/crypto/sahara.c
>> +++ b/drivers/crypto/sahara.c
>> @@ -1260,6 +1260,7 @@ static struct ahash_alg sha_v3_algs[] = {
>> .export = sahara_sha_export,
>> .import = sahara_sha_import,
>> .halg.digestsize = SHA1_DIGEST_SIZE,
>> + .halg.statesize = sizeof(struct sahara_ctx),
>
> Or should this be sizeof(struct sha1_state) instead?
It should actually be the size of the data that your import and export
routines copy. Looking at those it should be sizeof(struct sahara_ctx) +
sizeof(struct sahara_sha_reqctx).
Should the struct sahara_ctx be part of the import and export data,
though?
Tom
>
>> .halg.base = {
>> .cra_name = "sha1",
>> .cra_driver_name = "sahara-sha1",
>> @@ -1287,6 +1288,7 @@ static struct ahash_alg sha_v4_algs[] = {
>> .export = sahara_sha_export,
>> .import = sahara_sha_import,
>> .halg.digestsize = SHA256_DIGEST_SIZE,
>> + .halg.statesize = sizeof(struct sahara_ctx),
>
> Or should this be sizeof(struct sha256_state) instead?
>
> Thanks
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: sahara: Fill the statesize field
2016-01-13 17:00 ` Tom Lendacky
@ 2016-01-13 17:24 ` Fabio Estevam
0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-01-13 17:24 UTC (permalink / raw)
To: Tom Lendacky; +Cc: Herbert Xu, Steffen Trumtrar, linux-crypto, Fabio Estevam
On Wed, Jan 13, 2016 at 3:00 PM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
> It should actually be the size of the data that your import and export
> routines copy. Looking at those it should be sizeof(struct sahara_ctx) +
> sizeof(struct sahara_sha_reqctx).
>
> Should the struct sahara_ctx be part of the import and export data,
> though?
Thanks, Tom. Will send a v2.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-13 17:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13 12:10 [PATCH] crypto: sahara: Fill the statesize field Fabio Estevam
2016-01-13 16:42 ` Fabio Estevam
2016-01-13 17:00 ` Tom Lendacky
2016-01-13 17:24 ` Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).