diff for duplicates of <26151.1497974983@warthog.procyon.org.uk> diff --git a/a/1.txt b/N1/1.txt index 1344c14..c3f8345 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,9 +1,9 @@ -James Bottomley <James.Bottomley@HansenPartnership.com> wrote: +James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> wrote: > Added by > > commit 436529562df2748fd9918f578205b22cf8ced277 -> Author: David Howells <dhowells@redhat.com> +> Author: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Date: Mon Apr 3 16:07:25 2017 +0100 > > X.509: Allow X.509 certs to be blacklisted @@ -76,9 +76,9 @@ To this end: X.509 message. Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring") -Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com> -Signed-off-by: David Howells <dhowells@redhat.com> -cc: stable@vger.kernel.org +Suggested-by: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> +Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> +cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- certs/blacklist.c | 263 +++++++++++++++++++++++++++++-- crypto/asymmetric_keys/x509_public_key.c | 24 ++ @@ -116,8 +116,8 @@ index 3a507b9e2568..3be5ae5e5606 100644 + bhash = blacklist_hash_types; + smp_rmb(); /* Content after pointer. List tail is immutable */ + for (; bhash; bhash = bhash->next) -+ if (name_len = bhash->name_len && -+ memcmp(hash_algo, bhash->name, name_len) = 0) ++ if (name_len == bhash->name_len && ++ memcmp(hash_algo, bhash->name, name_len) == 0) + return bhash; + return NULL; +} @@ -142,7 +142,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 n++; } - if (n = 0 || n & 1) + if (n == 0 || n & 1) return -EINVAL; return 0; + @@ -310,9 +310,9 @@ index 3a507b9e2568..3be5ae5e5606 100644 + goto black; + + /* For SHA hashes, the hash type is optional. */ -+ if (hash_algo[0] = 's' && -+ hash_algo[1] = 'h' && -+ hash_algo[2] = 'a') { ++ if (hash_algo[0] == 's' && ++ hash_algo[1] == 'h' && ++ hash_algo[2] == 'a') { + p[-1] = 0; + + kref = keyring_search(make_key_ref(blacklist_keyring, true), @@ -350,7 +350,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 + */ + tfm = crypto_alloc_shash(hash_algo, 0, 0); + if (IS_ERR(tfm)) -+ return (PTR_ERR(tfm) = -ENOENT) ? 0 : PTR_ERR(tfm); ++ return (PTR_ERR(tfm) == -ENOENT) ? 0 : PTR_ERR(tfm); + + desc_size = crypto_shash_descsize(tfm) + sizeof(*desc); + digest_size = crypto_shash_digestsize(tfm); @@ -408,7 +408,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 + smp_rmb(); /* Content after pointer. List tail is immutable */ + + for (; bhash; bhash = bhash->next) { -+ if (strcmp(skip_hash, bhash->name) = 0) ++ if (strcmp(skip_hash, bhash->name) == 0) + continue; + ret = blacklist_test_one(data, data_len, type, bhash->name); + if (ret < 0) @@ -432,7 +432,7 @@ index eea71dc9686c..57be229dd7bf 100644 goto error_2; - ret = is_hash_blacklisted(sig->digest, sig->digest_size, "tbs"); -- if (ret = -EKEYREJECTED) { +- if (ret == -EKEYREJECTED) { - pr_err("Cert %*phN is blacklisted\n", - sig->digest_size, sig->digest); - cert->blacklisted = true; @@ -440,21 +440,21 @@ index eea71dc9686c..57be229dd7bf 100644 - } + ret = is_hash_blacklisted(sig->digest, sig->digest_size, "tbs", + sig->hash_algo); -+ if (ret = -EKEYREJECTED) ++ if (ret == -EKEYREJECTED) + goto blacklisted; + if (ret < 0) + goto error_2; + ret = is_data_blacklisted(cert->tbs, cert->tbs_size, "tbs", + sig->hash_algo); -+ if (ret = -EKEYREJECTED) ++ if (ret == -EKEYREJECTED) + goto blacklisted; + error_2: kfree(desc); error: crypto_free_shash(tfm); - pr_devel("<=%s() = %d\n", __func__, ret); + pr_devel("<==%s() = %d\n", __func__, ret); return ret; + +blacklisted: diff --git a/a/content_digest b/N1/content_digest index 4d486eb..d43c805 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,8 +1,8 @@ "ref\01495897525.3458.7.camel@HansenPartnership.com\0" "ref\01495897525.3458.7.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org\0" - "From\0David Howells <dhowells@redhat.com>\0" + "From\0David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>\0" "Subject\0Re: Problem with new X.509 is_hash_blacklisted() interface\0" - "Date\0Tue, 20 Jun 2017 16:09:43 +0000\0" + "Date\0Tue, 20 Jun 2017 17:09:43 +0100\0" "To\0James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>\0" "Cc\0dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" keyrings-u79uwXL29TY76Z2rM5mHXA@public.gmane.org @@ -11,12 +11,12 @@ " linux-kernel <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>\0" "\00:1\0" "b\0" - "James Bottomley <James.Bottomley@HansenPartnership.com> wrote:\n" + "James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> wrote:\n" "\n" "> Added by\n" "> \n" "> commit 436529562df2748fd9918f578205b22cf8ced277\n" - "> Author: David Howells <dhowells@redhat.com>\n" + "> Author: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>\n" "> Date: Mon Apr 3 16:07:25 2017 +0100\n" "> \n" "> X.509: Allow X.509 certs to be blacklisted\n" @@ -89,9 +89,9 @@ " X.509 message.\n" "\n" "Fixes: 734114f8782f (\"KEYS: Add a system blacklist keyring\")\n" - "Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com>\n" - "Signed-off-by: David Howells <dhowells@redhat.com>\n" - "cc: stable@vger.kernel.org\n" + "Suggested-by: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>\n" + "Signed-off-by: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>\n" + "cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org\n" "---\n" " certs/blacklist.c | 263 +++++++++++++++++++++++++++++--\n" " crypto/asymmetric_keys/x509_public_key.c | 24 ++\n" @@ -129,8 +129,8 @@ "+\tbhash = blacklist_hash_types;\n" "+\tsmp_rmb(); /* Content after pointer. List tail is immutable */\n" "+\tfor (; bhash; bhash = bhash->next)\n" - "+\t\tif (name_len = bhash->name_len &&\n" - "+\t\t memcmp(hash_algo, bhash->name, name_len) = 0)\n" + "+\t\tif (name_len == bhash->name_len &&\n" + "+\t\t memcmp(hash_algo, bhash->name, name_len) == 0)\n" "+\t\t\treturn bhash;\n" "+\treturn NULL;\n" "+}\n" @@ -155,7 +155,7 @@ " \t\tn++;\n" " \t}\n" " \n" - " \tif (n = 0 || n & 1)\n" + " \tif (n == 0 || n & 1)\n" " \t\treturn -EINVAL;\n" " \treturn 0;\n" "+\n" @@ -323,9 +323,9 @@ "+\t\tgoto black;\n" "+\n" "+\t/* For SHA hashes, the hash type is optional. */\n" - "+\tif (hash_algo[0] = 's' &&\n" - "+\t hash_algo[1] = 'h' &&\n" - "+\t hash_algo[2] = 'a') {\n" + "+\tif (hash_algo[0] == 's' &&\n" + "+\t hash_algo[1] == 'h' &&\n" + "+\t hash_algo[2] == 'a') {\n" "+\t\tp[-1] = 0;\n" "+\n" "+\t\tkref = keyring_search(make_key_ref(blacklist_keyring, true),\n" @@ -363,7 +363,7 @@ "+\t */\n" "+\ttfm = crypto_alloc_shash(hash_algo, 0, 0);\n" "+\tif (IS_ERR(tfm))\n" - "+\t\treturn (PTR_ERR(tfm) = -ENOENT) ? 0 : PTR_ERR(tfm);\n" + "+\t\treturn (PTR_ERR(tfm) == -ENOENT) ? 0 : PTR_ERR(tfm);\n" "+\n" "+\tdesc_size = crypto_shash_descsize(tfm) + sizeof(*desc);\n" "+\tdigest_size = crypto_shash_digestsize(tfm);\n" @@ -421,7 +421,7 @@ "+\tsmp_rmb(); /* Content after pointer. List tail is immutable */\n" "+\n" "+\tfor (; bhash; bhash = bhash->next) {\n" - "+\t\tif (strcmp(skip_hash, bhash->name) = 0)\n" + "+\t\tif (strcmp(skip_hash, bhash->name) == 0)\n" "+\t\t\tcontinue;\n" "+\t\tret = blacklist_test_one(data, data_len, type, bhash->name);\n" "+\t\tif (ret < 0)\n" @@ -445,7 +445,7 @@ " \t\tgoto error_2;\n" " \n" "-\tret = is_hash_blacklisted(sig->digest, sig->digest_size, \"tbs\");\n" - "-\tif (ret = -EKEYREJECTED) {\n" + "-\tif (ret == -EKEYREJECTED) {\n" "-\t\tpr_err(\"Cert %*phN is blacklisted\\n\",\n" "-\t\t sig->digest_size, sig->digest);\n" "-\t\tcert->blacklisted = true;\n" @@ -453,21 +453,21 @@ "-\t}\n" "+\tret = is_hash_blacklisted(sig->digest, sig->digest_size, \"tbs\",\n" "+\t\t\t\t sig->hash_algo);\n" - "+\tif (ret = -EKEYREJECTED)\n" + "+\tif (ret == -EKEYREJECTED)\n" "+\t\tgoto blacklisted;\n" "+\tif (ret < 0)\n" "+\t\tgoto error_2;\n" " \n" "+\tret = is_data_blacklisted(cert->tbs, cert->tbs_size, \"tbs\",\n" "+\t\t\t\t sig->hash_algo);\n" - "+\tif (ret = -EKEYREJECTED)\n" + "+\tif (ret == -EKEYREJECTED)\n" "+\t\tgoto blacklisted;\n" "+\t\n" " error_2:\n" " \tkfree(desc);\n" " error:\n" " \tcrypto_free_shash(tfm);\n" - " \tpr_devel(\"<=%s() = %d\\n\", __func__, ret);\n" + " \tpr_devel(\"<==%s() = %d\\n\", __func__, ret);\n" " \treturn ret;\n" "+\n" "+blacklisted:\n" @@ -503,4 +503,4 @@ " \treturn 0;\n" } -c3a0860adf39c368aafba308c6fcbbb02c9c400125f96785c57366eed81ad5e5 +4c37b044a73d01dc2ff05121a7e72edeabebd9c82eaf410f9618e147cac1e3e7
diff --git a/a/1.txt b/N2/1.txt index 1344c14..140302a 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -78,7 +78,7 @@ To this end: Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring") Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: David Howells <dhowells@redhat.com> -cc: stable@vger.kernel.org +cc: stable at vger.kernel.org --- certs/blacklist.c | 263 +++++++++++++++++++++++++++++-- crypto/asymmetric_keys/x509_public_key.c | 24 ++ @@ -116,8 +116,8 @@ index 3a507b9e2568..3be5ae5e5606 100644 + bhash = blacklist_hash_types; + smp_rmb(); /* Content after pointer. List tail is immutable */ + for (; bhash; bhash = bhash->next) -+ if (name_len = bhash->name_len && -+ memcmp(hash_algo, bhash->name, name_len) = 0) ++ if (name_len == bhash->name_len && ++ memcmp(hash_algo, bhash->name, name_len) == 0) + return bhash; + return NULL; +} @@ -142,7 +142,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 n++; } - if (n = 0 || n & 1) + if (n == 0 || n & 1) return -EINVAL; return 0; + @@ -310,9 +310,9 @@ index 3a507b9e2568..3be5ae5e5606 100644 + goto black; + + /* For SHA hashes, the hash type is optional. */ -+ if (hash_algo[0] = 's' && -+ hash_algo[1] = 'h' && -+ hash_algo[2] = 'a') { ++ if (hash_algo[0] == 's' && ++ hash_algo[1] == 'h' && ++ hash_algo[2] == 'a') { + p[-1] = 0; + + kref = keyring_search(make_key_ref(blacklist_keyring, true), @@ -350,7 +350,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 + */ + tfm = crypto_alloc_shash(hash_algo, 0, 0); + if (IS_ERR(tfm)) -+ return (PTR_ERR(tfm) = -ENOENT) ? 0 : PTR_ERR(tfm); ++ return (PTR_ERR(tfm) == -ENOENT) ? 0 : PTR_ERR(tfm); + + desc_size = crypto_shash_descsize(tfm) + sizeof(*desc); + digest_size = crypto_shash_digestsize(tfm); @@ -408,7 +408,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 + smp_rmb(); /* Content after pointer. List tail is immutable */ + + for (; bhash; bhash = bhash->next) { -+ if (strcmp(skip_hash, bhash->name) = 0) ++ if (strcmp(skip_hash, bhash->name) == 0) + continue; + ret = blacklist_test_one(data, data_len, type, bhash->name); + if (ret < 0) @@ -432,7 +432,7 @@ index eea71dc9686c..57be229dd7bf 100644 goto error_2; - ret = is_hash_blacklisted(sig->digest, sig->digest_size, "tbs"); -- if (ret = -EKEYREJECTED) { +- if (ret == -EKEYREJECTED) { - pr_err("Cert %*phN is blacklisted\n", - sig->digest_size, sig->digest); - cert->blacklisted = true; @@ -440,21 +440,21 @@ index eea71dc9686c..57be229dd7bf 100644 - } + ret = is_hash_blacklisted(sig->digest, sig->digest_size, "tbs", + sig->hash_algo); -+ if (ret = -EKEYREJECTED) ++ if (ret == -EKEYREJECTED) + goto blacklisted; + if (ret < 0) + goto error_2; + ret = is_data_blacklisted(cert->tbs, cert->tbs_size, "tbs", + sig->hash_algo); -+ if (ret = -EKEYREJECTED) ++ if (ret == -EKEYREJECTED) + goto blacklisted; + error_2: kfree(desc); error: crypto_free_shash(tfm); - pr_devel("<=%s() = %d\n", __func__, ret); + pr_devel("<==%s() = %d\n", __func__, ret); return ret; + +blacklisted: @@ -489,3 +489,7 @@ index 359c2f936004..6ab1260893eb 100644 { return 0; } +-- +To unsubscribe from this list: send the line "unsubscribe linux-security-module" in +the body of a message to majordomo at vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/a/content_digest b/N2/content_digest index 4d486eb..be4fe40 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,14 +1,8 @@ "ref\01495897525.3458.7.camel@HansenPartnership.com\0" - "ref\01495897525.3458.7.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org\0" - "From\0David Howells <dhowells@redhat.com>\0" - "Subject\0Re: Problem with new X.509 is_hash_blacklisted() interface\0" - "Date\0Tue, 20 Jun 2017 16:09:43 +0000\0" - "To\0James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>\0" - "Cc\0dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" - keyrings-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - " linux-kernel <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>\0" + "From\0dhowells@redhat.com (David Howells)\0" + "Subject\0Problem with new X.509 is_hash_blacklisted() interface\0" + "Date\0Tue, 20 Jun 2017 17:09:43 +0100\0" + "To\0linux-security-module@vger.kernel.org\0" "\00:1\0" "b\0" "James Bottomley <James.Bottomley@HansenPartnership.com> wrote:\n" @@ -91,7 +85,7 @@ "Fixes: 734114f8782f (\"KEYS: Add a system blacklist keyring\")\n" "Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com>\n" "Signed-off-by: David Howells <dhowells@redhat.com>\n" - "cc: stable@vger.kernel.org\n" + "cc: stable at vger.kernel.org\n" "---\n" " certs/blacklist.c | 263 +++++++++++++++++++++++++++++--\n" " crypto/asymmetric_keys/x509_public_key.c | 24 ++\n" @@ -129,8 +123,8 @@ "+\tbhash = blacklist_hash_types;\n" "+\tsmp_rmb(); /* Content after pointer. List tail is immutable */\n" "+\tfor (; bhash; bhash = bhash->next)\n" - "+\t\tif (name_len = bhash->name_len &&\n" - "+\t\t memcmp(hash_algo, bhash->name, name_len) = 0)\n" + "+\t\tif (name_len == bhash->name_len &&\n" + "+\t\t memcmp(hash_algo, bhash->name, name_len) == 0)\n" "+\t\t\treturn bhash;\n" "+\treturn NULL;\n" "+}\n" @@ -155,7 +149,7 @@ " \t\tn++;\n" " \t}\n" " \n" - " \tif (n = 0 || n & 1)\n" + " \tif (n == 0 || n & 1)\n" " \t\treturn -EINVAL;\n" " \treturn 0;\n" "+\n" @@ -323,9 +317,9 @@ "+\t\tgoto black;\n" "+\n" "+\t/* For SHA hashes, the hash type is optional. */\n" - "+\tif (hash_algo[0] = 's' &&\n" - "+\t hash_algo[1] = 'h' &&\n" - "+\t hash_algo[2] = 'a') {\n" + "+\tif (hash_algo[0] == 's' &&\n" + "+\t hash_algo[1] == 'h' &&\n" + "+\t hash_algo[2] == 'a') {\n" "+\t\tp[-1] = 0;\n" "+\n" "+\t\tkref = keyring_search(make_key_ref(blacklist_keyring, true),\n" @@ -363,7 +357,7 @@ "+\t */\n" "+\ttfm = crypto_alloc_shash(hash_algo, 0, 0);\n" "+\tif (IS_ERR(tfm))\n" - "+\t\treturn (PTR_ERR(tfm) = -ENOENT) ? 0 : PTR_ERR(tfm);\n" + "+\t\treturn (PTR_ERR(tfm) == -ENOENT) ? 0 : PTR_ERR(tfm);\n" "+\n" "+\tdesc_size = crypto_shash_descsize(tfm) + sizeof(*desc);\n" "+\tdigest_size = crypto_shash_digestsize(tfm);\n" @@ -421,7 +415,7 @@ "+\tsmp_rmb(); /* Content after pointer. List tail is immutable */\n" "+\n" "+\tfor (; bhash; bhash = bhash->next) {\n" - "+\t\tif (strcmp(skip_hash, bhash->name) = 0)\n" + "+\t\tif (strcmp(skip_hash, bhash->name) == 0)\n" "+\t\t\tcontinue;\n" "+\t\tret = blacklist_test_one(data, data_len, type, bhash->name);\n" "+\t\tif (ret < 0)\n" @@ -445,7 +439,7 @@ " \t\tgoto error_2;\n" " \n" "-\tret = is_hash_blacklisted(sig->digest, sig->digest_size, \"tbs\");\n" - "-\tif (ret = -EKEYREJECTED) {\n" + "-\tif (ret == -EKEYREJECTED) {\n" "-\t\tpr_err(\"Cert %*phN is blacklisted\\n\",\n" "-\t\t sig->digest_size, sig->digest);\n" "-\t\tcert->blacklisted = true;\n" @@ -453,21 +447,21 @@ "-\t}\n" "+\tret = is_hash_blacklisted(sig->digest, sig->digest_size, \"tbs\",\n" "+\t\t\t\t sig->hash_algo);\n" - "+\tif (ret = -EKEYREJECTED)\n" + "+\tif (ret == -EKEYREJECTED)\n" "+\t\tgoto blacklisted;\n" "+\tif (ret < 0)\n" "+\t\tgoto error_2;\n" " \n" "+\tret = is_data_blacklisted(cert->tbs, cert->tbs_size, \"tbs\",\n" "+\t\t\t\t sig->hash_algo);\n" - "+\tif (ret = -EKEYREJECTED)\n" + "+\tif (ret == -EKEYREJECTED)\n" "+\t\tgoto blacklisted;\n" "+\t\n" " error_2:\n" " \tkfree(desc);\n" " error:\n" " \tcrypto_free_shash(tfm);\n" - " \tpr_devel(\"<=%s() = %d\\n\", __func__, ret);\n" + " \tpr_devel(\"<==%s() = %d\\n\", __func__, ret);\n" " \treturn ret;\n" "+\n" "+blacklisted:\n" @@ -501,6 +495,10 @@ "+\t\t\t\t const char *type, const char *skip_hash)\n" " {\n" " \treturn 0;\n" - } + " }\n" + "--\n" + "To unsubscribe from this list: send the line \"unsubscribe linux-security-module\" in\n" + "the body of a message to majordomo at vger.kernel.org\n" + More majordomo info at http://vger.kernel.org/majordomo-info.html -c3a0860adf39c368aafba308c6fcbbb02c9c400125f96785c57366eed81ad5e5 +834f4296dabab70616dd913b1fe86e58d32e9a11a35e75bdccf8f5102b28bd7d
diff --git a/a/1.txt b/N3/1.txt index 1344c14..6c38265 100644 --- a/a/1.txt +++ b/N3/1.txt @@ -116,8 +116,8 @@ index 3a507b9e2568..3be5ae5e5606 100644 + bhash = blacklist_hash_types; + smp_rmb(); /* Content after pointer. List tail is immutable */ + for (; bhash; bhash = bhash->next) -+ if (name_len = bhash->name_len && -+ memcmp(hash_algo, bhash->name, name_len) = 0) ++ if (name_len == bhash->name_len && ++ memcmp(hash_algo, bhash->name, name_len) == 0) + return bhash; + return NULL; +} @@ -142,7 +142,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 n++; } - if (n = 0 || n & 1) + if (n == 0 || n & 1) return -EINVAL; return 0; + @@ -310,9 +310,9 @@ index 3a507b9e2568..3be5ae5e5606 100644 + goto black; + + /* For SHA hashes, the hash type is optional. */ -+ if (hash_algo[0] = 's' && -+ hash_algo[1] = 'h' && -+ hash_algo[2] = 'a') { ++ if (hash_algo[0] == 's' && ++ hash_algo[1] == 'h' && ++ hash_algo[2] == 'a') { + p[-1] = 0; + + kref = keyring_search(make_key_ref(blacklist_keyring, true), @@ -350,7 +350,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 + */ + tfm = crypto_alloc_shash(hash_algo, 0, 0); + if (IS_ERR(tfm)) -+ return (PTR_ERR(tfm) = -ENOENT) ? 0 : PTR_ERR(tfm); ++ return (PTR_ERR(tfm) == -ENOENT) ? 0 : PTR_ERR(tfm); + + desc_size = crypto_shash_descsize(tfm) + sizeof(*desc); + digest_size = crypto_shash_digestsize(tfm); @@ -408,7 +408,7 @@ index 3a507b9e2568..3be5ae5e5606 100644 + smp_rmb(); /* Content after pointer. List tail is immutable */ + + for (; bhash; bhash = bhash->next) { -+ if (strcmp(skip_hash, bhash->name) = 0) ++ if (strcmp(skip_hash, bhash->name) == 0) + continue; + ret = blacklist_test_one(data, data_len, type, bhash->name); + if (ret < 0) @@ -432,7 +432,7 @@ index eea71dc9686c..57be229dd7bf 100644 goto error_2; - ret = is_hash_blacklisted(sig->digest, sig->digest_size, "tbs"); -- if (ret = -EKEYREJECTED) { +- if (ret == -EKEYREJECTED) { - pr_err("Cert %*phN is blacklisted\n", - sig->digest_size, sig->digest); - cert->blacklisted = true; @@ -440,21 +440,21 @@ index eea71dc9686c..57be229dd7bf 100644 - } + ret = is_hash_blacklisted(sig->digest, sig->digest_size, "tbs", + sig->hash_algo); -+ if (ret = -EKEYREJECTED) ++ if (ret == -EKEYREJECTED) + goto blacklisted; + if (ret < 0) + goto error_2; + ret = is_data_blacklisted(cert->tbs, cert->tbs_size, "tbs", + sig->hash_algo); -+ if (ret = -EKEYREJECTED) ++ if (ret == -EKEYREJECTED) + goto blacklisted; + error_2: kfree(desc); error: crypto_free_shash(tfm); - pr_devel("<=%s() = %d\n", __func__, ret); + pr_devel("<==%s() = %d\n", __func__, ret); return ret; + +blacklisted: diff --git a/a/content_digest b/N3/content_digest index 4d486eb..e365821 100644 --- a/a/content_digest +++ b/N3/content_digest @@ -1,14 +1,13 @@ "ref\01495897525.3458.7.camel@HansenPartnership.com\0" - "ref\01495897525.3458.7.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org\0" "From\0David Howells <dhowells@redhat.com>\0" "Subject\0Re: Problem with new X.509 is_hash_blacklisted() interface\0" - "Date\0Tue, 20 Jun 2017 16:09:43 +0000\0" - "To\0James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>\0" - "Cc\0dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" - keyrings-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - " linux-kernel <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>\0" + "Date\0Tue, 20 Jun 2017 17:09:43 +0100\0" + "To\0James Bottomley <James.Bottomley@hansenpartnership.com>\0" + "Cc\0dhowells@redhat.com" + keyrings@vger.kernel.org + linux-security-module@vger.kernel.org + linux-efi@vger.kernel.org + " linux-kernel <linux-kernel@vger.kernel.org>\0" "\00:1\0" "b\0" "James Bottomley <James.Bottomley@HansenPartnership.com> wrote:\n" @@ -129,8 +128,8 @@ "+\tbhash = blacklist_hash_types;\n" "+\tsmp_rmb(); /* Content after pointer. List tail is immutable */\n" "+\tfor (; bhash; bhash = bhash->next)\n" - "+\t\tif (name_len = bhash->name_len &&\n" - "+\t\t memcmp(hash_algo, bhash->name, name_len) = 0)\n" + "+\t\tif (name_len == bhash->name_len &&\n" + "+\t\t memcmp(hash_algo, bhash->name, name_len) == 0)\n" "+\t\t\treturn bhash;\n" "+\treturn NULL;\n" "+}\n" @@ -155,7 +154,7 @@ " \t\tn++;\n" " \t}\n" " \n" - " \tif (n = 0 || n & 1)\n" + " \tif (n == 0 || n & 1)\n" " \t\treturn -EINVAL;\n" " \treturn 0;\n" "+\n" @@ -323,9 +322,9 @@ "+\t\tgoto black;\n" "+\n" "+\t/* For SHA hashes, the hash type is optional. */\n" - "+\tif (hash_algo[0] = 's' &&\n" - "+\t hash_algo[1] = 'h' &&\n" - "+\t hash_algo[2] = 'a') {\n" + "+\tif (hash_algo[0] == 's' &&\n" + "+\t hash_algo[1] == 'h' &&\n" + "+\t hash_algo[2] == 'a') {\n" "+\t\tp[-1] = 0;\n" "+\n" "+\t\tkref = keyring_search(make_key_ref(blacklist_keyring, true),\n" @@ -363,7 +362,7 @@ "+\t */\n" "+\ttfm = crypto_alloc_shash(hash_algo, 0, 0);\n" "+\tif (IS_ERR(tfm))\n" - "+\t\treturn (PTR_ERR(tfm) = -ENOENT) ? 0 : PTR_ERR(tfm);\n" + "+\t\treturn (PTR_ERR(tfm) == -ENOENT) ? 0 : PTR_ERR(tfm);\n" "+\n" "+\tdesc_size = crypto_shash_descsize(tfm) + sizeof(*desc);\n" "+\tdigest_size = crypto_shash_digestsize(tfm);\n" @@ -421,7 +420,7 @@ "+\tsmp_rmb(); /* Content after pointer. List tail is immutable */\n" "+\n" "+\tfor (; bhash; bhash = bhash->next) {\n" - "+\t\tif (strcmp(skip_hash, bhash->name) = 0)\n" + "+\t\tif (strcmp(skip_hash, bhash->name) == 0)\n" "+\t\t\tcontinue;\n" "+\t\tret = blacklist_test_one(data, data_len, type, bhash->name);\n" "+\t\tif (ret < 0)\n" @@ -445,7 +444,7 @@ " \t\tgoto error_2;\n" " \n" "-\tret = is_hash_blacklisted(sig->digest, sig->digest_size, \"tbs\");\n" - "-\tif (ret = -EKEYREJECTED) {\n" + "-\tif (ret == -EKEYREJECTED) {\n" "-\t\tpr_err(\"Cert %*phN is blacklisted\\n\",\n" "-\t\t sig->digest_size, sig->digest);\n" "-\t\tcert->blacklisted = true;\n" @@ -453,21 +452,21 @@ "-\t}\n" "+\tret = is_hash_blacklisted(sig->digest, sig->digest_size, \"tbs\",\n" "+\t\t\t\t sig->hash_algo);\n" - "+\tif (ret = -EKEYREJECTED)\n" + "+\tif (ret == -EKEYREJECTED)\n" "+\t\tgoto blacklisted;\n" "+\tif (ret < 0)\n" "+\t\tgoto error_2;\n" " \n" "+\tret = is_data_blacklisted(cert->tbs, cert->tbs_size, \"tbs\",\n" "+\t\t\t\t sig->hash_algo);\n" - "+\tif (ret = -EKEYREJECTED)\n" + "+\tif (ret == -EKEYREJECTED)\n" "+\t\tgoto blacklisted;\n" "+\t\n" " error_2:\n" " \tkfree(desc);\n" " error:\n" " \tcrypto_free_shash(tfm);\n" - " \tpr_devel(\"<=%s() = %d\\n\", __func__, ret);\n" + " \tpr_devel(\"<==%s() = %d\\n\", __func__, ret);\n" " \treturn ret;\n" "+\n" "+blacklisted:\n" @@ -503,4 +502,4 @@ " \treturn 0;\n" } -c3a0860adf39c368aafba308c6fcbbb02c9c400125f96785c57366eed81ad5e5 +60f2a0767475132908454aa6192b12df8cd938a9895185c6cf534daa8aed590b
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.