{"action":"created","comment":{"url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/comments/234051917","pull_request_review_id":175611216,"id":234051917,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNDA1MTkxNw==","diff_hunk":"@@ -0,0 +1,189 @@\n+//**********************************************************************;\n+// Copyright (c) 2018, Intel Corporation\n+// All rights reserved.\n+//\n+// Redistribution and use in source and binary forms, with or without\n+// modification, are permitted provided that the following conditions are met:\n+//\n+// 1. Redistributions of source code must retain the above copyright notice,\n+// this list of conditions and the following disclaimer.\n+//\n+// 2. Redistributions in binary form must reproduce the above copyright notice,\n+// this list of conditions and the following disclaimer in the documentation\n+// and/or other materials provided with the distribution.\n+//\n+// 3. Neither the name of Intel Corporation nor the names of its contributors\n+// may be used to endorse or promote products derived from this software without\n+// specific prior written permission.\n+//\n+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n+// THE POSSIBILITY OF SUCH DAMAGE.\n+//**********************************************************************;\n+#include <string.h>\n+#include <tss2/tss2_sys.h>\n+\n+#include \"files.h\"\n+#include \"log.h\"\n+#include \"tpm2_options.h\"\n+#include \"tpm2_policy.h\"\n+#include \"tpm2_session.h\"\n+#include \"tpm2_tool.h\"\n+#include \"tpm2_util.h\"\n+\n+typedef struct tpm2_policysecret_ctx tpm2_policysecret_ctx;\n+struct tpm2_policysecret_ctx {\n+    //File path for the session context data\n+    const char *session_path;\n+    //File path for storing the policy digest output\n+    const char *out_policy_dgst_path;\n+    //Specifying the TPM object handle-id or the file path of context blob\n+    const char *context_arg;\n+    tpm2_loaded_object context_object;\n+    //Auth value of the auth object\n+    char *auth_str;\n+    //Auth value length\n+    UINT16 auth_str_size;\n+    struct {\n+        UINT8 c : 1;\n+        UINT8 p : 1;\n+    } flags;\n+    TPMS_AUTH_COMMAND session_data;\n+};\n+\n+static tpm2_policysecret_ctx ctx = {\n+    .session_data = TPMS_AUTH_COMMAND_INIT(TPM2_RS_PW),\n+    .auth_str_size = UINT16_MAX,\n+    .auth_str = NULL,\n+};\n+\n+static bool on_option(char key, char *value) {\n+\n+    bool result = true;\n+\n+    switch (key) {\n+    case 'o':\n+        ctx.out_policy_dgst_path = value;\n+        break;\n+    case 'S':\n+        ctx.session_path = value;\n+        break;\n+    case 'c':\n+        ctx.context_arg = value;\n+        ctx.flags.c = 1;\n+        break;\n+    case 'p':","path":"tools/tpm2_policysecret.c","position":84,"original_position":83,"commit_id":"af56ae9b6bdb60b5396470e321d3aab3a1635e88","original_commit_id":"b9881f0e090ff30f70253892010fd22cd43ad700","user":{"login":"williamcroberts","id":17750791,"node_id":"MDQ6VXNlcjE3NzUwNzkx","avatar_url":"https://avatars0.githubusercontent.com/u/17750791?v=4","gravatar_id":"","url":"https://api.github.com/users/williamcroberts","html_url":"https://github.com/williamcroberts","followers_url":"https://api.github.com/users/williamcroberts/followers","following_url":"https://api.github.com/users/williamcroberts/following{/other_user}","gists_url":"https://api.github.com/users/williamcroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/williamcroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williamcroberts/subscriptions","organizations_url":"https://api.github.com/users/williamcroberts/orgs","repos_url":"https://api.github.com/users/williamcroberts/repos","events_url":"https://api.github.com/users/williamcroberts/events{/privacy}","received_events_url":"https://api.github.com/users/williamcroberts/received_events","type":"User","site_admin":false},"body":"Still need to handle","created_at":"2018-11-16T00:00:56Z","updated_at":"2018-11-16T00:01:05Z","html_url":"https://github.com/tpm2-software/tpm2-tools/pull/1215#discussion_r234051917","pull_request_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/comments/234051917"},"html":{"href":"https://github.com/tpm2-software/tpm2-tools/pull/1215#discussion_r234051917"},"pull_request":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215"}},"in_reply_to_id":232747012},"pull_request":{"url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215","id":225185380,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1MTg1Mzgw","html_url":"https://github.com/tpm2-software/tpm2-tools/pull/1215","diff_url":"https://github.com/tpm2-software/tpm2-tools/pull/1215.diff","patch_url":"https://github.com/tpm2-software/tpm2-tools/pull/1215.patch","issue_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues/1215","number":1215,"state":"open","locked":false,"title":"tpm2_policysecret: New tool to enable object secret based authentication to policies","user":{"login":"idesai","id":16821900,"node_id":"MDQ6VXNlcjE2ODIxOTAw","avatar_url":"https://avatars3.githubusercontent.com/u/16821900?v=4","gravatar_id":"","url":"https://api.github.com/users/idesai","html_url":"https://github.com/idesai","followers_url":"https://api.github.com/users/idesai/followers","following_url":"https://api.github.com/users/idesai/following{/other_user}","gists_url":"https://api.github.com/users/idesai/gists{/gist_id}","starred_url":"https://api.github.com/users/idesai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idesai/subscriptions","organizations_url":"https://api.github.com/users/idesai/orgs","repos_url":"https://api.github.com/users/idesai/repos","events_url":"https://api.github.com/users/idesai/events{/privacy}","received_events_url":"https://api.github.com/users/idesai/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-23T21:00:13Z","updated_at":"2018-11-16T00:01:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3561def64535a2346dfda5840e8b717080990225","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215/commits","review_comments_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215/comments","review_comment_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues/1215/comments","statuses_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/statuses/af56ae9b6bdb60b5396470e321d3aab3a1635e88","head":{"label":"idesai:tpm2_policysecret","ref":"tpm2_policysecret","sha":"af56ae9b6bdb60b5396470e321d3aab3a1635e88","user":{"login":"idesai","id":16821900,"node_id":"MDQ6VXNlcjE2ODIxOTAw","avatar_url":"https://avatars3.githubusercontent.com/u/16821900?v=4","gravatar_id":"","url":"https://api.github.com/users/idesai","html_url":"https://github.com/idesai","followers_url":"https://api.github.com/users/idesai/followers","following_url":"https://api.github.com/users/idesai/following{/other_user}","gists_url":"https://api.github.com/users/idesai/gists{/gist_id}","starred_url":"https://api.github.com/users/idesai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idesai/subscriptions","organizations_url":"https://api.github.com/users/idesai/orgs","repos_url":"https://api.github.com/users/idesai/repos","events_url":"https://api.github.com/users/idesai/events{/privacy}","received_events_url":"https://api.github.com/users/idesai/received_events","type":"User","site_admin":false},"repo":{"id":50965081,"node_id":"MDEwOlJlcG9zaXRvcnk1MDk2NTA4MQ==","name":"tpm2.0-tools","full_name":"idesai/tpm2.0-tools","private":false,"owner":{"login":"idesai","id":16821900,"node_id":"MDQ6VXNlcjE2ODIxOTAw","avatar_url":"https://avatars3.githubusercontent.com/u/16821900?v=4","gravatar_id":"","url":"https://api.github.com/users/idesai","html_url":"https://github.com/idesai","followers_url":"https://api.github.com/users/idesai/followers","following_url":"https://api.github.com/users/idesai/following{/other_user}","gists_url":"https://api.github.com/users/idesai/gists{/gist_id}","starred_url":"https://api.github.com/users/idesai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idesai/subscriptions","organizations_url":"https://api.github.com/users/idesai/orgs","repos_url":"https://api.github.com/users/idesai/repos","events_url":"https://api.github.com/users/idesai/events{/privacy}","received_events_url":"https://api.github.com/users/idesai/received_events","type":"User","site_admin":false},"html_url":"https://github.com/idesai/tpm2.0-tools","description":null,"fork":true,"url":"https://api.github.com/repos/idesai/tpm2.0-tools","forks_url":"https://api.github.com/repos/idesai/tpm2.0-tools/forks","keys_url":"https://api.github.com/repos/idesai/tpm2.0-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idesai/tpm2.0-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idesai/tpm2.0-tools/teams","hooks_url":"https://api.github.com/repos/idesai/tpm2.0-tools/hooks","issue_events_url":"https://api.github.com/repos/idesai/tpm2.0-tools/issues/events{/number}","events_url":"https://api.github.com/repos/idesai/tpm2.0-tools/events","assignees_url":"https://api.github.com/repos/idesai/tpm2.0-tools/assignees{/user}","branches_url":"https://api.github.com/repos/idesai/tpm2.0-tools/branches{/branch}","tags_url":"https://api.github.com/repos/idesai/tpm2.0-tools/tags","blobs_url":"https://api.github.com/repos/idesai/tpm2.0-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idesai/tpm2.0-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idesai/tpm2.0-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/idesai/tpm2.0-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idesai/tpm2.0-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/idesai/tpm2.0-tools/languages","stargazers_url":"https://api.github.com/repos/idesai/tpm2.0-tools/stargazers","contributors_url":"https://api.github.com/repos/idesai/tpm2.0-tools/contributors","subscribers_url":"https://api.github.com/repos/idesai/tpm2.0-tools/subscribers","subscription_url":"https://api.github.com/repos/idesai/tpm2.0-tools/subscription","commits_url":"https://api.github.com/repos/idesai/tpm2.0-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/idesai/tpm2.0-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/idesai/tpm2.0-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/idesai/tpm2.0-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/idesai/tpm2.0-tools/contents/{+path}","compare_url":"https://api.github.com/repos/idesai/tpm2.0-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idesai/tpm2.0-tools/merges","archive_url":"https://api.github.com/repos/idesai/tpm2.0-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idesai/tpm2.0-tools/downloads","issues_url":"https://api.github.com/repos/idesai/tpm2.0-tools/issues{/number}","pulls_url":"https://api.github.com/repos/idesai/tpm2.0-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/idesai/tpm2.0-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/idesai/tpm2.0-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idesai/tpm2.0-tools/labels{/name}","releases_url":"https://api.github.com/repos/idesai/tpm2.0-tools/releases{/id}","deployments_url":"https://api.github.com/repos/idesai/tpm2.0-tools/deployments","created_at":"2016-02-03T01:32:08Z","updated_at":"2018-11-05T23:48:10Z","pushed_at":"2018-11-15T23:59:19Z","git_url":"git://github.com/idesai/tpm2.0-tools.git","ssh_url":"git@github.com:idesai/tpm2.0-tools.git","clone_url":"https://github.com/idesai/tpm2.0-tools.git","svn_url":"https://github.com/idesai/tpm2.0-tools","homepage":null,"size":4828,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tpm2-software:master","ref":"master","sha":"5d5704181f6b23f1e5a3acb461501768a7a5c20a","user":{"login":"tpm2-software","id":34488697,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDg4Njk3","avatar_url":"https://avatars3.githubusercontent.com/u/34488697?v=4","gravatar_id":"","url":"https://api.github.com/users/tpm2-software","html_url":"https://github.com/tpm2-software","followers_url":"https://api.github.com/users/tpm2-software/followers","following_url":"https://api.github.com/users/tpm2-software/following{/other_user}","gists_url":"https://api.github.com/users/tpm2-software/gists{/gist_id}","starred_url":"https://api.github.com/users/tpm2-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpm2-software/subscriptions","organizations_url":"https://api.github.com/users/tpm2-software/orgs","repos_url":"https://api.github.com/users/tpm2-software/repos","events_url":"https://api.github.com/users/tpm2-software/events{/privacy}","received_events_url":"https://api.github.com/users/tpm2-software/received_events","type":"Organization","site_admin":false},"repo":{"id":41126332,"node_id":"MDEwOlJlcG9zaXRvcnk0MTEyNjMzMg==","name":"tpm2-tools","full_name":"tpm2-software/tpm2-tools","private":false,"owner":{"login":"tpm2-software","id":34488697,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDg4Njk3","avatar_url":"https://avatars3.githubusercontent.com/u/34488697?v=4","gravatar_id":"","url":"https://api.github.com/users/tpm2-software","html_url":"https://github.com/tpm2-software","followers_url":"https://api.github.com/users/tpm2-software/followers","following_url":"https://api.github.com/users/tpm2-software/following{/other_user}","gists_url":"https://api.github.com/users/tpm2-software/gists{/gist_id}","starred_url":"https://api.github.com/users/tpm2-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpm2-software/subscriptions","organizations_url":"https://api.github.com/users/tpm2-software/orgs","repos_url":"https://api.github.com/users/tpm2-software/repos","events_url":"https://api.github.com/users/tpm2-software/events{/privacy}","received_events_url":"https://api.github.com/users/tpm2-software/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tpm2-software/tpm2-tools","description":"The source repository for the TPM (Trusted Platform Module) 2 tools","fork":false,"url":"https://api.github.com/repos/tpm2-software/tpm2-tools","forks_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/forks","keys_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/teams","hooks_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/hooks","issue_events_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues/events{/number}","events_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/events","assignees_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/assignees{/user}","branches_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/branches{/branch}","tags_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/tags","blobs_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/languages","stargazers_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/stargazers","contributors_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/contributors","subscribers_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/subscribers","subscription_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/subscription","commits_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/contents/{+path}","compare_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/merges","archive_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/downloads","issues_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues{/number}","pulls_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/labels{/name}","releases_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/releases{/id}","deployments_url":"https://api.github.com/repos/tpm2-software/tpm2-tools/deployments","created_at":"2015-08-21T01:07:28Z","updated_at":"2018-11-15T23:55:19Z","pushed_at":"2018-11-15T23:59:21Z","git_url":"git://github.com/tpm2-software/tpm2-tools.git","ssh_url":"git@github.com:tpm2-software/tpm2-tools.git","clone_url":"https://github.com/tpm2-software/tpm2-tools.git","svn_url":"https://github.com/tpm2-software/tpm2-tools","homepage":"","size":4916,"stargazers_count":150,"watchers_count":150,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":110,"mirror_url":null,"archived":false,"open_issues_count":109,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":110,"open_issues":109,"watchers":150,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215"},"html":{"href":"https://github.com/tpm2-software/tpm2-tools/pull/1215"},"issue":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues/1215"},"comments":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/issues/1215/comments"},"review_comments":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215/comments"},"review_comment":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/pulls/1215/commits"},"statuses":{"href":"https://api.github.com/repos/tpm2-software/tpm2-tools/statuses/af56ae9b6bdb60b5396470e321d3aab3a1635e88"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"williamcroberts"}}