Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730748 > unrolled thread

[PATCH] crypto: talitos - Don't provide setkey for non hmac hashing algs.

Started byChristophe Leroy <christophe.leroy@c-s.fr>
First post2017-09-12 11:10 +0200
Last post2017-09-21 10:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] crypto: talitos - Don't provide setkey for non hmac hashing  algs. Christophe Leroy <christophe.leroy@c-s.fr> - 2017-09-12 11:10 +0200
    Re: [PATCH] crypto: talitos - Don't provide setkey for non hmac  hashing algs. Herbert Xu <herbert@gondor.apana.org.au> - 2017-09-21 10:10 +0200

#1730748 — [PATCH] crypto: talitos - Don't provide setkey for non hmac hashing algs.

FromChristophe Leroy <christophe.leroy@c-s.fr>
Date2017-09-12 11:10 +0200
Subject[PATCH] crypto: talitos - Don't provide setkey for non hmac hashing algs.
Message-ID<uoPmG-7Mg-27@gated-at.bofh.it>
Today, md5sum fails with error -ENOKEY because a setkey
function is set for non hmac hashing algs, see strace output below:

mmap(NULL, 378880, PROT_READ, MAP_SHARED, 6, 0) = 0x77f50000
accept(3, 0, NULL)                      = 7
vmsplice(5, [{"bin/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 378880}], 1, SPLICE_F_MORE|SPLICE_F_GIFT) = 262144
splice(4, NULL, 7, NULL, 262144, SPLICE_F_MORE) = -1 ENOKEY (Required key not available)
write(2, "Generation of hash for file kcap"..., 50) = 50
munmap(0x77f50000, 378880)              = 0

This patch ensures that setkey() function is set only
for hmac hashing.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 drivers/crypto/talitos.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 79791c690858..5cc160078286 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -3057,7 +3057,8 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
 		t_alg->algt.alg.hash.final = ahash_final;
 		t_alg->algt.alg.hash.finup = ahash_finup;
 		t_alg->algt.alg.hash.digest = ahash_digest;
-		t_alg->algt.alg.hash.setkey = ahash_setkey;
+		if (!strncmp(alg->cra_name, "hmac", 4))
+			t_alg->algt.alg.hash.setkey = ahash_setkey;
 		t_alg->algt.alg.hash.import = ahash_import;
 		t_alg->algt.alg.hash.export = ahash_export;
 
-- 
2.13.3

[toc] | [next] | [standalone]


#1736447 — Re: [PATCH] crypto: talitos - Don't provide setkey for non hmac hashing algs.

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2017-09-21 10:10 +0200
SubjectRe: [PATCH] crypto: talitos - Don't provide setkey for non hmac hashing algs.
Message-ID<us4Iy-6IJ-25@gated-at.bofh.it>
In reply to#1730748
On Tue, Sep 12, 2017 at 11:03:39AM +0200, Christophe Leroy wrote:
> Today, md5sum fails with error -ENOKEY because a setkey
> function is set for non hmac hashing algs, see strace output below:
> 
> mmap(NULL, 378880, PROT_READ, MAP_SHARED, 6, 0) = 0x77f50000
> accept(3, 0, NULL)                      = 7
> vmsplice(5, [{"bin/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 378880}], 1, SPLICE_F_MORE|SPLICE_F_GIFT) = 262144
> splice(4, NULL, 7, NULL, 262144, SPLICE_F_MORE) = -1 ENOKEY (Required key not available)
> write(2, "Generation of hash for file kcap"..., 50) = 50
> munmap(0x77f50000, 378880)              = 0
> 
> This patch ensures that setkey() function is set only
> for hmac hashing.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Patch applied.  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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web