diff for duplicates of <20190411155122.13245-9-vt@altlinux.org> diff --git a/a/1.txt b/N1/1.txt index 058c4ad..de422f3 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -164,9 +164,9 @@ index b2cdf2db1987..5b7bfd95c334 100644 return -EINVAL; } -- if (strcmp(ctx->cert->sig->pkey_algo, "rsa") = 0) { -+ if (strcmp(ctx->cert->sig->pkey_algo, "rsa") = 0 || -+ strcmp(ctx->cert->sig->pkey_algo, "ecrdsa") = 0) { +- if (strcmp(ctx->cert->sig->pkey_algo, "rsa") == 0) { ++ if (strcmp(ctx->cert->sig->pkey_algo, "rsa") == 0 || ++ strcmp(ctx->cert->sig->pkey_algo, "ecrdsa") == 0) { /* Discard the BIT STRING metadata */ if (vlen < 1 || *(const u8 *)value != 0) return -EBADMSG; @@ -176,10 +176,10 @@ index b2cdf2db1987..5b7bfd95c334 100644 - if (ctx->last_oid != OID_rsaEncryption) + ctx->key_algo = ctx->last_oid; -+ if (ctx->last_oid = OID_rsaEncryption) ++ if (ctx->last_oid == OID_rsaEncryption) + ctx->cert->pub->pkey_algo = "rsa"; -+ else if (ctx->last_oid = OID_gost2012PKey256 || -+ ctx->last_oid = OID_gost2012PKey512) ++ else if (ctx->last_oid == OID_gost2012PKey256 || ++ ctx->last_oid == OID_gost2012PKey512) + ctx->cert->pub->pkey_algo = "ecrdsa"; + else return -ENOPKG; @@ -553,12 +553,12 @@ index 5f36792d143d..dfe114bc0c4a 100644 + /* Currently, both NIST primes have -1 in lowest qword. */ + if (curve_prime[0] != -1ull) { + /* Try to handle Pseudo-Marsenne primes. */ -+ if (curve_prime[ndigits - 1] = -1ull) { ++ if (curve_prime[ndigits - 1] == -1ull) { + vli_mmod_special(result, product, curve_prime, + ndigits); + return true; -+ } else if (curve_prime[ndigits - 1] = 1ull << 63 && -+ curve_prime[ndigits - 2] = 0) { ++ } else if (curve_prime[ndigits - 1] == 1ull << 63 && ++ curve_prime[ndigits - 2] == 0) { + vli_mmod_special2(result, product, curve_prime, + ndigits); + return true; @@ -900,15 +900,15 @@ index 000000000000..887ec21aee49 + + /* Step 1: verify that 0 < r < q, 0 < s < q */ + if (vli_is_zero(r, ndigits) || -+ vli_cmp(r, ctx->curve->n, ndigits) = 1 || ++ vli_cmp(r, ctx->curve->n, ndigits) == 1 || + vli_is_zero(s, ndigits) || -+ vli_cmp(s, ctx->curve->n, ndigits) = 1) ++ vli_cmp(s, ctx->curve->n, ndigits) == 1) + return -EKEYREJECTED; + + /* Step 2: calculate hash (h) of the message (passed as input) */ + /* Step 3: calculate e = h \mod q */ + vli_from_le64(e, digest, ndigits); -+ if (vli_cmp(e, ctx->curve->n, ndigits) = 1) ++ if (vli_cmp(e, ctx->curve->n, ndigits) == 1) + vli_sub(e, e, ctx->curve->n, ndigits); + if (vli_is_zero(e, ndigits)) + e[0] = 1; @@ -924,10 +924,10 @@ index 000000000000..887ec21aee49 + /* Step 6: calculate point C = z_1P + z_2Q, and R = x_c \mod q */ + ecc_point_mult_shamir(&cc, z1, &ctx->curve->g, z2, &ctx->pub_key, + ctx->curve); -+ if (vli_cmp(cc.x, ctx->curve->n, ndigits) = 1) ++ if (vli_cmp(cc.x, ctx->curve->n, ndigits) == 1) + vli_sub(cc.x, cc.x, ctx->curve->n, ndigits); + -+ /* Step 7: if R = r signature is valid */ ++ /* Step 7: if R == r signature is valid */ + if (!vli_cmp(cc.x, r, ndigits)) + return 0; + else @@ -992,11 +992,11 @@ index 000000000000..887ec21aee49 + params = ecrdsa_unpack_u32(¶mlen, + ecrdsa_unpack_u32(&algo, (u8 *)key + keylen)); + -+ if (algo = OID_gost2012PKey256) { ++ if (algo == OID_gost2012PKey256) { + ctx->digest = "streebog256"; + ctx->digest_oid = OID_gost2012Digest256; + ctx->digest_len = 256 / 8; -+ } else if (algo = OID_gost2012PKey512) { ++ } else if (algo == OID_gost2012PKey512) { + ctx->digest = "streebog512"; + ctx->digest_oid = OID_gost2012Digest512; + ctx->digest_len = 512 / 8; diff --git a/a/content_digest b/N1/content_digest index cfc8292..9c2ea4f 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,7 +1,7 @@ "ref\020190411155122.13245-1-vt@altlinux.org\0" "From\0Vitaly Chikunov <vt@altlinux.org>\0" "Subject\0[PATCH v9 08/10] crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm\0" - "Date\0Thu, 11 Apr 2019 15:51:20 +0000\0" + "Date\0Thu, 11 Apr 2019 18:51:20 +0300\0" "To\0Herbert Xu <herbert@gondor.apana.org.au>" David Howells <dhowells@redhat.com> Mimi Zohar <zohar@linux.ibm.com> @@ -178,9 +178,9 @@ " \t\treturn -EINVAL;\n" " \t}\n" " \n" - "-\tif (strcmp(ctx->cert->sig->pkey_algo, \"rsa\") = 0) {\n" - "+\tif (strcmp(ctx->cert->sig->pkey_algo, \"rsa\") = 0 ||\n" - "+\t strcmp(ctx->cert->sig->pkey_algo, \"ecrdsa\") = 0) {\n" + "-\tif (strcmp(ctx->cert->sig->pkey_algo, \"rsa\") == 0) {\n" + "+\tif (strcmp(ctx->cert->sig->pkey_algo, \"rsa\") == 0 ||\n" + "+\t strcmp(ctx->cert->sig->pkey_algo, \"ecrdsa\") == 0) {\n" " \t\t/* Discard the BIT STRING metadata */\n" " \t\tif (vlen < 1 || *(const u8 *)value != 0)\n" " \t\t\treturn -EBADMSG;\n" @@ -190,10 +190,10 @@ " \n" "-\tif (ctx->last_oid != OID_rsaEncryption)\n" "+\tctx->key_algo = ctx->last_oid;\n" - "+\tif (ctx->last_oid = OID_rsaEncryption)\n" + "+\tif (ctx->last_oid == OID_rsaEncryption)\n" "+\t\tctx->cert->pub->pkey_algo = \"rsa\";\n" - "+\telse if (ctx->last_oid = OID_gost2012PKey256 ||\n" - "+\t\t ctx->last_oid = OID_gost2012PKey512)\n" + "+\telse if (ctx->last_oid == OID_gost2012PKey256 ||\n" + "+\t\t ctx->last_oid == OID_gost2012PKey512)\n" "+\t\tctx->cert->pub->pkey_algo = \"ecrdsa\";\n" "+\telse\n" " \t\treturn -ENOPKG;\n" @@ -567,12 +567,12 @@ "+\t/* Currently, both NIST primes have -1 in lowest qword. */\n" "+\tif (curve_prime[0] != -1ull) {\n" "+\t\t/* Try to handle Pseudo-Marsenne primes. */\n" - "+\t\tif (curve_prime[ndigits - 1] = -1ull) {\n" + "+\t\tif (curve_prime[ndigits - 1] == -1ull) {\n" "+\t\t\tvli_mmod_special(result, product, curve_prime,\n" "+\t\t\t\t\t ndigits);\n" "+\t\t\treturn true;\n" - "+\t\t} else if (curve_prime[ndigits - 1] = 1ull << 63 &&\n" - "+\t\t\t curve_prime[ndigits - 2] = 0) {\n" + "+\t\t} else if (curve_prime[ndigits - 1] == 1ull << 63 &&\n" + "+\t\t\t curve_prime[ndigits - 2] == 0) {\n" "+\t\t\tvli_mmod_special2(result, product, curve_prime,\n" "+\t\t\t\t\t ndigits);\n" "+\t\t\treturn true;\n" @@ -914,15 +914,15 @@ "+\n" "+\t/* Step 1: verify that 0 < r < q, 0 < s < q */\n" "+\tif (vli_is_zero(r, ndigits) ||\n" - "+\t vli_cmp(r, ctx->curve->n, ndigits) = 1 ||\n" + "+\t vli_cmp(r, ctx->curve->n, ndigits) == 1 ||\n" "+\t vli_is_zero(s, ndigits) ||\n" - "+\t vli_cmp(s, ctx->curve->n, ndigits) = 1)\n" + "+\t vli_cmp(s, ctx->curve->n, ndigits) == 1)\n" "+\t\treturn -EKEYREJECTED;\n" "+\n" "+\t/* Step 2: calculate hash (h) of the message (passed as input) */\n" "+\t/* Step 3: calculate e = h \\mod q */\n" "+\tvli_from_le64(e, digest, ndigits);\n" - "+\tif (vli_cmp(e, ctx->curve->n, ndigits) = 1)\n" + "+\tif (vli_cmp(e, ctx->curve->n, ndigits) == 1)\n" "+\t\tvli_sub(e, e, ctx->curve->n, ndigits);\n" "+\tif (vli_is_zero(e, ndigits))\n" "+\t\te[0] = 1;\n" @@ -938,10 +938,10 @@ "+\t/* Step 6: calculate point C = z_1P + z_2Q, and R = x_c \\mod q */\n" "+\tecc_point_mult_shamir(&cc, z1, &ctx->curve->g, z2, &ctx->pub_key,\n" "+\t\t\t ctx->curve);\n" - "+\tif (vli_cmp(cc.x, ctx->curve->n, ndigits) = 1)\n" + "+\tif (vli_cmp(cc.x, ctx->curve->n, ndigits) == 1)\n" "+\t\tvli_sub(cc.x, cc.x, ctx->curve->n, ndigits);\n" "+\n" - "+\t/* Step 7: if R = r signature is valid */\n" + "+\t/* Step 7: if R == r signature is valid */\n" "+\tif (!vli_cmp(cc.x, r, ndigits))\n" "+\t\treturn 0;\n" "+\telse\n" @@ -1006,11 +1006,11 @@ "+\tparams = ecrdsa_unpack_u32(¶mlen,\n" "+\t\t\t ecrdsa_unpack_u32(&algo, (u8 *)key + keylen));\n" "+\n" - "+\tif (algo = OID_gost2012PKey256) {\n" + "+\tif (algo == OID_gost2012PKey256) {\n" "+\t\tctx->digest\t= \"streebog256\";\n" "+\t\tctx->digest_oid\t= OID_gost2012Digest256;\n" "+\t\tctx->digest_len\t= 256 / 8;\n" - "+\t} else if (algo = OID_gost2012PKey512) {\n" + "+\t} else if (algo == OID_gost2012PKey512) {\n" "+\t\tctx->digest\t= \"streebog512\";\n" "+\t\tctx->digest_oid\t= OID_gost2012Digest512;\n" "+\t\tctx->digest_len\t= 512 / 8;\n" @@ -1376,4 +1376,4 @@ "-- \n" 2.11.0 -5e2d18db243225e5e1e1781ffcd5ddbba4e288528ed86bad25319373b083ba64 +d7ab81c549da6753f64b339c4dd210fc0539c72db1769a9edca0eac8a45cabef
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.