linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KEYS: revert requiring signature "encoding"
@ 2018-11-09  5:59 Mimi Zohar
  2018-11-09 13:16 ` David Howells
  2018-11-09 15:28 ` David Howells
  0 siblings, 2 replies; 6+ messages in thread
From: Mimi Zohar @ 2018-11-09  5:59 UTC (permalink / raw)
  To: David Howells
  Cc: Mimi Zohar, keyrings, linux-integrity, linux-security-module

Attempting to verify IMA signatures fail causing the system to hang.

Fixes: commit 82f94f24475c ("KEYS: Provide software public key query
       function [ver #2]")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
 crypto/asymmetric_keys/public_key.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index f5d85b47fcc6..f90360122090 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -239,9 +239,17 @@ int public_key_verify_signature(const struct public_key *pkey,
 	BUG_ON(!sig);
 	BUG_ON(!sig->s);
 
-	ret = software_key_determine_akcipher(sig->encoding,
-					      sig->hash_algo,
-					      pkey, alg_name);
+	if (!sig->digest)
+		return -ENOPKG;
+
+	if (!(sig->encoding) && strcmp(pkey->pkey_algo, "rsa") == 0)
+		ret = software_key_determine_akcipher("pkcs1",
+						      sig->hash_algo,
+						      pkey, alg_name);
+	else
+		ret = software_key_determine_akcipher(sig->encoding,
+						      sig->hash_algo,
+						      pkey, alg_name);
 	if (ret < 0)
 		return ret;
 
-- 
2.7.5


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

end of thread, other threads:[~2018-11-09 15:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09  5:59 [PATCH] KEYS: revert requiring signature "encoding" Mimi Zohar
2018-11-09 13:16 ` David Howells
2018-11-09 14:14   ` Mimi Zohar
2018-11-09 15:05   ` David Howells
2018-11-09 15:06   ` David Howells
2018-11-09 15:28 ` David Howells

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