)]}'
{
  "commit": "1df70cea5daa391e10f5df9057c60fd740b912ab",
  "tree": "4f0209cd30cec3b169d4f477e2067b78b7c27391",
  "parents": [
    "2c12ebdf3a97a03b8bab7f4cd3b841926227310f"
  ],
  "author": {
    "name": "David Benjamin",
    "email": "davidben@google.com",
    "time": "Sun Dec 04 23:48:42 2022 -0500"
  },
  "committer": {
    "name": "Boringssl LUCI CQ",
    "email": "boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Wed Feb 01 17:44:52 2023 +0000"
  },
  "message": "Correctly handle optional ASN1_ITEM_TEMPLATE types.\n\nI didn\u0027t quite handle this case correctly in\nhttps://boringssl-review.googlesource.com/c/boringssl/+/49350, which\nmade it impossible to express an OPTIONAL, doubly-tagged type in\ncrypto/asn1.\n\nFor some background, an ASN1_ITEM is a top-level type, while an\nASN1_TEMPLATE is roughly a field in a SEQUENCE or SET. In ASN.1, types\ncannot be OPTIONAL or DEFAULT, only fields, so something like\nASN1_TFLG_OPTIONAL is a flag an ASN1_TEMPLATE.\n\nHowever, there are many other type-level features that are applied as\nASN1_TEMPLATE flags. SEQUENCE OF T and SET OF T are represented as an\nASN1_TEMPLATE with the ASN1_TFLG_SEQUENCE_OF or ASN1_TFLG_SET_OF flag\nand an item of T. Tagging is also a feature of ASN1_TEMPLATE.\n\nBut some top-level ASN.1 types may be SEQUENCE OF T or be tagged. So one\nof the types of ASN1_ITEM is ASN1_ITEM_TEMPLATE, which is an ASN1_ITEM\nthat wraps an ASN1_TEMPLATE (which, in turn, wraps an ASN1_ITEM...).\nSuch an ASN1_ITEM could then be placed in a SEQUENCE or SET, where it is\nOPTIONAL.\n\nWe didn\u0027t correctly handle this case and instead lost the optional bit.\nFix this and add a test. This is a little interesting because it means\nasn1_template_ex_i2d may get an optional bit from the caller, or it may\nget one from the template itself. (But it will never get both. An\nASN1_ITEM_TEMPLATE cannot wrap an optional template because types are\nnot optional.)\n\nThis case doesn\u0027t actually come up, given it doesn\u0027t work today. But in\nmy pending rewrite of tasn_enc.c, it made more sense to just make it\nwork, so this CL fixes it and adds a test ahead of time.\n\nBug: 548\nChange-Id: I0cf8c25386ddff992bafae029a5a60d026f124d0\nReviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56185\nCommit-Queue: Bob Beck \u003cbbe@google.com\u003e\nReviewed-by: Bob Beck \u003cbbe@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "99d7d3092cbf226b6b86460e90da4590e50f5cc8",
      "old_mode": 33188,
      "old_path": "crypto/asn1/asn1_test.cc",
      "new_id": "59e80d2cb7fa3856967e6744deeca6719b946b76",
      "new_mode": 33188,
      "new_path": "crypto/asn1/asn1_test.cc"
    },
    {
      "type": "modify",
      "old_id": "afac17d67884b4c40460c620468dba86f8765f11",
      "old_mode": 33188,
      "old_path": "crypto/asn1/tasn_enc.c",
      "new_id": "0a0fdb09b6fa62c3993491a195fb6266d4608042",
      "new_mode": 33188,
      "new_path": "crypto/asn1/tasn_enc.c"
    }
  ]
}
