{"action":"created","comment":{"url":"https://api.github.com/repos/google/go-tpm/pulls/comments/168038739","pull_request_review_id":96342484,"id":168038739,"diff_hunk":"@@ -24,44 +24,15 @@ import (\n \t\"crypto/sha1\"\n \t\"encoding/binary\"\n \t\"errors\"\n-\t\"fmt\"\n \t\"io\"\n-\t\"net\"\n-\t\"os\"\n \n \t\"github.com/google/go-tpm/tpmutil\"\n )\n \n // OpenTPM opens a channel to the TPM at the given path. If the file is a\n // device, then it treats it like a normal TPM device, and if the file is a\n // Unix domain socket, then it opens a connection to the socket.\n-func OpenTPM(path string) (io.ReadWriteCloser, error) {\n-\t// If it's a regular file, then open it\n-\tvar rwc io.ReadWriteCloser\n-\tfi, err := os.Stat(path)\n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n-\n-\tif fi.Mode()&os.ModeDevice != 0 {\n-\t\tvar f *os.File\n-\t\tf, err = os.OpenFile(path, os.O_RDWR, 0600)\n-\t\tif err != nil {\n-\t\t\treturn nil, err\n-\t\t}\n-\t\trwc = io.ReadWriteCloser(f)\n-\t} else if fi.Mode()&os.ModeSocket != 0 {\n-\t\tuc, err := net.DialUnix(\"unix\", nil, &net.UnixAddr{Name: path, Net: \"unix\"})\n-\t\tif err != nil {\n-\t\t\treturn nil, err\n-\t\t}\n-\t\trwc = io.ReadWriteCloser(uc)\n-\t} else {\n-\t\treturn nil, fmt.Errorf(\"unsupported TPM file mode %s\", fi.Mode().String())\n-\t}\n-\n-\treturn rwc, nil\n-}\n+var OpenTPM = tpmutil.OpenTPM","path":"tpm/tpm.go","position":42,"original_position":42,"commit_id":"0ac19e09eb57c0c8b35e40fce56eeb2c726985d1","original_commit_id":"7fb19205be78cb3e54d3fc29aa1b6428e36b4564","user":{"login":"tmroeder","id":889223,"avatar_url":"https://avatars2.githubusercontent.com/u/889223?v=4","gravatar_id":"","url":"https://api.github.com/users/tmroeder","html_url":"https://github.com/tmroeder","followers_url":"https://api.github.com/users/tmroeder/followers","following_url":"https://api.github.com/users/tmroeder/following{/other_user}","gists_url":"https://api.github.com/users/tmroeder/gists{/gist_id}","starred_url":"https://api.github.com/users/tmroeder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmroeder/subscriptions","organizations_url":"https://api.github.com/users/tmroeder/orgs","repos_url":"https://api.github.com/users/tmroeder/repos","events_url":"https://api.github.com/users/tmroeder/events{/privacy}","received_events_url":"https://api.github.com/users/tmroeder/received_events","type":"User","site_admin":false},"body":"Good point. I guess it's OK to leave it like this for now.","created_at":"2018-02-13T23:40:40Z","updated_at":"2018-02-13T23:40:40Z","html_url":"https://github.com/google/go-tpm/pull/5#discussion_r168038739","pull_request_url":"https://api.github.com/repos/google/go-tpm/pulls/5","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/google/go-tpm/pulls/comments/168038739"},"html":{"href":"https://github.com/google/go-tpm/pull/5#discussion_r168038739"},"pull_request":{"href":"https://api.github.com/repos/google/go-tpm/pulls/5"}},"in_reply_to_id":168009415},"pull_request":{"url":"https://api.github.com/repos/google/go-tpm/pulls/5","id":167543589,"html_url":"https://github.com/google/go-tpm/pull/5","diff_url":"https://github.com/google/go-tpm/pull/5.diff","patch_url":"https://github.com/google/go-tpm/pull/5.patch","issue_url":"https://api.github.com/repos/google/go-tpm/issues/5","number":5,"state":"open","locked":false,"title":"TPM 2.0 partial implementation","user":{"login":"awly","id":1146263,"avatar_url":"https://avatars2.githubusercontent.com/u/1146263?v=4","gravatar_id":"","url":"https://api.github.com/users/awly","html_url":"https://github.com/awly","followers_url":"https://api.github.com/users/awly/followers","following_url":"https://api.github.com/users/awly/following{/other_user}","gists_url":"https://api.github.com/users/awly/gists{/gist_id}","starred_url":"https://api.github.com/users/awly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awly/subscriptions","organizations_url":"https://api.github.com/users/awly/orgs","repos_url":"https://api.github.com/users/awly/repos","events_url":"https://api.github.com/users/awly/events{/privacy}","received_events_url":"https://api.github.com/users/awly/received_events","type":"User","site_admin":false},"body":"Contains code from https://github.com/jlmucb/cloudproxy/tree/master/go/tpm2 plus refactoring.\r\n\r\nThis is NOT a full TPM 2.0 spec implementation. Only a select handful of commands are implemented, along with their required constants and data structures.\r\nMost of the constant groups are not the full set of constants from that category in the spec.\r\nCertain commands are not implemented with their full potential flexibility (e.g. TPM2_Create only creates RSA keys).","created_at":"2018-02-06T22:11:13Z","updated_at":"2018-02-13T23:40:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a479e73ec43b62f19f7930ad846738c9ec807721","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/go-tpm/pulls/5/commits","review_comments_url":"https://api.github.com/repos/google/go-tpm/pulls/5/comments","review_comment_url":"https://api.github.com/repos/google/go-tpm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/go-tpm/issues/5/comments","statuses_url":"https://api.github.com/repos/google/go-tpm/statuses/0ac19e09eb57c0c8b35e40fce56eeb2c726985d1","head":{"label":"awly:tpm2","ref":"tpm2","sha":"0ac19e09eb57c0c8b35e40fce56eeb2c726985d1","user":{"login":"awly","id":1146263,"avatar_url":"https://avatars2.githubusercontent.com/u/1146263?v=4","gravatar_id":"","url":"https://api.github.com/users/awly","html_url":"https://github.com/awly","followers_url":"https://api.github.com/users/awly/followers","following_url":"https://api.github.com/users/awly/following{/other_user}","gists_url":"https://api.github.com/users/awly/gists{/gist_id}","starred_url":"https://api.github.com/users/awly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awly/subscriptions","organizations_url":"https://api.github.com/users/awly/orgs","repos_url":"https://api.github.com/users/awly/repos","events_url":"https://api.github.com/users/awly/events{/privacy}","received_events_url":"https://api.github.com/users/awly/received_events","type":"User","site_admin":false},"repo":{"id":118978034,"name":"go-tpm","full_name":"awly/go-tpm","owner":{"login":"awly","id":1146263,"avatar_url":"https://avatars2.githubusercontent.com/u/1146263?v=4","gravatar_id":"","url":"https://api.github.com/users/awly","html_url":"https://github.com/awly","followers_url":"https://api.github.com/users/awly/followers","following_url":"https://api.github.com/users/awly/following{/other_user}","gists_url":"https://api.github.com/users/awly/gists{/gist_id}","starred_url":"https://api.github.com/users/awly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awly/subscriptions","organizations_url":"https://api.github.com/users/awly/orgs","repos_url":"https://api.github.com/users/awly/repos","events_url":"https://api.github.com/users/awly/events{/privacy}","received_events_url":"https://api.github.com/users/awly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/awly/go-tpm","description":null,"fork":true,"url":"https://api.github.com/repos/awly/go-tpm","forks_url":"https://api.github.com/repos/awly/go-tpm/forks","keys_url":"https://api.github.com/repos/awly/go-tpm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/awly/go-tpm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/awly/go-tpm/teams","hooks_url":"https://api.github.com/repos/awly/go-tpm/hooks","issue_events_url":"https://api.github.com/repos/awly/go-tpm/issues/events{/number}","events_url":"https://api.github.com/repos/awly/go-tpm/events","assignees_url":"https://api.github.com/repos/awly/go-tpm/assignees{/user}","branches_url":"https://api.github.com/repos/awly/go-tpm/branches{/branch}","tags_url":"https://api.github.com/repos/awly/go-tpm/tags","blobs_url":"https://api.github.com/repos/awly/go-tpm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/awly/go-tpm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/awly/go-tpm/git/refs{/sha}","trees_url":"https://api.github.com/repos/awly/go-tpm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/awly/go-tpm/statuses/{sha}","languages_url":"https://api.github.com/repos/awly/go-tpm/languages","stargazers_url":"https://api.github.com/repos/awly/go-tpm/stargazers","contributors_url":"https://api.github.com/repos/awly/go-tpm/contributors","subscribers_url":"https://api.github.com/repos/awly/go-tpm/subscribers","subscription_url":"https://api.github.com/repos/awly/go-tpm/subscription","commits_url":"https://api.github.com/repos/awly/go-tpm/commits{/sha}","git_commits_url":"https://api.github.com/repos/awly/go-tpm/git/commits{/sha}","comments_url":"https://api.github.com/repos/awly/go-tpm/comments{/number}","issue_comment_url":"https://api.github.com/repos/awly/go-tpm/issues/comments{/number}","contents_url":"https://api.github.com/repos/awly/go-tpm/contents/{+path}","compare_url":"https://api.github.com/repos/awly/go-tpm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/awly/go-tpm/merges","archive_url":"https://api.github.com/repos/awly/go-tpm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/awly/go-tpm/downloads","issues_url":"https://api.github.com/repos/awly/go-tpm/issues{/number}","pulls_url":"https://api.github.com/repos/awly/go-tpm/pulls{/number}","milestones_url":"https://api.github.com/repos/awly/go-tpm/milestones{/number}","notifications_url":"https://api.github.com/repos/awly/go-tpm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/awly/go-tpm/labels{/name}","releases_url":"https://api.github.com/repos/awly/go-tpm/releases{/id}","deployments_url":"https://api.github.com/repos/awly/go-tpm/deployments","created_at":"2018-01-25T23:05:33Z","updated_at":"2018-01-25T23:05:35Z","pushed_at":"2018-02-13T23:38:14Z","git_url":"git://github.com/awly/go-tpm.git","ssh_url":"git@github.com:awly/go-tpm.git","clone_url":"https://github.com/awly/go-tpm.git","svn_url":"https://github.com/awly/go-tpm","homepage":null,"size":232,"stargazers_count":0,"watchers_count":0,"language":"Go","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"c5c955955f4946a192b77e31952338b3ba36bc54","user":{"login":"google","id":1342004,"avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":22929140,"name":"go-tpm","full_name":"google/go-tpm","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/go-tpm","description":null,"fork":false,"url":"https://api.github.com/repos/google/go-tpm","forks_url":"https://api.github.com/repos/google/go-tpm/forks","keys_url":"https://api.github.com/repos/google/go-tpm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/go-tpm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/go-tpm/teams","hooks_url":"https://api.github.com/repos/google/go-tpm/hooks","issue_events_url":"https://api.github.com/repos/google/go-tpm/issues/events{/number}","events_url":"https://api.github.com/repos/google/go-tpm/events","assignees_url":"https://api.github.com/repos/google/go-tpm/assignees{/user}","branches_url":"https://api.github.com/repos/google/go-tpm/branches{/branch}","tags_url":"https://api.github.com/repos/google/go-tpm/tags","blobs_url":"https://api.github.com/repos/google/go-tpm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/go-tpm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/go-tpm/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/go-tpm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/go-tpm/statuses/{sha}","languages_url":"https://api.github.com/repos/google/go-tpm/languages","stargazers_url":"https://api.github.com/repos/google/go-tpm/stargazers","contributors_url":"https://api.github.com/repos/google/go-tpm/contributors","subscribers_url":"https://api.github.com/repos/google/go-tpm/subscribers","subscription_url":"https://api.github.com/repos/google/go-tpm/subscription","commits_url":"https://api.github.com/repos/google/go-tpm/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/go-tpm/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/go-tpm/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/go-tpm/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/go-tpm/contents/{+path}","compare_url":"https://api.github.com/repos/google/go-tpm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/go-tpm/merges","archive_url":"https://api.github.com/repos/google/go-tpm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/go-tpm/downloads","issues_url":"https://api.github.com/repos/google/go-tpm/issues{/number}","pulls_url":"https://api.github.com/repos/google/go-tpm/pulls{/number}","milestones_url":"https://api.github.com/repos/google/go-tpm/milestones{/number}","notifications_url":"https://api.github.com/repos/google/go-tpm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/go-tpm/labels{/name}","releases_url":"https://api.github.com/repos/google/go-tpm/releases{/id}","deployments_url":"https://api.github.com/repos/google/go-tpm/deployments","created_at":"2014-08-13T19:53:34Z","updated_at":"2018-02-09T17:35:52Z","pushed_at":"2018-02-13T23:38:17Z","git_url":"git://github.com/google/go-tpm.git","ssh_url":"git@github.com:google/go-tpm.git","clone_url":"https://github.com/google/go-tpm.git","svn_url":"https://github.com/google/go-tpm","homepage":null,"size":92,"stargazers_count":73,"watchers_count":73,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":19,"open_issues":1,"watchers":73,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/go-tpm/pulls/5"},"html":{"href":"https://github.com/google/go-tpm/pull/5"},"issue":{"href":"https://api.github.com/repos/google/go-tpm/issues/5"},"comments":{"href":"https://api.github.com/repos/google/go-tpm/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/google/go-tpm/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/google/go-tpm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/go-tpm/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/google/go-tpm/statuses/0ac19e09eb57c0c8b35e40fce56eeb2c726985d1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tmroeder"}}