Thread (6 messages) 6 messages, 2 authors, 2018-11-09

Re: [PATCH] KEYS: revert requiring signature "encoding"

From: David Howells <dhowells@redhat.com>
Date: 2018-11-09 15:05:27
Also in: keyrings, linux-integrity

Mimi Zohar [off-list ref] wrote:
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);
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help