{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1754122183,
"reponame":"openssl",
"desc":"OpenSSL",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"ae9fb7527684d8eeddfe900001114c06",
"commit": {"type":"commit",
"time": 1519131570,
"time_ofs": 0,
"oid_tree": { "oid": "3a27b811563ab771da13753f1ff4f95565f0a685", "alias": []},
"oid":{ "oid": "e54f5f397acde3798f2666c0fb3e797c50d571cf", "alias": []},
"msg": "Update the curve448 internal test to use testutil.h",
"sig_commit": { "git_time": { "time": 1519131570, "offset": 0 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" },
"sig_author": { "git_time": { "time": 1513110739, "offset": 0 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }},
"body": "Update the curve448 internal test to use testutil.h\n\nReviewed-by: Bernd Edlinger \u003cbernd.edlinger@hotmail.de\u003e\n(Merged from https://github.com/openssl/openssl/pull/5105)\n"
,
"diff": "diff --git a/test/curve448_internal_test.c b/test/curve448_internal_test.c\nindex c63bded..50113f4 100644\n--- a/test/curve448_internal_test.c\n+++ b/test/curve448_internal_test.c\n@@ -11,6 +11,10 @@\n #include \u003copenssl/e_os2.h\u003e\n #include \u003copenssl/evp.h\u003e\n #include \u0022curve448_lcl.h\u0022\n+#include \u0022testutil.h\u0022\n+\n+static unsigned int max \u003d 1000;\n+static unsigned int verbose \u003d 0;\n \n /* Test vectors from RFC7748 for X448 */\n \n@@ -72,31 +76,24 @@ const uint8_t in_u3[56] \u003d {\n \n const uint8_t out_u3[3][56] \u003d {\n {\n- 0x3f, 0x48, 0x2c, 0x8a, 0x9f, 0x19, 0xb0, 0x1e, 0x6c, 0x46, 0xee, 0x97,\n-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 0xdc, 0x14, 0xfd, 0x4b, 0xf6, 0x7a, 0xf3, 0x07, 0x65, 0xc2,\n+ 0xae, 0x2b, 0x84, 0x6a, 0x4d, 0x23, 0xa8, 0xcd, 0x0d, 0xb8, 0x97, 0x08,\n+ 0x62, 0x39, 0x49, 0x2c, 0xaf, 0x35, 0x0b, 0x51, 0xf8, 0x33, 0x86, 0x8b,\n+ 0x9b, 0xc2, 0xb3, 0xbc, 0xa9, 0xcf, 0x41, 0x13\n+ }, {\n+ 0xaa, 0x3b, 0x47, 0x49, 0xd5, 0x5b, 0x9d, 0xaf, 0x1e, 0x5b, 0x00, 0x28,\n+ 0x88, 0x26, 0xc4, 0x67, 0x27, 0x4c, 0xe3, 0xeb, 0xbd, 0xd5, 0xc1, 0x7b,\n+ 0x97, 0x5e, 0x09, 0xd4, 0xaf, 0x6c, 0x67, 0xcf, 0x10, 0xd0, 0x87, 0x20,\n+ 0x2d, 0xb8, 0x82, 0x86, 0xe2, 0xb7, 0x9f, 0xce, 0xea, 0x3e, 0xc3, 0x53,\n+ 0xef, 0x54, 0xfa, 0xa2, 0x6e, 0x21, 0x9f, 0x38\n+ }, {\n+ 0x07, 0x7f, 0x45, 0x36, 0x81, 0xca, 0xca, 0x36, 0x93, 0x19, 0x84, 0x20,\n+ 0xbb, 0xe5, 0x15, 0xca, 0xe0, 0x00, 0x24, 0x72, 0x51, 0x9b, 0x3e, 0x67,\n+ 0x66, 0x1a, 0x7e, 0x89, 0xca, 0xb9, 0x46, 0x95, 0xc8, 0xf4, 0xbc, 0xd6,\n+ 0x6e, 0x61, 0xb9, 0xb9, 0xc9, 0x46, 0xda, 0x8d, 0x52, 0x4d, 0xe3, 0xd6,\n+ 0x9b, 0xd9, 0xd9, 0xd6, 0x6b, 0x99, 0x7e, 0x37\n+ }\n };\n \n /* Test vectors from RFC8032 for Ed448 */\n@@ -597,155 +594,109 @@ static const uint8_t *dohash(EVP_MD_CTX *hashctx, const uint8_t *msg,\n return hashout;\n }\n \n-static int test_eddsa(void)\n+static int test_ed448(void)\n {\n uint8_t outsig[114];\n EVP_MD_CTX *hashctx \u003d EVP_MD_CTX_new();\n- int ret \u003d 0;\n \n- if (hashctx \u003d\u003d NULL) {\n- printf(\u0022Failed to allocate EVP_MD_CTX\u005cn\u0022);\n+ if (!TEST_ptr(hashctx)\n+ || !TEST_true(ED448_sign(outsig, NULL, 0, pubkey1, privkey1, NULL,\n+ 0))\n+ || !TEST_int_eq(memcmp(sig1, outsig, sizeof(sig1)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg2, sizeof(msg2), pubkey2,\n+ privkey2, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig2, outsig, sizeof(sig2)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg3, sizeof(msg3), pubkey3,\n+ privkey3, context3, sizeof(context3)))\n+ || !TEST_int_eq(memcmp(sig3, outsig, sizeof(sig3)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg4, sizeof(msg4), pubkey4,\n+ privkey4, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig4, outsig, sizeof(sig4)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg5, sizeof(msg5), pubkey5,\n+ privkey5, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig5, outsig, sizeof(sig5)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg6, sizeof(msg6), pubkey6,\n+ privkey6, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig6, outsig, sizeof(sig6)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg7, sizeof(msg7), pubkey7,\n+ privkey7, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig7, outsig, sizeof(sig7)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg8, sizeof(msg8), pubkey8,\n+ privkey8, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig8, outsig, sizeof(sig8)), 0)\n+ || !TEST_true(ED448_sign(outsig, msg9, sizeof(msg9), pubkey9,\n+ privkey9, NULL, 0))\n+ || !TEST_int_eq(memcmp(sig9, outsig, sizeof(sig9)), 0)\n+ || !TEST_true(ED448ph_sign(outsig, dohash(hashctx, phmsg1,\n+ sizeof(phmsg1)), phpubkey1, phprivkey1,\n+ NULL, 0))\n+ || !TEST_int_eq(memcmp(phsig1, outsig, sizeof(phsig1)), 0)\n+ || !TEST_true(ED448ph_sign(outsig, dohash(hashctx, phmsg2,\n+ sizeof(phmsg2)), phpubkey2, phprivkey2,\n+ phcontext2, sizeof(phcontext2)))\n+ || !TEST_int_eq(memcmp(phsig2, outsig, sizeof(phsig2)), 0)) {\n+ EVP_MD_CTX_free(hashctx);\n return 0;\n }\n \n- ED448_sign(outsig, NULL, 0, pubkey1, privkey1, NULL, 0);\n- if (memcmp(sig1, outsig, sizeof(sig1)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (1)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg2, sizeof(msg2), pubkey2, privkey2, NULL, 0);\n- if (memcmp(sig2, outsig, sizeof(sig2)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (2)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg3, sizeof(msg3), pubkey3, privkey3, context3,\n- sizeof(context3));\n- if (memcmp(sig3, outsig, sizeof(sig3)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (3)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg4, sizeof(msg4), pubkey4, privkey4, NULL, 0);\n- if (memcmp(sig4, outsig, sizeof(sig4)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (4)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg5, sizeof(msg5), pubkey5, privkey5, NULL, 0);\n- if (memcmp(sig5, outsig, sizeof(sig5)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (5)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg6, sizeof(msg6), pubkey6, privkey6, NULL, 0);\n- if (memcmp(sig6, outsig, sizeof(sig6)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (6)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg7, sizeof(msg7), pubkey7, privkey7, NULL, 0);\n- if (memcmp(sig7, outsig, sizeof(sig7)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (7)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg8, sizeof(msg8), pubkey8, privkey8, NULL, 0);\n- if (memcmp(sig8, outsig, sizeof(sig8)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (8)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448_sign(outsig, msg9, sizeof(msg9), pubkey9, privkey9, NULL, 0);\n- if (memcmp(sig9, outsig, sizeof(sig9)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (9)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448ph_sign(outsig, dohash(hashctx, phmsg1, sizeof(phmsg1)), phpubkey1,\n- phprivkey1, NULL, 0);\n- if (memcmp(phsig1, outsig, sizeof(phsig1)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (ph 1)\u005cn\u0022);\n- goto err;\n- }\n-\n- ED448ph_sign(outsig, dohash(hashctx, phmsg2, sizeof(phmsg2)), phpubkey2,\n- phprivkey2, phcontext2, sizeof(phcontext2));\n- if (memcmp(phsig2, outsig, sizeof(phsig2)) !\u003d 0) {\n- printf(\u0022Calculated sig and expected sig differ (ph 2)\u005cn\u0022);\n- goto err;\n- }\n-\n- ret \u003d 1;\n- err:\n EVP_MD_CTX_free(hashctx);\n- return ret;\n+ return 1;\n }\n \n-int main(int argc, char *argv[])\n+static int test_x448(void)\n {\n uint8_t u[56], k[56], out[56];\n- unsigned int i, max \u003d 1000;\n+ unsigned int i;\n int j \u003d -1;\n \n- if (argc !\u003d 1 \u0026\u0026 (argc !\u003d 2 || strcmp(argv[1], \u0022-f\u0022) !\u003d 0)) {\n- printf(\u0022Usage: curve448_test [-f]\u005cn\u0022);\n- return 1;\n- }\n-\n- if (argc \u003d\u003d 2)\n- max \u003d 1000000;\n-\n /* Curve448 tests */\n \n- if (!X448(out, in_scalar1, in_u1)) {\n- printf(\u0022Failed in X448 call (1)\u005cn\u0022);\n- return 1;\n- }\n- if (memcmp(out, out_u1, sizeof(out)) !\u003d 0) {\n- printf(\u0022Calculated output and expected output differ (1)\u005cn\u0022);\n- return 1;\n- }\n-\n- if (!X448(out, in_scalar2, in_u2)) {\n- printf(\u0022Failed in X448 call (2)\u005cn\u0022);\n- return 1;\n- }\n- if (memcmp(out, out_u2, sizeof(out)) !\u003d 0) {\n- printf(\u0022Calculated output and expected output differ (2)\u005cn\u0022);\n- return 1;\n- }\n+ if (!TEST_true(X448(out, in_scalar1, in_u1))\n+ || !TEST_int_eq(memcmp(out, out_u1, sizeof(out)), 0)\n+ || !TEST_true(X448(out, in_scalar2, in_u2))\n+ || !TEST_int_eq(memcmp(out, out_u2, sizeof(out)), 0))\n+ return 0;\n \n memcpy(u, in_u3, sizeof(u));\n memcpy(k, in_u3, sizeof(k));\n for (i \u003d 1; i \u003c\u003d max; i++) {\n- if (i % 10000 \u003d\u003d 0) {\n+ if (verbose \u0026\u0026 i % 10000 \u003d\u003d 0) {\n printf(\u0022.\u0022);\n fflush(stdout);\n }\n \n- if (!X448(out, k, u)) {\n- printf(\u0022Failed in X448 call (3, %ud)\u005cn\u0022, i);\n- return 1;\n- }\n+ if (!TEST_true(X448(out, k, u)))\n+ return 0;\n+\n if (i \u003d\u003d 1 || i \u003d\u003d 1000 || i \u003d\u003d 1000000) {\n j++;\n- if (memcmp(out, out_u3[j], sizeof(out)) !\u003d 0) {\n- printf\n- (\u0022Calculated output and expected output differ (3, %ud)\u005cn\u0022,\n- i);\n- return 1;\n+ if (!TEST_int_eq(memcmp(out, out_u3[j], sizeof(out)), 0)) {\n+ TEST_info(\u0022Failed at iteration %d\u0022, i);\n+ return 0;\n }\n }\n memcpy(u, k, sizeof(u));\n memcpy(k, out, sizeof(k));\n }\n \n- if (!test_eddsa())\n- return 1;\n+ return 1;\n+}\n+\n+int setup_tests(void)\n+{\n+ /*\n+ * The test vectors contain one test which takes a very long time to run,\n+ * so we don't do that be default. Using the -f option will cause it to be\n+ * run.\n+ */\n+ if (test_has_option(\u0022-f\u0022))\n+ max \u003d 1000000;\n \n- printf(\u0022\u005cnSuccess!\u005cn\u0022);\n+ /* Print progress dots */\n+ if (test_has_option(\u0022-v\u0022))\n+ verbose \u003d 1;\n \n- return 0;\n+ ADD_TEST(test_x448);\n+ ADD_TEST(test_ed448);\n+ return 1;\n }\n","s":{"c":1754122183,"u": 35486}}
],"g": 37856,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}