diff mbox

crypto: mxs-dcp - Initialize .statesize fields

Message ID 1448552861-17410-1-git-send-email-fabio.estevam@freescale.com (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show

Commit Message

Fabio Estevam Nov. 26, 2015, 3:47 p.m. UTC
Initialize .statesize fields in order to avoid the following error
on probe:

mxs-dcp 80028000.dcp: Failed to register sha1 hash!
mxs-dcp: probe of 80028000.dcp failed with error -22

Cc: <stable@vger.kernel.org> # 4.1+
Suggested-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/crypto/mxs-dcp.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Herbert Xu Nov. 27, 2015, 12:52 p.m. UTC | #1
On Thu, Nov 26, 2015 at 01:47:41PM -0200, Fabio Estevam wrote:
> Initialize .statesize fields in order to avoid the following error
> on probe:
> 
> mxs-dcp 80028000.dcp: Failed to register sha1 hash!
> mxs-dcp: probe of 80028000.dcp failed with error -22
> 
> Cc: <stable@vger.kernel.org> # 4.1+
> Suggested-by: Stephan Mueller <smueller@chronox.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

It's not as simple as that.  You must implement import and export
for it before we can turn it back on.

Thanks,
Stephan Mueller Nov. 27, 2015, 2:25 p.m. UTC | #2
Am Freitag, 27. November 2015, 20:52:39 schrieb Herbert Xu:

Hi Herbert,

>On Thu, Nov 26, 2015 at 01:47:41PM -0200, Fabio Estevam wrote:
>> Initialize .statesize fields in order to avoid the following error
>> on probe:
>> 
>> mxs-dcp 80028000.dcp: Failed to register sha1 hash!
>> mxs-dcp: probe of 80028000.dcp failed with error -22
>> 
>> Cc: <stable@vger.kernel.org> # 4.1+
>> Suggested-by: Stephan Mueller <smueller@chronox.de>
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>
>It's not as simple as that.  You must implement import and export
>for it before we can turn it back on.

May I ask you for a brief reference on how that should be covered so that we 
can fix all other problematic implementations?

Thanks
Stephan
--
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
Herbert Xu Nov. 27, 2015, 2:31 p.m. UTC | #3
On Fri, Nov 27, 2015 at 03:25:22PM +0100, Stephan Mueller wrote:
>
> May I ask you for a brief reference on how that should be covered so that we 
> can fix all other problematic implementations?

Basically export needs to write the complete hash state into
a buffer of size statesize, and import needs to be able to read
such a buffer and generate a hash state from it which can then
be updated/finalised.

Cheers,
diff mbox

Patch

diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 59ed54e..e65d379 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -836,6 +836,7 @@  static struct ahash_alg dcp_sha1_alg = {
 	.digest	= dcp_sha_digest,
 	.halg	= {
 		.digestsize	= SHA1_DIGEST_SIZE,
+		.statesize	= sizeof(struct sha1_state),
 		.base		= {
 			.cra_name		= "sha1",
 			.cra_driver_name	= "sha1-dcp",
@@ -860,6 +861,7 @@  static struct ahash_alg dcp_sha256_alg = {
 	.digest	= dcp_sha_digest,
 	.halg	= {
 		.digestsize	= SHA256_DIGEST_SIZE,
+		.statesize	= sizeof(struct sha256_state),
 		.base		= {
 			.cra_name		= "sha256",
 			.cra_driver_name	= "sha256-dcp",