From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Herbert Xu <herbert@gondor.apana.org.au>,
David S. Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-crypto@vger.kernel.org
Subject: [PATCH 1/6] crypto: talitos - Don't provide setkey for non hmac hashing algs.
Date: Tue, 19 Sep 2017 14:59:01 +0200 (CEST) [thread overview]
Message-ID: <47fddd0f43aaedf31bc55da9ff3114079254452f.1505825623.git.christophe.leroy@c-s.fr> (raw)
In-Reply-To: <cover.1505825623.git.christophe.leroy@c-s.fr>
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
next prev parent reply other threads:[~2017-09-19 12:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 12:58 [PATCH 0/6] crypto: talitos - various fixes Christophe Leroy
2017-09-19 12:59 ` Christophe Leroy [this message]
2017-09-19 12:59 ` [PATCH 2/6] crypto: talitos - fix hashing Christophe Leroy
2017-09-19 12:59 ` [PATCH 3/6] crypto: talitos - fix sha224 Christophe Leroy
2017-09-19 12:59 ` [PATCH 4/6] crypto: talitos - fix AEAD test failures Christophe Leroy
2017-09-19 12:59 ` [PATCH 5/6] crypto: talitos - use kzalloc instead of kmalloc Christophe Leroy
2017-09-19 12:59 ` [PATCH 6/6] crypto: talitos - fix memory corruption on SEC2 Christophe Leroy
2017-09-20 8:35 ` [PATCH 0/6] crypto: talitos - various fixes Christophe LEROY
2017-09-20 19:21 ` christophe leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47fddd0f43aaedf31bc55da9ff3114079254452f.1505825623.git.christophe.leroy@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).