{"action":"created","comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/comments/325614226","pull_request_review_id":289838579,"id":325614226,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyNTYxNDIyNg==","diff_hunk":"@@ -316,6 +316,58 @@ int mbedtls_asn1_get_sequence_of( unsigned char **p,\n                           mbedtls_asn1_sequence *cur,\n                           int tag);\n \n+/**\n+ * \\brief                Traverse an ASN.1 SEQUENCE container and\n+ *                       call a callback for each entry.\n+ *\n+ * \\warning              This function is still experimental and may change\n+ *                       at any time.\n+ *\n+ * \\param p              The address of the pointer to the beginning of\n+ *                       the ASN.1 SEQUENCE header. This is updated to\n+ *                       point to the end of the ASN.1 SEQUENCE container\n+ *                       on a successful invocation.\n+ * \\param end            The end of the ASN.1 SEQUENCE container.\n+ * \\param tag_must_mask  A mask to be applied to the ASN.1 tags found within\n+ *                       the SEQUENCE before comparing to \\p tag_must_value.\n+ * \\param tag_must_val   The required value of each ASN.1 tag found in the\n+ *                       SEQUENCE, after masking with \\p tag_must_mask.\n+ *                       Mismatching tags lead to an error.\n+ *                       For example, a value of \\c 0 for both \\p tag_must_mask\n+ *                       and \\p tag_must_val means that every tag is allowed,\n+ *                       while a value of \\c 0xFF for \\p tag_must_mask means\n+ *                       that \\p tag_must_val is the only allowed tag.\n+ * \\param tag_may_mask   A mask to be applied to the ASN.1 tags found within\n+ *                       the SEQUENCE before comparing to \\p tag_may_value.\n+ * \\param tag_may_val    The desired value of each ASN.1 tag found in the\n+ *                       SEQUENCE, after masking with \\p tag_may_mask.\n+ *                       Mismatching tags will be silently ignored.\n+ *                       For example, a value of \\c 0 for \\p tag_may_mask and\n+ *                       \\p tag_may_val means that any tag will be considered,\n+ *                       while a value of \\c 0xFF for \\p tag_may_mask means\n+ *                       that all tags with value different from \\p tag_may_val\n+ *                       will be ignored.\n+ * \\param cb             The callback to trigger for each component\n+ *                       in the ASN.1 SEQUENCE. If the callback returns\n+ *                       a non-zero value, the function stops immediately,\n+ *                       forwarding the callback's return value.\n+ * \\param ctx            The context to be passed to the callback \\p cb.\n+ *\n+ * \\return               \\c 0 if successful the entire ASN.1 SEQUENCE\n+ *                       was traversed without parsing or callback errors.\n+ * \\return               A negative ASN.1 error code on a parsing failure.\n+ * \\return               A non-zero error code forwarded from the callback\n+ *                       \\p cb in case the latter returns a non-zero value.\n+ */\n+int mbedtls_asn1_traverse_sequence_of(\n+    unsigned char **p,\n+    const unsigned char *end,\n+    uint8_t tag_must_mask, uint8_t tag_must_val,\n+    uint8_t tag_may_mask, uint8_t tag_may_val,\n+    int (*cb)( void *ctx, int tag,\n+               unsigned char* start, size_t len ),","path":"include/mbedtls/asn1.h","position":128,"original_position":53,"commit_id":"5d972e726465a7088da97af768733589a2b59bdc","original_commit_id":"3c25dddb569b2b76529fb4415395e96c8a161ca9","user":{"login":"Patater","id":410816,"node_id":"MDQ6VXNlcjQxMDgxNg==","avatar_url":"https://avatars0.githubusercontent.com/u/410816?v=4","gravatar_id":"","url":"https://api.github.com/users/Patater","html_url":"https://github.com/Patater","followers_url":"https://api.github.com/users/Patater/followers","following_url":"https://api.github.com/users/Patater/following{/other_user}","gists_url":"https://api.github.com/users/Patater/gists{/gist_id}","starred_url":"https://api.github.com/users/Patater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Patater/subscriptions","organizations_url":"https://api.github.com/users/Patater/orgs","repos_url":"https://api.github.com/users/Patater/repos","events_url":"https://api.github.com/users/Patater/events{/privacy}","received_events_url":"https://api.github.com/users/Patater/received_events","type":"User","site_admin":false},"body":"Can `start` be made const?","created_at":"2019-09-18T11:10:21Z","updated_at":"2019-09-18T11:13:41Z","html_url":"https://github.com/ARMmbed/mbed-crypto/pull/263#discussion_r325614226","pull_request_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/comments/325614226"},"html":{"href":"https://github.com/ARMmbed/mbed-crypto/pull/263#discussion_r325614226"},"pull_request":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263"}}},"pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263","id":318311907,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE4MzExOTA3","html_url":"https://github.com/ARMmbed/mbed-crypto/pull/263","diff_url":"https://github.com/ARMmbed/mbed-crypto/pull/263.diff","patch_url":"https://github.com/ARMmbed/mbed-crypto/pull/263.patch","issue_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues/263","number":263,"state":"open","locked":false,"title":"Introduce ASN.1 SEQUENCE traversal API","user":{"login":"hanno-arm","id":26892988,"node_id":"MDQ6VXNlcjI2ODkyOTg4","avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"body":"__Summary:__ This PR is a spin-out from the X.509 on demand parsing work https://github.com/ARMmbed/mbedtls/pull/2478, one of the main drivers of which is to avoid dynamically allocated presentations of ASN.1 SEQUENCEs by traversing the raw ASN.1 in-place whenever needed. To this end, this PR introduces the ASN.1 API `mbedtls_asn1_traverse_sequence_of()` which can be used to traverse an ASN.1 SEQUENCE container, triggering a user-specified callback for each entry found. \r\nThe PR also introduces two helper macros `MBEDTLS_ASN1_IS_STRING_TAG` and `MBEDTLS_OID_CMP_RAW`. Those are technically unrelated to the SEQUENCE traversal API and are included here solely to keep the number of dependencies for the on demand parsing PR low.","created_at":"2019-09-17T12:23:04Z","updated_at":"2019-09-18T11:13:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f560058da756d8ddc2a826f410165e5f101b7d6","assignee":null,"assignees":[],"requested_reviewers":[{"login":"yanesca","id":6871045,"node_id":"MDQ6VXNlcjY4NzEwNDU=","avatar_url":"https://avatars1.githubusercontent.com/u/6871045?v=4","gravatar_id":"","url":"https://api.github.com/users/yanesca","html_url":"https://github.com/yanesca","followers_url":"https://api.github.com/users/yanesca/followers","following_url":"https://api.github.com/users/yanesca/following{/other_user}","gists_url":"https://api.github.com/users/yanesca/gists{/gist_id}","starred_url":"https://api.github.com/users/yanesca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanesca/subscriptions","organizations_url":"https://api.github.com/users/yanesca/orgs","repos_url":"https://api.github.com/users/yanesca/repos","events_url":"https://api.github.com/users/yanesca/events{/privacy}","received_events_url":"https://api.github.com/users/yanesca/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1165346170,"node_id":"MDU6TGFiZWwxMTY1MzQ2MTcw","url":"https://api.github.com/repos/ARMmbed/mbed-crypto/labels/needs:%20review","name":"needs: review","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263/commits","review_comments_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263/comments","review_comment_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues/263/comments","statuses_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/statuses/5d972e726465a7088da97af768733589a2b59bdc","head":{"label":"hanno-arm:asn1_traversal_api","ref":"asn1_traversal_api","sha":"5d972e726465a7088da97af768733589a2b59bdc","user":{"login":"hanno-arm","id":26892988,"node_id":"MDQ6VXNlcjI2ODkyOTg4","avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"repo":{"id":167566717,"node_id":"MDEwOlJlcG9zaXRvcnkxNjc1NjY3MTc=","name":"mbed-crypto","full_name":"hanno-arm/mbed-crypto","private":false,"owner":{"login":"hanno-arm","id":26892988,"node_id":"MDQ6VXNlcjI2ODkyOTg4","avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"html_url":"https://github.com/hanno-arm/mbed-crypto","description":"Mbed Crypto is a reference implementation of the Arm PSA Crypto API","fork":true,"url":"https://api.github.com/repos/hanno-arm/mbed-crypto","forks_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/forks","keys_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/teams","hooks_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/hooks","issue_events_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/issues/events{/number}","events_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/events","assignees_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/assignees{/user}","branches_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/branches{/branch}","tags_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/tags","blobs_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/git/refs{/sha}","trees_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/statuses/{sha}","languages_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/languages","stargazers_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/stargazers","contributors_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/contributors","subscribers_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/subscribers","subscription_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/subscription","commits_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/commits{/sha}","git_commits_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/git/commits{/sha}","comments_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/comments{/number}","issue_comment_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/issues/comments{/number}","contents_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/contents/{+path}","compare_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/merges","archive_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/downloads","issues_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/issues{/number}","pulls_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/pulls{/number}","milestones_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/milestones{/number}","notifications_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/labels{/name}","releases_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/releases{/id}","deployments_url":"https://api.github.com/repos/hanno-arm/mbed-crypto/deployments","created_at":"2019-01-25T15:14:30Z","updated_at":"2019-01-25T15:14:35Z","pushed_at":"2019-09-18T08:16:40Z","git_url":"git://github.com/hanno-arm/mbed-crypto.git","ssh_url":"git@github.com:hanno-arm/mbed-crypto.git","clone_url":"https://github.com/hanno-arm/mbed-crypto.git","svn_url":"https://github.com/hanno-arm/mbed-crypto","homepage":"","size":19765,"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,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"ARMmbed:development","ref":"development","sha":"3f20efc03016b38f2677dadd476b21229c627c80","user":{"login":"ARMmbed","id":8916057,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg5MTYwNTc=","avatar_url":"https://avatars3.githubusercontent.com/u/8916057?v=4","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"repo":{"id":138151558,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgxNTE1NTg=","name":"mbed-crypto","full_name":"ARMmbed/mbed-crypto","private":false,"owner":{"login":"ARMmbed","id":8916057,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg5MTYwNTc=","avatar_url":"https://avatars3.githubusercontent.com/u/8916057?v=4","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ARMmbed/mbed-crypto","description":"Mbed Crypto is a reference implementation of the Arm PSA Crypto API","fork":false,"url":"https://api.github.com/repos/ARMmbed/mbed-crypto","forks_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/forks","keys_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/teams","hooks_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/hooks","issue_events_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues/events{/number}","events_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/events","assignees_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/assignees{/user}","branches_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/branches{/branch}","tags_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/tags","blobs_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/statuses/{sha}","languages_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/languages","stargazers_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/stargazers","contributors_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/contributors","subscribers_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/subscribers","subscription_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/subscription","commits_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/contents/{+path}","compare_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/merges","archive_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/downloads","issues_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues{/number}","pulls_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls{/number}","milestones_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/milestones{/number}","notifications_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/labels{/name}","releases_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/releases{/id}","deployments_url":"https://api.github.com/repos/ARMmbed/mbed-crypto/deployments","created_at":"2018-06-21T09:48:28Z","updated_at":"2019-09-18T09:49:26Z","pushed_at":"2019-09-18T10:14:38Z","git_url":"git://github.com/ARMmbed/mbed-crypto.git","ssh_url":"git@github.com:ARMmbed/mbed-crypto.git","clone_url":"https://github.com/ARMmbed/mbed-crypto.git","svn_url":"https://github.com/ARMmbed/mbed-crypto","homepage":"","size":22341,"stargazers_count":51,"watchers_count":51,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":39,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":71,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":39,"open_issues":71,"watchers":51,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263"},"html":{"href":"https://github.com/ARMmbed/mbed-crypto/pull/263"},"issue":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues/263"},"comments":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/issues/263/comments"},"review_comments":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263/comments"},"review_comment":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/pulls/263/commits"},"statuses":{"href":"https://api.github.com/repos/ARMmbed/mbed-crypto/statuses/5d972e726465a7088da97af768733589a2b59bdc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Patater"}}