{"action":"created","comment":{"url":"https://api.github.com/repos/awslabs/s2n/pulls/comments/206427043","pull_request_review_id":141836677,"id":206427043,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjQyNzA0Mw==","diff_hunk":"@@ -635,6 +636,42 @@ static int handshake_read_io(struct s2n_connection *conn)\n     return 0;\n }\n \n+static void s2n_write_keylog(struct s2n_connection *conn)\n+{\n+    char *keylog_fn;\n+    FILE *keylog_fp;\n+\n+    keylog_fn = getenv(\"SSLKEYLOGFILE\");\n+    if (!keylog_fn) {\n+        return;\n+    }\n+\n+    keylog_fp = fopen(keylog_fn, \"a\");","path":"tls/s2n_handshake_io.c","position":22,"original_position":22,"commit_id":"382efb8419c375df23afba58ca37a87f1c6e7612","original_commit_id":"382efb8419c375df23afba58ca37a87f1c6e7612","user":{"login":"phillipberndt","id":387407,"node_id":"MDQ6VXNlcjM4NzQwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/387407?v=4","gravatar_id":"","url":"https://api.github.com/users/phillipberndt","html_url":"https://github.com/phillipberndt","followers_url":"https://api.github.com/users/phillipberndt/followers","following_url":"https://api.github.com/users/phillipberndt/following{/other_user}","gists_url":"https://api.github.com/users/phillipberndt/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipberndt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipberndt/subscriptions","organizations_url":"https://api.github.com/users/phillipberndt/orgs","repos_url":"https://api.github.com/users/phillipberndt/repos","events_url":"https://api.github.com/users/phillipberndt/events{/privacy}","received_events_url":"https://api.github.com/users/phillipberndt/received_events","type":"User","site_admin":false},"body":"> We use GUARD() to check every call and return value\r\n\r\nBut `GUARD` assumes a classic C API returning a negative number in case of failures. `fopen` returns `NULL`.\r\n\r\n> Rather than using fprintf/fopen/fclose directly would it be better to add these as \r\n> stuffer abstractions? E.g. make a file writable stuffer? We have a file readable \r\n> stuffer already, so that would be symmetrical.\r\n\r\n`s2n_stuffer_send_to_fd` already exists, and my first idea was to use it, in particular since there's `s2n_stuffer_hex` already - but it's part of the testlib, that's why I eventually didn't.\r\n\r\n> Typically too programs that write to appended log files also need to do things like\r\n>  handle the HUP signal. Are we going to need that kind of infrastructure in \r\n> programs? Would we better off having a callback instead and letting the caller do \r\n> the logging?\r\n\r\nGood point. What I like about this is that it'd more in sync with the SSL_CTX_set_keylog_callback concept used by others. I'll update the PR.","created_at":"2018-07-31T07:52:22Z","updated_at":"2018-07-31T07:52:22Z","html_url":"https://github.com/awslabs/s2n/pull/818#discussion_r206427043","pull_request_url":"https://api.github.com/repos/awslabs/s2n/pulls/818","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/awslabs/s2n/pulls/comments/206427043"},"html":{"href":"https://github.com/awslabs/s2n/pull/818#discussion_r206427043"},"pull_request":{"href":"https://api.github.com/repos/awslabs/s2n/pulls/818"}},"in_reply_to_id":206344930},"pull_request":{"url":"https://api.github.com/repos/awslabs/s2n/pulls/818","id":204420057,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NDIwMDU3","html_url":"https://github.com/awslabs/s2n/pull/818","diff_url":"https://github.com/awslabs/s2n/pull/818.diff","patch_url":"https://github.com/awslabs/s2n/pull/818.patch","issue_url":"https://api.github.com/repos/awslabs/s2n/issues/818","number":818,"state":"open","locked":false,"title":"Debug: Add NSS Key Log Support","user":{"login":"phillipberndt","id":387407,"node_id":"MDQ6VXNlcjM4NzQwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/387407?v=4","gravatar_id":"","url":"https://api.github.com/users/phillipberndt","html_url":"https://github.com/phillipberndt","followers_url":"https://api.github.com/users/phillipberndt/followers","following_url":"https://api.github.com/users/phillipberndt/following{/other_user}","gists_url":"https://api.github.com/users/phillipberndt/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipberndt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipberndt/subscriptions","organizations_url":"https://api.github.com/users/phillipberndt/orgs","repos_url":"https://api.github.com/users/phillipberndt/repos","events_url":"https://api.github.com/users/phillipberndt/events{/privacy}","received_events_url":"https://api.github.com/users/phillipberndt/received_events","type":"User","site_admin":false},"body":"**Issue # (if available):** #817 \r\n\r\n**Description of changes:** Add NSS-compatible Key Log support\r\n\r\n**Remarks**:\r\n\r\n* One change I'm quite certain you'll want is to conditionally compile the code in, and preferably opt-in rather than opt-out. Since there are several ways to do this (cmake option, API) I've skipped that for now. Let's iterate on this PR!\r\n* What about error checking? I omitted it on purpose, because it feels wrong to me to error out of a connection just because writing debug logs to the disk failed..\r\n* This feature will need some (minor) work for TLS 1.3 compatibility: [See Mozilla's logs](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format). \r\n\r\nBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.\r\n","created_at":"2018-07-27T12:40:22Z","updated_at":"2018-07-31T07:52:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"215ecf6711cd2ea6153ad7878e849c01f7fbda3c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/awslabs/s2n/pulls/818/commits","review_comments_url":"https://api.github.com/repos/awslabs/s2n/pulls/818/comments","review_comment_url":"https://api.github.com/repos/awslabs/s2n/pulls/comments{/number}","comments_url":"https://api.github.com/repos/awslabs/s2n/issues/818/comments","statuses_url":"https://api.github.com/repos/awslabs/s2n/statuses/382efb8419c375df23afba58ca37a87f1c6e7612","head":{"label":"phillipberndt:master","ref":"master","sha":"382efb8419c375df23afba58ca37a87f1c6e7612","user":{"login":"phillipberndt","id":387407,"node_id":"MDQ6VXNlcjM4NzQwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/387407?v=4","gravatar_id":"","url":"https://api.github.com/users/phillipberndt","html_url":"https://github.com/phillipberndt","followers_url":"https://api.github.com/users/phillipberndt/followers","following_url":"https://api.github.com/users/phillipberndt/following{/other_user}","gists_url":"https://api.github.com/users/phillipberndt/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipberndt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipberndt/subscriptions","organizations_url":"https://api.github.com/users/phillipberndt/orgs","repos_url":"https://api.github.com/users/phillipberndt/repos","events_url":"https://api.github.com/users/phillipberndt/events{/privacy}","received_events_url":"https://api.github.com/users/phillipberndt/received_events","type":"User","site_admin":false},"repo":{"id":132573170,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI1NzMxNzA=","name":"s2n","full_name":"phillipberndt/s2n","owner":{"login":"phillipberndt","id":387407,"node_id":"MDQ6VXNlcjM4NzQwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/387407?v=4","gravatar_id":"","url":"https://api.github.com/users/phillipberndt","html_url":"https://github.com/phillipberndt","followers_url":"https://api.github.com/users/phillipberndt/followers","following_url":"https://api.github.com/users/phillipberndt/following{/other_user}","gists_url":"https://api.github.com/users/phillipberndt/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipberndt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipberndt/subscriptions","organizations_url":"https://api.github.com/users/phillipberndt/orgs","repos_url":"https://api.github.com/users/phillipberndt/repos","events_url":"https://api.github.com/users/phillipberndt/events{/privacy}","received_events_url":"https://api.github.com/users/phillipberndt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phillipberndt/s2n","description":"s2n : an implementation of the TLS/SSL protocols","fork":true,"url":"https://api.github.com/repos/phillipberndt/s2n","forks_url":"https://api.github.com/repos/phillipberndt/s2n/forks","keys_url":"https://api.github.com/repos/phillipberndt/s2n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phillipberndt/s2n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phillipberndt/s2n/teams","hooks_url":"https://api.github.com/repos/phillipberndt/s2n/hooks","issue_events_url":"https://api.github.com/repos/phillipberndt/s2n/issues/events{/number}","events_url":"https://api.github.com/repos/phillipberndt/s2n/events","assignees_url":"https://api.github.com/repos/phillipberndt/s2n/assignees{/user}","branches_url":"https://api.github.com/repos/phillipberndt/s2n/branches{/branch}","tags_url":"https://api.github.com/repos/phillipberndt/s2n/tags","blobs_url":"https://api.github.com/repos/phillipberndt/s2n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phillipberndt/s2n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phillipberndt/s2n/git/refs{/sha}","trees_url":"https://api.github.com/repos/phillipberndt/s2n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phillipberndt/s2n/statuses/{sha}","languages_url":"https://api.github.com/repos/phillipberndt/s2n/languages","stargazers_url":"https://api.github.com/repos/phillipberndt/s2n/stargazers","contributors_url":"https://api.github.com/repos/phillipberndt/s2n/contributors","subscribers_url":"https://api.github.com/repos/phillipberndt/s2n/subscribers","subscription_url":"https://api.github.com/repos/phillipberndt/s2n/subscription","commits_url":"https://api.github.com/repos/phillipberndt/s2n/commits{/sha}","git_commits_url":"https://api.github.com/repos/phillipberndt/s2n/git/commits{/sha}","comments_url":"https://api.github.com/repos/phillipberndt/s2n/comments{/number}","issue_comment_url":"https://api.github.com/repos/phillipberndt/s2n/issues/comments{/number}","contents_url":"https://api.github.com/repos/phillipberndt/s2n/contents/{+path}","compare_url":"https://api.github.com/repos/phillipberndt/s2n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phillipberndt/s2n/merges","archive_url":"https://api.github.com/repos/phillipberndt/s2n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phillipberndt/s2n/downloads","issues_url":"https://api.github.com/repos/phillipberndt/s2n/issues{/number}","pulls_url":"https://api.github.com/repos/phillipberndt/s2n/pulls{/number}","milestones_url":"https://api.github.com/repos/phillipberndt/s2n/milestones{/number}","notifications_url":"https://api.github.com/repos/phillipberndt/s2n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phillipberndt/s2n/labels{/name}","releases_url":"https://api.github.com/repos/phillipberndt/s2n/releases{/id}","deployments_url":"https://api.github.com/repos/phillipberndt/s2n/deployments","created_at":"2018-05-08T07:45:15Z","updated_at":"2018-07-27T13:31:29Z","pushed_at":"2018-07-27T13:31:27Z","git_url":"git://github.com/phillipberndt/s2n.git","ssh_url":"git@github.com:phillipberndt/s2n.git","clone_url":"https://github.com/phillipberndt/s2n.git","svn_url":"https://github.com/phillipberndt/s2n","homepage":"","size":4060,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"awslabs:master","ref":"master","sha":"3fd78ca2d1bd946d626d78148fc108654108b550","user":{"login":"awslabs","id":3299148,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyOTkxNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/3299148?v=4","gravatar_id":"","url":"https://api.github.com/users/awslabs","html_url":"https://github.com/awslabs","followers_url":"https://api.github.com/users/awslabs/followers","following_url":"https://api.github.com/users/awslabs/following{/other_user}","gists_url":"https://api.github.com/users/awslabs/gists{/gist_id}","starred_url":"https://api.github.com/users/awslabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awslabs/subscriptions","organizations_url":"https://api.github.com/users/awslabs/orgs","repos_url":"https://api.github.com/users/awslabs/repos","events_url":"https://api.github.com/users/awslabs/events{/privacy}","received_events_url":"https://api.github.com/users/awslabs/received_events","type":"Organization","site_admin":false},"repo":{"id":21287076,"node_id":"MDEwOlJlcG9zaXRvcnkyMTI4NzA3Ng==","name":"s2n","full_name":"awslabs/s2n","owner":{"login":"awslabs","id":3299148,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyOTkxNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/3299148?v=4","gravatar_id":"","url":"https://api.github.com/users/awslabs","html_url":"https://github.com/awslabs","followers_url":"https://api.github.com/users/awslabs/followers","following_url":"https://api.github.com/users/awslabs/following{/other_user}","gists_url":"https://api.github.com/users/awslabs/gists{/gist_id}","starred_url":"https://api.github.com/users/awslabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awslabs/subscriptions","organizations_url":"https://api.github.com/users/awslabs/orgs","repos_url":"https://api.github.com/users/awslabs/repos","events_url":"https://api.github.com/users/awslabs/events{/privacy}","received_events_url":"https://api.github.com/users/awslabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/awslabs/s2n","description":"s2n : an implementation of the TLS/SSL protocols","fork":false,"url":"https://api.github.com/repos/awslabs/s2n","forks_url":"https://api.github.com/repos/awslabs/s2n/forks","keys_url":"https://api.github.com/repos/awslabs/s2n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/awslabs/s2n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/awslabs/s2n/teams","hooks_url":"https://api.github.com/repos/awslabs/s2n/hooks","issue_events_url":"https://api.github.com/repos/awslabs/s2n/issues/events{/number}","events_url":"https://api.github.com/repos/awslabs/s2n/events","assignees_url":"https://api.github.com/repos/awslabs/s2n/assignees{/user}","branches_url":"https://api.github.com/repos/awslabs/s2n/branches{/branch}","tags_url":"https://api.github.com/repos/awslabs/s2n/tags","blobs_url":"https://api.github.com/repos/awslabs/s2n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/awslabs/s2n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/awslabs/s2n/git/refs{/sha}","trees_url":"https://api.github.com/repos/awslabs/s2n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/awslabs/s2n/statuses/{sha}","languages_url":"https://api.github.com/repos/awslabs/s2n/languages","stargazers_url":"https://api.github.com/repos/awslabs/s2n/stargazers","contributors_url":"https://api.github.com/repos/awslabs/s2n/contributors","subscribers_url":"https://api.github.com/repos/awslabs/s2n/subscribers","subscription_url":"https://api.github.com/repos/awslabs/s2n/subscription","commits_url":"https://api.github.com/repos/awslabs/s2n/commits{/sha}","git_commits_url":"https://api.github.com/repos/awslabs/s2n/git/commits{/sha}","comments_url":"https://api.github.com/repos/awslabs/s2n/comments{/number}","issue_comment_url":"https://api.github.com/repos/awslabs/s2n/issues/comments{/number}","contents_url":"https://api.github.com/repos/awslabs/s2n/contents/{+path}","compare_url":"https://api.github.com/repos/awslabs/s2n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/awslabs/s2n/merges","archive_url":"https://api.github.com/repos/awslabs/s2n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/awslabs/s2n/downloads","issues_url":"https://api.github.com/repos/awslabs/s2n/issues{/number}","pulls_url":"https://api.github.com/repos/awslabs/s2n/pulls{/number}","milestones_url":"https://api.github.com/repos/awslabs/s2n/milestones{/number}","notifications_url":"https://api.github.com/repos/awslabs/s2n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/awslabs/s2n/labels{/name}","releases_url":"https://api.github.com/repos/awslabs/s2n/releases{/id}","deployments_url":"https://api.github.com/repos/awslabs/s2n/deployments","created_at":"2014-06-27T19:37:59Z","updated_at":"2018-07-31T06:50:43Z","pushed_at":"2018-07-30T18:47:05Z","git_url":"git://github.com/awslabs/s2n.git","ssh_url":"git@github.com:awslabs/s2n.git","clone_url":"https://github.com/awslabs/s2n.git","svn_url":"https://github.com/awslabs/s2n","homepage":"","size":4061,"stargazers_count":3150,"watchers_count":3150,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":321,"mirror_url":null,"archived":false,"open_issues_count":134,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":321,"open_issues":134,"watchers":3150,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/awslabs/s2n/pulls/818"},"html":{"href":"https://github.com/awslabs/s2n/pull/818"},"issue":{"href":"https://api.github.com/repos/awslabs/s2n/issues/818"},"comments":{"href":"https://api.github.com/repos/awslabs/s2n/issues/818/comments"},"review_comments":{"href":"https://api.github.com/repos/awslabs/s2n/pulls/818/comments"},"review_comment":{"href":"https://api.github.com/repos/awslabs/s2n/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/awslabs/s2n/pulls/818/commits"},"statuses":{"href":"https://api.github.com/repos/awslabs/s2n/statuses/382efb8419c375df23afba58ca37a87f1c6e7612"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"phillipberndt"}}