KEYS: revert requiring signature "encoding"
Subsystems (5)
Mimi Zohar
maintainerPATCH 1/1 KEYS: revert requiring signature "encoding"
Attempting to verify IMA signatures fail causing the system to hang.
function [ver #2]")
--- crypto/asymmetric_keys/public_key.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
crypto/asymmetric_keys/public_key.c +11 -3
@@ -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;
Signature · 1 line
2.7.5
David Howells
maintainerQuoted 1 line · Mimi Zohar
Attempting to verify IMA signatures fail causing the system to hang.
Can you say why?
Quoted 2 lines
Fixes commit 82f94f24475c ("KEYS: Provide software public key queryfunction [ver #2]")
Btw, no word "commit" after Fixes:.
David
Mimi Zohar
maintainerQuoted 5 lines · David Howells
Quoted 1 line · Mimi Zohar
Attempting to verify IMA signatures fail causing the system to hang.
Can you say why?
On systems with IMA-appraisal enabled with a policy requiring file signatures, the "good" signature values are stored on the filesystem as extended attributes (security.ima). Signature verification failure would normally be limited to just a particular file (eg. executable), but during boot signature verification failure could result in a system hang.
Removing existing signature formats breaks existing systems. This patch adds support for RSA signatures without an explicit "pkcs1" sig-
Quoted 7 lines
encoding.
Quoted 2 lines
Fixes commit 82f94f24475c ("KEYS: Provide software public key queryfunction [ver #2]")Btw, no word "commit" after Fixes:.
Ok.
Looking the patch over again, do you prefer the duplicate call or defining a local variable and using the ternary conditional operator ("?:") like this:
bool rsa = false;
if (!(sig->encoding) && strcmp(pkey->pkey_algo, "rsa") = 0)
rsa = true;
ret = software_key_determine_akcipher(rsa ? "pkcs1" : sig->encoding,
sig->hash_algo,
pkey, alg_name);Mimi
David Howells
maintainerQuoted 4 lines · Mimi Zohar
Looking the patch over again, do you prefer the duplicate call or defining a local variable and using the ternary conditional operator ("?:") like this:
Quoted 8 lines
bool rsa = false;
if (!(sig->encoding) && strcmp(pkey->pkey_algo, "rsa") = 0)
rsa = true;
ret = software_key_determine_akcipher(rsa ? "pkcs1" : sig->encoding,
sig->hash_algo,
pkey, alg_name);Might be better to do:
const char *encoding = sig->encoding; if (!encoding && strcmp(pkey->pkey_algo, "rsa") = 0) encoding = "pkcs1"; ret = software_key_determine_akcipher(encoding, ...
David
David Howells
maintainerAnd can you cc: Denis Kenzior <[email protected]> too?
David
David Howells
maintainerActually, a better solution would be to set the encoding in the caller, say in asymmetric_verify() in digsig_asymmetric.c.
David