{"action":"created","comment":{"url":"https://api.github.com/repos/openssl/openssl/pulls/comments/81969228","pull_request_review_id":2909332,"id":81969228,"diff_hunk":"@@ -2561,85 +2557,78 @@ int speed_main(int argc, char **argv)\n \n         if (!ecdh_doit[testnum])\n             continue;\n+\n         for (i = 0; i < loopargs_len; i++) {\n-            loopargs[i].ecdh_a[testnum] = EC_KEY_new_by_curve_name(test_curves[testnum]);\n-            loopargs[i].ecdh_b[testnum] = EC_KEY_new_by_curve_name(test_curves[testnum]);\n-            if (loopargs[i].ecdh_a[testnum] == NULL ||\n-                loopargs[i].ecdh_b[testnum] == NULL) {\n-                ecdh_checks = 0;\n-                break;\n-            }\n-        }\n-        if (ecdh_checks == 0) {\n-            BIO_printf(bio_err, \"ECDH failure.\\n\");\n-            ERR_print_errors(bio_err);\n-            rsa_count = 1;\n-        } else {\n-            for (i = 0; i < loopargs_len; i++) {\n-                /* generate two ECDH key pairs */\n-                if (!EC_KEY_generate_key(loopargs[i].ecdh_a[testnum]) ||\n-                        !EC_KEY_generate_key(loopargs[i].ecdh_b[testnum])) {\n-                    BIO_printf(bio_err, \"ECDH key generation failure.\\n\");\n-                    ERR_print_errors(bio_err);\n+            EVP_PKEY_CTX *kctx = NULL, *ctx = NULL;\n+            EVP_PKEY *key_A = NULL, *key_B = NULL;\n+\n+            if (testnum == R_EC_X25519) {\n+                kctx = EVP_PKEY_CTX_new_id(test_curves[testnum], NULL); /* keygen ctx from NID */\n+            } else {\n+                EVP_PKEY_CTX *pctx = NULL;\n+                EVP_PKEY *params = NULL;\n+\n+                if(     /* Create the context for parameter generation */\n+                        !(pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL)) ||\n+                        /* Initialise the parameter generation */\n+                        !EVP_PKEY_paramgen_init(pctx) ||\n+                        /* Set the curve by NID */\n+                        !EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, test_curves[testnum]) ||\n+                        /* Create the parameter object params */\n+                        !EVP_PKEY_paramgen(pctx, &params) ||\n+                        0) {\n                     ecdh_checks = 0;\n+                    BIO_printf(bio_err, \"ECDH init failure.\\n\");\n+                    ERR_print_errors(bio_err);\n                     rsa_count = 1;\n-                } else {\n-                    int secret_size_a, secret_size_b;\n-                    /*\n-                     * If field size is not more than 24 octets, then use SHA-1\n-                     * hash of result; otherwise, use result (see section 4.8 of\n-                     * draft-ietf-tls-ecc-03.txt).\n-                     */\n-                    int field_size = EC_GROUP_get_degree(\n-                            EC_KEY_get0_group(loopargs[i].ecdh_a[testnum]));\n-\n-                    if (field_size <= 24 * 8) {                 /* 192 bits */","path":"apps/speed.c","position":1034,"original_position":137,"commit_id":"2da6cc827e444eb142040f68527545db6e545245","original_commit_id":"fb155b35495043fd1e479c9344f87cfe929c0658","user":{"login":"romen","id":338418,"avatar_url":"https://avatars.githubusercontent.com/u/338418?v=3","gravatar_id":"","url":"https://api.github.com/users/romen","html_url":"https://github.com/romen","followers_url":"https://api.github.com/users/romen/followers","following_url":"https://api.github.com/users/romen/following{/other_user}","gists_url":"https://api.github.com/users/romen/gists{/gist_id}","starred_url":"https://api.github.com/users/romen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romen/subscriptions","organizations_url":"https://api.github.com/users/romen/orgs","repos_url":"https://api.github.com/users/romen/repos","events_url":"https://api.github.com/users/romen/events{/privacy}","received_events_url":"https://api.github.com/users/romen/received_events","type":"User","site_admin":false},"body":"Well, X25519 output is over the 24B threshold so the KDF step shouldn't be enforced anyway. \r\n\r\nMy point is: why do we need to keep this in the benchmarked loop?  It is my understanding that TLS is enforcing the KDF step at an higher level altogether (I'm still trying to verify this with s_client and s_server but having an hard time trying to enforce a 192 bit or lower curve for ECDH/ECDHE).\r\n\r\nAlso the section that mandated KDF step on the draft standard is not currently enforcing the same criteria so we need to put more thought on it.\r\n\r\nWhat do you think? ","created_at":"2016-10-05T13:19:05Z","updated_at":"2016-10-05T13:19:05Z","html_url":"https://github.com/openssl/openssl/pull/1658#discussion_r81969228","pull_request_url":"https://api.github.com/repos/openssl/openssl/pulls/1658","_links":{"self":{"href":"https://api.github.com/repos/openssl/openssl/pulls/comments/81969228"},"html":{"href":"https://github.com/openssl/openssl/pull/1658#discussion_r81969228"},"pull_request":{"href":"https://api.github.com/repos/openssl/openssl/pulls/1658"}}},"pull_request":{"url":"https://api.github.com/repos/openssl/openssl/pulls/1658","id":87757965,"html_url":"https://github.com/openssl/openssl/pull/1658","diff_url":"https://github.com/openssl/openssl/pull/1658.diff","patch_url":"https://github.com/openssl/openssl/pull/1658.patch","issue_url":"https://api.github.com/repos/openssl/openssl/issues/1658","number":1658,"state":"open","locked":false,"title":"Use EVP interface for ECDH in apps/speed.c","user":{"login":"romen","id":338418,"avatar_url":"https://avatars.githubusercontent.com/u/338418?v=3","gravatar_id":"","url":"https://api.github.com/users/romen","html_url":"https://github.com/romen","followers_url":"https://api.github.com/users/romen/followers","following_url":"https://api.github.com/users/romen/following{/other_user}","gists_url":"https://api.github.com/users/romen/gists{/gist_id}","starred_url":"https://api.github.com/users/romen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romen/subscriptions","organizations_url":"https://api.github.com/users/romen/orgs","repos_url":"https://api.github.com/users/romen/repos","events_url":"https://api.github.com/users/romen/events{/privacy}","received_events_url":"https://api.github.com/users/romen/received_events","type":"User","site_admin":false},"body":"Noticed [this thread in the openssl-dev ML](https://mta.openssl.org/pipermail/openssl-dev/2016-October/008582.html).\r\n\r\nI was already working on option number 3 for a side project where I had the need to compare benchmarks of ECDH with different curves, including X25519, so here is a pull request to start from if we want to revise which interface to use to access EC crypto in apps/speed.\r\n\r\nThis commit only affects ECDH benchmarking, ECDSA still uses the low-level API. ","created_at":"2016-10-03T17:35:11Z","updated_at":"2016-10-05T13:19:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e828f381c45174284d188c1ac5ba28abeffd06d3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openssl/openssl/pulls/1658/commits","review_comments_url":"https://api.github.com/repos/openssl/openssl/pulls/1658/comments","review_comment_url":"https://api.github.com/repos/openssl/openssl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openssl/openssl/issues/1658/comments","statuses_url":"https://api.github.com/repos/openssl/openssl/statuses/2da6cc827e444eb142040f68527545db6e545245","head":{"label":"romen:master_speed_ecdh_evp","ref":"master_speed_ecdh_evp","sha":"2da6cc827e444eb142040f68527545db6e545245","user":{"login":"romen","id":338418,"avatar_url":"https://avatars.githubusercontent.com/u/338418?v=3","gravatar_id":"","url":"https://api.github.com/users/romen","html_url":"https://github.com/romen","followers_url":"https://api.github.com/users/romen/followers","following_url":"https://api.github.com/users/romen/following{/other_user}","gists_url":"https://api.github.com/users/romen/gists{/gist_id}","starred_url":"https://api.github.com/users/romen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romen/subscriptions","organizations_url":"https://api.github.com/users/romen/orgs","repos_url":"https://api.github.com/users/romen/repos","events_url":"https://api.github.com/users/romen/events{/privacy}","received_events_url":"https://api.github.com/users/romen/received_events","type":"User","site_admin":false},"repo":{"id":64729908,"name":"openssl","full_name":"romen/openssl","owner":{"login":"romen","id":338418,"avatar_url":"https://avatars.githubusercontent.com/u/338418?v=3","gravatar_id":"","url":"https://api.github.com/users/romen","html_url":"https://github.com/romen","followers_url":"https://api.github.com/users/romen/followers","following_url":"https://api.github.com/users/romen/following{/other_user}","gists_url":"https://api.github.com/users/romen/gists{/gist_id}","starred_url":"https://api.github.com/users/romen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romen/subscriptions","organizations_url":"https://api.github.com/users/romen/orgs","repos_url":"https://api.github.com/users/romen/repos","events_url":"https://api.github.com/users/romen/events{/privacy}","received_events_url":"https://api.github.com/users/romen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/romen/openssl","description":"TLS/SSL and crypto library","fork":true,"url":"https://api.github.com/repos/romen/openssl","forks_url":"https://api.github.com/repos/romen/openssl/forks","keys_url":"https://api.github.com/repos/romen/openssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/romen/openssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/romen/openssl/teams","hooks_url":"https://api.github.com/repos/romen/openssl/hooks","issue_events_url":"https://api.github.com/repos/romen/openssl/issues/events{/number}","events_url":"https://api.github.com/repos/romen/openssl/events","assignees_url":"https://api.github.com/repos/romen/openssl/assignees{/user}","branches_url":"https://api.github.com/repos/romen/openssl/branches{/branch}","tags_url":"https://api.github.com/repos/romen/openssl/tags","blobs_url":"https://api.github.com/repos/romen/openssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/romen/openssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/romen/openssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/romen/openssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/romen/openssl/statuses/{sha}","languages_url":"https://api.github.com/repos/romen/openssl/languages","stargazers_url":"https://api.github.com/repos/romen/openssl/stargazers","contributors_url":"https://api.github.com/repos/romen/openssl/contributors","subscribers_url":"https://api.github.com/repos/romen/openssl/subscribers","subscription_url":"https://api.github.com/repos/romen/openssl/subscription","commits_url":"https://api.github.com/repos/romen/openssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/romen/openssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/romen/openssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/romen/openssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/romen/openssl/contents/{+path}","compare_url":"https://api.github.com/repos/romen/openssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/romen/openssl/merges","archive_url":"https://api.github.com/repos/romen/openssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/romen/openssl/downloads","issues_url":"https://api.github.com/repos/romen/openssl/issues{/number}","pulls_url":"https://api.github.com/repos/romen/openssl/pulls{/number}","milestones_url":"https://api.github.com/repos/romen/openssl/milestones{/number}","notifications_url":"https://api.github.com/repos/romen/openssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/romen/openssl/labels{/name}","releases_url":"https://api.github.com/repos/romen/openssl/releases{/id}","deployments_url":"https://api.github.com/repos/romen/openssl/deployments","created_at":"2016-08-02T06:21:08Z","updated_at":"2016-08-02T06:21:21Z","pushed_at":"2016-10-04T13:41:34Z","git_url":"git://github.com/romen/openssl.git","ssh_url":"git@github.com:romen/openssl.git","clone_url":"https://github.com/romen/openssl.git","svn_url":"https://github.com/romen/openssl","homepage":"https://www.openssl.org","size":96859,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openssl:master","ref":"master","sha":"b90506e995d44dee0ef4dd0324b56b59154256c2","user":{"login":"openssl","id":3279138,"avatar_url":"https://avatars.githubusercontent.com/u/3279138?v=3","gravatar_id":"","url":"https://api.github.com/users/openssl","html_url":"https://github.com/openssl","followers_url":"https://api.github.com/users/openssl/followers","following_url":"https://api.github.com/users/openssl/following{/other_user}","gists_url":"https://api.github.com/users/openssl/gists{/gist_id}","starred_url":"https://api.github.com/users/openssl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openssl/subscriptions","organizations_url":"https://api.github.com/users/openssl/orgs","repos_url":"https://api.github.com/users/openssl/repos","events_url":"https://api.github.com/users/openssl/events{/privacy}","received_events_url":"https://api.github.com/users/openssl/received_events","type":"Organization","site_admin":false},"repo":{"id":7634677,"name":"openssl","full_name":"openssl/openssl","owner":{"login":"openssl","id":3279138,"avatar_url":"https://avatars.githubusercontent.com/u/3279138?v=3","gravatar_id":"","url":"https://api.github.com/users/openssl","html_url":"https://github.com/openssl","followers_url":"https://api.github.com/users/openssl/followers","following_url":"https://api.github.com/users/openssl/following{/other_user}","gists_url":"https://api.github.com/users/openssl/gists{/gist_id}","starred_url":"https://api.github.com/users/openssl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openssl/subscriptions","organizations_url":"https://api.github.com/users/openssl/orgs","repos_url":"https://api.github.com/users/openssl/repos","events_url":"https://api.github.com/users/openssl/events{/privacy}","received_events_url":"https://api.github.com/users/openssl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openssl/openssl","description":"TLS/SSL and crypto library","fork":false,"url":"https://api.github.com/repos/openssl/openssl","forks_url":"https://api.github.com/repos/openssl/openssl/forks","keys_url":"https://api.github.com/repos/openssl/openssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openssl/openssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openssl/openssl/teams","hooks_url":"https://api.github.com/repos/openssl/openssl/hooks","issue_events_url":"https://api.github.com/repos/openssl/openssl/issues/events{/number}","events_url":"https://api.github.com/repos/openssl/openssl/events","assignees_url":"https://api.github.com/repos/openssl/openssl/assignees{/user}","branches_url":"https://api.github.com/repos/openssl/openssl/branches{/branch}","tags_url":"https://api.github.com/repos/openssl/openssl/tags","blobs_url":"https://api.github.com/repos/openssl/openssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openssl/openssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openssl/openssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/openssl/openssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openssl/openssl/statuses/{sha}","languages_url":"https://api.github.com/repos/openssl/openssl/languages","stargazers_url":"https://api.github.com/repos/openssl/openssl/stargazers","contributors_url":"https://api.github.com/repos/openssl/openssl/contributors","subscribers_url":"https://api.github.com/repos/openssl/openssl/subscribers","subscription_url":"https://api.github.com/repos/openssl/openssl/subscription","commits_url":"https://api.github.com/repos/openssl/openssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/openssl/openssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/openssl/openssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/openssl/openssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/openssl/openssl/contents/{+path}","compare_url":"https://api.github.com/repos/openssl/openssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openssl/openssl/merges","archive_url":"https://api.github.com/repos/openssl/openssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openssl/openssl/downloads","issues_url":"https://api.github.com/repos/openssl/openssl/issues{/number}","pulls_url":"https://api.github.com/repos/openssl/openssl/pulls{/number}","milestones_url":"https://api.github.com/repos/openssl/openssl/milestones{/number}","notifications_url":"https://api.github.com/repos/openssl/openssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openssl/openssl/labels{/name}","releases_url":"https://api.github.com/repos/openssl/openssl/releases{/id}","deployments_url":"https://api.github.com/repos/openssl/openssl/deployments","created_at":"2013-01-15T22:34:48Z","updated_at":"2016-10-05T09:06:40Z","pushed_at":"2016-10-05T10:45:44Z","git_url":"git://github.com/openssl/openssl.git","ssh_url":"git@github.com:openssl/openssl.git","clone_url":"https://github.com/openssl/openssl.git","svn_url":"https://github.com/openssl/openssl","homepage":"https://www.openssl.org","size":120976,"stargazers_count":3283,"watchers_count":3283,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1877,"mirror_url":null,"open_issues_count":172,"forks":1877,"open_issues":172,"watchers":3283,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openssl/openssl/pulls/1658"},"html":{"href":"https://github.com/openssl/openssl/pull/1658"},"issue":{"href":"https://api.github.com/repos/openssl/openssl/issues/1658"},"comments":{"href":"https://api.github.com/repos/openssl/openssl/issues/1658/comments"},"review_comments":{"href":"https://api.github.com/repos/openssl/openssl/pulls/1658/comments"},"review_comment":{"href":"https://api.github.com/repos/openssl/openssl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openssl/openssl/pulls/1658/commits"},"statuses":{"href":"https://api.github.com/repos/openssl/openssl/statuses/2da6cc827e444eb142040f68527545db6e545245"}}}}
{"actor":{"display_login":"romen"}}