linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* AF_ALG: hash returns -ENOKEY
@ 2016-01-25 21:22 Stephan Mueller
  2016-01-26 16:16 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Mueller @ 2016-01-25 21:22 UTC (permalink / raw)
  To: herbert, linux-crypto

Hi Herbert,

during testing of the current cryptodev-2.6 key, the AF_ALG hash does not seem 
to work as it used to.

Regardless whether I use the vmsplice or the sendmsg call, I get -ENOKEY using 
a normal hash.

When you use by libkcapi/test/ [1] test application with the following 
command, I always get the error:

./kcapi -x 3 -c sha256 -p 38f86d

Expected result is 
cc42f645c5aa76ac3154b023359b665375fc3ae42f025fe961fb0f65205ad70e

[1] http://www.chronox.de/libkcapi.html

Ciao
Stephan

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

* Re: AF_ALG: hash returns -ENOKEY
  2016-01-25 21:22 AF_ALG: hash returns -ENOKEY Stephan Mueller
@ 2016-01-26 16:16 ` Herbert Xu
  2016-01-26 16:46   ` Stephan Mueller
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2016-01-26 16:16 UTC (permalink / raw)
  To: Stephan Mueller; +Cc: linux-crypto

On Mon, Jan 25, 2016 at 10:22:36PM +0100, Stephan Mueller wrote:
> Hi Herbert,
> 
> during testing of the current cryptodev-2.6 key, the AF_ALG hash does not seem 
> to work as it used to.

Oops, looks like I screwed up shash.

---8<---
Subject: crypto: shash - Fix has_key setting

The has_key logic is wrong for shash algorithms as they always
have a setkey function.  So we should instead be testing against
shash_no_setkey.

Fixes: a5596d633278 ("crypto: hash - Add crypto_ahash_has_setkey")
Cc: stable@vger.kernel.org
Reported-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/crypto/shash.c b/crypto/shash.c
index 88a27de..3597545 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -354,11 +354,10 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
 	crt->final = shash_async_final;
 	crt->finup = shash_async_finup;
 	crt->digest = shash_async_digest;
+	crt->setkey = shash_async_setkey;
+
+	crt->has_setkey = alg->setkey != shash_no_setkey;
 
-	if (alg->setkey) {
-		crt->setkey = shash_async_setkey;
-		crt->has_setkey = true;
-	}
 	if (alg->export)
 		crt->export = shash_async_export;
 	if (alg->import)
-- 
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 related	[flat|nested] 3+ messages in thread

* Re: AF_ALG: hash returns -ENOKEY
  2016-01-26 16:16 ` Herbert Xu
@ 2016-01-26 16:46   ` Stephan Mueller
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Mueller @ 2016-01-26 16:46 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto

Am Mittwoch, 27. Januar 2016, 00:16:37 schrieb Herbert Xu:

Hi Herbert,

> On Mon, Jan 25, 2016 at 10:22:36PM +0100, Stephan Mueller wrote:
> > Hi Herbert,
> > 
> > during testing of the current cryptodev-2.6 key, the AF_ALG hash does not
> > seem to work as it used to.
> 
> Oops, looks like I screwed up shash.
> 
> ---8<---
> Subject: crypto: shash - Fix has_key setting
> 
> The has_key logic is wrong for shash algorithms as they always
> have a setkey function.  So we should instead be testing against
> shash_no_setkey.
> 
> Fixes: a5596d633278 ("crypto: hash - Add crypto_ahash_has_setkey")
> Cc: stable@vger.kernel.org
> Reported-by: Stephan Mueller <smueller@chronox.de>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Tested-by: Stephan Mueller <smueller@chronox.de>

Ciao
Stephan

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

end of thread, other threads:[~2016-01-26 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 21:22 AF_ALG: hash returns -ENOKEY Stephan Mueller
2016-01-26 16:16 ` Herbert Xu
2016-01-26 16:46   ` Stephan Mueller

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).