asn1_bit_string_length:
   34|   146k|                           uint8_t *out_padding_bits) {
   35|   146k|  int len = str->length;
   36|   146k|  if (str->flags & ASN1_STRING_FLAG_BITS_LEFT) {
  ------------------
  |  |  497|   146k|#define ASN1_STRING_FLAG_BITS_LEFT 0x08
  ------------------
  |  Branch (36:7): [True: 146k, False: 0]
  ------------------
   37|       |    // If the string is already empty, it cannot have padding bits.
   38|   146k|    *out_padding_bits = len == 0 ? 0 : str->flags & 0x07;
  ------------------
  |  Branch (38:25): [True: 0, False: 146k]
  ------------------
   39|   146k|    return len;
   40|   146k|  }
   41|       |
   42|       |  // TODO(https://crbug.com/boringssl/447): If we move this logic to
   43|       |  // |ASN1_BIT_STRING_set_bit|, can we remove this representation?
   44|      0|  while (len > 0 && str->data[len - 1] == 0) {
  ------------------
  |  Branch (44:10): [True: 0, False: 0]
  |  Branch (44:21): [True: 0, False: 0]
  ------------------
   45|      0|    len--;
   46|      0|  }
   47|      0|  uint8_t padding_bits = 0;
   48|      0|  if (len > 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  ------------------
   49|      0|    uint8_t last = str->data[len - 1];
   50|      0|    assert(last != 0);
   51|      0|    for (; padding_bits < 7; padding_bits++) {
  ------------------
  |  Branch (51:12): [True: 0, False: 0]
  ------------------
   52|      0|      if (last & (1 << padding_bits)) {
  ------------------
  |  Branch (52:11): [True: 0, False: 0]
  ------------------
   53|      0|        break;
   54|      0|      }
   55|      0|    }
   56|      0|  }
   57|      0|  *out_padding_bits = padding_bits;
   58|      0|  return len;
   59|      0|}
i2c_ASN1_BIT_STRING:
   71|   146k|int i2c_ASN1_BIT_STRING(const ASN1_BIT_STRING *a, unsigned char **pp) {
   72|   146k|  if (a == NULL) {
  ------------------
  |  Branch (72:7): [True: 0, False: 146k]
  ------------------
   73|      0|    return 0;
   74|      0|  }
   75|       |
   76|   146k|  uint8_t bits;
   77|   146k|  int len = asn1_bit_string_length(a, &bits);
   78|   146k|  if (len > INT_MAX - 1) {
  ------------------
  |  Branch (78:7): [True: 0, False: 146k]
  ------------------
   79|      0|    OPENSSL_PUT_ERROR(ASN1, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   80|      0|    return 0;
   81|      0|  }
   82|   146k|  int ret = 1 + len;
   83|   146k|  if (pp == NULL) {
  ------------------
  |  Branch (83:7): [True: 101k, False: 45.2k]
  ------------------
   84|   101k|    return ret;
   85|   101k|  }
   86|       |
   87|  45.2k|  uint8_t *p = *pp;
   88|  45.2k|  *(p++) = bits;
   89|  45.2k|  OPENSSL_memcpy(p, a->data, len);
   90|  45.2k|  if (len > 0) {
  ------------------
  |  Branch (90:7): [True: 45.2k, False: 0]
  ------------------
   91|  45.2k|    p[len - 1] &= (0xff << bits);
   92|  45.2k|  }
   93|  45.2k|  p += len;
   94|  45.2k|  *pp = p;
   95|  45.2k|  return ret;
   96|   146k|}
asn1_marshal_bit_string:
   99|  17.1k|                            CBS_ASN1_TAG tag) {
  100|  17.1k|  int len = i2c_ASN1_BIT_STRING(in, nullptr);
  101|  17.1k|  if (len <= 0) {
  ------------------
  |  Branch (101:7): [True: 0, False: 17.1k]
  ------------------
  102|      0|    return 0;
  103|      0|  }
  104|  17.1k|  tag = tag == 0 ? CBS_ASN1_BITSTRING : tag;
  ------------------
  |  |  217|  17.1k|#define CBS_ASN1_BITSTRING 0x3u
  ------------------
  |  Branch (104:9): [True: 17.1k, False: 0]
  ------------------
  105|  17.1k|  CBB child;
  106|  17.1k|  uint8_t *ptr;
  107|  17.1k|  return CBB_add_asn1(out, &child, tag) &&                         //
  ------------------
  |  Branch (107:10): [True: 17.1k, False: 0]
  ------------------
  108|  17.1k|         CBB_add_space(&child, &ptr, static_cast<size_t>(len)) &&  //
  ------------------
  |  Branch (108:10): [True: 17.1k, False: 0]
  ------------------
  109|  17.1k|         i2c_ASN1_BIT_STRING(in, &ptr) == len &&                   //
  ------------------
  |  Branch (109:10): [True: 17.1k, False: 0]
  ------------------
  110|  17.1k|         CBB_flush(out);
  ------------------
  |  Branch (110:10): [True: 17.1k, False: 0]
  ------------------
  111|  17.1k|}
c2i_ASN1_BIT_STRING:
  114|  56.2k|                                     const unsigned char **pp, long len) {
  115|  56.2k|  ASN1_BIT_STRING *ret = NULL;
  116|  56.2k|  const unsigned char *p;
  117|  56.2k|  unsigned char *s;
  118|  56.2k|  int padding;
  119|  56.2k|  uint8_t padding_mask;
  120|       |
  121|  56.2k|  if (len < 1) {
  ------------------
  |  Branch (121:7): [True: 0, False: 56.2k]
  ------------------
  122|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_SHORT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  123|      0|    goto err;
  124|      0|  }
  125|       |
  126|  56.2k|  if (len > INT_MAX) {
  ------------------
  |  Branch (126:7): [True: 0, False: 56.2k]
  ------------------
  127|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  128|      0|    goto err;
  129|      0|  }
  130|       |
  131|  56.2k|  if ((a == NULL) || ((*a) == NULL)) {
  ------------------
  |  Branch (131:7): [True: 28.1k, False: 28.1k]
  |  Branch (131:22): [True: 0, False: 28.1k]
  ------------------
  132|  28.1k|    if ((ret = ASN1_BIT_STRING_new()) == NULL) {
  ------------------
  |  Branch (132:9): [True: 0, False: 28.1k]
  ------------------
  133|      0|      return NULL;
  134|      0|    }
  135|  28.1k|  } else {
  136|  28.1k|    ret = (*a);
  137|  28.1k|  }
  138|       |
  139|  56.2k|  p = *pp;
  140|  56.2k|  padding = *(p++);
  141|  56.2k|  len--;
  142|  56.2k|  if (padding > 7) {
  ------------------
  |  Branch (142:7): [True: 0, False: 56.2k]
  ------------------
  143|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  144|      0|    goto err;
  145|      0|  }
  146|       |
  147|       |  // Unused bits in a BIT STRING must be zero.
  148|  56.2k|  padding_mask = (1 << padding) - 1;
  149|  56.2k|  if (padding != 0 && (len < 1 || (p[len - 1] & padding_mask) != 0)) {
  ------------------
  |  Branch (149:7): [True: 0, False: 56.2k]
  |  Branch (149:24): [True: 0, False: 0]
  |  Branch (149:35): [True: 0, False: 0]
  ------------------
  150|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_BIT_STRING_PADDING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  151|      0|    goto err;
  152|      0|  }
  153|       |
  154|       |  // We do this to preserve the settings.  If we modify the settings, via
  155|       |  // the _set_bit function, we will recalculate on output
  156|  56.2k|  ret->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);    // clear
  ------------------
  |  |  497|  56.2k|#define ASN1_STRING_FLAG_BITS_LEFT 0x08
  ------------------
  157|  56.2k|  ret->flags |= (ASN1_STRING_FLAG_BITS_LEFT | padding);  // set
  ------------------
  |  |  497|  56.2k|#define ASN1_STRING_FLAG_BITS_LEFT 0x08
  ------------------
  158|       |
  159|  56.2k|  if (len > 0) {
  ------------------
  |  Branch (159:7): [True: 56.2k, False: 0]
  ------------------
  160|  56.2k|    s = reinterpret_cast<uint8_t *>(OPENSSL_memdup(p, len));
  161|  56.2k|    if (s == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 56.2k]
  ------------------
  162|      0|      goto err;
  163|      0|    }
  164|  56.2k|    p += len;
  165|  56.2k|  } else {
  166|      0|    s = NULL;
  167|      0|  }
  168|       |
  169|  56.2k|  ret->length = (int)len;
  170|  56.2k|  OPENSSL_free(ret->data);
  171|  56.2k|  ret->data = s;
  172|  56.2k|  ret->type = V_ASN1_BIT_STRING;
  ------------------
  |  |   88|  56.2k|#define V_ASN1_BIT_STRING 3
  ------------------
  173|  56.2k|  if (a != NULL) {
  ------------------
  |  Branch (173:7): [True: 28.1k, False: 28.1k]
  ------------------
  174|  28.1k|    (*a) = ret;
  175|  28.1k|  }
  176|  56.2k|  *pp = p;
  177|  56.2k|  return ret;
  178|      0|err:
  179|      0|  if ((ret != NULL) && ((a == NULL) || (*a != ret))) {
  ------------------
  |  Branch (179:7): [True: 0, False: 0]
  |  Branch (179:25): [True: 0, False: 0]
  |  Branch (179:40): [True: 0, False: 0]
  ------------------
  180|      0|    ASN1_BIT_STRING_free(ret);
  181|      0|  }
  182|      0|  return NULL;
  183|  56.2k|}

c2i_ASN1_INTEGER:
  150|  56.2k|                               long len) {
  151|       |  // This function can handle lengths up to INT_MAX - 1, but the rest of the
  152|       |  // legacy ASN.1 code mixes integer types, so avoid exposing it to
  153|       |  // ASN1_INTEGERS with larger lengths.
  154|  56.2k|  if (len < 0 || len > INT_MAX / 2) {
  ------------------
  |  Branch (154:7): [True: 0, False: 56.2k]
  |  Branch (154:18): [True: 0, False: 56.2k]
  ------------------
  155|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  156|      0|    return NULL;
  157|      0|  }
  158|       |
  159|  56.2k|  CBS cbs;
  160|  56.2k|  CBS_init(&cbs, *inp, (size_t)len);
  161|  56.2k|  int is_negative;
  162|  56.2k|  if (!CBS_is_valid_asn1_integer(&cbs, &is_negative)) {
  ------------------
  |  Branch (162:7): [True: 0, False: 56.2k]
  ------------------
  163|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_INTEGER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  164|      0|    return NULL;
  165|      0|  }
  166|       |
  167|  56.2k|  ASN1_INTEGER *ret = NULL;
  168|  56.2k|  if (out == NULL || *out == NULL) {
  ------------------
  |  Branch (168:7): [True: 0, False: 56.2k]
  |  Branch (168:22): [True: 28.1k, False: 28.1k]
  ------------------
  169|  28.1k|    ret = ASN1_INTEGER_new();
  170|  28.1k|    if (ret == NULL) {
  ------------------
  |  Branch (170:9): [True: 0, False: 28.1k]
  ------------------
  171|      0|      return NULL;
  172|      0|    }
  173|  28.1k|  } else {
  174|  28.1k|    ret = *out;
  175|  28.1k|  }
  176|       |
  177|       |  // Convert to |ASN1_INTEGER|'s sign-and-magnitude representation. First,
  178|       |  // determine the size needed for a minimal result.
  179|  56.2k|  if (is_negative) {
  ------------------
  |  Branch (179:7): [True: 0, False: 56.2k]
  ------------------
  180|       |    // 0xff00...01 through 0xff7f..ff have a two's complement of 0x00ff...ff
  181|       |    // through 0x000100...001 and need one leading zero removed. 0x8000...00
  182|       |    // through 0xff00...00 have a two's complement of 0x8000...00 through
  183|       |    // 0x0100...00 and will be minimally-encoded as-is.
  184|      0|    if (CBS_len(&cbs) > 0 && CBS_data(&cbs)[0] == 0xff &&
  ------------------
  |  Branch (184:9): [True: 0, False: 0]
  |  Branch (184:30): [True: 0, False: 0]
  ------------------
  185|      0|        !is_all_zeros(CBS_data(&cbs) + 1, CBS_len(&cbs) - 1)) {
  ------------------
  |  Branch (185:9): [True: 0, False: 0]
  ------------------
  186|      0|      CBS_skip(&cbs, 1);
  187|      0|    }
  188|  56.2k|  } else {
  189|       |    // Remove the leading zero byte, if any.
  190|  56.2k|    if (CBS_len(&cbs) > 0 && CBS_data(&cbs)[0] == 0x00) {
  ------------------
  |  Branch (190:9): [True: 56.2k, False: 0]
  |  Branch (190:30): [True: 28.1k, False: 28.1k]
  ------------------
  191|  28.1k|      CBS_skip(&cbs, 1);
  192|  28.1k|    }
  193|  56.2k|  }
  194|       |
  195|  56.2k|  if (!ASN1_STRING_set(ret, CBS_data(&cbs), CBS_len(&cbs))) {
  ------------------
  |  Branch (195:7): [True: 0, False: 56.2k]
  ------------------
  196|      0|    goto err;
  197|      0|  }
  198|       |
  199|  56.2k|  if (is_negative) {
  ------------------
  |  Branch (199:7): [True: 0, False: 56.2k]
  ------------------
  200|      0|    ret->type = V_ASN1_NEG_INTEGER;
  ------------------
  |  |  117|      0|#define V_ASN1_NEG_INTEGER (V_ASN1_INTEGER | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   87|      0|#define V_ASN1_INTEGER 2
  |  |  ------------------
  |  |               #define V_ASN1_NEG_INTEGER (V_ASN1_INTEGER | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |  116|      0|#define V_ASN1_NEG 0x100
  |  |  ------------------
  ------------------
  201|      0|    negate_twos_complement(ret->data, ret->length);
  202|  56.2k|  } else {
  203|  56.2k|    ret->type = V_ASN1_INTEGER;
  ------------------
  |  |   87|  56.2k|#define V_ASN1_INTEGER 2
  ------------------
  204|  56.2k|  }
  205|       |
  206|       |  // The value should be minimally-encoded.
  207|  56.2k|  assert(ret->length == 0 || ret->data[0] != 0);
  208|       |  // Zero is not negative.
  209|  56.2k|  assert(!is_negative || ret->length > 0);
  210|       |
  211|  56.2k|  *inp += len;
  212|  56.2k|  if (out != NULL) {
  ------------------
  |  Branch (212:7): [True: 56.2k, False: 0]
  ------------------
  213|  56.2k|    *out = ret;
  214|  56.2k|  }
  215|  56.2k|  return ret;
  216|       |
  217|      0|err:
  218|      0|  if (ret != NULL && (out == NULL || *out != ret)) {
  ------------------
  |  Branch (218:7): [True: 0, False: 0]
  |  Branch (218:23): [True: 0, False: 0]
  |  Branch (218:38): [True: 0, False: 0]
  ------------------
  219|      0|    ASN1_INTEGER_free(ret);
  220|      0|  }
  221|      0|  return NULL;
  222|  56.2k|}
ASN1_INTEGER_get:
  368|  28.1k|long ASN1_INTEGER_get(const ASN1_INTEGER *a) {
  369|  28.1k|  return asn1_string_get_long(a, V_ASN1_INTEGER);
  ------------------
  |  |   87|  28.1k|#define V_ASN1_INTEGER 2
  ------------------
  370|  28.1k|}
a_int.cc:_ZL26asn1_string_get_abs_uint64PmPK14asn1_string_sti:
  286|  28.1k|                                      int type) {
  287|  28.1k|  if ((a->type & ~V_ASN1_NEG) != type) {
  ------------------
  |  |  116|  28.1k|#define V_ASN1_NEG 0x100
  ------------------
  |  Branch (287:7): [True: 0, False: 28.1k]
  ------------------
  288|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_WRONG_INTEGER_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  289|      0|    return 0;
  290|      0|  }
  291|  28.1k|  uint8_t buf[sizeof(uint64_t)] = {0};
  292|  28.1k|  if (a->length > (int)sizeof(buf)) {
  ------------------
  |  Branch (292:7): [True: 0, False: 28.1k]
  ------------------
  293|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_INTEGER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  294|      0|    return 0;
  295|      0|  }
  296|  28.1k|  OPENSSL_memcpy(buf + sizeof(buf) - a->length, a->data, a->length);
  297|  28.1k|  *out = CRYPTO_load_u64_be(buf);
  298|  28.1k|  return 1;
  299|  28.1k|}
a_int.cc:_ZL21asn1_string_get_int64PlPK14asn1_string_sti:
  321|  28.1k|static int asn1_string_get_int64(int64_t *out, const ASN1_STRING *a, int type) {
  322|  28.1k|  uint64_t v;
  323|  28.1k|  if (!asn1_string_get_abs_uint64(&v, a, type)) {
  ------------------
  |  Branch (323:7): [True: 0, False: 28.1k]
  ------------------
  324|      0|    return 0;
  325|      0|  }
  326|  28.1k|  int64_t i64;
  327|  28.1k|  int fits_in_i64;
  328|       |  // Check |v != 0| to handle manually-constructed negative zeros.
  329|  28.1k|  if ((a->type & V_ASN1_NEG) && v != 0) {
  ------------------
  |  |  116|  28.1k|#define V_ASN1_NEG 0x100
  ------------------
  |  Branch (329:7): [True: 0, False: 28.1k]
  |  Branch (329:33): [True: 0, False: 0]
  ------------------
  330|      0|    i64 = (int64_t)(0u - v);
  331|      0|    fits_in_i64 = i64 < 0;
  332|  28.1k|  } else {
  333|  28.1k|    i64 = (int64_t)v;
  334|  28.1k|    fits_in_i64 = i64 >= 0;
  335|  28.1k|  }
  336|  28.1k|  if (!fits_in_i64) {
  ------------------
  |  Branch (336:7): [True: 0, False: 28.1k]
  ------------------
  337|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_INTEGER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  338|      0|    return 0;
  339|      0|  }
  340|  28.1k|  *out = i64;
  341|  28.1k|  return 1;
  342|  28.1k|}
a_int.cc:_ZL20asn1_string_get_longPK14asn1_string_sti:
  352|  28.1k|static long asn1_string_get_long(const ASN1_STRING *a, int type) {
  353|  28.1k|  if (a == NULL) {
  ------------------
  |  Branch (353:7): [True: 0, False: 28.1k]
  ------------------
  354|      0|    return 0;
  355|      0|  }
  356|       |
  357|  28.1k|  int64_t v;
  358|  28.1k|  if (!asn1_string_get_int64(&v, a, type) ||  //
  ------------------
  |  Branch (358:7): [True: 0, False: 28.1k]
  ------------------
  359|  28.1k|      v < LONG_MIN || v > LONG_MAX) {
  ------------------
  |  Branch (359:7): [True: 0, False: 28.1k]
  |  Branch (359:23): [True: 0, False: 28.1k]
  ------------------
  360|       |    // This function's return value does not distinguish overflow from -1.
  361|      0|    ERR_clear_error();
  362|      0|    return -1;
  363|      0|  }
  364|       |
  365|  28.1k|  return (long)v;
  366|  28.1k|}

ASN1_mbstring_copy:
   35|  56.2k|                       ossl_ssize_t len, int inform, unsigned long mask) {
   36|  56.2k|  return ASN1_mbstring_ncopy(out, in, len, inform, mask, /*minsize=*/0,
   37|  56.2k|                             /*maxsize=*/0);
   38|  56.2k|}
ASN1_mbstring_ncopy:
   46|  56.2k|                        ossl_ssize_t minsize, ossl_ssize_t maxsize) {
   47|  56.2k|  if (len == -1) {
  ------------------
  |  Branch (47:7): [True: 0, False: 56.2k]
  ------------------
   48|      0|    len = strlen((const char *)in);
   49|      0|  }
   50|  56.2k|  if (!mask) {
  ------------------
  |  Branch (50:7): [True: 0, False: 56.2k]
  ------------------
   51|      0|    mask = DIRSTRING_TYPE;
  ------------------
  |  |  684|      0|  (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \
  |  |  ------------------
  |  |  |  |  122|      0|#define B_ASN1_PRINTABLESTRING 0x0002
  |  |  ------------------
  |  |                 (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \
  |  |  ------------------
  |  |  |  |  123|      0|#define B_ASN1_T61STRING 0x0004
  |  |  ------------------
  |  |                 (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | \
  |  |  ------------------
  |  |  |  |  134|      0|#define B_ASN1_BMPSTRING 0x0800
  |  |  ------------------
  |  |  685|      0|   B_ASN1_UTF8STRING)
  |  |  ------------------
  |  |  |  |  135|      0|#define B_ASN1_UTF8STRING 0x2000
  |  |  ------------------
  ------------------
   52|      0|  }
   53|       |
   54|  56.2k|  int (*decode_func)(CBS *, uint32_t *);
   55|  56.2k|  int error;
   56|  56.2k|  switch (inform) {
   57|      0|    case MBSTRING_BMP:
  ------------------
  |  |  679|      0|#define MBSTRING_BMP (MBSTRING_FLAG | 2)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  |  Branch (57:5): [True: 0, False: 56.2k]
  ------------------
   58|      0|      decode_func = CBS_get_ucs2_be;
   59|      0|      error = ASN1_R_INVALID_BMPSTRING;
  ------------------
  |  | 1940|      0|#define ASN1_R_INVALID_BMPSTRING 142
  ------------------
   60|      0|      break;
   61|       |
   62|      0|    case MBSTRING_UNIV:
  ------------------
  |  |  680|      0|#define MBSTRING_UNIV (MBSTRING_FLAG | 4)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  |  Branch (62:5): [True: 0, False: 56.2k]
  ------------------
   63|      0|      decode_func = CBS_get_utf32_be;
   64|      0|      error = ASN1_R_INVALID_UNIVERSALSTRING;
  ------------------
  |  | 1947|      0|#define ASN1_R_INVALID_UNIVERSALSTRING 149
  ------------------
   65|      0|      break;
   66|       |
   67|      0|    case MBSTRING_UTF8:
  ------------------
  |  |  677|      0|#define MBSTRING_UTF8 (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  |  Branch (67:5): [True: 0, False: 56.2k]
  ------------------
   68|      0|      decode_func = CBS_get_utf8;
   69|      0|      error = ASN1_R_INVALID_UTF8STRING;
  ------------------
  |  | 1948|      0|#define ASN1_R_INVALID_UTF8STRING 150
  ------------------
   70|      0|      break;
   71|       |
   72|  56.2k|    case MBSTRING_ASC:
  ------------------
  |  |  678|  56.2k|#define MBSTRING_ASC (MBSTRING_FLAG | 1)
  |  |  ------------------
  |  |  |  |  676|  56.2k|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  |  Branch (72:5): [True: 56.2k, False: 0]
  ------------------
   73|  56.2k|      decode_func = CBS_get_latin1;
   74|  56.2k|      error = ERR_R_INTERNAL_ERROR;  // Latin-1 inputs are never invalid.
  ------------------
  |  |  307|  56.2k|#define ERR_R_INTERNAL_ERROR (4 | ERR_R_FATAL)
  |  |  ------------------
  |  |  |  |  303|  56.2k|#define ERR_R_FATAL 64
  |  |  ------------------
  ------------------
   75|  56.2k|      break;
   76|       |
   77|      0|    default:
  ------------------
  |  Branch (77:5): [True: 0, False: 56.2k]
  ------------------
   78|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNKNOWN_FORMAT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   79|      0|      return -1;
   80|  56.2k|  }
   81|       |
   82|       |  // Check |minsize| and |maxsize| and work out the minimal type, if any.
   83|  56.2k|  CBS cbs;
   84|  56.2k|  CBS_init(&cbs, in, len);
   85|  56.2k|  size_t utf8_len = 0, nchar = 0;
   86|   449k|  while (CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (86:10): [True: 393k, False: 56.2k]
  ------------------
   87|   393k|    uint32_t c;
   88|   393k|    if (!decode_func(&cbs, &c)) {
  ------------------
  |  Branch (88:9): [True: 0, False: 393k]
  ------------------
   89|      0|      OPENSSL_PUT_ERROR(ASN1, error);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   90|      0|      return -1;
   91|      0|    }
   92|   393k|    if (nchar == 0 && (inform == MBSTRING_BMP || inform == MBSTRING_UNIV) &&
  ------------------
  |  |  679|   112k|#define MBSTRING_BMP (MBSTRING_FLAG | 2)
  |  |  ------------------
  |  |  |  |  676|  56.2k|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
                  if (nchar == 0 && (inform == MBSTRING_BMP || inform == MBSTRING_UNIV) &&
  ------------------
  |  |  680|  56.2k|#define MBSTRING_UNIV (MBSTRING_FLAG | 4)
  |  |  ------------------
  |  |  |  |  676|  56.2k|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  |  Branch (92:9): [True: 56.2k, False: 337k]
  |  Branch (92:24): [True: 0, False: 56.2k]
  |  Branch (92:50): [True: 0, False: 56.2k]
  ------------------
   93|   393k|        c == 0xfeff) {
  ------------------
  |  Branch (93:9): [True: 0, False: 0]
  ------------------
   94|       |      // Reject byte-order mark. We could drop it but that would mean
   95|       |      // adding ambiguity around whether a BOM was included or not when
   96|       |      // matching strings.
   97|       |      //
   98|       |      // For a little-endian UCS-2 string, the BOM will appear as 0xfffe
   99|       |      // and will be rejected as noncharacter, below.
  100|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_CHARACTERS);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  101|      0|      return -1;
  102|      0|    }
  103|       |
  104|       |    // Update which output formats are still possible.
  105|   393k|    if ((mask & B_ASN1_PRINTABLESTRING) && !asn1_is_printable(c)) {
  ------------------
  |  |  122|   393k|#define B_ASN1_PRINTABLESTRING 0x0002
  ------------------
  |  Branch (105:9): [True: 0, False: 393k]
  |  Branch (105:44): [True: 0, False: 0]
  ------------------
  106|      0|      mask &= ~B_ASN1_PRINTABLESTRING;
  ------------------
  |  |  122|      0|#define B_ASN1_PRINTABLESTRING 0x0002
  ------------------
  107|      0|    }
  108|   393k|    if ((mask & B_ASN1_IA5STRING) && (c > 127)) {
  ------------------
  |  |  126|   393k|#define B_ASN1_IA5STRING 0x0010
  ------------------
  |  Branch (108:9): [True: 0, False: 393k]
  |  Branch (108:38): [True: 0, False: 0]
  ------------------
  109|      0|      mask &= ~B_ASN1_IA5STRING;
  ------------------
  |  |  126|      0|#define B_ASN1_IA5STRING 0x0010
  ------------------
  110|      0|    }
  111|   393k|    if ((mask & B_ASN1_T61STRING) && (c > 0xff)) {
  ------------------
  |  |  123|   393k|#define B_ASN1_T61STRING 0x0004
  ------------------
  |  Branch (111:9): [True: 0, False: 393k]
  |  Branch (111:38): [True: 0, False: 0]
  ------------------
  112|      0|      mask &= ~B_ASN1_T61STRING;
  ------------------
  |  |  123|      0|#define B_ASN1_T61STRING 0x0004
  ------------------
  113|      0|    }
  114|   393k|    if ((mask & B_ASN1_BMPSTRING) && (c > 0xffff)) {
  ------------------
  |  |  134|   393k|#define B_ASN1_BMPSTRING 0x0800
  ------------------
  |  Branch (114:9): [True: 0, False: 393k]
  |  Branch (114:38): [True: 0, False: 0]
  ------------------
  115|      0|      mask &= ~B_ASN1_BMPSTRING;
  ------------------
  |  |  134|      0|#define B_ASN1_BMPSTRING 0x0800
  ------------------
  116|      0|    }
  117|   393k|    if (!mask) {
  ------------------
  |  Branch (117:9): [True: 0, False: 393k]
  ------------------
  118|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_CHARACTERS);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  119|      0|      return -1;
  120|      0|    }
  121|       |
  122|   393k|    nchar++;
  123|   393k|    utf8_len += CBB_get_utf8_len(c);
  124|   393k|    if (maxsize > 0 && nchar > (size_t)maxsize) {
  ------------------
  |  Branch (124:9): [True: 0, False: 393k]
  |  Branch (124:24): [True: 0, False: 0]
  ------------------
  125|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  126|      0|      ERR_add_error_dataf("maxsize=%zu", (size_t)maxsize);
  127|      0|      return -1;
  128|      0|    }
  129|   393k|  }
  130|       |
  131|  56.2k|  if (minsize > 0 && nchar < (size_t)minsize) {
  ------------------
  |  Branch (131:7): [True: 0, False: 56.2k]
  |  Branch (131:22): [True: 0, False: 0]
  ------------------
  132|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_SHORT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  133|      0|    ERR_add_error_dataf("minsize=%zu", (size_t)minsize);
  134|      0|    return -1;
  135|      0|  }
  136|       |
  137|       |  // Now work out output format and string type
  138|  56.2k|  int str_type;
  139|  56.2k|  int (*encode_func)(CBB *, uint32_t) = CBB_add_latin1;
  140|  56.2k|  size_t size_estimate = nchar;
  141|  56.2k|  int outform = MBSTRING_ASC;
  ------------------
  |  |  678|  56.2k|#define MBSTRING_ASC (MBSTRING_FLAG | 1)
  |  |  ------------------
  |  |  |  |  676|  56.2k|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  142|  56.2k|  if (mask & B_ASN1_PRINTABLESTRING) {
  ------------------
  |  |  122|  56.2k|#define B_ASN1_PRINTABLESTRING 0x0002
  ------------------
  |  Branch (142:7): [True: 0, False: 56.2k]
  ------------------
  143|      0|    str_type = V_ASN1_PRINTABLESTRING;
  ------------------
  |  |  100|      0|#define V_ASN1_PRINTABLESTRING 19
  ------------------
  144|  56.2k|  } else if (mask & B_ASN1_IA5STRING) {
  ------------------
  |  |  126|  56.2k|#define B_ASN1_IA5STRING 0x0010
  ------------------
  |  Branch (144:14): [True: 0, False: 56.2k]
  ------------------
  145|      0|    str_type = V_ASN1_IA5STRING;
  ------------------
  |  |  104|      0|#define V_ASN1_IA5STRING 22
  ------------------
  146|  56.2k|  } else if (mask & B_ASN1_T61STRING) {
  ------------------
  |  |  123|  56.2k|#define B_ASN1_T61STRING 0x0004
  ------------------
  |  Branch (146:14): [True: 0, False: 56.2k]
  ------------------
  147|      0|    str_type = V_ASN1_T61STRING;
  ------------------
  |  |  101|      0|#define V_ASN1_T61STRING 20
  ------------------
  148|  56.2k|  } else if (mask & B_ASN1_BMPSTRING) {
  ------------------
  |  |  134|  56.2k|#define B_ASN1_BMPSTRING 0x0800
  ------------------
  |  Branch (148:14): [True: 0, False: 56.2k]
  ------------------
  149|      0|    str_type = V_ASN1_BMPSTRING;
  ------------------
  |  |  112|      0|#define V_ASN1_BMPSTRING 30
  ------------------
  150|      0|    outform = MBSTRING_BMP;
  ------------------
  |  |  679|      0|#define MBSTRING_BMP (MBSTRING_FLAG | 2)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  151|      0|    encode_func = CBB_add_ucs2_be;
  152|      0|    size_estimate = 2 * nchar;
  153|  56.2k|  } else if (mask & B_ASN1_UNIVERSALSTRING) {
  ------------------
  |  |  131|  56.2k|#define B_ASN1_UNIVERSALSTRING 0x0100
  ------------------
  |  Branch (153:14): [True: 0, False: 56.2k]
  ------------------
  154|      0|    str_type = V_ASN1_UNIVERSALSTRING;
  ------------------
  |  |  111|      0|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
  155|      0|    encode_func = CBB_add_utf32_be;
  156|      0|    size_estimate = 4 * nchar;
  157|      0|    outform = MBSTRING_UNIV;
  ------------------
  |  |  680|      0|#define MBSTRING_UNIV (MBSTRING_FLAG | 4)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  158|  56.2k|  } else if (mask & B_ASN1_UTF8STRING) {
  ------------------
  |  |  135|  56.2k|#define B_ASN1_UTF8STRING 0x2000
  ------------------
  |  Branch (158:14): [True: 56.2k, False: 0]
  ------------------
  159|  56.2k|    str_type = V_ASN1_UTF8STRING;
  ------------------
  |  |   96|  56.2k|#define V_ASN1_UTF8STRING 12
  ------------------
  160|  56.2k|    outform = MBSTRING_UTF8;
  ------------------
  |  |  677|  56.2k|#define MBSTRING_UTF8 (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  676|  56.2k|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  161|  56.2k|    encode_func = CBB_add_utf8;
  162|  56.2k|    size_estimate = utf8_len;
  163|  56.2k|  } else {
  164|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_CHARACTERS);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  165|      0|    return -1;
  166|      0|  }
  167|       |
  168|  56.2k|  if (!out) {
  ------------------
  |  Branch (168:7): [True: 0, False: 56.2k]
  ------------------
  169|      0|    return str_type;
  170|      0|  }
  171|       |
  172|  56.2k|  int free_dest = 0;
  173|  56.2k|  ASN1_STRING *dest;
  174|  56.2k|  if (*out) {
  ------------------
  |  Branch (174:7): [True: 56.2k, False: 0]
  ------------------
  175|  56.2k|    dest = *out;
  176|  56.2k|  } else {
  177|      0|    free_dest = 1;
  178|      0|    dest = ASN1_STRING_type_new(str_type);
  179|      0|    if (!dest) {
  ------------------
  |  Branch (179:9): [True: 0, False: 0]
  ------------------
  180|      0|      return -1;
  181|      0|    }
  182|      0|  }
  183|       |
  184|  56.2k|  CBB cbb;
  185|  56.2k|  CBB_zero(&cbb);
  186|       |  // If both the same type just copy across
  187|  56.2k|  uint8_t *data = NULL;
  188|  56.2k|  size_t data_len = 0;
  189|  56.2k|  if (inform == outform) {
  ------------------
  |  Branch (189:7): [True: 0, False: 56.2k]
  ------------------
  190|      0|    if (!ASN1_STRING_set(dest, in, len)) {
  ------------------
  |  Branch (190:9): [True: 0, False: 0]
  ------------------
  191|      0|      goto err;
  192|      0|    }
  193|      0|    dest->type = str_type;
  194|      0|    *out = dest;
  195|      0|    return str_type;
  196|      0|  }
  197|  56.2k|  if (!CBB_init(&cbb, size_estimate + 1)) {
  ------------------
  |  Branch (197:7): [True: 0, False: 56.2k]
  ------------------
  198|      0|    goto err;
  199|      0|  }
  200|  56.2k|  CBS_init(&cbs, in, len);
  201|   449k|  while (CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (201:10): [True: 393k, False: 56.2k]
  ------------------
  202|   393k|    uint32_t c;
  203|   393k|    if (!decode_func(&cbs, &c) || !encode_func(&cbb, c)) {
  ------------------
  |  Branch (203:9): [True: 0, False: 393k]
  |  Branch (203:35): [True: 0, False: 393k]
  ------------------
  204|      0|      OPENSSL_PUT_ERROR(ASN1, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  205|      0|      goto err;
  206|      0|    }
  207|   393k|  }
  208|  56.2k|  if (/* OpenSSL historically NUL-terminated this value with a single byte,
  209|       |       * even for |MBSTRING_BMP| and |MBSTRING_UNIV|. */
  210|  56.2k|      !CBB_add_u8(&cbb, 0) ||                 //
  ------------------
  |  Branch (210:7): [True: 0, False: 56.2k]
  ------------------
  211|  56.2k|      !CBB_finish(&cbb, &data, &data_len) ||  //
  ------------------
  |  Branch (211:7): [True: 0, False: 56.2k]
  ------------------
  212|  56.2k|      data_len < 1 ||                         //
  ------------------
  |  Branch (212:7): [True: 0, False: 56.2k]
  ------------------
  213|  56.2k|      data_len > INT_MAX) {
  ------------------
  |  Branch (213:7): [True: 0, False: 56.2k]
  ------------------
  214|      0|    OPENSSL_PUT_ERROR(ASN1, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  215|      0|    OPENSSL_free(data);
  216|      0|    goto err;
  217|      0|  }
  218|  56.2k|  dest->type = str_type;
  219|  56.2k|  ASN1_STRING_set0(dest, data, (int)data_len - 1);
  220|  56.2k|  *out = dest;
  221|  56.2k|  return str_type;
  222|       |
  223|      0|err:
  224|      0|  if (free_dest) {
  ------------------
  |  Branch (224:7): [True: 0, False: 0]
  ------------------
  225|      0|    ASN1_STRING_free(dest);
  226|      0|  }
  227|      0|  CBB_cleanup(&cbb);
  228|      0|  return -1;
  229|  56.2k|}

c2i_ASN1_OBJECT:
  115|   253k|                             long len) {
  116|   253k|  if (len < 0) {
  ------------------
  |  Branch (116:7): [True: 0, False: 253k]
  ------------------
  117|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_OBJECT_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  118|      0|    return NULL;
  119|      0|  }
  120|       |
  121|   253k|  CBS cbs;
  122|   253k|  CBS_init(&cbs, *inp, (size_t)len);
  123|   253k|  if (!CBS_is_valid_asn1_oid(&cbs)) {
  ------------------
  |  Branch (123:7): [True: 0, False: 253k]
  ------------------
  124|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_OBJECT_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  125|      0|    return NULL;
  126|      0|  }
  127|       |
  128|   253k|  ASN1_OBJECT *ret = ASN1_OBJECT_create(NID_undef, *inp, (size_t)len,
  ------------------
  |  |   43|   253k|#define NID_undef 0
  ------------------
  129|       |                                        /*sn=*/NULL, /*ln=*/NULL);
  130|   253k|  if (ret == NULL) {
  ------------------
  |  Branch (130:7): [True: 0, False: 253k]
  ------------------
  131|      0|    return NULL;
  132|      0|  }
  133|       |
  134|   253k|  if (out != NULL) {
  ------------------
  |  Branch (134:7): [True: 253k, False: 0]
  ------------------
  135|   253k|    ASN1_OBJECT_free(*out);
  136|   253k|    *out = ret;
  137|   253k|  }
  138|   253k|  *inp += len;  // All bytes were consumed.
  139|   253k|  return ret;
  140|   253k|}
ASN1_OBJECT_new:
  142|   309k|ASN1_OBJECT *ASN1_OBJECT_new(void) {
  143|   309k|  ASN1_OBJECT *ret;
  144|       |
  145|   309k|  ret = (ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT));
  146|   309k|  if (ret == NULL) {
  ------------------
  |  Branch (146:7): [True: 0, False: 309k]
  ------------------
  147|      0|    return NULL;
  148|      0|  }
  149|   309k|  ret->length = 0;
  150|   309k|  ret->data = NULL;
  151|   309k|  ret->nid = 0;
  152|   309k|  ret->sn = NULL;
  153|   309k|  ret->ln = NULL;
  154|   309k|  ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
  ------------------
  |  |   55|   309k|#define ASN1_OBJECT_FLAG_DYNAMIC 0x01          // internal use
  ------------------
  155|   309k|  return ret;
  156|   309k|}
ASN1_OBJECT_free:
  158|   562k|void ASN1_OBJECT_free(ASN1_OBJECT *a) {
  159|   562k|  if (a == NULL) {
  ------------------
  |  Branch (159:7): [True: 0, False: 562k]
  ------------------
  160|      0|    return;
  161|      0|  }
  162|   562k|  if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) {
  ------------------
  |  |   56|   562k|#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04  // internal use
  ------------------
  |  Branch (162:7): [True: 309k, False: 253k]
  ------------------
  163|   309k|    OPENSSL_free((void *)a->sn);
  164|   309k|    OPENSSL_free((void *)a->ln);
  165|   309k|    a->sn = a->ln = NULL;
  166|   309k|  }
  167|   562k|  if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) {
  ------------------
  |  |   57|   562k|#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08     // internal use
  ------------------
  |  Branch (167:7): [True: 309k, False: 253k]
  ------------------
  168|   309k|    OPENSSL_free((void *)a->data);
  169|   309k|    a->data = NULL;
  170|   309k|    a->length = 0;
  171|   309k|  }
  172|   562k|  if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) {
  ------------------
  |  |   55|   562k|#define ASN1_OBJECT_FLAG_DYNAMIC 0x01          // internal use
  ------------------
  |  Branch (172:7): [True: 309k, False: 253k]
  ------------------
  173|   309k|    OPENSSL_free(a);
  174|   309k|  }
  175|   562k|}
ASN1_OBJECT_create:
  178|   253k|                                const char *sn, const char *ln) {
  179|   253k|  if (len > INT_MAX) {
  ------------------
  |  Branch (179:7): [True: 0, False: 253k]
  ------------------
  180|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  181|      0|    return NULL;
  182|      0|  }
  183|       |
  184|   253k|  ASN1_OBJECT o;
  185|   253k|  o.sn = sn;
  186|   253k|  o.ln = ln;
  187|   253k|  o.data = data;
  188|   253k|  o.nid = nid;
  189|   253k|  o.length = (int)len;
  190|   253k|  o.flags = ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  ------------------
  |  |   55|   253k|#define ASN1_OBJECT_FLAG_DYNAMIC 0x01          // internal use
  ------------------
                o.flags = ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  ------------------
  |  |   56|   253k|#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04  // internal use
  ------------------
  191|   253k|            ASN1_OBJECT_FLAG_DYNAMIC_DATA;
  ------------------
  |  |   57|   253k|#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08     // internal use
  ------------------
  192|   253k|  return OBJ_dup(&o);
  193|   253k|}

ASN1_STRING_to_UTF8:
  321|  56.2k|int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in) {
  322|  56.2k|  if (!in) {
  ------------------
  |  Branch (322:7): [True: 0, False: 56.2k]
  ------------------
  323|      0|    return -1;
  324|      0|  }
  325|  56.2k|  int mbflag = string_type_to_encoding(in->type);
  326|  56.2k|  if (mbflag == -1) {
  ------------------
  |  Branch (326:7): [True: 0, False: 56.2k]
  ------------------
  327|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNKNOWN_TAG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  328|      0|    return -1;
  329|      0|  }
  330|  56.2k|  ASN1_STRING stmp, *str = &stmp;
  331|  56.2k|  stmp.data = NULL;
  332|  56.2k|  stmp.length = 0;
  333|  56.2k|  stmp.flags = 0;
  334|  56.2k|  int ret =
  335|  56.2k|      ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
  ------------------
  |  |  135|  56.2k|#define B_ASN1_UTF8STRING 0x2000
  ------------------
  336|  56.2k|  if (ret < 0) {
  ------------------
  |  Branch (336:7): [True: 0, False: 56.2k]
  ------------------
  337|      0|    return ret;
  338|      0|  }
  339|  56.2k|  *out = stmp.data;
  340|  56.2k|  return stmp.length;
  341|  56.2k|}
a_strex.cc:_ZL23string_type_to_encodingi:
  218|  56.2k|static int string_type_to_encoding(int type) {
  219|       |  // This function is sometimes passed ASN.1 universal types and sometimes
  220|       |  // passed |ASN1_STRING| type values
  221|  56.2k|  switch (type) {
  ------------------
  |  Branch (221:11): [True: 0, False: 56.2k]
  ------------------
  222|      0|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   96|      0|#define V_ASN1_UTF8STRING 12
  ------------------
  |  Branch (222:5): [True: 0, False: 56.2k]
  ------------------
  223|      0|      return MBSTRING_UTF8;
  ------------------
  |  |  677|      0|#define MBSTRING_UTF8 (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  224|      0|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   99|      0|#define V_ASN1_NUMERICSTRING 18
  ------------------
  |  Branch (224:5): [True: 0, False: 56.2k]
  ------------------
  225|  56.2k|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |  100|  56.2k|#define V_ASN1_PRINTABLESTRING 19
  ------------------
  |  Branch (225:5): [True: 56.2k, False: 0]
  ------------------
  226|  56.2k|    case V_ASN1_T61STRING:
  ------------------
  |  |  101|  56.2k|#define V_ASN1_T61STRING 20
  ------------------
  |  Branch (226:5): [True: 0, False: 56.2k]
  ------------------
  227|  56.2k|    case V_ASN1_IA5STRING:
  ------------------
  |  |  104|  56.2k|#define V_ASN1_IA5STRING 22
  ------------------
  |  Branch (227:5): [True: 0, False: 56.2k]
  ------------------
  228|  56.2k|    case V_ASN1_UTCTIME:
  ------------------
  |  |  105|  56.2k|#define V_ASN1_UTCTIME 23
  ------------------
  |  Branch (228:5): [True: 0, False: 56.2k]
  ------------------
  229|  56.2k|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |  106|  56.2k|#define V_ASN1_GENERALIZEDTIME 24
  ------------------
  |  Branch (229:5): [True: 0, False: 56.2k]
  ------------------
  230|  56.2k|    case V_ASN1_ISO64STRING:
  ------------------
  |  |  108|  56.2k|#define V_ASN1_ISO64STRING 26
  ------------------
  |  Branch (230:5): [True: 0, False: 56.2k]
  ------------------
  231|       |      // |MBSTRING_ASC| refers to Latin-1, not ASCII.
  232|  56.2k|      return MBSTRING_ASC;
  ------------------
  |  |  678|  56.2k|#define MBSTRING_ASC (MBSTRING_FLAG | 1)
  |  |  ------------------
  |  |  |  |  676|  56.2k|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  233|      0|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |  111|      0|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
  |  Branch (233:5): [True: 0, False: 56.2k]
  ------------------
  234|      0|      return MBSTRING_UNIV;
  ------------------
  |  |  680|      0|#define MBSTRING_UNIV (MBSTRING_FLAG | 4)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  235|      0|    case V_ASN1_BMPSTRING:
  ------------------
  |  |  112|      0|#define V_ASN1_BMPSTRING 30
  ------------------
  |  Branch (235:5): [True: 0, False: 56.2k]
  ------------------
  236|      0|      return MBSTRING_BMP;
  ------------------
  |  |  679|      0|#define MBSTRING_BMP (MBSTRING_FLAG | 2)
  |  |  ------------------
  |  |  |  |  676|      0|#define MBSTRING_FLAG 0x1000
  |  |  ------------------
  ------------------
  237|  56.2k|  }
  238|      0|  return -1;
  239|  56.2k|}

asn1_type_cleanup:
   68|   168k|void asn1_type_cleanup(ASN1_TYPE *a) {
   69|   168k|  switch (a->type) {
   70|  84.3k|    case V_ASN1_NULL:
  ------------------
  |  |   90|  84.3k|#define V_ASN1_NULL 5
  ------------------
  |  Branch (70:5): [True: 84.3k, False: 84.3k]
  ------------------
   71|  84.3k|      a->value.ptr = NULL;
   72|  84.3k|      break;
   73|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   86|      0|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (73:5): [True: 0, False: 168k]
  ------------------
   74|      0|      a->value.boolean = ASN1_BOOLEAN_NONE;
  ------------------
  |  |  385|      0|#define ASN1_BOOLEAN_NONE (-1)
  ------------------
   75|      0|      break;
   76|      0|    case V_ASN1_OBJECT:
  ------------------
  |  |   91|      0|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (76:5): [True: 0, False: 168k]
  ------------------
   77|      0|      ASN1_OBJECT_free(a->value.object);
   78|      0|      a->value.object = NULL;
   79|      0|      break;
   80|  84.3k|    default:
  ------------------
  |  Branch (80:5): [True: 84.3k, False: 84.3k]
  ------------------
   81|  84.3k|      ASN1_STRING_free(a->value.asn1_string);
   82|  84.3k|      a->value.asn1_string = NULL;
   83|  84.3k|      break;
   84|   168k|  }
   85|   168k|}
ASN1_TYPE_set:
   87|  84.3k|void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) {
   88|  84.3k|  asn1_type_cleanup(a);
   89|  84.3k|  a->type = type;
   90|  84.3k|  switch (type) {
   91|  84.3k|    case V_ASN1_NULL:
  ------------------
  |  |   90|  84.3k|#define V_ASN1_NULL 5
  ------------------
  |  Branch (91:5): [True: 84.3k, False: 0]
  ------------------
   92|  84.3k|      a->value.ptr = NULL;
   93|  84.3k|      break;
   94|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   86|      0|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (94:5): [True: 0, False: 84.3k]
  ------------------
   95|      0|      a->value.boolean = value ? ASN1_BOOLEAN_TRUE : ASN1_BOOLEAN_FALSE;
  ------------------
  |  |  380|      0|#define ASN1_BOOLEAN_TRUE 0xff
  ------------------
                    a->value.boolean = value ? ASN1_BOOLEAN_TRUE : ASN1_BOOLEAN_FALSE;
  ------------------
  |  |  376|      0|#define ASN1_BOOLEAN_FALSE 0
  ------------------
  |  Branch (95:26): [True: 0, False: 0]
  ------------------
   96|      0|      break;
   97|      0|    case V_ASN1_OBJECT:
  ------------------
  |  |   91|      0|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (97:5): [True: 0, False: 84.3k]
  ------------------
   98|      0|      a->value.object = reinterpret_cast<ASN1_OBJECT *>(value);
   99|      0|      break;
  100|      0|    default:
  ------------------
  |  Branch (100:5): [True: 0, False: 84.3k]
  ------------------
  101|      0|      a->value.asn1_string = reinterpret_cast<ASN1_STRING *>(value);
  102|      0|      break;
  103|  84.3k|  }
  104|  84.3k|}

ASN1_get_object:
   75|  1.54M|                    int *out_class, long in_len) {
   76|  1.54M|  if (in_len < 0) {
  ------------------
  |  Branch (76:7): [True: 0, False: 1.54M]
  ------------------
   77|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_HEADER_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   78|      0|    return 0x80;
   79|      0|  }
   80|       |
   81|  1.54M|  CBS_ASN1_TAG tag;
   82|  1.54M|  CBS cbs, body;
   83|  1.54M|  CBS_init(&cbs, *inp, (size_t)in_len);
   84|  1.54M|  if (!CBS_get_any_asn1(&cbs, &body, &tag) ||
  ------------------
  |  Branch (84:7): [True: 0, False: 1.54M]
  ------------------
   85|       |      // Bound the length to comfortably fit in an int. Lengths in this
   86|       |      // module often switch between int and long without overflow checks.
   87|  1.54M|      CBS_len(&body) > INT_MAX / 2) {
  ------------------
  |  Branch (87:7): [True: 0, False: 1.54M]
  ------------------
   88|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_HEADER_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   89|      0|    return 0x80;
   90|      0|  }
   91|       |
   92|       |  // Convert between tag representations.
   93|  1.54M|  int tag_class = (tag & CBS_ASN1_CLASS_MASK) >> CBS_ASN1_TAG_SHIFT;
  ------------------
  |  |  208|  1.54M|#define CBS_ASN1_CLASS_MASK (0xc0u << CBS_ASN1_TAG_SHIFT)
  |  |  ------------------
  |  |  |  |  194|  1.54M|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
                int tag_class = (tag & CBS_ASN1_CLASS_MASK) >> CBS_ASN1_TAG_SHIFT;
  ------------------
  |  |  194|  1.54M|#define CBS_ASN1_TAG_SHIFT 24
  ------------------
   94|  1.54M|  int constructed = (tag & CBS_ASN1_CONSTRUCTED) >> CBS_ASN1_TAG_SHIFT;
  ------------------
  |  |  197|  1.54M|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  ------------------
  |  |  |  |  194|  1.54M|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
                int constructed = (tag & CBS_ASN1_CONSTRUCTED) >> CBS_ASN1_TAG_SHIFT;
  ------------------
  |  |  194|  1.54M|#define CBS_ASN1_TAG_SHIFT 24
  ------------------
   95|  1.54M|  int tag_number = tag & CBS_ASN1_TAG_NUMBER_MASK;
  ------------------
  |  |  211|  1.54M|#define CBS_ASN1_TAG_NUMBER_MASK ((1u << (5 + CBS_ASN1_TAG_SHIFT)) - 1)
  |  |  ------------------
  |  |  |  |  194|  1.54M|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
   96|       |
   97|       |  // To avoid ambiguity with V_ASN1_NEG, impose a limit on universal tags.
   98|  1.54M|  if (tag_class == V_ASN1_UNIVERSAL && tag_number > V_ASN1_MAX_UNIVERSAL) {
  ------------------
  |  |   49|  3.09M|#define V_ASN1_UNIVERSAL 0x00
  ------------------
                if (tag_class == V_ASN1_UNIVERSAL && tag_number > V_ASN1_MAX_UNIVERSAL) {
  ------------------
  |  |   69|  1.43M|#define V_ASN1_MAX_UNIVERSAL 0xff
  ------------------
  |  Branch (98:7): [True: 1.43M, False: 112k]
  |  Branch (98:40): [True: 0, False: 1.43M]
  ------------------
   99|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_HEADER_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  100|      0|    return 0x80;
  101|      0|  }
  102|       |
  103|  1.54M|  *inp = CBS_data(&body);
  104|  1.54M|  *out_len = CBS_len(&body);
  105|  1.54M|  *out_tag = tag_number;
  106|  1.54M|  *out_class = tag_class;
  107|  1.54M|  return constructed;
  108|  1.54M|}
ASN1_put_object:
  112|   416k|                     int xclass) {
  113|   416k|  unsigned char *p = *pp;
  114|   416k|  int i, ttag;
  115|       |
  116|   416k|  i = (constructed) ? V_ASN1_CONSTRUCTED : 0;
  ------------------
  |  |   56|   185k|#define V_ASN1_CONSTRUCTED 0x20
  ------------------
  |  Branch (116:7): [True: 185k, False: 231k]
  ------------------
  117|   416k|  i |= (xclass & V_ASN1_PRIVATE);
  ------------------
  |  |   52|   416k|#define V_ASN1_PRIVATE 0xc0
  ------------------
  118|   416k|  if (tag < 31) {
  ------------------
  |  Branch (118:7): [True: 416k, False: 0]
  ------------------
  119|   416k|    *(p++) = i | (tag & V_ASN1_PRIMITIVE_TAG);
  ------------------
  |  |   63|   416k|#define V_ASN1_PRIMITIVE_TAG 0x1f
  ------------------
  120|   416k|  } else {
  121|      0|    *(p++) = i | V_ASN1_PRIMITIVE_TAG;
  ------------------
  |  |   63|      0|#define V_ASN1_PRIMITIVE_TAG 0x1f
  ------------------
  122|      0|    for (i = 0, ttag = tag; ttag > 0; i++) {
  ------------------
  |  Branch (122:29): [True: 0, False: 0]
  ------------------
  123|      0|      ttag >>= 7;
  124|      0|    }
  125|      0|    ttag = i;
  126|      0|    while (i-- > 0) {
  ------------------
  |  Branch (126:12): [True: 0, False: 0]
  ------------------
  127|      0|      p[i] = tag & 0x7f;
  128|      0|      if (i != (ttag - 1)) {
  ------------------
  |  Branch (128:11): [True: 0, False: 0]
  ------------------
  129|      0|        p[i] |= 0x80;
  130|      0|      }
  131|      0|      tag >>= 7;
  132|      0|    }
  133|      0|    p += ttag;
  134|      0|  }
  135|   416k|  if (constructed == 2) {
  ------------------
  |  Branch (135:7): [True: 0, False: 416k]
  ------------------
  136|      0|    *(p++) = 0x80;
  137|   416k|  } else {
  138|   416k|    asn1_put_length(&p, length);
  139|   416k|  }
  140|   416k|  *pp = p;
  141|   416k|}
ASN1_object_size:
  174|  1.31M|int ASN1_object_size(int constructed, int length, int tag) {
  175|  1.31M|  int ret = 1;
  176|  1.31M|  if (length < 0) {
  ------------------
  |  Branch (176:7): [True: 0, False: 1.31M]
  ------------------
  177|      0|    return -1;
  178|      0|  }
  179|  1.31M|  if (tag >= 31) {
  ------------------
  |  Branch (179:7): [True: 0, False: 1.31M]
  ------------------
  180|      0|    while (tag > 0) {
  ------------------
  |  Branch (180:12): [True: 0, False: 0]
  ------------------
  181|      0|      tag >>= 7;
  182|      0|      ret++;
  183|      0|    }
  184|      0|  }
  185|  1.31M|  if (constructed == 2) {
  ------------------
  |  Branch (185:7): [True: 0, False: 1.31M]
  ------------------
  186|      0|    ret += 3;
  187|  1.31M|  } else {
  188|  1.31M|    ret++;
  189|  1.31M|    if (length > 127) {
  ------------------
  |  Branch (189:9): [True: 140k, False: 1.17M]
  ------------------
  190|   140k|      int tmplen = length;
  191|   421k|      while (tmplen > 0) {
  ------------------
  |  Branch (191:14): [True: 281k, False: 140k]
  ------------------
  192|   281k|        tmplen >>= 8;
  193|   281k|        ret++;
  194|   281k|      }
  195|   140k|    }
  196|  1.31M|  }
  197|  1.31M|  if (ret >= INT_MAX - length) {
  ------------------
  |  Branch (197:7): [True: 0, False: 1.31M]
  ------------------
  198|      0|    return -1;
  199|      0|  }
  200|  1.31M|  return ret + length;
  201|  1.31M|}
ASN1_STRING_set:
  231|   281k|int ASN1_STRING_set(ASN1_STRING *str, const void *_data, ossl_ssize_t len_s) {
  232|   281k|  const char *data = reinterpret_cast<const char *>(_data);
  233|   281k|  size_t len;
  234|   281k|  if (len_s < 0) {
  ------------------
  |  Branch (234:7): [True: 0, False: 281k]
  ------------------
  235|      0|    if (data == NULL) {
  ------------------
  |  Branch (235:9): [True: 0, False: 0]
  ------------------
  236|      0|      return 0;
  237|      0|    }
  238|      0|    len = strlen(data);
  239|   281k|  } else {
  240|   281k|    len = (size_t)len_s;
  241|   281k|  }
  242|       |
  243|   281k|  static_assert(ASN1_STRING_MAX < INT_MAX, "len will not overflow int");
  244|   281k|  if (len > ASN1_STRING_MAX) {
  ------------------
  |  |   70|   281k|#define ASN1_STRING_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (244:7): [True: 0, False: 281k]
  ------------------
  245|      0|    OPENSSL_PUT_ERROR(ASN1, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  246|      0|    return 0;
  247|      0|  }
  248|       |
  249|   281k|  if (str->length <= (int)len || str->data == NULL) {
  ------------------
  |  Branch (249:7): [True: 281k, False: 0]
  |  Branch (249:34): [True: 0, False: 0]
  ------------------
  250|   281k|    unsigned char *c = str->data;
  251|   281k|    if (c == NULL) {
  ------------------
  |  Branch (251:9): [True: 281k, False: 0]
  ------------------
  252|   281k|      str->data = reinterpret_cast<uint8_t *>(OPENSSL_malloc(len + 1));
  253|   281k|    } else {
  254|      0|      str->data = reinterpret_cast<uint8_t *>(OPENSSL_realloc(c, len + 1));
  255|      0|    }
  256|       |
  257|   281k|    if (str->data == NULL) {
  ------------------
  |  Branch (257:9): [True: 0, False: 281k]
  ------------------
  258|      0|      str->data = c;
  259|      0|      return 0;
  260|      0|    }
  261|   281k|  }
  262|   281k|  str->length = (int)len;
  263|   281k|  if (data != NULL) {
  ------------------
  |  Branch (263:7): [True: 281k, False: 0]
  ------------------
  264|   281k|    OPENSSL_memcpy(str->data, data, len);
  265|       |    // Historically, OpenSSL would NUL-terminate most (but not all)
  266|       |    // |ASN1_STRING|s, in case anyone accidentally passed |str->data| into a
  267|       |    // function expecting a C string. We retain this behavior for compatibility,
  268|       |    // but code must not rely on this. See CVE-2021-3712.
  269|   281k|    str->data[len] = '\0';
  270|   281k|  }
  271|   281k|  return 1;
  272|   281k|}
ASN1_STRING_set0:
  274|  56.2k|void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) {
  275|  56.2k|  OPENSSL_free(str->data);
  276|  56.2k|  str->data = reinterpret_cast<uint8_t *>(data);
  277|  56.2k|  str->length = len;
  278|  56.2k|}
ASN1_STRING_type_new:
  284|   393k|ASN1_STRING *ASN1_STRING_type_new(int type) {
  285|   393k|  ASN1_STRING *ret;
  286|       |
  287|   393k|  ret = (ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING));
  288|   393k|  if (ret == NULL) {
  ------------------
  |  Branch (288:7): [True: 0, False: 393k]
  ------------------
  289|      0|    return NULL;
  290|      0|  }
  291|   393k|  ret->length = 0;
  292|   393k|  ret->type = type;
  293|   393k|  ret->data = NULL;
  294|   393k|  ret->flags = 0;
  295|   393k|  return ret;
  296|   393k|}
ASN1_STRING_free:
  298|   618k|void ASN1_STRING_free(ASN1_STRING *str) {
  299|   618k|  if (str == NULL) {
  ------------------
  |  Branch (299:7): [True: 224k, False: 393k]
  ------------------
  300|   224k|    return;
  301|   224k|  }
  302|   393k|  OPENSSL_free(str->data);
  303|   393k|  OPENSSL_free(str);
  304|   393k|}
asn1_lib.cc:_ZL15asn1_put_lengthPPhi:
  153|   416k|static void asn1_put_length(unsigned char **pp, int length) {
  154|   416k|  unsigned char *p = *pp;
  155|   416k|  int i, l;
  156|   416k|  if (length <= 127) {
  ------------------
  |  Branch (156:7): [True: 360k, False: 56.2k]
  ------------------
  157|   360k|    *(p++) = (unsigned char)length;
  158|   360k|  } else {
  159|  56.2k|    l = length;
  160|   168k|    for (i = 0; l > 0; i++) {
  ------------------
  |  Branch (160:17): [True: 112k, False: 56.2k]
  ------------------
  161|   112k|      l >>= 8;
  162|   112k|    }
  163|  56.2k|    *(p++) = i | 0x80;
  164|  56.2k|    l = i;
  165|   168k|    while (i-- > 0) {
  ------------------
  |  Branch (165:12): [True: 112k, False: 56.2k]
  ------------------
  166|   112k|      p[i] = length & 0xff;
  167|   112k|      length >>= 8;
  168|   112k|    }
  169|  56.2k|    p += l;
  170|  56.2k|  }
  171|   416k|  *pp = p;
  172|   416k|}

ASN1_tag2bit:
   55|   112k|unsigned long ASN1_tag2bit(int tag) {
   56|   112k|  switch (tag) {
   57|      0|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   88|      0|#define V_ASN1_BIT_STRING 3
  ------------------
  |  Branch (57:5): [True: 0, False: 112k]
  ------------------
   58|      0|      return B_ASN1_BIT_STRING;
  ------------------
  |  |  133|      0|#define B_ASN1_BIT_STRING 0x0400
  ------------------
   59|      0|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   89|      0|#define V_ASN1_OCTET_STRING 4
  ------------------
  |  Branch (59:5): [True: 0, False: 112k]
  ------------------
   60|      0|      return B_ASN1_OCTET_STRING;
  ------------------
  |  |  132|      0|#define B_ASN1_OCTET_STRING 0x0200
  ------------------
   61|      0|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   96|      0|#define V_ASN1_UTF8STRING 12
  ------------------
  |  Branch (61:5): [True: 0, False: 112k]
  ------------------
   62|      0|      return B_ASN1_UTF8STRING;
  ------------------
  |  |  135|      0|#define B_ASN1_UTF8STRING 0x2000
  ------------------
   63|      0|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   97|      0|#define V_ASN1_SEQUENCE 16
  ------------------
  |  Branch (63:5): [True: 0, False: 112k]
  ------------------
   64|      0|      return B_ASN1_SEQUENCE;
  ------------------
  |  |  138|      0|#define B_ASN1_SEQUENCE 0x10000
  ------------------
   65|      0|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   99|      0|#define V_ASN1_NUMERICSTRING 18
  ------------------
  |  Branch (65:5): [True: 0, False: 112k]
  ------------------
   66|      0|      return B_ASN1_NUMERICSTRING;
  ------------------
  |  |  121|      0|#define B_ASN1_NUMERICSTRING 0x0001
  ------------------
   67|  56.2k|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |  100|  56.2k|#define V_ASN1_PRINTABLESTRING 19
  ------------------
  |  Branch (67:5): [True: 56.2k, False: 56.2k]
  ------------------
   68|  56.2k|      return B_ASN1_PRINTABLESTRING;
  ------------------
  |  |  122|  56.2k|#define B_ASN1_PRINTABLESTRING 0x0002
  ------------------
   69|      0|    case V_ASN1_T61STRING:
  ------------------
  |  |  101|      0|#define V_ASN1_T61STRING 20
  ------------------
  |  Branch (69:5): [True: 0, False: 112k]
  ------------------
   70|      0|      return B_ASN1_T61STRING;
  ------------------
  |  |  123|      0|#define B_ASN1_T61STRING 0x0004
  ------------------
   71|      0|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |  103|      0|#define V_ASN1_VIDEOTEXSTRING 21
  ------------------
  |  Branch (71:5): [True: 0, False: 112k]
  ------------------
   72|      0|      return B_ASN1_VIDEOTEXSTRING;
  ------------------
  |  |  125|      0|#define B_ASN1_VIDEOTEXSTRING 0x0008
  ------------------
   73|      0|    case V_ASN1_IA5STRING:
  ------------------
  |  |  104|      0|#define V_ASN1_IA5STRING 22
  ------------------
  |  Branch (73:5): [True: 0, False: 112k]
  ------------------
   74|      0|      return B_ASN1_IA5STRING;
  ------------------
  |  |  126|      0|#define B_ASN1_IA5STRING 0x0010
  ------------------
   75|  56.2k|    case V_ASN1_UTCTIME:
  ------------------
  |  |  105|  56.2k|#define V_ASN1_UTCTIME 23
  ------------------
  |  Branch (75:5): [True: 56.2k, False: 56.2k]
  ------------------
   76|  56.2k|      return B_ASN1_UTCTIME;
  ------------------
  |  |  136|  56.2k|#define B_ASN1_UTCTIME 0x4000
  ------------------
   77|      0|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |  106|      0|#define V_ASN1_GENERALIZEDTIME 24
  ------------------
  |  Branch (77:5): [True: 0, False: 112k]
  ------------------
   78|      0|      return B_ASN1_GENERALIZEDTIME;
  ------------------
  |  |  137|      0|#define B_ASN1_GENERALIZEDTIME 0x8000
  ------------------
   79|      0|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |  107|      0|#define V_ASN1_GRAPHICSTRING 25
  ------------------
  |  Branch (79:5): [True: 0, False: 112k]
  ------------------
   80|      0|      return B_ASN1_GRAPHICSTRING;
  ------------------
  |  |  127|      0|#define B_ASN1_GRAPHICSTRING 0x0020
  ------------------
   81|      0|    case V_ASN1_ISO64STRING:
  ------------------
  |  |  108|      0|#define V_ASN1_ISO64STRING 26
  ------------------
  |  Branch (81:5): [True: 0, False: 112k]
  ------------------
   82|      0|      return B_ASN1_ISO64STRING;
  ------------------
  |  |  128|      0|#define B_ASN1_ISO64STRING 0x0040
  ------------------
   83|      0|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |  110|      0|#define V_ASN1_GENERALSTRING 27
  ------------------
  |  Branch (83:5): [True: 0, False: 112k]
  ------------------
   84|      0|      return B_ASN1_GENERALSTRING;
  ------------------
  |  |  130|      0|#define B_ASN1_GENERALSTRING 0x0080
  ------------------
   85|      0|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |  111|      0|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
  |  Branch (85:5): [True: 0, False: 112k]
  ------------------
   86|      0|      return B_ASN1_UNIVERSALSTRING;
  ------------------
  |  |  131|      0|#define B_ASN1_UNIVERSALSTRING 0x0100
  ------------------
   87|      0|    case V_ASN1_BMPSTRING:
  ------------------
  |  |  112|      0|#define V_ASN1_BMPSTRING 30
  ------------------
  |  Branch (87:5): [True: 0, False: 112k]
  ------------------
   88|      0|      return B_ASN1_BMPSTRING;
  ------------------
  |  |  134|      0|#define B_ASN1_BMPSTRING 0x0800
  ------------------
   89|      0|    default:
  ------------------
  |  Branch (89:5): [True: 0, False: 112k]
  ------------------
   90|      0|      return 0;
   91|   112k|  }
   92|   112k|}
ASN1_item_d2i:
  119|  28.1k|                          const ASN1_ITEM *it) {
  120|  28.1k|  ASN1_VALUE *ret = NULL;
  121|  28.1k|  if (asn1_item_ex_d2i(&ret, in, len, it, /*tag=*/-1, /*aclass=*/0, /*opt=*/0,
  ------------------
  |  Branch (121:7): [True: 0, False: 28.1k]
  ------------------
  122|  28.1k|                       /*buf=*/NULL, /*depth=*/0) <= 0) {
  123|       |    // Clean up, in case the caller left a partial object.
  124|       |    //
  125|       |    // TODO(davidben): I don't think it can leave one, but the codepaths below
  126|       |    // are a bit inconsistent. Revisit this when rewriting this function.
  127|      0|    ASN1_item_ex_free(&ret, it);
  128|      0|  }
  129|       |
  130|       |  // If the caller supplied an output pointer, free the old one and replace it
  131|       |  // with |ret|. This differs from OpenSSL slightly in that we don't support
  132|       |  // object reuse. We run this on both success and failure. On failure, even
  133|       |  // with object reuse, OpenSSL destroys the previous object.
  134|  28.1k|  if (pval != NULL) {
  ------------------
  |  Branch (134:7): [True: 0, False: 28.1k]
  ------------------
  135|      0|    ASN1_item_ex_free(pval, it);
  136|      0|    *pval = ret;
  137|      0|  }
  138|  28.1k|  return ret;
  139|  28.1k|}
ASN1_item_ex_d2i:
  449|  84.3k|                     CRYPTO_BUFFER *buf) {
  450|  84.3k|  return asn1_item_ex_d2i(pval, in, len, it, tag, aclass, opt, buf,
  451|  84.3k|                          /*depth=*/0);
  452|  84.3k|}
tasn_dec.cc:_ZL16asn1_item_ex_d2iPP13ASN1_VALUE_stPPKhlPK12ASN1_ITEM_stiicP16crypto_buffer_sti:
  152|  1.32M|                            char opt, CRYPTO_BUFFER *buf, int depth) {
  153|  1.32M|  const ASN1_TEMPLATE *tt, *errtt = NULL;
  154|  1.32M|  const unsigned char *p = NULL, *q;
  155|  1.32M|  unsigned char oclass;
  156|  1.32M|  char cst, isopt;
  157|  1.32M|  int i;
  158|  1.32M|  int otag;
  159|  1.32M|  int ret = 0;
  160|  1.32M|  ASN1_VALUE **pchptr;
  161|  1.32M|  if (!pval) {
  ------------------
  |  Branch (161:7): [True: 0, False: 1.32M]
  ------------------
  162|      0|    return 0;
  163|      0|  }
  164|       |
  165|  1.32M|  if (buf != NULL) {
  ------------------
  |  Branch (165:7): [True: 956k, False: 365k]
  ------------------
  166|   956k|    assert(CRYPTO_BUFFER_data(buf) <= *in &&
  167|   956k|           *in + len <= CRYPTO_BUFFER_data(buf) + CRYPTO_BUFFER_len(buf));
  168|   956k|  }
  169|       |
  170|       |  // Bound |len| to comfortably fit in an int. Lengths in this module often
  171|       |  // switch between int and long without overflow checks.
  172|  1.32M|  if (len > INT_MAX / 2) {
  ------------------
  |  Branch (172:7): [True: 0, False: 1.32M]
  ------------------
  173|      0|    len = INT_MAX / 2;
  174|      0|  }
  175|       |
  176|  1.32M|  if (++depth > ASN1_MAX_CONSTRUCTED_NEST) {
  ------------------
  |  |   34|  1.32M|#define ASN1_MAX_CONSTRUCTED_NEST 30
  ------------------
  |  Branch (176:7): [True: 0, False: 1.32M]
  ------------------
  177|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_TOO_DEEP);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  178|      0|    goto err;
  179|      0|  }
  180|       |
  181|  1.32M|  switch (it->itype) {
  182|   871k|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  418|   871k|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (182:5): [True: 871k, False: 449k]
  ------------------
  183|   871k|      if (it->templates) {
  ------------------
  |  Branch (183:11): [True: 112k, False: 759k]
  ------------------
  184|       |        // tagging or OPTIONAL is currently illegal on an item template
  185|       |        // because the flags can't get passed down. In practice this
  186|       |        // isn't a problem: we include the relevant flags from the item
  187|       |        // template in the template itself.
  188|   112k|        if ((tag != -1) || opt) {
  ------------------
  |  Branch (188:13): [True: 0, False: 112k]
  |  Branch (188:28): [True: 0, False: 112k]
  ------------------
  189|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  190|      0|          goto err;
  191|      0|        }
  192|   112k|        return asn1_template_ex_d2i(pval, in, len, it->templates, opt, buf,
  193|   112k|                                    depth);
  194|   112k|      }
  195|   759k|      return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt);
  196|      0|      break;
  197|       |
  198|  56.2k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  426|  56.2k|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (198:5): [True: 56.2k, False: 1.26M]
  ------------------
  199|       |      // It never makes sense for multi-strings to have implicit tagging, so
  200|       |      // if tag != -1, then this looks like an error in the template.
  201|  56.2k|      if (tag != -1) {
  ------------------
  |  Branch (201:11): [True: 0, False: 56.2k]
  ------------------
  202|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  203|      0|        goto err;
  204|      0|      }
  205|       |
  206|  56.2k|      p = *in;
  207|       |      // Just read in tag and class
  208|  56.2k|      ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, &p, len, -1, 0, 1);
  209|  56.2k|      if (!ret) {
  ------------------
  |  Branch (209:11): [True: 0, False: 56.2k]
  ------------------
  210|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  211|      0|        goto err;
  212|      0|      }
  213|       |
  214|       |      // Must be UNIVERSAL class
  215|  56.2k|      if (oclass != V_ASN1_UNIVERSAL) {
  ------------------
  |  |   49|  56.2k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  |  Branch (215:11): [True: 0, False: 56.2k]
  ------------------
  216|       |        // If OPTIONAL, assume this is OK
  217|      0|        if (opt) {
  ------------------
  |  Branch (217:13): [True: 0, False: 0]
  ------------------
  218|      0|          return -1;
  219|      0|        }
  220|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_MSTRING_NOT_UNIVERSAL);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  221|      0|        goto err;
  222|      0|      }
  223|       |      // Check tag matches bit map
  224|  56.2k|      if (!(ASN1_tag2bit(otag) & it->utype)) {
  ------------------
  |  Branch (224:11): [True: 0, False: 56.2k]
  ------------------
  225|       |        // If OPTIONAL, assume this is OK
  226|      0|        if (opt) {
  ------------------
  |  Branch (226:13): [True: 0, False: 0]
  ------------------
  227|      0|          return -1;
  228|      0|        }
  229|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_MSTRING_WRONG_TAG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  230|      0|        goto err;
  231|      0|      }
  232|  56.2k|      return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0);
  233|       |
  234|  56.2k|    case ASN1_ITYPE_EXTERN: {
  ------------------
  |  |  424|  56.2k|#define ASN1_ITYPE_EXTERN 0x4
  ------------------
  |  Branch (234:5): [True: 56.2k, False: 1.26M]
  ------------------
  235|       |      // We don't support implicit tagging with external types.
  236|  56.2k|      if (tag != -1) {
  ------------------
  |  Branch (236:11): [True: 0, False: 56.2k]
  ------------------
  237|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  238|      0|        goto err;
  239|      0|      }
  240|  56.2k|      const ASN1_EXTERN_FUNCS *ef =
  241|  56.2k|          reinterpret_cast<const ASN1_EXTERN_FUNCS *>(it->funcs);
  242|  56.2k|      return ef->asn1_ex_d2i(pval, in, len, it, opt, NULL);
  243|  56.2k|    }
  244|       |
  245|      0|    case ASN1_ITYPE_CHOICE: {
  ------------------
  |  |  422|      0|#define ASN1_ITYPE_CHOICE 0x2
  ------------------
  |  Branch (245:5): [True: 0, False: 1.32M]
  ------------------
  246|       |      // It never makes sense for CHOICE types to have implicit tagging, so if
  247|       |      // tag != -1, then this looks like an error in the template.
  248|      0|      if (tag != -1) {
  ------------------
  |  Branch (248:11): [True: 0, False: 0]
  ------------------
  249|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  250|      0|        goto err;
  251|      0|      }
  252|       |
  253|      0|      const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
  254|      0|      ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (254:30): [True: 0, False: 0]
  ------------------
  255|      0|      if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) {
  ------------------
  |  |  472|      0|#define ASN1_OP_D2I_PRE 4
  ------------------
  |  Branch (255:11): [True: 0, False: 0]
  |  Branch (255:22): [True: 0, False: 0]
  ------------------
  256|      0|        goto auxerr;
  257|      0|      }
  258|       |
  259|      0|      if (*pval) {
  ------------------
  |  Branch (259:11): [True: 0, False: 0]
  ------------------
  260|       |        // Free up and zero CHOICE value if initialised
  261|      0|        i = asn1_get_choice_selector(pval, it);
  262|      0|        if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (262:13): [True: 0, False: 0]
  |  Branch (262:25): [True: 0, False: 0]
  ------------------
  263|      0|          tt = it->templates + i;
  264|      0|          pchptr = asn1_get_field_ptr(pval, tt);
  265|      0|          ASN1_template_free(pchptr, tt);
  266|      0|          asn1_set_choice_selector(pval, -1, it);
  267|      0|        }
  268|      0|      } else if (!ASN1_item_ex_new(pval, it)) {
  ------------------
  |  Branch (268:18): [True: 0, False: 0]
  ------------------
  269|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  270|      0|        goto err;
  271|      0|      }
  272|       |      // CHOICE type, try each possibility in turn
  273|      0|      p = *in;
  274|      0|      for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (274:39): [True: 0, False: 0]
  ------------------
  275|      0|        pchptr = asn1_get_field_ptr(pval, tt);
  276|       |        // We mark field as OPTIONAL so its absence can be recognised.
  277|      0|        ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, buf, depth);
  278|       |        // If field not present, try the next one
  279|      0|        if (ret == -1) {
  ------------------
  |  Branch (279:13): [True: 0, False: 0]
  ------------------
  280|      0|          continue;
  281|      0|        }
  282|       |        // If positive return, read OK, break loop
  283|      0|        if (ret > 0) {
  ------------------
  |  Branch (283:13): [True: 0, False: 0]
  ------------------
  284|      0|          break;
  285|      0|        }
  286|       |        // Otherwise must be an ASN1 parsing error
  287|      0|        errtt = tt;
  288|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  289|      0|        goto err;
  290|      0|      }
  291|       |
  292|       |      // Did we fall off the end without reading anything?
  293|      0|      if (i == it->tcount) {
  ------------------
  |  Branch (293:11): [True: 0, False: 0]
  ------------------
  294|       |        // If OPTIONAL, this is OK
  295|      0|        if (opt) {
  ------------------
  |  Branch (295:13): [True: 0, False: 0]
  ------------------
  296|       |          // Free and zero it
  297|      0|          ASN1_item_ex_free(pval, it);
  298|      0|          return -1;
  299|      0|        }
  300|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NO_MATCHING_CHOICE_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  301|      0|        goto err;
  302|      0|      }
  303|       |
  304|      0|      asn1_set_choice_selector(pval, i, it);
  305|      0|      if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) {
  ------------------
  |  |  473|      0|#define ASN1_OP_D2I_POST 5
  ------------------
  |  Branch (305:11): [True: 0, False: 0]
  |  Branch (305:22): [True: 0, False: 0]
  ------------------
  306|      0|        goto auxerr;
  307|      0|      }
  308|      0|      *in = p;
  309|      0|      return 1;
  310|      0|    }
  311|       |
  312|   337k|    case ASN1_ITYPE_SEQUENCE: {
  ------------------
  |  |  420|   337k|#define ASN1_ITYPE_SEQUENCE 0x1
  ------------------
  |  Branch (312:5): [True: 337k, False: 984k]
  ------------------
  313|   337k|      p = *in;
  314|       |
  315|       |      // If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL
  316|   337k|      if (tag == -1) {
  ------------------
  |  Branch (316:11): [True: 337k, False: 0]
  ------------------
  317|   337k|        tag = V_ASN1_SEQUENCE;
  ------------------
  |  |   97|   337k|#define V_ASN1_SEQUENCE 16
  ------------------
  318|   337k|        aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   49|   337k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  319|   337k|      }
  320|       |      // Get SEQUENCE length and update len, p
  321|   337k|      ret = asn1_check_tlen(&len, NULL, NULL, &cst, &p, len, tag, aclass, opt);
  322|   337k|      if (!ret) {
  ------------------
  |  Branch (322:11): [True: 0, False: 337k]
  ------------------
  323|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  324|      0|        goto err;
  325|   337k|      } else if (ret == -1) {
  ------------------
  |  Branch (325:18): [True: 0, False: 337k]
  ------------------
  326|      0|        return -1;
  327|      0|      }
  328|   337k|      if (!cst) {
  ------------------
  |  Branch (328:11): [True: 0, False: 337k]
  ------------------
  329|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  330|      0|        goto err;
  331|      0|      }
  332|       |
  333|   337k|      if (!*pval && !ASN1_item_ex_new(pval, it)) {
  ------------------
  |  Branch (333:11): [True: 224k, False: 112k]
  |  Branch (333:21): [True: 0, False: 224k]
  ------------------
  334|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  335|      0|        goto err;
  336|      0|      }
  337|       |
  338|   337k|      const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
  339|   337k|      ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (339:30): [True: 56.2k, False: 281k]
  ------------------
  340|   337k|      if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) {
  ------------------
  |  |  472|  28.1k|#define ASN1_OP_D2I_PRE 4
  ------------------
  |  Branch (340:11): [True: 28.1k, False: 309k]
  |  Branch (340:22): [True: 0, False: 28.1k]
  ------------------
  341|      0|        goto auxerr;
  342|      0|      }
  343|       |
  344|       |      // Free up and zero any ADB found
  345|  1.34M|      for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (345:39): [True: 1.01M, False: 337k]
  ------------------
  346|  1.01M|        if (tt->flags & ASN1_TFLG_ADB_MASK) {
  ------------------
  |  |  365|  1.01M|#define ASN1_TFLG_ADB_MASK (0x3 << 8)
  ------------------
  |  Branch (346:13): [True: 0, False: 1.01M]
  ------------------
  347|      0|          const ASN1_TEMPLATE *seqtt;
  348|      0|          ASN1_VALUE **pseqval;
  349|      0|          seqtt = asn1_do_adb(pval, tt, 0);
  350|      0|          if (seqtt == NULL) {
  ------------------
  |  Branch (350:15): [True: 0, False: 0]
  ------------------
  351|      0|            continue;
  352|      0|          }
  353|      0|          pseqval = asn1_get_field_ptr(pval, seqtt);
  354|      0|          ASN1_template_free(pseqval, seqtt);
  355|      0|        }
  356|  1.01M|      }
  357|       |
  358|       |      // Get each field entry
  359|  1.34M|      for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (359:39): [True: 1.01M, False: 337k]
  ------------------
  360|  1.01M|        const ASN1_TEMPLATE *seqtt;
  361|  1.01M|        ASN1_VALUE **pseqval;
  362|  1.01M|        seqtt = asn1_do_adb(pval, tt, 1);
  363|  1.01M|        if (seqtt == NULL) {
  ------------------
  |  Branch (363:13): [True: 0, False: 1.01M]
  ------------------
  364|      0|          goto err;
  365|      0|        }
  366|  1.01M|        pseqval = asn1_get_field_ptr(pval, seqtt);
  367|       |        // Have we ran out of data?
  368|  1.01M|        if (!len) {
  ------------------
  |  Branch (368:13): [True: 0, False: 1.01M]
  ------------------
  369|      0|          break;
  370|      0|        }
  371|  1.01M|        q = p;
  372|       |        // This determines the OPTIONAL flag value. The field cannot be
  373|       |        // omitted if it is the last of a SEQUENCE and there is still
  374|       |        // data to be read. This isn't strictly necessary but it
  375|       |        // increases efficiency in some cases.
  376|  1.01M|        if (i == (it->tcount - 1)) {
  ------------------
  |  Branch (376:13): [True: 337k, False: 674k]
  ------------------
  377|   337k|          isopt = 0;
  378|   674k|        } else {
  379|   674k|          isopt = (seqtt->flags & ASN1_TFLG_OPTIONAL) != 0;
  ------------------
  |  |  311|   674k|#define ASN1_TFLG_OPTIONAL (0x1)
  ------------------
  380|   674k|        }
  381|       |        // attempt to read in field, allowing each to be OPTIONAL
  382|       |
  383|  1.01M|        ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, buf, depth);
  384|  1.01M|        if (!ret) {
  ------------------
  |  Branch (384:13): [True: 0, False: 1.01M]
  ------------------
  385|      0|          errtt = seqtt;
  386|      0|          goto err;
  387|  1.01M|        } else if (ret == -1) {
  ------------------
  |  Branch (387:20): [True: 112k, False: 899k]
  ------------------
  388|       |          // OPTIONAL component absent. Free and zero the field.
  389|   112k|          ASN1_template_free(pseqval, seqtt);
  390|   112k|          continue;
  391|   112k|        }
  392|       |        // Update length
  393|   899k|        len -= p - q;
  394|   899k|      }
  395|       |
  396|       |      // Check all data read
  397|   337k|      if (len) {
  ------------------
  |  Branch (397:11): [True: 0, False: 337k]
  ------------------
  398|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_SEQUENCE_LENGTH_MISMATCH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  399|      0|        goto err;
  400|      0|      }
  401|       |
  402|       |      // If we get here we've got no more data in the SEQUENCE, however we
  403|       |      // may not have read all fields so check all remaining are OPTIONAL
  404|       |      // and clear any that are.
  405|   337k|      for (; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (405:14): [True: 0, False: 337k]
  ------------------
  406|      0|        const ASN1_TEMPLATE *seqtt;
  407|      0|        seqtt = asn1_do_adb(pval, tt, 1);
  408|      0|        if (seqtt == NULL) {
  ------------------
  |  Branch (408:13): [True: 0, False: 0]
  ------------------
  409|      0|          goto err;
  410|      0|        }
  411|      0|        if (seqtt->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  311|      0|#define ASN1_TFLG_OPTIONAL (0x1)
  ------------------
  |  Branch (411:13): [True: 0, False: 0]
  ------------------
  412|      0|          ASN1_VALUE **pseqval;
  413|      0|          pseqval = asn1_get_field_ptr(pval, seqtt);
  414|      0|          ASN1_template_free(pseqval, seqtt);
  415|      0|        } else {
  416|      0|          errtt = seqtt;
  417|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_FIELD_MISSING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  418|      0|          goto err;
  419|      0|        }
  420|      0|      }
  421|       |      // Save encoding
  422|   337k|      if (!asn1_enc_save(pval, *in, p - *in, it, buf)) {
  ------------------
  |  Branch (422:11): [True: 0, False: 337k]
  ------------------
  423|      0|        goto auxerr;
  424|      0|      }
  425|   337k|      if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) {
  ------------------
  |  |  473|  28.1k|#define ASN1_OP_D2I_POST 5
  ------------------
  |  Branch (425:11): [True: 28.1k, False: 309k]
  |  Branch (425:22): [True: 0, False: 28.1k]
  ------------------
  426|      0|        goto auxerr;
  427|      0|      }
  428|   337k|      *in = p;
  429|   337k|      return 1;
  430|   337k|    }
  431|       |
  432|      0|    default:
  ------------------
  |  Branch (432:5): [True: 0, False: 1.32M]
  ------------------
  433|      0|      return 0;
  434|  1.32M|  }
  435|      0|auxerr:
  436|      0|  OPENSSL_PUT_ERROR(ASN1, ASN1_R_AUX_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  437|      0|err:
  438|      0|  ASN1_item_ex_free(pval, it);
  439|      0|  if (errtt) {
  ------------------
  |  Branch (439:7): [True: 0, False: 0]
  ------------------
  440|      0|    ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);
  441|      0|  } else {
  442|      0|    ERR_add_error_data(2, "Type=", it->sname);
  443|      0|  }
  444|      0|  return 0;
  445|      0|}
tasn_dec.cc:_ZL20asn1_template_ex_d2iPP13ASN1_VALUE_stPPKhlPK16ASN1_TEMPLATE_stcP16crypto_buffer_sti:
  459|  1.12M|                                CRYPTO_BUFFER *buf, int depth) {
  460|  1.12M|  int aclass;
  461|  1.12M|  int ret;
  462|  1.12M|  long len;
  463|  1.12M|  const unsigned char *p, *q;
  464|  1.12M|  if (!val) {
  ------------------
  |  Branch (464:7): [True: 0, False: 1.12M]
  ------------------
  465|      0|    return 0;
  466|      0|  }
  467|  1.12M|  uint32_t flags = tt->flags;
  468|  1.12M|  aclass = flags & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  357|  1.12M|#define ASN1_TFLG_TAG_CLASS (0x3 << 6)
  ------------------
  469|       |
  470|  1.12M|  p = *in;
  471|       |
  472|       |  // Check if EXPLICIT tag expected
  473|  1.12M|  if (flags & ASN1_TFLG_EXPTAG) {
  ------------------
  |  |  332|  1.12M|#define ASN1_TFLG_EXPTAG (0x2 << 3)
  ------------------
  |  Branch (473:7): [True: 56.2k, False: 1.06M]
  ------------------
  474|  56.2k|    char cst;
  475|       |    // Need to work out amount of data available to the inner content and
  476|       |    // where it starts: so read in EXPLICIT header to get the info.
  477|  56.2k|    ret = asn1_check_tlen(&len, NULL, NULL, &cst, &p, inlen, tt->tag, aclass,
  478|  56.2k|                          opt);
  479|  56.2k|    q = p;
  480|  56.2k|    if (!ret) {
  ------------------
  |  Branch (480:9): [True: 0, False: 56.2k]
  ------------------
  481|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  482|      0|      return 0;
  483|  56.2k|    } else if (ret == -1) {
  ------------------
  |  Branch (483:16): [True: 0, False: 56.2k]
  ------------------
  484|      0|      return -1;
  485|      0|    }
  486|  56.2k|    if (!cst) {
  ------------------
  |  Branch (486:9): [True: 0, False: 56.2k]
  ------------------
  487|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  488|      0|      return 0;
  489|      0|    }
  490|       |    // We've found the field so it can't be OPTIONAL now
  491|  56.2k|    ret = asn1_template_noexp_d2i(val, &p, len, tt, /*opt=*/0, buf, depth);
  492|  56.2k|    if (!ret) {
  ------------------
  |  Branch (492:9): [True: 0, False: 56.2k]
  ------------------
  493|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  494|      0|      return 0;
  495|      0|    }
  496|       |    // We read the field in OK so update length
  497|  56.2k|    len -= p - q;
  498|       |    // Check for trailing data.
  499|  56.2k|    if (len) {
  ------------------
  |  Branch (499:9): [True: 0, False: 56.2k]
  ------------------
  500|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_EXPLICIT_LENGTH_MISMATCH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  501|      0|      goto err;
  502|      0|    }
  503|  1.06M|  } else {
  504|  1.06M|    return asn1_template_noexp_d2i(val, in, inlen, tt, opt, buf, depth);
  505|  1.06M|  }
  506|       |
  507|  56.2k|  *in = p;
  508|  56.2k|  return 1;
  509|       |
  510|      0|err:
  511|      0|  ASN1_template_free(val, tt);
  512|      0|  return 0;
  513|  1.12M|}
tasn_dec.cc:_ZL23asn1_template_noexp_d2iPP13ASN1_VALUE_stPPKhlPK16ASN1_TEMPLATE_stcP16crypto_buffer_sti:
  517|  1.12M|                                   CRYPTO_BUFFER *buf, int depth) {
  518|  1.12M|  int aclass;
  519|  1.12M|  int ret;
  520|  1.12M|  const unsigned char *p;
  521|  1.12M|  if (!val) {
  ------------------
  |  Branch (521:7): [True: 0, False: 1.12M]
  ------------------
  522|      0|    return 0;
  523|      0|  }
  524|  1.12M|  uint32_t flags = tt->flags;
  525|  1.12M|  aclass = flags & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  357|  1.12M|#define ASN1_TFLG_TAG_CLASS (0x3 << 6)
  ------------------
  526|       |
  527|  1.12M|  p = *in;
  528|       |
  529|  1.12M|  if (flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  320|  1.12M|#define ASN1_TFLG_SK_MASK (0x3 << 1)
  ------------------
  |  Branch (529:7): [True: 140k, False: 984k]
  ------------------
  530|       |    // SET OF, SEQUENCE OF
  531|   140k|    int sktag, skaclass;
  532|       |    // First work out expected inner tag value
  533|   140k|    if (flags & ASN1_TFLG_IMPTAG) {
  ------------------
  |  |  328|   140k|#define ASN1_TFLG_IMPTAG (0x1 << 3)
  ------------------
  |  Branch (533:9): [True: 0, False: 140k]
  ------------------
  534|      0|      sktag = tt->tag;
  535|      0|      skaclass = aclass;
  536|   140k|    } else {
  537|   140k|      skaclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   49|   140k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  538|   140k|      if (flags & ASN1_TFLG_SET_OF) {
  ------------------
  |  |  314|   140k|#define ASN1_TFLG_SET_OF (0x1 << 1)
  ------------------
  |  Branch (538:11): [True: 56.2k, False: 84.3k]
  ------------------
  539|  56.2k|        sktag = V_ASN1_SET;
  ------------------
  |  |   98|  56.2k|#define V_ASN1_SET 17
  ------------------
  540|  84.3k|      } else {
  541|  84.3k|        sktag = V_ASN1_SEQUENCE;
  ------------------
  |  |   97|  84.3k|#define V_ASN1_SEQUENCE 16
  ------------------
  542|  84.3k|      }
  543|   140k|    }
  544|       |    // Get the tag
  545|   140k|    ret =
  546|   140k|        asn1_check_tlen(&len, NULL, NULL, NULL, &p, len, sktag, skaclass, opt);
  547|   140k|    if (!ret) {
  ------------------
  |  Branch (547:9): [True: 0, False: 140k]
  ------------------
  548|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  549|      0|      return 0;
  550|   140k|    } else if (ret == -1) {
  ------------------
  |  Branch (550:16): [True: 0, False: 140k]
  ------------------
  551|      0|      return -1;
  552|      0|    }
  553|   140k|    if (!*val) {
  ------------------
  |  Branch (553:9): [True: 140k, False: 0]
  ------------------
  554|   140k|      *val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();
  555|   140k|    } else {
  556|       |      // We've got a valid STACK: free up any items present
  557|      0|      STACK_OF(ASN1_VALUE) *sktmp = (STACK_OF(ASN1_VALUE) *)*val;
  ------------------
  |  |   39|      0|#define STACK_OF(type) struct stack_st_##type
  ------------------
  558|      0|      ASN1_VALUE *vtmp;
  559|      0|      while (sk_ASN1_VALUE_num(sktmp) > 0) {
  ------------------
  |  Branch (559:14): [True: 0, False: 0]
  ------------------
  560|      0|        vtmp = sk_ASN1_VALUE_pop(sktmp);
  561|      0|        ASN1_item_ex_free(&vtmp, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  241|      0|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  562|      0|      }
  563|      0|    }
  564|       |
  565|   140k|    if (!*val) {
  ------------------
  |  Branch (565:9): [True: 0, False: 140k]
  ------------------
  566|      0|      goto err;
  567|      0|    }
  568|       |
  569|       |    // Read as many items as we can
  570|   365k|    while (len > 0) {
  ------------------
  |  Branch (570:12): [True: 224k, False: 140k]
  ------------------
  571|   224k|      ASN1_VALUE *skfield;
  572|   224k|      const unsigned char *q = p;
  573|   224k|      skfield = NULL;
  574|   224k|      if (!asn1_item_ex_d2i(&skfield, &p, len, ASN1_ITEM_ptr(tt->item),
  ------------------
  |  |  241|   224k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  |  Branch (574:11): [True: 0, False: 224k]
  ------------------
  575|   224k|                            /*tag=*/-1, /*aclass=*/0, /*opt=*/0, buf, depth)) {
  576|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  577|      0|        goto err;
  578|      0|      }
  579|   224k|      len -= p - q;
  580|   224k|      if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) {
  ------------------
  |  Branch (580:11): [True: 0, False: 224k]
  ------------------
  581|      0|        ASN1_item_ex_free(&skfield, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  241|      0|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  582|      0|        goto err;
  583|      0|      }
  584|   224k|    }
  585|   984k|  } else if (flags & ASN1_TFLG_IMPTAG) {
  ------------------
  |  |  328|   984k|#define ASN1_TFLG_IMPTAG (0x1 << 3)
  ------------------
  |  Branch (585:14): [True: 56.2k, False: 928k]
  ------------------
  586|       |    // IMPLICIT tagging
  587|  56.2k|    ret = asn1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), tt->tag,
  ------------------
  |  |  241|  56.2k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  588|  56.2k|                           aclass, opt, buf, depth);
  589|  56.2k|    if (!ret) {
  ------------------
  |  Branch (589:9): [True: 0, False: 56.2k]
  ------------------
  590|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  591|      0|      goto err;
  592|  56.2k|    } else if (ret == -1) {
  ------------------
  |  Branch (592:16): [True: 56.2k, False: 0]
  ------------------
  593|  56.2k|      return -1;
  594|  56.2k|    }
  595|   928k|  } else {
  596|       |    // Nothing special
  597|   928k|    ret = asn1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), /*tag=*/-1,
  ------------------
  |  |  241|   928k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  598|   928k|                           /*aclass=*/0, opt, buf, depth);
  599|   928k|    if (!ret) {
  ------------------
  |  Branch (599:9): [True: 0, False: 928k]
  ------------------
  600|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  601|      0|      goto err;
  602|   928k|    } else if (ret == -1) {
  ------------------
  |  Branch (602:16): [True: 56.2k, False: 871k]
  ------------------
  603|  56.2k|      return -1;
  604|  56.2k|    }
  605|   928k|  }
  606|       |
  607|  1.01M|  *in = p;
  608|  1.01M|  return 1;
  609|       |
  610|      0|err:
  611|      0|  ASN1_template_free(val, tt);
  612|      0|  return 0;
  613|  1.12M|}
tasn_dec.cc:_ZL21asn1_d2i_ex_primitivePP13ASN1_VALUE_stPPKhlPK12ASN1_ITEM_stiic:
  617|   815k|                                 int aclass, char opt) {
  618|   815k|  int ret = 0, utype;
  619|   815k|  long plen;
  620|   815k|  char cst;
  621|   815k|  const unsigned char *p;
  622|   815k|  const unsigned char *cont = NULL;
  623|   815k|  long len;
  624|   815k|  if (!pval) {
  ------------------
  |  Branch (624:7): [True: 0, False: 815k]
  ------------------
  625|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_NULL);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  626|      0|    return 0;  // Should never happen
  627|      0|  }
  628|       |
  629|   815k|  assert(it->itype == ASN1_ITYPE_PRIMITIVE || it->itype == ASN1_ITYPE_MSTRING);
  630|   815k|  if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |  426|   815k|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (630:7): [True: 56.2k, False: 759k]
  ------------------
  631|  56.2k|    utype = tag;
  632|  56.2k|    tag = -1;
  633|   759k|  } else {
  634|   759k|    utype = it->utype;
  635|   759k|  }
  636|       |
  637|   815k|  if (utype == V_ASN1_ANY || utype == V_ASN1_ANY_AS_STRING) {
  ------------------
  |  |   78|  1.63M|#define V_ASN1_ANY (-4)
  ------------------
                if (utype == V_ASN1_ANY || utype == V_ASN1_ANY_AS_STRING) {
  ------------------
  |  |   82|   731k|#define V_ASN1_ANY_AS_STRING (-5)
  ------------------
  |  Branch (637:7): [True: 84.3k, False: 731k]
  |  Branch (637:30): [True: 56.2k, False: 674k]
  ------------------
  638|       |    // If type is ANY need to figure out type from tag
  639|   140k|    unsigned char oclass;
  640|   140k|    if (tag >= 0) {
  ------------------
  |  Branch (640:9): [True: 0, False: 140k]
  ------------------
  641|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_TAGGED_ANY);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  642|      0|      return 0;
  643|      0|    }
  644|   140k|    if (opt) {
  ------------------
  |  Branch (644:9): [True: 0, False: 140k]
  ------------------
  645|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_OPTIONAL_ANY);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  646|      0|      return 0;
  647|      0|    }
  648|   140k|    const int is_string = utype == V_ASN1_ANY_AS_STRING;
  ------------------
  |  |   82|   140k|#define V_ASN1_ANY_AS_STRING (-5)
  ------------------
  649|   140k|    p = *in;
  650|   140k|    ret = asn1_check_tlen(&plen, &utype, &oclass, &cst, &p, inlen, -1, 0, 0);
  651|   140k|    if (!ret) {
  ------------------
  |  Branch (651:9): [True: 0, False: 140k]
  ------------------
  652|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  653|      0|      return 0;
  654|      0|    }
  655|   140k|    if (!is_supported_universal_type(utype, oclass)) {
  ------------------
  |  Branch (655:9): [True: 0, False: 140k]
  ------------------
  656|      0|      utype = V_ASN1_OTHER;
  ------------------
  |  |   75|      0|#define V_ASN1_OTHER (-3)
  ------------------
  657|      0|    }
  658|       |    // These three types are not represented as |ASN1_STRING|, so they must be
  659|       |    // parsed separately and then treated as an opaque |V_ASN1_OTHER|.
  660|   140k|    if (is_string && (utype == V_ASN1_OBJECT || utype == V_ASN1_NULL ||
  ------------------
  |  |   91|   112k|#define V_ASN1_OBJECT 6
  ------------------
                  if (is_string && (utype == V_ASN1_OBJECT || utype == V_ASN1_NULL ||
  ------------------
  |  |   90|   112k|#define V_ASN1_NULL 5
  ------------------
  |  Branch (660:9): [True: 56.2k, False: 84.3k]
  |  Branch (660:23): [True: 0, False: 56.2k]
  |  Branch (660:49): [True: 0, False: 56.2k]
  ------------------
  661|  56.2k|                      utype == V_ASN1_BOOLEAN)) {
  ------------------
  |  |   86|  56.2k|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (661:23): [True: 0, False: 56.2k]
  ------------------
  662|      0|      if (cst) {
  ------------------
  |  Branch (662:11): [True: 0, False: 0]
  ------------------
  663|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_TYPE_NOT_PRIMITIVE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  664|      0|        return 0;
  665|      0|      }
  666|      0|      CBS cbs;
  667|      0|      CBS_init(&cbs, p, plen);
  668|      0|      if (utype == V_ASN1_OBJECT && !CBS_is_valid_asn1_oid(&cbs)) {
  ------------------
  |  |   91|      0|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (668:11): [True: 0, False: 0]
  |  Branch (668:37): [True: 0, False: 0]
  ------------------
  669|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_OBJECT_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  670|      0|        return 0;
  671|      0|      }
  672|      0|      if (utype == V_ASN1_NULL && CBS_len(&cbs) != 0) {
  ------------------
  |  |   90|      0|#define V_ASN1_NULL 5
  ------------------
  |  Branch (672:11): [True: 0, False: 0]
  |  Branch (672:35): [True: 0, False: 0]
  ------------------
  673|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NULL_IS_WRONG_LENGTH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  674|      0|        return 0;
  675|      0|      }
  676|      0|      if (utype == V_ASN1_BOOLEAN) {
  ------------------
  |  |   86|      0|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (676:11): [True: 0, False: 0]
  ------------------
  677|      0|        if (CBS_len(&cbs) != 1) {
  ------------------
  |  Branch (677:13): [True: 0, False: 0]
  ------------------
  678|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  679|      0|          return 0;
  680|      0|        }
  681|      0|        uint8_t v = CBS_data(&cbs)[0];
  682|      0|        if (v != 0 && v != 0xff) {
  ------------------
  |  Branch (682:13): [True: 0, False: 0]
  |  Branch (682:23): [True: 0, False: 0]
  ------------------
  683|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  684|      0|          return 0;
  685|      0|        }
  686|      0|      }
  687|      0|      utype = V_ASN1_OTHER;
  ------------------
  |  |   75|      0|#define V_ASN1_OTHER (-3)
  ------------------
  688|      0|    }
  689|   140k|  }
  690|   815k|  if (tag == -1) {
  ------------------
  |  Branch (690:7): [True: 759k, False: 56.2k]
  ------------------
  691|   759k|    tag = utype;
  692|   759k|    aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   49|   759k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  693|   759k|  }
  694|   815k|  p = *in;
  695|       |  // Check header
  696|   815k|  ret = asn1_check_tlen(&plen, NULL, NULL, &cst, &p, inlen, tag, aclass, opt);
  697|   815k|  if (!ret) {
  ------------------
  |  Branch (697:7): [True: 0, False: 815k]
  ------------------
  698|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  699|      0|    return 0;
  700|   815k|  } else if (ret == -1) {
  ------------------
  |  Branch (700:14): [True: 112k, False: 703k]
  ------------------
  701|   112k|    return -1;
  702|   112k|  }
  703|   703k|  ret = 0;
  704|       |  // SEQUENCE, SET and "OTHER" are left in encoded form
  705|   703k|  if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
  ------------------
  |  |   97|   703k|#define V_ASN1_SEQUENCE 16
  ------------------
                if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
  ------------------
  |  |   98|   703k|#define V_ASN1_SET 17
  ------------------
  |  Branch (705:7): [True: 0, False: 703k]
  |  Branch (705:37): [True: 0, False: 703k]
  ------------------
  706|   703k|      (utype == V_ASN1_OTHER)) {
  ------------------
  |  |   75|   703k|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (706:7): [True: 0, False: 703k]
  ------------------
  707|       |    // SEQUENCE and SET must be constructed
  708|      0|    if (utype != V_ASN1_OTHER && !cst) {
  ------------------
  |  |   75|      0|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (708:9): [True: 0, False: 0]
  |  Branch (708:34): [True: 0, False: 0]
  ------------------
  709|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_TYPE_NOT_CONSTRUCTED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  710|      0|      return 0;
  711|      0|    }
  712|       |
  713|      0|    cont = *in;
  714|      0|    len = p - cont + plen;
  715|      0|    p += plen;
  716|   703k|  } else if (cst) {
  ------------------
  |  Branch (716:14): [True: 0, False: 703k]
  ------------------
  717|       |    // This parser historically supported BER constructed strings. We no
  718|       |    // longer do and will gradually tighten this parser into a DER
  719|       |    // parser. BER types should use |CBS_asn1_ber_to_der|.
  720|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_TYPE_NOT_PRIMITIVE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  721|      0|    return 0;
  722|   703k|  } else {
  723|   703k|    cont = p;
  724|   703k|    len = plen;
  725|   703k|    p += plen;
  726|   703k|  }
  727|       |
  728|       |  // We now have content length and type: translate into a structure
  729|   703k|  if (!asn1_ex_c2i(pval, cont, len, utype, it)) {
  ------------------
  |  Branch (729:7): [True: 0, False: 703k]
  ------------------
  730|      0|    goto err;
  731|      0|  }
  732|       |
  733|   703k|  *in = p;
  734|   703k|  ret = 1;
  735|   703k|err:
  736|   703k|  return ret;
  737|   703k|}
tasn_dec.cc:_ZL27is_supported_universal_typeii:
   94|   140k|static int is_supported_universal_type(int tag, int aclass) {
   95|   140k|  if (aclass != V_ASN1_UNIVERSAL) {
  ------------------
  |  |   49|   140k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  |  Branch (95:7): [True: 0, False: 140k]
  ------------------
   96|      0|    return 0;
   97|      0|  }
   98|   140k|  return tag == V_ASN1_OBJECT || tag == V_ASN1_NULL || tag == V_ASN1_BOOLEAN ||
  ------------------
  |  |   91|   281k|#define V_ASN1_OBJECT 6
  ------------------
                return tag == V_ASN1_OBJECT || tag == V_ASN1_NULL || tag == V_ASN1_BOOLEAN ||
  ------------------
  |  |   90|   281k|#define V_ASN1_NULL 5
  ------------------
                return tag == V_ASN1_OBJECT || tag == V_ASN1_NULL || tag == V_ASN1_BOOLEAN ||
  ------------------
  |  |   86|   196k|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (98:10): [True: 0, False: 140k]
  |  Branch (98:34): [True: 84.3k, False: 56.2k]
  |  Branch (98:56): [True: 0, False: 56.2k]
  ------------------
   99|   140k|         tag == V_ASN1_BIT_STRING || tag == V_ASN1_INTEGER ||
  ------------------
  |  |   88|   196k|#define V_ASN1_BIT_STRING 3
  ------------------
                       tag == V_ASN1_BIT_STRING || tag == V_ASN1_INTEGER ||
  ------------------
  |  |   87|   196k|#define V_ASN1_INTEGER 2
  ------------------
  |  Branch (99:10): [True: 0, False: 56.2k]
  |  Branch (99:38): [True: 0, False: 56.2k]
  ------------------
  100|   140k|         tag == V_ASN1_ENUMERATED || tag == V_ASN1_OCTET_STRING ||
  ------------------
  |  |   95|   196k|#define V_ASN1_ENUMERATED 10
  ------------------
                       tag == V_ASN1_ENUMERATED || tag == V_ASN1_OCTET_STRING ||
  ------------------
  |  |   89|   196k|#define V_ASN1_OCTET_STRING 4
  ------------------
  |  Branch (100:10): [True: 0, False: 56.2k]
  |  Branch (100:38): [True: 0, False: 56.2k]
  ------------------
  101|   140k|         tag == V_ASN1_NUMERICSTRING || tag == V_ASN1_PRINTABLESTRING ||
  ------------------
  |  |   99|   196k|#define V_ASN1_NUMERICSTRING 18
  ------------------
                       tag == V_ASN1_NUMERICSTRING || tag == V_ASN1_PRINTABLESTRING ||
  ------------------
  |  |  100|   196k|#define V_ASN1_PRINTABLESTRING 19
  ------------------
  |  Branch (101:10): [True: 0, False: 56.2k]
  |  Branch (101:41): [True: 56.2k, False: 0]
  ------------------
  102|   140k|         tag == V_ASN1_T61STRING || tag == V_ASN1_VIDEOTEXSTRING ||
  ------------------
  |  |  101|   140k|#define V_ASN1_T61STRING 20
  ------------------
                       tag == V_ASN1_T61STRING || tag == V_ASN1_VIDEOTEXSTRING ||
  ------------------
  |  |  103|   140k|#define V_ASN1_VIDEOTEXSTRING 21
  ------------------
  |  Branch (102:10): [True: 0, False: 0]
  |  Branch (102:37): [True: 0, False: 0]
  ------------------
  103|   140k|         tag == V_ASN1_IA5STRING || tag == V_ASN1_UTCTIME ||
  ------------------
  |  |  104|   140k|#define V_ASN1_IA5STRING 22
  ------------------
                       tag == V_ASN1_IA5STRING || tag == V_ASN1_UTCTIME ||
  ------------------
  |  |  105|   140k|#define V_ASN1_UTCTIME 23
  ------------------
  |  Branch (103:10): [True: 0, False: 0]
  |  Branch (103:37): [True: 0, False: 0]
  ------------------
  104|   140k|         tag == V_ASN1_GENERALIZEDTIME || tag == V_ASN1_GRAPHICSTRING ||
  ------------------
  |  |  106|   140k|#define V_ASN1_GENERALIZEDTIME 24
  ------------------
                       tag == V_ASN1_GENERALIZEDTIME || tag == V_ASN1_GRAPHICSTRING ||
  ------------------
  |  |  107|   140k|#define V_ASN1_GRAPHICSTRING 25
  ------------------
  |  Branch (104:10): [True: 0, False: 0]
  |  Branch (104:43): [True: 0, False: 0]
  ------------------
  105|   140k|         tag == V_ASN1_VISIBLESTRING || tag == V_ASN1_GENERALSTRING ||
  ------------------
  |  |  109|   140k|#define V_ASN1_VISIBLESTRING 26
  ------------------
                       tag == V_ASN1_VISIBLESTRING || tag == V_ASN1_GENERALSTRING ||
  ------------------
  |  |  110|   140k|#define V_ASN1_GENERALSTRING 27
  ------------------
  |  Branch (105:10): [True: 0, False: 0]
  |  Branch (105:41): [True: 0, False: 0]
  ------------------
  106|   140k|         tag == V_ASN1_UNIVERSALSTRING || tag == V_ASN1_BMPSTRING ||
  ------------------
  |  |  111|   140k|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
                       tag == V_ASN1_UNIVERSALSTRING || tag == V_ASN1_BMPSTRING ||
  ------------------
  |  |  112|   140k|#define V_ASN1_BMPSTRING 30
  ------------------
  |  Branch (106:10): [True: 0, False: 0]
  |  Branch (106:43): [True: 0, False: 0]
  ------------------
  107|   140k|         tag == V_ASN1_UTF8STRING || tag == V_ASN1_SET ||
  ------------------
  |  |   96|   140k|#define V_ASN1_UTF8STRING 12
  ------------------
                       tag == V_ASN1_UTF8STRING || tag == V_ASN1_SET ||
  ------------------
  |  |   98|   140k|#define V_ASN1_SET 17
  ------------------
  |  Branch (107:10): [True: 0, False: 0]
  |  Branch (107:38): [True: 0, False: 0]
  ------------------
  108|   140k|         tag == V_ASN1_SEQUENCE;
  ------------------
  |  |   97|   140k|#define V_ASN1_SEQUENCE 16
  ------------------
  |  Branch (108:10): [True: 0, False: 0]
  ------------------
  109|   140k|}
tasn_dec.cc:_ZL11asn1_ex_c2iPP13ASN1_VALUE_stPKhliPK12ASN1_ITEM_st:
  742|   703k|                       int utype, const ASN1_ITEM *it) {
  743|   703k|  ASN1_VALUE **opval = NULL;
  744|   703k|  ASN1_STRING *stmp;
  745|   703k|  ASN1_TYPE *typ = NULL;
  746|   703k|  int ret = 0;
  747|   703k|  ASN1_INTEGER **tint;
  748|       |
  749|       |  // Historically, |it->funcs| for primitive types contained an
  750|       |  // |ASN1_PRIMITIVE_FUNCS| table of callbacks.
  751|   703k|  assert(it->funcs == NULL);
  752|       |
  753|       |  // If ANY type clear type and set pointer to internal value
  754|   703k|  if (it->utype == V_ASN1_ANY) {
  ------------------
  |  |   78|   703k|#define V_ASN1_ANY (-4)
  ------------------
  |  Branch (754:7): [True: 84.3k, False: 618k]
  ------------------
  755|  84.3k|    if (!*pval) {
  ------------------
  |  Branch (755:9): [True: 84.3k, False: 0]
  ------------------
  756|  84.3k|      typ = ASN1_TYPE_new();
  757|  84.3k|      if (typ == NULL) {
  ------------------
  |  Branch (757:11): [True: 0, False: 84.3k]
  ------------------
  758|      0|        goto err;
  759|      0|      }
  760|  84.3k|      *pval = (ASN1_VALUE *)typ;
  761|  84.3k|    } else {
  762|      0|      typ = (ASN1_TYPE *)*pval;
  763|      0|    }
  764|       |
  765|  84.3k|    if (utype != typ->type) {
  ------------------
  |  Branch (765:9): [True: 84.3k, False: 0]
  ------------------
  766|  84.3k|      ASN1_TYPE_set(typ, utype, NULL);
  767|  84.3k|    }
  768|  84.3k|    opval = pval;
  769|  84.3k|    pval = &typ->value.asn1_value;
  770|  84.3k|  }
  771|       |
  772|       |  // If implementing a type that is not represented in |ASN1_STRING|, the
  773|       |  // |V_ASN1_ANY_AS_STRING| logic must be modified to redirect it to
  774|       |  // |V_ASN1_OTHER|.
  775|   703k|  switch (utype) {
  776|   253k|    case V_ASN1_OBJECT:
  ------------------
  |  |   91|   253k|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (776:5): [True: 253k, False: 449k]
  ------------------
  777|   253k|      if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len)) {
  ------------------
  |  Branch (777:11): [True: 0, False: 253k]
  ------------------
  778|      0|        goto err;
  779|      0|      }
  780|   253k|      break;
  781|       |
  782|   253k|    case V_ASN1_NULL:
  ------------------
  |  |   90|  84.3k|#define V_ASN1_NULL 5
  ------------------
  |  Branch (782:5): [True: 84.3k, False: 618k]
  ------------------
  783|  84.3k|      if (len) {
  ------------------
  |  Branch (783:11): [True: 0, False: 84.3k]
  ------------------
  784|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NULL_IS_WRONG_LENGTH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  785|      0|        goto err;
  786|      0|      }
  787|  84.3k|      *pval = (ASN1_VALUE *)1;
  788|  84.3k|      break;
  789|       |
  790|  56.2k|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   86|  56.2k|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (790:5): [True: 56.2k, False: 646k]
  ------------------
  791|  56.2k|      if (len != 1) {
  ------------------
  |  Branch (791:11): [True: 0, False: 56.2k]
  ------------------
  792|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  793|      0|        goto err;
  794|  56.2k|      } else {
  795|  56.2k|        ASN1_BOOLEAN *tbool;
  796|  56.2k|        tbool = (ASN1_BOOLEAN *)pval;
  797|  56.2k|        *tbool = *cont;
  798|  56.2k|      }
  799|  56.2k|      break;
  800|       |
  801|  56.2k|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   88|  28.1k|#define V_ASN1_BIT_STRING 3
  ------------------
  |  Branch (801:5): [True: 28.1k, False: 674k]
  ------------------
  802|  28.1k|      if (!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len)) {
  ------------------
  |  Branch (802:11): [True: 0, False: 28.1k]
  ------------------
  803|      0|        goto err;
  804|      0|      }
  805|  28.1k|      break;
  806|       |
  807|  56.2k|    case V_ASN1_INTEGER:
  ------------------
  |  |   87|  56.2k|#define V_ASN1_INTEGER 2
  ------------------
  |  Branch (807:5): [True: 56.2k, False: 646k]
  ------------------
  808|  56.2k|    case V_ASN1_ENUMERATED:
  ------------------
  |  |   95|  56.2k|#define V_ASN1_ENUMERATED 10
  ------------------
  |  Branch (808:5): [True: 0, False: 703k]
  ------------------
  809|  56.2k|      tint = (ASN1_INTEGER **)pval;
  810|  56.2k|      if (!c2i_ASN1_INTEGER(tint, &cont, len)) {
  ------------------
  |  Branch (810:11): [True: 0, False: 56.2k]
  ------------------
  811|      0|        goto err;
  812|      0|      }
  813|       |      // Fixup type to match the expected form
  814|  56.2k|      (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
  ------------------
  |  |  116|  56.2k|#define V_ASN1_NEG 0x100
  ------------------
  815|  56.2k|      break;
  816|       |
  817|   112k|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   89|   112k|#define V_ASN1_OCTET_STRING 4
  ------------------
  |  Branch (817:5): [True: 112k, False: 590k]
  ------------------
  818|   112k|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   99|   112k|#define V_ASN1_NUMERICSTRING 18
  ------------------
  |  Branch (818:5): [True: 0, False: 703k]
  ------------------
  819|   168k|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |  100|   168k|#define V_ASN1_PRINTABLESTRING 19
  ------------------
  |  Branch (819:5): [True: 56.2k, False: 646k]
  ------------------
  820|   168k|    case V_ASN1_T61STRING:
  ------------------
  |  |  101|   168k|#define V_ASN1_T61STRING 20
  ------------------
  |  Branch (820:5): [True: 0, False: 703k]
  ------------------
  821|   168k|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |  103|   168k|#define V_ASN1_VIDEOTEXSTRING 21
  ------------------
  |  Branch (821:5): [True: 0, False: 703k]
  ------------------
  822|   168k|    case V_ASN1_IA5STRING:
  ------------------
  |  |  104|   168k|#define V_ASN1_IA5STRING 22
  ------------------
  |  Branch (822:5): [True: 0, False: 703k]
  ------------------
  823|   224k|    case V_ASN1_UTCTIME:
  ------------------
  |  |  105|   224k|#define V_ASN1_UTCTIME 23
  ------------------
  |  Branch (823:5): [True: 56.2k, False: 646k]
  ------------------
  824|   224k|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |  106|   224k|#define V_ASN1_GENERALIZEDTIME 24
  ------------------
  |  Branch (824:5): [True: 0, False: 703k]
  ------------------
  825|   224k|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |  107|   224k|#define V_ASN1_GRAPHICSTRING 25
  ------------------
  |  Branch (825:5): [True: 0, False: 703k]
  ------------------
  826|   224k|    case V_ASN1_VISIBLESTRING:
  ------------------
  |  |  109|   224k|#define V_ASN1_VISIBLESTRING 26
  ------------------
  |  Branch (826:5): [True: 0, False: 703k]
  ------------------
  827|   224k|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |  110|   224k|#define V_ASN1_GENERALSTRING 27
  ------------------
  |  Branch (827:5): [True: 0, False: 703k]
  ------------------
  828|   224k|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |  111|   224k|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
  |  Branch (828:5): [True: 0, False: 703k]
  ------------------
  829|   224k|    case V_ASN1_BMPSTRING:
  ------------------
  |  |  112|   224k|#define V_ASN1_BMPSTRING 30
  ------------------
  |  Branch (829:5): [True: 0, False: 703k]
  ------------------
  830|   224k|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   96|   224k|#define V_ASN1_UTF8STRING 12
  ------------------
  |  Branch (830:5): [True: 0, False: 703k]
  ------------------
  831|   224k|    case V_ASN1_OTHER:
  ------------------
  |  |   75|   224k|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (831:5): [True: 0, False: 703k]
  ------------------
  832|   224k|    case V_ASN1_SET:
  ------------------
  |  |   98|   224k|#define V_ASN1_SET 17
  ------------------
  |  Branch (832:5): [True: 0, False: 703k]
  ------------------
  833|   224k|    case V_ASN1_SEQUENCE: {
  ------------------
  |  |   97|   224k|#define V_ASN1_SEQUENCE 16
  ------------------
  |  Branch (833:5): [True: 0, False: 703k]
  ------------------
  834|   224k|      CBS cbs;
  835|   224k|      CBS_init(&cbs, cont, (size_t)len);
  836|   224k|      if (utype == V_ASN1_BMPSTRING) {
  ------------------
  |  |  112|   224k|#define V_ASN1_BMPSTRING 30
  ------------------
  |  Branch (836:11): [True: 0, False: 224k]
  ------------------
  837|      0|        while (CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (837:16): [True: 0, False: 0]
  ------------------
  838|      0|          uint32_t c;
  839|      0|          if (!CBS_get_ucs2_be(&cbs, &c)) {
  ------------------
  |  Branch (839:15): [True: 0, False: 0]
  ------------------
  840|      0|            OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_BMPSTRING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  841|      0|            goto err;
  842|      0|          }
  843|      0|        }
  844|      0|      }
  845|   224k|      if (utype == V_ASN1_UNIVERSALSTRING) {
  ------------------
  |  |  111|   224k|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
  |  Branch (845:11): [True: 0, False: 224k]
  ------------------
  846|      0|        while (CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (846:16): [True: 0, False: 0]
  ------------------
  847|      0|          uint32_t c;
  848|      0|          if (!CBS_get_utf32_be(&cbs, &c)) {
  ------------------
  |  Branch (848:15): [True: 0, False: 0]
  ------------------
  849|      0|            OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_UNIVERSALSTRING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  850|      0|            goto err;
  851|      0|          }
  852|      0|        }
  853|      0|      }
  854|   224k|      if (utype == V_ASN1_UTF8STRING) {
  ------------------
  |  |   96|   224k|#define V_ASN1_UTF8STRING 12
  ------------------
  |  Branch (854:11): [True: 0, False: 224k]
  ------------------
  855|      0|        while (CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (855:16): [True: 0, False: 0]
  ------------------
  856|      0|          uint32_t c;
  857|      0|          if (!CBS_get_utf8(&cbs, &c)) {
  ------------------
  |  Branch (857:15): [True: 0, False: 0]
  ------------------
  858|      0|            OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_UTF8STRING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  859|      0|            goto err;
  860|      0|          }
  861|      0|        }
  862|      0|      }
  863|   224k|      if (utype == V_ASN1_UTCTIME) {
  ------------------
  |  |  105|   224k|#define V_ASN1_UTCTIME 23
  ------------------
  |  Branch (863:11): [True: 56.2k, False: 168k]
  ------------------
  864|  56.2k|        if (!CBS_parse_utc_time(&cbs, NULL, /*allow_timezone_offset=*/1)) {
  ------------------
  |  Branch (864:13): [True: 0, False: 56.2k]
  ------------------
  865|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_TIME_FORMAT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  866|      0|          goto err;
  867|      0|        }
  868|  56.2k|      }
  869|   224k|      if (utype == V_ASN1_GENERALIZEDTIME) {
  ------------------
  |  |  106|   224k|#define V_ASN1_GENERALIZEDTIME 24
  ------------------
  |  Branch (869:11): [True: 0, False: 224k]
  ------------------
  870|      0|        if (!CBS_parse_generalized_time(&cbs, NULL,
  ------------------
  |  Branch (870:13): [True: 0, False: 0]
  ------------------
  871|      0|                                        /*allow_timezone_offset=*/0)) {
  872|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_INVALID_TIME_FORMAT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  873|      0|          goto err;
  874|      0|        }
  875|      0|      }
  876|       |      // TODO(https://crbug.com/boringssl/427): Check other string types.
  877|       |
  878|       |      // All based on ASN1_STRING and handled the same
  879|   224k|      if (!*pval) {
  ------------------
  |  Branch (879:11): [True: 0, False: 224k]
  ------------------
  880|      0|        stmp = ASN1_STRING_type_new(utype);
  881|      0|        if (!stmp) {
  ------------------
  |  Branch (881:13): [True: 0, False: 0]
  ------------------
  882|      0|          goto err;
  883|      0|        }
  884|      0|        *pval = (ASN1_VALUE *)stmp;
  885|   224k|      } else {
  886|   224k|        stmp = (ASN1_STRING *)*pval;
  887|   224k|        stmp->type = utype;
  888|   224k|      }
  889|   224k|      if (!ASN1_STRING_set(stmp, cont, len)) {
  ------------------
  |  Branch (889:11): [True: 0, False: 224k]
  ------------------
  890|      0|        ASN1_STRING_free(stmp);
  891|      0|        *pval = NULL;
  892|      0|        goto err;
  893|      0|      }
  894|   224k|      break;
  895|   224k|    }
  896|       |
  897|   224k|    default:
  ------------------
  |  Branch (897:5): [True: 0, False: 703k]
  ------------------
  898|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  899|      0|      goto err;
  900|   703k|  }
  901|       |  // If ASN1_ANY and NULL type fix up value
  902|   703k|  if (typ && (utype == V_ASN1_NULL)) {
  ------------------
  |  |   90|  84.3k|#define V_ASN1_NULL 5
  ------------------
  |  Branch (902:7): [True: 84.3k, False: 618k]
  |  Branch (902:14): [True: 84.3k, False: 0]
  ------------------
  903|  84.3k|    typ->value.ptr = NULL;
  904|  84.3k|  }
  905|       |
  906|   703k|  ret = 1;
  907|   703k|err:
  908|   703k|  if (!ret) {
  ------------------
  |  Branch (908:7): [True: 0, False: 703k]
  ------------------
  909|      0|    ASN1_TYPE_free(typ);
  910|      0|    if (opval) {
  ------------------
  |  Branch (910:9): [True: 0, False: 0]
  ------------------
  911|      0|      *opval = NULL;
  912|      0|    }
  913|      0|  }
  914|   703k|  return ret;
  915|   703k|}
tasn_dec.cc:_ZL15asn1_check_tlenPlPiPhPcPPKhliic:
  922|  1.54M|                           int exptag, int expclass, char opt) {
  923|  1.54M|  int i;
  924|  1.54M|  int ptag, pclass;
  925|  1.54M|  long plen;
  926|  1.54M|  const unsigned char *p;
  927|  1.54M|  p = *in;
  928|       |
  929|  1.54M|  i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
  930|  1.54M|  if (i & 0x80) {
  ------------------
  |  Branch (930:7): [True: 0, False: 1.54M]
  ------------------
  931|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_OBJECT_HEADER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  932|      0|    return 0;
  933|      0|  }
  934|  1.54M|  if (exptag >= 0) {
  ------------------
  |  Branch (934:7): [True: 1.34M, False: 196k]
  ------------------
  935|  1.34M|    if ((exptag != ptag) || (expclass != pclass)) {
  ------------------
  |  Branch (935:9): [True: 112k, False: 1.23M]
  |  Branch (935:29): [True: 0, False: 1.23M]
  ------------------
  936|       |      // If type is OPTIONAL, not an error: indicate missing type.
  937|   112k|      if (opt) {
  ------------------
  |  Branch (937:11): [True: 112k, False: 0]
  ------------------
  938|   112k|        return -1;
  939|   112k|      }
  940|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_WRONG_TAG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  941|      0|      return 0;
  942|   112k|    }
  943|  1.34M|  }
  944|       |
  945|  1.43M|  if (cst) {
  ------------------
  |  Branch (945:7): [True: 1.23M, False: 196k]
  ------------------
  946|  1.23M|    *cst = i & V_ASN1_CONSTRUCTED;
  ------------------
  |  |   56|  1.23M|#define V_ASN1_CONSTRUCTED 0x20
  ------------------
  947|  1.23M|  }
  948|       |
  949|  1.43M|  if (olen) {
  ------------------
  |  Branch (949:7): [True: 1.37M, False: 56.2k]
  ------------------
  950|  1.37M|    *olen = plen;
  951|  1.37M|  }
  952|       |
  953|  1.43M|  if (oclass) {
  ------------------
  |  Branch (953:7): [True: 196k, False: 1.23M]
  ------------------
  954|   196k|    *oclass = pclass;
  955|   196k|  }
  956|       |
  957|  1.43M|  if (otag) {
  ------------------
  |  Branch (957:7): [True: 196k, False: 1.23M]
  ------------------
  958|   196k|    *otag = ptag;
  959|   196k|  }
  960|       |
  961|  1.43M|  *in = p;
  962|  1.43M|  return 1;
  963|  1.54M|}

ASN1_item_i2d:
   44|   100k|int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it) {
   45|   100k|  if (out && !*out) {
  ------------------
  |  Branch (45:7): [True: 65.7k, False: 34.2k]
  |  Branch (45:14): [True: 31.4k, False: 34.2k]
  ------------------
   46|  31.4k|    unsigned char *p, *buf;
   47|  31.4k|    int len = ASN1_item_ex_i2d(&val, NULL, it, /*tag=*/-1, /*aclass=*/0);
   48|  31.4k|    if (len <= 0) {
  ------------------
  |  Branch (48:9): [True: 0, False: 31.4k]
  ------------------
   49|      0|      return len;
   50|      0|    }
   51|  31.4k|    buf = reinterpret_cast<uint8_t *>(OPENSSL_malloc(len));
   52|  31.4k|    if (!buf) {
  ------------------
  |  Branch (52:9): [True: 0, False: 31.4k]
  ------------------
   53|      0|      return -1;
   54|      0|    }
   55|  31.4k|    p = buf;
   56|  31.4k|    int len2 = ASN1_item_ex_i2d(&val, &p, it, /*tag=*/-1, /*aclass=*/0);
   57|  31.4k|    if (len2 <= 0) {
  ------------------
  |  Branch (57:9): [True: 0, False: 31.4k]
  ------------------
   58|      0|      OPENSSL_free(buf);
   59|      0|      return len2;
   60|      0|    }
   61|  31.4k|    assert(len == len2);
   62|  31.4k|    *out = buf;
   63|  31.4k|    return len;
   64|  31.4k|  }
   65|       |
   66|  68.5k|  return ASN1_item_ex_i2d(&val, out, it, /*tag=*/-1, /*aclass=*/0);
   67|   100k|}
ASN1_item_ex_i2d:
   73|   412k|                     const ASN1_ITEM *it, int tag, int aclass) {
   74|   412k|  int ret = asn1_item_ex_i2d_opt(pval, out, it, tag, aclass, /*optional=*/0);
   75|   412k|  assert(ret != 0);
   76|   412k|  return ret;
   77|   412k|}
tasn_enc.cc:_ZL20asn1_item_ex_i2d_optPP13ASN1_VALUE_stPPhPK12ASN1_ITEM_stiii:
   83|  1.35M|                         int optional) {
   84|  1.35M|  const ASN1_TEMPLATE *tt = NULL;
   85|  1.35M|  int i, seqcontlen, seqlen;
   86|       |
   87|       |  // Historically, |aclass| was repurposed to pass additional flags into the
   88|       |  // encoding process.
   89|  1.35M|  assert((aclass & ASN1_TFLG_TAG_CLASS) == aclass);
   90|       |  // If not overridding the tag, |aclass| is ignored and should be zero.
   91|  1.35M|  assert(tag != -1 || aclass == 0);
   92|       |
   93|       |  // All fields are pointers, except for boolean |ASN1_ITYPE_PRIMITIVE|s.
   94|       |  // Optional primitives are handled later.
   95|  1.35M|  if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) {
  ------------------
  |  |  418|  1.35M|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (95:7): [True: 384k, False: 974k]
  |  Branch (95:46): [True: 0, False: 384k]
  ------------------
   96|      0|    if (optional) {
  ------------------
  |  Branch (96:9): [True: 0, False: 0]
  ------------------
   97|      0|      return 0;
   98|      0|    }
   99|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_MISSING_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  100|      0|    return -1;
  101|      0|  }
  102|       |
  103|  1.35M|  switch (it->itype) {
  104|   974k|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  418|   974k|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (104:5): [True: 974k, False: 384k]
  ------------------
  105|   974k|      if (it->templates) {
  ------------------
  |  Branch (105:11): [True: 112k, False: 862k]
  ------------------
  106|       |        // This is an |ASN1_ITEM_TEMPLATE|.
  107|   112k|        if (it->templates->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  311|   112k|#define ASN1_TFLG_OPTIONAL (0x1)
  ------------------
  |  Branch (107:13): [True: 0, False: 112k]
  ------------------
  108|      0|          OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  109|      0|          return -1;
  110|      0|        }
  111|   112k|        return asn1_template_ex_i2d(pval, out, it->templates, tag, aclass,
  112|   112k|                                    optional);
  113|   112k|      }
  114|   862k|      return asn1_i2d_ex_primitive(pval, out, it, tag, aclass, optional);
  115|       |
  116|      0|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  426|      0|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (116:5): [True: 0, False: 1.35M]
  ------------------
  117|       |      // It never makes sense for multi-strings to have implicit tagging, so
  118|       |      // if tag != -1, then this looks like an error in the template.
  119|      0|      if (tag != -1) {
  ------------------
  |  Branch (119:11): [True: 0, False: 0]
  ------------------
  120|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  121|      0|        return -1;
  122|      0|      }
  123|      0|      return asn1_i2d_ex_primitive(pval, out, it, -1, 0, optional);
  124|       |
  125|      0|    case ASN1_ITYPE_CHOICE: {
  ------------------
  |  |  422|      0|#define ASN1_ITYPE_CHOICE 0x2
  ------------------
  |  Branch (125:5): [True: 0, False: 1.35M]
  ------------------
  126|       |      // It never makes sense for CHOICE types to have implicit tagging, so if
  127|       |      // tag != -1, then this looks like an error in the template.
  128|      0|      if (tag != -1) {
  ------------------
  |  Branch (128:11): [True: 0, False: 0]
  ------------------
  129|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  130|      0|        return -1;
  131|      0|      }
  132|      0|      i = asn1_get_choice_selector(pval, it);
  133|      0|      if (i < 0 || i >= it->tcount) {
  ------------------
  |  Branch (133:11): [True: 0, False: 0]
  |  Branch (133:20): [True: 0, False: 0]
  ------------------
  134|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_NO_MATCHING_CHOICE_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  135|      0|        return -1;
  136|      0|      }
  137|      0|      const ASN1_TEMPLATE *chtt = it->templates + i;
  138|      0|      if (chtt->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  311|      0|#define ASN1_TFLG_OPTIONAL (0x1)
  ------------------
  |  Branch (138:11): [True: 0, False: 0]
  ------------------
  139|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  140|      0|        return -1;
  141|      0|      }
  142|      0|      ASN1_VALUE **pchval = asn1_get_field_ptr(pval, chtt);
  143|      0|      return asn1_template_ex_i2d(pchval, out, chtt, -1, 0, /*optional=*/0);
  144|      0|    }
  145|       |
  146|  6.73k|    case ASN1_ITYPE_EXTERN: {
  ------------------
  |  |  424|  6.73k|#define ASN1_ITYPE_EXTERN 0x4
  ------------------
  |  Branch (146:5): [True: 6.73k, False: 1.35M]
  ------------------
  147|       |      // We don't support implicit tagging with external types.
  148|  6.73k|      if (tag != -1) {
  ------------------
  |  Branch (148:11): [True: 0, False: 6.73k]
  ------------------
  149|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  150|      0|        return -1;
  151|      0|      }
  152|  6.73k|      const ASN1_EXTERN_FUNCS *ef =
  153|  6.73k|          reinterpret_cast<const ASN1_EXTERN_FUNCS *>(it->funcs);
  154|  6.73k|      int ret = ef->asn1_ex_i2d(pval, out, it);
  155|  6.73k|      if (ret == 0) {
  ------------------
  |  Branch (155:11): [True: 0, False: 6.73k]
  ------------------
  156|       |        // |asn1_ex_i2d| should never return zero. We have already checked
  157|       |        // for optional values generically, and |ASN1_ITYPE_EXTERN| fields
  158|       |        // must be pointers.
  159|      0|        OPENSSL_PUT_ERROR(ASN1, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  160|      0|        return -1;
  161|      0|      }
  162|  6.73k|      return ret;
  163|  6.73k|    }
  164|       |
  165|   377k|    case ASN1_ITYPE_SEQUENCE: {
  ------------------
  |  |  420|   377k|#define ASN1_ITYPE_SEQUENCE 0x1
  ------------------
  |  Branch (165:5): [True: 377k, False: 981k]
  ------------------
  166|   377k|      i = asn1_enc_restore(&seqcontlen, out, pval, it);
  167|       |      // An error occurred
  168|   377k|      if (i < 0) {
  ------------------
  |  Branch (168:11): [True: 0, False: 377k]
  ------------------
  169|      0|        return -1;
  170|      0|      }
  171|       |      // We have a valid cached encoding...
  172|   377k|      if (i > 0) {
  ------------------
  |  Branch (172:11): [True: 34.2k, False: 343k]
  ------------------
  173|  34.2k|        return seqcontlen;
  174|  34.2k|      }
  175|       |      // Otherwise carry on
  176|   343k|      seqcontlen = 0;
  177|       |      // If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL
  178|   343k|      if (tag == -1) {
  ------------------
  |  Branch (178:11): [True: 343k, False: 0]
  ------------------
  179|   343k|        tag = V_ASN1_SEQUENCE;
  ------------------
  |  |   97|   343k|#define V_ASN1_SEQUENCE 16
  ------------------
  180|   343k|        aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   49|   343k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  181|   343k|      }
  182|       |      // First work out sequence content length
  183|  1.03M|      for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (183:39): [True: 687k, False: 343k]
  ------------------
  184|   687k|        const ASN1_TEMPLATE *seqtt;
  185|   687k|        ASN1_VALUE **pseqval;
  186|   687k|        int tmplen;
  187|   687k|        seqtt = asn1_do_adb(pval, tt, 1);
  188|   687k|        if (!seqtt) {
  ------------------
  |  Branch (188:13): [True: 0, False: 687k]
  ------------------
  189|      0|          return -1;
  190|      0|        }
  191|   687k|        pseqval = asn1_get_field_ptr(pval, seqtt);
  192|   687k|        tmplen =
  193|   687k|            asn1_template_ex_i2d(pseqval, NULL, seqtt, -1, 0, /*optional=*/0);
  194|   687k|        if (tmplen == -1 || (tmplen > INT_MAX - seqcontlen)) {
  ------------------
  |  Branch (194:13): [True: 0, False: 687k]
  |  Branch (194:29): [True: 0, False: 687k]
  ------------------
  195|      0|          return -1;
  196|      0|        }
  197|   687k|        seqcontlen += tmplen;
  198|   687k|      }
  199|       |
  200|   343k|      seqlen = ASN1_object_size(/*constructed=*/1, seqcontlen, tag);
  201|   343k|      if (!out || seqlen == -1) {
  ------------------
  |  Branch (201:11): [True: 213k, False: 129k]
  |  Branch (201:19): [True: 0, False: 129k]
  ------------------
  202|   213k|        return seqlen;
  203|   213k|      }
  204|       |      // Output SEQUENCE header
  205|   129k|      ASN1_put_object(out, /*constructed=*/1, seqcontlen, tag, aclass);
  206|   388k|      for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (206:39): [True: 259k, False: 129k]
  ------------------
  207|   259k|        const ASN1_TEMPLATE *seqtt;
  208|   259k|        ASN1_VALUE **pseqval;
  209|   259k|        seqtt = asn1_do_adb(pval, tt, 1);
  210|   259k|        if (!seqtt) {
  ------------------
  |  Branch (210:13): [True: 0, False: 259k]
  ------------------
  211|      0|          return -1;
  212|      0|        }
  213|   259k|        pseqval = asn1_get_field_ptr(pval, seqtt);
  214|   259k|        if (asn1_template_ex_i2d(pseqval, out, seqtt, -1, 0, /*optional=*/0) <
  ------------------
  |  Branch (214:13): [True: 0, False: 259k]
  ------------------
  215|   259k|            0) {
  216|      0|          return -1;
  217|      0|        }
  218|   259k|      }
  219|   129k|      return seqlen;
  220|   129k|    }
  221|       |
  222|      0|    default:
  ------------------
  |  Branch (222:5): [True: 0, False: 1.35M]
  ------------------
  223|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  224|      0|      return -1;
  225|  1.35M|  }
  226|  1.35M|}
tasn_enc.cc:_ZL20asn1_template_ex_i2dPP13ASN1_VALUE_stPPhPK16ASN1_TEMPLATE_stiii:
  233|  1.05M|                                int optional) {
  234|  1.05M|  int i, ret, ttag, tclass;
  235|  1.05M|  size_t j;
  236|  1.05M|  uint32_t flags = tt->flags;
  237|       |
  238|       |  // Historically, |iclass| was repurposed to pass additional flags into the
  239|       |  // encoding process.
  240|  1.05M|  assert((iclass & ASN1_TFLG_TAG_CLASS) == iclass);
  241|       |  // If not overridding the tag, |iclass| is ignored and should be zero.
  242|  1.05M|  assert(tag != -1 || iclass == 0);
  243|       |
  244|       |  // Work out tag and class to use: tagging may come either from the
  245|       |  // template or the arguments, not both because this would create
  246|       |  // ambiguity.
  247|  1.05M|  if (flags & ASN1_TFLG_TAG_MASK) {
  ------------------
  |  |  334|  1.05M|#define ASN1_TFLG_TAG_MASK (0x3 << 3)
  ------------------
  |  Branch (247:7): [True: 0, False: 1.05M]
  ------------------
  248|       |    // Error if argument and template tagging
  249|      0|    if (tag != -1) {
  ------------------
  |  Branch (249:9): [True: 0, False: 0]
  ------------------
  250|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  251|      0|      return -1;
  252|      0|    }
  253|       |    // Get tagging from template
  254|      0|    ttag = tt->tag;
  255|      0|    tclass = flags & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  357|      0|#define ASN1_TFLG_TAG_CLASS (0x3 << 6)
  ------------------
  256|  1.05M|  } else if (tag != -1) {
  ------------------
  |  Branch (256:14): [True: 0, False: 1.05M]
  ------------------
  257|       |    // No template tagging, get from arguments
  258|      0|    ttag = tag;
  259|      0|    tclass = iclass & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  357|      0|#define ASN1_TFLG_TAG_CLASS (0x3 << 6)
  ------------------
  260|  1.05M|  } else {
  261|  1.05M|    ttag = -1;
  262|  1.05M|    tclass = 0;
  263|  1.05M|  }
  264|       |
  265|       |  // The template may itself by marked as optional, or this may be the template
  266|       |  // of an |ASN1_ITEM_TEMPLATE| type which was contained inside an outer
  267|       |  // optional template. (They cannot both be true because the
  268|       |  // |ASN1_ITEM_TEMPLATE| codepath rejects optional templates.)
  269|  1.05M|  assert(!optional || (flags & ASN1_TFLG_OPTIONAL) == 0);
  270|  1.05M|  optional = optional || (flags & ASN1_TFLG_OPTIONAL) != 0;
  ------------------
  |  |  311|  1.05M|#define ASN1_TFLG_OPTIONAL (0x1)
  ------------------
  |  Branch (270:14): [True: 0, False: 1.05M]
  |  Branch (270:26): [True: 163k, False: 895k]
  ------------------
  271|       |
  272|       |  // At this point 'ttag' contains the outer tag to use, and 'tclass' is the
  273|       |  // class.
  274|       |
  275|  1.05M|  if (flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  320|  1.05M|#define ASN1_TFLG_SK_MASK (0x3 << 1)
  ------------------
  |  Branch (275:7): [True: 112k, False: 946k]
  ------------------
  276|       |    // SET OF, SEQUENCE OF
  277|   112k|    STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
  ------------------
  |  |   39|   112k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  278|   112k|    int isset, sktag, skaclass;
  279|   112k|    int skcontlen, sklen;
  280|   112k|    ASN1_VALUE *skitem;
  281|       |
  282|   112k|    if (!*pval) {
  ------------------
  |  Branch (282:9): [True: 0, False: 112k]
  ------------------
  283|      0|      if (optional) {
  ------------------
  |  Branch (283:11): [True: 0, False: 0]
  ------------------
  284|      0|        return 0;
  285|      0|      }
  286|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_MISSING_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  287|      0|      return -1;
  288|      0|    }
  289|       |
  290|   112k|    if (flags & ASN1_TFLG_SET_OF) {
  ------------------
  |  |  314|   112k|#define ASN1_TFLG_SET_OF (0x1 << 1)
  ------------------
  |  Branch (290:9): [True: 112k, False: 0]
  ------------------
  291|   112k|      isset = 1;
  292|       |      // Historically, types with both bits set were mutated when
  293|       |      // serialized to apply the sort. We no longer support this.
  294|   112k|      assert((flags & ASN1_TFLG_SEQUENCE_OF) == 0);
  295|   112k|    } else {
  296|      0|      isset = 0;
  297|      0|    }
  298|       |
  299|       |    // Work out inner tag value: if EXPLICIT or no tagging use underlying
  300|       |    // type.
  301|   112k|    if ((ttag != -1) && !(flags & ASN1_TFLG_EXPTAG)) {
  ------------------
  |  |  332|      0|#define ASN1_TFLG_EXPTAG (0x2 << 3)
  ------------------
  |  Branch (301:9): [True: 0, False: 112k]
  |  Branch (301:25): [True: 0, False: 0]
  ------------------
  302|      0|      sktag = ttag;
  303|      0|      skaclass = tclass;
  304|   112k|    } else {
  305|   112k|      skaclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   49|   112k|#define V_ASN1_UNIVERSAL 0x00
  ------------------
  306|   112k|      if (isset) {
  ------------------
  |  Branch (306:11): [True: 112k, False: 0]
  ------------------
  307|   112k|        sktag = V_ASN1_SET;
  ------------------
  |  |   98|   112k|#define V_ASN1_SET 17
  ------------------
  308|   112k|      } else {
  309|      0|        sktag = V_ASN1_SEQUENCE;
  ------------------
  |  |   97|      0|#define V_ASN1_SEQUENCE 16
  ------------------
  310|      0|      }
  311|   112k|    }
  312|       |
  313|       |    // Determine total length of items
  314|   112k|    skcontlen = 0;
  315|   224k|    for (j = 0; j < sk_ASN1_VALUE_num(sk); j++) {
  ------------------
  |  Branch (315:17): [True: 112k, False: 112k]
  ------------------
  316|   112k|      int tmplen;
  317|   112k|      skitem = sk_ASN1_VALUE_value(sk, j);
  318|   112k|      tmplen = ASN1_item_ex_i2d(&skitem, NULL, ASN1_ITEM_ptr(tt->item), -1, 0);
  ------------------
  |  |  241|   112k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  319|   112k|      if (tmplen == -1 || (skcontlen > INT_MAX - tmplen)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 112k]
  |  Branch (319:27): [True: 0, False: 112k]
  ------------------
  320|      0|        return -1;
  321|      0|      }
  322|   112k|      skcontlen += tmplen;
  323|   112k|    }
  324|   112k|    sklen = ASN1_object_size(/*constructed=*/1, skcontlen, sktag);
  325|   112k|    if (sklen == -1) {
  ------------------
  |  Branch (325:9): [True: 0, False: 112k]
  ------------------
  326|      0|      return -1;
  327|      0|    }
  328|       |    // If EXPLICIT need length of surrounding tag
  329|   112k|    if (flags & ASN1_TFLG_EXPTAG) {
  ------------------
  |  |  332|   112k|#define ASN1_TFLG_EXPTAG (0x2 << 3)
  ------------------
  |  Branch (329:9): [True: 0, False: 112k]
  ------------------
  330|      0|      ret = ASN1_object_size(/*constructed=*/1, sklen, ttag);
  331|   112k|    } else {
  332|   112k|      ret = sklen;
  333|   112k|    }
  334|       |
  335|   112k|    if (!out || ret == -1) {
  ------------------
  |  Branch (335:9): [True: 56.2k, False: 56.2k]
  |  Branch (335:17): [True: 0, False: 56.2k]
  ------------------
  336|  56.2k|      return ret;
  337|  56.2k|    }
  338|       |
  339|       |    // Now encode this lot...
  340|       |    // EXPLICIT tag
  341|  56.2k|    if (flags & ASN1_TFLG_EXPTAG) {
  ------------------
  |  |  332|  56.2k|#define ASN1_TFLG_EXPTAG (0x2 << 3)
  ------------------
  |  Branch (341:9): [True: 0, False: 56.2k]
  ------------------
  342|      0|      ASN1_put_object(out, /*constructed=*/1, sklen, ttag, tclass);
  343|      0|    }
  344|       |    // SET or SEQUENCE and IMPLICIT tag
  345|  56.2k|    ASN1_put_object(out, /*constructed=*/1, skcontlen, sktag, skaclass);
  346|       |    // And the stuff itself
  347|  56.2k|    if (!asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item), isset)) {
  ------------------
  |  |  241|  56.2k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  |  Branch (347:9): [True: 0, False: 56.2k]
  ------------------
  348|      0|      return -1;
  349|      0|    }
  350|  56.2k|    return ret;
  351|  56.2k|  }
  352|       |
  353|   946k|  if (flags & ASN1_TFLG_EXPTAG) {
  ------------------
  |  |  332|   946k|#define ASN1_TFLG_EXPTAG (0x2 << 3)
  ------------------
  |  Branch (353:7): [True: 0, False: 946k]
  ------------------
  354|       |    // EXPLICIT tagging
  355|       |    // Find length of tagged item
  356|      0|    i = asn1_item_ex_i2d_opt(pval, NULL, ASN1_ITEM_ptr(tt->item), -1, 0,
  ------------------
  |  |  241|      0|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  357|      0|                             optional);
  358|      0|    if (i <= 0) {
  ------------------
  |  Branch (358:9): [True: 0, False: 0]
  ------------------
  359|      0|      return i;
  360|      0|    }
  361|       |    // Find length of EXPLICIT tag
  362|      0|    ret = ASN1_object_size(/*constructed=*/1, i, ttag);
  363|      0|    if (out && ret != -1) {
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  |  Branch (363:16): [True: 0, False: 0]
  ------------------
  364|       |      // Output tag and item
  365|      0|      ASN1_put_object(out, /*constructed=*/1, i, ttag, tclass);
  366|      0|      if (ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, 0) < 0) {
  ------------------
  |  |  241|      0|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  |  Branch (366:11): [True: 0, False: 0]
  ------------------
  367|      0|        return -1;
  368|      0|      }
  369|      0|    }
  370|      0|    return ret;
  371|      0|  }
  372|       |
  373|       |  // Either normal or IMPLICIT tagging
  374|   946k|  return asn1_item_ex_i2d_opt(pval, out, ASN1_ITEM_ptr(tt->item), ttag, tclass,
  ------------------
  |  |  241|   946k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  375|   946k|                              optional);
  376|   946k|}
tasn_enc.cc:_ZL16asn1_set_seq_outP19stack_st_ASN1_VALUEPPhiPK12ASN1_ITEM_sti:
  403|  56.2k|                            int skcontlen, const ASN1_ITEM *item, int do_sort) {
  404|       |  // No need to sort if there are fewer than two items.
  405|  56.2k|  if (!do_sort || sk_ASN1_VALUE_num(sk) < 2) {
  ------------------
  |  Branch (405:7): [True: 0, False: 56.2k]
  |  Branch (405:19): [True: 56.2k, False: 0]
  ------------------
  406|   112k|    for (size_t i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  Branch (406:24): [True: 56.2k, False: 56.2k]
  ------------------
  407|  56.2k|      ASN1_VALUE *skitem = sk_ASN1_VALUE_value(sk, i);
  408|  56.2k|      if (ASN1_item_ex_i2d(&skitem, out, item, -1, 0) < 0) {
  ------------------
  |  Branch (408:11): [True: 0, False: 56.2k]
  ------------------
  409|      0|        return 0;
  410|      0|      }
  411|  56.2k|    }
  412|  56.2k|    return 1;
  413|  56.2k|  }
  414|       |
  415|      0|  int ret = 0;
  416|      0|  uint8_t *const buf = reinterpret_cast<uint8_t *>(OPENSSL_malloc(skcontlen));
  417|      0|  DER_ENC *encoded = reinterpret_cast<DER_ENC *>(
  418|      0|      OPENSSL_calloc(sk_ASN1_VALUE_num(sk), sizeof(*encoded)));
  419|      0|  uint8_t *p = buf;
  420|      0|  if (encoded == NULL || buf == NULL) {
  ------------------
  |  Branch (420:7): [True: 0, False: 0]
  |  Branch (420:26): [True: 0, False: 0]
  ------------------
  421|      0|    goto err;
  422|      0|  }
  423|       |
  424|       |  // Encode all the elements into |buf| and populate |encoded|.
  425|      0|  for (size_t i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  Branch (425:22): [True: 0, False: 0]
  ------------------
  426|      0|    ASN1_VALUE *skitem = sk_ASN1_VALUE_value(sk, i);
  427|      0|    encoded[i].data = p;
  428|      0|    encoded[i].length = ASN1_item_ex_i2d(&skitem, &p, item, -1, 0);
  429|      0|    if (encoded[i].length < 0) {
  ------------------
  |  Branch (429:9): [True: 0, False: 0]
  ------------------
  430|      0|      goto err;
  431|      0|    }
  432|      0|    assert(p - buf <= skcontlen);
  433|      0|  }
  434|       |
  435|      0|  qsort(encoded, sk_ASN1_VALUE_num(sk), sizeof(*encoded), der_cmp);
  436|       |
  437|       |  // Output the elements in sorted order.
  438|      0|  p = *out;
  439|      0|  for (size_t i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  Branch (439:22): [True: 0, False: 0]
  ------------------
  440|      0|    OPENSSL_memcpy(p, encoded[i].data, encoded[i].length);
  441|      0|    p += encoded[i].length;
  442|      0|  }
  443|      0|  *out = p;
  444|       |
  445|      0|  ret = 1;
  446|       |
  447|      0|err:
  448|      0|  OPENSSL_free(encoded);
  449|      0|  OPENSSL_free(buf);
  450|      0|  return ret;
  451|      0|}
tasn_enc.cc:_ZL21asn1_i2d_ex_primitivePP13ASN1_VALUE_stPPhPK12ASN1_ITEM_stiii:
  457|   862k|                                 int optional) {
  458|       |  // Get length of content octets and maybe find out the underlying type.
  459|   862k|  int omit;
  460|   862k|  int utype = it->utype;
  461|   862k|  int len = asn1_ex_i2c(pval, NULL, &omit, &utype, it);
  462|   862k|  if (len < 0) {
  ------------------
  |  Branch (462:7): [True: 0, False: 862k]
  ------------------
  463|      0|    return -1;
  464|      0|  }
  465|   862k|  if (omit) {
  ------------------
  |  Branch (465:7): [True: 0, False: 862k]
  ------------------
  466|      0|    if (optional) {
  ------------------
  |  Branch (466:9): [True: 0, False: 0]
  ------------------
  467|      0|      return 0;
  468|      0|    }
  469|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_MISSING_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  470|      0|    return -1;
  471|      0|  }
  472|       |
  473|       |  // If SEQUENCE, SET or OTHER then header is included in pseudo content
  474|       |  // octets so don't include tag+length. We need to check here because the
  475|       |  // call to asn1_ex_i2c() could change utype.
  476|   862k|  int usetag =
  477|   862k|      utype != V_ASN1_SEQUENCE && utype != V_ASN1_SET && utype != V_ASN1_OTHER;
  ------------------
  |  |   97|  1.72M|#define V_ASN1_SEQUENCE 16
  ------------------
                    utype != V_ASN1_SEQUENCE && utype != V_ASN1_SET && utype != V_ASN1_OTHER;
  ------------------
  |  |   98|  1.72M|#define V_ASN1_SET 17
  ------------------
                    utype != V_ASN1_SEQUENCE && utype != V_ASN1_SET && utype != V_ASN1_OTHER;
  ------------------
  |  |   75|  1.72M|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (477:7): [True: 862k, False: 0]
  |  Branch (477:35): [True: 862k, False: 0]
  |  Branch (477:58): [True: 862k, False: 0]
  ------------------
  478|       |
  479|       |  // If not implicitly tagged get tag from underlying type
  480|   862k|  if (tag == -1) {
  ------------------
  |  Branch (480:7): [True: 862k, False: 0]
  ------------------
  481|   862k|    tag = utype;
  482|   862k|  }
  483|       |
  484|       |  // Output tag+length followed by content octets
  485|   862k|  if (out) {
  ------------------
  |  Branch (485:7): [True: 231k, False: 630k]
  ------------------
  486|   231k|    if (usetag) {
  ------------------
  |  Branch (486:9): [True: 231k, False: 0]
  ------------------
  487|   231k|      ASN1_put_object(out, /*constructed=*/0, len, tag, aclass);
  488|   231k|    }
  489|   231k|    int len2 = asn1_ex_i2c(pval, *out, &omit, &utype, it);
  490|   231k|    if (len2 < 0) {
  ------------------
  |  Branch (490:9): [True: 0, False: 231k]
  ------------------
  491|      0|      return -1;
  492|      0|    }
  493|   231k|    assert(len == len2);
  494|   231k|    assert(!omit);
  495|   231k|    *out += len;
  496|   231k|  }
  497|       |
  498|   862k|  if (usetag) {
  ------------------
  |  Branch (498:7): [True: 862k, False: 0]
  ------------------
  499|   862k|    return ASN1_object_size(/*constructed=*/0, len, tag);
  500|   862k|  }
  501|      0|  return len;
  502|   862k|}
tasn_enc.cc:_ZL11asn1_ex_i2cPP13ASN1_VALUE_stPhPiS3_PK12ASN1_ITEM_st:
  521|  1.09M|                       int *putype, const ASN1_ITEM *it) {
  522|  1.09M|  ASN1_BOOLEAN *tbool = NULL;
  523|  1.09M|  ASN1_STRING *strtmp;
  524|  1.09M|  ASN1_OBJECT *otmp;
  525|  1.09M|  int utype;
  526|  1.09M|  const unsigned char *cont;
  527|  1.09M|  unsigned char c;
  528|  1.09M|  int len;
  529|       |
  530|  1.09M|  assert(it->itype == ASN1_ITYPE_PRIMITIVE || it->itype == ASN1_ITYPE_MSTRING);
  531|       |  // Historically, |it->funcs| for primitive types contained an
  532|       |  // |ASN1_PRIMITIVE_FUNCS| table of callbacks.
  533|  1.09M|  assert(it->funcs == NULL);
  534|       |
  535|  1.09M|  *out_omit = 0;
  536|       |
  537|       |  // Handle omitted optional values for all but BOOLEAN, which uses a
  538|       |  // non-pointer representation.
  539|  1.09M|  if (it->itype != ASN1_ITYPE_PRIMITIVE || it->utype != V_ASN1_BOOLEAN) {
  ------------------
  |  |  418|  2.18M|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
                if (it->itype != ASN1_ITYPE_PRIMITIVE || it->utype != V_ASN1_BOOLEAN) {
  ------------------
  |  |   86|  1.09M|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (539:7): [True: 0, False: 1.09M]
  |  Branch (539:44): [True: 1.09M, False: 0]
  ------------------
  540|  1.09M|    if (!*pval) {
  ------------------
  |  Branch (540:9): [True: 0, False: 1.09M]
  ------------------
  541|      0|      *out_omit = 1;
  542|      0|      return 0;
  543|      0|    }
  544|  1.09M|  }
  545|       |
  546|  1.09M|  if (it->itype == ASN1_ITYPE_MSTRING || it->utype == V_ASN1_ANY_AS_STRING) {
  ------------------
  |  |  426|  2.18M|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
                if (it->itype == ASN1_ITYPE_MSTRING || it->utype == V_ASN1_ANY_AS_STRING) {
  ------------------
  |  |   82|  1.09M|#define V_ASN1_ANY_AS_STRING (-5)
  ------------------
  |  Branch (546:7): [True: 0, False: 1.09M]
  |  Branch (546:42): [True: 281k, False: 811k]
  ------------------
  547|       |    // If MSTRING type set the underlying type
  548|   281k|    strtmp = (ASN1_STRING *)*pval;
  549|   281k|    utype = strtmp->type;
  550|   281k|    if (utype < 0 && utype != V_ASN1_OTHER) {
  ------------------
  |  |   75|      0|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (550:9): [True: 0, False: 281k]
  |  Branch (550:22): [True: 0, False: 0]
  ------------------
  551|       |      // MSTRINGs can have type -1 when default-constructed.
  552|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_WRONG_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  553|      0|      return -1;
  554|      0|    }
  555|       |    // Negative INTEGER and ENUMERATED values use |ASN1_STRING| type values that
  556|       |    // do not match their corresponding utype values.
  557|   281k|    if (utype == V_ASN1_NEG_INTEGER) {
  ------------------
  |  |  117|   281k|#define V_ASN1_NEG_INTEGER (V_ASN1_INTEGER | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   87|   281k|#define V_ASN1_INTEGER 2
  |  |  ------------------
  |  |               #define V_ASN1_NEG_INTEGER (V_ASN1_INTEGER | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |  116|   281k|#define V_ASN1_NEG 0x100
  |  |  ------------------
  ------------------
  |  Branch (557:9): [True: 0, False: 281k]
  ------------------
  558|      0|      utype = V_ASN1_INTEGER;
  ------------------
  |  |   87|      0|#define V_ASN1_INTEGER 2
  ------------------
  559|   281k|    } else if (utype == V_ASN1_NEG_ENUMERATED) {
  ------------------
  |  |  118|   281k|#define V_ASN1_NEG_ENUMERATED (V_ASN1_ENUMERATED | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   95|   281k|#define V_ASN1_ENUMERATED 10
  |  |  ------------------
  |  |               #define V_ASN1_NEG_ENUMERATED (V_ASN1_ENUMERATED | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |  116|   281k|#define V_ASN1_NEG 0x100
  |  |  ------------------
  ------------------
  |  Branch (559:16): [True: 0, False: 281k]
  ------------------
  560|      0|      utype = V_ASN1_ENUMERATED;
  ------------------
  |  |   95|      0|#define V_ASN1_ENUMERATED 10
  ------------------
  561|      0|    }
  562|   281k|    *putype = utype;
  563|   811k|  } else if (it->utype == V_ASN1_ANY) {
  ------------------
  |  |   78|   811k|#define V_ASN1_ANY (-4)
  ------------------
  |  Branch (563:14): [True: 209k, False: 602k]
  ------------------
  564|       |    // If ANY set type and pointer to value
  565|   209k|    ASN1_TYPE *typ;
  566|   209k|    typ = (ASN1_TYPE *)*pval;
  567|   209k|    utype = typ->type;
  568|   209k|    if (utype < 0 && utype != V_ASN1_OTHER) {
  ------------------
  |  |   75|      0|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (568:9): [True: 0, False: 209k]
  |  Branch (568:22): [True: 0, False: 0]
  ------------------
  569|       |      // |ASN1_TYPE|s can have type -1 when default-constructed.
  570|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_WRONG_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  571|      0|      return -1;
  572|      0|    }
  573|   209k|    *putype = utype;
  574|   209k|    pval = &typ->value.asn1_value;
  575|   602k|  } else {
  576|   602k|    utype = *putype;
  577|   602k|  }
  578|       |
  579|  1.09M|  switch (utype) {
  580|   490k|    case V_ASN1_OBJECT:
  ------------------
  |  |   91|   490k|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (580:5): [True: 490k, False: 602k]
  ------------------
  581|   490k|      otmp = (ASN1_OBJECT *)*pval;
  582|   490k|      cont = otmp->data;
  583|   490k|      len = otmp->length;
  584|   490k|      if (len == 0) {
  ------------------
  |  Branch (584:11): [True: 0, False: 490k]
  ------------------
  585|       |        // Some |ASN1_OBJECT|s do not have OIDs and cannot be serialized.
  586|      0|        OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_OBJECT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  587|      0|        return -1;
  588|      0|      }
  589|   490k|      break;
  590|       |
  591|   490k|    case V_ASN1_NULL:
  ------------------
  |  |   90|   209k|#define V_ASN1_NULL 5
  ------------------
  |  Branch (591:5): [True: 209k, False: 884k]
  ------------------
  592|   209k|      cont = NULL;
  593|   209k|      len = 0;
  594|   209k|      break;
  595|       |
  596|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   86|      0|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (596:5): [True: 0, False: 1.09M]
  ------------------
  597|      0|      tbool = (ASN1_BOOLEAN *)pval;
  598|      0|      if (*tbool == ASN1_BOOLEAN_NONE) {
  ------------------
  |  |  385|      0|#define ASN1_BOOLEAN_NONE (-1)
  ------------------
  |  Branch (598:11): [True: 0, False: 0]
  ------------------
  599|      0|        *out_omit = 1;
  600|      0|        return 0;
  601|      0|      }
  602|      0|      if (it->utype != V_ASN1_ANY) {
  ------------------
  |  |   78|      0|#define V_ASN1_ANY (-4)
  ------------------
  |  Branch (602:11): [True: 0, False: 0]
  ------------------
  603|       |        // Default handling if value == size field then omit
  604|      0|        if ((*tbool && (it->size > 0)) || (!*tbool && !it->size)) {
  ------------------
  |  Branch (604:14): [True: 0, False: 0]
  |  Branch (604:24): [True: 0, False: 0]
  |  Branch (604:44): [True: 0, False: 0]
  |  Branch (604:55): [True: 0, False: 0]
  ------------------
  605|      0|          *out_omit = 1;
  606|      0|          return 0;
  607|      0|        }
  608|      0|      }
  609|      0|      c = *tbool ? 0xff : 0x00;
  ------------------
  |  Branch (609:11): [True: 0, False: 0]
  ------------------
  610|      0|      cont = &c;
  611|      0|      len = 1;
  612|      0|      break;
  613|       |
  614|   112k|    case V_ASN1_BIT_STRING: {
  ------------------
  |  |   88|   112k|#define V_ASN1_BIT_STRING 3
  ------------------
  |  Branch (614:5): [True: 112k, False: 980k]
  ------------------
  615|   112k|      int ret =
  616|   112k|          i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : NULL);
  ------------------
  |  Branch (616:57): [True: 28.1k, False: 84.3k]
  ------------------
  617|       |      // |i2c_ASN1_BIT_STRING| returns zero on error instead of -1.
  618|   112k|      return ret <= 0 ? -1 : ret;
  ------------------
  |  Branch (618:14): [True: 0, False: 112k]
  ------------------
  619|      0|    }
  620|       |
  621|      0|    case V_ASN1_INTEGER:
  ------------------
  |  |   87|      0|#define V_ASN1_INTEGER 2
  ------------------
  |  Branch (621:5): [True: 0, False: 1.09M]
  ------------------
  622|      0|    case V_ASN1_ENUMERATED: {
  ------------------
  |  |   95|      0|#define V_ASN1_ENUMERATED 10
  ------------------
  |  Branch (622:5): [True: 0, False: 1.09M]
  ------------------
  623|       |      // |i2c_ASN1_INTEGER| also handles ENUMERATED.
  624|      0|      int ret = i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
  ------------------
  |  Branch (624:57): [True: 0, False: 0]
  ------------------
  625|       |      // |i2c_ASN1_INTEGER| returns zero on error instead of -1.
  626|      0|      return ret <= 0 ? -1 : ret;
  ------------------
  |  Branch (626:14): [True: 0, False: 0]
  ------------------
  627|      0|    }
  628|       |
  629|      0|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   89|      0|#define V_ASN1_OCTET_STRING 4
  ------------------
  |  Branch (629:5): [True: 0, False: 1.09M]
  ------------------
  630|      0|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   99|      0|#define V_ASN1_NUMERICSTRING 18
  ------------------
  |  Branch (630:5): [True: 0, False: 1.09M]
  ------------------
  631|      0|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |  100|      0|#define V_ASN1_PRINTABLESTRING 19
  ------------------
  |  Branch (631:5): [True: 0, False: 1.09M]
  ------------------
  632|      0|    case V_ASN1_T61STRING:
  ------------------
  |  |  101|      0|#define V_ASN1_T61STRING 20
  ------------------
  |  Branch (632:5): [True: 0, False: 1.09M]
  ------------------
  633|      0|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |  103|      0|#define V_ASN1_VIDEOTEXSTRING 21
  ------------------
  |  Branch (633:5): [True: 0, False: 1.09M]
  ------------------
  634|      0|    case V_ASN1_IA5STRING:
  ------------------
  |  |  104|      0|#define V_ASN1_IA5STRING 22
  ------------------
  |  Branch (634:5): [True: 0, False: 1.09M]
  ------------------
  635|      0|    case V_ASN1_UTCTIME:
  ------------------
  |  |  105|      0|#define V_ASN1_UTCTIME 23
  ------------------
  |  Branch (635:5): [True: 0, False: 1.09M]
  ------------------
  636|      0|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |  106|      0|#define V_ASN1_GENERALIZEDTIME 24
  ------------------
  |  Branch (636:5): [True: 0, False: 1.09M]
  ------------------
  637|      0|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |  107|      0|#define V_ASN1_GRAPHICSTRING 25
  ------------------
  |  Branch (637:5): [True: 0, False: 1.09M]
  ------------------
  638|      0|    case V_ASN1_VISIBLESTRING:
  ------------------
  |  |  109|      0|#define V_ASN1_VISIBLESTRING 26
  ------------------
  |  Branch (638:5): [True: 0, False: 1.09M]
  ------------------
  639|      0|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |  110|      0|#define V_ASN1_GENERALSTRING 27
  ------------------
  |  Branch (639:5): [True: 0, False: 1.09M]
  ------------------
  640|      0|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |  111|      0|#define V_ASN1_UNIVERSALSTRING 28
  ------------------
  |  Branch (640:5): [True: 0, False: 1.09M]
  ------------------
  641|      0|    case V_ASN1_BMPSTRING:
  ------------------
  |  |  112|      0|#define V_ASN1_BMPSTRING 30
  ------------------
  |  Branch (641:5): [True: 0, False: 1.09M]
  ------------------
  642|   281k|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   96|   281k|#define V_ASN1_UTF8STRING 12
  ------------------
  |  Branch (642:5): [True: 281k, False: 811k]
  ------------------
  643|   281k|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   97|   281k|#define V_ASN1_SEQUENCE 16
  ------------------
  |  Branch (643:5): [True: 0, False: 1.09M]
  ------------------
  644|   281k|    case V_ASN1_SET:
  ------------------
  |  |   98|   281k|#define V_ASN1_SET 17
  ------------------
  |  Branch (644:5): [True: 0, False: 1.09M]
  ------------------
  645|       |    // This is not a valid |ASN1_ITEM| type, but it appears in |ASN1_TYPE|.
  646|   281k|    case V_ASN1_OTHER:
  ------------------
  |  |   75|   281k|#define V_ASN1_OTHER (-3)
  ------------------
  |  Branch (646:5): [True: 0, False: 1.09M]
  ------------------
  647|       |      // All based on ASN1_STRING and handled the same
  648|   281k|      strtmp = (ASN1_STRING *)*pval;
  649|   281k|      cont = strtmp->data;
  650|   281k|      len = strtmp->length;
  651|   281k|      break;
  652|       |
  653|      0|    default:
  ------------------
  |  Branch (653:5): [True: 0, False: 1.09M]
  ------------------
  654|      0|      OPENSSL_PUT_ERROR(ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  655|      0|      return -1;
  656|  1.09M|  }
  657|   980k|  if (cout && len) {
  ------------------
  |  Branch (657:7): [True: 202k, False: 777k]
  |  Branch (657:15): [True: 157k, False: 45.2k]
  ------------------
  658|   157k|    OPENSSL_memcpy(cout, cont, len);
  659|   157k|  }
  660|   980k|  return len;
  661|  1.09M|}

ASN1_item_free:
   26|   309k|void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) {
   27|   309k|  ASN1_item_ex_free(&val, it);
   28|   309k|}
ASN1_item_ex_free:
   30|  1.63M|void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
   31|  1.63M|  if (!pval) {
  ------------------
  |  Branch (31:7): [True: 0, False: 1.63M]
  ------------------
   32|      0|    return;
   33|      0|  }
   34|  1.63M|  if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) {
  ------------------
  |  |  418|  1.63M|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (34:7): [True: 590k, False: 1.04M]
  |  Branch (34:46): [True: 84.3k, False: 506k]
  ------------------
   35|  84.3k|    return;
   36|  84.3k|  }
   37|       |
   38|  1.54M|  switch (it->itype) {
  ------------------
  |  Branch (38:11): [True: 0, False: 1.54M]
  ------------------
   39|  1.04M|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  418|  1.04M|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (39:5): [True: 1.04M, False: 506k]
  ------------------
   40|  1.04M|      if (it->templates) {
  ------------------
  |  Branch (40:11): [True: 56.2k, False: 984k]
  ------------------
   41|  56.2k|        ASN1_template_free(pval, it->templates);
   42|   984k|      } else {
   43|   984k|        ASN1_primitive_free(pval, it);
   44|   984k|      }
   45|  1.04M|      break;
   46|       |
   47|  56.2k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  426|  56.2k|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (47:5): [True: 56.2k, False: 1.49M]
  ------------------
   48|  56.2k|      ASN1_primitive_free(pval, it);
   49|  56.2k|      break;
   50|       |
   51|      0|    case ASN1_ITYPE_CHOICE: {
  ------------------
  |  |  422|      0|#define ASN1_ITYPE_CHOICE 0x2
  ------------------
  |  Branch (51:5): [True: 0, False: 1.54M]
  ------------------
   52|      0|      const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
   53|      0|      ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (53:30): [True: 0, False: 0]
  ------------------
   54|      0|      if (asn1_cb) {
  ------------------
  |  Branch (54:11): [True: 0, False: 0]
  ------------------
   55|      0|        if (asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL) == 2) {
  ------------------
  |  |  470|      0|#define ASN1_OP_FREE_PRE 2
  ------------------
  |  Branch (55:13): [True: 0, False: 0]
  ------------------
   56|      0|          return;
   57|      0|        }
   58|      0|      }
   59|      0|      int i = asn1_get_choice_selector(pval, it);
   60|      0|      if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (60:11): [True: 0, False: 0]
  |  Branch (60:23): [True: 0, False: 0]
  ------------------
   61|      0|        const ASN1_TEMPLATE *tt = it->templates + i;
   62|      0|        ASN1_VALUE **pchval = asn1_get_field_ptr(pval, tt);
   63|      0|        ASN1_template_free(pchval, tt);
   64|      0|      }
   65|      0|      if (asn1_cb) {
  ------------------
  |  Branch (65:11): [True: 0, False: 0]
  ------------------
   66|      0|        asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
  ------------------
  |  |  471|      0|#define ASN1_OP_FREE_POST 3
  ------------------
   67|      0|      }
   68|      0|      OPENSSL_free(*pval);
   69|      0|      *pval = NULL;
   70|      0|      break;
   71|      0|    }
   72|       |
   73|  56.2k|    case ASN1_ITYPE_EXTERN: {
  ------------------
  |  |  424|  56.2k|#define ASN1_ITYPE_EXTERN 0x4
  ------------------
  |  Branch (73:5): [True: 56.2k, False: 1.49M]
  ------------------
   74|  56.2k|      const ASN1_EXTERN_FUNCS *ef =
   75|  56.2k|          reinterpret_cast<const ASN1_EXTERN_FUNCS *>(it->funcs);
   76|  56.2k|      if (ef && ef->asn1_ex_free) {
  ------------------
  |  Branch (76:11): [True: 56.2k, False: 0]
  |  Branch (76:17): [True: 56.2k, False: 0]
  ------------------
   77|  56.2k|        ef->asn1_ex_free(pval, it);
   78|  56.2k|      }
   79|  56.2k|      break;
   80|      0|    }
   81|       |
   82|   393k|    case ASN1_ITYPE_SEQUENCE: {
  ------------------
  |  |  420|   393k|#define ASN1_ITYPE_SEQUENCE 0x1
  ------------------
  |  Branch (82:5): [True: 393k, False: 1.15M]
  ------------------
   83|   393k|      if (!asn1_refcount_dec_and_test_zero(pval, it)) {
  ------------------
  |  Branch (83:11): [True: 0, False: 393k]
  ------------------
   84|      0|        return;
   85|      0|      }
   86|   393k|      const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
   87|   393k|      ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (87:30): [True: 56.2k, False: 337k]
  ------------------
   88|   393k|      if (asn1_cb) {
  ------------------
  |  Branch (88:11): [True: 28.1k, False: 365k]
  ------------------
   89|  28.1k|        if (asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL) == 2) {
  ------------------
  |  |  470|  28.1k|#define ASN1_OP_FREE_PRE 2
  ------------------
  |  Branch (89:13): [True: 0, False: 28.1k]
  ------------------
   90|      0|          return;
   91|      0|        }
   92|  28.1k|      }
   93|   393k|      asn1_enc_free(pval, it);
   94|       |      // If we free up as normal we will invalidate any ANY DEFINED BY
   95|       |      // field and we wont be able to determine the type of the field it
   96|       |      // defines. So free up in reverse order.
   97|  1.51M|      for (int i = it->tcount - 1; i >= 0; i--) {
  ------------------
  |  Branch (97:36): [True: 1.12M, False: 393k]
  ------------------
   98|  1.12M|        const ASN1_TEMPLATE *seqtt = asn1_do_adb(pval, &it->templates[i], 0);
   99|  1.12M|        if (!seqtt) {
  ------------------
  |  Branch (99:13): [True: 0, False: 1.12M]
  ------------------
  100|      0|          continue;
  101|      0|        }
  102|  1.12M|        ASN1_VALUE **pseqval = asn1_get_field_ptr(pval, seqtt);
  103|  1.12M|        ASN1_template_free(pseqval, seqtt);
  104|  1.12M|      }
  105|   393k|      if (asn1_cb) {
  ------------------
  |  Branch (105:11): [True: 28.1k, False: 365k]
  ------------------
  106|  28.1k|        asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
  ------------------
  |  |  471|  28.1k|#define ASN1_OP_FREE_POST 3
  ------------------
  107|  28.1k|      }
  108|   393k|      OPENSSL_free(*pval);
  109|   393k|      *pval = NULL;
  110|   393k|      break;
  111|   393k|    }
  112|  1.54M|  }
  113|  1.54M|}
ASN1_template_free:
  115|  1.29M|void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) {
  116|  1.29M|  if (tt->flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  320|  1.29M|#define ASN1_TFLG_SK_MASK (0x3 << 1)
  ------------------
  |  Branch (116:7): [True: 84.3k, False: 1.20M]
  ------------------
  117|  84.3k|    STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
  ------------------
  |  |   39|  84.3k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  118|   196k|    for (size_t i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  Branch (118:24): [True: 112k, False: 84.3k]
  ------------------
  119|   112k|      ASN1_VALUE *vtmp = sk_ASN1_VALUE_value(sk, i);
  120|   112k|      ASN1_item_ex_free(&vtmp, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  241|   112k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  121|   112k|    }
  122|  84.3k|    sk_ASN1_VALUE_free(sk);
  123|  84.3k|    *pval = NULL;
  124|  1.20M|  } else {
  125|  1.20M|    ASN1_item_ex_free(pval, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  241|  1.20M|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  126|  1.20M|  }
  127|  1.29M|}
ASN1_primitive_free:
  129|  1.04M|void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  130|       |  // Historically, |it->funcs| for primitive types contained an
  131|       |  // |ASN1_PRIMITIVE_FUNCS| table of calbacks.
  132|  1.04M|  assert(it->funcs == NULL);
  133|       |
  134|  1.04M|  int utype = it->itype == ASN1_ITYPE_MSTRING ? -1 : it->utype;
  ------------------
  |  |  426|  1.04M|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (134:15): [True: 56.2k, False: 984k]
  ------------------
  135|  1.04M|  switch (utype) {
  136|   309k|    case V_ASN1_OBJECT:
  ------------------
  |  |   91|   309k|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (136:5): [True: 309k, False: 731k]
  ------------------
  137|   309k|      ASN1_OBJECT_free((ASN1_OBJECT *)*pval);
  138|   309k|      break;
  139|       |
  140|   168k|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   86|   168k|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (140:5): [True: 168k, False: 871k]
  ------------------
  141|   168k|      if (it) {
  ------------------
  |  Branch (141:11): [True: 168k, False: 0]
  ------------------
  142|   168k|        *(ASN1_BOOLEAN *)pval = (ASN1_BOOLEAN)it->size;
  143|   168k|      } else {
  144|      0|        *(ASN1_BOOLEAN *)pval = ASN1_BOOLEAN_NONE;
  ------------------
  |  |  385|      0|#define ASN1_BOOLEAN_NONE (-1)
  ------------------
  145|      0|      }
  146|   168k|      return;
  147|       |
  148|      0|    case V_ASN1_NULL:
  ------------------
  |  |   90|      0|#define V_ASN1_NULL 5
  ------------------
  |  Branch (148:5): [True: 0, False: 1.04M]
  ------------------
  149|      0|      break;
  150|       |
  151|  84.3k|    case V_ASN1_ANY:
  ------------------
  |  |   78|  84.3k|#define V_ASN1_ANY (-4)
  ------------------
  |  Branch (151:5): [True: 84.3k, False: 956k]
  ------------------
  152|  84.3k|      if (*pval != NULL) {
  ------------------
  |  Branch (152:11): [True: 84.3k, False: 0]
  ------------------
  153|  84.3k|        asn1_type_cleanup((ASN1_TYPE *)*pval);
  154|  84.3k|        OPENSSL_free(*pval);
  155|  84.3k|      }
  156|  84.3k|      break;
  157|       |
  158|   478k|    default:
  ------------------
  |  Branch (158:5): [True: 478k, False: 562k]
  ------------------
  159|   478k|      ASN1_STRING_free((ASN1_STRING *)*pval);
  160|   478k|      *pval = NULL;
  161|   478k|      break;
  162|  1.04M|  }
  163|   871k|  *pval = NULL;
  164|   871k|}

ASN1_item_new:
   34|   140k|ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it) {
   35|   140k|  ASN1_VALUE *ret = NULL;
   36|   140k|  if (ASN1_item_ex_new(&ret, it) > 0) {
  ------------------
  |  Branch (36:7): [True: 140k, False: 0]
  ------------------
   37|   140k|    return ret;
   38|   140k|  }
   39|      0|  return NULL;
   40|   140k|}
ASN1_item_ex_new:
   44|  1.18M|int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
   45|  1.18M|  const ASN1_TEMPLATE *tt = NULL;
   46|  1.18M|  const ASN1_EXTERN_FUNCS *ef;
   47|  1.18M|  ASN1_VALUE **pseqval;
   48|  1.18M|  int i;
   49|       |
   50|  1.18M|  switch (it->itype) {
  ------------------
  |  Branch (50:11): [True: 0, False: 1.18M]
  ------------------
   51|  56.2k|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |  424|  56.2k|#define ASN1_ITYPE_EXTERN 0x4
  ------------------
  |  Branch (51:5): [True: 56.2k, False: 1.12M]
  ------------------
   52|  56.2k|      ef = reinterpret_cast<const ASN1_EXTERN_FUNCS *>(it->funcs);
   53|  56.2k|      if (ef && ef->asn1_ex_new) {
  ------------------
  |  Branch (53:11): [True: 56.2k, False: 0]
  |  Branch (53:17): [True: 56.2k, False: 0]
  ------------------
   54|  56.2k|        if (!ef->asn1_ex_new(pval, it)) {
  ------------------
  |  Branch (54:13): [True: 0, False: 56.2k]
  ------------------
   55|      0|          goto memerr;
   56|      0|        }
   57|  56.2k|      }
   58|  56.2k|      break;
   59|       |
   60|   674k|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  418|   674k|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (60:5): [True: 674k, False: 506k]
  ------------------
   61|   674k|      if (it->templates) {
  ------------------
  |  Branch (61:11): [True: 0, False: 674k]
  ------------------
   62|      0|        if (!ASN1_template_new(pval, it->templates)) {
  ------------------
  |  Branch (62:13): [True: 0, False: 0]
  ------------------
   63|      0|          goto memerr;
   64|      0|        }
   65|   674k|      } else if (!ASN1_primitive_new(pval, it)) {
  ------------------
  |  Branch (65:18): [True: 0, False: 674k]
  ------------------
   66|      0|        goto memerr;
   67|      0|      }
   68|   674k|      break;
   69|       |
   70|   674k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  426|  56.2k|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (70:5): [True: 56.2k, False: 1.12M]
  ------------------
   71|  56.2k|      if (!ASN1_primitive_new(pval, it)) {
  ------------------
  |  Branch (71:11): [True: 0, False: 56.2k]
  ------------------
   72|      0|        goto memerr;
   73|      0|      }
   74|  56.2k|      break;
   75|       |
   76|  56.2k|    case ASN1_ITYPE_CHOICE: {
  ------------------
  |  |  422|      0|#define ASN1_ITYPE_CHOICE 0x2
  ------------------
  |  Branch (76:5): [True: 0, False: 1.18M]
  ------------------
   77|      0|      const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
   78|      0|      ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (78:30): [True: 0, False: 0]
  ------------------
   79|      0|      if (asn1_cb) {
  ------------------
  |  Branch (79:11): [True: 0, False: 0]
  ------------------
   80|      0|        i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
  ------------------
  |  |  468|      0|#define ASN1_OP_NEW_PRE 0
  ------------------
   81|      0|        if (!i) {
  ------------------
  |  Branch (81:13): [True: 0, False: 0]
  ------------------
   82|      0|          goto auxerr;
   83|      0|        }
   84|      0|        if (i == 2) {
  ------------------
  |  Branch (84:13): [True: 0, False: 0]
  ------------------
   85|      0|          return 1;
   86|      0|        }
   87|      0|      }
   88|      0|      *pval = reinterpret_cast<ASN1_VALUE *>(OPENSSL_zalloc(it->size));
   89|      0|      if (!*pval) {
  ------------------
  |  Branch (89:11): [True: 0, False: 0]
  ------------------
   90|      0|        goto memerr;
   91|      0|      }
   92|      0|      asn1_set_choice_selector(pval, -1, it);
   93|      0|      if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) {
  ------------------
  |  |  469|      0|#define ASN1_OP_NEW_POST 1
  ------------------
  |  Branch (93:11): [True: 0, False: 0]
  |  Branch (93:22): [True: 0, False: 0]
  ------------------
   94|      0|        goto auxerr2;
   95|      0|      }
   96|      0|      break;
   97|      0|    }
   98|       |
   99|   393k|    case ASN1_ITYPE_SEQUENCE: {
  ------------------
  |  |  420|   393k|#define ASN1_ITYPE_SEQUENCE 0x1
  ------------------
  |  Branch (99:5): [True: 393k, False: 787k]
  ------------------
  100|   393k|      const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
  101|   393k|      ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (101:30): [True: 56.2k, False: 337k]
  ------------------
  102|   393k|      if (asn1_cb) {
  ------------------
  |  Branch (102:11): [True: 28.1k, False: 365k]
  ------------------
  103|  28.1k|        i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
  ------------------
  |  |  468|  28.1k|#define ASN1_OP_NEW_PRE 0
  ------------------
  104|  28.1k|        if (!i) {
  ------------------
  |  Branch (104:13): [True: 0, False: 28.1k]
  ------------------
  105|      0|          goto auxerr;
  106|      0|        }
  107|  28.1k|        if (i == 2) {
  ------------------
  |  Branch (107:13): [True: 0, False: 28.1k]
  ------------------
  108|      0|          return 1;
  109|      0|        }
  110|  28.1k|      }
  111|   393k|      *pval = reinterpret_cast<ASN1_VALUE *>(OPENSSL_zalloc(it->size));
  112|   393k|      if (!*pval) {
  ------------------
  |  Branch (112:11): [True: 0, False: 393k]
  ------------------
  113|      0|        goto memerr;
  114|      0|      }
  115|   393k|      asn1_refcount_set_one(pval, it);
  116|   393k|      asn1_enc_init(pval, it);
  117|  1.51M|      for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (117:39): [True: 1.12M, False: 393k]
  ------------------
  118|  1.12M|        pseqval = asn1_get_field_ptr(pval, tt);
  119|  1.12M|        if (!ASN1_template_new(pseqval, tt)) {
  ------------------
  |  Branch (119:13): [True: 0, False: 1.12M]
  ------------------
  120|      0|          goto memerr2;
  121|      0|        }
  122|  1.12M|      }
  123|   393k|      if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) {
  ------------------
  |  |  469|  28.1k|#define ASN1_OP_NEW_POST 1
  ------------------
  |  Branch (123:11): [True: 28.1k, False: 365k]
  |  Branch (123:22): [True: 0, False: 28.1k]
  ------------------
  124|      0|        goto auxerr2;
  125|      0|      }
  126|   393k|      break;
  127|   393k|    }
  128|  1.18M|  }
  129|  1.18M|  return 1;
  130|       |
  131|      0|memerr2:
  132|      0|  ASN1_item_ex_free(pval, it);
  133|      0|memerr:
  134|      0|  return 0;
  135|       |
  136|      0|auxerr2:
  137|      0|  ASN1_item_ex_free(pval, it);
  138|      0|auxerr:
  139|      0|  OPENSSL_PUT_ERROR(ASN1, ASN1_R_AUX_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  140|      0|  return 0;
  141|      0|}
tasn_new.cc:_ZL17ASN1_template_newPP13ASN1_VALUE_stPK16ASN1_TEMPLATE_st:
  168|  1.12M|static int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) {
  169|  1.12M|  const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
  ------------------
  |  |  241|  1.12M|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  170|  1.12M|  int ret;
  171|  1.12M|  if (tt->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  311|  1.12M|#define ASN1_TFLG_OPTIONAL (0x1)
  ------------------
  |  Branch (171:7): [True: 309k, False: 815k]
  ------------------
  172|   309k|    asn1_template_clear(pval, tt);
  173|   309k|    return 1;
  174|   309k|  }
  175|       |  // If ANY DEFINED BY nothing to do
  176|       |
  177|   815k|  if (tt->flags & ASN1_TFLG_ADB_MASK) {
  ------------------
  |  |  365|   815k|#define ASN1_TFLG_ADB_MASK (0x3 << 8)
  ------------------
  |  Branch (177:7): [True: 0, False: 815k]
  ------------------
  178|      0|    *pval = NULL;
  179|      0|    return 1;
  180|      0|  }
  181|       |  // If SET OF or SEQUENCE OF, its a STACK
  182|   815k|  if (tt->flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  320|   815k|#define ASN1_TFLG_SK_MASK (0x3 << 1)
  ------------------
  |  Branch (182:7): [True: 0, False: 815k]
  ------------------
  183|      0|    STACK_OF(ASN1_VALUE) *skval;
  ------------------
  |  |   39|      0|#define STACK_OF(type) struct stack_st_##type
  ------------------
  184|      0|    skval = sk_ASN1_VALUE_new_null();
  185|      0|    if (!skval) {
  ------------------
  |  Branch (185:9): [True: 0, False: 0]
  ------------------
  186|      0|      ret = 0;
  187|      0|      goto done;
  188|      0|    }
  189|      0|    *pval = (ASN1_VALUE *)skval;
  190|      0|    ret = 1;
  191|      0|    goto done;
  192|      0|  }
  193|       |  // Otherwise pass it back to the item routine
  194|   815k|  ret = ASN1_item_ex_new(pval, it);
  195|   815k|done:
  196|   815k|  return ret;
  197|   815k|}
tasn_new.cc:_ZL19asn1_template_clearPP13ASN1_VALUE_stPK16ASN1_TEMPLATE_st:
  199|   309k|static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) {
  200|       |  // If ADB or STACK just NULL the field
  201|   309k|  if (tt->flags & (ASN1_TFLG_ADB_MASK | ASN1_TFLG_SK_MASK)) {
  ------------------
  |  |  365|   309k|#define ASN1_TFLG_ADB_MASK (0x3 << 8)
  ------------------
                if (tt->flags & (ASN1_TFLG_ADB_MASK | ASN1_TFLG_SK_MASK)) {
  ------------------
  |  |  320|   309k|#define ASN1_TFLG_SK_MASK (0x3 << 1)
  ------------------
  |  Branch (201:7): [True: 28.1k, False: 281k]
  ------------------
  202|  28.1k|    *pval = NULL;
  203|   281k|  } else {
  204|   281k|    asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  241|   281k|#define ASN1_ITEM_ptr(iptr) (iptr)
  ------------------
  205|   281k|  }
  206|   309k|}
tasn_new.cc:_ZL15asn1_item_clearPP13ASN1_VALUE_stPK12ASN1_ITEM_st:
  143|   281k|static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  144|   281k|  switch (it->itype) {
  ------------------
  |  Branch (144:11): [True: 0, False: 281k]
  ------------------
  145|      0|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |  424|      0|#define ASN1_ITYPE_EXTERN 0x4
  ------------------
  |  Branch (145:5): [True: 0, False: 281k]
  ------------------
  146|      0|      *pval = NULL;
  147|      0|      break;
  148|       |
  149|   281k|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  418|   281k|#define ASN1_ITYPE_PRIMITIVE 0x0
  ------------------
  |  Branch (149:5): [True: 281k, False: 0]
  ------------------
  150|   281k|      if (it->templates) {
  ------------------
  |  Branch (150:11): [True: 0, False: 281k]
  ------------------
  151|      0|        asn1_template_clear(pval, it->templates);
  152|   281k|      } else {
  153|   281k|        asn1_primitive_clear(pval, it);
  154|   281k|      }
  155|   281k|      break;
  156|       |
  157|      0|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  426|      0|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (157:5): [True: 0, False: 281k]
  ------------------
  158|      0|      asn1_primitive_clear(pval, it);
  159|      0|      break;
  160|       |
  161|      0|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |  422|      0|#define ASN1_ITYPE_CHOICE 0x2
  ------------------
  |  Branch (161:5): [True: 0, False: 281k]
  ------------------
  162|      0|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |  420|      0|#define ASN1_ITYPE_SEQUENCE 0x1
  ------------------
  |  Branch (162:5): [True: 0, False: 281k]
  ------------------
  163|      0|      *pval = NULL;
  164|      0|      break;
  165|   281k|  }
  166|   281k|}
tasn_new.cc:_ZL20asn1_primitive_clearPP13ASN1_VALUE_stPK12ASN1_ITEM_st:
  261|   281k|static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  262|   281k|  int utype;
  263|       |  // Historically, |it->funcs| for primitive types contained an
  264|       |  // |ASN1_PRIMITIVE_FUNCS| table of calbacks.
  265|   281k|  assert(it == NULL || it->funcs == NULL);
  266|   281k|  if (!it || (it->itype == ASN1_ITYPE_MSTRING)) {
  ------------------
  |  |  426|   281k|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (266:7): [True: 0, False: 281k]
  |  Branch (266:14): [True: 0, False: 281k]
  ------------------
  267|      0|    utype = -1;
  268|   281k|  } else {
  269|   281k|    utype = it->utype;
  270|   281k|  }
  271|   281k|  if (utype == V_ASN1_BOOLEAN) {
  ------------------
  |  |   86|   281k|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (271:7): [True: 112k, False: 168k]
  ------------------
  272|   112k|    *(ASN1_BOOLEAN *)pval = (ASN1_BOOLEAN)it->size;
  273|   168k|  } else {
  274|   168k|    *pval = NULL;
  275|   168k|  }
  276|   281k|}
tasn_new.cc:_ZL18ASN1_primitive_newPP13ASN1_VALUE_stPK12ASN1_ITEM_st:
  211|   731k|static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  212|   731k|  if (!it) {
  ------------------
  |  Branch (212:7): [True: 0, False: 731k]
  ------------------
  213|      0|    return 0;
  214|      0|  }
  215|       |
  216|       |  // Historically, |it->funcs| for primitive types contained an
  217|       |  // |ASN1_PRIMITIVE_FUNCS| table of calbacks.
  218|   731k|  assert(it->funcs == NULL);
  219|       |
  220|   731k|  int utype;
  221|   731k|  if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |  426|   731k|#define ASN1_ITYPE_MSTRING 0x5
  ------------------
  |  Branch (221:7): [True: 56.2k, False: 674k]
  ------------------
  222|  56.2k|    utype = -1;
  223|   674k|  } else {
  224|   674k|    utype = it->utype;
  225|   674k|  }
  226|   731k|  switch (utype) {
  227|   309k|    case V_ASN1_OBJECT:
  ------------------
  |  |   91|   309k|#define V_ASN1_OBJECT 6
  ------------------
  |  Branch (227:5): [True: 309k, False: 421k]
  ------------------
  228|   309k|      *pval = (ASN1_VALUE *)OBJ_get_undef();
  229|   309k|      return 1;
  230|       |
  231|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   86|      0|#define V_ASN1_BOOLEAN 1
  ------------------
  |  Branch (231:5): [True: 0, False: 731k]
  ------------------
  232|      0|      *(ASN1_BOOLEAN *)pval = (ASN1_BOOLEAN)it->size;
  233|      0|      return 1;
  234|       |
  235|      0|    case V_ASN1_NULL:
  ------------------
  |  |   90|      0|#define V_ASN1_NULL 5
  ------------------
  |  Branch (235:5): [True: 0, False: 731k]
  ------------------
  236|      0|      *pval = (ASN1_VALUE *)1;
  237|      0|      return 1;
  238|       |
  239|  84.3k|    case V_ASN1_ANY: {
  ------------------
  |  |   78|  84.3k|#define V_ASN1_ANY (-4)
  ------------------
  |  Branch (239:5): [True: 84.3k, False: 646k]
  ------------------
  240|  84.3k|      ASN1_TYPE *typ =
  241|  84.3k|          reinterpret_cast<ASN1_TYPE *>(OPENSSL_malloc(sizeof(ASN1_TYPE)));
  242|  84.3k|      if (!typ) {
  ------------------
  |  Branch (242:11): [True: 0, False: 84.3k]
  ------------------
  243|      0|        return 0;
  244|      0|      }
  245|  84.3k|      typ->value.ptr = NULL;
  246|  84.3k|      typ->type = -1;
  247|  84.3k|      *pval = (ASN1_VALUE *)typ;
  248|  84.3k|      break;
  249|  84.3k|    }
  250|       |
  251|   337k|    default:
  ------------------
  |  Branch (251:5): [True: 337k, False: 393k]
  ------------------
  252|   337k|      *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype);
  253|   337k|      break;
  254|   731k|  }
  255|   421k|  if (*pval) {
  ------------------
  |  Branch (255:7): [True: 421k, False: 0]
  ------------------
  256|   421k|    return 1;
  257|   421k|  }
  258|      0|  return 0;
  259|   421k|}

ASN1_OCTET_STRING_free:
   26|  28.1k|  void sname##_free(sname *x) { ASN1_STRING_free(x); }
ASN1_INTEGER_new:
   25|  28.1k|  sname *sname##_new(void) { return ASN1_STRING_type_new(V_##sname); } \
ASN1_BIT_STRING_new:
   25|  28.1k|  sname *sname##_new(void) { return ASN1_STRING_type_new(V_##sname); } \
ASN1_BIT_STRING_free:
   26|  28.1k|  void sname##_free(sname *x) { ASN1_STRING_free(x); }

asn1_refcount_set_one:
   64|   393k|void asn1_refcount_set_one(ASN1_VALUE **pval, const ASN1_ITEM *it) {
   65|   393k|  CRYPTO_refcount_t *references = asn1_get_references(pval, it);
   66|   393k|  if (references != NULL) {
  ------------------
  |  Branch (66:7): [True: 0, False: 393k]
  ------------------
   67|      0|    *references = 1;
   68|      0|  }
   69|   393k|}
asn1_refcount_dec_and_test_zero:
   71|   393k|int asn1_refcount_dec_and_test_zero(ASN1_VALUE **pval, const ASN1_ITEM *it) {
   72|   393k|  CRYPTO_refcount_t *references = asn1_get_references(pval, it);
   73|   393k|  if (references != NULL) {
  ------------------
  |  Branch (73:7): [True: 0, False: 393k]
  ------------------
   74|      0|    return CRYPTO_refcount_dec_and_test_zero(references);
   75|      0|  }
   76|   393k|  return 1;
   77|   393k|}
asn1_enc_init:
   92|   393k|void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it) {
   93|   393k|  ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
   94|   393k|  if (enc) {
  ------------------
  |  Branch (94:7): [True: 28.1k, False: 365k]
  ------------------
   95|  28.1k|    enc->enc = NULL;
   96|  28.1k|    enc->len = 0;
   97|  28.1k|    enc->buf = NULL;
   98|  28.1k|  }
   99|   393k|}
asn1_enc_free:
  101|   393k|void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  102|   393k|  ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
  103|   393k|  if (enc) {
  ------------------
  |  Branch (103:7): [True: 28.1k, False: 365k]
  ------------------
  104|  28.1k|    asn1_encoding_clear(enc);
  105|  28.1k|  }
  106|   393k|}
asn1_enc_save:
  109|   337k|                  const ASN1_ITEM *it, CRYPTO_BUFFER *buf) {
  110|   337k|  ASN1_ENCODING *enc;
  111|   337k|  enc = asn1_get_enc_ptr(pval, it);
  112|   337k|  if (!enc) {
  ------------------
  |  Branch (112:7): [True: 309k, False: 28.1k]
  ------------------
  113|   309k|    return 1;
  114|   309k|  }
  115|       |
  116|  28.1k|  asn1_encoding_clear(enc);
  117|  28.1k|  if (buf != NULL) {
  ------------------
  |  Branch (117:7): [True: 28.1k, False: 2]
  ------------------
  118|  28.1k|    assert(CRYPTO_BUFFER_data(buf) <= in &&
  119|  28.1k|           in + in_len <= CRYPTO_BUFFER_data(buf) + CRYPTO_BUFFER_len(buf));
  120|  28.1k|    CRYPTO_BUFFER_up_ref(buf);
  121|  28.1k|    enc->buf = buf;
  122|  28.1k|    enc->enc = (uint8_t *)in;
  123|  28.1k|  } else {
  124|      2|    enc->enc = reinterpret_cast<uint8_t *>(OPENSSL_memdup(in, in_len));
  125|      2|    if (!enc->enc) {
  ------------------
  |  Branch (125:9): [True: 0, False: 2]
  ------------------
  126|      0|      return 0;
  127|      0|    }
  128|      2|  }
  129|       |
  130|  28.1k|  enc->len = in_len;
  131|  28.1k|  return 1;
  132|  28.1k|}
asn1_encoding_clear:
  134|  56.2k|void asn1_encoding_clear(ASN1_ENCODING *enc) {
  135|  56.2k|  if (enc->buf != NULL) {
  ------------------
  |  Branch (135:7): [True: 28.1k, False: 28.1k]
  ------------------
  136|  28.1k|    CRYPTO_BUFFER_free(enc->buf);
  137|  28.1k|  } else {
  138|  28.1k|    OPENSSL_free(enc->enc);
  139|  28.1k|  }
  140|  56.2k|  enc->enc = NULL;
  141|  56.2k|  enc->len = 0;
  142|  56.2k|  enc->buf = NULL;
  143|  56.2k|}
asn1_enc_restore:
  146|   377k|                     const ASN1_ITEM *it) {
  147|   377k|  ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
  148|   377k|  if (!enc || enc->len == 0) {
  ------------------
  |  Branch (148:7): [True: 343k, False: 34.2k]
  |  Branch (148:15): [True: 0, False: 34.2k]
  ------------------
  149|   343k|    return 0;
  150|   343k|  }
  151|  34.2k|  if (out) {
  ------------------
  |  Branch (151:7): [True: 17.1k, False: 17.1k]
  ------------------
  152|  17.1k|    OPENSSL_memcpy(*out, enc->enc, enc->len);
  153|  17.1k|    *out += enc->len;
  154|  17.1k|  }
  155|  34.2k|  if (len) {
  ------------------
  |  Branch (155:7): [True: 34.2k, False: 0]
  ------------------
  156|  34.2k|    *len = enc->len;
  157|  34.2k|  }
  158|  34.2k|  return 1;
  159|   377k|}
asn1_get_field_ptr:
  162|  4.20M|ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) {
  163|  4.20M|  ASN1_VALUE **pvaltmp =
  164|  4.20M|      reinterpret_cast<ASN1_VALUE **>(offset2ptr(*pval, tt->offset));
  ------------------
  |  |   33|  4.20M|#define offset2ptr(addr, offset) (void *)(((char *)(addr)) + (offset))
  ------------------
  165|       |  // NOTE for BOOLEAN types the field is just a plain int so we can't return
  166|       |  // int **, so settle for (int *).
  167|  4.20M|  return pvaltmp;
  168|  4.20M|}
asn1_do_adb:
  173|  3.08M|                                 int nullerr) {
  174|  3.08M|  const ASN1_ADB *adb;
  175|  3.08M|  const ASN1_ADB_TABLE *atbl;
  176|  3.08M|  ASN1_VALUE **sfld;
  177|  3.08M|  int i;
  178|  3.08M|  if (!(tt->flags & ASN1_TFLG_ADB_MASK)) {
  ------------------
  |  |  365|  3.08M|#define ASN1_TFLG_ADB_MASK (0x3 << 8)
  ------------------
  |  Branch (178:7): [True: 3.08M, False: 0]
  ------------------
  179|  3.08M|    return tt;
  180|  3.08M|  }
  181|       |
  182|       |  // Else ANY DEFINED BY ... get the table
  183|      0|  adb = ASN1_ADB_ptr(tt->item);
  ------------------
  |  |   37|      0|#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))
  ------------------
  184|       |
  185|       |  // Get the selector field
  186|      0|  sfld = reinterpret_cast<ASN1_VALUE **>(offset2ptr(*pval, adb->offset));
  ------------------
  |  |   33|      0|#define offset2ptr(addr, offset) (void *)(((char *)(addr)) + (offset))
  ------------------
  187|       |
  188|       |  // Check if NULL
  189|      0|  int selector;
  190|      0|  if (*sfld == NULL) {
  ------------------
  |  Branch (190:7): [True: 0, False: 0]
  ------------------
  191|      0|    if (!adb->null_tt) {
  ------------------
  |  Branch (191:9): [True: 0, False: 0]
  ------------------
  192|      0|      goto err;
  193|      0|    }
  194|      0|    return adb->null_tt;
  195|      0|  }
  196|       |
  197|       |  // Convert type to a NID:
  198|       |  // NB: don't check for NID_undef here because it
  199|       |  // might be a legitimate value in the table
  200|      0|  assert(tt->flags & ASN1_TFLG_ADB_OID);
  201|      0|  selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld);
  202|       |
  203|       |  // Try to find matching entry in table Maybe should check application types
  204|       |  // first to allow application override? Might also be useful to have a flag
  205|       |  // which indicates table is sorted and we can do a binary search. For now
  206|       |  // stick to a linear search.
  207|       |
  208|      0|  for (atbl = adb->tbl, i = 0; i < adb->tblcount; i++, atbl++) {
  ------------------
  |  Branch (208:32): [True: 0, False: 0]
  ------------------
  209|      0|    if (atbl->value == selector) {
  ------------------
  |  Branch (209:9): [True: 0, False: 0]
  ------------------
  210|      0|      return &atbl->tt;
  211|      0|    }
  212|      0|  }
  213|       |
  214|       |  // FIXME: need to search application table too
  215|       |
  216|       |  // No match, return default type
  217|      0|  if (!adb->default_tt) {
  ------------------
  |  Branch (217:7): [True: 0, False: 0]
  ------------------
  218|      0|    goto err;
  219|      0|  }
  220|      0|  return adb->default_tt;
  221|       |
  222|      0|err:
  223|       |  // FIXME: should log the value or OID of unsupported type
  224|      0|  if (nullerr) {
  ------------------
  |  Branch (224:7): [True: 0, False: 0]
  ------------------
  225|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  226|      0|  }
  227|      0|  return NULL;
  228|      0|}
tasn_utl.cc:_ZL19asn1_get_referencesPP13ASN1_VALUE_stPK12ASN1_ITEM_st:
   52|   787k|                                              const ASN1_ITEM *it) {
   53|   787k|  if (it->itype != ASN1_ITYPE_SEQUENCE) {
  ------------------
  |  |  420|   787k|#define ASN1_ITYPE_SEQUENCE 0x1
  ------------------
  |  Branch (53:7): [True: 0, False: 787k]
  ------------------
   54|      0|    return NULL;
   55|      0|  }
   56|   787k|  const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
   57|   787k|  if (!aux || !(aux->flags & ASN1_AFLG_REFCOUNT)) {
  ------------------
  |  |  462|   112k|#define ASN1_AFLG_REFCOUNT 1
  ------------------
  |  Branch (57:7): [True: 674k, False: 112k]
  |  Branch (57:15): [True: 112k, False: 0]
  ------------------
   58|   787k|    return NULL;
   59|   787k|  }
   60|      0|  return reinterpret_cast<CRYPTO_refcount_t *>(
   61|      0|      offset2ptr(*pval, aux->ref_offset));
  ------------------
  |  |   33|      0|#define offset2ptr(addr, offset) (void *)(((char *)(addr)) + (offset))
  ------------------
   62|   787k|}
tasn_utl.cc:_ZL16asn1_get_enc_ptrPP13ASN1_VALUE_stPK12ASN1_ITEM_st:
   79|  1.50M|static ASN1_ENCODING *asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it) {
   80|  1.50M|  assert(it->itype == ASN1_ITYPE_SEQUENCE);
   81|  1.50M|  const ASN1_AUX *aux;
   82|  1.50M|  if (!pval || !*pval) {
  ------------------
  |  Branch (82:7): [True: 0, False: 1.50M]
  |  Branch (82:16): [True: 0, False: 1.50M]
  ------------------
   83|      0|    return NULL;
   84|      0|  }
   85|  1.50M|  aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
   86|  1.50M|  if (!aux || !(aux->flags & ASN1_AFLG_ENCODING)) {
  ------------------
  |  |  464|   259k|#define ASN1_AFLG_ENCODING 2
  ------------------
  |  Branch (86:7): [True: 1.24M, False: 259k]
  |  Branch (86:15): [True: 140k, False: 118k]
  ------------------
   87|  1.38M|    return NULL;
   88|  1.38M|  }
   89|   118k|  return reinterpret_cast<ASN1_ENCODING *>(offset2ptr(*pval, aux->enc_offset));
  ------------------
  |  |   33|   118k|#define offset2ptr(addr, offset) (void *)(((char *)(addr)) + (offset))
  ------------------
   90|  1.50M|}

BN_parse_asn1_unsigned:
   21|  70.4k|int BN_parse_asn1_unsigned(CBS *cbs, BIGNUM *ret) {
   22|  70.4k|  CBS child;
   23|  70.4k|  int is_negative;
   24|  70.4k|  if (!CBS_get_asn1(cbs, &child, CBS_ASN1_INTEGER) ||
  ------------------
  |  |  216|  70.4k|#define CBS_ASN1_INTEGER 0x2u
  ------------------
  |  Branch (24:7): [True: 0, False: 70.4k]
  ------------------
   25|  70.4k|      !CBS_is_valid_asn1_integer(&child, &is_negative)) {
  ------------------
  |  Branch (25:7): [True: 0, False: 70.4k]
  ------------------
   26|      0|    OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   27|      0|    return 0;
   28|      0|  }
   29|       |
   30|  70.4k|  if (is_negative) {
  ------------------
  |  Branch (30:7): [True: 0, False: 70.4k]
  ------------------
   31|      0|    OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   32|      0|    return 0;
   33|      0|  }
   34|       |
   35|  70.4k|  return BN_bin2bn(CBS_data(&child), CBS_len(&child), ret) != NULL;
   36|  70.4k|}

BUF_MEM_new:
   25|   117k|BUF_MEM *BUF_MEM_new(void) {
   26|   117k|  return reinterpret_cast<BUF_MEM *>(OPENSSL_zalloc(sizeof(BUF_MEM)));
   27|   117k|}
BUF_MEM_free:
   29|   117k|void BUF_MEM_free(BUF_MEM *buf) {
   30|   117k|  if (buf == nullptr) {
  ------------------
  |  Branch (30:7): [True: 0, False: 117k]
  ------------------
   31|      0|    return;
   32|      0|  }
   33|   117k|  OPENSSL_free(buf->data);
   34|   117k|  OPENSSL_free(buf);
   35|   117k|}
BUF_MEM_reserve:
   37|  56.2k|int BUF_MEM_reserve(BUF_MEM *buf, size_t cap) {
   38|  56.2k|  if (buf->max >= cap) {
  ------------------
  |  Branch (38:7): [True: 0, False: 56.2k]
  ------------------
   39|      0|    return 1;
   40|      0|  }
   41|       |
   42|  56.2k|  size_t n = cap + 3;
   43|  56.2k|  if (n < cap) {
  ------------------
  |  Branch (43:7): [True: 0, False: 56.2k]
  ------------------
   44|      0|    OPENSSL_PUT_ERROR(BUF, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   45|      0|    return 0;
   46|      0|  }
   47|  56.2k|  n = n / 3;
   48|  56.2k|  size_t alloc_size = n * 4;
   49|  56.2k|  if (alloc_size / 4 != n) {
  ------------------
  |  Branch (49:7): [True: 0, False: 56.2k]
  ------------------
   50|      0|    OPENSSL_PUT_ERROR(BUF, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   51|      0|    return 0;
   52|      0|  }
   53|       |
   54|  56.2k|  char *new_buf =
   55|  56.2k|      reinterpret_cast<char *>(OPENSSL_realloc(buf->data, alloc_size));
   56|  56.2k|  if (new_buf == NULL) {
  ------------------
  |  Branch (56:7): [True: 0, False: 56.2k]
  ------------------
   57|      0|    return 0;
   58|      0|  }
   59|       |
   60|  56.2k|  buf->data = new_buf;
   61|  56.2k|  buf->max = alloc_size;
   62|  56.2k|  return 1;
   63|  56.2k|}
BUF_MEM_grow:
   65|  56.2k|size_t BUF_MEM_grow(BUF_MEM *buf, size_t len) {
   66|  56.2k|  if (!BUF_MEM_reserve(buf, len)) {
  ------------------
  |  Branch (66:7): [True: 0, False: 56.2k]
  ------------------
   67|      0|    return 0;
   68|      0|  }
   69|  56.2k|  if (buf->length < len) {
  ------------------
  |  Branch (69:7): [True: 56.2k, False: 0]
  ------------------
   70|  56.2k|    OPENSSL_memset(&buf->data[buf->length], 0, len - buf->length);
   71|  56.2k|  }
   72|  56.2k|  buf->length = len;
   73|  56.2k|  return len;
   74|  56.2k|}

CBB_finish_i2d:
   28|  17.1k|int CBB_finish_i2d(CBB *cbb, uint8_t **outp) {
   29|  17.1k|  assert(!cbb->is_child);
   30|  17.1k|  assert(cbb->u.base.can_resize);
   31|       |
   32|  17.1k|  uint8_t *der;
   33|  17.1k|  size_t der_len;
   34|  17.1k|  if (!CBB_finish(cbb, &der, &der_len)) {
  ------------------
  |  Branch (34:7): [True: 0, False: 17.1k]
  ------------------
   35|      0|    CBB_cleanup(cbb);
   36|      0|    return -1;
   37|      0|  }
   38|  17.1k|  if (der_len > INT_MAX) {
  ------------------
  |  Branch (38:7): [True: 0, False: 17.1k]
  ------------------
   39|      0|    OPENSSL_free(der);
   40|      0|    return -1;
   41|      0|  }
   42|  17.1k|  if (outp != NULL) {
  ------------------
  |  Branch (42:7): [True: 17.1k, False: 0]
  ------------------
   43|  17.1k|    if (*outp == NULL) {
  ------------------
  |  Branch (43:9): [True: 17.1k, False: 0]
  ------------------
   44|  17.1k|      *outp = der;
   45|  17.1k|      der = NULL;
   46|  17.1k|    } else {
   47|      0|      OPENSSL_memcpy(*outp, der, der_len);
   48|      0|      *outp += der_len;
   49|      0|    }
   50|  17.1k|  }
   51|  17.1k|  OPENSSL_free(der);
   52|  17.1k|  return (int)der_len;
   53|  17.1k|}

CBB_zero:
   27|   181k|void CBB_zero(CBB *cbb) { OPENSSL_memset(cbb, 0, sizeof(CBB)); }
CBB_init:
   39|  73.3k|int CBB_init(CBB *cbb, size_t initial_capacity) {
   40|  73.3k|  CBB_zero(cbb);
   41|       |
   42|  73.3k|  uint8_t *buf = reinterpret_cast<uint8_t *>(OPENSSL_malloc(initial_capacity));
   43|  73.3k|  if (initial_capacity > 0 && buf == NULL) {
  ------------------
  |  Branch (43:7): [True: 73.3k, False: 0]
  |  Branch (43:31): [True: 0, False: 73.3k]
  ------------------
   44|      0|    return 0;
   45|      0|  }
   46|       |
   47|  73.3k|  cbb_init(cbb, buf, initial_capacity, /*can_resize=*/1);
   48|  73.3k|  return 1;
   49|  73.3k|}
CBB_cleanup:
   57|  90.5k|void CBB_cleanup(CBB *cbb) {
   58|       |  // Child |CBB|s are non-owning. They are implicitly discarded and should not
   59|       |  // be used with |CBB_cleanup| or |ScopedCBB|.
   60|  90.5k|  assert(!cbb->is_child);
   61|  90.5k|  if (cbb->is_child) {
  ------------------
  |  Branch (61:7): [True: 0, False: 90.5k]
  ------------------
   62|      0|    return;
   63|      0|  }
   64|       |
   65|  90.5k|  if (cbb->u.base.can_resize) {
  ------------------
  |  Branch (65:7): [True: 90.5k, False: 0]
  ------------------
   66|  90.5k|    OPENSSL_free(cbb->u.base.buf);
   67|  90.5k|  }
   68|  90.5k|}
CBB_finish:
  124|  73.3k|int CBB_finish(CBB *cbb, uint8_t **out_data, size_t *out_len) {
  125|  73.3k|  if (cbb->is_child) {
  ------------------
  |  Branch (125:7): [True: 0, False: 73.3k]
  ------------------
  126|      0|    OPENSSL_PUT_ERROR(CRYPTO, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  127|      0|    return 0;
  128|      0|  }
  129|       |
  130|  73.3k|  if (!CBB_flush(cbb)) {
  ------------------
  |  Branch (130:7): [True: 0, False: 73.3k]
  ------------------
  131|      0|    return 0;
  132|      0|  }
  133|       |
  134|  73.3k|  if (cbb->u.base.can_resize && (out_data == NULL || out_len == NULL)) {
  ------------------
  |  Branch (134:7): [True: 73.3k, False: 0]
  |  Branch (134:34): [True: 0, False: 73.3k]
  |  Branch (134:54): [True: 0, False: 73.3k]
  ------------------
  135|       |    // |out_data| and |out_len| can only be NULL if the CBB is fixed.
  136|      0|    return 0;
  137|      0|  }
  138|       |
  139|  73.3k|  if (out_data != NULL) {
  ------------------
  |  Branch (139:7): [True: 73.3k, False: 0]
  ------------------
  140|  73.3k|    *out_data = cbb->u.base.buf;
  141|  73.3k|  }
  142|  73.3k|  if (out_len != NULL) {
  ------------------
  |  Branch (142:7): [True: 73.3k, False: 0]
  ------------------
  143|  73.3k|    *out_len = cbb->u.base.len;
  144|  73.3k|  }
  145|  73.3k|  cbb->u.base.buf = NULL;
  146|  73.3k|  CBB_cleanup(cbb);
  147|  73.3k|  return 1;
  148|  73.3k|}
CBB_flush:
  183|   694k|int CBB_flush(CBB *cbb) {
  184|       |  // If |base| has hit an error, the buffer is in an undefined state, so
  185|       |  // fail all following calls. In particular, |cbb->child| may point to invalid
  186|       |  // memory.
  187|   694k|  struct cbb_buffer_st *base = cbb_get_base(cbb);
  188|   694k|  if (base == NULL || base->error) {
  ------------------
  |  Branch (188:7): [True: 0, False: 694k]
  |  Branch (188:23): [True: 0, False: 694k]
  ------------------
  189|      0|    return 0;
  190|      0|  }
  191|       |
  192|   694k|  if (cbb->child == NULL) {
  ------------------
  |  Branch (192:7): [True: 660k, False: 34.2k]
  ------------------
  193|       |    // Nothing to flush.
  194|   660k|    return 1;
  195|   660k|  }
  196|       |
  197|  34.2k|  assert(cbb->child->is_child);
  198|  34.2k|  struct cbb_child_st *child = &cbb->child->u.child;
  199|  34.2k|  assert(child->base == base);
  200|  34.2k|  size_t child_start = child->offset + child->pending_len_len;
  201|       |
  202|  34.2k|  size_t len;
  203|  34.2k|  if (!CBB_flush(cbb->child) || child_start < child->offset ||
  ------------------
  |  Branch (203:7): [True: 0, False: 34.2k]
  |  Branch (203:33): [True: 0, False: 34.2k]
  ------------------
  204|  34.2k|      base->len < child_start) {
  ------------------
  |  Branch (204:7): [True: 0, False: 34.2k]
  ------------------
  205|      0|    goto err;
  206|      0|  }
  207|       |
  208|  34.2k|  len = base->len - child_start;
  209|       |
  210|  34.2k|  if (child->pending_is_asn1) {
  ------------------
  |  Branch (210:7): [True: 34.2k, False: 0]
  ------------------
  211|       |    // For ASN.1 we assume that we'll only need a single byte for the length.
  212|       |    // If that turned out to be incorrect, we have to move the contents along
  213|       |    // in order to make space.
  214|  34.2k|    uint8_t len_len;
  215|  34.2k|    uint8_t initial_length_byte;
  216|       |
  217|  34.2k|    assert(child->pending_len_len == 1);
  218|       |
  219|  34.2k|    if (len > 0xfffffffe) {
  ------------------
  |  Branch (219:9): [True: 0, False: 34.2k]
  ------------------
  220|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  221|       |      // Too large.
  222|      0|      goto err;
  223|  34.2k|    } else if (len > 0xffffff) {
  ------------------
  |  Branch (223:16): [True: 0, False: 34.2k]
  ------------------
  224|      0|      len_len = 5;
  225|      0|      initial_length_byte = 0x80 | 4;
  226|  34.2k|    } else if (len > 0xffff) {
  ------------------
  |  Branch (226:16): [True: 0, False: 34.2k]
  ------------------
  227|      0|      len_len = 4;
  228|      0|      initial_length_byte = 0x80 | 3;
  229|  34.2k|    } else if (len > 0xff) {
  ------------------
  |  Branch (229:16): [True: 34.2k, False: 0]
  ------------------
  230|  34.2k|      len_len = 3;
  231|  34.2k|      initial_length_byte = 0x80 | 2;
  232|  34.2k|    } else if (len > 0x7f) {
  ------------------
  |  Branch (232:16): [True: 0, False: 0]
  ------------------
  233|      0|      len_len = 2;
  234|      0|      initial_length_byte = 0x80 | 1;
  235|      0|    } else {
  236|      0|      len_len = 1;
  237|      0|      initial_length_byte = (uint8_t)len;
  238|      0|      len = 0;
  239|      0|    }
  240|       |
  241|  34.2k|    if (len_len != 1) {
  ------------------
  |  Branch (241:9): [True: 34.2k, False: 0]
  ------------------
  242|       |      // We need to move the contents along in order to make space.
  243|  34.2k|      size_t extra_bytes = len_len - 1;
  244|  34.2k|      if (!cbb_buffer_add(base, NULL, extra_bytes)) {
  ------------------
  |  Branch (244:11): [True: 0, False: 34.2k]
  ------------------
  245|      0|        goto err;
  246|      0|      }
  247|  34.2k|      OPENSSL_memmove(base->buf + child_start + extra_bytes,
  248|  34.2k|                      base->buf + child_start, len);
  249|  34.2k|    }
  250|  34.2k|    base->buf[child->offset++] = initial_length_byte;
  251|  34.2k|    child->pending_len_len = len_len - 1;
  252|  34.2k|  }
  253|       |
  254|   102k|  for (size_t i = child->pending_len_len - 1; i < child->pending_len_len; i--) {
  ------------------
  |  Branch (254:47): [True: 68.5k, False: 34.2k]
  ------------------
  255|  68.5k|    base->buf[child->offset + i] = (uint8_t)len;
  256|  68.5k|    len >>= 8;
  257|  68.5k|  }
  258|  34.2k|  if (len != 0) {
  ------------------
  |  Branch (258:7): [True: 0, False: 34.2k]
  ------------------
  259|      0|    OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  260|      0|    goto err;
  261|      0|  }
  262|       |
  263|  34.2k|  child->base = NULL;
  264|  34.2k|  cbb->child = NULL;
  265|       |
  266|  34.2k|  return 1;
  267|       |
  268|      0|err:
  269|      0|  cbb_on_error(cbb);
  270|      0|  return 0;
  271|  34.2k|}
CBB_add_asn1:
  364|  34.2k|int CBB_add_asn1(CBB *cbb, CBB *out_contents, CBS_ASN1_TAG tag) {
  365|  34.2k|  if (!CBB_flush(cbb)) {
  ------------------
  |  Branch (365:7): [True: 0, False: 34.2k]
  ------------------
  366|      0|    return 0;
  367|      0|  }
  368|       |
  369|       |  // Split the tag into leading bits and tag number.
  370|  34.2k|  uint8_t tag_bits = (tag >> CBS_ASN1_TAG_SHIFT) & 0xe0;
  ------------------
  |  |  194|  34.2k|#define CBS_ASN1_TAG_SHIFT 24
  ------------------
  371|  34.2k|  CBS_ASN1_TAG tag_number = tag & CBS_ASN1_TAG_NUMBER_MASK;
  ------------------
  |  |  211|  34.2k|#define CBS_ASN1_TAG_NUMBER_MASK ((1u << (5 + CBS_ASN1_TAG_SHIFT)) - 1)
  |  |  ------------------
  |  |  |  |  194|  34.2k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
  372|  34.2k|  if (tag_number >= 0x1f) {
  ------------------
  |  Branch (372:7): [True: 0, False: 34.2k]
  ------------------
  373|       |    // Set all the bits in the tag number to signal high tag number form.
  374|      0|    if (!CBB_add_u8(cbb, tag_bits | 0x1f) ||
  ------------------
  |  Branch (374:9): [True: 0, False: 0]
  ------------------
  375|      0|        !add_base128_integer(cbb, tag_number)) {
  ------------------
  |  Branch (375:9): [True: 0, False: 0]
  ------------------
  376|      0|      return 0;
  377|      0|    }
  378|  34.2k|  } else if (!CBB_add_u8(cbb, tag_bits | tag_number)) {
  ------------------
  |  Branch (378:14): [True: 0, False: 34.2k]
  ------------------
  379|      0|    return 0;
  380|      0|  }
  381|       |
  382|       |  // Reserve one byte of length prefix. |CBB_flush| will finish it later.
  383|  34.2k|  return cbb_add_child(cbb, out_contents, /*len_len=*/1, /*is_asn1=*/1);
  384|  34.2k|}
CBB_add_space:
  404|   535k|int CBB_add_space(CBB *cbb, uint8_t **out_data, size_t len) {
  405|   535k|  if (!CBB_flush(cbb) || !cbb_buffer_add(cbb_get_base(cbb), out_data, len)) {
  ------------------
  |  Branch (405:7): [True: 0, False: 535k]
  |  Branch (405:26): [True: 0, False: 535k]
  ------------------
  406|      0|    return 0;
  407|      0|  }
  408|   535k|  return 1;
  409|   535k|}
CBB_add_u8:
  449|   484k|int CBB_add_u8(CBB *cbb, uint8_t value) { return cbb_add_u(cbb, value, 1); }
cbb.cc:_ZL8cbb_initP6cbb_stPhmi:
   29|  73.3k|static void cbb_init(CBB *cbb, uint8_t *buf, size_t cap, int can_resize) {
   30|  73.3k|  cbb->is_child = 0;
   31|  73.3k|  cbb->child = NULL;
   32|  73.3k|  cbb->u.base.buf = buf;
   33|  73.3k|  cbb->u.base.len = 0;
   34|  73.3k|  cbb->u.base.cap = cap;
   35|  73.3k|  cbb->u.base.can_resize = can_resize;
   36|  73.3k|  cbb->u.base.error = 0;
   37|  73.3k|}
cbb.cc:_ZL12cbb_get_baseP6cbb_st:
  150|  1.26M|static struct cbb_buffer_st *cbb_get_base(CBB *cbb) {
  151|  1.26M|  if (cbb->is_child) {
  ------------------
  |  Branch (151:7): [True: 222k, False: 1.04M]
  ------------------
  152|   222k|    return cbb->u.child.base;
  153|   222k|  }
  154|  1.04M|  return &cbb->u.base;
  155|  1.26M|}
cbb.cc:_ZL14cbb_buffer_addP13cbb_buffer_stPPhm:
  115|   604k|                          size_t len) {
  116|   604k|  if (!cbb_buffer_reserve(base, out, len)) {
  ------------------
  |  Branch (116:7): [True: 0, False: 604k]
  ------------------
  117|      0|    return 0;
  118|      0|  }
  119|       |  // This will not overflow or |cbb_buffer_reserve| would have failed.
  120|   604k|  base->len += len;
  121|   604k|  return 1;
  122|   604k|}
cbb.cc:_ZL13cbb_add_childP6cbb_stS0_hi:
  294|  34.2k|                         int is_asn1) {
  295|  34.2k|  assert(cbb->child == NULL);
  296|  34.2k|  assert(!is_asn1 || len_len == 1);
  297|  34.2k|  struct cbb_buffer_st *base = cbb_get_base(cbb);
  298|  34.2k|  size_t offset = base->len;
  299|       |
  300|       |  // Reserve space for the length prefix.
  301|  34.2k|  uint8_t *prefix_bytes;
  302|  34.2k|  if (!cbb_buffer_add(base, &prefix_bytes, len_len)) {
  ------------------
  |  Branch (302:7): [True: 0, False: 34.2k]
  ------------------
  303|      0|    return 0;
  304|      0|  }
  305|  34.2k|  OPENSSL_memset(prefix_bytes, 0, len_len);
  306|       |
  307|  34.2k|  CBB_zero(out_child);
  308|  34.2k|  out_child->is_child = 1;
  309|  34.2k|  out_child->u.child.base = base;
  310|  34.2k|  out_child->u.child.offset = offset;
  311|  34.2k|  out_child->u.child.pending_len_len = len_len;
  312|  34.2k|  out_child->u.child.pending_is_asn1 = is_asn1;
  313|  34.2k|  cbb->child = out_child;
  314|  34.2k|  return 1;
  315|  34.2k|}
cbb.cc:_ZL18cbb_buffer_reserveP13cbb_buffer_stPPhm:
   71|   604k|                              size_t len) {
   72|   604k|  if (base == NULL) {
  ------------------
  |  Branch (72:7): [True: 0, False: 604k]
  ------------------
   73|      0|    return 0;
   74|      0|  }
   75|       |
   76|   604k|  size_t newlen = base->len + len;
   77|   604k|  if (newlen < base->len) {
  ------------------
  |  Branch (77:7): [True: 0, False: 604k]
  ------------------
   78|       |    // Overflow
   79|      0|    OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   80|      0|    goto err;
   81|      0|  }
   82|       |
   83|   604k|  if (newlen > base->cap) {
  ------------------
  |  Branch (83:7): [True: 34.2k, False: 569k]
  ------------------
   84|  34.2k|    if (!base->can_resize) {
  ------------------
  |  Branch (84:9): [True: 0, False: 34.2k]
  ------------------
   85|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   86|      0|      goto err;
   87|      0|    }
   88|       |
   89|  34.2k|    size_t newcap = base->cap * 2;
   90|  34.2k|    if (newcap < base->cap || newcap < newlen) {
  ------------------
  |  Branch (90:9): [True: 0, False: 34.2k]
  |  Branch (90:31): [True: 17.1k, False: 17.1k]
  ------------------
   91|  17.1k|      newcap = newlen;
   92|  17.1k|    }
   93|  34.2k|    uint8_t *newbuf =
   94|  34.2k|        reinterpret_cast<uint8_t *>(OPENSSL_realloc(base->buf, newcap));
   95|  34.2k|    if (newbuf == NULL) {
  ------------------
  |  Branch (95:9): [True: 0, False: 34.2k]
  ------------------
   96|      0|      goto err;
   97|      0|    }
   98|       |
   99|  34.2k|    base->buf = newbuf;
  100|  34.2k|    base->cap = newcap;
  101|  34.2k|  }
  102|       |
  103|   604k|  if (out) {
  ------------------
  |  Branch (103:7): [True: 569k, False: 34.2k]
  ------------------
  104|   569k|    *out = base->buf + base->len;
  105|   569k|  }
  106|       |
  107|   604k|  return 1;
  108|       |
  109|      0|err:
  110|      0|  base->error = 1;
  111|      0|  return 0;
  112|   604k|}
cbb.cc:_ZL9cbb_add_uP6cbb_stmm:
  429|   484k|static int cbb_add_u(CBB *cbb, uint64_t v, size_t len_len) {
  430|   484k|  uint8_t *buf;
  431|   484k|  if (!CBB_add_space(cbb, &buf, len_len)) {
  ------------------
  |  Branch (431:7): [True: 0, False: 484k]
  ------------------
  432|      0|    return 0;
  433|      0|  }
  434|       |
  435|   968k|  for (size_t i = len_len - 1; i < len_len; i--) {
  ------------------
  |  Branch (435:32): [True: 484k, False: 484k]
  ------------------
  436|   484k|    buf[i] = v;
  437|   484k|    v >>= 8;
  438|   484k|  }
  439|       |
  440|       |  // |v| must fit in |len_len| bytes.
  441|   484k|  if (v != 0) {
  ------------------
  |  Branch (441:7): [True: 0, False: 484k]
  ------------------
  442|      0|    cbb_on_error(cbb);
  443|      0|    return 0;
  444|      0|  }
  445|       |
  446|   484k|  return 1;
  447|   484k|}

CBS_skip:
   40|  1.97M|int CBS_skip(CBS *cbs, size_t len) {
   41|  1.97M|  const uint8_t *dummy;
   42|  1.97M|  return cbs_get(cbs, &dummy, len);
   43|  1.97M|}
CBS_get_u8:
   95|  7.88M|int CBS_get_u8(CBS *cbs, uint8_t *out) {
   96|  7.88M|  const uint8_t *v;
   97|  7.88M|  if (!cbs_get(cbs, &v, 1)) {
  ------------------
  |  Branch (97:7): [True: 286k, False: 7.59M]
  ------------------
   98|   286k|    return 0;
   99|   286k|  }
  100|  7.59M|  *out = *v;
  101|  7.59M|  return 1;
  102|  7.88M|}
CBS_get_u16:
  104|  44.8k|int CBS_get_u16(CBS *cbs, uint16_t *out) {
  105|  44.8k|  uint64_t v;
  106|  44.8k|  if (!cbs_get_u(cbs, &v, 2)) {
  ------------------
  |  Branch (106:7): [True: 3.60k, False: 41.2k]
  ------------------
  107|  3.60k|    return 0;
  108|  3.60k|  }
  109|  41.2k|  *out = v;
  110|  41.2k|  return 1;
  111|  44.8k|}
CBS_get_u32:
  130|  23.6k|int CBS_get_u32(CBS *cbs, uint32_t *out) {
  131|  23.6k|  uint64_t v;
  132|  23.6k|  if (!cbs_get_u(cbs, &v, 4)) {
  ------------------
  |  Branch (132:7): [True: 253, False: 23.3k]
  ------------------
  133|    253|    return 0;
  134|    253|  }
  135|  23.3k|  *out = (uint32_t)v;
  136|  23.3k|  return 1;
  137|  23.6k|}
CBS_get_bytes:
  166|  2.16M|int CBS_get_bytes(CBS *cbs, CBS *out, size_t len) {
  167|  2.16M|  const uint8_t *v;
  168|  2.16M|  if (!cbs_get(cbs, &v, len)) {
  ------------------
  |  Branch (168:7): [True: 5.02k, False: 2.16M]
  ------------------
  169|  5.02k|    return 0;
  170|  5.02k|  }
  171|  2.16M|  CBS_init(out, v, len);
  172|  2.16M|  return 1;
  173|  2.16M|}
CBS_get_u8_length_prefixed:
  195|   102k|int CBS_get_u8_length_prefixed(CBS *cbs, CBS *out) {
  196|   102k|  return cbs_get_length_prefixed(cbs, out, 1);
  197|   102k|}
CBS_get_u16_length_prefixed:
  199|  70.3k|int CBS_get_u16_length_prefixed(CBS *cbs, CBS *out) {
  200|  70.3k|  return cbs_get_length_prefixed(cbs, out, 2);
  201|  70.3k|}
CBS_get_any_asn1:
  407|  1.54M|int CBS_get_any_asn1(CBS *cbs, CBS *out, CBS_ASN1_TAG *out_tag) {
  408|  1.54M|  size_t header_len;
  409|  1.54M|  if (!CBS_get_any_asn1_element(cbs, out, out_tag, &header_len)) {
  ------------------
  |  Branch (409:7): [True: 0, False: 1.54M]
  ------------------
  410|      0|    return 0;
  411|      0|  }
  412|       |
  413|  1.54M|  if (out && !CBS_skip(out, header_len)) {
  ------------------
  |  Branch (413:7): [True: 1.54M, False: 0]
  |  Branch (413:14): [True: 0, False: 1.54M]
  ------------------
  414|      0|    assert(0);
  415|      0|    return 0;
  416|      0|  }
  417|       |
  418|  1.54M|  return 1;
  419|  1.54M|}
CBS_get_any_asn1_element:
  422|  1.96M|                             size_t *out_header_len) {
  423|  1.96M|  return cbs_get_any_asn1_element(cbs, out, out_tag, out_header_len, NULL, NULL,
  424|  1.96M|                                  /*ber_ok=*/0);
  425|  1.96M|}
CBS_get_any_ber_asn1_element:
  429|  28.1k|                                 int *out_indefinite) {
  430|  28.1k|  int ber_found_temp;
  431|  28.1k|  return cbs_get_any_asn1_element(
  432|  28.1k|      cbs, out, out_tag, out_header_len,
  433|  28.1k|      out_ber_found ? out_ber_found : &ber_found_temp, out_indefinite,
  ------------------
  |  Branch (433:7): [True: 0, False: 28.1k]
  ------------------
  434|  28.1k|      /*ber_ok=*/1);
  435|  28.1k|}
CBS_get_asn1:
  460|   366k|int CBS_get_asn1(CBS *cbs, CBS *out, CBS_ASN1_TAG tag_value) {
  461|   366k|  return cbs_get_asn1(cbs, out, tag_value, 1 /* skip header */);
  462|   366k|}
CBS_get_asn1_element:
  464|  56.2k|int CBS_get_asn1_element(CBS *cbs, CBS *out, CBS_ASN1_TAG tag_value) {
  465|  56.2k|  return cbs_get_asn1(cbs, out, tag_value, 0 /* include header */);
  466|  56.2k|}
CBS_peek_asn1_tag:
  468|  7.09k|int CBS_peek_asn1_tag(const CBS *cbs, CBS_ASN1_TAG tag_value) {
  469|  7.09k|  CBS copy = *cbs;
  470|  7.09k|  CBS_ASN1_TAG actual_tag;
  471|  7.09k|  return parse_asn1_tag(&copy, &actual_tag) && tag_value == actual_tag;
  ------------------
  |  Branch (471:10): [True: 7.09k, False: 0]
  |  Branch (471:48): [True: 7.09k, False: 0]
  ------------------
  472|  7.09k|}
CBS_get_asn1_uint64:
  474|      2|int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out) {
  475|      2|  return CBS_get_asn1_uint64_with_tag(cbs, out, CBS_ASN1_INTEGER);
  ------------------
  |  |  216|      2|#define CBS_ASN1_INTEGER 0x2u
  ------------------
  476|      2|}
CBS_get_asn1_uint64_with_tag:
  478|      2|int CBS_get_asn1_uint64_with_tag(CBS *cbs, uint64_t *out, CBS_ASN1_TAG tag) {
  479|      2|  CBS bytes;
  480|      2|  if (!CBS_get_asn1(cbs, &bytes, tag) ||
  ------------------
  |  Branch (480:7): [True: 0, False: 2]
  ------------------
  481|      2|      !CBS_is_unsigned_asn1_integer(&bytes)) {
  ------------------
  |  Branch (481:7): [True: 0, False: 2]
  ------------------
  482|      0|    return 0;
  483|      0|  }
  484|       |
  485|      2|  *out = 0;
  486|      2|  const uint8_t *data = CBS_data(&bytes);
  487|      2|  size_t len = CBS_len(&bytes);
  488|      4|  for (size_t i = 0; i < len; i++) {
  ------------------
  |  Branch (488:22): [True: 2, False: 2]
  ------------------
  489|      2|    if ((*out >> 56) != 0) {
  ------------------
  |  Branch (489:9): [True: 0, False: 2]
  ------------------
  490|       |      // Too large to represent as a uint64_t.
  491|      0|      return 0;
  492|      0|    }
  493|      2|    *out <<= 8;
  494|      2|    *out |= data[i];
  495|      2|  }
  496|       |
  497|      2|  return 1;
  498|      2|}
CBS_get_optional_asn1:
  539|  7.09k|                          CBS_ASN1_TAG tag) {
  540|  7.09k|  int present = 0;
  541|       |
  542|  7.09k|  if (CBS_peek_asn1_tag(cbs, tag)) {
  ------------------
  |  Branch (542:7): [True: 7.09k, False: 0]
  ------------------
  543|  7.09k|    if (!CBS_get_asn1(cbs, out, tag)) {
  ------------------
  |  Branch (543:9): [True: 0, False: 7.09k]
  ------------------
  544|      0|      return 0;
  545|      0|    }
  546|  7.09k|    present = 1;
  547|  7.09k|  }
  548|       |
  549|  7.09k|  if (out_present != NULL) {
  ------------------
  |  Branch (549:7): [True: 0, False: 7.09k]
  ------------------
  550|      0|    *out_present = present;
  551|      0|  }
  552|       |
  553|  7.09k|  return 1;
  554|  7.09k|}
CBS_is_valid_asn1_integer:
  660|   126k|int CBS_is_valid_asn1_integer(const CBS *cbs, int *out_is_negative) {
  661|   126k|  CBS copy = *cbs;
  662|   126k|  uint8_t first_byte, second_byte;
  663|   126k|  if (!CBS_get_u8(&copy, &first_byte)) {
  ------------------
  |  Branch (663:7): [True: 0, False: 126k]
  ------------------
  664|      0|    return 0;  // INTEGERs may not be empty.
  665|      0|  }
  666|   126k|  if (out_is_negative != NULL) {
  ------------------
  |  Branch (666:7): [True: 126k, False: 0]
  ------------------
  667|   126k|    *out_is_negative = (first_byte & 0x80) != 0;
  668|   126k|  }
  669|   126k|  if (!CBS_get_u8(&copy, &second_byte)) {
  ------------------
  |  Branch (669:7): [True: 28.1k, False: 98.5k]
  ------------------
  670|  28.1k|    return 1;  // One byte INTEGERs are always minimal.
  671|  28.1k|  }
  672|  98.5k|  if ((first_byte == 0x00 && (second_byte & 0x80) == 0) ||
  ------------------
  |  Branch (672:8): [True: 63.3k, False: 35.2k]
  |  Branch (672:30): [True: 0, False: 63.3k]
  ------------------
  673|  98.5k|      (first_byte == 0xff && (second_byte & 0x80) != 0)) {
  ------------------
  |  Branch (673:8): [True: 0, False: 98.5k]
  |  Branch (673:30): [True: 0, False: 0]
  ------------------
  674|      0|    return 0;  // The value is minimal iff the first 9 bits are not all equal.
  675|      0|  }
  676|  98.5k|  return 1;
  677|  98.5k|}
CBS_is_unsigned_asn1_integer:
  679|      2|int CBS_is_unsigned_asn1_integer(const CBS *cbs) {
  680|      2|  int is_negative;
  681|      2|  return CBS_is_valid_asn1_integer(cbs, &is_negative) && !is_negative;
  ------------------
  |  Branch (681:10): [True: 2, False: 0]
  |  Branch (681:58): [True: 2, False: 0]
  ------------------
  682|      2|}
CBS_is_valid_asn1_oid:
  690|   253k|int CBS_is_valid_asn1_oid(const CBS *cbs) {
  691|   253k|  if (CBS_len(cbs) == 0) {
  ------------------
  |  Branch (691:7): [True: 0, False: 253k]
  ------------------
  692|      0|    return 0;  // OID encodings cannot be empty.
  693|      0|  }
  694|       |
  695|   253k|  CBS copy = *cbs;
  696|   253k|  uint8_t v, prev = 0;
  697|  1.51M|  while (CBS_get_u8(&copy, &v)) {
  ------------------
  |  Branch (697:10): [True: 1.26M, False: 253k]
  ------------------
  698|       |    // OID encodings are a sequence of minimally-encoded base-128 integers (see
  699|       |    // |parse_base128_integer|). If |prev|'s MSB was clear, it was the last byte
  700|       |    // of an integer (or |v| is the first byte). |v| is then the first byte of
  701|       |    // the next integer. If first byte of an integer is 0x80, it is not
  702|       |    // minimally-encoded.
  703|  1.26M|    if ((prev & 0x80) == 0 && v == 0x80) {
  ------------------
  |  Branch (703:9): [True: 1.01M, False: 253k]
  |  Branch (703:31): [True: 0, False: 1.01M]
  ------------------
  704|      0|      return 0;
  705|      0|    }
  706|  1.26M|    prev = v;
  707|  1.26M|  }
  708|       |
  709|       |  // The last byte should must end an integer encoding.
  710|   253k|  return (prev & 0x80) == 0;
  711|   253k|}
CBS_parse_utc_time:
  910|  56.2k|                       int allow_timezone_offset) {
  911|  56.2k|  return CBS_parse_rfc5280_time_internal(cbs, 0, allow_timezone_offset, out_tm);
  912|  56.2k|}
cbs.cc:_ZL7cbs_getP6cbs_stPPKhm:
   29|  12.5M|static int cbs_get(CBS *cbs, const uint8_t **p, size_t n) {
   30|  12.5M|  if (cbs->len < n) {
  ------------------
  |  Branch (30:7): [True: 297k, False: 12.2M]
  ------------------
   31|   297k|    return 0;
   32|   297k|  }
   33|       |
   34|  12.2M|  *p = cbs->data;
   35|  12.2M|  cbs->data += n;
   36|  12.2M|  cbs->len -= n;
   37|  12.2M|  return 1;
   38|  12.5M|}
cbs.cc:_ZL9cbs_get_uP6cbs_stPmm:
   80|   564k|static int cbs_get_u(CBS *cbs, uint64_t *out, size_t len) {
   81|   564k|  uint64_t result = 0;
   82|   564k|  const uint8_t *data;
   83|       |
   84|   564k|  if (!cbs_get(cbs, &data, len)) {
  ------------------
  |  Branch (84:7): [True: 5.82k, False: 559k]
  ------------------
   85|  5.82k|    return 0;
   86|  5.82k|  }
   87|  1.62M|  for (size_t i = 0; i < len; i++) {
  ------------------
  |  Branch (87:22): [True: 1.06M, False: 559k]
  ------------------
   88|  1.06M|    result <<= 8;
   89|  1.06M|    result |= data[i];
   90|  1.06M|  }
   91|   559k|  *out = result;
   92|   559k|  return 1;
   93|   564k|}
cbs.cc:_ZL23cbs_get_length_prefixedP6cbs_stS0_m:
  184|   172k|static int cbs_get_length_prefixed(CBS *cbs, CBS *out, size_t len_len) {
  185|   172k|  uint64_t len;
  186|   172k|  if (!cbs_get_u(cbs, &len, len_len)) {
  ------------------
  |  Branch (186:7): [True: 1.96k, False: 170k]
  ------------------
  187|  1.96k|    return 0;
  188|  1.96k|  }
  189|       |  // If |len_len| <= 3 then we know that |len| will fit into a |size_t|, even on
  190|       |  // 32-bit systems.
  191|   170k|  assert(len_len <= 3);
  192|   170k|  return CBS_get_bytes(cbs, out, len);
  193|   170k|}
cbs.cc:_ZL24cbs_get_any_asn1_elementP6cbs_stS0_PjPmPiS3_i:
  308|  1.99M|                                    int *out_indefinite, int ber_ok) {
  309|  1.99M|  CBS header = *cbs;
  310|  1.99M|  CBS throwaway;
  311|       |
  312|  1.99M|  if (out == NULL) {
  ------------------
  |  Branch (312:7): [True: 0, False: 1.99M]
  ------------------
  313|      0|    out = &throwaway;
  314|      0|  }
  315|  1.99M|  if (ber_ok) {
  ------------------
  |  Branch (315:7): [True: 28.1k, False: 1.96M]
  ------------------
  316|  28.1k|    *out_ber_found = 0;
  317|  28.1k|    *out_indefinite = 0;
  318|  1.96M|  } else {
  319|  1.96M|    assert(out_ber_found == NULL);
  320|  1.96M|    assert(out_indefinite == NULL);
  321|  1.96M|  }
  322|       |
  323|  1.99M|  CBS_ASN1_TAG tag;
  324|  1.99M|  if (!parse_asn1_tag(&header, &tag)) {
  ------------------
  |  Branch (324:7): [True: 0, False: 1.99M]
  ------------------
  325|      0|    return 0;
  326|      0|  }
  327|  1.99M|  if (out_tag != NULL) {
  ------------------
  |  Branch (327:7): [True: 1.99M, False: 0]
  ------------------
  328|  1.99M|    *out_tag = tag;
  329|  1.99M|  }
  330|       |
  331|  1.99M|  uint8_t length_byte;
  332|  1.99M|  if (!CBS_get_u8(&header, &length_byte)) {
  ------------------
  |  Branch (332:7): [True: 0, False: 1.99M]
  ------------------
  333|      0|    return 0;
  334|      0|  }
  335|       |
  336|  1.99M|  size_t header_len = CBS_len(cbs) - CBS_len(&header);
  337|       |
  338|  1.99M|  size_t len;
  339|       |  // The format for the length encoding is specified in ITU-T X.690 section
  340|       |  // 8.1.3.
  341|  1.99M|  if ((length_byte & 0x80) == 0) {
  ------------------
  |  Branch (341:7): [True: 1.67M, False: 323k]
  ------------------
  342|       |    // Short form length.
  343|  1.67M|    len = ((size_t)length_byte) + header_len;
  344|  1.67M|    if (out_header_len != NULL) {
  ------------------
  |  Branch (344:9): [True: 1.67M, False: 0]
  ------------------
  345|  1.67M|      *out_header_len = header_len;
  346|  1.67M|    }
  347|  1.67M|  } else {
  348|       |    // The high bit indicate that this is the long form, while the next 7 bits
  349|       |    // encode the number of subsequent octets used to encode the length (ITU-T
  350|       |    // X.690 clause 8.1.3.5.b).
  351|   323k|    const size_t num_bytes = length_byte & 0x7f;
  352|   323k|    uint64_t len64;
  353|       |
  354|   323k|    if (ber_ok && (tag & CBS_ASN1_CONSTRUCTED) != 0 && num_bytes == 0) {
  ------------------
  |  |  197|  28.1k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  ------------------
  |  |  |  |  194|  28.1k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
  |  Branch (354:9): [True: 28.1k, False: 295k]
  |  Branch (354:19): [True: 0, False: 28.1k]
  |  Branch (354:56): [True: 0, False: 0]
  ------------------
  355|       |      // indefinite length
  356|      0|      if (out_header_len != NULL) {
  ------------------
  |  Branch (356:11): [True: 0, False: 0]
  ------------------
  357|      0|        *out_header_len = header_len;
  358|      0|      }
  359|      0|      *out_ber_found = 1;
  360|      0|      *out_indefinite = 1;
  361|      0|      return CBS_get_bytes(cbs, out, header_len);
  362|      0|    }
  363|       |
  364|       |    // ITU-T X.690 clause 8.1.3.5.c specifies that the value 0xff shall not be
  365|       |    // used as the first byte of the length. If this parser encounters that
  366|       |    // value, num_bytes will be parsed as 127, which will fail this check.
  367|   323k|    if (num_bytes == 0 || num_bytes > 4) {
  ------------------
  |  Branch (367:9): [True: 0, False: 323k]
  |  Branch (367:27): [True: 0, False: 323k]
  ------------------
  368|      0|      return 0;
  369|      0|    }
  370|   323k|    if (!cbs_get_u(&header, &len64, num_bytes)) {
  ------------------
  |  Branch (370:9): [True: 0, False: 323k]
  ------------------
  371|      0|      return 0;
  372|      0|    }
  373|       |    // ITU-T X.690 section 10.1 (DER length forms) requires encoding the
  374|       |    // length with the minimum number of octets. BER could, technically, have
  375|       |    // 125 superfluous zero bytes. We do not attempt to handle that and still
  376|       |    // require that the length fit in a |uint32_t| for BER.
  377|   323k|    if (len64 < 128) {
  ------------------
  |  Branch (377:9): [True: 0, False: 323k]
  ------------------
  378|       |      // Length should have used short-form encoding.
  379|      0|      if (ber_ok) {
  ------------------
  |  Branch (379:11): [True: 0, False: 0]
  ------------------
  380|      0|        *out_ber_found = 1;
  381|      0|      } else {
  382|      0|        return 0;
  383|      0|      }
  384|      0|    }
  385|   323k|    if ((len64 >> ((num_bytes - 1) * 8)) == 0) {
  ------------------
  |  Branch (385:9): [True: 0, False: 323k]
  ------------------
  386|       |      // Length should have been at least one byte shorter.
  387|      0|      if (ber_ok) {
  ------------------
  |  Branch (387:11): [True: 0, False: 0]
  ------------------
  388|      0|        *out_ber_found = 1;
  389|      0|      } else {
  390|      0|        return 0;
  391|      0|      }
  392|      0|    }
  393|   323k|    len = len64;
  394|   323k|    if (len + header_len + num_bytes < len) {
  ------------------
  |  Branch (394:9): [True: 0, False: 323k]
  ------------------
  395|       |      // Overflow.
  396|      0|      return 0;
  397|      0|    }
  398|   323k|    len += header_len + num_bytes;
  399|   323k|    if (out_header_len != NULL) {
  ------------------
  |  Branch (399:9): [True: 323k, False: 0]
  ------------------
  400|   323k|      *out_header_len = header_len + num_bytes;
  401|   323k|    }
  402|   323k|  }
  403|       |
  404|  1.99M|  return CBS_get_bytes(cbs, out, len);
  405|  1.99M|}
cbs.cc:_ZL12cbs_get_asn1P6cbs_stS0_ji:
  438|   422k|                        int skip_header) {
  439|   422k|  size_t header_len;
  440|   422k|  CBS_ASN1_TAG tag;
  441|   422k|  CBS throwaway;
  442|       |
  443|   422k|  if (out == NULL) {
  ------------------
  |  Branch (443:7): [True: 42.5k, False: 380k]
  ------------------
  444|  42.5k|    out = &throwaway;
  445|  42.5k|  }
  446|       |
  447|   422k|  if (!CBS_get_any_asn1_element(cbs, out, &tag, &header_len) ||
  ------------------
  |  Branch (447:7): [True: 0, False: 422k]
  ------------------
  448|   422k|      tag != tag_value) {
  ------------------
  |  Branch (448:7): [True: 0, False: 422k]
  ------------------
  449|      0|    return 0;
  450|      0|  }
  451|       |
  452|   422k|  if (skip_header && !CBS_skip(out, header_len)) {
  ------------------
  |  Branch (452:7): [True: 366k, False: 56.2k]
  |  Branch (452:22): [True: 0, False: 366k]
  ------------------
  453|      0|    assert(0);
  454|      0|    return 0;
  455|      0|  }
  456|       |
  457|   422k|  return 1;
  458|   422k|}
cbs.cc:_ZL14parse_asn1_tagP6cbs_stPj:
  267|  2.00M|static int parse_asn1_tag(CBS *cbs, CBS_ASN1_TAG *out) {
  268|  2.00M|  uint8_t tag_byte;
  269|  2.00M|  if (!CBS_get_u8(cbs, &tag_byte)) {
  ------------------
  |  Branch (269:7): [True: 0, False: 2.00M]
  ------------------
  270|      0|    return 0;
  271|      0|  }
  272|       |
  273|       |  // ITU-T X.690 section 8.1.2.3 specifies the format for identifiers with a tag
  274|       |  // number no greater than 30.
  275|       |  //
  276|       |  // If the number portion is 31 (0x1f, the largest value that fits in the
  277|       |  // allotted bits), then the tag is more than one byte long and the
  278|       |  // continuation bytes contain the tag number.
  279|  2.00M|  CBS_ASN1_TAG tag = ((CBS_ASN1_TAG)tag_byte & 0xe0) << CBS_ASN1_TAG_SHIFT;
  ------------------
  |  |  194|  2.00M|#define CBS_ASN1_TAG_SHIFT 24
  ------------------
  280|  2.00M|  CBS_ASN1_TAG tag_number = tag_byte & 0x1f;
  281|  2.00M|  if (tag_number == 0x1f) {
  ------------------
  |  Branch (281:7): [True: 0, False: 2.00M]
  ------------------
  282|      0|    uint64_t v;
  283|      0|    if (!parse_base128_integer(cbs, &v) ||
  ------------------
  |  Branch (283:9): [True: 0, False: 0]
  ------------------
  284|       |        // Check the tag number is within our supported bounds.
  285|      0|        v > CBS_ASN1_TAG_NUMBER_MASK ||
  ------------------
  |  |  211|      0|#define CBS_ASN1_TAG_NUMBER_MASK ((1u << (5 + CBS_ASN1_TAG_SHIFT)) - 1)
  |  |  ------------------
  |  |  |  |  194|      0|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
  |  Branch (285:9): [True: 0, False: 0]
  ------------------
  286|       |        // Small tag numbers should have used low tag number form, even in BER.
  287|      0|        v < 0x1f) {
  ------------------
  |  Branch (287:9): [True: 0, False: 0]
  ------------------
  288|      0|      return 0;
  289|      0|    }
  290|      0|    tag_number = (CBS_ASN1_TAG)v;
  291|      0|  }
  292|       |
  293|  2.00M|  tag |= tag_number;
  294|       |
  295|       |  // Tag [UNIVERSAL 0] is reserved for use by the encoding. Reject it here to
  296|       |  // avoid some ambiguity around ANY values and BER indefinite-length EOCs. See
  297|       |  // https://crbug.com/boringssl/455.
  298|  2.00M|  if ((tag & ~CBS_ASN1_CONSTRUCTED) == 0) {
  ------------------
  |  |  197|  2.00M|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  ------------------
  |  |  |  |  194|  2.00M|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
  |  Branch (298:7): [True: 0, False: 2.00M]
  ------------------
  299|      0|    return 0;
  300|      0|  }
  301|       |
  302|  2.00M|  *out = tag;
  303|  2.00M|  return 1;
  304|  2.00M|}
cbs.cc:_ZL31CBS_parse_rfc5280_time_internalPK6cbs_stiiP2tm:
  805|  56.2k|                                           struct tm *out_tm) {
  806|  56.2k|  int year, month, day, hour, min, sec, tmp;
  807|  56.2k|  CBS copy = *cbs;
  808|  56.2k|  uint8_t tz;
  809|       |
  810|  56.2k|  if (is_gentime) {
  ------------------
  |  Branch (810:7): [True: 0, False: 56.2k]
  ------------------
  811|      0|    if (!cbs_get_two_digits(&copy, &tmp)) {
  ------------------
  |  Branch (811:9): [True: 0, False: 0]
  ------------------
  812|      0|      return 0;
  813|      0|    }
  814|      0|    year = tmp * 100;
  815|      0|    if (!cbs_get_two_digits(&copy, &tmp)) {
  ------------------
  |  Branch (815:9): [True: 0, False: 0]
  ------------------
  816|      0|      return 0;
  817|      0|    }
  818|      0|    year += tmp;
  819|  56.2k|  } else {
  820|  56.2k|    year = 1900;
  821|  56.2k|    if (!cbs_get_two_digits(&copy, &tmp)) {
  ------------------
  |  Branch (821:9): [True: 0, False: 56.2k]
  ------------------
  822|      0|      return 0;
  823|      0|    }
  824|  56.2k|    year += tmp;
  825|  56.2k|    if (year < 1950) {
  ------------------
  |  Branch (825:9): [True: 56.2k, False: 0]
  ------------------
  826|  56.2k|      year += 100;
  827|  56.2k|    }
  828|  56.2k|    if (year >= 2050) {
  ------------------
  |  Branch (828:9): [True: 0, False: 56.2k]
  ------------------
  829|      0|      return 0;  // A Generalized time must be used.
  830|      0|    }
  831|  56.2k|  }
  832|  56.2k|  if (!cbs_get_two_digits(&copy, &month) || month < 1 ||
  ------------------
  |  Branch (832:7): [True: 0, False: 56.2k]
  |  Branch (832:45): [True: 0, False: 56.2k]
  ------------------
  833|  56.2k|      month > 12 ||  // Reject invalid months.
  ------------------
  |  Branch (833:7): [True: 0, False: 56.2k]
  ------------------
  834|  56.2k|      !cbs_get_two_digits(&copy, &day) ||
  ------------------
  |  Branch (834:7): [True: 0, False: 56.2k]
  ------------------
  835|  56.2k|      !is_valid_day(year, month, day) ||  // Reject invalid days.
  ------------------
  |  Branch (835:7): [True: 0, False: 56.2k]
  ------------------
  836|  56.2k|      !cbs_get_two_digits(&copy, &hour) ||
  ------------------
  |  Branch (836:7): [True: 0, False: 56.2k]
  ------------------
  837|  56.2k|      hour > 23 ||  // Reject invalid hours.
  ------------------
  |  Branch (837:7): [True: 0, False: 56.2k]
  ------------------
  838|  56.2k|      !cbs_get_two_digits(&copy, &min) ||
  ------------------
  |  Branch (838:7): [True: 0, False: 56.2k]
  ------------------
  839|  56.2k|      min > 59 ||  // Reject invalid minutes.
  ------------------
  |  Branch (839:7): [True: 0, False: 56.2k]
  ------------------
  840|  56.2k|      !cbs_get_two_digits(&copy, &sec) || sec > 59 || !CBS_get_u8(&copy, &tz)) {
  ------------------
  |  Branch (840:7): [True: 0, False: 56.2k]
  |  Branch (840:43): [True: 0, False: 56.2k]
  |  Branch (840:55): [True: 0, False: 56.2k]
  ------------------
  841|      0|    return 0;
  842|      0|  }
  843|       |
  844|  56.2k|  int offset_sign = 0;
  845|  56.2k|  switch (tz) {
  846|  56.2k|    case 'Z':
  ------------------
  |  Branch (846:5): [True: 56.2k, False: 0]
  ------------------
  847|  56.2k|      break;  // We correctly have 'Z' on the end as per spec.
  848|      0|    case '+':
  ------------------
  |  Branch (848:5): [True: 0, False: 56.2k]
  ------------------
  849|      0|      offset_sign = 1;
  850|      0|      break;  // Should not be allowed per RFC 5280.
  851|      0|    case '-':
  ------------------
  |  Branch (851:5): [True: 0, False: 56.2k]
  ------------------
  852|      0|      offset_sign = -1;
  853|      0|      break;  // Should not be allowed per RFC 5280.
  854|      0|    default:
  ------------------
  |  Branch (854:5): [True: 0, False: 56.2k]
  ------------------
  855|      0|      return 0;  // Reject anything else after the time.
  856|  56.2k|  }
  857|       |
  858|       |  // If allow_timezone_offset is non-zero, allow for a four digit timezone
  859|       |  // offset to be specified even though this is not allowed by RFC 5280. We are
  860|       |  // permissive of this for UTCTimes due to the unfortunate existence of
  861|       |  // artisinally rolled long lived certificates that were baked into places that
  862|       |  // are now difficult to change. These certificates were generated with the
  863|       |  // 'openssl' command that permissively allowed the creation of certificates
  864|       |  // with notBefore and notAfter times specified as strings for direct
  865|       |  // certificate inclusion on the command line. For context see cl/237068815.
  866|       |  //
  867|       |  // TODO(bbe): This has been expunged from public web-pki as the ecosystem has
  868|       |  // managed to encourage CA compliance with standards. We should find a way to
  869|       |  // get rid of this or make it off by default.
  870|  56.2k|  int offset_seconds = 0;
  871|  56.2k|  if (offset_sign != 0) {
  ------------------
  |  Branch (871:7): [True: 0, False: 56.2k]
  ------------------
  872|      0|    if (!allow_timezone_offset) {
  ------------------
  |  Branch (872:9): [True: 0, False: 0]
  ------------------
  873|      0|      return 0;
  874|      0|    }
  875|      0|    int offset_hours, offset_minutes;
  876|      0|    if (!cbs_get_two_digits(&copy, &offset_hours) ||
  ------------------
  |  Branch (876:9): [True: 0, False: 0]
  ------------------
  877|      0|        offset_hours > 23 ||  // Reject invalid hours.
  ------------------
  |  Branch (877:9): [True: 0, False: 0]
  ------------------
  878|      0|        !cbs_get_two_digits(&copy, &offset_minutes) ||
  ------------------
  |  Branch (878:9): [True: 0, False: 0]
  ------------------
  879|      0|        offset_minutes > 59) {  // Reject invalid minutes.
  ------------------
  |  Branch (879:9): [True: 0, False: 0]
  ------------------
  880|      0|      return 0;
  881|      0|    }
  882|      0|    offset_seconds = offset_sign * (offset_hours * 3600 + offset_minutes * 60);
  883|      0|  }
  884|       |
  885|  56.2k|  if (CBS_len(&copy) != 0) {
  ------------------
  |  Branch (885:7): [True: 0, False: 56.2k]
  ------------------
  886|      0|    return 0;  // Reject invalid lengths.
  887|      0|  }
  888|       |
  889|  56.2k|  if (out_tm != NULL) {
  ------------------
  |  Branch (889:7): [True: 0, False: 56.2k]
  ------------------
  890|       |    // Fill in the tm fields corresponding to what we validated.
  891|      0|    out_tm->tm_year = year - 1900;
  892|      0|    out_tm->tm_mon = month - 1;
  893|      0|    out_tm->tm_mday = day;
  894|      0|    out_tm->tm_hour = hour;
  895|      0|    out_tm->tm_min = min;
  896|      0|    out_tm->tm_sec = sec;
  897|      0|    if (offset_seconds && !OPENSSL_gmtime_adj(out_tm, 0, offset_seconds)) {
  ------------------
  |  Branch (897:9): [True: 0, False: 0]
  |  Branch (897:27): [True: 0, False: 0]
  ------------------
  898|      0|      return 0;
  899|      0|    }
  900|      0|  }
  901|  56.2k|  return 1;
  902|  56.2k|}
cbs.cc:_ZL18cbs_get_two_digitsP6cbs_stPi:
  756|   337k|static int cbs_get_two_digits(CBS *cbs, int *out) {
  757|   337k|  uint8_t first_digit, second_digit;
  758|   337k|  if (!CBS_get_u8(cbs, &first_digit)) {
  ------------------
  |  Branch (758:7): [True: 0, False: 337k]
  ------------------
  759|      0|    return 0;
  760|      0|  }
  761|   337k|  if (!OPENSSL_isdigit(first_digit)) {
  ------------------
  |  Branch (761:7): [True: 0, False: 337k]
  ------------------
  762|      0|    return 0;
  763|      0|  }
  764|   337k|  if (!CBS_get_u8(cbs, &second_digit)) {
  ------------------
  |  Branch (764:7): [True: 0, False: 337k]
  ------------------
  765|      0|    return 0;
  766|      0|  }
  767|   337k|  if (!OPENSSL_isdigit(second_digit)) {
  ------------------
  |  Branch (767:7): [True: 0, False: 337k]
  ------------------
  768|      0|    return 0;
  769|      0|  }
  770|   337k|  *out = (first_digit - '0') * 10 + (second_digit - '0');
  771|   337k|  return 1;
  772|   337k|}
cbs.cc:_ZL12is_valid_dayiii:
  774|  56.2k|static int is_valid_day(int year, int month, int day) {
  775|  56.2k|  if (day < 1) {
  ------------------
  |  Branch (775:7): [True: 0, False: 56.2k]
  ------------------
  776|      0|    return 0;
  777|      0|  }
  778|  56.2k|  switch (month) {
  779|      0|    case 1:
  ------------------
  |  Branch (779:5): [True: 0, False: 56.2k]
  ------------------
  780|      0|    case 3:
  ------------------
  |  Branch (780:5): [True: 0, False: 56.2k]
  ------------------
  781|      0|    case 5:
  ------------------
  |  Branch (781:5): [True: 0, False: 56.2k]
  ------------------
  782|      0|    case 7:
  ------------------
  |  Branch (782:5): [True: 0, False: 56.2k]
  ------------------
  783|      0|    case 8:
  ------------------
  |  Branch (783:5): [True: 0, False: 56.2k]
  ------------------
  784|      0|    case 10:
  ------------------
  |  Branch (784:5): [True: 0, False: 56.2k]
  ------------------
  785|      0|    case 12:
  ------------------
  |  Branch (785:5): [True: 0, False: 56.2k]
  ------------------
  786|      0|      return day <= 31;
  787|      0|    case 4:
  ------------------
  |  Branch (787:5): [True: 0, False: 56.2k]
  ------------------
  788|      0|    case 6:
  ------------------
  |  Branch (788:5): [True: 0, False: 56.2k]
  ------------------
  789|      0|    case 9:
  ------------------
  |  Branch (789:5): [True: 0, False: 56.2k]
  ------------------
  790|  56.2k|    case 11:
  ------------------
  |  Branch (790:5): [True: 56.2k, False: 0]
  ------------------
  791|  56.2k|      return day <= 30;
  792|      0|    case 2:
  ------------------
  |  Branch (792:5): [True: 0, False: 56.2k]
  ------------------
  793|      0|      if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
  ------------------
  |  Branch (793:12): [True: 0, False: 0]
  |  Branch (793:29): [True: 0, False: 0]
  |  Branch (793:49): [True: 0, False: 0]
  ------------------
  794|      0|        return day <= 29;
  795|      0|      } else {
  796|      0|        return day <= 28;
  797|      0|      }
  798|      0|    default:
  ------------------
  |  Branch (798:5): [True: 0, False: 56.2k]
  ------------------
  799|      0|      return 0;
  800|  56.2k|  }
  801|  56.2k|}

CBS_get_latin1:
   84|   787k|int CBS_get_latin1(CBS *cbs, uint32_t *out) {
   85|   787k|  uint8_t c;
   86|   787k|  if (!CBS_get_u8(cbs, &c)) {
  ------------------
  |  Branch (86:7): [True: 0, False: 787k]
  ------------------
   87|      0|    return 0;
   88|      0|  }
   89|   787k|  *out = c;
   90|   787k|  return 1;
   91|   787k|}
CBB_get_utf8_len:
  108|   393k|size_t CBB_get_utf8_len(uint32_t u) {
  109|   393k|  if (u <= 0x7f) {
  ------------------
  |  Branch (109:7): [True: 393k, False: 0]
  ------------------
  110|   393k|    return 1;
  111|   393k|  }
  112|      0|  if (u <= 0x7ff) {
  ------------------
  |  Branch (112:7): [True: 0, False: 0]
  ------------------
  113|      0|    return 2;
  114|      0|  }
  115|      0|  if (u <= 0xffff) {
  ------------------
  |  Branch (115:7): [True: 0, False: 0]
  ------------------
  116|      0|    return 3;
  117|      0|  }
  118|      0|  return 4;
  119|      0|}
CBB_add_utf8:
  121|   393k|int CBB_add_utf8(CBB *cbb, uint32_t u) {
  122|   393k|  if (!is_valid_code_point(u)) {
  ------------------
  |  Branch (122:7): [True: 0, False: 393k]
  ------------------
  123|      0|    return 0;
  124|      0|  }
  125|   393k|  if (u <= 0x7f) {
  ------------------
  |  Branch (125:7): [True: 393k, False: 0]
  ------------------
  126|   393k|    return CBB_add_u8(cbb, (uint8_t)u);
  127|   393k|  }
  128|      0|  if (u <= 0x7ff) {
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|      0|    return CBB_add_u8(cbb, TOP_BITS(2) | (u >> 6)) &&
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (129:12): [True: 0, False: 0]
  ------------------
  130|      0|           CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6)));
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
                         CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6)));
  ------------------
  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  ------------------
  |  Branch (130:12): [True: 0, False: 0]
  ------------------
  131|      0|  }
  132|      0|  if (u <= 0xffff) {
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|    return CBB_add_u8(cbb, TOP_BITS(3) | (u >> 12)) &&
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (133:12): [True: 0, False: 0]
  ------------------
  134|      0|           CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 6) & BOTTOM_BITS(6))) &&
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
                         CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 6) & BOTTOM_BITS(6))) &&
  ------------------
  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  ------------------
  |  Branch (134:12): [True: 0, False: 0]
  ------------------
  135|      0|           CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6)));
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
                         CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6)));
  ------------------
  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  ------------------
  |  Branch (135:12): [True: 0, False: 0]
  ------------------
  136|      0|  }
  137|      0|  if (u <= 0x10ffff) {
  ------------------
  |  Branch (137:7): [True: 0, False: 0]
  ------------------
  138|      0|    return CBB_add_u8(cbb, TOP_BITS(4) | (u >> 18)) &&
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (138:12): [True: 0, False: 0]
  ------------------
  139|      0|           CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 12) & BOTTOM_BITS(6))) &&
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
                         CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 12) & BOTTOM_BITS(6))) &&
  ------------------
  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  ------------------
  |  Branch (139:12): [True: 0, False: 0]
  ------------------
  140|      0|           CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 6) & BOTTOM_BITS(6))) &&
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
                         CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 6) & BOTTOM_BITS(6))) &&
  ------------------
  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  ------------------
  |  Branch (140:12): [True: 0, False: 0]
  ------------------
  141|      0|           CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6)));
  ------------------
  |  |   40|      0|#define TOP_BITS(n) ((uint8_t)~BOTTOM_BITS(8 - (n)))
  |  |  ------------------
  |  |  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  |  |  ------------------
  ------------------
                         CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6)));
  ------------------
  |  |   37|      0|#define BOTTOM_BITS(n) (uint8_t)((1u << (n)) - 1)
  ------------------
  |  Branch (141:12): [True: 0, False: 0]
  ------------------
  142|      0|  }
  143|      0|  return 0;
  144|      0|}
unicode.cc:_ZL19is_valid_code_pointj:
   20|   393k|static int is_valid_code_point(uint32_t v) {
   21|       |  // References in the following are to Unicode 15.0.0.
   22|   393k|  if (// The Unicode space runs from zero to 0x10ffff (3.4 D9).
   23|   393k|      v > 0x10ffff ||
  ------------------
  |  Branch (23:7): [True: 0, False: 393k]
  ------------------
   24|       |      // Values 0x...fffe, 0x...ffff, and 0xfdd0-0xfdef are permanently reserved
   25|       |      // as noncharacters (3.4 D14). See also 23.7. As our APIs are intended for
   26|       |      // "open interchange", such as ASN.1, we reject them.
   27|   393k|      (v & 0xfffe) == 0xfffe ||
  ------------------
  |  Branch (27:7): [True: 0, False: 393k]
  ------------------
   28|   393k|      (v >= 0xfdd0 && v <= 0xfdef) ||
  ------------------
  |  Branch (28:8): [True: 0, False: 393k]
  |  Branch (28:23): [True: 0, False: 0]
  ------------------
   29|       |      // Surrogate code points are invalid (3.2 C1).
   30|   393k|      (v >= 0xd800 && v <= 0xdfff)) {
  ------------------
  |  Branch (30:8): [True: 0, False: 393k]
  |  Branch (30:23): [True: 0, False: 0]
  ------------------
   31|      0|    return 0;
   32|      0|  }
   33|   393k|  return 1;
   34|   393k|}

CRYPTO_chacha_20:
  100|      2|                      uint32_t counter) {
  101|      2|  assert(!buffers_alias(out, in_len, in, in_len) || in == out);
  102|       |
  103|      2|  uint32_t counter_nonce[4];
  104|      2|  counter_nonce[0] = counter;
  105|      2|  counter_nonce[1] = CRYPTO_load_u32_le(nonce + 0);
  106|      2|  counter_nonce[2] = CRYPTO_load_u32_le(nonce + 4);
  107|      2|  counter_nonce[3] = CRYPTO_load_u32_le(nonce + 8);
  108|       |
  109|      2|  const uint32_t *key_ptr = (const uint32_t *)key;
  110|       |#if !defined(OPENSSL_X86) && !defined(OPENSSL_X86_64)
  111|       |  // The assembly expects the key to be four-byte aligned.
  112|       |  uint32_t key_u32[8];
  113|       |  if ((((uintptr_t)key) & 3) != 0) {
  114|       |    key_u32[0] = CRYPTO_load_u32_le(key + 0);
  115|       |    key_u32[1] = CRYPTO_load_u32_le(key + 4);
  116|       |    key_u32[2] = CRYPTO_load_u32_le(key + 8);
  117|       |    key_u32[3] = CRYPTO_load_u32_le(key + 12);
  118|       |    key_u32[4] = CRYPTO_load_u32_le(key + 16);
  119|       |    key_u32[5] = CRYPTO_load_u32_le(key + 20);
  120|       |    key_u32[6] = CRYPTO_load_u32_le(key + 24);
  121|       |    key_u32[7] = CRYPTO_load_u32_le(key + 28);
  122|       |
  123|       |    key_ptr = key_u32;
  124|       |  }
  125|       |#endif
  126|       |
  127|      4|  while (in_len > 0) {
  ------------------
  |  Branch (127:10): [True: 2, False: 2]
  ------------------
  128|       |    // The assembly functions do not have defined overflow behavior. While
  129|       |    // overflow is almost always a bug in the caller, we prefer our functions to
  130|       |    // behave the same across platforms, so divide into multiple calls to avoid
  131|       |    // this case.
  132|      2|    uint64_t todo = 64 * ((UINT64_C(1) << 32) - counter_nonce[0]);
  133|      2|    if (todo > in_len) {
  ------------------
  |  Branch (133:9): [True: 2, False: 0]
  ------------------
  134|      2|      todo = in_len;
  135|      2|    }
  136|       |
  137|      2|    ChaCha20_ctr32(out, in, (size_t)todo, key_ptr, counter_nonce);
  138|      2|    in += todo;
  139|      2|    out += todo;
  140|      2|    in_len -= todo;
  141|       |
  142|       |    // We're either done and will next break out of the loop, or we stopped at
  143|       |    // the wraparound point and the counter should continue at zero.
  144|      2|    counter_nonce[0] = 0;
  145|      2|  }
  146|      2|}
chacha.cc:_ZL14ChaCha20_ctr32PhPKhmPKjS3_:
   65|      2|                           const uint32_t key[8], const uint32_t counter[4]) {
   66|       |#if defined(CHACHA20_ASM_NEON)
   67|       |  if (ChaCha20_ctr32_neon_capable(in_len)) {
   68|       |    ChaCha20_ctr32_neon(out, in, in_len, key, counter);
   69|       |    return;
   70|       |  }
   71|       |#endif
   72|      2|#if defined(CHACHA20_ASM_AVX2)
   73|      2|  if (ChaCha20_ctr32_avx2_capable(in_len)) {
  ------------------
  |  Branch (73:7): [True: 0, False: 2]
  ------------------
   74|      0|    ChaCha20_ctr32_avx2(out, in, in_len, key, counter);
   75|      0|    return;
   76|      0|  }
   77|      2|#endif
   78|      2|#if defined(CHACHA20_ASM_SSSE3_4X)
   79|      2|  if (ChaCha20_ctr32_ssse3_4x_capable(in_len)) {
  ------------------
  |  Branch (79:7): [True: 0, False: 2]
  ------------------
   80|      0|    ChaCha20_ctr32_ssse3_4x(out, in, in_len, key, counter);
   81|      0|    return;
   82|      0|  }
   83|      2|#endif
   84|      2|#if defined(CHACHA20_ASM_SSSE3)
   85|      2|  if (ChaCha20_ctr32_ssse3_capable(in_len)) {
  ------------------
  |  Branch (85:7): [True: 0, False: 2]
  ------------------
   86|      0|    ChaCha20_ctr32_ssse3(out, in, in_len, key, counter);
   87|      0|    return;
   88|      0|  }
   89|      2|#endif
   90|      2|  if (in_len > 0) {
  ------------------
  |  Branch (90:7): [True: 2, False: 0]
  ------------------
   91|      2|    ChaCha20_ctr32_nohw(out, in, in_len, key, counter);
   92|      2|  }
   93|      2|}

ChaCha20_ctr32_avx2_capable:
   60|      2|inline int ChaCha20_ctr32_avx2_capable(size_t len) {
   61|      2|  return len > 128 && CRYPTO_is_AVX2_capable();
  ------------------
  |  Branch (61:10): [True: 0, False: 2]
  |  Branch (61:23): [True: 0, False: 0]
  ------------------
   62|      2|}
ChaCha20_ctr32_ssse3_4x_capable:
   67|      2|inline int ChaCha20_ctr32_ssse3_4x_capable(size_t len) {
   68|      2|  int capable = len > 128 && CRYPTO_is_SSSE3_capable();
  ------------------
  |  Branch (68:17): [True: 0, False: 2]
  |  Branch (68:30): [True: 0, False: 0]
  ------------------
   69|      2|  int faster = len > 192 || !CRYPTO_cpu_perf_is_like_silvermont();
  ------------------
  |  Branch (69:16): [True: 0, False: 2]
  |  Branch (69:29): [True: 2, False: 0]
  ------------------
   70|      2|  return capable && faster;
  ------------------
  |  Branch (70:10): [True: 0, False: 2]
  |  Branch (70:21): [True: 0, False: 0]
  ------------------
   71|      2|}
ChaCha20_ctr32_ssse3_capable:
   76|      2|inline int ChaCha20_ctr32_ssse3_capable(size_t len) {
   77|      2|  return len > 128 && CRYPTO_is_SSSE3_capable();
  ------------------
  |  Branch (77:10): [True: 0, False: 2]
  |  Branch (77:23): [True: 0, False: 0]
  ------------------
   78|      2|}

OPENSSL_cpuid_setup:
  149|      1|void OPENSSL_cpuid_setup(void) {
  150|       |  // Determine the vendor and maximum input value.
  151|      1|  uint32_t eax, ebx, ecx, edx;
  152|      1|  OPENSSL_cpuid(&eax, &ebx, &ecx, &edx, 0);
  153|       |
  154|      1|  uint32_t num_ids = eax;
  155|       |
  156|      1|  int is_intel = ebx == 0x756e6547 /* Genu */ &&  //
  ------------------
  |  Branch (156:18): [True: 0, False: 1]
  ------------------
  157|      1|                 edx == 0x49656e69 /* ineI */ &&  //
  ------------------
  |  Branch (157:18): [True: 0, False: 0]
  ------------------
  158|      1|                 ecx == 0x6c65746e /* ntel */;
  ------------------
  |  Branch (158:18): [True: 0, False: 0]
  ------------------
  159|      1|  int is_amd = ebx == 0x68747541 /* Auth */ &&  //
  ------------------
  |  Branch (159:16): [True: 1, False: 0]
  ------------------
  160|      1|               edx == 0x69746e65 /* enti */ &&  //
  ------------------
  |  Branch (160:16): [True: 1, False: 0]
  ------------------
  161|      1|               ecx == 0x444d4163 /* cAMD */;
  ------------------
  |  Branch (161:16): [True: 1, False: 0]
  ------------------
  162|       |
  163|      1|  uint32_t extended_features[2] = {0};
  164|      1|  if (num_ids >= 7) {
  ------------------
  |  Branch (164:7): [True: 1, False: 0]
  ------------------
  165|      1|    OPENSSL_cpuid(&eax, &ebx, &ecx, &edx, 7);
  166|      1|    extended_features[0] = ebx;
  167|      1|    extended_features[1] = ecx;
  168|      1|  }
  169|       |
  170|      1|  OPENSSL_cpuid(&eax, &ebx, &ecx, &edx, 1);
  171|       |
  172|      1|  const uint32_t base_family = (eax >> 8) & 15;
  173|      1|  const uint32_t base_model = (eax >> 4) & 15;
  174|       |
  175|      1|  uint32_t family = base_family;
  176|      1|  uint32_t model = base_model;
  177|      1|  if (base_family == 15) {
  ------------------
  |  Branch (177:7): [True: 1, False: 0]
  ------------------
  178|      1|    const uint32_t ext_family = (eax >> 20) & 255;
  179|      1|    family += ext_family;
  180|      1|  }
  181|      1|  if (base_family == 6 || base_family == 15) {
  ------------------
  |  Branch (181:7): [True: 0, False: 1]
  |  Branch (181:27): [True: 1, False: 0]
  ------------------
  182|      1|    const uint32_t ext_model = (eax >> 16) & 15;
  183|      1|    model |= ext_model << 4;
  184|      1|  }
  185|       |
  186|      1|  if (is_amd) {
  ------------------
  |  Branch (186:7): [True: 1, False: 0]
  ------------------
  187|      1|    if (family < 0x17 || (family == 0x17 && 0x70 <= model && model <= 0x7f)) {
  ------------------
  |  Branch (187:9): [True: 0, False: 1]
  |  Branch (187:27): [True: 1, False: 0]
  |  Branch (187:45): [True: 0, False: 1]
  |  Branch (187:62): [True: 0, False: 0]
  ------------------
  188|       |      // Disable RDRAND on AMD families before 0x17 (Zen) due to reported
  189|       |      // failures after suspend.
  190|       |      // https://bugzilla.redhat.com/show_bug.cgi?id=1150286
  191|       |      // Also disable for family 0x17, models 0x70–0x7f, due to possible RDRAND
  192|       |      // failures there too.
  193|      0|      ecx &= ~(1u << 30);
  194|      0|    }
  195|      1|  }
  196|       |
  197|       |  // Reserved bit #30 is repurposed to signal an Intel CPU.
  198|      1|  if (is_intel) {
  ------------------
  |  Branch (198:7): [True: 0, False: 1]
  ------------------
  199|      0|    edx |= (1u << 30);
  200|      1|  } else {
  201|      1|    edx &= ~(1u << 30);
  202|      1|  }
  203|       |
  204|      1|  uint64_t xcr0 = 0;
  205|      1|  if (ecx & (1u << 27)) {
  ------------------
  |  Branch (205:7): [True: 1, False: 0]
  ------------------
  206|       |    // XCR0 may only be queried if the OSXSAVE bit is set.
  207|      1|    xcr0 = OPENSSL_xgetbv(0);
  208|      1|  }
  209|       |  // See Intel manual, volume 1, section 14.3.
  210|      1|  if ((xcr0 & 6) != 6) {
  ------------------
  |  Branch (210:7): [True: 0, False: 1]
  ------------------
  211|       |    // YMM registers cannot be used.
  212|      0|    ecx &= ~(1u << 28);                   // AVX
  213|      0|    ecx &= ~(1u << 12);                   // FMA
  214|      0|    ecx &= ~(1u << 11);                   // AMD XOP
  215|      0|    extended_features[0] &= ~(1u << 5);   // AVX2
  216|      0|    extended_features[1] &= ~(1u << 9);   // VAES
  217|      0|    extended_features[1] &= ~(1u << 10);  // VPCLMULQDQ
  218|      0|  }
  219|       |  // See Intel manual, volume 1, sections 15.2 ("Detection of AVX-512 Foundation
  220|       |  // Instructions") through 15.4 ("Detection of Intel AVX-512 Instruction Groups
  221|       |  // Operating at 256 and 128-bit Vector Lengths").
  222|      1|  if (!os_supports_avx512(xcr0)) {
  ------------------
  |  Branch (222:7): [True: 1, False: 0]
  ------------------
  223|       |    // Without XCR0.111xx11x, no AVX512 feature can be used. This includes ZMM
  224|       |    // registers, masking, SIMD registers 16-31 (even if accessed as YMM or
  225|       |    // XMM), and EVEX-coded instructions (even on YMM or XMM). Even if only
  226|       |    // XCR0.ZMM_Hi256 is missing, it isn't valid to use AVX512 features on
  227|       |    // shorter vectors, since AVX512 ties everything to the availability of
  228|       |    // 512-bit vectors. See the above-mentioned sections of the Intel manual,
  229|       |    // which say that *all* these XCR0 bits must be checked even when just using
  230|       |    // 128-bit or 256-bit vectors, and also volume 2a section 2.7.11 ("#UD
  231|       |    // Equations for EVEX") which says that all EVEX-coded instructions raise an
  232|       |    // undefined-instruction exception if any of these XCR0 bits is zero.
  233|      1|    extended_features[0] &= ~(1u << 16);  // AVX512F
  234|      1|    extended_features[0] &= ~(1u << 17);  // AVX512DQ
  235|      1|    extended_features[0] &= ~(1u << 21);  // AVX512IFMA
  236|      1|    extended_features[0] &= ~(1u << 26);  // AVX512PF
  237|      1|    extended_features[0] &= ~(1u << 27);  // AVX512ER
  238|      1|    extended_features[0] &= ~(1u << 28);  // AVX512CD
  239|      1|    extended_features[0] &= ~(1u << 30);  // AVX512BW
  240|      1|    extended_features[0] &= ~(1u << 31);  // AVX512VL
  241|      1|    extended_features[1] &= ~(1u << 1);   // AVX512VBMI
  242|      1|    extended_features[1] &= ~(1u << 6);   // AVX512VBMI2
  243|      1|    extended_features[1] &= ~(1u << 11);  // AVX512VNNI
  244|      1|    extended_features[1] &= ~(1u << 12);  // AVX512BITALG
  245|      1|    extended_features[1] &= ~(1u << 14);  // AVX512VPOPCNTDQ
  246|      1|  }
  247|       |
  248|       |  // Repurpose the bit for the removed MPX feature to indicate when using zmm
  249|       |  // registers should be avoided even when they are supported. (When set, AVX512
  250|       |  // features can still be used, but only using ymm or xmm registers.) Skylake
  251|       |  // suffered from severe downclocking when zmm registers were used, which
  252|       |  // affected unrelated code running on the system, making zmm registers not too
  253|       |  // useful outside of benchmarks. The situation improved significantly by Ice
  254|       |  // Lake, but a small amount of downclocking remained. (See
  255|       |  // https://lore.kernel.org/linux-crypto/e8ce1146-3952-6977-1d0e-a22758e58914@intel.com/)
  256|       |  // We take a conservative approach of not allowing zmm registers until after
  257|       |  // Ice Lake and Tiger Lake, i.e. until Sapphire Rapids on the server side.
  258|       |  //
  259|       |  // AMD CPUs, which support AVX512 starting with Zen 4, have not been reported
  260|       |  // to have any downclocking problem when zmm registers are used.
  261|      1|  if (is_intel && family == 6 &&
  ------------------
  |  Branch (261:7): [True: 0, False: 1]
  |  Branch (261:19): [True: 0, False: 0]
  ------------------
  262|      1|      (model == 85 ||    // Skylake, Cascade Lake, Cooper Lake (server)
  ------------------
  |  Branch (262:8): [True: 0, False: 0]
  ------------------
  263|      0|       model == 106 ||   // Ice Lake (server)
  ------------------
  |  Branch (263:8): [True: 0, False: 0]
  ------------------
  264|      0|       model == 108 ||   // Ice Lake (micro server)
  ------------------
  |  Branch (264:8): [True: 0, False: 0]
  ------------------
  265|      0|       model == 125 ||   // Ice Lake (client)
  ------------------
  |  Branch (265:8): [True: 0, False: 0]
  ------------------
  266|      0|       model == 126 ||   // Ice Lake (mobile)
  ------------------
  |  Branch (266:8): [True: 0, False: 0]
  ------------------
  267|      0|       model == 140 ||   // Tiger Lake (mobile)
  ------------------
  |  Branch (267:8): [True: 0, False: 0]
  ------------------
  268|      0|       model == 141)) {  // Tiger Lake (client)
  ------------------
  |  Branch (268:8): [True: 0, False: 0]
  ------------------
  269|      0|    extended_features[0] |= 1u << 14;
  270|      1|  } else {
  271|      1|    extended_features[0] &= ~(1u << 14);
  272|      1|  }
  273|       |
  274|      1|  OPENSSL_ia32cap_P[0] = edx;
  275|      1|  OPENSSL_ia32cap_P[1] = ecx;
  276|      1|  OPENSSL_ia32cap_P[2] = extended_features[0];
  277|      1|  OPENSSL_ia32cap_P[3] = extended_features[1];
  278|       |
  279|      1|  const char *env = getenv("OPENSSL_ia32cap");
  280|      1|  if (env != nullptr) {
  ------------------
  |  Branch (280:7): [True: 0, False: 1]
  ------------------
  281|      0|    OPENSSL_adjust_ia32cap(OPENSSL_ia32cap_P, env);
  282|      0|  }
  283|      1|}
cpu_intel.cc:_ZL13OPENSSL_cpuidPjS_S_S_j:
   38|      3|                          uint32_t *out_ecx, uint32_t *out_edx, uint32_t leaf) {
   39|       |#if defined(_MSC_VER)
   40|       |  int tmp[4];
   41|       |  __cpuid(tmp, (int)leaf);
   42|       |  *out_eax = (uint32_t)tmp[0];
   43|       |  *out_ebx = (uint32_t)tmp[1];
   44|       |  *out_ecx = (uint32_t)tmp[2];
   45|       |  *out_edx = (uint32_t)tmp[3];
   46|       |#elif defined(__pic__) && defined(OPENSSL_32_BIT)
   47|       |  // Inline assembly may not clobber the PIC register. For 32-bit, this is EBX.
   48|       |  // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47602.
   49|       |  __asm__ volatile(
   50|       |      "xor %%ecx, %%ecx\n"
   51|       |      "mov %%ebx, %%edi\n"
   52|       |      "cpuid\n"
   53|       |      "xchg %%edi, %%ebx\n"
   54|       |      : "=a"(*out_eax), "=D"(*out_ebx), "=c"(*out_ecx), "=d"(*out_edx)
   55|       |      : "a"(leaf));
   56|       |#else
   57|      3|  __asm__ volatile(
   58|      3|      "xor %%ecx, %%ecx\n"
   59|      3|      "cpuid\n"
   60|      3|      : "=a"(*out_eax), "=b"(*out_ebx), "=c"(*out_ecx), "=d"(*out_edx)
   61|      3|      : "a"(leaf));
   62|      3|#endif
   63|      3|}
cpu_intel.cc:_ZL14OPENSSL_xgetbvj:
   67|      1|static uint64_t OPENSSL_xgetbv(uint32_t xcr) {
   68|       |#if defined(_MSC_VER)
   69|       |  return (uint64_t)_xgetbv(xcr);
   70|       |#else
   71|      1|  uint32_t eax, edx;
   72|      1|  __asm__ volatile("xgetbv" : "=a"(eax), "=d"(edx) : "c"(xcr));
   73|      1|  return (((uint64_t)edx) << 32) | eax;
   74|      1|#endif
   75|      1|}
cpu_intel.cc:_ZL18os_supports_avx512m:
   77|      1|static bool os_supports_avx512(uint64_t xcr0) {
   78|       |#if defined(__APPLE__)
   79|       |  // The Darwin kernel had a bug where it could corrupt the opmask registers.
   80|       |  // See
   81|       |  // https://community.intel.com/t5/Software-Tuning-Performance/MacOS-Darwin-kernel-bug-clobbers-AVX-512-opmask-register-state/m-p/1327259
   82|       |  // Darwin also does not initially set the XCR0 bits for AVX512, but they are
   83|       |  // set if the thread tries to use AVX512 anyway.  Thus, to safely and
   84|       |  // consistently use AVX512 on macOS we'd need to check the kernel version as
   85|       |  // well as detect AVX512 support using a macOS-specific method.  We don't
   86|       |  // bother with this, especially given Apple's transition to arm64.
   87|       |  return false;
   88|       |#else
   89|      1|  return (xcr0 & 0xe6) == 0xe6;
   90|      1|#endif
   91|      1|}

OPENSSL_get_ia32cap:
   65|  72.3k|uint32_t OPENSSL_get_ia32cap(int idx) {
   66|  72.3k|  OPENSSL_init_cpuid();
   67|  72.3k|  return OPENSSL_ia32cap_P[idx];
   68|  72.3k|}
OPENSSL_init_cpuid:
   87|  72.3k|void OPENSSL_init_cpuid(void) { CRYPTO_once(&once, OPENSSL_cpuid_setup); }

x25519_ge_scalarmult_base:
  794|  12.0k|void x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t a[32]) {
  795|  12.0k|#if defined(BORINGSSL_FE25519_ADX)
  796|  12.0k|  if (CRYPTO_is_BMI1_capable() && CRYPTO_is_BMI2_capable() &&
  ------------------
  |  Branch (796:7): [True: 12.0k, False: 0]
  |  Branch (796:35): [True: 12.0k, False: 0]
  ------------------
  797|  12.0k|      CRYPTO_is_ADX_capable()) {
  ------------------
  |  Branch (797:7): [True: 12.0k, False: 0]
  ------------------
  798|  12.0k|    uint8_t t[4][32];
  799|  12.0k|    x25519_ge_scalarmult_base_adx(t, a);
  800|  12.0k|    fiat_25519_from_bytes(h->X.v, t[0]);
  801|  12.0k|    fiat_25519_from_bytes(h->Y.v, t[1]);
  802|  12.0k|    fiat_25519_from_bytes(h->Z.v, t[2]);
  803|  12.0k|    fiat_25519_from_bytes(h->T.v, t[3]);
  804|  12.0k|    return;
  805|  12.0k|  }
  806|      0|#endif
  807|      0|  signed char e[64];
  808|      0|  signed char carry;
  809|      0|  ge_p1p1 r;
  810|      0|  ge_p2 s;
  811|      0|  ge_precomp t;
  812|      0|  int i;
  813|       |
  814|      0|  for (i = 0; i < 32; ++i) {
  ------------------
  |  Branch (814:15): [True: 0, False: 0]
  ------------------
  815|      0|    e[2 * i + 0] = (a[i] >> 0) & 15;
  816|      0|    e[2 * i + 1] = (a[i] >> 4) & 15;
  817|      0|  }
  818|       |  // each e[i] is between 0 and 15
  819|       |  // e[63] is between 0 and 7
  820|       |
  821|      0|  carry = 0;
  822|      0|  for (i = 0; i < 63; ++i) {
  ------------------
  |  Branch (822:15): [True: 0, False: 0]
  ------------------
  823|      0|    e[i] += carry;
  824|      0|    carry = e[i] + 8;
  825|      0|    carry >>= 4;
  826|      0|    e[i] -= carry << 4;
  827|      0|  }
  828|      0|  e[63] += carry;
  829|       |  // each e[i] is between -8 and 8
  830|       |
  831|      0|  ge_p3_0(h);
  832|      0|  for (i = 1; i < 64; i += 2) {
  ------------------
  |  Branch (832:15): [True: 0, False: 0]
  ------------------
  833|      0|    table_select(&t, i / 2, e[i]);
  834|      0|    ge_madd(&r, h, &t);
  835|      0|    x25519_ge_p1p1_to_p3(h, &r);
  836|      0|  }
  837|       |
  838|      0|  ge_p3_dbl(&r, h);
  839|      0|  x25519_ge_p1p1_to_p2(&s, &r);
  840|      0|  ge_p2_dbl(&r, &s);
  841|      0|  x25519_ge_p1p1_to_p2(&s, &r);
  842|      0|  ge_p2_dbl(&r, &s);
  843|      0|  x25519_ge_p1p1_to_p2(&s, &r);
  844|      0|  ge_p2_dbl(&r, &s);
  845|      0|  x25519_ge_p1p1_to_p3(h, &r);
  846|       |
  847|      0|  for (i = 0; i < 64; i += 2) {
  ------------------
  |  Branch (847:15): [True: 0, False: 0]
  ------------------
  848|      0|    table_select(&t, i / 2, e[i]);
  849|      0|    ge_madd(&r, h, &t);
  850|      0|    x25519_ge_p1p1_to_p3(h, &r);
  851|      0|  }
  852|      0|}
X25519_public_from_private:
 2126|  12.0k|                                const uint8_t private_key[32]) {
 2127|       |#if defined(BORINGSSL_X25519_NEON)
 2128|       |  if (CRYPTO_is_NEON_capable()) {
 2129|       |    static const uint8_t kMongomeryBasePoint[32] = {9};
 2130|       |    x25519_NEON(out_public_value, private_key, kMongomeryBasePoint);
 2131|       |    return;
 2132|       |  }
 2133|       |#endif
 2134|       |
 2135|  12.0k|  uint8_t e[32];
 2136|  12.0k|  OPENSSL_memcpy(e, private_key, 32);
 2137|  12.0k|  e[0] &= 248;
 2138|  12.0k|  e[31] &= 127;
 2139|  12.0k|  e[31] |= 64;
 2140|       |
 2141|  12.0k|  ge_p3 A;
 2142|  12.0k|  x25519_ge_scalarmult_base(&A, e);
 2143|       |
 2144|       |  // We only need the u-coordinate of the curve25519 point. The map is
 2145|       |  // u=(y+1)/(1-y). Since y=Y/Z, this gives u=(Z+Y)/(Z-Y).
 2146|  12.0k|  fe_loose zplusy, zminusy;
 2147|  12.0k|  fe zminusy_inv;
 2148|  12.0k|  fe_add(&zplusy, &A.Z, &A.Y);
 2149|  12.0k|  fe_sub(&zminusy, &A.Z, &A.Y);
 2150|  12.0k|  fe_loose_invert(&zminusy_inv, &zminusy);
 2151|  12.0k|  fe_mul_tlt(&zminusy_inv, &zplusy, &zminusy_inv);
 2152|  12.0k|  fe_tobytes(out_public_value, &zminusy_inv);
 2153|  12.0k|  CONSTTIME_DECLASSIFY(out_public_value, 32);
 2154|  12.0k|}
curve25519.cc:_ZL10fe_mul_tttP2fePKS_S2_:
  227|   120k|static void fe_mul_ttt(fe *h, const fe *f, const fe *g) {
  228|   120k|  fe_mul_impl(h->v, f->v, g->v);
  229|   120k|}
curve25519.cc:_ZL11fe_mul_implPmPKmS1_:
  212|   144k|                        const fe_limb_t in2[FE_NUM_LIMBS]) {
  213|   144k|  assert_fe_loose(in1);
  ------------------
  |  |   99|   144k|  do {                                                                  \
  |  |  100|   867k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (100:37): [True: 723k, False: 144k]
  |  |  ------------------
  |  |  101|   723k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
  |  |  ------------------
  |  |  |  |  493|   723k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |  102|   723k|    }                                                                   \
  |  |  103|   144k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (103:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  214|   144k|  assert_fe_loose(in2);
  ------------------
  |  |   99|   144k|  do {                                                                  \
  |  |  100|   867k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (100:37): [True: 723k, False: 144k]
  |  |  ------------------
  |  |  101|   723k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
  |  |  ------------------
  |  |  |  |  493|   723k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |  102|   723k|    }                                                                   \
  |  |  103|   144k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (103:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  215|   144k|  fiat_25519_carry_mul(out, in1, in2);
  216|   144k|  assert_fe(out);
  ------------------
  |  |   82|   144k|  do {                                                                  \
  |  |   83|   867k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 723k, False: 144k]
  |  |  ------------------
  |  |   84|   723k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|   723k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|   723k|    }                                                                   \
  |  |   86|   144k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  217|   144k|}
curve25519.cc:_ZL10fe_tobytesPhPK2fe:
  165|  12.0k|static void fe_tobytes(uint8_t s[32], const fe *f) {
  166|  12.0k|  assert_fe(f->v);
  ------------------
  |  |   82|  12.0k|  do {                                                                  \
  |  |   83|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |   84|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  60.2k|    }                                                                   \
  |  |   86|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|  12.0k|  fiat_25519_to_bytes(s, f->v);
  168|  12.0k|}
curve25519.cc:_ZL8fe_sq_ttP2fePKS_:
  249|  3.04M|static void fe_sq_tt(fe *h, const fe *f) {
  250|  3.04M|  assert_fe_loose(f->v);
  ------------------
  |  |   99|  3.04M|  do {                                                                  \
  |  |  100|  18.2M|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (100:37): [True: 15.2M, False: 3.04M]
  |  |  ------------------
  |  |  101|  15.2M|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
  |  |  ------------------
  |  |  |  |  493|  15.2M|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |  102|  15.2M|    }                                                                   \
  |  |  103|  3.04M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (103:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  251|  3.04M|  fiat_25519_carry_square(h->v, f->v);
  252|  3.04M|  assert_fe(h->v);
  ------------------
  |  |   82|  3.04M|  do {                                                                  \
  |  |   83|  18.2M|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 15.2M, False: 3.04M]
  |  |  ------------------
  |  |   84|  15.2M|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  15.2M|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  15.2M|    }                                                                   \
  |  |   86|  3.04M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  253|  3.04M|}
curve25519.cc:_ZL6fe_subP8fe_loosePK2feS3_:
  197|  12.0k|static void fe_sub(fe_loose *h, const fe *f, const fe *g) {
  198|  12.0k|  assert_fe(f->v);
  ------------------
  |  |   82|  12.0k|  do {                                                                  \
  |  |   83|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |   84|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  60.2k|    }                                                                   \
  |  |   86|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  199|  12.0k|  assert_fe(g->v);
  ------------------
  |  |   82|  12.0k|  do {                                                                  \
  |  |   83|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |   84|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  60.2k|    }                                                                   \
  |  |   86|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  200|  12.0k|  fiat_25519_sub(h->v, f->v, g->v);
  201|  12.0k|  assert_fe_loose(h->v);
  ------------------
  |  |   99|  12.0k|  do {                                                                  \
  |  |  100|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (100:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |  101|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |  102|  60.2k|    }                                                                   \
  |  |  103|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (103:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  202|  12.0k|}
curve25519.cc:_ZL6fe_addP8fe_loosePK2feS3_:
  188|  12.0k|static void fe_add(fe_loose *h, const fe *f, const fe *g) {
  189|  12.0k|  assert_fe(f->v);
  ------------------
  |  |   82|  12.0k|  do {                                                                  \
  |  |   83|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |   84|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  60.2k|    }                                                                   \
  |  |   86|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  190|  12.0k|  assert_fe(g->v);
  ------------------
  |  |   82|  12.0k|  do {                                                                  \
  |  |   83|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |   84|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  60.2k|    }                                                                   \
  |  |   86|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|  12.0k|  fiat_25519_add(h->v, f->v, g->v);
  192|  12.0k|  assert_fe_loose(h->v);
  ------------------
  |  |   99|  12.0k|  do {                                                                  \
  |  |  100|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (100:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |  101|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |  102|  60.2k|    }                                                                   \
  |  |  103|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (103:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  193|  12.0k|}
curve25519.cc:_ZL10fe_mul_tltP2fePK8fe_loosePKS_:
  231|  24.1k|static void fe_mul_tlt(fe *h, const fe_loose *f, const fe *g) {
  232|  24.1k|  fe_mul_impl(h->v, f->v, g->v);
  233|  24.1k|}
curve25519.cc:_ZL8fe_sq_tlP2fePK8fe_loose:
  243|  12.0k|static void fe_sq_tl(fe *h, const fe_loose *f) {
  244|  12.0k|  assert_fe_loose(f->v);
  ------------------
  |  |   99|  12.0k|  do {                                                                  \
  |  |  100|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (100:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |  101|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |  102|  60.2k|    }                                                                   \
  |  |  103|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (103:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  245|  12.0k|  fiat_25519_carry_square(h->v, f->v);
  246|  12.0k|  assert_fe(h->v);
  ------------------
  |  |   82|  12.0k|  do {                                                                  \
  |  |   83|  72.3k|    for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 60.2k, False: 12.0k]
  |  |  ------------------
  |  |   84|  60.2k|      declassify_assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc));  \
  |  |  ------------------
  |  |  |  |  493|  60.2k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  |  |  ------------------
  |  |   85|  60.2k|    }                                                                   \
  |  |   86|  12.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (86:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  247|  12.0k|}
curve25519.cc:_ZL15fe_loose_invertP2fePK8fe_loose:
  309|  12.0k|static void fe_loose_invert(fe *out, const fe_loose *z) {
  310|  12.0k|  fe t0;
  311|  12.0k|  fe t1;
  312|  12.0k|  fe t2;
  313|  12.0k|  fe t3;
  314|  12.0k|  int i;
  315|       |
  316|  12.0k|  fe_sq_tl(&t0, z);
  317|  12.0k|  fe_sq_tt(&t1, &t0);
  318|  24.1k|  for (i = 1; i < 2; ++i) {
  ------------------
  |  Branch (318:15): [True: 12.0k, False: 12.0k]
  ------------------
  319|  12.0k|    fe_sq_tt(&t1, &t1);
  320|  12.0k|  }
  321|  12.0k|  fe_mul_tlt(&t1, z, &t1);
  322|  12.0k|  fe_mul_ttt(&t0, &t0, &t1);
  323|  12.0k|  fe_sq_tt(&t2, &t0);
  324|  12.0k|  fe_mul_ttt(&t1, &t1, &t2);
  325|  12.0k|  fe_sq_tt(&t2, &t1);
  326|  60.2k|  for (i = 1; i < 5; ++i) {
  ------------------
  |  Branch (326:15): [True: 48.2k, False: 12.0k]
  ------------------
  327|  48.2k|    fe_sq_tt(&t2, &t2);
  328|  48.2k|  }
  329|  12.0k|  fe_mul_ttt(&t1, &t2, &t1);
  330|  12.0k|  fe_sq_tt(&t2, &t1);
  331|   120k|  for (i = 1; i < 10; ++i) {
  ------------------
  |  Branch (331:15): [True: 108k, False: 12.0k]
  ------------------
  332|   108k|    fe_sq_tt(&t2, &t2);
  333|   108k|  }
  334|  12.0k|  fe_mul_ttt(&t2, &t2, &t1);
  335|  12.0k|  fe_sq_tt(&t3, &t2);
  336|   241k|  for (i = 1; i < 20; ++i) {
  ------------------
  |  Branch (336:15): [True: 229k, False: 12.0k]
  ------------------
  337|   229k|    fe_sq_tt(&t3, &t3);
  338|   229k|  }
  339|  12.0k|  fe_mul_ttt(&t2, &t3, &t2);
  340|  12.0k|  fe_sq_tt(&t2, &t2);
  341|   120k|  for (i = 1; i < 10; ++i) {
  ------------------
  |  Branch (341:15): [True: 108k, False: 12.0k]
  ------------------
  342|   108k|    fe_sq_tt(&t2, &t2);
  343|   108k|  }
  344|  12.0k|  fe_mul_ttt(&t1, &t2, &t1);
  345|  12.0k|  fe_sq_tt(&t2, &t1);
  346|   602k|  for (i = 1; i < 50; ++i) {
  ------------------
  |  Branch (346:15): [True: 590k, False: 12.0k]
  ------------------
  347|   590k|    fe_sq_tt(&t2, &t2);
  348|   590k|  }
  349|  12.0k|  fe_mul_ttt(&t2, &t2, &t1);
  350|  12.0k|  fe_sq_tt(&t3, &t2);
  351|  1.20M|  for (i = 1; i < 100; ++i) {
  ------------------
  |  Branch (351:15): [True: 1.19M, False: 12.0k]
  ------------------
  352|  1.19M|    fe_sq_tt(&t3, &t3);
  353|  1.19M|  }
  354|  12.0k|  fe_mul_ttt(&t2, &t3, &t2);
  355|  12.0k|  fe_sq_tt(&t2, &t2);
  356|   602k|  for (i = 1; i < 50; ++i) {
  ------------------
  |  Branch (356:15): [True: 590k, False: 12.0k]
  ------------------
  357|   590k|    fe_sq_tt(&t2, &t2);
  358|   590k|  }
  359|  12.0k|  fe_mul_ttt(&t1, &t2, &t1);
  360|  12.0k|  fe_sq_tt(&t1, &t1);
  361|  60.2k|  for (i = 1; i < 5; ++i) {
  ------------------
  |  Branch (361:15): [True: 48.2k, False: 12.0k]
  ------------------
  362|  48.2k|    fe_sq_tt(&t1, &t1);
  363|  48.2k|  }
  364|  12.0k|  fe_mul_ttt(out, &t1, &t0);
  365|  12.0k|}

METHOD_ref:
   80|  35.2k|void METHOD_ref(void *method_in) {
   81|  35.2k|  assert(((struct openssl_method_common_st *)method_in)->is_static);
   82|  35.2k|}
METHOD_unref:
   84|  35.2k|void METHOD_unref(void *method_in) {
   85|  35.2k|  struct openssl_method_common_st *method =
   86|  35.2k|      reinterpret_cast<openssl_method_common_st *>(method_in);
   87|       |
   88|  35.2k|  if (method == NULL) {
  ------------------
  |  Branch (88:7): [True: 0, False: 35.2k]
  ------------------
   89|      0|    return;
   90|      0|  }
   91|  35.2k|  assert(method->is_static);
   92|  35.2k|}

ERR_clear_error:
  253|  33.0k|void ERR_clear_error(void) {
  254|  33.0k|  ERR_STATE *const state = err_get_state();
  255|  33.0k|  unsigned i;
  256|       |
  257|  33.0k|  if (state == NULL) {
  ------------------
  |  Branch (257:7): [True: 0, False: 33.0k]
  ------------------
  258|      0|    return;
  259|      0|  }
  260|       |
  261|   561k|  for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |  397|   561k|#define ERR_NUM_ERRORS 16
  ------------------
  |  Branch (261:15): [True: 528k, False: 33.0k]
  ------------------
  262|   528k|    err_clear(&state->errors[i]);
  263|   528k|  }
  264|  33.0k|  free(state->to_free);
  265|  33.0k|  state->to_free = NULL;
  266|       |
  267|  33.0k|  state->top = state->bottom = 0;
  268|  33.0k|}
ERR_put_error:
  583|  95.4k|                   unsigned line) {
  584|  95.4k|  ERR_STATE *const state = err_get_state();
  585|  95.4k|  struct err_error_st *error;
  586|       |
  587|  95.4k|  if (state == NULL) {
  ------------------
  |  Branch (587:7): [True: 0, False: 95.4k]
  ------------------
  588|      0|    return;
  589|      0|  }
  590|       |
  591|  95.4k|  if (library == ERR_LIB_SYS && reason == 0) {
  ------------------
  |  Branch (591:7): [True: 0, False: 95.4k]
  |  Branch (591:33): [True: 0, False: 0]
  ------------------
  592|       |#if defined(OPENSSL_WINDOWS)
  593|       |    reason = GetLastError();
  594|       |#else
  595|      0|    reason = errno;
  596|      0|#endif
  597|      0|  }
  598|       |
  599|  95.4k|  state->top = (state->top + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |  397|  95.4k|#define ERR_NUM_ERRORS 16
  ------------------
  600|  95.4k|  if (state->top == state->bottom) {
  ------------------
  |  Branch (600:7): [True: 59.3k, False: 36.1k]
  ------------------
  601|  59.3k|    state->bottom = (state->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |  397|  59.3k|#define ERR_NUM_ERRORS 16
  ------------------
  602|  59.3k|  }
  603|       |
  604|  95.4k|  error = &state->errors[state->top];
  605|  95.4k|  err_clear(error);
  606|  95.4k|  error->file = file;
  607|  95.4k|  error->line = line;
  608|  95.4k|  error->packed = ERR_PACK(library, reason);
  ------------------
  |  |  400|  95.4k|  (((((uint32_t)(lib)) & 0xff) << 24) | ((((uint32_t)(reason)) & 0xfff)))
  ------------------
  609|  95.4k|}
ERR_add_error_dataf:
  660|  8.86k|void ERR_add_error_dataf(const char *format, ...) {
  661|  8.86k|  char *buf = NULL;
  662|  8.86k|  va_list ap;
  663|       |
  664|  8.86k|  va_start(ap, format);
  665|  8.86k|  if (OPENSSL_vasprintf_internal(&buf, format, ap, /*system_malloc=*/1) == -1) {
  ------------------
  |  Branch (665:7): [True: 0, False: 8.86k]
  ------------------
  666|      0|    return;
  667|      0|  }
  668|  8.86k|  va_end(ap);
  669|       |
  670|  8.86k|  err_set_error_data(buf);
  671|  8.86k|}
err.cc:_ZL13err_get_statev:
  124|   137k|static ERR_STATE *err_get_state(void) {
  125|   137k|  ERR_STATE *state = reinterpret_cast<ERR_STATE *>(
  126|   137k|      CRYPTO_get_thread_local(OPENSSL_THREAD_LOCAL_ERR));
  127|   137k|  if (state == NULL) {
  ------------------
  |  Branch (127:7): [True: 2, False: 137k]
  ------------------
  128|      2|    state = reinterpret_cast<ERR_STATE *>(malloc(sizeof(ERR_STATE)));
  129|      2|    if (state == NULL) {
  ------------------
  |  Branch (129:9): [True: 0, False: 2]
  ------------------
  130|      0|      return NULL;
  131|      0|    }
  132|      2|    OPENSSL_memset(state, 0, sizeof(ERR_STATE));
  133|      2|    if (!CRYPTO_set_thread_local(OPENSSL_THREAD_LOCAL_ERR, state,
  ------------------
  |  Branch (133:9): [True: 0, False: 2]
  ------------------
  134|      2|                                 err_state_free)) {
  135|      0|      return NULL;
  136|      0|    }
  137|      2|  }
  138|       |
  139|   137k|  return state;
  140|   137k|}
err.cc:_ZL9err_clearPN12_GLOBAL__N_112err_error_stE:
   84|   623k|static void err_clear(struct err_error_st *error) {
   85|   623k|  free(error->data);
   86|   623k|  OPENSSL_memset(error, 0, sizeof(struct err_error_st));
   87|   623k|}
err.cc:_ZL18err_set_error_dataPc:
  567|  8.86k|static void err_set_error_data(char *data) {
  568|  8.86k|  ERR_STATE *const state = err_get_state();
  569|  8.86k|  struct err_error_st *error;
  570|       |
  571|  8.86k|  if (state == NULL || state->top == state->bottom) {
  ------------------
  |  Branch (571:7): [True: 0, False: 8.86k]
  |  Branch (571:24): [True: 0, False: 8.86k]
  ------------------
  572|      0|    free(data);
  573|      0|    return;
  574|      0|  }
  575|       |
  576|  8.86k|  error = &state->errors[state->top];
  577|       |
  578|  8.86k|  free(error->data);
  579|  8.86k|  error->data = data;
  580|  8.86k|}

EVP_PKEY_new:
   37|  35.2k|EVP_PKEY *EVP_PKEY_new(void) {
   38|  35.2k|  EVP_PKEY *ret =
   39|  35.2k|      reinterpret_cast<EVP_PKEY *>(OPENSSL_zalloc(sizeof(EVP_PKEY)));
   40|  35.2k|  if (ret == NULL) {
  ------------------
  |  Branch (40:7): [True: 0, False: 35.2k]
  ------------------
   41|      0|    return NULL;
   42|      0|  }
   43|       |
   44|  35.2k|  ret->type = EVP_PKEY_NONE;
  ------------------
  |  |  132|  35.2k|#define EVP_PKEY_NONE NID_undef
  |  |  ------------------
  |  |  |  |   43|  35.2k|#define NID_undef 0
  |  |  ------------------
  ------------------
   45|  35.2k|  ret->references = 1;
   46|  35.2k|  return ret;
   47|  35.2k|}
EVP_PKEY_free:
   57|  72.3k|void EVP_PKEY_free(EVP_PKEY *pkey) {
   58|  72.3k|  if (pkey == NULL) {
  ------------------
  |  Branch (58:7): [True: 28.1k, False: 44.2k]
  ------------------
   59|  28.1k|    return;
   60|  28.1k|  }
   61|       |
   62|  44.2k|  if (!CRYPTO_refcount_dec_and_test_zero(&pkey->references)) {
  ------------------
  |  Branch (62:7): [True: 9.00k, False: 35.2k]
  ------------------
   63|  9.00k|    return;
   64|  9.00k|  }
   65|       |
   66|  35.2k|  free_it(pkey);
   67|  35.2k|  OPENSSL_free(pkey);
   68|  35.2k|}
EVP_PKEY_up_ref:
   70|  9.00k|int EVP_PKEY_up_ref(EVP_PKEY *pkey) {
   71|  9.00k|  CRYPTO_refcount_inc(&pkey->references);
   72|  9.00k|  return 1;
   73|  9.00k|}
EVP_PKEY_is_opaque:
   75|  11.8k|int EVP_PKEY_is_opaque(const EVP_PKEY *pkey) {
   76|  11.8k|  if (pkey->ameth && pkey->ameth->pkey_opaque) {
  ------------------
  |  Branch (76:7): [True: 11.8k, False: 0]
  |  Branch (76:22): [True: 11.8k, False: 0]
  ------------------
   77|  11.8k|    return pkey->ameth->pkey_opaque(pkey);
   78|  11.8k|  }
   79|      0|  return 0;
   80|  11.8k|}
EVP_PKEY_cmp:
   82|  11.8k|int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) {
   83|  11.8k|  if (a->type != b->type) {
  ------------------
  |  Branch (83:7): [True: 0, False: 11.8k]
  ------------------
   84|      0|    return -1;
   85|      0|  }
   86|       |
   87|  11.8k|  if (a->ameth) {
  ------------------
  |  Branch (87:7): [True: 11.8k, False: 0]
  ------------------
   88|  11.8k|    int ret;
   89|       |    // Compare parameters if the algorithm has them
   90|  11.8k|    if (a->ameth->param_cmp) {
  ------------------
  |  Branch (90:9): [True: 0, False: 11.8k]
  ------------------
   91|      0|      ret = a->ameth->param_cmp(a, b);
   92|      0|      if (ret <= 0) {
  ------------------
  |  Branch (92:11): [True: 0, False: 0]
  ------------------
   93|      0|        return ret;
   94|      0|      }
   95|      0|    }
   96|       |
   97|  11.8k|    if (a->ameth->pub_cmp) {
  ------------------
  |  Branch (97:9): [True: 11.8k, False: 0]
  ------------------
   98|  11.8k|      return a->ameth->pub_cmp(a, b);
   99|  11.8k|    }
  100|  11.8k|  }
  101|       |
  102|      0|  return -2;
  103|  11.8k|}
EVP_PKEY_id:
  157|  14.1k|int EVP_PKEY_id(const EVP_PKEY *pkey) { return pkey->type; }
evp_pkey_set_method:
  179|  70.4k|void evp_pkey_set_method(EVP_PKEY *pkey, const EVP_PKEY_ASN1_METHOD *method) {
  180|  70.4k|  free_it(pkey);
  181|  70.4k|  pkey->ameth = method;
  182|  70.4k|  pkey->type = pkey->ameth->pkey_id;
  183|  70.4k|}
evp.cc:_ZL7free_itP11evp_pkey_st:
   49|   105k|static void free_it(EVP_PKEY *pkey) {
   50|   105k|  if (pkey->ameth && pkey->ameth->pkey_free) {
  ------------------
  |  Branch (50:7): [True: 70.4k, False: 35.2k]
  |  Branch (50:22): [True: 70.4k, False: 0]
  ------------------
   51|  70.4k|    pkey->ameth->pkey_free(pkey);
   52|  70.4k|    pkey->pkey = NULL;
   53|  70.4k|    pkey->type = EVP_PKEY_NONE;
  ------------------
  |  |  132|  70.4k|#define EVP_PKEY_NONE NID_undef
  |  |  ------------------
  |  |  |  |   43|  70.4k|#define NID_undef 0
  |  |  ------------------
  ------------------
   54|  70.4k|  }
   55|   105k|}

EVP_parse_public_key:
   56|  35.2k|EVP_PKEY *EVP_parse_public_key(CBS *cbs) {
   57|       |  // Parse the SubjectPublicKeyInfo.
   58|  35.2k|  CBS spki, algorithm, key;
   59|  35.2k|  uint8_t padding;
   60|  35.2k|  if (!CBS_get_asn1(cbs, &spki, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  35.2k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  35.2k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  35.2k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (60:7): [True: 0, False: 35.2k]
  ------------------
   61|  35.2k|      !CBS_get_asn1(&spki, &algorithm, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  35.2k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  35.2k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  35.2k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (61:7): [True: 0, False: 35.2k]
  ------------------
   62|  35.2k|      !CBS_get_asn1(&spki, &key, CBS_ASN1_BITSTRING) ||
  ------------------
  |  |  217|  35.2k|#define CBS_ASN1_BITSTRING 0x3u
  ------------------
  |  Branch (62:7): [True: 0, False: 35.2k]
  ------------------
   63|  35.2k|      CBS_len(&spki) != 0) {
  ------------------
  |  Branch (63:7): [True: 0, False: 35.2k]
  ------------------
   64|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   65|      0|    return nullptr;
   66|      0|  }
   67|  35.2k|  const EVP_PKEY_ASN1_METHOD *method = parse_key_type(&algorithm);
   68|  35.2k|  if (method == nullptr) {
  ------------------
  |  Branch (68:7): [True: 0, False: 35.2k]
  ------------------
   69|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_UNSUPPORTED_ALGORITHM);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   70|      0|    return nullptr;
   71|      0|  }
   72|  35.2k|  if (// Every key type defined encodes the key as a byte string with the same
   73|       |      // conversion to BIT STRING.
   74|  35.2k|      !CBS_get_u8(&key, &padding) ||
  ------------------
  |  Branch (74:7): [True: 0, False: 35.2k]
  ------------------
   75|  35.2k|      padding != 0) {
  ------------------
  |  Branch (75:7): [True: 0, False: 35.2k]
  ------------------
   76|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   77|      0|    return nullptr;
   78|      0|  }
   79|       |
   80|       |  // Set up an |EVP_PKEY| of the appropriate type.
   81|  35.2k|  bssl::UniquePtr<EVP_PKEY> ret(EVP_PKEY_new());
   82|  35.2k|  if (ret == nullptr) {
  ------------------
  |  Branch (82:7): [True: 0, False: 35.2k]
  ------------------
   83|      0|    return nullptr;
   84|      0|  }
   85|  35.2k|  evp_pkey_set_method(ret.get(), method);
   86|       |
   87|       |  // Call into the type-specific SPKI decoding function.
   88|  35.2k|  if (ret->ameth->pub_decode == nullptr) {
  ------------------
  |  Branch (88:7): [True: 0, False: 35.2k]
  ------------------
   89|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_UNSUPPORTED_ALGORITHM);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   90|      0|    return nullptr;
   91|      0|  }
   92|  35.2k|  if (!ret->ameth->pub_decode(ret.get(), &algorithm, &key)) {
  ------------------
  |  Branch (92:7): [True: 0, False: 35.2k]
  ------------------
   93|      0|    return nullptr;
   94|      0|  }
   95|       |
   96|  35.2k|  return ret.release();
   97|  35.2k|}
evp_asn1.cc:_ZL14parse_key_typeP6cbs_st:
   39|  35.2k|static const EVP_PKEY_ASN1_METHOD *parse_key_type(CBS *cbs) {
   40|  35.2k|  CBS oid;
   41|  35.2k|  if (!CBS_get_asn1(cbs, &oid, CBS_ASN1_OBJECT)) {
  ------------------
  |  |  220|  35.2k|#define CBS_ASN1_OBJECT 0x6u
  ------------------
  |  Branch (41:7): [True: 0, False: 35.2k]
  ------------------
   42|      0|    return NULL;
   43|      0|  }
   44|       |
   45|  35.2k|  for (unsigned i = 0; i < OPENSSL_ARRAY_SIZE(kASN1Methods); i++) {
  ------------------
  |  |  103|  35.2k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  |  Branch (45:24): [True: 35.2k, False: 0]
  ------------------
   46|  35.2k|    const EVP_PKEY_ASN1_METHOD *method = kASN1Methods[i];
   47|  35.2k|    if (CBS_len(&oid) == method->oid_len &&
  ------------------
  |  Branch (47:9): [True: 35.2k, False: 0]
  ------------------
   48|  35.2k|        OPENSSL_memcmp(CBS_data(&oid), method->oid, method->oid_len) == 0) {
  ------------------
  |  Branch (48:9): [True: 35.2k, False: 0]
  ------------------
   49|  35.2k|      return method;
   50|  35.2k|    }
   51|  35.2k|  }
   52|       |
   53|      0|  return NULL;
   54|  35.2k|}

EVP_PKEY_assign_RSA:
  178|  35.2k|int EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key) {
  179|  35.2k|  evp_pkey_set_method(pkey, &rsa_asn1_meth);
  180|  35.2k|  pkey->pkey = key;
  181|  35.2k|  return key != NULL;
  182|  35.2k|}
p_rsa_asn1.cc:_ZL14rsa_pub_decodeP11evp_pkey_stP6cbs_stS2_:
   48|  35.2k|static int rsa_pub_decode(EVP_PKEY *out, CBS *params, CBS *key) {
   49|       |  // See RFC 3279, section 2.3.1.
   50|       |
   51|       |  // The parameters must be NULL.
   52|  35.2k|  CBS null;
   53|  35.2k|  if (!CBS_get_asn1(params, &null, CBS_ASN1_NULL) || CBS_len(&null) != 0 ||
  ------------------
  |  |  219|  35.2k|#define CBS_ASN1_NULL 0x5u
  ------------------
  |  Branch (53:7): [True: 0, False: 35.2k]
  |  Branch (53:54): [True: 0, False: 35.2k]
  ------------------
   54|  35.2k|      CBS_len(params) != 0) {
  ------------------
  |  Branch (54:7): [True: 0, False: 35.2k]
  ------------------
   55|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   56|      0|    return 0;
   57|      0|  }
   58|       |
   59|  35.2k|  RSA *rsa = RSA_parse_public_key(key);
   60|  35.2k|  if (rsa == NULL || CBS_len(key) != 0) {
  ------------------
  |  Branch (60:7): [True: 0, False: 35.2k]
  |  Branch (60:22): [True: 0, False: 35.2k]
  ------------------
   61|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   62|      0|    RSA_free(rsa);
   63|      0|    return 0;
   64|      0|  }
   65|       |
   66|  35.2k|  EVP_PKEY_assign_RSA(out, rsa);
   67|  35.2k|  return 1;
   68|  35.2k|}
p_rsa_asn1.cc:_ZL11rsa_pub_cmpPK11evp_pkey_stS1_:
   70|  11.8k|static int rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) {
   71|  11.8k|  const RSA *a_rsa = reinterpret_cast<const RSA *>(a->pkey);
   72|  11.8k|  const RSA *b_rsa = reinterpret_cast<const RSA *>(b->pkey);
   73|  11.8k|  return BN_cmp(RSA_get0_n(b_rsa), RSA_get0_n(a_rsa)) == 0 &&
  ------------------
  |  Branch (73:10): [True: 11.8k, False: 0]
  ------------------
   74|  11.8k|         BN_cmp(RSA_get0_e(b_rsa), RSA_get0_e(a_rsa)) == 0;
  ------------------
  |  Branch (74:10): [True: 11.8k, False: 0]
  ------------------
   75|  11.8k|}
p_rsa_asn1.cc:_ZL10rsa_opaquePK11evp_pkey_st:
  116|  11.8k|static int rsa_opaque(const EVP_PKEY *pkey) {
  117|  11.8k|  const RSA *rsa = reinterpret_cast<const RSA *>(pkey->pkey);
  118|  11.8k|  return RSA_is_opaque(rsa);
  119|  11.8k|}
p_rsa_asn1.cc:_ZL12int_rsa_freeP11evp_pkey_st:
  131|  70.4k|static void int_rsa_free(EVP_PKEY *pkey) {
  132|  70.4k|  RSA_free(reinterpret_cast<RSA *>(pkey->pkey));
  133|  70.4k|  pkey->pkey = NULL;
  134|  70.4k|}

CRYPTO_new_ex_data:
  109|  87.7k|void CRYPTO_new_ex_data(CRYPTO_EX_DATA *ad) { ad->sk = NULL; }
CRYPTO_free_ex_data:
  112|  87.7k|                         CRYPTO_EX_DATA *ad) {
  113|  87.7k|  if (ad->sk == NULL) {
  ------------------
  |  Branch (113:7): [True: 87.7k, False: 0]
  ------------------
  114|       |    // Nothing to do.
  115|  87.7k|    return;
  116|  87.7k|  }
  117|       |
  118|      0|  uint32_t num_funcs = CRYPTO_atomic_load_u32(&ex_data_class->num_funcs);
  119|       |  // |CRYPTO_get_ex_new_index_ex| will not allocate indices beyond |INT_MAX|.
  120|      0|  assert(num_funcs <= (size_t)(INT_MAX - ex_data_class->num_reserved));
  121|       |
  122|       |  // Defer dereferencing |ex_data_class->funcs| and |funcs->next|. It must come
  123|       |  // after the |num_funcs| comparison to be correctly synchronized.
  124|      0|  CRYPTO_EX_DATA_FUNCS *const *funcs = &ex_data_class->funcs;
  125|      0|  for (uint32_t i = 0; i < num_funcs; i++) {
  ------------------
  |  Branch (125:24): [True: 0, False: 0]
  ------------------
  126|      0|    if ((*funcs)->free_func != NULL) {
  ------------------
  |  Branch (126:9): [True: 0, False: 0]
  ------------------
  127|      0|      int index = (int)i + ex_data_class->num_reserved;
  128|      0|      void *ptr = CRYPTO_get_ex_data(ad, index);
  129|      0|      (*funcs)->free_func(/*parent=*/nullptr, ptr, /*ad*/ nullptr, index,
  130|      0|                          (*funcs)->argl, (*funcs)->argp);
  131|      0|    }
  132|      0|    funcs = &(*funcs)->next;
  133|      0|  }
  134|       |
  135|      0|  sk_void_free(ad->sk);
  136|      0|  ad->sk = NULL;
  137|      0|}

aes_hw_set_encrypt_key:
   96|  9.77k|int aes_hw_set_encrypt_key(const uint8_t *user_key, int bits, AES_KEY *key) {
   97|  9.77k|  if (aes_hw_set_encrypt_key_alt_preferred()) {
  ------------------
  |  Branch (97:7): [True: 9.77k, False: 0]
  ------------------
   98|  9.77k|    return aes_hw_set_encrypt_key_alt(user_key, bits, key);
   99|  9.77k|  } else {
  100|      0|    return aes_hw_set_encrypt_key_base(user_key, bits, key);
  101|      0|  }
  102|  9.77k|}
aes_ctr_set_key:
  164|  9.77k|                         size_t key_bytes) {
  165|       |  // This function assumes the key length was previously validated.
  166|  9.77k|  assert(key_bytes == 128 / 8 || key_bytes == 192 / 8 || key_bytes == 256 / 8);
  167|  9.77k|  if (hwaes_capable()) {
  ------------------
  |  Branch (167:7): [True: 9.77k, False: 0]
  ------------------
  168|  9.77k|    aes_hw_set_encrypt_key(key, (int)key_bytes * 8, aes_key);
  169|  9.77k|    if (out_is_hwaes) {
  ------------------
  |  Branch (169:9): [True: 0, False: 9.77k]
  ------------------
  170|      0|      *out_is_hwaes = 1;
  171|      0|    }
  172|  9.77k|    if (out_block) {
  ------------------
  |  Branch (172:9): [True: 9.77k, False: 0]
  ------------------
  173|  9.77k|      *out_block = aes_hw_encrypt;
  174|  9.77k|    }
  175|  9.77k|    return aes_hw_ctr32_encrypt_blocks;
  176|  9.77k|  }
  177|       |
  178|      0|  if (vpaes_capable()) {
  ------------------
  |  Branch (178:7): [True: 0, False: 0]
  ------------------
  179|      0|    vpaes_set_encrypt_key(key, (int)key_bytes * 8, aes_key);
  180|      0|    if (out_block) {
  ------------------
  |  Branch (180:9): [True: 0, False: 0]
  ------------------
  181|      0|      *out_block = vpaes_encrypt;
  182|      0|    }
  183|      0|    if (out_is_hwaes) {
  ------------------
  |  Branch (183:9): [True: 0, False: 0]
  ------------------
  184|      0|      *out_is_hwaes = 0;
  185|      0|    }
  186|       |#if defined(BSAES)
  187|       |    assert(bsaes_capable());
  188|       |    return vpaes_ctr32_encrypt_blocks_with_bsaes;
  189|       |#else
  190|      0|    return vpaes_ctr32_encrypt_blocks;
  191|      0|#endif
  192|      0|  }
  193|       |
  194|      0|  aes_nohw_set_encrypt_key(key, (int)key_bytes * 8, aes_key);
  195|      0|  if (out_is_hwaes) {
  ------------------
  |  Branch (195:7): [True: 0, False: 0]
  ------------------
  196|      0|    *out_is_hwaes = 0;
  197|      0|  }
  198|      0|  if (out_block) {
  ------------------
  |  Branch (198:7): [True: 0, False: 0]
  ------------------
  199|      0|    *out_block = aes_nohw_encrypt;
  200|      0|  }
  201|      0|  return aes_nohw_ctr32_encrypt_blocks;
  202|      0|}

crypto_gcm_clmul_enabled:
  597|  30.9k|int crypto_gcm_clmul_enabled(void) {
  598|  30.9k|#if defined(GHASH_ASM_X86) || defined(GHASH_ASM_X86_64)
  599|  30.9k|  return CRYPTO_is_PCLMUL_capable() && CRYPTO_is_SSSE3_capable();
  ------------------
  |  Branch (599:10): [True: 30.9k, False: 0]
  |  Branch (599:40): [True: 30.9k, False: 0]
  ------------------
  600|       |#else
  601|       |  return 0;
  602|       |#endif
  603|  30.9k|}

hwaes_capable:
   60|  50.5k|inline int hwaes_capable(void) { return CRYPTO_is_AESNI_capable(); }
aes_hw_set_encrypt_key_alt_preferred:
  118|  9.77k|inline int aes_hw_set_encrypt_key_alt_preferred(void) {
  119|  9.77k|  return hwaes_capable() && CRYPTO_is_AVX_capable();
  ------------------
  |  Branch (119:10): [True: 9.77k, False: 0]
  |  Branch (119:29): [True: 9.77k, False: 0]
  ------------------
  120|  9.77k|}

bn_usub_consttime:
  182|      4|int bn_usub_consttime(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) {
  183|       |  // |b| may have more words than |a| given non-minimal inputs, but all words
  184|       |  // beyond |a->width| must then be zero.
  185|      4|  int b_width = b->width;
  186|      4|  if (b_width > a->width) {
  ------------------
  |  Branch (186:7): [True: 0, False: 4]
  ------------------
  187|      0|    if (!bn_fits_in_words(b, a->width)) {
  ------------------
  |  Branch (187:9): [True: 0, False: 0]
  ------------------
  188|      0|      OPENSSL_PUT_ERROR(BN, BN_R_ARG2_LT_ARG3);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  189|      0|      return 0;
  190|      0|    }
  191|      0|    b_width = a->width;
  192|      0|  }
  193|       |
  194|      4|  if (!bn_wexpand(r, a->width)) {
  ------------------
  |  Branch (194:7): [True: 0, False: 4]
  ------------------
  195|      0|    return 0;
  196|      0|  }
  197|       |
  198|      4|  BN_ULONG borrow = bn_sub_words(r->d, a->d, b->d, b_width);
  199|     68|  for (int i = b_width; i < a->width; i++) {
  ------------------
  |  Branch (199:25): [True: 64, False: 4]
  ------------------
  200|     64|    r->d[i] = CRYPTO_subc_w(a->d[i], 0, borrow, &borrow);
  ------------------
  |  | 1563|     64|#define CRYPTO_subc_w CRYPTO_subc_u64
  ------------------
  201|     64|  }
  202|       |
  203|      4|  if (borrow) {
  ------------------
  |  Branch (203:7): [True: 0, False: 4]
  ------------------
  204|      0|    OPENSSL_PUT_ERROR(BN, BN_R_ARG2_LT_ARG3);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  205|      0|    return 0;
  206|      0|  }
  207|       |
  208|      4|  r->width = a->width;
  209|      4|  r->neg = 0;
  210|      4|  return 1;
  211|      4|}

bn_mul_add_words:
  125|     62|                          BN_ULONG w) {
  126|     62|  BN_ULONG c1 = 0;
  127|       |
  128|     62|  if (num == 0) {
  ------------------
  |  Branch (128:7): [True: 0, False: 62]
  ------------------
  129|      0|    return (c1);
  130|      0|  }
  131|       |
  132|    310|  while (num & ~3) {
  ------------------
  |  Branch (132:10): [True: 248, False: 62]
  ------------------
  133|    248|    mul_add(rp[0], ap[0], w, c1);
  ------------------
  |  |   80|    248|  do {                                                                     \
  |  |   81|    248|    BN_ULONG high, low;                                                    \
  |  |   82|    248|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|    248|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|    248|            : "a"(low)                                                     \
  |  |   86|    248|            : "cc");                                                       \
  |  |   87|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|    248|            : "+m"(r), "+d"(high)                                          \
  |  |   89|    248|            : "r"(carry)                                                   \
  |  |   90|    248|            : "cc");                                                       \
  |  |   91|    248|    (carry) = high;                                                        \
  |  |   92|    248|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|    248|    mul_add(rp[1], ap[1], w, c1);
  ------------------
  |  |   80|    248|  do {                                                                     \
  |  |   81|    248|    BN_ULONG high, low;                                                    \
  |  |   82|    248|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|    248|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|    248|            : "a"(low)                                                     \
  |  |   86|    248|            : "cc");                                                       \
  |  |   87|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|    248|            : "+m"(r), "+d"(high)                                          \
  |  |   89|    248|            : "r"(carry)                                                   \
  |  |   90|    248|            : "cc");                                                       \
  |  |   91|    248|    (carry) = high;                                                        \
  |  |   92|    248|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  135|    248|    mul_add(rp[2], ap[2], w, c1);
  ------------------
  |  |   80|    248|  do {                                                                     \
  |  |   81|    248|    BN_ULONG high, low;                                                    \
  |  |   82|    248|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|    248|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|    248|            : "a"(low)                                                     \
  |  |   86|    248|            : "cc");                                                       \
  |  |   87|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|    248|            : "+m"(r), "+d"(high)                                          \
  |  |   89|    248|            : "r"(carry)                                                   \
  |  |   90|    248|            : "cc");                                                       \
  |  |   91|    248|    (carry) = high;                                                        \
  |  |   92|    248|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  136|    248|    mul_add(rp[3], ap[3], w, c1);
  ------------------
  |  |   80|    248|  do {                                                                     \
  |  |   81|    248|    BN_ULONG high, low;                                                    \
  |  |   82|    248|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|    248|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|    248|            : "a"(low)                                                     \
  |  |   86|    248|            : "cc");                                                       \
  |  |   87|    248|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|    248|            : "+m"(r), "+d"(high)                                          \
  |  |   89|    248|            : "r"(carry)                                                   \
  |  |   90|    248|            : "cc");                                                       \
  |  |   91|    248|    (carry) = high;                                                        \
  |  |   92|    248|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  137|    248|    ap += 4;
  138|    248|    rp += 4;
  139|    248|    num -= 4;
  140|    248|  }
  141|     62|  if (num) {
  ------------------
  |  Branch (141:7): [True: 62, False: 0]
  ------------------
  142|     62|    mul_add(rp[0], ap[0], w, c1);
  ------------------
  |  |   80|     62|  do {                                                                     \
  |  |   81|     62|    BN_ULONG high, low;                                                    \
  |  |   82|     62|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|     62|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|     62|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|     62|            : "a"(low)                                                     \
  |  |   86|     62|            : "cc");                                                       \
  |  |   87|     62|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|     62|            : "+m"(r), "+d"(high)                                          \
  |  |   89|     62|            : "r"(carry)                                                   \
  |  |   90|     62|            : "cc");                                                       \
  |  |   91|     62|    (carry) = high;                                                        \
  |  |   92|     62|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  143|     62|    if (--num == 0) {
  ------------------
  |  Branch (143:9): [True: 62, False: 0]
  ------------------
  144|     62|      return c1;
  145|     62|    }
  146|      0|    mul_add(rp[1], ap[1], w, c1);
  ------------------
  |  |   80|      0|  do {                                                                     \
  |  |   81|      0|    BN_ULONG high, low;                                                    \
  |  |   82|      0|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|      0|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|      0|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|      0|            : "a"(low)                                                     \
  |  |   86|      0|            : "cc");                                                       \
  |  |   87|      0|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|      0|            : "+m"(r), "+d"(high)                                          \
  |  |   89|      0|            : "r"(carry)                                                   \
  |  |   90|      0|            : "cc");                                                       \
  |  |   91|      0|    (carry) = high;                                                        \
  |  |   92|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  147|      0|    if (--num == 0) {
  ------------------
  |  Branch (147:9): [True: 0, False: 0]
  ------------------
  148|      0|      return c1;
  149|      0|    }
  150|      0|    mul_add(rp[2], ap[2], w, c1);
  ------------------
  |  |   80|      0|  do {                                                                     \
  |  |   81|      0|    BN_ULONG high, low;                                                    \
  |  |   82|      0|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
  |  |   83|      0|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   84|      0|            : "+r"(carry), "+d"(high)                                      \
  |  |   85|      0|            : "a"(low)                                                     \
  |  |   86|      0|            : "cc");                                                       \
  |  |   87|      0|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   88|      0|            : "+m"(r), "+d"(high)                                          \
  |  |   89|      0|            : "r"(carry)                                                   \
  |  |   90|      0|            : "cc");                                                       \
  |  |   91|      0|    (carry) = high;                                                        \
  |  |   92|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (92:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|      0|    return c1;
  152|      0|  }
  153|       |
  154|      0|  return c1;
  155|     62|}
bn_mul_words:
  158|     10|                      BN_ULONG w) {
  159|     10|  BN_ULONG c1 = 0;
  160|       |
  161|     10|  if (num == 0) {
  ------------------
  |  Branch (161:7): [True: 0, False: 10]
  ------------------
  162|      0|    return c1;
  163|      0|  }
  164|       |
  165|     58|  while (num & ~3) {
  ------------------
  |  Branch (165:10): [True: 48, False: 10]
  ------------------
  166|     48|    mul(rp[0], ap[0], w, c1);
  ------------------
  |  |   95|     48|  do {                                                                     \
  |  |   96|     48|    BN_ULONG high, low;                                                    \
  |  |   97|     48|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|     48|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|     48|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|     48|            : "a"(low)                                                     \
  |  |  101|     48|            : "cc");                                                       \
  |  |  102|     48|    (r) = (carry);                                                         \
  |  |  103|     48|    (carry) = high;                                                        \
  |  |  104|     48|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|     48|    mul(rp[1], ap[1], w, c1);
  ------------------
  |  |   95|     48|  do {                                                                     \
  |  |   96|     48|    BN_ULONG high, low;                                                    \
  |  |   97|     48|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|     48|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|     48|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|     48|            : "a"(low)                                                     \
  |  |  101|     48|            : "cc");                                                       \
  |  |  102|     48|    (r) = (carry);                                                         \
  |  |  103|     48|    (carry) = high;                                                        \
  |  |  104|     48|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  168|     48|    mul(rp[2], ap[2], w, c1);
  ------------------
  |  |   95|     48|  do {                                                                     \
  |  |   96|     48|    BN_ULONG high, low;                                                    \
  |  |   97|     48|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|     48|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|     48|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|     48|            : "a"(low)                                                     \
  |  |  101|     48|            : "cc");                                                       \
  |  |  102|     48|    (r) = (carry);                                                         \
  |  |  103|     48|    (carry) = high;                                                        \
  |  |  104|     48|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  169|     48|    mul(rp[3], ap[3], w, c1);
  ------------------
  |  |   95|     48|  do {                                                                     \
  |  |   96|     48|    BN_ULONG high, low;                                                    \
  |  |   97|     48|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|     48|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|     48|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|     48|            : "a"(low)                                                     \
  |  |  101|     48|            : "cc");                                                       \
  |  |  102|     48|    (r) = (carry);                                                         \
  |  |  103|     48|    (carry) = high;                                                        \
  |  |  104|     48|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  170|     48|    ap += 4;
  171|     48|    rp += 4;
  172|     48|    num -= 4;
  173|     48|  }
  174|     10|  if (num) {
  ------------------
  |  Branch (174:7): [True: 10, False: 0]
  ------------------
  175|     10|    mul(rp[0], ap[0], w, c1);
  ------------------
  |  |   95|     10|  do {                                                                     \
  |  |   96|     10|    BN_ULONG high, low;                                                    \
  |  |   97|     10|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|     10|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|     10|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|     10|            : "a"(low)                                                     \
  |  |  101|     10|            : "cc");                                                       \
  |  |  102|     10|    (r) = (carry);                                                         \
  |  |  103|     10|    (carry) = high;                                                        \
  |  |  104|     10|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  176|     10|    if (--num == 0) {
  ------------------
  |  Branch (176:9): [True: 10, False: 0]
  ------------------
  177|     10|      return c1;
  178|     10|    }
  179|      0|    mul(rp[1], ap[1], w, c1);
  ------------------
  |  |   95|      0|  do {                                                                     \
  |  |   96|      0|    BN_ULONG high, low;                                                    \
  |  |   97|      0|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|      0|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|      0|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|      0|            : "a"(low)                                                     \
  |  |  101|      0|            : "cc");                                                       \
  |  |  102|      0|    (r) = (carry);                                                         \
  |  |  103|      0|    (carry) = high;                                                        \
  |  |  104|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  180|      0|    if (--num == 0) {
  ------------------
  |  Branch (180:9): [True: 0, False: 0]
  ------------------
  181|      0|      return c1;
  182|      0|    }
  183|      0|    mul(rp[2], ap[2], w, c1);
  ------------------
  |  |   95|      0|  do {                                                                     \
  |  |   96|      0|    BN_ULONG high, low;                                                    \
  |  |   97|      0|    __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "g"(a) : "cc"); \
  |  |   98|      0|    __asm__("addq %2,%0; adcq $0,%1"                                       \
  |  |   99|      0|            : "+r"(carry), "+d"(high)                                      \
  |  |  100|      0|            : "a"(low)                                                     \
  |  |  101|      0|            : "cc");                                                       \
  |  |  102|      0|    (r) = (carry);                                                         \
  |  |  103|      0|    (carry) = high;                                                        \
  |  |  104|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (104:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  184|      0|  }
  185|      0|  return c1;
  186|     10|}
bn_add_words:
  217|  7.93k|                      size_t n) {
  218|  7.93k|  BN_ULONG ret;
  219|  7.93k|  size_t i = 0;
  220|       |
  221|  7.93k|  if (n == 0) {
  ------------------
  |  Branch (221:7): [True: 0, False: 7.93k]
  ------------------
  222|      0|    return 0;
  223|      0|  }
  224|       |
  225|  7.93k|  __asm__ volatile(
  226|  7.93k|      "	subq	%0,%0		\n"  // clear carry
  227|  7.93k|      "	jmp	1f		\n"
  228|  7.93k|      ".p2align 4			\n"
  229|  7.93k|      "1:"
  230|  7.93k|      "	movq	(%4,%2,8),%0	\n"
  231|  7.93k|      "	adcq	(%5,%2,8),%0	\n"
  232|  7.93k|      "	movq	%0,(%3,%2,8)	\n"
  233|  7.93k|      "	lea	1(%2),%2	\n"
  234|  7.93k|      "	dec	%1		\n"
  235|  7.93k|      "	jnz	1b		\n"
  236|  7.93k|      "	sbbq	%0,%0		\n"
  237|  7.93k|      : "=&r"(ret), "+&c"(n), "+&r"(i)
  238|  7.93k|      : "r"(rp), "r"(ap), "r"(bp)
  239|  7.93k|      : "cc", "memory");
  240|       |
  241|  7.93k|  return ret & 1;
  242|  7.93k|}
bn_sub_words:
  245|  7.94k|                      size_t n) {
  246|  7.94k|  BN_ULONG ret;
  247|  7.94k|  size_t i = 0;
  248|       |
  249|  7.94k|  if (n == 0) {
  ------------------
  |  Branch (249:7): [True: 0, False: 7.94k]
  ------------------
  250|      0|    return 0;
  251|      0|  }
  252|       |
  253|  7.94k|  __asm__ volatile(
  254|  7.94k|      "	subq	%0,%0		\n"  // clear borrow
  255|  7.94k|      "	jmp	1f		\n"
  256|  7.94k|      ".p2align 4			\n"
  257|  7.94k|      "1:"
  258|  7.94k|      "	movq	(%4,%2,8),%0	\n"
  259|  7.94k|      "	sbbq	(%5,%2,8),%0	\n"
  260|  7.94k|      "	movq	%0,(%3,%2,8)	\n"
  261|  7.94k|      "	lea	1(%2),%2	\n"
  262|  7.94k|      "	dec	%1		\n"
  263|  7.94k|      "	jnz	1b		\n"
  264|  7.94k|      "	sbbq	%0,%0		\n"
  265|  7.94k|      : "=&r"(ret), "+&c"(n), "+&r"(i)
  266|  7.94k|      : "r"(rp), "r"(ap), "r"(bp)
  267|  7.94k|      : "cc", "memory");
  268|       |
  269|  7.94k|  return ret & 1;
  270|  7.94k|}

BN_new:
   33|  70.4k|BIGNUM *BN_new(void) {
   34|  70.4k|  BIGNUM *bn = reinterpret_cast<BIGNUM *>(OPENSSL_malloc(sizeof(BIGNUM)));
   35|       |
   36|  70.4k|  if (bn == NULL) {
  ------------------
  |  Branch (36:7): [True: 0, False: 70.4k]
  ------------------
   37|      0|    return NULL;
   38|      0|  }
   39|       |
   40|  70.4k|  OPENSSL_memset(bn, 0, sizeof(BIGNUM));
   41|  70.4k|  bn->flags = BN_FLG_MALLOCED;
  ------------------
  |  |  932|  70.4k|#define BN_FLG_MALLOCED 0x01
  ------------------
   42|       |
   43|  70.4k|  return bn;
   44|  70.4k|}
BN_init:
   48|     12|void BN_init(BIGNUM *bn) { OPENSSL_memset(bn, 0, sizeof(BIGNUM)); }
BN_free:
   50|   422k|void BN_free(BIGNUM *bn) {
   51|   422k|  if (bn == NULL) {
  ------------------
  |  Branch (51:7): [True: 352k, False: 70.4k]
  ------------------
   52|   352k|    return;
   53|   352k|  }
   54|       |
   55|  70.4k|  if ((bn->flags & BN_FLG_STATIC_DATA) == 0) {
  ------------------
  |  |  933|  70.4k|#define BN_FLG_STATIC_DATA 0x02
  ------------------
  |  Branch (55:7): [True: 70.4k, False: 0]
  ------------------
   56|  70.4k|    OPENSSL_free(bn->d);
   57|  70.4k|  }
   58|       |
   59|  70.4k|  if (bn->flags & BN_FLG_MALLOCED) {
  ------------------
  |  |  932|  70.4k|#define BN_FLG_MALLOCED 0x01
  ------------------
  |  Branch (59:7): [True: 70.4k, False: 12]
  ------------------
   60|  70.4k|    OPENSSL_free(bn);
   61|  70.4k|  } else {
   62|     12|    bn->d = NULL;
   63|     12|  }
   64|  70.4k|}
BN_copy:
   88|     10|BIGNUM *BN_copy(BIGNUM *dest, const BIGNUM *src) {
   89|     10|  if (src == dest) {
  ------------------
  |  Branch (89:7): [True: 2, False: 8]
  ------------------
   90|      2|    return dest;
   91|      2|  }
   92|       |
   93|      8|  if (!bn_wexpand(dest, src->width)) {
  ------------------
  |  Branch (93:7): [True: 0, False: 8]
  ------------------
   94|      0|    return NULL;
   95|      0|  }
   96|       |
   97|      8|  OPENSSL_memcpy(dest->d, src->d, sizeof(src->d[0]) * src->width);
   98|       |
   99|      8|  dest->width = src->width;
  100|      8|  dest->neg = src->neg;
  101|      8|  return dest;
  102|      8|}
BN_num_bits_word:
  124|  70.4k|unsigned BN_num_bits_word(BN_ULONG l) {
  125|       |  // |BN_num_bits| is often called on RSA prime factors. These have public bit
  126|       |  // lengths, but all bits beyond the high bit are secret, so count bits in
  127|       |  // constant time.
  128|  70.4k|  BN_ULONG x, mask;
  129|  70.4k|  int bits = (l != 0);
  130|       |
  131|  70.4k|#if BN_BITS2 > 32
  132|       |  // Look at the upper half of |x|. |x| is at most 64 bits long.
  133|  70.4k|  x = l >> 32;
  134|       |  // Set |mask| to all ones if |x| (the top 32 bits of |l|) is non-zero and all
  135|       |  // all zeros otherwise.
  136|  70.4k|  mask = 0u - x;
  137|  70.4k|  mask = (0u - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  138|       |  // If |x| is non-zero, the lower half is included in the bit count in full,
  139|       |  // and we count the upper half. Otherwise, we count the lower half.
  140|  70.4k|  bits += 32 & mask;
  141|  70.4k|  l ^= (x ^ l) & mask;  // |l| is |x| if |mask| and remains |l| otherwise.
  142|  70.4k|#endif
  143|       |
  144|       |  // The remaining blocks are analogous iterations at lower powers of two.
  145|  70.4k|  x = l >> 16;
  146|  70.4k|  mask = 0u - x;
  147|  70.4k|  mask = (0u - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  148|  70.4k|  bits += 16 & mask;
  149|  70.4k|  l ^= (x ^ l) & mask;
  150|       |
  151|  70.4k|  x = l >> 8;
  152|  70.4k|  mask = 0u - x;
  153|  70.4k|  mask = (0u - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  154|  70.4k|  bits += 8 & mask;
  155|  70.4k|  l ^= (x ^ l) & mask;
  156|       |
  157|  70.4k|  x = l >> 4;
  158|  70.4k|  mask = 0u - x;
  159|  70.4k|  mask = (0u - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  160|  70.4k|  bits += 4 & mask;
  161|  70.4k|  l ^= (x ^ l) & mask;
  162|       |
  163|  70.4k|  x = l >> 2;
  164|  70.4k|  mask = 0u - x;
  165|  70.4k|  mask = (0u - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  166|  70.4k|  bits += 2 & mask;
  167|  70.4k|  l ^= (x ^ l) & mask;
  168|       |
  169|  70.4k|  x = l >> 1;
  170|  70.4k|  mask = 0u - x;
  171|  70.4k|  mask = (0u - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  172|  70.4k|  bits += 1 & mask;
  173|       |
  174|  70.4k|  return bits;
  175|  70.4k|}
BN_num_bits:
  177|  70.4k|unsigned BN_num_bits(const BIGNUM *bn) {
  178|  70.4k|  const int width = bn_minimal_width(bn);
  179|  70.4k|  if (width == 0) {
  ------------------
  |  Branch (179:7): [True: 0, False: 70.4k]
  ------------------
  180|      0|    return 0;
  181|      0|  }
  182|       |
  183|  70.4k|  return (width - 1) * BN_BITS2 + BN_num_bits_word(bn->d[width - 1]);
  ------------------
  |  |   42|  70.4k|#define BN_BITS2 64
  ------------------
  184|  70.4k|}
BN_zero:
  188|     34|void BN_zero(BIGNUM *bn) { bn->width = bn->neg = 0; }
bn_fits_in_words:
  254|     10|int bn_fits_in_words(const BIGNUM *bn, size_t num) {
  255|       |  // All words beyond |num| must be zero.
  256|     10|  BN_ULONG mask = 0;
  257|    180|  for (size_t i = num; i < (size_t)bn->width; i++) {
  ------------------
  |  Branch (257:24): [True: 170, False: 10]
  ------------------
  258|    170|    mask |= bn->d[i];
  259|    170|  }
  260|     10|  return mask == 0;
  261|     10|}
BN_is_negative:
  283|  70.4k|int BN_is_negative(const BIGNUM *bn) { return bn->neg != 0; }
bn_wexpand:
  293|  70.5k|int bn_wexpand(BIGNUM *bn, size_t words) {
  294|  70.5k|  BN_ULONG *a;
  295|       |
  296|  70.5k|  if (words <= (size_t)bn->dmax) {
  ------------------
  |  Branch (296:7): [True: 32, False: 70.4k]
  ------------------
  297|     32|    return 1;
  298|     32|  }
  299|       |
  300|  70.4k|  if (words > BN_MAX_WORDS) {
  ------------------
  |  |   31|  70.4k|#define BN_MAX_WORDS (INT_MAX / (4 * BN_BITS2))
  |  |  ------------------
  |  |  |  |   42|  70.4k|#define BN_BITS2 64
  |  |  ------------------
  ------------------
  |  Branch (300:7): [True: 0, False: 70.4k]
  ------------------
  301|      0|    OPENSSL_PUT_ERROR(BN, BN_R_BIGNUM_TOO_LONG);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  302|      0|    return 0;
  303|      0|  }
  304|       |
  305|  70.4k|  if (bn->flags & BN_FLG_STATIC_DATA) {
  ------------------
  |  |  933|  70.4k|#define BN_FLG_STATIC_DATA 0x02
  ------------------
  |  Branch (305:7): [True: 0, False: 70.4k]
  ------------------
  306|      0|    OPENSSL_PUT_ERROR(BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  307|      0|    return 0;
  308|      0|  }
  309|       |
  310|  70.4k|  a = reinterpret_cast<BN_ULONG *>(OPENSSL_calloc(words, sizeof(BN_ULONG)));
  311|  70.4k|  if (a == NULL) {
  ------------------
  |  Branch (311:7): [True: 0, False: 70.4k]
  ------------------
  312|      0|    return 0;
  313|      0|  }
  314|       |
  315|  70.4k|  OPENSSL_memcpy(a, bn->d, sizeof(BN_ULONG) * bn->width);
  316|       |
  317|  70.4k|  OPENSSL_free(bn->d);
  318|  70.4k|  bn->d = a;
  319|  70.4k|  bn->dmax = (int)words;
  320|       |
  321|  70.4k|  return 1;
  322|  70.4k|}
bn_select_words:
  353|  7.93k|                     const BN_ULONG *b, size_t num) {
  354|   142k|  for (size_t i = 0; i < num; i++) {
  ------------------
  |  Branch (354:22): [True: 134k, False: 7.93k]
  ------------------
  355|   134k|    static_assert(sizeof(BN_ULONG) <= sizeof(crypto_word_t),
  356|   134k|                  "crypto_word_t is too small");
  357|   134k|    r[i] = constant_time_select_w(mask, a[i], b[i]);
  358|   134k|  }
  359|  7.93k|}
bn_minimal_width:
  361|  70.4k|int bn_minimal_width(const BIGNUM *bn) {
  362|  70.4k|  int ret = bn->width;
  363|   105k|  while (ret > 0 && bn->d[ret - 1] == 0) {
  ------------------
  |  Branch (363:10): [True: 105k, False: 0]
  |  Branch (363:21): [True: 35.2k, False: 70.4k]
  ------------------
  364|  35.2k|    ret--;
  365|  35.2k|  }
  366|  70.4k|  return ret;
  367|  70.4k|}
bcm.cc:_ZL20BN_value_one_do_initP9bignum_st:
  113|      2|DEFINE_METHOD_FUNCTION(BIGNUM, BN_value_one) {
  114|      2|  static const BN_ULONG kOneLimbs[1] = {1};
  115|      2|  out->d = (BN_ULONG *)kOneLimbs;
  116|      2|  out->width = 1;
  117|      2|  out->dmax = 1;
  118|      2|  out->neg = 0;
  119|      2|  out->flags = BN_FLG_STATIC_DATA;
  ------------------
  |  |  933|      2|#define BN_FLG_STATIC_DATA 0x02
  ------------------
  120|      2|}

bn_big_endian_to_words:
   23|  70.4k|                            size_t in_len) {
   24|       |  // The caller should have sized |out| to fit |in| without truncating. This
   25|       |  // condition ensures we do not overflow |out|, so use a runtime check.
   26|  70.4k|  BSSL_CHECK(in_len <= out_len * sizeof(BN_ULONG));
  ------------------
  |  |  384|  70.4k|  do {                        \
  |  |  385|  70.4k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 70.4k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  70.4k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   27|       |
   28|       |  // Load whole words.
   29|  1.19M|  while (in_len >= sizeof(BN_ULONG)) {
  ------------------
  |  Branch (29:10): [True: 1.12M, False: 70.4k]
  ------------------
   30|  1.12M|    in_len -= sizeof(BN_ULONG);
   31|  1.12M|    out[0] = CRYPTO_load_word_be(in + in_len);
   32|  1.12M|    out++;
   33|  1.12M|    out_len--;
   34|  1.12M|  }
   35|       |
   36|       |  // Load the last partial word.
   37|  70.4k|  if (in_len != 0) {
  ------------------
  |  Branch (37:7): [True: 70.4k, False: 2]
  ------------------
   38|  70.4k|    BN_ULONG word = 0;
   39|   211k|    for (size_t i = 0; i < in_len; i++) {
  ------------------
  |  Branch (39:24): [True: 140k, False: 70.4k]
  ------------------
   40|   140k|      word = (word << 8) | in[i];
   41|   140k|    }
   42|  70.4k|    out[0] = word;
   43|  70.4k|    out++;
   44|  70.4k|    out_len--;
   45|  70.4k|  }
   46|       |
   47|       |  // Fill the remainder with zeros.
   48|  70.4k|  OPENSSL_memset(out, 0, out_len * sizeof(BN_ULONG));
   49|  70.4k|}
BN_bin2bn:
   51|  70.4k|BIGNUM *BN_bin2bn(const uint8_t *in, size_t len, BIGNUM *ret) {
   52|  70.4k|  BIGNUM *bn = NULL;
   53|  70.4k|  if (ret == NULL) {
  ------------------
  |  Branch (53:7): [True: 0, False: 70.4k]
  ------------------
   54|      0|    bn = BN_new();
   55|      0|    if (bn == NULL) {
  ------------------
  |  Branch (55:9): [True: 0, False: 0]
  ------------------
   56|      0|      return NULL;
   57|      0|    }
   58|      0|    ret = bn;
   59|      0|  }
   60|       |
   61|  70.4k|  if (len == 0) {
  ------------------
  |  Branch (61:7): [True: 0, False: 70.4k]
  ------------------
   62|      0|    ret->width = 0;
   63|      0|    return ret;
   64|      0|  }
   65|       |
   66|  70.4k|  size_t num_words = ((len - 1) / BN_BYTES) + 1;
  ------------------
  |  |   44|  70.4k|#define BN_BYTES 8
  ------------------
   67|  70.4k|  if (!bn_wexpand(ret, num_words)) {
  ------------------
  |  Branch (67:7): [True: 0, False: 70.4k]
  ------------------
   68|      0|    BN_free(bn);
   69|      0|    return NULL;
   70|      0|  }
   71|       |
   72|       |  // |bn_wexpand| must check bounds on |num_words| to write it into
   73|       |  // |ret->dmax|.
   74|  70.4k|  assert(num_words <= INT_MAX);
   75|  70.4k|  ret->width = (int)num_words;
   76|  70.4k|  ret->neg = 0;
   77|       |
   78|  70.4k|  bn_big_endian_to_words(ret->d, ret->width, in, len);
   79|  70.4k|  return ret;
   80|  70.4k|}

BN_ucmp:
   57|  58.8k|int BN_ucmp(const BIGNUM *a, const BIGNUM *b) {
   58|  58.8k|  return bn_cmp_words_consttime(a->d, a->width, b->d, b->width);
   59|  58.8k|}
BN_cmp:
   61|  23.6k|int BN_cmp(const BIGNUM *a, const BIGNUM *b) {
   62|  23.6k|  if ((a == NULL) || (b == NULL)) {
  ------------------
  |  Branch (62:7): [True: 0, False: 23.6k]
  |  Branch (62:22): [True: 0, False: 23.6k]
  ------------------
   63|      0|    if (a != NULL) {
  ------------------
  |  Branch (63:9): [True: 0, False: 0]
  ------------------
   64|      0|      return -1;
   65|      0|    } else if (b != NULL) {
  ------------------
  |  Branch (65:16): [True: 0, False: 0]
  ------------------
   66|      0|      return 1;
   67|      0|    } else {
   68|      0|      return 0;
   69|      0|    }
   70|      0|  }
   71|       |
   72|       |  // We do not attempt to process the sign bit in constant time. Negative
   73|       |  // |BIGNUM|s should never occur in crypto, only calculators.
   74|  23.6k|  if (a->neg != b->neg) {
  ------------------
  |  Branch (74:7): [True: 0, False: 23.6k]
  ------------------
   75|      0|    if (a->neg) {
  ------------------
  |  Branch (75:9): [True: 0, False: 0]
  ------------------
   76|      0|      return -1;
   77|      0|    }
   78|      0|    return 1;
   79|      0|  }
   80|       |
   81|  23.6k|  int ret = BN_ucmp(a, b);
   82|  23.6k|  return a->neg ? -ret : ret;
  ------------------
  |  Branch (82:10): [True: 0, False: 23.6k]
  ------------------
   83|  23.6k|}
BN_abs_is_word:
   89|     10|int BN_abs_is_word(const BIGNUM *bn, BN_ULONG w) {
   90|     10|  if (bn->width == 0) {
  ------------------
  |  Branch (90:7): [True: 0, False: 10]
  ------------------
   91|      0|    return w == 0;
   92|      0|  }
   93|     10|  BN_ULONG mask = bn->d[0] ^ w;
   94|    170|  for (int i = 1; i < bn->width; i++) {
  ------------------
  |  Branch (94:19): [True: 160, False: 10]
  ------------------
   95|    160|    mask |= bn->d[i];
   96|    160|  }
   97|     10|  return mask == 0;
   98|     10|}
BN_is_zero:
  111|     10|int BN_is_zero(const BIGNUM *bn) {
  112|     10|  return bn_fits_in_words(bn, 0);
  113|     10|}
BN_is_one:
  115|     10|int BN_is_one(const BIGNUM *bn) {
  116|     10|  return bn->neg == 0 && BN_abs_is_word(bn, 1);
  ------------------
  |  Branch (116:10): [True: 10, False: 0]
  |  Branch (116:26): [True: 10, False: 0]
  ------------------
  117|     10|}
BN_is_odd:
  123|  70.4k|int BN_is_odd(const BIGNUM *bn) {
  124|  70.4k|  return bn->width > 0 && (bn->d[0] & 1) == 1;
  ------------------
  |  Branch (124:10): [True: 70.4k, False: 0]
  |  Branch (124:27): [True: 70.4k, False: 0]
  ------------------
  125|  70.4k|}
bcm.cc:_ZL22bn_cmp_words_consttimePKmmS0_m:
   26|  58.8k|                                  const BN_ULONG *b, size_t b_len) {
   27|  58.8k|  static_assert(sizeof(BN_ULONG) <= sizeof(crypto_word_t),
   28|  58.8k|                "crypto_word_t is too small");
   29|  58.8k|  int ret = 0;
   30|       |  // Process the common words in little-endian order.
   31|  58.8k|  size_t min = a_len < b_len ? a_len : b_len;
  ------------------
  |  Branch (31:16): [True: 6, False: 58.8k]
  ------------------
   32|   496k|  for (size_t i = 0; i < min; i++) {
  ------------------
  |  Branch (32:22): [True: 437k, False: 58.8k]
  ------------------
   33|   437k|    crypto_word_t eq = constant_time_eq_w(a[i], b[i]);
   34|   437k|    crypto_word_t lt = constant_time_lt_w(a[i], b[i]);
   35|   437k|    ret =
   36|   437k|        constant_time_select_int(eq, ret, constant_time_select_int(lt, -1, 1));
   37|   437k|  }
   38|       |
   39|       |  // If |a| or |b| has non-zero words beyond |min|, they take precedence.
   40|  58.8k|  if (a_len < b_len) {
  ------------------
  |  Branch (40:7): [True: 6, False: 58.8k]
  ------------------
   41|      6|    crypto_word_t mask = 0;
   42|     72|    for (size_t i = a_len; i < b_len; i++) {
  ------------------
  |  Branch (42:28): [True: 66, False: 6]
  ------------------
   43|     66|      mask |= b[i];
   44|     66|    }
   45|      6|    ret = constant_time_select_int(constant_time_is_zero_w(mask), ret, -1);
   46|  58.8k|  } else if (b_len < a_len) {
  ------------------
  |  Branch (46:14): [True: 35.2k, False: 23.6k]
  ------------------
   47|  35.2k|    crypto_word_t mask = 0;
   48|  1.16M|    for (size_t i = b_len; i < a_len; i++) {
  ------------------
  |  Branch (48:28): [True: 1.12M, False: 35.2k]
  ------------------
   49|  1.12M|      mask |= a[i];
   50|  1.12M|    }
   51|  35.2k|    ret = constant_time_select_int(constant_time_is_zero_w(mask), ret, 1);
   52|  35.2k|  }
   53|       |
   54|  58.8k|  return ret;
   55|  58.8k|}

BN_CTX_new:
   52|      2|BN_CTX *BN_CTX_new(void) { return bssl::New<BN_CTX>(); }
BN_CTX_free:
   54|      2|void BN_CTX_free(BN_CTX *ctx) { bssl::Delete(ctx); }
BN_CTX_start:
   56|     26|void BN_CTX_start(BN_CTX *ctx) {
   57|     26|  if (ctx->error_) {
  ------------------
  |  Branch (57:7): [True: 0, False: 26]
  ------------------
   58|       |    // Once an operation has failed, |ctx->stack| no longer matches the number
   59|       |    // of |BN_CTX_end| calls to come. Do nothing.
   60|      0|    return;
   61|      0|  }
   62|       |
   63|     26|  if (!ctx->stack_.Push(ctx->used_)) {
  ------------------
  |  Branch (63:7): [True: 0, False: 26]
  ------------------
   64|      0|    ctx->error_ = true;
   65|       |    // |BN_CTX_start| cannot fail, so defer the error to |BN_CTX_get|.
   66|      0|    ctx->defer_error_ = true;
   67|      0|    ERR_clear_error();
   68|      0|  }
   69|     26|}
BN_CTX_get:
   71|     34|BIGNUM *BN_CTX_get(BN_CTX *ctx) {
   72|       |  // Once any operation has failed, they all do.
   73|     34|  if (ctx->error_) {
  ------------------
  |  Branch (73:7): [True: 0, False: 34]
  ------------------
   74|      0|    if (ctx->defer_error_) {
  ------------------
  |  Branch (74:9): [True: 0, False: 0]
  ------------------
   75|      0|      OPENSSL_PUT_ERROR(BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   76|      0|      ctx->defer_error_ = false;
   77|      0|    }
   78|      0|    return nullptr;
   79|      0|  }
   80|       |
   81|     34|  if (ctx->used_ == ctx->bignums_.size()) {
  ------------------
  |  Branch (81:7): [True: 8, False: 26]
  ------------------
   82|      8|    bssl::UniquePtr<BIGNUM> bn(BN_new());
   83|      8|    if (bn == nullptr || !ctx->bignums_.Push(std::move(bn))) {
  ------------------
  |  Branch (83:9): [True: 0, False: 8]
  |  Branch (83:9): [True: 0, False: 8]
  |  Branch (83:26): [True: 0, False: 8]
  ------------------
   84|      0|      OPENSSL_PUT_ERROR(BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   85|      0|      ctx->error_ = true;
   86|      0|      return nullptr;
   87|      0|    }
   88|      8|  }
   89|       |
   90|     34|  BIGNUM *ret = ctx->bignums_[ctx->used_].get();
   91|     34|  BN_zero(ret);
   92|       |  // This is bounded by |ctx->bignums_.size()|, so it cannot overflow.
   93|     34|  ctx->used_++;
   94|     34|  return ret;
   95|     34|}
BN_CTX_end:
   97|     26|void BN_CTX_end(BN_CTX *ctx) {
   98|     26|  if (ctx->error_) {
  ------------------
  |  Branch (98:7): [True: 0, False: 26]
  ------------------
   99|       |    // Once an operation has failed, |ctx->stack_| no longer matches the number
  100|       |    // of |BN_CTX_end| calls to come. Do nothing.
  101|      0|    return;
  102|      0|  }
  103|       |
  104|     26|  assert(!ctx->stack_.empty());
  105|     26|  ctx->used_ = ctx->stack_.back();
  106|     26|  ctx->stack_.pop_back();
  107|     26|}
_ZN10bignum_ctxD2Ev:
   29|      2|  ~bignum_ctx() {
   30|       |    // All |BN_CTX_start| calls must be matched with |BN_CTX_end|, otherwise the
   31|       |    // function may use more memory than expected, potentially without bound if
   32|       |    // done in a loop. Assert that all |BIGNUM|s have been released.
   33|      2|    assert(used_ == 0 || error_);
   34|      2|  }

bn_reduce_once_in_place:
  374|  7.93k|                                 BN_ULONG *tmp, size_t num) {
  375|       |  // See |bn_reduce_once| for why this logic works.
  376|  7.93k|  carry -= bn_sub_words(tmp, r, m, num);
  377|  7.93k|  declassify_assert(carry + 1 <= 1);
  ------------------
  |  |  493|  7.93k|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  ------------------
  378|  7.93k|  bn_select_words(r, carry, r /* tmp < 0 */, tmp /* tmp >= 0 */, num);
  379|  7.93k|  return carry;
  380|  7.93k|}
bn_div_consttime:
  399|     10|                     unsigned divisor_min_bits, BN_CTX *ctx) {
  400|     10|  if (BN_is_negative(numerator) || BN_is_negative(divisor)) {
  ------------------
  |  Branch (400:7): [True: 0, False: 10]
  |  Branch (400:36): [True: 0, False: 10]
  ------------------
  401|      0|    OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  402|      0|    return 0;
  403|      0|  }
  404|     10|  if (BN_is_zero(divisor)) {
  ------------------
  |  Branch (404:7): [True: 0, False: 10]
  ------------------
  405|      0|    OPENSSL_PUT_ERROR(BN, BN_R_DIV_BY_ZERO);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  406|      0|    return 0;
  407|      0|  }
  408|       |
  409|       |  // This function implements long division in binary. It is not very efficient,
  410|       |  // but it is simple, easy to make constant-time, and performant enough for RSA
  411|       |  // key generation.
  412|       |
  413|     10|  bssl::BN_CTXScope scope(ctx);
  414|     10|  BIGNUM *q = quotient, *r = remainder;
  415|     10|  if (quotient == NULL || quotient == numerator || quotient == divisor) {
  ------------------
  |  Branch (415:7): [True: 10, False: 0]
  |  Branch (415:27): [True: 0, False: 0]
  |  Branch (415:52): [True: 0, False: 0]
  ------------------
  416|     10|    q = BN_CTX_get(ctx);
  417|     10|  }
  418|     10|  if (remainder == NULL || remainder == numerator || remainder == divisor) {
  ------------------
  |  Branch (418:7): [True: 0, False: 10]
  |  Branch (418:28): [True: 8, False: 2]
  |  Branch (418:54): [True: 0, False: 2]
  ------------------
  419|      8|    r = BN_CTX_get(ctx);
  420|      8|  }
  421|     10|  BIGNUM *tmp = BN_CTX_get(ctx);
  422|     10|  int initial_words;
  423|     10|  if (q == NULL || r == NULL || tmp == NULL ||
  ------------------
  |  Branch (423:7): [True: 0, False: 10]
  |  Branch (423:20): [True: 0, False: 10]
  |  Branch (423:33): [True: 0, False: 10]
  ------------------
  424|     10|      !bn_wexpand(q, numerator->width) || !bn_wexpand(r, divisor->width) ||
  ------------------
  |  Branch (424:7): [True: 0, False: 10]
  |  Branch (424:43): [True: 0, False: 10]
  ------------------
  425|     10|      !bn_wexpand(tmp, divisor->width)) {
  ------------------
  |  Branch (425:7): [True: 0, False: 10]
  ------------------
  426|      0|    return 0;
  427|      0|  }
  428|       |
  429|     10|  OPENSSL_memset(q->d, 0, numerator->width * sizeof(BN_ULONG));
  430|     10|  q->width = numerator->width;
  431|     10|  q->neg = 0;
  432|       |
  433|     10|  OPENSSL_memset(r->d, 0, divisor->width * sizeof(BN_ULONG));
  434|     10|  r->width = divisor->width;
  435|     10|  r->neg = 0;
  436|       |
  437|       |  // Incorporate |numerator| into |r|, one bit at a time, reducing after each
  438|       |  // step. We maintain the invariant that |0 <= r < divisor| and
  439|       |  // |q * divisor + r = n| where |n| is the portion of |numerator| incorporated
  440|       |  // so far.
  441|       |  //
  442|       |  // First, we short-circuit the loop: if we know |divisor| has at least
  443|       |  // |divisor_min_bits| bits, the top |divisor_min_bits - 1| can be incorporated
  444|       |  // without reductions. This significantly speeds up |RSA_check_key|. For
  445|       |  // simplicity, we round down to a whole number of words.
  446|     10|  declassify_assert(divisor_min_bits <= BN_num_bits(divisor));
  ------------------
  |  |  493|     10|#define declassify_assert(expr) assert(constant_time_declassify_int(expr))
  ------------------
  447|     10|  initial_words = 0;
  448|     10|  if (divisor_min_bits > 0) {
  ------------------
  |  Branch (448:7): [True: 10, False: 0]
  ------------------
  449|     10|    initial_words = (divisor_min_bits - 1) / BN_BITS2;
  ------------------
  |  |   42|     10|#define BN_BITS2 64
  ------------------
  450|     10|    if (initial_words > numerator->width) {
  ------------------
  |  Branch (450:9): [True: 0, False: 10]
  ------------------
  451|      0|      initial_words = numerator->width;
  452|      0|    }
  453|     10|    OPENSSL_memcpy(r->d, numerator->d + numerator->width - initial_words,
  454|     10|                   initial_words * sizeof(BN_ULONG));
  455|     10|  }
  456|       |
  457|    134|  for (int i = numerator->width - initial_words - 1; i >= 0; i--) {
  ------------------
  |  Branch (457:54): [True: 124, False: 10]
  ------------------
  458|  8.06k|    for (int bit = BN_BITS2 - 1; bit >= 0; bit--) {
  ------------------
  |  |   42|    124|#define BN_BITS2 64
  ------------------
  |  Branch (458:34): [True: 7.93k, False: 124]
  ------------------
  459|       |      // Incorporate the next bit of the numerator, by computing
  460|       |      // r = 2*r or 2*r + 1. Note the result fits in one more word. We store the
  461|       |      // extra word in |carry|.
  462|  7.93k|      BN_ULONG carry = bn_add_words(r->d, r->d, r->d, divisor->width);
  463|  7.93k|      r->d[0] |= (numerator->d[i] >> bit) & 1;
  464|       |      // |r| was previously fully-reduced, so we know:
  465|       |      //      2*0 <= r <= 2*(divisor-1) + 1
  466|       |      //        0 <= r <= 2*divisor - 1 < 2*divisor.
  467|       |      // Thus |r| satisfies the preconditions for |bn_reduce_once_in_place|.
  468|  7.93k|      BN_ULONG subtracted = bn_reduce_once_in_place(r->d, carry, divisor->d,
  469|  7.93k|                                                    tmp->d, divisor->width);
  470|       |      // The corresponding bit of the quotient is set iff we needed to subtract.
  471|  7.93k|      q->d[i] |= (~subtracted & 1) << bit;
  472|  7.93k|    }
  473|    124|  }
  474|       |
  475|     10|  if ((quotient != NULL && !BN_copy(quotient, q)) ||
  ------------------
  |  Branch (475:8): [True: 0, False: 10]
  |  Branch (475:28): [True: 0, False: 0]
  ------------------
  476|     10|      (remainder != NULL && !BN_copy(remainder, r))) {
  ------------------
  |  Branch (476:8): [True: 10, False: 0]
  |  Branch (476:29): [True: 0, False: 10]
  ------------------
  477|      0|    return 0;
  478|      0|  }
  479|       |
  480|     10|  return 1;
  481|     10|}

BN_MONT_CTX_free:
   51|   105k|void BN_MONT_CTX_free(BN_MONT_CTX *mont) {
   52|   105k|  if (mont == nullptr) {
  ------------------
  |  Branch (52:7): [True: 105k, False: 0]
  ------------------
   53|   105k|    return;
   54|   105k|  }
   55|      0|  bn_mont_ctx_cleanup(mont);
   56|      0|  OPENSSL_free(mont);
   57|      0|}

bn_mul_consttime:
  205|     10|int bn_mul_consttime(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) {
  206|       |  // Prevent negative zeros.
  207|     10|  if (a->neg || b->neg) {
  ------------------
  |  Branch (207:7): [True: 0, False: 10]
  |  Branch (207:17): [True: 0, False: 10]
  ------------------
  208|      0|    OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  209|      0|    return 0;
  210|      0|  }
  211|       |
  212|     10|  return bn_mul_impl(r, a, b, ctx);
  213|     10|}
bcm.cc:_ZL11bn_mul_implP9bignum_stPKS_S2_P10bignum_ctx:
  148|     10|                       BN_CTX *ctx) {
  149|     10|  int al = a->width;
  150|     10|  int bl = b->width;
  151|     10|  if (al == 0 || bl == 0) {
  ------------------
  |  Branch (151:7): [True: 0, False: 10]
  |  Branch (151:18): [True: 0, False: 10]
  ------------------
  152|      0|    BN_zero(r);
  153|      0|    return 1;
  154|      0|  }
  155|       |
  156|     10|  int i, top;
  157|     10|  BIGNUM *rr;
  158|     10|  bssl::BN_CTXScope scope(ctx);
  159|     10|  if (r == a || r == b) {
  ------------------
  |  Branch (159:7): [True: 0, False: 10]
  |  Branch (159:17): [True: 0, False: 10]
  ------------------
  160|      0|    rr = BN_CTX_get(ctx);
  161|      0|    if (rr == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 0]
  ------------------
  162|      0|      return 0;
  163|      0|    }
  164|     10|  } else {
  165|     10|    rr = r;
  166|     10|  }
  167|     10|  rr->neg = a->neg ^ b->neg;
  168|       |
  169|     10|  i = al - bl;
  170|     10|  if (i == 0) {
  ------------------
  |  Branch (170:7): [True: 2, False: 8]
  ------------------
  171|      2|    if (al == 8) {
  ------------------
  |  Branch (171:9): [True: 0, False: 2]
  ------------------
  172|      0|      if (!bn_wexpand(rr, 16)) {
  ------------------
  |  Branch (172:11): [True: 0, False: 0]
  ------------------
  173|      0|        return 0;
  174|      0|      }
  175|      0|      rr->width = 16;
  176|      0|      bn_mul_comba8(rr->d, a->d, b->d);
  177|      0|      goto end;
  178|      0|    }
  179|      2|  }
  180|       |
  181|     10|  top = al + bl;
  182|     10|  if (!bn_wexpand(rr, top)) {
  ------------------
  |  Branch (182:7): [True: 0, False: 10]
  ------------------
  183|      0|    return 0;
  184|      0|  }
  185|     10|  rr->width = top;
  186|     10|  bn_mul_normal(rr->d, a->d, al, b->d, bl);
  187|       |
  188|     10|end:
  189|     10|  if (r != rr && !BN_copy(r, rr)) {
  ------------------
  |  Branch (189:7): [True: 0, False: 10]
  |  Branch (189:18): [True: 0, False: 0]
  ------------------
  190|      0|    return 0;
  191|      0|  }
  192|     10|  return 1;
  193|     10|}
bcm.cc:_ZL13bn_mul_normalPmPKmmS1_m:
   29|     10|                          const BN_ULONG *b, size_t nb) {
   30|     10|  if (na < nb) {
  ------------------
  |  Branch (30:7): [True: 4, False: 6]
  ------------------
   31|      4|    size_t itmp = na;
   32|      4|    na = nb;
   33|      4|    nb = itmp;
   34|      4|    const BN_ULONG *ltmp = a;
   35|      4|    a = b;
   36|      4|    b = ltmp;
   37|      4|  }
   38|     10|  BN_ULONG *rr = &(r[na]);
   39|     10|  if (nb == 0) {
  ------------------
  |  Branch (39:7): [True: 0, False: 10]
  ------------------
   40|      0|    OPENSSL_memset(r, 0, na * sizeof(BN_ULONG));
   41|      0|    return;
   42|      0|  }
   43|     10|  rr[0] = bn_mul_words(r, a, na, b[0]);
   44|       |
   45|     24|  for (;;) {
   46|     24|    if (--nb == 0) {
  ------------------
  |  Branch (46:9): [True: 8, False: 16]
  ------------------
   47|      8|      return;
   48|      8|    }
   49|     16|    rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]);
   50|     16|    if (--nb == 0) {
  ------------------
  |  Branch (50:9): [True: 0, False: 16]
  ------------------
   51|      0|      return;
   52|      0|    }
   53|     16|    rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]);
   54|     16|    if (--nb == 0) {
  ------------------
  |  Branch (54:9): [True: 0, False: 16]
  ------------------
   55|      0|      return;
   56|      0|    }
   57|     16|    rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]);
   58|     16|    if (--nb == 0) {
  ------------------
  |  Branch (58:9): [True: 2, False: 14]
  ------------------
   59|      2|      return;
   60|      2|    }
   61|     14|    rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
   62|     14|    rr += 4;
   63|     14|    r += 4;
   64|     14|    b += 4;
   65|     14|  }
   66|     10|}

EVP_AEAD_CTX_zero:
   36|  14.6k|void EVP_AEAD_CTX_zero(EVP_AEAD_CTX *ctx) {
   37|  14.6k|  OPENSSL_memset(ctx, 0, sizeof(EVP_AEAD_CTX));
   38|  14.6k|}
EVP_AEAD_CTX_cleanup:
  103|  14.6k|void EVP_AEAD_CTX_cleanup(EVP_AEAD_CTX *ctx) {
  104|  14.6k|  if (ctx->aead == NULL) {
  ------------------
  |  Branch (104:7): [True: 14.6k, False: 0]
  ------------------
  105|  14.6k|    return;
  106|  14.6k|  }
  107|      0|  ctx->aead->cleanup(ctx);
  108|      0|  ctx->aead = NULL;
  109|      0|}

EVP_has_aes_hardware:
 1227|  30.9k|int EVP_has_aes_hardware(void) {
 1228|  30.9k|#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
 1229|  30.9k|  return hwaes_capable() && crypto_gcm_clmul_enabled();
  ------------------
  |  Branch (1229:10): [True: 30.9k, False: 0]
  |  Branch (1229:29): [True: 30.9k, False: 0]
  ------------------
 1230|       |#elif defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
 1231|       |  return hwaes_capable() && CRYPTO_is_ARMv8_PMULL_capable();
 1232|       |#else
 1233|       |  return 0;
 1234|       |#endif
 1235|  30.9k|}

BN_value_one:
   66|      4|  accessor_decorations type *name(void) {                                     \
   67|      4|    CRYPTO_once(name##_once_bss_get(), name##_init);                          \
   68|      4|    /* See http://c-faq.com/ansi/constmismatch.html for why the following     \
   69|      4|     * cast is needed. */                                                     \
   70|      4|    return (const type *)name##_storage_bss_get();                            \
   71|      4|  }                                                                           \
RSA_default_method:
   66|  35.2k|  accessor_decorations type *name(void) {                                     \
   67|  35.2k|    CRYPTO_once(name##_once_bss_get(), name##_init);                          \
   68|  35.2k|    /* See http://c-faq.com/ansi/constmismatch.html for why the following     \
   69|  35.2k|     * cast is needed. */                                                     \
   70|  35.2k|    return (const type *)name##_storage_bss_get();                            \
   71|  35.2k|  }                                                                           \
bcm.cc:_ZL25BN_value_one_once_bss_getv:
   52|      4|  static CRYPTO_once_t *name##_bss_get(void) { return &name; }
bcm.cc:_ZL17BN_value_one_initv:
   65|      2|  static void name##_init(void) { name##_do_init(name##_storage_bss_get()); } \
bcm.cc:_ZL28BN_value_one_storage_bss_getv:
   49|      6|  static type *name##_bss_get(void) { return &name; }
bcm.cc:_ZL27g_rsa_ex_data_class_bss_getv:
   58|  35.2k|  static CRYPTO_EX_DATA_CLASS *name##_bss_get(void) { return &name; }
bcm.cc:_ZL31RSA_default_method_once_bss_getv:
   52|  35.2k|  static CRYPTO_once_t *name##_bss_get(void) { return &name; }
bcm.cc:_ZL23RSA_default_method_initv:
   65|      2|  static void name##_init(void) { name##_do_init(name##_storage_bss_get()); } \
bcm.cc:_ZL34RSA_default_method_storage_bss_getv:
   49|  35.2k|  static type *name##_bss_get(void) { return &name; }

EVP_MD_CTX_init:
   38|  29.3k|void EVP_MD_CTX_init(EVP_MD_CTX *ctx) {
   39|  29.3k|  ctx->digest = nullptr;
   40|  29.3k|  ctx->pctx = nullptr;
   41|  29.3k|  ctx->pctx_ops = nullptr;
   42|  29.3k|}
EVP_MD_CTX_cleanup:
   57|  14.6k|int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) {
   58|  14.6k|  assert(ctx->pctx == NULL || ctx->pctx_ops != NULL);
   59|  14.6k|  if (ctx->pctx_ops) {
  ------------------
  |  Branch (59:7): [True: 0, False: 14.6k]
  ------------------
   60|      0|    ctx->pctx_ops->free(ctx->pctx);
   61|      0|  }
   62|       |
   63|  14.6k|  EVP_MD_CTX_init(ctx);
   64|       |
   65|  14.6k|  return 1;
   66|  14.6k|}

CTR_DRBG_init:
   50|      1|                  const uint8_t *personalization, size_t personalization_len) {
   51|       |  // Section 10.2.1.3.1
   52|      1|  if (personalization_len > CTR_DRBG_ENTROPY_LEN) {
  ------------------
  |  |   36|      1|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
  |  Branch (52:7): [True: 0, False: 1]
  ------------------
   53|      0|    return 0;
   54|      0|  }
   55|       |
   56|      1|  uint8_t seed_material[CTR_DRBG_ENTROPY_LEN];
   57|      1|  OPENSSL_memcpy(seed_material, entropy, CTR_DRBG_ENTROPY_LEN);
  ------------------
  |  |   36|      1|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
   58|       |
   59|      1|  for (size_t i = 0; i < personalization_len; i++) {
  ------------------
  |  Branch (59:22): [True: 0, False: 1]
  ------------------
   60|      0|    seed_material[i] ^= personalization[i];
   61|      0|  }
   62|       |
   63|       |  // Section 10.2.1.2
   64|       |
   65|       |  // kInitMask is the result of encrypting blocks with big-endian value 1, 2
   66|       |  // and 3 with the all-zero AES-256 key.
   67|      1|  static const uint8_t kInitMask[CTR_DRBG_ENTROPY_LEN] = {
   68|      1|      0x53, 0x0f, 0x8a, 0xfb, 0xc7, 0x45, 0x36, 0xb9, 0xa9, 0x63, 0xb4, 0xf1,
   69|      1|      0xc4, 0xcb, 0x73, 0x8b, 0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e,
   70|      1|      0x07, 0x4e, 0xc5, 0xd3, 0xba, 0xf3, 0x9d, 0x18, 0x72, 0x60, 0x03, 0xca,
   71|      1|      0x37, 0xa6, 0x2a, 0x74, 0xd1, 0xa2, 0xf5, 0x8e, 0x75, 0x06, 0x35, 0x8e,
   72|      1|  };
   73|       |
   74|     49|  for (size_t i = 0; i < sizeof(kInitMask); i++) {
  ------------------
  |  Branch (74:22): [True: 48, False: 1]
  ------------------
   75|     48|    seed_material[i] ^= kInitMask[i];
   76|     48|  }
   77|       |
   78|      1|  drbg->ctr = aes_ctr_set_key(&drbg->ks, NULL, &drbg->block, seed_material, 32);
   79|      1|  OPENSSL_memcpy(drbg->counter, seed_material + 32, 16);
   80|      1|  drbg->reseed_counter = 1;
   81|       |
   82|      1|  return 1;
   83|      1|}
CTR_DRBG_reseed:
  123|      1|                    size_t additional_data_len) {
  124|       |  // Section 10.2.1.4
  125|      1|  uint8_t entropy_copy[CTR_DRBG_ENTROPY_LEN];
  126|       |
  127|      1|  if (additional_data_len > 0) {
  ------------------
  |  Branch (127:7): [True: 0, False: 1]
  ------------------
  128|      0|    if (additional_data_len > CTR_DRBG_ENTROPY_LEN) {
  ------------------
  |  |   36|      0|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
  |  Branch (128:9): [True: 0, False: 0]
  ------------------
  129|      0|      return 0;
  130|      0|    }
  131|       |
  132|      0|    OPENSSL_memcpy(entropy_copy, entropy, CTR_DRBG_ENTROPY_LEN);
  ------------------
  |  |   36|      0|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
  133|      0|    for (size_t i = 0; i < additional_data_len; i++) {
  ------------------
  |  Branch (133:24): [True: 0, False: 0]
  ------------------
  134|      0|      entropy_copy[i] ^= additional_data[i];
  135|      0|    }
  136|       |
  137|      0|    entropy = entropy_copy;
  138|      0|  }
  139|       |
  140|      1|  if (!ctr_drbg_update(drbg, entropy, CTR_DRBG_ENTROPY_LEN)) {
  ------------------
  |  |   36|      1|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
  |  Branch (140:7): [True: 0, False: 1]
  ------------------
  141|      0|    return 0;
  142|      0|  }
  143|       |
  144|      1|  drbg->reseed_counter = 1;
  145|       |
  146|      1|  return 1;
  147|      1|}
CTR_DRBG_generate:
  151|  4.88k|                      size_t additional_data_len) {
  152|       |  // See 9.3.1
  153|  4.88k|  if (out_len > CTR_DRBG_MAX_GENERATE_LENGTH) {
  ------------------
  |  |   40|  4.88k|#define CTR_DRBG_MAX_GENERATE_LENGTH 65536
  ------------------
  |  Branch (153:7): [True: 0, False: 4.88k]
  ------------------
  154|      0|    return 0;
  155|      0|  }
  156|       |
  157|       |  // See 10.2.1.5.1
  158|  4.88k|  if (drbg->reseed_counter > kMaxReseedCount) {
  ------------------
  |  Branch (158:7): [True: 0, False: 4.88k]
  ------------------
  159|      0|    return 0;
  160|      0|  }
  161|       |
  162|  4.88k|  if (additional_data_len != 0 &&
  ------------------
  |  Branch (162:7): [True: 4.88k, False: 0]
  ------------------
  163|  4.88k|      !ctr_drbg_update(drbg, additional_data, additional_data_len)) {
  ------------------
  |  Branch (163:7): [True: 0, False: 4.88k]
  ------------------
  164|      0|    return 0;
  165|      0|  }
  166|       |
  167|       |  // kChunkSize is used to interact better with the cache. Since the AES-CTR
  168|       |  // code assumes that it's encrypting rather than just writing keystream, the
  169|       |  // buffer has to be zeroed first. Without chunking, large reads would zero
  170|       |  // the whole buffer, flushing the L1 cache, and then do another pass (missing
  171|       |  // the cache every time) to “encrypt” it. The code can avoid this by
  172|       |  // chunking.
  173|  4.88k|  static const size_t kChunkSize = 8 * 1024;
  174|       |
  175|  4.88k|  while (out_len >= AES_BLOCK_SIZE) {
  ------------------
  |  |   34|  4.88k|#define AES_BLOCK_SIZE 16
  ------------------
  |  Branch (175:10): [True: 0, False: 4.88k]
  ------------------
  176|      0|    size_t todo = kChunkSize;
  177|      0|    if (todo > out_len) {
  ------------------
  |  Branch (177:9): [True: 0, False: 0]
  ------------------
  178|      0|      todo = out_len;
  179|      0|    }
  180|       |
  181|      0|    todo &= ~(AES_BLOCK_SIZE - 1);
  ------------------
  |  |   34|      0|#define AES_BLOCK_SIZE 16
  ------------------
  182|      0|    const size_t num_blocks = todo / AES_BLOCK_SIZE;
  ------------------
  |  |   34|      0|#define AES_BLOCK_SIZE 16
  ------------------
  183|       |
  184|      0|    OPENSSL_memset(out, 0, todo);
  185|      0|    ctr32_add(drbg, 1);
  186|      0|    drbg->ctr(out, out, num_blocks, &drbg->ks, drbg->counter);
  187|      0|    ctr32_add(drbg, (uint32_t)(num_blocks - 1));
  188|       |
  189|      0|    out += todo;
  190|      0|    out_len -= todo;
  191|      0|  }
  192|       |
  193|  4.88k|  if (out_len > 0) {
  ------------------
  |  Branch (193:7): [True: 4.88k, False: 0]
  ------------------
  194|  4.88k|    uint8_t block[AES_BLOCK_SIZE];
  195|  4.88k|    ctr32_add(drbg, 1);
  196|  4.88k|    drbg->block(drbg->counter, block, &drbg->ks);
  197|       |
  198|  4.88k|    OPENSSL_memcpy(out, block, out_len);
  199|  4.88k|  }
  200|       |
  201|       |  // Right-padding |additional_data| in step 2.2 is handled implicitly by
  202|       |  // |ctr_drbg_update|, to save a copy.
  203|  4.88k|  if (!ctr_drbg_update(drbg, additional_data, additional_data_len)) {
  ------------------
  |  Branch (203:7): [True: 0, False: 4.88k]
  ------------------
  204|      0|    return 0;
  205|      0|  }
  206|       |
  207|  4.88k|  drbg->reseed_counter++;
  208|  4.88k|  FIPS_service_indicator_update_state();
  209|  4.88k|  return 1;
  210|  4.88k|}
bcm.cc:_ZL15ctr_drbg_updateP17ctr_drbg_state_stPKhm:
   96|  9.77k|                           size_t data_len) {
   97|       |  // Per section 10.2.1.2, |data_len| must be |CTR_DRBG_ENTROPY_LEN|. Here, we
   98|       |  // allow shorter inputs and right-pad them with zeros. This is equivalent to
   99|       |  // the specified algorithm but saves a copy in |CTR_DRBG_generate|.
  100|  9.77k|  if (data_len > CTR_DRBG_ENTROPY_LEN) {
  ------------------
  |  |   36|  9.77k|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
  |  Branch (100:7): [True: 0, False: 9.77k]
  ------------------
  101|      0|    return 0;
  102|      0|  }
  103|       |
  104|  9.77k|  uint8_t temp[CTR_DRBG_ENTROPY_LEN];
  105|  39.0k|  for (size_t i = 0; i < CTR_DRBG_ENTROPY_LEN; i += AES_BLOCK_SIZE) {
  ------------------
  |  |   36|  39.0k|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
                for (size_t i = 0; i < CTR_DRBG_ENTROPY_LEN; i += AES_BLOCK_SIZE) {
  ------------------
  |  |   34|  29.3k|#define AES_BLOCK_SIZE 16
  ------------------
  |  Branch (105:22): [True: 29.3k, False: 9.77k]
  ------------------
  106|  29.3k|    ctr32_add(drbg, 1);
  107|  29.3k|    drbg->block(drbg->counter, temp + i, &drbg->ks);
  108|  29.3k|  }
  109|       |
  110|   322k|  for (size_t i = 0; i < data_len; i++) {
  ------------------
  |  Branch (110:22): [True: 312k, False: 9.77k]
  ------------------
  111|   312k|    temp[i] ^= data[i];
  112|   312k|  }
  113|       |
  114|  9.77k|  drbg->ctr = aes_ctr_set_key(&drbg->ks, NULL, &drbg->block, temp, 32);
  115|  9.77k|  OPENSSL_memcpy(drbg->counter, temp + 32, 16);
  116|       |
  117|  9.77k|  return 1;
  118|  9.77k|}
bcm.cc:_ZL9ctr32_addP17ctr_drbg_state_stj:
   90|  34.1k|static void ctr32_add(CTR_DRBG_STATE *drbg, uint32_t n) {
   91|  34.1k|  uint32_t ctr = CRYPTO_load_u32_be(drbg->counter + 12);
   92|  34.1k|  CRYPTO_store_u32_be(drbg->counter + 12, ctr + n);
   93|  34.1k|}

have_fast_rdrand:
   58|  4.88k|inline int have_fast_rdrand(void) {
   59|  4.88k|  return CRYPTO_is_RDRAND_capable() && CRYPTO_is_intel_cpu();
  ------------------
  |  Branch (59:10): [True: 4.88k, False: 0]
  |  Branch (59:40): [True: 0, False: 4.88k]
  ------------------
   60|  4.88k|}

BCM_rand_bytes_with_additional_data:
  333|  4.88k|    uint8_t *out, size_t out_len, const uint8_t user_additional_data[32]) {
  334|  4.88k|  if (out_len == 0) {
  ------------------
  |  Branch (334:7): [True: 0, False: 4.88k]
  ------------------
  335|      0|    return bcm_infallible::approved;
  336|      0|  }
  337|       |
  338|  4.88k|  const uint64_t fork_generation = CRYPTO_get_fork_generation();
  339|  4.88k|  const int fork_unsafe_buffering = rand_fork_unsafe_buffering_enabled();
  340|       |
  341|       |  // Additional data is mixed into every CTR-DRBG call to protect, as best we
  342|       |  // can, against forks & VM clones. We do not over-read this information and
  343|       |  // don't reseed with it so, from the point of view of FIPS, this doesn't
  344|       |  // provide “prediction resistance”. But, in practice, it does.
  345|  4.88k|  uint8_t additional_data[32];
  346|       |  // Intel chips have fast RDRAND instructions while, in other cases, RDRAND can
  347|       |  // be _slower_ than a system call.
  348|  4.88k|  if (!have_fast_rdrand() ||
  ------------------
  |  Branch (348:7): [True: 4.88k, False: 0]
  ------------------
  349|  4.88k|      !rdrand(additional_data, sizeof(additional_data))) {
  ------------------
  |  Branch (349:7): [True: 0, False: 0]
  ------------------
  350|       |    // Without a hardware RNG to save us from address-space duplication, the OS
  351|       |    // entropy is used. This can be expensive (one read per |RAND_bytes| call)
  352|       |    // and so is disabled when we have fork detection, or if the application has
  353|       |    // promised not to fork.
  354|  4.88k|    if (fork_generation != 0 || fork_unsafe_buffering) {
  ------------------
  |  Branch (354:9): [True: 4.88k, False: 0]
  |  Branch (354:33): [True: 0, False: 0]
  ------------------
  355|  4.88k|      OPENSSL_memset(additional_data, 0, sizeof(additional_data));
  356|  4.88k|    } else if (!have_rdrand()) {
  ------------------
  |  Branch (356:16): [True: 0, False: 0]
  ------------------
  357|       |      // No alternative so block for OS entropy.
  358|      0|      CRYPTO_sysrand(additional_data, sizeof(additional_data));
  359|      0|    } else if (!CRYPTO_sysrand_if_available(additional_data,
  ------------------
  |  Branch (359:16): [True: 0, False: 0]
  ------------------
  360|      0|                                            sizeof(additional_data)) &&
  361|      0|               !rdrand(additional_data, sizeof(additional_data))) {
  ------------------
  |  Branch (361:16): [True: 0, False: 0]
  ------------------
  362|       |      // RDRAND failed: block for OS entropy.
  363|      0|      CRYPTO_sysrand(additional_data, sizeof(additional_data));
  364|      0|    }
  365|  4.88k|  }
  366|       |
  367|   161k|  for (size_t i = 0; i < sizeof(additional_data); i++) {
  ------------------
  |  Branch (367:22): [True: 156k, False: 4.88k]
  ------------------
  368|   156k|    additional_data[i] ^= user_additional_data[i];
  369|   156k|  }
  370|       |
  371|  4.88k|  struct rand_thread_state stack_state;
  372|  4.88k|  struct rand_thread_state *state = reinterpret_cast<rand_thread_state *>(
  373|  4.88k|      CRYPTO_get_thread_local(OPENSSL_THREAD_LOCAL_RAND));
  374|       |
  375|  4.88k|  if (state == NULL) {
  ------------------
  |  Branch (375:7): [True: 1, False: 4.88k]
  ------------------
  376|      1|    state = reinterpret_cast<rand_thread_state *>(
  377|      1|        OPENSSL_zalloc(sizeof(struct rand_thread_state)));
  378|      1|    if (state == NULL ||
  ------------------
  |  Branch (378:9): [True: 0, False: 1]
  ------------------
  379|      1|        !CRYPTO_set_thread_local(OPENSSL_THREAD_LOCAL_RAND, state,
  ------------------
  |  Branch (379:9): [True: 0, False: 1]
  ------------------
  380|      1|                                 rand_thread_state_free)) {
  381|       |      // If the system is out of memory, use an ephemeral state on the
  382|       |      // stack.
  383|      0|      state = &stack_state;
  384|      0|    }
  385|       |
  386|      1|    state->last_block_valid = 0;
  387|      1|    uint8_t seed[CTR_DRBG_ENTROPY_LEN];
  388|      1|    uint8_t personalization[CTR_DRBG_ENTROPY_LEN] = {0};
  389|      1|    size_t personalization_len = 0;
  390|      1|    rand_get_seed(state, seed, personalization, &personalization_len);
  391|       |
  392|      1|    if (!CTR_DRBG_init(&state->drbg, seed, personalization,
  ------------------
  |  Branch (392:9): [True: 0, False: 1]
  ------------------
  393|      1|                       personalization_len)) {
  394|      0|      abort();
  395|      0|    }
  396|      1|    state->calls = 0;
  397|      1|    state->fork_generation = fork_generation;
  398|      1|    state->fork_unsafe_buffering = fork_unsafe_buffering;
  399|       |
  400|       |#if defined(BORINGSSL_FIPS)
  401|       |    CRYPTO_MUTEX_init(&state->clear_drbg_lock);
  402|       |    if (state != &stack_state) {
  403|       |      CRYPTO_MUTEX_lock_write(thread_states_list_lock_bss_get());
  404|       |      struct rand_thread_state **states_list = thread_states_list_bss_get();
  405|       |      state->next = *states_list;
  406|       |      if (state->next != NULL) {
  407|       |        state->next->prev = state;
  408|       |      }
  409|       |      state->prev = NULL;
  410|       |      *states_list = state;
  411|       |      CRYPTO_MUTEX_unlock_write(thread_states_list_lock_bss_get());
  412|       |    }
  413|       |#endif
  414|      1|  }
  415|       |
  416|  4.88k|  if (state->calls >= kReseedInterval ||
  ------------------
  |  Branch (416:7): [True: 1, False: 4.88k]
  ------------------
  417|       |      // If we've forked since |state| was last seeded, reseed.
  418|  4.88k|      state->fork_generation != fork_generation ||
  ------------------
  |  Branch (418:7): [True: 0, False: 4.88k]
  ------------------
  419|       |      // If |state| was seeded from a state with different fork-safety
  420|       |      // preferences, reseed. Suppose |state| was fork-safe, then forked into
  421|       |      // two children, but each of the children never fork and disable fork
  422|       |      // safety. The children must reseed to avoid working from the same PRNG
  423|       |      // state.
  424|  4.88k|      state->fork_unsafe_buffering != fork_unsafe_buffering) {
  ------------------
  |  Branch (424:7): [True: 0, False: 4.88k]
  ------------------
  425|      1|    uint8_t seed[CTR_DRBG_ENTROPY_LEN];
  426|      1|    uint8_t reseed_additional_data[CTR_DRBG_ENTROPY_LEN] = {0};
  427|      1|    size_t reseed_additional_data_len = 0;
  428|      1|    rand_get_seed(state, seed, reseed_additional_data,
  429|      1|                  &reseed_additional_data_len);
  430|       |#if defined(BORINGSSL_FIPS)
  431|       |    // Take a read lock around accesses to |state->drbg|. This is needed to
  432|       |    // avoid returning bad entropy if we race with
  433|       |    // |rand_thread_state_clear_all|.
  434|       |    CRYPTO_MUTEX_lock_read(&state->clear_drbg_lock);
  435|       |#endif
  436|      1|    if (!CTR_DRBG_reseed(&state->drbg, seed, reseed_additional_data,
  ------------------
  |  Branch (436:9): [True: 0, False: 1]
  ------------------
  437|      1|                         reseed_additional_data_len)) {
  438|      0|      abort();
  439|      0|    }
  440|      1|    state->calls = 0;
  441|      1|    state->fork_generation = fork_generation;
  442|      1|    state->fork_unsafe_buffering = fork_unsafe_buffering;
  443|  4.88k|  } else {
  444|       |#if defined(BORINGSSL_FIPS)
  445|       |    CRYPTO_MUTEX_lock_read(&state->clear_drbg_lock);
  446|       |#endif
  447|  4.88k|  }
  448|       |
  449|  4.88k|  int first_call = 1;
  450|  9.77k|  while (out_len > 0) {
  ------------------
  |  Branch (450:10): [True: 4.88k, False: 4.88k]
  ------------------
  451|  4.88k|    size_t todo = out_len;
  452|  4.88k|    if (todo > CTR_DRBG_MAX_GENERATE_LENGTH) {
  ------------------
  |  |   40|  4.88k|#define CTR_DRBG_MAX_GENERATE_LENGTH 65536
  ------------------
  |  Branch (452:9): [True: 0, False: 4.88k]
  ------------------
  453|      0|      todo = CTR_DRBG_MAX_GENERATE_LENGTH;
  ------------------
  |  |   40|      0|#define CTR_DRBG_MAX_GENERATE_LENGTH 65536
  ------------------
  454|      0|    }
  455|       |
  456|  4.88k|    if (!CTR_DRBG_generate(&state->drbg, out, todo, additional_data,
  ------------------
  |  Branch (456:9): [True: 0, False: 4.88k]
  ------------------
  457|  4.88k|                           first_call ? sizeof(additional_data) : 0)) {
  ------------------
  |  Branch (457:28): [True: 4.88k, False: 0]
  ------------------
  458|      0|      abort();
  459|      0|    }
  460|       |
  461|  4.88k|    out += todo;
  462|  4.88k|    out_len -= todo;
  463|       |    // Though we only check before entering the loop, this cannot add enough to
  464|       |    // overflow a |size_t|.
  465|  4.88k|    state->calls++;
  466|  4.88k|    first_call = 0;
  467|  4.88k|  }
  468|       |
  469|  4.88k|  if (state == &stack_state) {
  ------------------
  |  Branch (469:7): [True: 0, False: 4.88k]
  ------------------
  470|      0|    CTR_DRBG_clear(&state->drbg);
  471|      0|  }
  472|       |
  473|       |#if defined(BORINGSSL_FIPS)
  474|       |  CRYPTO_MUTEX_unlock_read(&state->clear_drbg_lock);
  475|       |#endif
  476|  4.88k|  return bcm_infallible::approved;
  477|  4.88k|}
BCM_rand_bytes:
  479|  4.88k|bcm_infallible BCM_rand_bytes(uint8_t *out, size_t out_len) {
  480|  4.88k|  static const uint8_t kZeroAdditionalData[32] = {0};
  481|  4.88k|  BCM_rand_bytes_with_additional_data(out, out_len, kZeroAdditionalData);
  482|  4.88k|  return bcm_infallible::approved;
  483|  4.88k|}
bcm.cc:_ZL13rand_get_seedPN12_GLOBAL__N_117rand_thread_stateEPhS2_Pm:
  323|      2|                          size_t *out_additional_input_len) {
  324|       |  // If not in FIPS mode, we don't overread from the system entropy source and
  325|       |  // we don't depend only on the hardware RDRAND.
  326|      2|  CRYPTO_sysrand_for_seed(seed, CTR_DRBG_ENTROPY_LEN);
  ------------------
  |  |   36|      2|#define CTR_DRBG_ENTROPY_LEN 48
  ------------------
  327|      2|  *out_additional_input_len = 0;
  328|      2|}

RSA_new:
  163|  35.2k|RSA *RSA_new(void) { return RSA_new_method(NULL); }
RSA_new_method:
  165|  35.2k|RSA *RSA_new_method(const ENGINE *engine) {
  166|  35.2k|  RSA *rsa = reinterpret_cast<RSA *>(OPENSSL_zalloc(sizeof(RSA)));
  167|  35.2k|  if (rsa == NULL) {
  ------------------
  |  Branch (167:7): [True: 0, False: 35.2k]
  ------------------
  168|      0|    return NULL;
  169|      0|  }
  170|       |
  171|  35.2k|  if (engine) {
  ------------------
  |  Branch (171:7): [True: 0, False: 35.2k]
  ------------------
  172|      0|    rsa->meth = ENGINE_get_RSA_method(engine);
  173|      0|  }
  174|       |
  175|  35.2k|  if (rsa->meth == NULL) {
  ------------------
  |  Branch (175:7): [True: 35.2k, False: 0]
  ------------------
  176|  35.2k|    rsa->meth = (RSA_METHOD *)RSA_default_method();
  177|  35.2k|  }
  178|  35.2k|  METHOD_ref(rsa->meth);
  179|       |
  180|  35.2k|  rsa->references = 1;
  181|  35.2k|  rsa->flags = rsa->meth->flags;
  182|  35.2k|  CRYPTO_MUTEX_init(&rsa->lock);
  183|  35.2k|  CRYPTO_new_ex_data(&rsa->ex_data);
  184|       |
  185|  35.2k|  if (rsa->meth->init && !rsa->meth->init(rsa)) {
  ------------------
  |  Branch (185:7): [True: 0, False: 35.2k]
  |  Branch (185:26): [True: 0, False: 0]
  ------------------
  186|      0|    rsa->meth = nullptr;
  187|      0|    RSA_free(rsa);
  188|      0|    return NULL;
  189|      0|  }
  190|       |
  191|  35.2k|  return rsa;
  192|  35.2k|}
RSA_free:
  204|  70.4k|void RSA_free(RSA *rsa) {
  205|  70.4k|  if (rsa == NULL) {
  ------------------
  |  Branch (205:7): [True: 35.2k, False: 35.2k]
  ------------------
  206|  35.2k|    return;
  207|  35.2k|  }
  208|       |
  209|  35.2k|  if (!CRYPTO_refcount_dec_and_test_zero(&rsa->references)) {
  ------------------
  |  Branch (209:7): [True: 0, False: 35.2k]
  ------------------
  210|      0|    return;
  211|      0|  }
  212|       |
  213|  35.2k|  if (rsa->meth != nullptr && rsa->meth->finish != nullptr) {
  ------------------
  |  Branch (213:7): [True: 35.2k, False: 0]
  |  Branch (213:31): [True: 0, False: 35.2k]
  ------------------
  214|      0|    rsa->meth->finish(rsa);
  215|      0|  }
  216|  35.2k|  METHOD_unref(rsa->meth);
  217|       |
  218|  35.2k|  CRYPTO_free_ex_data(g_rsa_ex_data_class_bss_get(), &rsa->ex_data);
  219|       |
  220|  35.2k|  BN_free(rsa->n);
  221|  35.2k|  BN_free(rsa->e);
  222|  35.2k|  BN_free(rsa->d);
  223|  35.2k|  BN_free(rsa->p);
  224|  35.2k|  BN_free(rsa->q);
  225|  35.2k|  BN_free(rsa->dmp1);
  226|  35.2k|  BN_free(rsa->dmq1);
  227|  35.2k|  BN_free(rsa->iqmp);
  228|  35.2k|  rsa_invalidate_key(rsa);
  229|  35.2k|  CRYPTO_MUTEX_cleanup(&rsa->lock);
  230|  35.2k|  OPENSSL_free(rsa);
  231|  35.2k|}
RSA_get0_n:
  240|  23.6k|const BIGNUM *RSA_get0_n(const RSA *rsa) { return rsa->n; }
RSA_get0_e:
  242|  23.6k|const BIGNUM *RSA_get0_e(const RSA *rsa) { return rsa->e; }
RSA_is_opaque:
  381|  11.8k|int RSA_is_opaque(const RSA *rsa) {
  382|  11.8k|  return rsa->meth && (rsa->meth->flags & RSA_FLAG_OPAQUE);
  ------------------
  |  |  632|  11.8k|#define RSA_FLAG_OPAQUE 1
  ------------------
  |  Branch (382:10): [True: 11.8k, False: 0]
  |  Branch (382:23): [True: 0, False: 11.8k]
  ------------------
  383|  11.8k|}
RSA_check_key:
  729|  35.2k|int RSA_check_key(const RSA *key) {
  730|       |  // TODO(davidben): RSA key initialization is spread across
  731|       |  // |rsa_check_public_key|, |RSA_check_key|, |freeze_private_key|, and
  732|       |  // |BN_MONT_CTX_set_locked| as a result of API issues. See
  733|       |  // https://crbug.com/boringssl/316. As a result, we inconsistently check RSA
  734|       |  // invariants. We should fix this and integrate that logic.
  735|       |
  736|  35.2k|  if (!rsa_check_public_key(key)) {
  ------------------
  |  Branch (736:7): [True: 0, False: 35.2k]
  ------------------
  737|      0|    return 0;
  738|      0|  }
  739|       |
  740|  35.2k|  if ((key->p != NULL) != (key->q != NULL)) {
  ------------------
  |  Branch (740:7): [True: 0, False: 35.2k]
  ------------------
  741|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_ONLY_ONE_OF_P_Q_GIVEN);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  742|      0|    return 0;
  743|      0|  }
  744|       |
  745|       |  // |key->d| must be bounded by |key->n|. This ensures bounds on |RSA_bits|
  746|       |  // translate to bounds on the running time of private key operations.
  747|  35.2k|  if (key->d != NULL &&
  ------------------
  |  Branch (747:7): [True: 2, False: 35.2k]
  ------------------
  748|  35.2k|      (BN_is_negative(key->d) || BN_cmp(key->d, key->n) >= 0)) {
  ------------------
  |  Branch (748:8): [True: 0, False: 2]
  |  Branch (748:34): [True: 0, False: 2]
  ------------------
  749|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_D_OUT_OF_RANGE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  750|      0|    return 0;
  751|      0|  }
  752|       |
  753|  35.2k|  if (key->d == NULL || key->p == NULL) {
  ------------------
  |  Branch (753:7): [True: 35.2k, False: 2]
  |  Branch (753:25): [True: 0, False: 2]
  ------------------
  754|       |    // For a public key, or without p and q, there's nothing that can be
  755|       |    // checked.
  756|  35.2k|    return 1;
  757|  35.2k|  }
  758|       |
  759|      2|  BN_CTX *ctx = BN_CTX_new();
  760|      2|  if (ctx == NULL) {
  ------------------
  |  Branch (760:7): [True: 0, False: 2]
  ------------------
  761|      0|    return 0;
  762|      0|  }
  763|       |
  764|      2|  BIGNUM tmp, de, pm1, qm1, dmp1, dmq1;
  765|      2|  int ok = 0, has_crt_values;
  766|      2|  unsigned pm1_bits, qm1_bits;
  767|      2|  BN_init(&tmp);
  768|      2|  BN_init(&de);
  769|      2|  BN_init(&pm1);
  770|      2|  BN_init(&qm1);
  771|      2|  BN_init(&dmp1);
  772|      2|  BN_init(&dmq1);
  773|       |
  774|       |  // Check that p * q == n. Before we multiply, we check that p and q are in
  775|       |  // bounds, to avoid a DoS vector in |bn_mul_consttime| below. Note that
  776|       |  // n was bound by |rsa_check_public_key|. This also implicitly checks p and q
  777|       |  // are odd, which is a necessary condition for Montgomery reduction.
  778|      2|  if (BN_is_negative(key->p) ||
  ------------------
  |  Branch (778:7): [True: 0, False: 2]
  ------------------
  779|      2|      constant_time_declassify_int(BN_cmp(key->p, key->n) >= 0) ||
  ------------------
  |  Branch (779:7): [True: 0, False: 2]
  ------------------
  780|      2|      BN_is_negative(key->q) ||
  ------------------
  |  Branch (780:7): [True: 0, False: 2]
  ------------------
  781|      2|      constant_time_declassify_int(BN_cmp(key->q, key->n) >= 0)) {
  ------------------
  |  Branch (781:7): [True: 0, False: 2]
  ------------------
  782|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_N_NOT_EQUAL_P_Q);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  783|      0|    goto out;
  784|      0|  }
  785|      2|  if (!bn_mul_consttime(&tmp, key->p, key->q, ctx)) {
  ------------------
  |  Branch (785:7): [True: 0, False: 2]
  ------------------
  786|      0|    OPENSSL_PUT_ERROR(RSA, ERR_LIB_BN);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  787|      0|    goto out;
  788|      0|  }
  789|      2|  if (BN_cmp(&tmp, key->n) != 0) {
  ------------------
  |  Branch (789:7): [True: 0, False: 2]
  ------------------
  790|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_N_NOT_EQUAL_P_Q);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  791|      0|    goto out;
  792|      0|  }
  793|       |
  794|       |  // d must be an inverse of e mod the Carmichael totient, lcm(p-1, q-1), but it
  795|       |  // may be unreduced because other implementations use the Euler totient. We
  796|       |  // simply check that d * e is one mod p-1 and mod q-1. Note d and e were bound
  797|       |  // by earlier checks in this function.
  798|      2|  if (!bn_usub_consttime(&pm1, key->p, BN_value_one()) ||
  ------------------
  |  Branch (798:7): [True: 0, False: 2]
  ------------------
  799|      2|      !bn_usub_consttime(&qm1, key->q, BN_value_one())) {
  ------------------
  |  Branch (799:7): [True: 0, False: 2]
  ------------------
  800|      0|    OPENSSL_PUT_ERROR(RSA, ERR_LIB_BN);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  801|      0|    goto out;
  802|      0|  }
  803|      2|  pm1_bits = BN_num_bits(&pm1);
  804|      2|  qm1_bits = BN_num_bits(&qm1);
  805|      2|  if (!bn_mul_consttime(&de, key->d, key->e, ctx) ||
  ------------------
  |  Branch (805:7): [True: 0, False: 2]
  ------------------
  806|      2|      !bn_div_consttime(NULL, &tmp, &de, &pm1, pm1_bits, ctx) ||
  ------------------
  |  Branch (806:7): [True: 0, False: 2]
  ------------------
  807|      2|      !bn_div_consttime(NULL, &de, &de, &qm1, qm1_bits, ctx)) {
  ------------------
  |  Branch (807:7): [True: 0, False: 2]
  ------------------
  808|      0|    OPENSSL_PUT_ERROR(RSA, ERR_LIB_BN);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  809|      0|    goto out;
  810|      0|  }
  811|       |
  812|      2|  if (constant_time_declassify_int(!BN_is_one(&tmp)) ||
  ------------------
  |  Branch (812:7): [True: 0, False: 2]
  ------------------
  813|      2|      constant_time_declassify_int(!BN_is_one(&de))) {
  ------------------
  |  Branch (813:7): [True: 0, False: 2]
  ------------------
  814|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_D_E_NOT_CONGRUENT_TO_1);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  815|      0|    goto out;
  816|      0|  }
  817|       |
  818|      2|  has_crt_values = key->dmp1 != NULL;
  819|      2|  if (has_crt_values != (key->dmq1 != NULL) ||
  ------------------
  |  Branch (819:7): [True: 0, False: 2]
  ------------------
  820|      2|      has_crt_values != (key->iqmp != NULL)) {
  ------------------
  |  Branch (820:7): [True: 0, False: 2]
  ------------------
  821|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_INCONSISTENT_SET_OF_CRT_VALUES);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  822|      0|    goto out;
  823|      0|  }
  824|       |
  825|      2|  if (has_crt_values) {
  ------------------
  |  Branch (825:7): [True: 2, False: 0]
  ------------------
  826|      2|    int dmp1_ok, dmq1_ok, iqmp_ok;
  827|      2|    if (!check_mod_inverse(&dmp1_ok, key->e, key->dmp1, &pm1, pm1_bits, ctx) ||
  ------------------
  |  Branch (827:9): [True: 0, False: 2]
  ------------------
  828|      2|        !check_mod_inverse(&dmq1_ok, key->e, key->dmq1, &qm1, qm1_bits, ctx) ||
  ------------------
  |  Branch (828:9): [True: 0, False: 2]
  ------------------
  829|       |        // |p| is odd, so |pm1| and |p| have the same bit width. If they didn't,
  830|       |        // we only need a lower bound anyway.
  831|      2|        !check_mod_inverse(&iqmp_ok, key->q, key->iqmp, key->p, pm1_bits,
  ------------------
  |  Branch (831:9): [True: 0, False: 2]
  ------------------
  832|      2|                           ctx)) {
  833|      0|      OPENSSL_PUT_ERROR(RSA, ERR_LIB_BN);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  834|      0|      goto out;
  835|      0|    }
  836|       |
  837|      2|    if (!dmp1_ok || !dmq1_ok || !iqmp_ok) {
  ------------------
  |  Branch (837:9): [True: 0, False: 2]
  |  Branch (837:21): [True: 0, False: 2]
  |  Branch (837:33): [True: 0, False: 2]
  ------------------
  838|      0|      OPENSSL_PUT_ERROR(RSA, RSA_R_CRT_VALUES_INCORRECT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  839|      0|      goto out;
  840|      0|    }
  841|      2|  }
  842|       |
  843|      2|  ok = 1;
  844|       |
  845|      2|out:
  846|      2|  BN_free(&tmp);
  847|      2|  BN_free(&de);
  848|      2|  BN_free(&pm1);
  849|      2|  BN_free(&qm1);
  850|      2|  BN_free(&dmp1);
  851|      2|  BN_free(&dmq1);
  852|      2|  BN_CTX_free(ctx);
  853|       |
  854|      2|  return ok;
  855|      2|}
bcm.cc:_ZL17check_mod_inversePiPK9bignum_stS2_S2_jP10bignum_ctx:
  708|      6|                             BN_CTX *ctx) {
  709|      6|  if (BN_is_negative(ainv) ||
  ------------------
  |  Branch (709:7): [True: 0, False: 6]
  ------------------
  710|      6|      constant_time_declassify_int(BN_cmp(ainv, m) >= 0)) {
  ------------------
  |  Branch (710:7): [True: 0, False: 6]
  ------------------
  711|      0|    *out_ok = 0;
  712|      0|    return 1;
  713|      0|  }
  714|       |
  715|       |  // Note |bn_mul_consttime| and |bn_div_consttime| do not scale linearly, but
  716|       |  // checking |ainv| is in range bounds the running time, assuming |m|'s bounds
  717|       |  // were checked by the caller.
  718|      6|  bssl::BN_CTXScope scope(ctx);
  719|      6|  BIGNUM *tmp = BN_CTX_get(ctx);
  720|      6|  if (tmp == nullptr ||  //
  ------------------
  |  Branch (720:7): [True: 0, False: 6]
  ------------------
  721|      6|      !bn_mul_consttime(tmp, a, ainv, ctx) ||
  ------------------
  |  Branch (721:7): [True: 0, False: 6]
  ------------------
  722|      6|      !bn_div_consttime(NULL, tmp, tmp, m, m_min_bits, ctx)) {
  ------------------
  |  Branch (722:7): [True: 0, False: 6]
  ------------------
  723|      0|    return 0;
  724|      0|  }
  725|      6|  *out_ok = constant_time_declassify_int(BN_is_one(tmp));
  726|      6|  return 1;
  727|      6|}

rsa_check_public_key:
   37|  35.2k|int rsa_check_public_key(const RSA *rsa) {
   38|  35.2k|  if (rsa->n == NULL) {
  ------------------
  |  Branch (38:7): [True: 0, False: 35.2k]
  ------------------
   39|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_VALUE_MISSING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   40|      0|    return 0;
   41|      0|  }
   42|       |
   43|  35.2k|  unsigned n_bits = BN_num_bits(rsa->n);
   44|  35.2k|  if (n_bits > OPENSSL_RSA_MAX_MODULUS_BITS) {
  ------------------
  |  |   74|  35.2k|#define OPENSSL_RSA_MAX_MODULUS_BITS 16384
  ------------------
  |  Branch (44:7): [True: 0, False: 35.2k]
  ------------------
   45|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_MODULUS_TOO_LARGE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   46|      0|    return 0;
   47|      0|  }
   48|       |
   49|       |  // TODO(crbug.com/boringssl/607): Raise this limit. 512-bit RSA was factored
   50|       |  // in 1999.
   51|  35.2k|  if (n_bits < 512) {
  ------------------
  |  Branch (51:7): [True: 0, False: 35.2k]
  ------------------
   52|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_KEY_SIZE_TOO_SMALL);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   53|      0|    return 0;
   54|      0|  }
   55|       |
   56|       |  // RSA moduli must be positive and odd. In addition to being necessary for RSA
   57|       |  // in general, we cannot setup Montgomery reduction with even moduli.
   58|  35.2k|  if (!BN_is_odd(rsa->n) || BN_is_negative(rsa->n)) {
  ------------------
  |  Branch (58:7): [True: 0, False: 35.2k]
  |  Branch (58:29): [True: 0, False: 35.2k]
  ------------------
   59|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_RSA_PARAMETERS);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   60|      0|    return 0;
   61|      0|  }
   62|       |
   63|  35.2k|  static const unsigned kMaxExponentBits = 33;
   64|  35.2k|  if (rsa->e != NULL) {
  ------------------
  |  Branch (64:7): [True: 35.2k, False: 0]
  ------------------
   65|       |    // Reject e = 1, negative e, and even e. e must be odd to be relatively
   66|       |    // prime with phi(n).
   67|  35.2k|    unsigned e_bits = BN_num_bits(rsa->e);
   68|  35.2k|    if (e_bits < 2 || BN_is_negative(rsa->e) || !BN_is_odd(rsa->e)) {
  ------------------
  |  Branch (68:9): [True: 0, False: 35.2k]
  |  Branch (68:23): [True: 0, False: 35.2k]
  |  Branch (68:49): [True: 0, False: 35.2k]
  ------------------
   69|      0|      OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_E_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   70|      0|      return 0;
   71|      0|    }
   72|  35.2k|    if (rsa->flags & RSA_FLAG_LARGE_PUBLIC_EXPONENT) {
  ------------------
  |  |  651|  35.2k|#define RSA_FLAG_LARGE_PUBLIC_EXPONENT 0x80
  ------------------
  |  Branch (72:9): [True: 0, False: 35.2k]
  ------------------
   73|       |      // The caller has requested disabling DoS protections. Still, e must be
   74|       |      // less than n.
   75|      0|      if (BN_ucmp(rsa->n, rsa->e) <= 0) {
  ------------------
  |  Branch (75:11): [True: 0, False: 0]
  ------------------
   76|      0|        OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_E_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   77|      0|        return 0;
   78|      0|      }
   79|  35.2k|    } else {
   80|       |      // Mitigate DoS attacks by limiting the exponent size. 33 bits was chosen
   81|       |      // as the limit based on the recommendations in [1] and [2]. Windows
   82|       |      // CryptoAPI doesn't support values larger than 32 bits [3], so it is
   83|       |      // unlikely that exponents larger than 32 bits are being used for anything
   84|       |      // Windows commonly does.
   85|       |      //
   86|       |      // [1] https://www.imperialviolet.org/2012/03/16/rsae.html
   87|       |      // [2] https://www.imperialviolet.org/2012/03/17/rsados.html
   88|       |      // [3] https://msdn.microsoft.com/en-us/library/aa387685(VS.85).aspx
   89|  35.2k|      if (e_bits > kMaxExponentBits) {
  ------------------
  |  Branch (89:11): [True: 0, False: 35.2k]
  ------------------
   90|      0|        OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_E_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   91|      0|        return 0;
   92|      0|      }
   93|       |
   94|       |      // The upper bound on |e_bits| and lower bound on |n_bits| imply e is
   95|       |      // bounded by n.
   96|  35.2k|      assert(BN_ucmp(rsa->n, rsa->e) > 0);
   97|  35.2k|    }
   98|  35.2k|  } else if (!(rsa->flags & RSA_FLAG_NO_PUBLIC_EXPONENT)) {
  ------------------
  |  |  645|      0|#define RSA_FLAG_NO_PUBLIC_EXPONENT 0x40
  ------------------
  |  Branch (98:14): [True: 0, False: 0]
  ------------------
   99|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_VALUE_MISSING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  100|      0|    return 0;
  101|      0|  }
  102|       |
  103|  35.2k|  return 1;
  104|  35.2k|}
rsa_invalidate_key:
  222|  35.2k|void rsa_invalidate_key(RSA *rsa) {
  223|  35.2k|  rsa->private_key_frozen = 0;
  224|       |
  225|  35.2k|  BN_MONT_CTX_free(rsa->mont_n);
  226|  35.2k|  rsa->mont_n = NULL;
  227|  35.2k|  BN_MONT_CTX_free(rsa->mont_p);
  228|  35.2k|  rsa->mont_p = NULL;
  229|  35.2k|  BN_MONT_CTX_free(rsa->mont_q);
  230|  35.2k|  rsa->mont_q = NULL;
  231|       |
  232|  35.2k|  BN_free(rsa->d_fixed);
  233|  35.2k|  rsa->d_fixed = NULL;
  234|  35.2k|  BN_free(rsa->dmp1_fixed);
  235|  35.2k|  rsa->dmp1_fixed = NULL;
  236|  35.2k|  BN_free(rsa->dmq1_fixed);
  237|  35.2k|  rsa->dmq1_fixed = NULL;
  238|  35.2k|  BN_free(rsa->iqmp_mont);
  239|  35.2k|  rsa->iqmp_mont = NULL;
  240|       |
  241|  35.2k|  for (size_t i = 0; i < rsa->num_blindings; i++) {
  ------------------
  |  Branch (241:22): [True: 0, False: 35.2k]
  ------------------
  242|      0|    BN_BLINDING_free(rsa->blindings[i]);
  243|      0|  }
  244|  35.2k|  OPENSSL_free(rsa->blindings);
  245|  35.2k|  rsa->blindings = NULL;
  246|  35.2k|  rsa->num_blindings = 0;
  247|  35.2k|  OPENSSL_free(rsa->blindings_inuse);
  248|  35.2k|  rsa->blindings_inuse = NULL;
  249|  35.2k|  rsa->blinding_fork_generation = 0;
  250|  35.2k|}
bcm.cc:_ZL26RSA_default_method_do_initP11rsa_meth_st:
 1272|      2|DEFINE_METHOD_FUNCTION(RSA_METHOD, RSA_default_method) {
 1273|       |  // All of the methods are NULL to make it easier for the compiler/linker to
 1274|       |  // drop unused functions. The wrapper functions will select the appropriate
 1275|       |  // |rsa_default_*| implementation.
 1276|      2|  OPENSSL_memset(out, 0, sizeof(RSA_METHOD));
 1277|      2|  out->common.is_static = 1;
 1278|      2|}

_Z35FIPS_service_indicator_update_statev:
   75|  4.88k|inline void FIPS_service_indicator_update_state(void) {}

EVP_hpke_x25519_hkdf_sha256:
  299|  12.6k|const EVP_HPKE_KEM *EVP_hpke_x25519_hkdf_sha256(void) {
  300|  12.6k|  static const EVP_HPKE_KEM kKEM = {
  301|  12.6k|      /*id=*/EVP_HPKE_DHKEM_X25519_HKDF_SHA256,
  ------------------
  |  |   44|  12.6k|#define EVP_HPKE_DHKEM_X25519_HKDF_SHA256 0x0020
  ------------------
  302|  12.6k|      /*public_key_len=*/X25519_PUBLIC_VALUE_LEN,
  ------------------
  |  |   37|  12.6k|#define X25519_PUBLIC_VALUE_LEN 32
  ------------------
  303|  12.6k|      /*private_key_len=*/X25519_PRIVATE_KEY_LEN,
  ------------------
  |  |   36|  12.6k|#define X25519_PRIVATE_KEY_LEN 32
  ------------------
  304|  12.6k|      /*seed_len=*/X25519_PRIVATE_KEY_LEN,
  ------------------
  |  |   36|  12.6k|#define X25519_PRIVATE_KEY_LEN 32
  ------------------
  305|  12.6k|      /*enc_len=*/X25519_PUBLIC_VALUE_LEN,
  ------------------
  |  |   37|  12.6k|#define X25519_PUBLIC_VALUE_LEN 32
  ------------------
  306|  12.6k|      x25519_init_key,
  307|  12.6k|      x25519_generate_key,
  308|  12.6k|      x25519_encap_with_seed,
  309|  12.6k|      x25519_decap,
  310|  12.6k|      x25519_auth_encap_with_seed,
  311|  12.6k|      x25519_auth_decap,
  312|  12.6k|  };
  313|  12.6k|  return &kKEM;
  314|  12.6k|}
EVP_HPKE_KEM_id:
  604|    511|uint16_t EVP_HPKE_KEM_id(const EVP_HPKE_KEM *kem) { return kem->id; }
EVP_HPKE_KEY_zero:
  616|  37.2k|void EVP_HPKE_KEY_zero(EVP_HPKE_KEY *key) {
  617|  37.2k|  OPENSSL_memset(key, 0, sizeof(EVP_HPKE_KEY));
  618|  37.2k|}
EVP_HPKE_KEY_cleanup:
  620|  24.6k|void EVP_HPKE_KEY_cleanup(EVP_HPKE_KEY *key) {
  621|       |  // Nothing to clean up for now, but we may introduce a cleanup process in the
  622|       |  // future.
  623|  24.6k|}
EVP_HPKE_KEY_init:
  658|  12.6k|                      const uint8_t *priv_key, size_t priv_key_len) {
  659|  12.6k|  EVP_HPKE_KEY_zero(key);
  660|  12.6k|  key->kem = kem;
  661|  12.6k|  if (!kem->init_key(key, priv_key, priv_key_len)) {
  ------------------
  |  Branch (661:7): [True: 569, False: 12.0k]
  ------------------
  662|    569|    key->kem = NULL;
  663|    569|    return 0;
  664|    569|  }
  665|  12.0k|  return 1;
  666|  12.6k|}
EVP_HPKE_KEY_kem:
  678|    511|const EVP_HPKE_KEM *EVP_HPKE_KEY_kem(const EVP_HPKE_KEY *key) {
  679|    511|  return key->kem;
  680|    511|}
EVP_HPKE_KEY_public_key:
  683|    511|                            size_t *out_len, size_t max_out) {
  684|    511|  if (max_out < key->kem->public_key_len) {
  ------------------
  |  Branch (684:7): [True: 0, False: 511]
  ------------------
  685|      0|    OPENSSL_PUT_ERROR(EVP, EVP_R_INVALID_BUFFER_SIZE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  686|      0|    return 0;
  687|      0|  }
  688|    511|  OPENSSL_memcpy(out, key->public_key, key->kem->public_key_len);
  689|    511|  *out_len = key->kem->public_key_len;
  690|    511|  return 1;
  691|    511|}
EVP_hpke_aes_128_gcm:
  718|  1.12k|const EVP_HPKE_AEAD *EVP_hpke_aes_128_gcm(void) {
  719|  1.12k|  static const EVP_HPKE_AEAD kAEAD = {EVP_HPKE_AES_128_GCM,
  ------------------
  |  |   95|  1.12k|#define EVP_HPKE_AES_128_GCM 0x0001
  ------------------
  720|  1.12k|                                      &EVP_aead_aes_128_gcm};
  721|  1.12k|  return &kAEAD;
  722|  1.12k|}
EVP_hpke_aes_256_gcm:
  724|    876|const EVP_HPKE_AEAD *EVP_hpke_aes_256_gcm(void) {
  725|    876|  static const EVP_HPKE_AEAD kAEAD = {EVP_HPKE_AES_256_GCM,
  ------------------
  |  |   96|    876|#define EVP_HPKE_AES_256_GCM 0x0002
  ------------------
  726|    876|                                      &EVP_aead_aes_256_gcm};
  727|    876|  return &kAEAD;
  728|    876|}
EVP_hpke_chacha20_poly1305:
  730|    863|const EVP_HPKE_AEAD *EVP_hpke_chacha20_poly1305(void) {
  731|    863|  static const EVP_HPKE_AEAD kAEAD = {EVP_HPKE_CHACHA20_POLY1305,
  ------------------
  |  |   97|    863|#define EVP_HPKE_CHACHA20_POLY1305 0x0003
  ------------------
  732|    863|                                      &EVP_aead_chacha20_poly1305};
  733|    863|  return &kAEAD;
  734|    863|}
EVP_HPKE_AEAD_id:
  736|  2.85k|uint16_t EVP_HPKE_AEAD_id(const EVP_HPKE_AEAD *aead) { return aead->id; }
EVP_HPKE_CTX_zero:
  842|  4.88k|void EVP_HPKE_CTX_zero(EVP_HPKE_CTX *ctx) {
  843|  4.88k|  OPENSSL_memset(ctx, 0, sizeof(EVP_HPKE_CTX));
  844|  4.88k|  EVP_AEAD_CTX_zero(&ctx->aead_ctx);
  845|  4.88k|}
EVP_HPKE_CTX_cleanup:
  847|  4.88k|void EVP_HPKE_CTX_cleanup(EVP_HPKE_CTX *ctx) {
  848|  4.88k|  EVP_AEAD_CTX_cleanup(&ctx->aead_ctx);
  849|  4.88k|}
hpke.cc:_ZL15x25519_init_keyP15evp_hpke_key_stPKhm:
  152|  12.6k|                           size_t priv_key_len) {
  153|  12.6k|  if (priv_key_len != X25519_PRIVATE_KEY_LEN) {
  ------------------
  |  |   36|  12.6k|#define X25519_PRIVATE_KEY_LEN 32
  ------------------
  |  Branch (153:7): [True: 569, False: 12.0k]
  ------------------
  154|    569|    OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR);
  ------------------
  |  |  361|    569|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  155|    569|    return 0;
  156|    569|  }
  157|       |
  158|  12.0k|  OPENSSL_memcpy(key->private_key, priv_key, priv_key_len);
  159|  12.0k|  X25519_public_from_private(key->public_key, priv_key);
  160|  12.0k|  return 1;
  161|  12.6k|}

ssl_ctx_api.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  46.9k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  46.9k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 8.10k, False: 38.8k]
  ------------------
  860|  8.10k|    return dst;
  861|  8.10k|  }
  862|       |
  863|  38.8k|  return memcpy(dst, src, n);
  864|  46.9k|}
CRYPTO_atomic_load_u32:
  532|   335k|inline uint32_t CRYPTO_atomic_load_u32(const CRYPTO_atomic_u32 *val) {
  533|   335k|  return val->load(std::memory_order_seq_cst);
  534|   335k|}
CRYPTO_atomic_compare_exchange_weak_u32:
  538|   325k|                                                    uint32_t desired) {
  539|   325k|  return val->compare_exchange_weak(
  540|   325k|      *expected, desired, std::memory_order_seq_cst, std::memory_order_seq_cst);
  541|   325k|}
CRYPTO_atomic_store_u32:
  543|      1|inline void CRYPTO_atomic_store_u32(CRYPTO_atomic_u32 *val, uint32_t desired) {
  544|      1|  val->store(desired, std::memory_order_seq_cst);
  545|      1|}
CRYPTO_is_intel_cpu:
 1120|  4.88k|inline int CRYPTO_is_intel_cpu(void) {
 1121|       |  // The reserved bit 30 is used to indicate an Intel CPU.
 1122|  4.88k|  return (OPENSSL_get_ia32cap(0) & (1u << 30)) != 0;
 1123|  4.88k|}
CRYPTO_is_PCLMUL_capable:
 1127|  30.9k|inline int CRYPTO_is_PCLMUL_capable(void) {
 1128|       |#if defined(__PCLMUL__)
 1129|       |  return 1;
 1130|       |#else
 1131|  30.9k|  return (OPENSSL_get_ia32cap(1) & (1u << 1)) != 0;
 1132|  30.9k|#endif
 1133|  30.9k|}
CRYPTO_is_SSSE3_capable:
 1135|  30.9k|inline int CRYPTO_is_SSSE3_capable(void) {
 1136|       |#if defined(__SSSE3__)
 1137|       |  return 1;
 1138|       |#else
 1139|  30.9k|  return (OPENSSL_get_ia32cap(1) & (1u << 9)) != 0;
 1140|  30.9k|#endif
 1141|  30.9k|}
CRYPTO_is_AESNI_capable:
 1159|  50.5k|inline int CRYPTO_is_AESNI_capable(void) {
 1160|       |#if defined(__AES__)
 1161|       |  return 1;
 1162|       |#else
 1163|  50.5k|  return (OPENSSL_get_ia32cap(1) & (1u << 25)) != 0;
 1164|  50.5k|#endif
 1165|  50.5k|}
CRYPTO_is_AVX_capable:
 1170|  9.77k|inline int CRYPTO_is_AVX_capable(void) {
 1171|       |#if defined(__AVX__)
 1172|       |  return 1;
 1173|       |#else
 1174|  9.77k|  return (OPENSSL_get_ia32cap(1) & (1u << 28)) != 0;
 1175|  9.77k|#endif
 1176|  9.77k|}
CRYPTO_is_RDRAND_capable:
 1178|  4.88k|inline int CRYPTO_is_RDRAND_capable(void) {
 1179|       |  // We intentionally do not check |__RDRND__| here. On some AMD processors, we
 1180|       |  // will act as if the hardware is RDRAND-incapable, even it actually supports
 1181|       |  // it. See cpu_intel.c.
 1182|  4.88k|  return (OPENSSL_get_ia32cap(1) & (1u << 30)) != 0;
 1183|  4.88k|}
CRYPTO_is_BMI1_capable:
 1187|  12.0k|inline int CRYPTO_is_BMI1_capable(void) {
 1188|       |#if defined(__BMI__)
 1189|       |  return 1;
 1190|       |#else
 1191|  12.0k|  return (OPENSSL_get_ia32cap(2) & (1u << 3)) != 0;
 1192|  12.0k|#endif
 1193|  12.0k|}
CRYPTO_is_BMI2_capable:
 1203|  12.0k|inline int CRYPTO_is_BMI2_capable(void) {
 1204|       |#if defined(__BMI2__)
 1205|       |  return 1;
 1206|       |#else
 1207|  12.0k|  return (OPENSSL_get_ia32cap(2) & (1u << 8)) != 0;
 1208|  12.0k|#endif
 1209|  12.0k|}
CRYPTO_is_ADX_capable:
 1211|  12.0k|inline int CRYPTO_is_ADX_capable(void) {
 1212|       |#if defined(__ADX__)
 1213|       |  return 1;
 1214|       |#else
 1215|  12.0k|  return (OPENSSL_get_ia32cap(2) & (1u << 19)) != 0;
 1216|  12.0k|#endif
 1217|  12.0k|}
CRYPTO_cpu_perf_is_like_silvermont:
 1238|      2|inline int CRYPTO_cpu_perf_is_like_silvermont(void) {
 1239|       |  // WARNING: This MUST NOT be used to guard the execution of the XSAVE
 1240|       |  // instruction. This is the "hardware supports XSAVE" bit, not the OSXSAVE bit
 1241|       |  // that indicates whether we can safely execute XSAVE. This bit may be set
 1242|       |  // even when XSAVE is disabled (by the operating system). See how the users of
 1243|       |  // this bit use it.
 1244|       |  //
 1245|       |  // Historically, the XSAVE bit was artificially cleared on Knights Landing
 1246|       |  // and Knights Mill chips, but as Intel has removed all support from GCC,
 1247|       |  // LLVM, and SDE, we assume they are no longer worth special-casing.
 1248|      2|  int hardware_supports_xsave = (OPENSSL_get_ia32cap(1) & (1u << 26)) != 0;
 1249|      2|  return !hardware_supports_xsave && CRYPTO_is_MOVBE_capable();
  ------------------
  |  Branch (1249:10): [True: 0, False: 2]
  |  Branch (1249:38): [True: 0, False: 0]
  ------------------
 1250|      2|}
_Z16CRYPTO_subc_implmmmPm:
 1521|     64|                                      unsigned long *out_borrow) {
 1522|     64|  return __builtin_subcl(x, y, borrow, out_borrow);
 1523|     64|}
_Z15CRYPTO_subc_u64mmmPm:
 1538|     64|                                uint64_t *out_borrow) {
 1539|     64|  return CRYPTO_subc_impl(x, y, borrow, out_borrow);
 1540|     64|}
_ZN4bssl8internal13MutexLockBaseIXadL_Z23CRYPTO_MUTEX_lock_writeEEXadL_Z25CRYPTO_MUTEX_unlock_writeEEEC2EP16pthread_rwlock_t:
  650|  23.7k|  explicit MutexLockBase(CRYPTO_MUTEX *mu) : mu_(mu) {
  651|  23.7k|    assert(mu_ != nullptr);
  652|  23.7k|    LockFunc(mu_);
  653|  23.7k|  }
_ZN4bssl8internal13MutexLockBaseIXadL_Z23CRYPTO_MUTEX_lock_writeEEXadL_Z25CRYPTO_MUTEX_unlock_writeEEED2Ev:
  654|  23.7k|  ~MutexLockBase() { ReleaseFunc(mu_); }
_ZN4bssl8internal13MutexLockBaseIXadL_Z22CRYPTO_MUTEX_lock_readEEXadL_Z24CRYPTO_MUTEX_unlock_readEEEC2EP16pthread_rwlock_t:
  650|    851|  explicit MutexLockBase(CRYPTO_MUTEX *mu) : mu_(mu) {
  651|    851|    assert(mu_ != nullptr);
  652|    851|    LockFunc(mu_);
  653|    851|  }
_ZN4bssl8internal13MutexLockBaseIXadL_Z22CRYPTO_MUTEX_lock_readEEXadL_Z24CRYPTO_MUTEX_unlock_readEEED2Ev:
  654|    851|  ~MutexLockBase() { ReleaseFunc(mu_); }
ssl_lib.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  1.16k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  1.16k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 1.16k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  1.16k|  return memcpy(dst, src, n);
  864|  1.16k|}
bcm.cc:_ZL18CRYPTO_load_u32_bePKv:
  910|  34.1k|static inline uint32_t CRYPTO_load_u32_be(const void *in) {
  911|  34.1k|  uint32_t v;
  912|  34.1k|  OPENSSL_memcpy(&v, in, sizeof(v));
  913|  34.1k|  return CRYPTO_bswap4(v);
  914|  34.1k|}
bcm.cc:_ZL13CRYPTO_bswap4j:
  775|  68.3k|static inline uint32_t CRYPTO_bswap4(uint32_t x) {
  776|  68.3k|  return __builtin_bswap32(x);
  777|  68.3k|}
bcm.cc:_ZL19CRYPTO_store_u32_bePvj:
  916|  34.1k|static inline void CRYPTO_store_u32_be(void *out, uint32_t v) {
  917|  34.1k|  v = CRYPTO_bswap4(v);
  918|  34.1k|  OPENSSL_memcpy(out, &v, sizeof(v));
  919|  34.1k|}
bcm.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  1.28M|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  1.28M|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 70.4k, False: 1.21M]
  ------------------
  860|  70.4k|    return dst;
  861|  70.4k|  }
  862|       |
  863|  1.21M|  return memcpy(dst, src, n);
  864|  1.28M|}
bcm.cc:_ZL14OPENSSL_memsetPvim:
  874|   160k|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|   160k|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 70.4k, False: 90.0k]
  ------------------
  876|  70.4k|    return dst;
  877|  70.4k|  }
  878|       |
  879|  90.0k|  return memset(dst, c, n);
  880|   160k|}
bcm.cc:_ZL13CRYPTO_bswap8m:
  779|  1.12M|static inline uint64_t CRYPTO_bswap8(uint64_t x) {
  780|  1.12M|  return __builtin_bswap64(x);
  781|  1.12M|}
bcm.cc:_ZL23constant_time_is_zero_wm:
  326|   472k|static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
  327|       |  // Here is an SMT-LIB verification of this formula:
  328|       |  //
  329|       |  // (define-fun is_zero ((a (_ BitVec 32))) (_ BitVec 32)
  330|       |  //   (bvand (bvnot a) (bvsub a #x00000001))
  331|       |  // )
  332|       |  //
  333|       |  // (declare-fun a () (_ BitVec 32))
  334|       |  //
  335|       |  // (assert (not (= (= #x00000001 (bvlshr (is_zero a) #x0000001f)) (= a
  336|       |  // #x00000000)))) (check-sat) (get-model)
  337|   472k|  return constant_time_msb_w(~a & (a - 1));
  338|   472k|}
bcm.cc:_ZL19constant_time_msb_wm:
  267|   909k|static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
  268|   909k|  return 0u - (a >> (sizeof(a) * 8 - 1));
  269|   909k|}
bcm.cc:_ZL18constant_time_eq_wmm:
  348|   437k|                                               crypto_word_t b) {
  349|   437k|  return constant_time_is_zero_w(a ^ b);
  350|   437k|}
bcm.cc:_ZL22constant_time_select_wmmm:
  375|  1.04M|                                                   crypto_word_t b) {
  376|       |  // Clang recognizes this pattern as a select. While it usually transforms it
  377|       |  // to a cmov, it sometimes further transforms it into a branch, which we do
  378|       |  // not want.
  379|       |  //
  380|       |  // Hiding the value of the mask from the compiler evades this transformation.
  381|  1.04M|  mask = value_barrier_w(mask);
  382|  1.04M|  return (mask & a) | (~mask & b);
  383|  1.04M|}
bcm.cc:_ZL15value_barrier_wm:
  239|  1.04M|static inline crypto_word_t value_barrier_w(crypto_word_t a) {
  240|  1.04M|#if defined(__GNUC__) || defined(__clang__)
  241|  1.04M|  __asm__("" : "+r"(a) : /* no inputs */);
  242|  1.04M|#endif
  243|  1.04M|  return a;
  244|  1.04M|}
bcm.cc:_ZL19CRYPTO_load_word_bePKv:
  952|  1.12M|static inline crypto_word_t CRYPTO_load_word_be(const void *in) {
  953|  1.12M|  crypto_word_t v;
  954|  1.12M|  OPENSSL_memcpy(&v, in, sizeof(v));
  955|  1.12M|#if defined(OPENSSL_64_BIT)
  956|  1.12M|  static_assert(sizeof(v) == 8, "crypto_word_t has unexpected size");
  957|  1.12M|  return CRYPTO_bswap8(v);
  958|       |#else
  959|       |  static_assert(sizeof(v) == 4, "crypto_word_t has unexpected size");
  960|       |  return CRYPTO_bswap4(v);
  961|       |#endif
  962|  1.12M|}
bcm.cc:_ZL28constant_time_declassify_inti:
  481|  7.96k|static inline int constant_time_declassify_int(int v) {
  482|  7.96k|  static_assert(sizeof(uint32_t) == sizeof(int),
  483|  7.96k|                "int is not the same size as uint32_t");
  484|       |  // See comment above.
  485|  7.96k|  CONSTTIME_DECLASSIFY(&v, sizeof(v));
  486|  7.96k|  return value_barrier_u32(v);
  487|  7.96k|}
bcm.cc:_ZL17value_barrier_u32j:
  247|  7.96k|static inline uint32_t value_barrier_u32(uint32_t a) {
  248|  7.96k|#if defined(__GNUC__) || defined(__clang__)
  249|  7.96k|  __asm__("" : "+r"(a) : /* no inputs */);
  250|  7.96k|#endif
  251|  7.96k|  return a;
  252|  7.96k|}
bcm.cc:_ZL24constant_time_select_intmii:
  401|   909k|static inline int constant_time_select_int(crypto_word_t mask, int a, int b) {
  402|   909k|  return (int)(constant_time_select_w(mask, (crypto_word_t)(a),
  403|   909k|                                      (crypto_word_t)(b)));
  404|   909k|}
bcm.cc:_ZL18constant_time_lt_wmm:
  273|   437k|                                               crypto_word_t b) {
  274|       |  // Consider the two cases of the problem:
  275|       |  //   msb(a) == msb(b): a < b iff the MSB of a - b is set.
  276|       |  //   msb(a) != msb(b): a < b iff the MSB of b is set.
  277|       |  //
  278|       |  // If msb(a) == msb(b) then the following evaluates as:
  279|       |  //   msb(a^((a^b)|((a-b)^a))) ==
  280|       |  //   msb(a^((a-b) ^ a))       ==   (because msb(a^b) == 0)
  281|       |  //   msb(a^a^(a-b))           ==   (rearranging)
  282|       |  //   msb(a-b)                      (because ∀x. x^x == 0)
  283|       |  //
  284|       |  // Else, if msb(a) != msb(b) then the following evaluates as:
  285|       |  //   msb(a^((a^b)|((a-b)^a))) ==
  286|       |  //   msb(a^(𝟙 | ((a-b)^a)))   ==   (because msb(a^b) == 1 and 𝟙
  287|       |  //                                  represents a value s.t. msb(𝟙) = 1)
  288|       |  //   msb(a^𝟙)                 ==   (because ORing with 1 results in 1)
  289|       |  //   msb(b)
  290|       |  //
  291|       |  //
  292|       |  // Here is an SMT-LIB verification of this formula:
  293|       |  //
  294|       |  // (define-fun lt ((a (_ BitVec 32)) (b (_ BitVec 32))) (_ BitVec 32)
  295|       |  //   (bvxor a (bvor (bvxor a b) (bvxor (bvsub a b) a)))
  296|       |  // )
  297|       |  //
  298|       |  // (declare-fun a () (_ BitVec 32))
  299|       |  // (declare-fun b () (_ BitVec 32))
  300|       |  //
  301|       |  // (assert (not (= (= #x00000001 (bvlshr (lt a b) #x0000001f)) (bvult a b))))
  302|       |  // (check-sat)
  303|       |  // (get-model)
  304|   437k|  return constant_time_msb_w(a ^ ((a ^ b) | ((a - b) ^ a)));
  305|   437k|}
buf.cc:_ZL14OPENSSL_memsetPvim:
  874|  56.2k|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|  56.2k|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 56.2k]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|  56.2k|  return memset(dst, c, n);
  880|  56.2k|}
cbb.cc:_ZL14OPENSSL_memsetPvim:
  874|   215k|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|   215k|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 215k]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|   215k|  return memset(dst, c, n);
  880|   215k|}
cbb.cc:_ZL15OPENSSL_memmovePvPKvm:
  866|  34.2k|static inline void *OPENSSL_memmove(void *dst, const void *src, size_t n) {
  867|  34.2k|  if (n == 0) {
  ------------------
  |  Branch (867:7): [True: 0, False: 34.2k]
  ------------------
  868|      0|    return dst;
  869|      0|  }
  870|       |
  871|  34.2k|  return memmove(dst, src, n);
  872|  34.2k|}
chacha.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|      6|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|      6|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 6]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|      6|  return memcpy(dst, src, n);
  864|      6|}
chacha.cc:_ZL13buffers_aliasPKvmS0_m:
  168|      2|                                size_t b_bytes) {
  169|       |  // Cast |a| and |b| to integers. In C, pointer comparisons between unrelated
  170|       |  // objects are undefined whereas pointer to integer conversions are merely
  171|       |  // implementation-defined. We assume the implementation defined it in a sane
  172|       |  // way.
  173|      2|  uintptr_t a_u = (uintptr_t)a;
  174|      2|  uintptr_t b_u = (uintptr_t)b;
  175|      2|  return a_u + a_bytes > b_u && b_u + b_bytes > a_u;
  ------------------
  |  Branch (175:10): [True: 2, False: 0]
  |  Branch (175:33): [True: 2, False: 0]
  ------------------
  176|      2|}
chacha.cc:_ZL18CRYPTO_load_u32_lePKv:
  900|      6|static inline uint32_t CRYPTO_load_u32_le(const void *in) {
  901|      6|  uint32_t v;
  902|      6|  OPENSSL_memcpy(&v, in, sizeof(v));
  903|      6|  return v;
  904|      6|}
curve25519.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  12.0k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  12.0k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 12.0k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  12.0k|  return memcpy(dst, src, n);
  864|  12.0k|}
curve25519.cc:_ZL28constant_time_declassify_inti:
  481|  33.2M|static inline int constant_time_declassify_int(int v) {
  482|  33.2M|  static_assert(sizeof(uint32_t) == sizeof(int),
  483|  33.2M|                "int is not the same size as uint32_t");
  484|       |  // See comment above.
  485|  33.2M|  CONSTTIME_DECLASSIFY(&v, sizeof(v));
  486|  33.2M|  return value_barrier_u32(v);
  487|  33.2M|}
curve25519.cc:_ZL17value_barrier_u32j:
  247|  33.2M|static inline uint32_t value_barrier_u32(uint32_t a) {
  248|  33.2M|#if defined(__GNUC__) || defined(__clang__)
  249|  33.2M|  __asm__("" : "+r"(a) : /* no inputs */);
  250|  33.2M|#endif
  251|  33.2M|  return a;
  252|  33.2M|}
curve25519_64_adx.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|   783k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|   783k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 783k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|   783k|  return memcpy(dst, src, n);
  864|   783k|}
curve25519_64_adx.cc:_ZL19constant_time_msb_wm:
  267|  8.48M|static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
  268|  8.48M|  return 0u - (a >> (sizeof(a) * 8 - 1));
  269|  8.48M|}
curve25519_64_adx.cc:_ZL23constant_time_is_zero_wm:
  326|  7.71M|static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
  327|       |  // Here is an SMT-LIB verification of this formula:
  328|       |  //
  329|       |  // (define-fun is_zero ((a (_ BitVec 32))) (_ BitVec 32)
  330|       |  //   (bvand (bvnot a) (bvsub a #x00000001))
  331|       |  // )
  332|       |  //
  333|       |  // (declare-fun a () (_ BitVec 32))
  334|       |  //
  335|       |  // (assert (not (= (= #x00000001 (bvlshr (is_zero a) #x0000001f)) (= a
  336|       |  // #x00000000)))) (check-sat) (get-model)
  337|  7.71M|  return constant_time_msb_w(~a & (a - 1));
  338|  7.71M|}
curve25519_64_adx.cc:_ZL32constant_time_conditional_memxorPvPKvmm:
  425|  6.17M|                                                    const crypto_word_t mask) {
  426|  6.17M|  assert(!buffers_alias(dst, n, src, n));
  427|  6.17M|  uint8_t *out = (uint8_t *)dst;
  428|  6.17M|  const uint8_t *in = (const uint8_t *)src;
  429|       |#if defined(__GNUC__) && !defined(__clang__)
  430|       |  // gcc 13.2.0 doesn't automatically vectorize this loop regardless of barrier
  431|       |  typedef uint8_t v32u8 __attribute__((vector_size(32), aligned(1), may_alias));
  432|       |  size_t n_vec = n & ~(size_t)31;
  433|       |  v32u8 masks = ((uint8_t)mask - (v32u8){});  // broadcast
  434|       |  for (size_t i = 0; i < n_vec; i += 32) {
  435|       |    *(v32u8 *)&out[i] ^= masks & *(v32u8 *)&in[i];
  436|       |  }
  437|       |  out += n_vec;
  438|       |  n -= n_vec;
  439|       |#endif
  440|   598M|  for (size_t i = 0; i < n; i++) {
  ------------------
  |  Branch (440:22): [True: 592M, False: 6.17M]
  ------------------
  441|   592M|    out[i] ^= value_barrier_w(mask) & in[i];
  442|   592M|  }
  443|  6.17M|}
curve25519_64_adx.cc:_ZL13buffers_aliasPKvmS0_m:
  168|  8.48M|                                size_t b_bytes) {
  169|       |  // Cast |a| and |b| to integers. In C, pointer comparisons between unrelated
  170|       |  // objects are undefined whereas pointer to integer conversions are merely
  171|       |  // implementation-defined. We assume the implementation defined it in a sane
  172|       |  // way.
  173|  8.48M|  uintptr_t a_u = (uintptr_t)a;
  174|  8.48M|  uintptr_t b_u = (uintptr_t)b;
  175|  8.48M|  return a_u + a_bytes > b_u && b_u + b_bytes > a_u;
  ------------------
  |  Branch (175:10): [True: 6.17M, False: 2.31M]
  |  Branch (175:33): [True: 0, False: 6.17M]
  ------------------
  176|  8.48M|}
curve25519_64_adx.cc:_ZL15value_barrier_wm:
  239|   666M|static inline crypto_word_t value_barrier_w(crypto_word_t a) {
  240|   666M|#if defined(__GNUC__) || defined(__clang__)
  241|   666M|  __asm__("" : "+r"(a) : /* no inputs */);
  242|   666M|#endif
  243|   666M|  return a;
  244|   666M|}
curve25519_64_adx.cc:_ZL18constant_time_eq_wmm:
  348|  6.17M|                                               crypto_word_t b) {
  349|  6.17M|  return constant_time_is_zero_w(a ^ b);
  350|  6.17M|}
curve25519_64_adx.cc:_ZL32constant_time_conditional_memcpyPvPKvmm:
  411|  2.31M|                                                    const crypto_word_t mask) {
  412|  2.31M|  assert(!buffers_alias(dst, n, src, n));
  413|  2.31M|  uint8_t *out = (uint8_t *)dst;
  414|  2.31M|  const uint8_t *in = (const uint8_t *)src;
  415|  76.3M|  for (size_t i = 0; i < n; i++) {
  ------------------
  |  Branch (415:22): [True: 74.0M, False: 2.31M]
  ------------------
  416|  74.0M|    out[i] = constant_time_select_8(mask, in[i], out[i]);
  417|  74.0M|  }
  418|  2.31M|}
curve25519_64_adx.cc:_ZL22constant_time_select_8mhh:
  388|  74.0M|                                             uint8_t b) {
  389|       |  // |mask| is a word instead of |uint8_t| to avoid materializing 0x000..0MM
  390|       |  // Making both |mask| and its value barrier |uint8_t| would allow the compiler
  391|       |  // to materialize 0x????..?MM instead, but only clang is that clever.
  392|       |  // However, vectorization of bitwise operations seems to work better on
  393|       |  // |uint8_t| than a mix of |uint64_t| and |uint8_t|, so |m| is cast to
  394|       |  // |uint8_t| after the value barrier but before the bitwise operations.
  395|  74.0M|  uint8_t m = value_barrier_w(mask);
  396|  74.0M|  return (m & a) | (~m & b);
  397|  74.0M|}
err.cc:_ZL14OPENSSL_memsetPvim:
  874|   623k|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|   623k|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 623k]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|   623k|  return memset(dst, c, n);
  880|   623k|}
evp_asn1.cc:_ZL14OPENSSL_memcmpPKvS0_m:
  850|  35.2k|static inline int OPENSSL_memcmp(const void *s1, const void *s2, size_t n) {
  851|  35.2k|  if (n == 0) {
  ------------------
  |  Branch (851:7): [True: 0, False: 35.2k]
  ------------------
  852|      0|    return 0;
  853|      0|  }
  854|       |
  855|  35.2k|  return memcmp(s1, s2, n);
  856|  35.2k|}
hpke.cc:_ZL14OPENSSL_memsetPvim:
  874|  42.1k|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|  42.1k|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 42.1k]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|  42.1k|  return memset(dst, c, n);
  880|  42.1k|}
hpke.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  12.5k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  12.5k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 12.5k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  12.5k|  return memcpy(dst, src, n);
  864|  12.5k|}
mem.cc:_ZL14OPENSSL_memsetPvim:
  874|  5.28M|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|  5.28M|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 5.28M]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|  5.28M|  return memset(dst, c, n);
  880|  5.28M|}
mem.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|   408k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|   408k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 408k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|   408k|  return memcpy(dst, src, n);
  864|   408k|}
deterministic.cc:_ZL14OPENSSL_memsetPvim:
  874|      4|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|      4|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 4]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|      4|  return memset(dst, c, n);
  880|      4|}
deterministic.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|      2|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|      2|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 2]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|      2|  return memcpy(dst, src, n);
  864|      2|}
thread_pthread.cc:_ZL14OPENSSL_memsetPvim:
  874|      2|static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
  875|      2|  if (n == 0) {
  ------------------
  |  Branch (875:7): [True: 0, False: 2]
  ------------------
  876|      0|    return dst;
  877|      0|  }
  878|       |
  879|      2|  return memset(dst, c, n);
  880|      2|}
x_name.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  59.6k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  59.6k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 59.6k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  59.6k|  return memcpy(dst, src, n);
  864|  59.6k|}
a_bitstr.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  45.2k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  45.2k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 45.2k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  45.2k|  return memcpy(dst, src, n);
  864|  45.2k|}
a_int.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  56.2k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  56.2k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 56.2k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  56.2k|  return memcpy(dst, src, n);
  864|  56.2k|}
a_int.cc:_ZL13CRYPTO_bswap8m:
  779|  28.1k|static inline uint64_t CRYPTO_bswap8(uint64_t x) {
  780|  28.1k|  return __builtin_bswap64(x);
  781|  28.1k|}
a_int.cc:_ZL18CRYPTO_load_u64_bePKv:
  931|  28.1k|static inline uint64_t CRYPTO_load_u64_be(const void *ptr) {
  932|  28.1k|  uint64_t ret;
  933|  28.1k|  OPENSSL_memcpy(&ret, ptr, sizeof(ret));
  934|  28.1k|  return CRYPTO_bswap8(ret);
  935|  28.1k|}
asn1_lib.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|   281k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|   281k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 281k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|   281k|  return memcpy(dst, src, n);
  864|   281k|}
tasn_enc.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|   157k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|   157k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 157k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|   157k|  return memcpy(dst, src, n);
  864|   157k|}
tasn_utl.cc:_ZL14OPENSSL_memcpyPvPKvm:
  858|  17.1k|static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
  859|  17.1k|  if (n == 0) {
  ------------------
  |  Branch (859:7): [True: 0, False: 17.1k]
  ------------------
  860|      0|    return dst;
  861|      0|  }
  862|       |
  863|  17.1k|  return memcpy(dst, src, n);
  864|  17.1k|}

_Z18lh_SSL_SESSION_newPFjPK14ssl_session_stEPFiS1_S1_E:
  150|  4.88k|                                         lhash_##type##_cmp_func comp) {       \
  151|  4.88k|    return (LHASH_OF(type) *)OPENSSL_lh_new((lhash_hash_func)hash,             \
  152|  4.88k|                                            (lhash_cmp_func)comp);             \
  153|  4.88k|  }                                                                            \
_Z19lh_SSL_SESSION_freeP20lhash_st_SSL_SESSION:
  155|  4.88k|  inline void lh_##type##_free(LHASH_OF(type) *lh) {                           \
  156|  4.88k|    OPENSSL_lh_free((_LHASH *)lh);                                             \
  157|  4.88k|  }                                                                            \
_Z24lh_SSL_SESSION_num_itemsPK20lhash_st_SSL_SESSION:
  159|    851|  inline size_t lh_##type##_num_items(const LHASH_OF(type) *lh) {              \
  160|    851|    return OPENSSL_lh_num_items((const _LHASH *)lh);                           \
  161|    851|  }                                                                            \
_Z24lh_SSL_SESSION_doall_argP20lhash_st_SSL_SESSIONPFvP14ssl_session_stPvES3_:
  215|  8.11k|                                    void (*func)(type *, void *), void *arg) { \
  216|  8.11k|    LHASH_DOALL_##type cb = {func, arg};                                       \
  217|  8.11k|    OPENSSL_lh_doall_arg((_LHASH *)lh, lh_##type##_call_doall_arg, &cb);       \
  218|  8.11k|  }                                                                            \

OPENSSL_lh_new:
   62|  4.88k|_LHASH *OPENSSL_lh_new(lhash_hash_func hash, lhash_cmp_func comp) {
   63|  4.88k|  _LHASH *ret = reinterpret_cast<_LHASH *>(OPENSSL_zalloc(sizeof(_LHASH)));
   64|  4.88k|  if (ret == NULL) {
  ------------------
  |  Branch (64:7): [True: 0, False: 4.88k]
  ------------------
   65|      0|    return NULL;
   66|      0|  }
   67|       |
   68|  4.88k|  ret->num_buckets = kMinNumBuckets;
   69|  4.88k|  ret->buckets = reinterpret_cast<LHASH_ITEM **>(
   70|  4.88k|      OPENSSL_calloc(ret->num_buckets, sizeof(LHASH_ITEM *)));
   71|  4.88k|  if (ret->buckets == NULL) {
  ------------------
  |  Branch (71:7): [True: 0, False: 4.88k]
  ------------------
   72|      0|    OPENSSL_free(ret);
   73|      0|    return NULL;
   74|      0|  }
   75|       |
   76|  4.88k|  ret->comp = comp;
   77|  4.88k|  ret->hash = hash;
   78|  4.88k|  return ret;
   79|  4.88k|}
OPENSSL_lh_free:
   81|  4.88k|void OPENSSL_lh_free(_LHASH *lh) {
   82|  4.88k|  if (lh == NULL) {
  ------------------
  |  Branch (82:7): [True: 0, False: 4.88k]
  ------------------
   83|      0|    return;
   84|      0|  }
   85|       |
   86|  83.0k|  for (size_t i = 0; i < lh->num_buckets; i++) {
  ------------------
  |  Branch (86:22): [True: 78.1k, False: 4.88k]
  ------------------
   87|  78.1k|    LHASH_ITEM *next;
   88|  78.1k|    for (LHASH_ITEM *n = lh->buckets[i]; n != NULL; n = next) {
  ------------------
  |  Branch (88:42): [True: 0, False: 78.1k]
  ------------------
   89|      0|      next = n->next;
   90|      0|      OPENSSL_free(n);
   91|      0|    }
   92|  78.1k|  }
   93|       |
   94|  4.88k|  OPENSSL_free(lh->buckets);
   95|  4.88k|  OPENSSL_free(lh);
   96|  4.88k|}
OPENSSL_lh_num_items:
   98|    851|size_t OPENSSL_lh_num_items(const _LHASH *lh) { return lh->num_items; }
OPENSSL_lh_doall_arg:
  281|  8.11k|void OPENSSL_lh_doall_arg(_LHASH *lh, void (*func)(void *, void *), void *arg) {
  282|  8.11k|  if (lh == NULL) {
  ------------------
  |  Branch (282:7): [True: 0, False: 8.11k]
  ------------------
  283|      0|    return;
  284|      0|  }
  285|       |
  286|  8.11k|  if (lh->callback_depth < UINT_MAX) {
  ------------------
  |  Branch (286:7): [True: 8.11k, False: 0]
  ------------------
  287|       |    // |callback_depth| is a saturating counter.
  288|  8.11k|    lh->callback_depth++;
  289|  8.11k|  }
  290|       |
  291|   137k|  for (size_t i = 0; i < lh->num_buckets; i++) {
  ------------------
  |  Branch (291:22): [True: 129k, False: 8.11k]
  ------------------
  292|   129k|    LHASH_ITEM *next;
  293|   129k|    for (LHASH_ITEM *cur = lh->buckets[i]; cur != NULL; cur = next) {
  ------------------
  |  Branch (293:44): [True: 0, False: 129k]
  ------------------
  294|      0|      next = cur->next;
  295|      0|      func(cur->data, arg);
  296|      0|    }
  297|   129k|  }
  298|       |
  299|  8.11k|  if (lh->callback_depth < UINT_MAX) {
  ------------------
  |  Branch (299:7): [True: 8.11k, False: 0]
  ------------------
  300|  8.11k|    lh->callback_depth--;
  301|  8.11k|  }
  302|       |
  303|       |  // The callback may have added or removed elements and the non-zero value of
  304|       |  // |callback_depth| will have suppressed any resizing. Thus any needed
  305|       |  // resizing is done here.
  306|  8.11k|  lh_maybe_resize(lh);
  307|  8.11k|}
lhash.cc:_ZL15lh_maybe_resizeP8lhash_st:
  193|  8.11k|static void lh_maybe_resize(_LHASH *lh) {
  194|  8.11k|  size_t avg_chain_length;
  195|       |
  196|  8.11k|  if (lh->callback_depth > 0) {
  ------------------
  |  Branch (196:7): [True: 0, False: 8.11k]
  ------------------
  197|       |    // Don't resize the hash if we are currently iterating over it.
  198|      0|    return;
  199|      0|  }
  200|       |
  201|  8.11k|  assert(lh->num_buckets >= kMinNumBuckets);
  202|  8.11k|  avg_chain_length = lh->num_items / lh->num_buckets;
  203|       |
  204|  8.11k|  if (avg_chain_length > kMaxAverageChainLength) {
  ------------------
  |  Branch (204:7): [True: 0, False: 8.11k]
  ------------------
  205|      0|    const size_t new_num_buckets = lh->num_buckets * 2;
  206|       |
  207|      0|    if (new_num_buckets > lh->num_buckets) {
  ------------------
  |  Branch (207:9): [True: 0, False: 0]
  ------------------
  208|      0|      lh_rebucket(lh, new_num_buckets);
  209|      0|    }
  210|  8.11k|  } else if (avg_chain_length < kMinAverageChainLength &&
  ------------------
  |  Branch (210:14): [True: 8.11k, False: 0]
  ------------------
  211|  8.11k|             lh->num_buckets > kMinNumBuckets) {
  ------------------
  |  Branch (211:14): [True: 0, False: 8.11k]
  ------------------
  212|      0|    size_t new_num_buckets = lh->num_buckets / 2;
  213|       |
  214|      0|    if (new_num_buckets < kMinNumBuckets) {
  ------------------
  |  Branch (214:9): [True: 0, False: 0]
  ------------------
  215|      0|      new_num_buckets = kMinNumBuckets;
  216|      0|    }
  217|       |
  218|      0|    lh_rebucket(lh, new_num_buckets);
  219|      0|  }
  220|  8.11k|}

OPENSSL_malloc:
  185|  3.71M|void *OPENSSL_malloc(size_t size) {
  186|  3.71M|  void *ptr = nullptr;
  187|  3.71M|  if (should_fail_allocation()) {
  ------------------
  |  Branch (187:7): [True: 0, False: 3.71M]
  ------------------
  188|      0|    goto err;
  189|      0|  }
  190|       |
  191|  3.71M|  if (OPENSSL_memory_alloc != NULL) {
  ------------------
  |  Branch (191:7): [True: 0, False: 3.71M]
  ------------------
  192|      0|    assert(OPENSSL_memory_free != NULL);
  193|      0|    assert(OPENSSL_memory_get_size != NULL);
  194|      0|    void *ptr2 = OPENSSL_memory_alloc(size);
  195|      0|    if (ptr2 == NULL && size != 0) {
  ------------------
  |  Branch (195:9): [True: 0, False: 0]
  |  Branch (195:25): [True: 0, False: 0]
  ------------------
  196|      0|      goto err;
  197|      0|    }
  198|      0|    return ptr2;
  199|      0|  }
  200|       |
  201|  3.71M|  if (size + OPENSSL_MALLOC_PREFIX < size) {
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  |  Branch (201:7): [True: 0, False: 3.71M]
  ------------------
  202|      0|    goto err;
  203|      0|  }
  204|       |
  205|  3.71M|  ptr = malloc(size + OPENSSL_MALLOC_PREFIX);
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  206|  3.71M|  if (ptr == NULL) {
  ------------------
  |  Branch (206:7): [True: 0, False: 3.71M]
  ------------------
  207|      0|    goto err;
  208|      0|  }
  209|       |
  210|  3.71M|  *(size_t *)ptr = size;
  211|       |
  212|  3.71M|  __asan_poison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  213|  3.71M|  return ((uint8_t *)ptr) + OPENSSL_MALLOC_PREFIX;
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  214|       |
  215|      0|err:
  216|       |  // This only works because ERR does not call OPENSSL_malloc.
  217|      0|  OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  218|      0|  return NULL;
  219|  3.71M|}
OPENSSL_zalloc:
  221|  1.57M|void *OPENSSL_zalloc(size_t size) {
  222|  1.57M|  void *ret = OPENSSL_malloc(size);
  223|  1.57M|  if (ret != NULL) {
  ------------------
  |  Branch (223:7): [True: 1.57M, False: 0]
  ------------------
  224|  1.57M|    OPENSSL_memset(ret, 0, size);
  225|  1.57M|  }
  226|  1.57M|  return ret;
  227|  1.57M|}
OPENSSL_calloc:
  229|   484k|void *OPENSSL_calloc(size_t num, size_t size) {
  230|   484k|  if (size != 0 && num > SIZE_MAX / size) {
  ------------------
  |  Branch (230:7): [True: 484k, False: 0]
  |  Branch (230:20): [True: 0, False: 484k]
  ------------------
  231|      0|    OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  232|      0|    return NULL;
  233|      0|  }
  234|       |
  235|   484k|  return OPENSSL_zalloc(num * size);
  236|   484k|}
OPENSSL_free:
  238|  5.25M|void OPENSSL_free(void *orig_ptr) {
  239|  5.25M|  if (orig_ptr == NULL) {
  ------------------
  |  Branch (239:7): [True: 1.53M, False: 3.71M]
  ------------------
  240|  1.53M|    return;
  241|  1.53M|  }
  242|       |
  243|  3.71M|  if (OPENSSL_memory_free != NULL) {
  ------------------
  |  Branch (243:7): [True: 0, False: 3.71M]
  ------------------
  244|      0|    OPENSSL_memory_free(orig_ptr);
  245|      0|    return;
  246|      0|  }
  247|       |
  248|  3.71M|  void *ptr = ((uint8_t *)orig_ptr) - OPENSSL_MALLOC_PREFIX;
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  249|  3.71M|  __asan_unpoison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  250|       |
  251|  3.71M|  size_t size = *(size_t *)ptr;
  252|  3.71M|  OPENSSL_cleanse(ptr, size + OPENSSL_MALLOC_PREFIX);
  ------------------
  |  |   39|  3.71M|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  253|       |
  254|       |// ASan knows to intercept malloc and free, but not sdallocx.
  255|       |#if defined(OPENSSL_ASAN)
  256|       |  (void)sdallocx;
  257|       |  free(ptr);
  258|       |#else
  259|  3.71M|  if (sdallocx) {
  ------------------
  |  Branch (259:7): [Folded - Ignored]
  ------------------
  260|      0|    sdallocx(ptr, size + OPENSSL_MALLOC_PREFIX, 0 /* flags */);
  ------------------
  |  |   39|      0|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  261|  3.71M|  } else {
  262|  3.71M|    free(ptr);
  263|  3.71M|  }
  264|  3.71M|#endif
  265|  3.71M|}
OPENSSL_realloc:
  267|   148k|void *OPENSSL_realloc(void *orig_ptr, size_t new_size) {
  268|   148k|  if (orig_ptr == NULL) {
  ------------------
  |  Branch (268:7): [True: 56.2k, False: 91.8k]
  ------------------
  269|  56.2k|    return OPENSSL_malloc(new_size);
  270|  56.2k|  }
  271|       |
  272|  91.8k|  size_t old_size;
  273|  91.8k|  if (OPENSSL_memory_get_size != NULL) {
  ------------------
  |  Branch (273:7): [True: 0, False: 91.8k]
  ------------------
  274|      0|    old_size = OPENSSL_memory_get_size(orig_ptr);
  275|  91.8k|  } else {
  276|  91.8k|    void *ptr = ((uint8_t *)orig_ptr) - OPENSSL_MALLOC_PREFIX;
  ------------------
  |  |   39|  91.8k|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  277|  91.8k|    __asan_unpoison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
  ------------------
  |  |   39|  91.8k|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  278|  91.8k|    old_size = *(size_t *)ptr;
  279|  91.8k|    __asan_poison_memory_region(ptr, OPENSSL_MALLOC_PREFIX);
  ------------------
  |  |   39|  91.8k|#define OPENSSL_MALLOC_PREFIX 8
  ------------------
  280|  91.8k|  }
  281|       |
  282|  91.8k|  void *ret = OPENSSL_malloc(new_size);
  283|  91.8k|  if (ret == NULL) {
  ------------------
  |  Branch (283:7): [True: 0, False: 91.8k]
  ------------------
  284|      0|    return NULL;
  285|      0|  }
  286|       |
  287|  91.8k|  size_t to_copy = new_size;
  288|  91.8k|  if (old_size < to_copy) {
  ------------------
  |  Branch (288:7): [True: 91.8k, False: 0]
  ------------------
  289|  91.8k|    to_copy = old_size;
  290|  91.8k|  }
  291|       |
  292|  91.8k|  memcpy(ret, orig_ptr, to_copy);
  293|  91.8k|  OPENSSL_free(orig_ptr);
  294|       |
  295|  91.8k|  return ret;
  296|  91.8k|}
OPENSSL_cleanse:
  298|  3.71M|void OPENSSL_cleanse(void *ptr, size_t len) {
  299|       |#if defined(OPENSSL_WINDOWS)
  300|       |  SecureZeroMemory(ptr, len);
  301|       |#else
  302|  3.71M|  OPENSSL_memset(ptr, 0, len);
  303|       |
  304|  3.71M|#if !defined(OPENSSL_NO_ASM)
  305|       |  /* As best as we can tell, this is sufficient to break any optimisations that
  306|       |     might try to eliminate "superfluous" memsets. If there's an easy way to
  307|       |     detect memset_s, it would be better to use that. */
  308|  3.71M|  __asm__ __volatile__("" : : "r"(ptr) : "memory");
  309|  3.71M|#endif
  310|  3.71M|#endif  // !OPENSSL_NO_ASM
  311|  3.71M|}
OPENSSL_isalpha:
  375|   341k|int OPENSSL_isalpha(int c) {
  376|   341k|  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
  ------------------
  |  Branch (376:11): [True: 20.2k, False: 320k]
  |  Branch (376:23): [True: 18.3k, False: 1.93k]
  |  Branch (376:37): [True: 233k, False: 88.9k]
  |  Branch (376:49): [True: 227k, False: 6.59k]
  ------------------
  377|   341k|}
OPENSSL_isdigit:
  379|   776k|int OPENSSL_isdigit(int c) { return c >= '0' && c <= '9'; }
  ------------------
  |  Branch (379:37): [True: 734k, False: 41.8k]
  |  Branch (379:49): [True: 705k, False: 28.8k]
  ------------------
OPENSSL_isxdigit:
  381|  5.66k|int OPENSSL_isxdigit(int c) {
  382|  5.66k|  return OPENSSL_isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
  ------------------
  |  Branch (382:10): [True: 459, False: 5.21k]
  |  Branch (382:33): [True: 3.51k, False: 1.69k]
  |  Branch (382:45): [True: 2.93k, False: 579]
  |  Branch (382:59): [True: 1.92k, False: 349]
  |  Branch (382:71): [True: 1.32k, False: 594]
  ------------------
  383|  5.66k|}
OPENSSL_isalnum:
  401|   341k|int OPENSSL_isalnum(int c) { return OPENSSL_isalpha(c) || OPENSSL_isdigit(c); }
  ------------------
  |  Branch (401:37): [True: 245k, False: 95.5k]
  |  Branch (401:59): [True: 30.0k, False: 65.5k]
  ------------------
OPENSSL_tolower:
  403|   337k|int OPENSSL_tolower(int c) {
  404|   337k|  if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (404:7): [True: 337k, False: 0]
  |  Branch (404:19): [True: 112k, False: 224k]
  ------------------
  405|   112k|    return c + ('a' - 'A');
  406|   112k|  }
  407|   224k|  return c;
  408|   337k|}
OPENSSL_isspace:
  410|   562k|int OPENSSL_isspace(int c) {
  411|   562k|  return c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r' ||
  ------------------
  |  Branch (411:10): [True: 0, False: 562k]
  |  Branch (411:23): [True: 0, False: 562k]
  |  Branch (411:36): [True: 0, False: 562k]
  |  Branch (411:49): [True: 0, False: 562k]
  |  Branch (411:62): [True: 0, False: 562k]
  ------------------
  412|   562k|         c == ' ';
  ------------------
  |  Branch (412:10): [True: 56.2k, False: 506k]
  ------------------
  413|   562k|}
OPENSSL_vasprintf_internal:
  460|  8.86k|                               int system_malloc) {
  461|  8.86k|  void *(*allocate)(size_t) = system_malloc ? malloc : OPENSSL_malloc;
  ------------------
  |  Branch (461:31): [True: 8.86k, False: 0]
  ------------------
  462|  8.86k|  void (*deallocate)(void *) = system_malloc ? free : OPENSSL_free;
  ------------------
  |  Branch (462:32): [True: 8.86k, False: 0]
  ------------------
  463|  8.86k|  void *(*reallocate)(void *, size_t) =
  464|  8.86k|      system_malloc ? realloc : OPENSSL_realloc;
  ------------------
  |  Branch (464:7): [True: 8.86k, False: 0]
  ------------------
  465|  8.86k|  char *candidate = NULL;
  466|  8.86k|  size_t candidate_len = 64;  // TODO(bbe) what's the best initial size?
  467|  8.86k|  int ret;
  468|       |
  469|  8.86k|  if ((candidate = reinterpret_cast<char *>(allocate(candidate_len))) == NULL) {
  ------------------
  |  Branch (469:7): [True: 0, False: 8.86k]
  ------------------
  470|      0|    goto err;
  471|      0|  }
  472|  8.86k|  va_list args_copy;
  473|  8.86k|  va_copy(args_copy, args);
  474|  8.86k|  ret = vsnprintf(candidate, candidate_len, format, args_copy);
  475|  8.86k|  va_end(args_copy);
  476|  8.86k|  if (ret < 0) {
  ------------------
  |  Branch (476:7): [True: 0, False: 8.86k]
  ------------------
  477|      0|    goto err;
  478|      0|  }
  479|  8.86k|  if ((size_t)ret >= candidate_len) {
  ------------------
  |  Branch (479:7): [True: 0, False: 8.86k]
  ------------------
  480|       |    // Too big to fit in allocation.
  481|      0|    char *tmp;
  482|       |
  483|      0|    candidate_len = (size_t)ret + 1;
  484|      0|    if ((tmp = reinterpret_cast<char *>(
  ------------------
  |  Branch (484:9): [True: 0, False: 0]
  ------------------
  485|      0|             reallocate(candidate, candidate_len))) == NULL) {
  486|      0|      goto err;
  487|      0|    }
  488|      0|    candidate = tmp;
  489|      0|    ret = vsnprintf(candidate, candidate_len, format, args);
  490|      0|  }
  491|       |  // At this point this should not happen unless vsnprintf is insane.
  492|  8.86k|  if (ret < 0 || (size_t)ret >= candidate_len) {
  ------------------
  |  Branch (492:7): [True: 0, False: 8.86k]
  |  Branch (492:18): [True: 0, False: 8.86k]
  ------------------
  493|      0|    goto err;
  494|      0|  }
  495|  8.86k|  *str = candidate;
  496|  8.86k|  return ret;
  497|       |
  498|      0|err:
  499|      0|  deallocate(candidate);
  500|      0|  *str = NULL;
  501|      0|  errno = ENOMEM;
  502|      0|  return -1;
  503|  8.86k|}
OPENSSL_memdup:
  559|   409k|void *OPENSSL_memdup(const void *data, size_t size) {
  560|   409k|  if (size == 0) {
  ------------------
  |  Branch (560:7): [True: 894, False: 408k]
  ------------------
  561|    894|    return NULL;
  562|    894|  }
  563|       |
  564|   408k|  void *ret = OPENSSL_malloc(size);
  565|   408k|  if (ret == NULL) {
  ------------------
  |  Branch (565:7): [True: 0, False: 408k]
  ------------------
  566|      0|    return NULL;
  567|      0|  }
  568|       |
  569|   408k|  OPENSSL_memcpy(ret, data, size);
  570|   408k|  return ret;
  571|   408k|}
mem.cc:_ZL22should_fail_allocationv:
  182|  3.71M|static int should_fail_allocation(void) { return 0; }
mem.cc:_ZL27__asan_poison_memory_regionPKvm:
   48|  3.80M|static void __asan_poison_memory_region(const void *addr, size_t size) {}
mem.cc:_ZL29__asan_unpoison_memory_regionPKvm:
   49|  3.80M|static void __asan_unpoison_memory_region(const void *addr, size_t size) {}

_ZNK4bssl5ArrayIhE4sizeEv:
  105|  13.1k|  size_t size() const { return size_; }
_ZNK4bssl5ArrayIhE4dataEv:
  103|  13.1k|  const T *data() const { return data_; }
_ZN4bssl6VectorINSt3__110unique_ptrINS_15ECHServerConfigENS_8internal7DeleterEEEE5clearEv:
  282|  13.8k|  void clear() {
  283|  13.8k|    std::destroy_n(data_, size_);
  284|  13.8k|    OPENSSL_free(data_);
  285|  13.8k|    data_ = nullptr;
  286|  13.8k|    size_ = 0;
  287|  13.8k|    capacity_ = 0;
  288|  13.8k|  }
_ZN4bssl8internal11DeleterImplINS_15ECHServerConfigEvE4FreeEPS2_:
   71|  12.0k|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_15ECHServerConfigEEEvPT_:
   59|  12.0k|void Delete(T *t) {
   60|  12.0k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 12.0k, False: 0]
  ------------------
   61|  12.0k|    t->~T();
   62|  12.0k|    OPENSSL_free(t);
   63|  12.0k|  }
   64|  12.0k|}
_ZN4bssl5ArrayIhE5ResetEv:
  139|   235k|  void Reset() { Reset(nullptr, 0); }
_ZN4bssl5ArrayIhE5ResetEPhm:
  143|   235k|  void Reset(T *new_data, size_t new_size) {
  144|   235k|    std::destroy_n(data_, size_);
  145|   235k|    OPENSSL_free(data_);
  146|   235k|    data_ = new_data;
  147|   235k|    size_ = new_size;
  148|   235k|  }
_ZN4bssl5ArrayIhEC2Ev:
   90|   222k|  Array() {}
_ZN4bssl5ArrayIhED2Ev:
   94|   222k|  ~Array() { Reset(); }
_ZN4bssl5ArrayIhE8CopyFromENS_4SpanIKhEE:
  184|  13.5k|  [[nodiscard]] bool CopyFrom(Span<const T> in) {
  185|  13.5k|    if (!InitUninitialized(in.size())) {
  ------------------
  |  Branch (185:9): [True: 0, False: 13.5k]
  ------------------
  186|      0|      return false;
  187|      0|    }
  188|  13.5k|    std::uninitialized_copy(in.begin(), in.end(), data_);
  189|  13.5k|    return true;
  190|  13.5k|  }
_ZN4bssl5ArrayIhE17InitUninitializedEm:
  206|  13.5k|  bool InitUninitialized(size_t new_size) {
  207|  13.5k|    Reset();
  208|  13.5k|    if (new_size == 0) {
  ------------------
  |  Branch (208:9): [True: 5.05k, False: 8.49k]
  ------------------
  209|  5.05k|      return true;
  210|  5.05k|    }
  211|       |
  212|  8.49k|    if (new_size > SIZE_MAX / sizeof(T)) {
  ------------------
  |  Branch (212:9): [True: 0, False: 8.49k]
  ------------------
  213|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  214|      0|      return false;
  215|      0|    }
  216|  8.49k|    data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
  217|  8.49k|    if (data_ == nullptr) {
  ------------------
  |  Branch (217:9): [True: 0, False: 8.49k]
  ------------------
  218|      0|      return false;
  219|      0|    }
  220|  8.49k|    size_ = new_size;
  221|  8.49k|    return true;
  222|  8.49k|  }
_ZN4bssl3NewI15ssl_ech_keys_stJEEEPT_DpOT0_:
   47|  13.8k|T *New(Args &&...args) {
   48|  13.8k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  13.8k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 13.8k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  13.8k|  return new (t) T(std::forward<Args>(args)...);
   53|  13.8k|}
_ZN4bssl6VectorINSt3__110unique_ptrINS_15ECHServerConfigENS_8internal7DeleterEEEEC2Ev:
  232|  13.8k|  Vector() = default;
_ZN4bssl6VectorINSt3__110unique_ptrINS_15ECHServerConfigENS_8internal7DeleterEEEED2Ev:
  235|  13.8k|  ~Vector() { clear(); }
_ZN4bssl10MakeUniqueINS_15ECHServerConfigEJEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  12.0k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  12.0k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  12.0k|}
_ZN4bssl3NewINS_15ECHServerConfigEJEEEPT_DpOT0_:
   47|  12.0k|T *New(Args &&...args) {
   48|  12.0k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  12.0k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 12.0k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  12.0k|  return new (t) T(std::forward<Args>(args)...);
   53|  12.0k|}
_ZN4bssl5ArrayItEC2Ev:
   90|  82.0k|  Array() {}
_ZN4bssl5ArrayItE16InitForOverwriteEm:
  174|  29.0k|  [[nodiscard]] bool InitForOverwrite(size_t new_size) {
  175|  29.0k|    if (!InitUninitialized(new_size)) {
  ------------------
  |  Branch (175:9): [True: 0, False: 29.0k]
  ------------------
  176|      0|      return false;
  177|      0|    }
  178|  29.0k|    std::uninitialized_default_construct_n(data_, size_);
  179|  29.0k|    return true;
  180|  29.0k|  }
_ZN4bssl5ArrayItE17InitUninitializedEm:
  206|  49.6k|  bool InitUninitialized(size_t new_size) {
  207|  49.6k|    Reset();
  208|  49.6k|    if (new_size == 0) {
  ------------------
  |  Branch (208:9): [True: 21.3k, False: 28.3k]
  ------------------
  209|  21.3k|      return true;
  210|  21.3k|    }
  211|       |
  212|  28.3k|    if (new_size > SIZE_MAX / sizeof(T)) {
  ------------------
  |  Branch (212:9): [True: 0, False: 28.3k]
  ------------------
  213|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  214|      0|      return false;
  215|      0|    }
  216|  28.3k|    data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
  217|  28.3k|    if (data_ == nullptr) {
  ------------------
  |  Branch (217:9): [True: 0, False: 28.3k]
  ------------------
  218|      0|      return false;
  219|      0|    }
  220|  28.3k|    size_ = new_size;
  221|  28.3k|    return true;
  222|  28.3k|  }
_ZN4bssl5ArrayItE5ResetEv:
  139|   138k|  void Reset() { Reset(nullptr, 0); }
_ZN4bssl5ArrayItE5ResetEPtm:
  143|   138k|  void Reset(T *new_data, size_t new_size) {
  144|   138k|    std::destroy_n(data_, size_);
  145|   138k|    OPENSSL_free(data_);
  146|   138k|    data_ = new_data;
  147|   138k|    size_ = new_size;
  148|   138k|  }
_ZNK4bssl5ArrayItE4sizeEv:
  105|  49.5k|  size_t size() const { return size_; }
_ZN4bssl5ArrayItEixEm:
  112|  76.0k|  T &operator[](size_t i) {
  113|  76.0k|    BSSL_CHECK(i < size_);
  ------------------
  |  |  384|  76.0k|  do {                        \
  |  |  385|  76.0k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 76.0k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  76.0k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  114|  76.0k|    return data_[i];
  115|  76.0k|  }
_ZN4bssl5ArrayItE5beginEv:
  134|  3.60k|  T *begin() { return data_; }
_ZN4bssl5ArrayItE3endEv:
  136|  3.60k|  T *end() { return data_ + size_; }
_ZN4bssl5ArrayItED2Ev:
   94|  82.0k|  ~Array() { Reset(); }
_ZNK4bssl5ArrayItE4dataEv:
  103|  14.6k|  const T *data() const { return data_; }
_ZN4bssl13InplaceVectorIhLm12EE4dataEv:
  398|  19.5k|  T *data() { return reinterpret_cast<T *>(storage_); }
_ZN4bssl6VectorINSt3__110unique_ptrI17ssl_credential_stNS_8internal7DeleterEEEE5beginEv:
  277|  4.88k|  T *begin() { return data_; }
_ZN4bssl6VectorINSt3__110unique_ptrI17ssl_credential_stNS_8internal7DeleterEEEE3endEv:
  279|  4.88k|  T *end() { return data_ + size_; }
_ZN4bssl5ArrayItEaSEOS1_:
   97|  6.74k|  Array &operator=(Array &&other) {
   98|  6.74k|    Reset();
   99|  6.74k|    other.Release(&data_, &size_);
  100|  6.74k|    return *this;
  101|  6.74k|  }
_ZN4bssl5ArrayItE7ReleaseEPPtPm:
  152|  6.74k|  void Release(T **out, size_t *out_size) {
  153|  6.74k|    *out = data_;
  154|  6.74k|    *out_size = size_;
  155|  6.74k|    data_ = nullptr;
  156|  6.74k|    size_ = 0;
  157|  6.74k|  }
_ZNK4bssl5ArrayItE5emptyEv:
  106|  1.77k|  bool empty() const { return size_ == 0; }
_ZN4bssl13InplaceVectorIhLm32EE6ShrinkEm:
  444|  20.6k|  void Shrink(size_t new_size) {
  445|  20.6k|    BSSL_CHECK(new_size <= size_);
  ------------------
  |  |  384|  20.6k|  do {                        \
  |  |  385|  20.6k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 20.6k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  20.6k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  446|  20.6k|    std::destroy_n(data() + new_size, size_ - new_size);
  447|  20.6k|    size_ = static_cast<PackedSize<N>>(new_size);
  448|  20.6k|  }
_ZN4bssl13InplaceVectorIhLm32EE8capacityEv:
  400|  7.39k|  static constexpr size_t capacity() { return N; }
_ZN4bssl13InplaceVectorIhLm32EE4dataEv:
  398|  26.7k|  T *data() { return reinterpret_cast<T *>(storage_); }
_ZN4bssl13InplaceVectorIhLm48EE4dataEv:
  398|  48.8k|  T *data() { return reinterpret_cast<T *>(storage_); }
_ZN4bssl13InplaceVectorIhLm48EE6ShrinkEm:
  444|  48.8k|  void Shrink(size_t new_size) {
  445|  48.8k|    BSSL_CHECK(new_size <= size_);
  ------------------
  |  |  384|  48.8k|  do {                        \
  |  |  385|  48.8k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 48.8k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  48.8k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  446|  48.8k|    std::destroy_n(data() + new_size, size_ - new_size);
  447|  48.8k|    size_ = static_cast<PackedSize<N>>(new_size);
  448|  48.8k|  }
_ZN4bssl13InplaceVectorIhLm48EEC2Ev:
  380|  48.8k|  InplaceVector() = default;
_ZN4bssl13InplaceVectorIhLm32EEC2Ev:
  380|  14.6k|  InplaceVector() = default;
_ZN4bssl13InplaceVectorIhLm48EED2Ev:
  383|  48.8k|  ~InplaceVector() { clear(); }
_ZN4bssl13InplaceVectorIhLm48EE5clearEv:
  434|  48.8k|  void clear() { Shrink(0); }
_ZN4bssl13InplaceVectorIhLm32EED2Ev:
  383|  14.6k|  ~InplaceVector() { clear(); }
_ZN4bssl13InplaceVectorIhLm32EE5clearEv:
  434|  20.6k|  void clear() { Shrink(0); }
_ZN4bssl10MakeUniqueINS_13SSL_HANDSHAKEEJRP6ssl_stEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewINS_13SSL_HANDSHAKEEJRP6ssl_stEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl8internal11DeleterImplINS_13SSL_HANDSHAKEEvE4FreeEPS2_:
   71|  4.88k|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_13SSL_HANDSHAKEEEEvPT_:
   59|  4.88k|void Delete(T *t) {
   60|  4.88k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 4.88k, False: 0]
  ------------------
   61|  4.88k|    t->~T();
   62|  4.88k|    OPENSSL_free(t);
   63|  4.88k|  }
   64|  4.88k|}
_ZN4bssl13InplaceVectorIhLm12EE5clearEv:
  434|  19.5k|  void clear() { Shrink(0); }
_ZN4bssl13InplaceVectorIhLm12EE6ShrinkEm:
  444|  19.5k|  void Shrink(size_t new_size) {
  445|  19.5k|    BSSL_CHECK(new_size <= size_);
  ------------------
  |  |  384|  19.5k|  do {                        \
  |  |  385|  19.5k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 19.5k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  19.5k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  446|  19.5k|    std::destroy_n(data() + new_size, size_ - new_size);
  447|  19.5k|    size_ = static_cast<PackedSize<N>>(new_size);
  448|  19.5k|  }
_ZN4bssl13InplaceVectorIhLm32EEaSERKS1_:
  384|  4.88k|  InplaceVector &operator=(const InplaceVector &other) {
  385|  4.88k|    if (this != &other) {
  ------------------
  |  Branch (385:9): [True: 4.88k, False: 0]
  ------------------
  386|  4.88k|      CopyFrom(other);
  387|  4.88k|    }
  388|  4.88k|    return *this;
  389|  4.88k|  }
_ZN4bssl13InplaceVectorIhLm32EE8CopyFromENS_4SpanIKhEE:
  512|  4.88k|  void CopyFrom(Span<const T> in) { BSSL_CHECK(TryCopyFrom(in)); }
  ------------------
  |  |  384|  4.88k|  do {                        \
  |  |  385|  4.88k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 4.88k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  4.88k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
_ZN4bssl13InplaceVectorIhLm32EE11TryCopyFromENS_4SpanIKhEE:
  484|  7.39k|  [[nodiscard]] bool TryCopyFrom(Span<const T> in) {
  485|  7.39k|    if (in.size() > capacity()) {
  ------------------
  |  Branch (485:9): [True: 1.36k, False: 6.03k]
  ------------------
  486|  1.36k|      return false;
  487|  1.36k|    }
  488|  6.03k|    clear();
  489|  6.03k|    std::uninitialized_copy(in.begin(), in.end(), data());
  490|  6.03k|    size_ = in.size();
  491|  6.03k|    return true;
  492|  7.39k|  }
_ZNK4bssl13InplaceVectorIhLm32EE4dataEv:
  397|  4.88k|  const T *data() const { return reinterpret_cast<const T *>(storage_); }
_ZNK4bssl13InplaceVectorIhLm32EE4sizeEv:
  399|  4.88k|  size_t size() const { return size_; }
_ZN4bssl13InplaceVectorIhLm12EEC2Ev:
  380|  19.5k|  InplaceVector() = default;
_ZN4bssl13InplaceVectorIhLm12EED2Ev:
  383|  19.5k|  ~InplaceVector() { clear(); }
_ZN4bssl10MakeUniqueINS_14SSLAEADContextEJDnEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  9.77k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  9.77k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  9.77k|}
_ZN4bssl3NewINS_14SSLAEADContextEJDnEEEPT_DpOT0_:
   47|  9.77k|T *New(Args &&...args) {
   48|  9.77k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  9.77k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 9.77k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  9.77k|  return new (t) T(std::forward<Args>(args)...);
   53|  9.77k|}
_ZN4bssl8internal11DeleterImplINS_14SSLAEADContextEvE4FreeEPS2_:
   71|  9.77k|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_14SSLAEADContextEEEvPT_:
   59|  9.77k|void Delete(T *t) {
   60|  9.77k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 9.77k, False: 0]
  ------------------
   61|  9.77k|    t->~T();
   62|  9.77k|    OPENSSL_free(t);
   63|  9.77k|  }
   64|  9.77k|}
_ZN4bssl6VectorINSt3__110unique_ptrI17ssl_credential_stNS_8internal7DeleterEEEEC2Ev:
  232|  9.77k|  Vector() = default;
_ZN4bssl10MakeUniqueI17ssl_credential_stJNS_17SSLCredentialTypeEEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  9.77k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  9.77k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  9.77k|}
_ZN4bssl3NewI17ssl_credential_stJNS_17SSLCredentialTypeEEEEPT_DpOT0_:
   47|  9.77k|T *New(Args &&...args) {
   48|  9.77k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  9.77k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 9.77k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  9.77k|  return new (t) T(std::forward<Args>(args)...);
   53|  9.77k|}
_ZN4bssl6VectorINSt3__110unique_ptrI17ssl_credential_stNS_8internal7DeleterEEEED2Ev:
  235|  9.77k|  ~Vector() { clear(); }
_ZN4bssl10MakeUniqueINS_4CERTEJRPKNS_15SSL_X509_METHODEEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewINS_4CERTEJRPKNS_15SSL_X509_METHODEEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl8internal11DeleterImplINS_4CERTEvE4FreeEPS2_:
   71|  9.77k|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_4CERTEEEvPT_:
   59|  9.77k|void Delete(T *t) {
   60|  9.77k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 9.77k, False: 0]
  ------------------
   61|  9.77k|    t->~T();
   62|  9.77k|    OPENSSL_free(t);
   63|  9.77k|  }
   64|  9.77k|}
_ZN4bssl6VectorINSt3__110unique_ptrI17ssl_credential_stNS_8internal7DeleterEEEE5clearEv:
  282|  9.77k|  void clear() {
  283|  9.77k|    std::destroy_n(data_, size_);
  284|  9.77k|    OPENSSL_free(data_);
  285|  9.77k|    data_ = nullptr;
  286|  9.77k|    size_ = 0;
  287|  9.77k|    capacity_ = 0;
  288|  9.77k|  }
_ZN4bssl5ArrayIiEC2Ev:
   90|  8.53k|  Array() {}
_ZN4bssl5ArrayIiE4InitEm:
  163|  8.53k|  [[nodiscard]] bool Init(size_t new_size) {
  164|  8.53k|    if (!InitUninitialized(new_size)) {
  ------------------
  |  Branch (164:9): [True: 0, False: 8.53k]
  ------------------
  165|      0|      return false;
  166|      0|    }
  167|  8.53k|    std::uninitialized_value_construct_n(data_, size_);
  168|  8.53k|    return true;
  169|  8.53k|  }
_ZN4bssl5ArrayIiE17InitUninitializedEm:
  206|  8.53k|  bool InitUninitialized(size_t new_size) {
  207|  8.53k|    Reset();
  208|  8.53k|    if (new_size == 0) {
  ------------------
  |  Branch (208:9): [True: 0, False: 8.53k]
  ------------------
  209|      0|      return true;
  210|      0|    }
  211|       |
  212|  8.53k|    if (new_size > SIZE_MAX / sizeof(T)) {
  ------------------
  |  Branch (212:9): [True: 0, False: 8.53k]
  ------------------
  213|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  214|      0|      return false;
  215|      0|    }
  216|  8.53k|    data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
  217|  8.53k|    if (data_ == nullptr) {
  ------------------
  |  Branch (217:9): [True: 0, False: 8.53k]
  ------------------
  218|      0|      return false;
  219|      0|    }
  220|  8.53k|    size_ = new_size;
  221|  8.53k|    return true;
  222|  8.53k|  }
_ZN4bssl5ArrayIiE5ResetEv:
  139|  17.0k|  void Reset() { Reset(nullptr, 0); }
_ZN4bssl5ArrayIiE5ResetEPim:
  143|  17.0k|  void Reset(T *new_data, size_t new_size) {
  144|  17.0k|    std::destroy_n(data_, size_);
  145|  17.0k|    OPENSSL_free(data_);
  146|  17.0k|    data_ = new_data;
  147|  17.0k|    size_ = new_size;
  148|  17.0k|  }
_ZN4bssl5ArrayIiEixEm:
  112|  1.53M|  T &operator[](size_t i) {
  113|  1.53M|    BSSL_CHECK(i < size_);
  ------------------
  |  |  384|  1.53M|  do {                        \
  |  |  385|  1.53M|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 1.53M]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|  1.53M|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  114|  1.53M|    return data_[i];
  115|  1.53M|  }
_ZN4bssl5ArrayIiED2Ev:
   94|  8.53k|  ~Array() { Reset(); }
_ZNK4bssl5ArrayIbE4dataEv:
  103|  17.5k|  const T *data() const { return data_; }
_ZNK4bssl5ArrayIbE4sizeEv:
  105|  17.5k|  size_t size() const { return size_; }
_ZN4bssl5ArrayIbEC2Ev:
   90|  35.1k|  Array() {}
_ZN4bssl5ArrayIbED2Ev:
   94|  35.1k|  ~Array() { Reset(); }
_ZN4bssl5ArrayIbE5ResetEv:
  139|  70.2k|  void Reset() { Reset(nullptr, 0); }
_ZN4bssl5ArrayIbE5ResetEPbm:
  143|  70.2k|  void Reset(T *new_data, size_t new_size) {
  144|  70.2k|    std::destroy_n(data_, size_);
  145|  70.2k|    OPENSSL_free(data_);
  146|  70.2k|    data_ = new_data;
  147|  70.2k|    size_ = new_size;
  148|  70.2k|  }
_ZN4bssl5ArrayIbE8CopyFromENS_4SpanIKbEE:
  184|  17.5k|  [[nodiscard]] bool CopyFrom(Span<const T> in) {
  185|  17.5k|    if (!InitUninitialized(in.size())) {
  ------------------
  |  Branch (185:9): [True: 0, False: 17.5k]
  ------------------
  186|      0|      return false;
  187|      0|    }
  188|  17.5k|    std::uninitialized_copy(in.begin(), in.end(), data_);
  189|  17.5k|    return true;
  190|  17.5k|  }
_ZN4bssl5ArrayIbE17InitUninitializedEm:
  206|  35.1k|  bool InitUninitialized(size_t new_size) {
  207|  35.1k|    Reset();
  208|  35.1k|    if (new_size == 0) {
  ------------------
  |  Branch (208:9): [True: 7.61k, False: 27.5k]
  ------------------
  209|  7.61k|      return true;
  210|  7.61k|    }
  211|       |
  212|  27.5k|    if (new_size > SIZE_MAX / sizeof(T)) {
  ------------------
  |  Branch (212:9): [True: 0, False: 27.5k]
  ------------------
  213|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  214|      0|      return false;
  215|      0|    }
  216|  27.5k|    data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
  217|  27.5k|    if (data_ == nullptr) {
  ------------------
  |  Branch (217:9): [True: 0, False: 27.5k]
  ------------------
  218|      0|      return false;
  219|      0|    }
  220|  27.5k|    size_ = new_size;
  221|  27.5k|    return true;
  222|  27.5k|  }
_ZN4bssl5ArrayIbE7ReleaseEPPbPm:
  152|  17.5k|  void Release(T **out, size_t *out_size) {
  153|  17.5k|    *out = data_;
  154|  17.5k|    *out_size = size_;
  155|  17.5k|    data_ = nullptr;
  156|  17.5k|    size_ = 0;
  157|  17.5k|  }
_ZN4bssl5ArrayIbE16InitForOverwriteEm:
  174|  17.5k|  [[nodiscard]] bool InitForOverwrite(size_t new_size) {
  175|  17.5k|    if (!InitUninitialized(new_size)) {
  ------------------
  |  Branch (175:9): [True: 0, False: 17.5k]
  ------------------
  176|      0|      return false;
  177|      0|    }
  178|  17.5k|    std::uninitialized_default_construct_n(data_, size_);
  179|  17.5k|    return true;
  180|  17.5k|  }
_ZN4bssl5ArrayIbEixEm:
  112|   159k|  T &operator[](size_t i) {
  113|   159k|    BSSL_CHECK(i < size_);
  ------------------
  |  |  384|   159k|  do {                        \
  |  |  385|   159k|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 159k]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|   159k|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  114|   159k|    return data_[i];
  115|   159k|  }
_ZN4bssl5ArrayIbE6ShrinkEm:
  194|  17.5k|  void Shrink(size_t new_size) {
  195|  17.5k|    if (new_size > size_) {
  ------------------
  |  Branch (195:9): [True: 0, False: 17.5k]
  ------------------
  196|      0|      abort();
  197|      0|    }
  198|  17.5k|    std::destroy_n(data_ + new_size, size_ - new_size);
  199|  17.5k|    size_ = new_size;
  200|  17.5k|  }
_ZN4bssl10MakeUniqueINS_23SSLCipherPreferenceListEJEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  17.5k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  17.5k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  17.5k|}
_ZN4bssl3NewINS_23SSLCipherPreferenceListEJEEEPT_DpOT0_:
   47|  17.5k|T *New(Args &&...args) {
   48|  17.5k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  17.5k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 17.5k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  17.5k|  return new (t) T(std::forward<Args>(args)...);
   53|  17.5k|}
_ZN4bssl8internal11DeleterImplINS_23SSLCipherPreferenceListEvE4FreeEPS2_:
   71|  17.5k|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_23SSLCipherPreferenceListEEEvPT_:
   59|  17.5k|void Delete(T *t) {
   60|  17.5k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 17.5k, False: 0]
  ------------------
   61|  17.5k|    t->~T();
   62|  17.5k|    OPENSSL_free(t);
   63|  17.5k|  }
   64|  17.5k|}
_ZN4bssl10MakeUniqueI17ssl_credential_stJRKNS_17SSLCredentialTypeEEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewI17ssl_credential_stJRKNS_17SSLCredentialTypeEEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl5ArrayItE8CopyFromENS_4SpanIKtEE:
  184|  20.6k|  [[nodiscard]] bool CopyFrom(Span<const T> in) {
  185|  20.6k|    if (!InitUninitialized(in.size())) {
  ------------------
  |  Branch (185:9): [True: 0, False: 20.6k]
  ------------------
  186|      0|      return false;
  187|      0|    }
  188|  20.6k|    std::uninitialized_copy(in.begin(), in.end(), data_);
  189|  20.6k|    return true;
  190|  20.6k|  }
_ZN4bssl6VectorINS_18CertCompressionAlgEEC2Ev:
  232|  4.88k|  Vector() = default;
_ZN4bssl6VectorINS_10ALPSConfigEEC2Ev:
  232|  4.88k|  Vector() = default;
_ZN4bssl8internal11DeleterImplINS_10SSL_CONFIGEvE4FreeEPS2_:
   71|  4.88k|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_10SSL_CONFIGEEEvPT_:
   59|  4.88k|void Delete(T *t) {
   60|  4.88k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 4.88k, False: 0]
  ------------------
   61|  4.88k|    t->~T();
   62|  4.88k|    OPENSSL_free(t);
   63|  4.88k|  }
   64|  4.88k|}
_ZN4bssl6VectorINS_18CertCompressionAlgEED2Ev:
  235|  4.88k|  ~Vector() { clear(); }
_ZN4bssl6VectorINS_18CertCompressionAlgEE5clearEv:
  282|  4.88k|  void clear() {
  283|  4.88k|    std::destroy_n(data_, size_);
  284|  4.88k|    OPENSSL_free(data_);
  285|  4.88k|    data_ = nullptr;
  286|  4.88k|    size_ = 0;
  287|  4.88k|    capacity_ = 0;
  288|  4.88k|  }
_ZN4bssl10MakeUniqueI10ssl_ctx_stJRPK13ssl_method_stEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewI10ssl_ctx_stJRPK13ssl_method_stEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl10MakeUniqueINS_4CERTEJRKPKNS_15SSL_X509_METHODEEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewINS_4CERTEJRKPKNS_15SSL_X509_METHODEEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl10MakeUniqueI6ssl_stJRP10ssl_ctx_stEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewI6ssl_stJRP10ssl_ctx_stEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl10MakeUniqueINS_10SSL_CONFIGEJP6ssl_stEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewINS_10SSL_CONFIGEJP6ssl_stEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl6VectorINS_10ALPSConfigEED2Ev:
  235|  4.88k|  ~Vector() { clear(); }
_ZN4bssl6VectorINS_10ALPSConfigEE5clearEv:
  282|  4.88k|  void clear() {
  283|  4.88k|    std::destroy_n(data_, size_);
  284|  4.88k|    OPENSSL_free(data_);
  285|  4.88k|    data_ = nullptr;
  286|  4.88k|    size_ = 0;
  287|  4.88k|    capacity_ = 0;
  288|  4.88k|  }
_ZN4bssl6DeleteI6ssl_stEEvPT_:
   59|  4.88k|void Delete(T *t) {
   60|  4.88k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 4.88k, False: 0]
  ------------------
   61|  4.88k|    t->~T();
   62|  4.88k|    OPENSSL_free(t);
   63|  4.88k|  }
   64|  4.88k|}
_ZN4bssl10MakeUniqueINS_9TicketKeyEJEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|    389|UniquePtr<T> MakeUnique(Args &&...args) {
   79|    389|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|    389|}
_ZN4bssl3NewINS_9TicketKeyEJEEEPT_DpOT0_:
   47|    389|T *New(Args &&...args) {
   48|    389|  void *t = OPENSSL_malloc(sizeof(T));
   49|    389|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 389]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|    389|  return new (t) T(std::forward<Args>(args)...);
   53|    389|}
_ZN4bssl8internal11DeleterImplINS_9TicketKeyEvE4FreeEPS2_:
   71|    389|  static void Free(T *t) { Delete(t); }
_ZN4bssl6DeleteINS_9TicketKeyEEEvPT_:
   59|    389|void Delete(T *t) {
   60|    389|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 389, False: 0]
  ------------------
   61|    389|    t->~T();
   62|    389|    OPENSSL_free(t);
   63|    389|  }
   64|    389|}
_ZN4bssl5ArrayItE6ShrinkEm:
  194|  3.17k|  void Shrink(size_t new_size) {
  195|  3.17k|    if (new_size > size_) {
  ------------------
  |  Branch (195:9): [True: 0, False: 3.17k]
  ------------------
  196|      0|      abort();
  197|      0|    }
  198|  3.17k|    std::destroy_n(data_ + new_size, size_ - new_size);
  199|  3.17k|    size_ = new_size;
  200|  3.17k|  }
_ZN4bssl5ArrayItE4dataEv:
  104|  3.32k|  T *data() { return data_; }
_ZN4bssl10MakeUniqueINS_10SSL3_STATEEJEEENSt3__110unique_ptrIT_NS_8internal7DeleterEEEDpOT0_:
   78|  4.88k|UniquePtr<T> MakeUnique(Args &&...args) {
   79|  4.88k|  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
   80|  4.88k|}
_ZN4bssl3NewINS_10SSL3_STATEEJEEEPT_DpOT0_:
   47|  4.88k|T *New(Args &&...args) {
   48|  4.88k|  void *t = OPENSSL_malloc(sizeof(T));
   49|  4.88k|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 4.88k]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|  4.88k|  return new (t) T(std::forward<Args>(args)...);
   53|  4.88k|}
_ZN4bssl6DeleteINS_10SSL3_STATEEEEvPT_:
   59|  4.88k|void Delete(T *t) {
   60|  4.88k|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 4.88k, False: 0]
  ------------------
   61|  4.88k|    t->~T();
   62|  4.88k|    OPENSSL_free(t);
   63|  4.88k|  }
   64|  4.88k|}
_ZN4bssl3NewI10bignum_ctxJEEEPT_DpOT0_:
   47|      2|T *New(Args &&...args) {
   48|      2|  void *t = OPENSSL_malloc(sizeof(T));
   49|      2|  if (t == nullptr) {
  ------------------
  |  Branch (49:7): [True: 0, False: 2]
  ------------------
   50|      0|    return nullptr;
   51|      0|  }
   52|      2|  return new (t) T(std::forward<Args>(args)...);
   53|      2|}
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEEC2Ev:
  232|      2|  Vector() = default;
_ZN4bssl6VectorImEC2Ev:
  232|      2|  Vector() = default;
_ZN4bssl6DeleteI10bignum_ctxEEvPT_:
   59|      2|void Delete(T *t) {
   60|      2|  if (t != nullptr) {
  ------------------
  |  Branch (60:7): [True: 2, False: 0]
  ------------------
   61|      2|    t->~T();
   62|      2|    OPENSSL_free(t);
   63|      2|  }
   64|      2|}
_ZN4bssl6VectorImED2Ev:
  235|      2|  ~Vector() { clear(); }
_ZN4bssl6VectorImE5clearEv:
  282|      4|  void clear() {
  283|      4|    std::destroy_n(data_, size_);
  284|      4|    OPENSSL_free(data_);
  285|      4|    data_ = nullptr;
  286|      4|    size_ = 0;
  287|      4|    capacity_ = 0;
  288|      4|  }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEED2Ev:
  235|      2|  ~Vector() { clear(); }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEE5clearEv:
  282|      4|  void clear() {
  283|      4|    std::destroy_n(data_, size_);
  284|      4|    OPENSSL_free(data_);
  285|      4|    data_ = nullptr;
  286|      4|    size_ = 0;
  287|      4|    capacity_ = 0;
  288|      4|  }
_ZN4bssl6VectorImE4PushEm:
  298|     26|  [[nodiscard]] bool Push(T elem) {
  299|     26|    if (!MaybeGrow()) {
  ------------------
  |  Branch (299:9): [True: 0, False: 26]
  ------------------
  300|      0|      return false;
  301|      0|    }
  302|     26|    new (&data_[size_]) T(std::move(elem));
  303|     26|    size_++;
  304|     26|    return true;
  305|     26|  }
_ZN4bssl6VectorImE9MaybeGrowEv:
  324|     26|  bool MaybeGrow() {
  325|       |    // No need to grow if we have room for one more T.
  326|     26|    if (size_ < capacity_) {
  ------------------
  |  Branch (326:9): [True: 24, False: 2]
  ------------------
  327|     24|      return true;
  328|     24|    }
  329|      2|    size_t new_capacity = kDefaultSize;
  330|      2|    if (capacity_ > 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 2]
  ------------------
  331|       |      // Double the array's size if it's safe to do so.
  332|      0|      if (capacity_ > SIZE_MAX / 2) {
  ------------------
  |  Branch (332:11): [True: 0, False: 0]
  ------------------
  333|      0|        OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  334|      0|        return false;
  335|      0|      }
  336|      0|      new_capacity = capacity_ * 2;
  337|      0|    }
  338|      2|    if (new_capacity > SIZE_MAX / sizeof(T)) {
  ------------------
  |  Branch (338:9): [True: 0, False: 2]
  ------------------
  339|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  340|      0|      return false;
  341|      0|    }
  342|      2|    T *new_data =
  343|      2|        reinterpret_cast<T *>(OPENSSL_malloc(new_capacity * sizeof(T)));
  344|      2|    if (new_data == nullptr) {
  ------------------
  |  Branch (344:9): [True: 0, False: 2]
  ------------------
  345|      0|      return false;
  346|      0|    }
  347|      2|    size_t new_size = size_;
  348|      2|    std::uninitialized_move(begin(), end(), new_data);
  349|      2|    clear();
  350|      2|    data_ = new_data;
  351|      2|    size_ = new_size;
  352|      2|    capacity_ = new_capacity;
  353|      2|    return true;
  354|      2|  }
_ZN4bssl6VectorImE5beginEv:
  277|      2|  T *begin() { return data_; }
_ZN4bssl6VectorImE3endEv:
  279|      2|  T *end() { return data_ + size_; }
_ZNK4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEE4sizeEv:
  248|     34|  size_t size() const { return size_; }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEE4PushES6_:
  298|      8|  [[nodiscard]] bool Push(T elem) {
  299|      8|    if (!MaybeGrow()) {
  ------------------
  |  Branch (299:9): [True: 0, False: 8]
  ------------------
  300|      0|      return false;
  301|      0|    }
  302|      8|    new (&data_[size_]) T(std::move(elem));
  303|      8|    size_++;
  304|      8|    return true;
  305|      8|  }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEE9MaybeGrowEv:
  324|      8|  bool MaybeGrow() {
  325|       |    // No need to grow if we have room for one more T.
  326|      8|    if (size_ < capacity_) {
  ------------------
  |  Branch (326:9): [True: 6, False: 2]
  ------------------
  327|      6|      return true;
  328|      6|    }
  329|      2|    size_t new_capacity = kDefaultSize;
  330|      2|    if (capacity_ > 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 2]
  ------------------
  331|       |      // Double the array's size if it's safe to do so.
  332|      0|      if (capacity_ > SIZE_MAX / 2) {
  ------------------
  |  Branch (332:11): [True: 0, False: 0]
  ------------------
  333|      0|        OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  334|      0|        return false;
  335|      0|      }
  336|      0|      new_capacity = capacity_ * 2;
  337|      0|    }
  338|      2|    if (new_capacity > SIZE_MAX / sizeof(T)) {
  ------------------
  |  Branch (338:9): [True: 0, False: 2]
  ------------------
  339|      0|      OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  340|      0|      return false;
  341|      0|    }
  342|      2|    T *new_data =
  343|      2|        reinterpret_cast<T *>(OPENSSL_malloc(new_capacity * sizeof(T)));
  344|      2|    if (new_data == nullptr) {
  ------------------
  |  Branch (344:9): [True: 0, False: 2]
  ------------------
  345|      0|      return false;
  346|      0|    }
  347|      2|    size_t new_size = size_;
  348|      2|    std::uninitialized_move(begin(), end(), new_data);
  349|      2|    clear();
  350|      2|    data_ = new_data;
  351|      2|    size_ = new_size;
  352|      2|    capacity_ = new_capacity;
  353|      2|    return true;
  354|      2|  }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEE5beginEv:
  277|      2|  T *begin() { return data_; }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEE3endEv:
  279|      2|  T *end() { return data_ + size_; }
_ZN4bssl6VectorINSt3__110unique_ptrI9bignum_stNS_8internal7DeleterEEEEixEm:
  255|     34|  T &operator[](size_t i) {
  256|     34|    BSSL_CHECK(i < size_);
  ------------------
  |  |  384|     34|  do {                        \
  |  |  385|     34|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 34]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|     34|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  257|     34|    return data_[i];
  258|     34|  }
_ZNK4bssl6VectorImE5emptyEv:
  249|     26|  bool empty() const { return size_ == 0; }
_ZN4bssl6VectorImE4backEv:
  268|     26|  T &back() {
  269|     26|    BSSL_CHECK(size_ != 0);
  ------------------
  |  |  384|     26|  do {                        \
  |  |  385|     26|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 26]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|     26|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  270|     26|    return data_[size_ - 1];
  271|     26|  }
_ZN4bssl6VectorImE8pop_backEv:
  290|     26|  void pop_back() {
  291|     26|    BSSL_CHECK(size_ != 0);
  ------------------
  |  |  384|     26|  do {                        \
  |  |  385|     26|    if (!(condition)) {       \
  |  |  ------------------
  |  |  |  Branch (385:9): [True: 0, False: 26]
  |  |  ------------------
  |  |  386|      0|      abort();                \
  |  |  387|      0|    }                         \
  |  |  388|     26|  } while (0);
  |  |  ------------------
  |  |  |  Branch (388:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  292|     26|    std::destroy_at(&data_[size_ - 1]);
  293|     26|    size_--;
  294|     26|  }

OBJ_dup:
   53|   309k|ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) {
   54|   309k|  ASN1_OBJECT *r;
   55|   309k|  unsigned char *data = NULL;
   56|   309k|  char *sn = NULL, *ln = NULL;
   57|       |
   58|   309k|  if (o == NULL) {
  ------------------
  |  Branch (58:7): [True: 0, False: 309k]
  ------------------
   59|      0|    return NULL;
   60|      0|  }
   61|       |
   62|   309k|  if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC)) {
  ------------------
  |  |   55|   309k|#define ASN1_OBJECT_FLAG_DYNAMIC 0x01          // internal use
  ------------------
  |  Branch (62:7): [True: 0, False: 309k]
  ------------------
   63|       |    // TODO(fork): this is a little dangerous.
   64|      0|    return (ASN1_OBJECT *)o;
   65|      0|  }
   66|       |
   67|   309k|  r = ASN1_OBJECT_new();
   68|   309k|  if (r == NULL) {
  ------------------
  |  Branch (68:7): [True: 0, False: 309k]
  ------------------
   69|      0|    OPENSSL_PUT_ERROR(OBJ, ERR_R_ASN1_LIB);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   70|      0|    return NULL;
   71|      0|  }
   72|   309k|  r->ln = r->sn = NULL;
   73|       |
   74|       |  // once data is attached to an object, it remains const
   75|   309k|  r->data = reinterpret_cast<uint8_t *>(OPENSSL_memdup(o->data, o->length));
   76|   309k|  if (o->length != 0 && r->data == NULL) {
  ------------------
  |  Branch (76:7): [True: 309k, False: 0]
  |  Branch (76:25): [True: 0, False: 309k]
  ------------------
   77|      0|    goto err;
   78|      0|  }
   79|       |
   80|   309k|  r->length = o->length;
   81|   309k|  r->nid = o->nid;
   82|       |
   83|   309k|  if (o->ln != NULL) {
  ------------------
  |  Branch (83:7): [True: 0, False: 309k]
  ------------------
   84|      0|    ln = OPENSSL_strdup(o->ln);
   85|      0|    if (ln == NULL) {
  ------------------
  |  Branch (85:9): [True: 0, False: 0]
  ------------------
   86|      0|      goto err;
   87|      0|    }
   88|      0|  }
   89|       |
   90|   309k|  if (o->sn != NULL) {
  ------------------
  |  Branch (90:7): [True: 0, False: 309k]
  ------------------
   91|      0|    sn = OPENSSL_strdup(o->sn);
   92|      0|    if (sn == NULL) {
  ------------------
  |  Branch (92:9): [True: 0, False: 0]
  ------------------
   93|      0|      goto err;
   94|      0|    }
   95|      0|  }
   96|       |
   97|   309k|  r->sn = sn;
   98|   309k|  r->ln = ln;
   99|       |
  100|   309k|  r->flags =
  101|   309k|      o->flags | (ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  ------------------
  |  |   55|   309k|#define ASN1_OBJECT_FLAG_DYNAMIC 0x01          // internal use
  ------------------
                    o->flags | (ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  ------------------
  |  |   56|   309k|#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04  // internal use
  ------------------
  102|   309k|                  ASN1_OBJECT_FLAG_DYNAMIC_DATA);
  ------------------
  |  |   57|   309k|#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08     // internal use
  ------------------
  103|   309k|  return r;
  104|       |
  105|      0|err:
  106|      0|  OPENSSL_free(ln);
  107|      0|  OPENSSL_free(sn);
  108|      0|  OPENSSL_free(data);
  109|      0|  OPENSSL_free(r);
  110|      0|  return NULL;
  111|   309k|}
OBJ_get_undef:
  283|   309k|const ASN1_OBJECT *OBJ_get_undef(void) {
  284|   309k|  static const ASN1_OBJECT kUndef = {
  285|   309k|      /*sn=*/SN_undef,
  ------------------
  |  |   41|   309k|#define SN_undef "UNDEF"
  ------------------
  286|   309k|      /*ln=*/LN_undef,
  ------------------
  |  |   42|   309k|#define LN_undef "undefined"
  ------------------
  287|   309k|      /*nid=*/NID_undef,
  ------------------
  |  |   43|   309k|#define NID_undef 0
  ------------------
  288|   309k|      /*length=*/0,
  289|       |      /*data=*/NULL,
  290|   309k|      /*flags=*/0,
  291|   309k|  };
  292|   309k|  return &kUndef;
  293|   309k|}

CRYPTO_BUFFER_new:
  167|  43.4k|                                 CRYPTO_BUFFER_POOL *pool) {
  168|  43.4k|  return crypto_buffer_new(data, len, /*data_is_static=*/0, pool);
  169|  43.4k|}
CRYPTO_BUFFER_free:
  200|  97.6k|void CRYPTO_BUFFER_free(CRYPTO_BUFFER *buf) {
  201|  97.6k|  if (buf == NULL) {
  ------------------
  |  Branch (201:7): [True: 265, False: 97.3k]
  ------------------
  202|    265|    return;
  203|    265|  }
  204|       |
  205|  97.3k|  CRYPTO_BUFFER_POOL *const pool = buf->pool;
  206|  97.3k|  if (pool == NULL) {
  ------------------
  |  Branch (206:7): [True: 97.3k, False: 0]
  ------------------
  207|  97.3k|    if (CRYPTO_refcount_dec_and_test_zero(&buf->references)) {
  ------------------
  |  Branch (207:9): [True: 43.4k, False: 53.8k]
  ------------------
  208|       |      // If a reference count of zero is observed, there cannot be a reference
  209|       |      // from any pool to this buffer and thus we are able to free this
  210|       |      // buffer.
  211|  43.4k|      crypto_buffer_free_object(buf);
  212|  43.4k|    }
  213|       |
  214|  97.3k|    return;
  215|  97.3k|  }
  216|       |
  217|      0|  CRYPTO_MUTEX_lock_write(&pool->lock);
  218|      0|  if (!CRYPTO_refcount_dec_and_test_zero(&buf->references)) {
  ------------------
  |  Branch (218:7): [True: 0, False: 0]
  ------------------
  219|      0|    CRYPTO_MUTEX_unlock_write(&buf->pool->lock);
  220|      0|    return;
  221|      0|  }
  222|       |
  223|       |  // We have an exclusive lock on the pool, therefore no concurrent lookups can
  224|       |  // find this buffer and increment the reference count. Thus, if the count is
  225|       |  // zero there are and can never be any more references and thus we can free
  226|       |  // this buffer.
  227|       |  //
  228|       |  // Note it is possible |buf| is no longer in the pool, if it was replaced by a
  229|       |  // static version. If that static version was since removed, it is even
  230|       |  // possible for |found| to be NULL.
  231|      0|  CRYPTO_BUFFER *found = lh_CRYPTO_BUFFER_retrieve(pool->bufs, buf);
  232|      0|  if (found == buf) {
  ------------------
  |  Branch (232:7): [True: 0, False: 0]
  ------------------
  233|      0|    found = lh_CRYPTO_BUFFER_delete(pool->bufs, buf);
  234|      0|    assert(found == buf);
  235|      0|    (void)found;
  236|      0|  }
  237|       |
  238|      0|  CRYPTO_MUTEX_unlock_write(&buf->pool->lock);
  239|      0|  crypto_buffer_free_object(buf);
  240|      0|}
CRYPTO_BUFFER_up_ref:
  242|  53.8k|int CRYPTO_BUFFER_up_ref(CRYPTO_BUFFER *buf) {
  243|       |  // This is safe in the case that |buf->pool| is NULL because it's just
  244|       |  // standard reference counting in that case.
  245|       |  //
  246|       |  // This is also safe if |buf->pool| is non-NULL because, if it were racing
  247|       |  // with |CRYPTO_BUFFER_free| then the two callers must have independent
  248|       |  // references already and so the reference count will never hit zero.
  249|  53.8k|  CRYPTO_refcount_inc(&buf->references);
  250|  53.8k|  return 1;
  251|  53.8k|}
CRYPTO_BUFFER_data:
  253|  1.99M|const uint8_t *CRYPTO_BUFFER_data(const CRYPTO_BUFFER *buf) {
  254|  1.99M|  return buf->data;
  255|  1.99M|}
CRYPTO_BUFFER_len:
  257|  1.01M|size_t CRYPTO_BUFFER_len(const CRYPTO_BUFFER *buf) { return buf->len; }
CRYPTO_BUFFER_init_CBS:
  259|  9.86k|void CRYPTO_BUFFER_init_CBS(const CRYPTO_BUFFER *buf, CBS *out) {
  260|  9.86k|  CBS_init(out, buf->data, buf->len);
  261|  9.86k|}
pool.cc:_ZL17crypto_buffer_newPKhmiP21crypto_buffer_pool_st:
   87|  43.4k|                                        CRYPTO_BUFFER_POOL *pool) {
   88|  43.4k|  if (pool != NULL) {
  ------------------
  |  Branch (88:7): [True: 0, False: 43.4k]
  ------------------
   89|      0|    CRYPTO_BUFFER tmp;
   90|      0|    tmp.data = (uint8_t *)data;
   91|      0|    tmp.len = len;
   92|      0|    tmp.pool = pool;
   93|       |
   94|      0|    CRYPTO_MUTEX_lock_read(&pool->lock);
   95|      0|    CRYPTO_BUFFER *duplicate = lh_CRYPTO_BUFFER_retrieve(pool->bufs, &tmp);
   96|      0|    if (data_is_static && duplicate != NULL && !duplicate->data_is_static) {
  ------------------
  |  Branch (96:9): [True: 0, False: 0]
  |  Branch (96:27): [True: 0, False: 0]
  |  Branch (96:48): [True: 0, False: 0]
  ------------------
   97|       |      // If the new |CRYPTO_BUFFER| would have static data, but the duplicate
   98|       |      // does not, we replace the old one with the new static version.
   99|      0|      duplicate = NULL;
  100|      0|    }
  101|      0|    if (duplicate != NULL) {
  ------------------
  |  Branch (101:9): [True: 0, False: 0]
  ------------------
  102|      0|      CRYPTO_refcount_inc(&duplicate->references);
  103|      0|    }
  104|      0|    CRYPTO_MUTEX_unlock_read(&pool->lock);
  105|       |
  106|      0|    if (duplicate != NULL) {
  ------------------
  |  Branch (106:9): [True: 0, False: 0]
  ------------------
  107|      0|      return duplicate;
  108|      0|    }
  109|      0|  }
  110|       |
  111|  43.4k|  CRYPTO_BUFFER *const buf =
  112|  43.4k|      reinterpret_cast<CRYPTO_BUFFER *>(OPENSSL_zalloc(sizeof(CRYPTO_BUFFER)));
  113|  43.4k|  if (buf == NULL) {
  ------------------
  |  Branch (113:7): [True: 0, False: 43.4k]
  ------------------
  114|      0|    return NULL;
  115|      0|  }
  116|       |
  117|  43.4k|  if (data_is_static) {
  ------------------
  |  Branch (117:7): [True: 0, False: 43.4k]
  ------------------
  118|      0|    buf->data = (uint8_t *)data;
  119|      0|    buf->data_is_static = 1;
  120|  43.4k|  } else {
  121|  43.4k|    buf->data = reinterpret_cast<uint8_t *>(OPENSSL_memdup(data, len));
  122|  43.4k|    if (len != 0 && buf->data == NULL) {
  ------------------
  |  Branch (122:9): [True: 42.5k, False: 894]
  |  Branch (122:21): [True: 0, False: 42.5k]
  ------------------
  123|      0|      OPENSSL_free(buf);
  124|      0|      return NULL;
  125|      0|    }
  126|  43.4k|  }
  127|       |
  128|  43.4k|  buf->len = len;
  129|  43.4k|  buf->references = 1;
  130|       |
  131|  43.4k|  if (pool == NULL) {
  ------------------
  |  Branch (131:7): [True: 43.4k, False: 0]
  ------------------
  132|  43.4k|    return buf;
  133|  43.4k|  }
  134|       |
  135|      0|  buf->pool = pool;
  136|       |
  137|      0|  CRYPTO_MUTEX_lock_write(&pool->lock);
  138|      0|  CRYPTO_BUFFER *duplicate = lh_CRYPTO_BUFFER_retrieve(pool->bufs, buf);
  139|      0|  if (data_is_static && duplicate != NULL && !duplicate->data_is_static) {
  ------------------
  |  Branch (139:7): [True: 0, False: 0]
  |  Branch (139:25): [True: 0, False: 0]
  |  Branch (139:46): [True: 0, False: 0]
  ------------------
  140|       |    // If the new |CRYPTO_BUFFER| would have static data, but the duplicate does
  141|       |    // not, we replace the old one with the new static version.
  142|      0|    duplicate = NULL;
  143|      0|  }
  144|      0|  int inserted = 0;
  145|      0|  if (duplicate == NULL) {
  ------------------
  |  Branch (145:7): [True: 0, False: 0]
  ------------------
  146|      0|    CRYPTO_BUFFER *old = NULL;
  147|      0|    inserted = lh_CRYPTO_BUFFER_insert(pool->bufs, &old, buf);
  148|       |    // |old| may be non-NULL if a match was found but ignored. |pool->bufs| does
  149|       |    // not increment refcounts, so there is no need to clean up after the
  150|       |    // replacement.
  151|      0|  } else {
  152|      0|    CRYPTO_refcount_inc(&duplicate->references);
  153|      0|  }
  154|      0|  CRYPTO_MUTEX_unlock_write(&pool->lock);
  155|       |
  156|      0|  if (!inserted) {
  ------------------
  |  Branch (156:7): [True: 0, False: 0]
  ------------------
  157|       |    // We raced to insert |buf| into the pool and lost, or else there was an
  158|       |    // error inserting.
  159|      0|    crypto_buffer_free_object(buf);
  160|      0|    return duplicate;
  161|      0|  }
  162|       |
  163|      0|  return buf;
  164|      0|}
pool.cc:_ZL25crypto_buffer_free_objectP16crypto_buffer_st:
   78|  43.4k|static void crypto_buffer_free_object(CRYPTO_BUFFER *buf) {
   79|  43.4k|  if (!buf->data_is_static) {
  ------------------
  |  Branch (79:7): [True: 43.4k, False: 0]
  ------------------
   80|  43.4k|    OPENSSL_free(buf->data);
   81|  43.4k|  }
   82|  43.4k|  OPENSSL_free(buf);
   83|  43.4k|}

CRYPTO_sysrand:
   41|      2|void CRYPTO_sysrand(uint8_t *out, size_t requested) {
   42|      2|  static const uint8_t kZeroKey[32] = {0};
   43|       |
   44|      2|  CRYPTO_MUTEX_lock_write(&g_num_calls_lock);
   45|      2|  uint64_t num_calls = g_num_calls++;
   46|      2|  CRYPTO_MUTEX_unlock_write(&g_num_calls_lock);
   47|       |
   48|      2|  uint8_t nonce[12];
   49|      2|  OPENSSL_memset(nonce, 0, sizeof(nonce));
   50|      2|  OPENSSL_memcpy(nonce, &num_calls, sizeof(num_calls));
   51|       |
   52|      2|  OPENSSL_memset(out, 0, requested);
   53|      2|  CRYPTO_chacha_20(out, out, requested, kZeroKey, nonce, 0);
   54|      2|}
CRYPTO_sysrand_for_seed:
   61|      2|void CRYPTO_sysrand_for_seed(uint8_t *out, size_t requested) {
   62|      2|  CRYPTO_sysrand(out, requested);
   63|      2|}

CRYPTO_get_fork_generation:
   80|  4.88k|uint64_t CRYPTO_get_fork_generation(void) {
   81|  4.88k|  CRYPTO_once(&g_fork_detect_once, init_fork_detect);
   82|       |
   83|       |  // In a single-threaded process, there are obviously no races because there's
   84|       |  // only a single mutator in the address space.
   85|       |  //
   86|       |  // In a multi-threaded environment, |CRYPTO_once| ensures that the flag byte
   87|       |  // is initialised atomically, even if multiple threads enter this function
   88|       |  // concurrently.
   89|       |  //
   90|       |  // Additionally, while the kernel will only clear WIPEONFORK at a point when a
   91|       |  // child process is single-threaded, the child may become multi-threaded
   92|       |  // before it observes this. Therefore, we must synchronize the logic below.
   93|       |
   94|  4.88k|  CRYPTO_atomic_u32 *const flag_ptr = g_fork_detect_addr;
   95|  4.88k|  if (flag_ptr == NULL) {
  ------------------
  |  Branch (95:7): [True: 0, False: 4.88k]
  ------------------
   96|       |    // Our kernel is too old to support |MADV_WIPEONFORK| or
   97|       |    // |g_force_madv_wipeonfork| is set.
   98|      0|    if (g_force_madv_wipeonfork && g_force_madv_wipeonfork_enabled) {
  ------------------
  |  Branch (98:9): [True: 0, False: 0]
  |  Branch (98:36): [True: 0, False: 0]
  ------------------
   99|       |      // A constant generation number to simulate support, even if the kernel
  100|       |      // doesn't support it.
  101|      0|      return 42;
  102|      0|    }
  103|       |    // With Linux and clone(), we do not believe that pthread_atfork() is
  104|       |    // sufficient for detecting all forms of address space duplication. At this
  105|       |    // point we have a kernel that does not support MADV_WIPEONFORK. We could
  106|       |    // return the generation number from pthread_atfork() here and it would
  107|       |    // probably be safe in almost any situation, but to ensure safety we return
  108|       |    // 0 and force an entropy draw on every call.
  109|      0|    return 0;
  110|      0|  }
  111|       |
  112|       |  // In the common case, try to observe the flag without taking a lock. This
  113|       |  // avoids cacheline contention in the PRNG.
  114|  4.88k|  uint64_t *const generation_ptr = &g_fork_generation;
  115|  4.88k|  if (CRYPTO_atomic_load_u32(flag_ptr) != 0) {
  ------------------
  |  Branch (115:7): [True: 4.88k, False: 0]
  ------------------
  116|       |    // If we observe a non-zero flag, it is safe to read |generation_ptr|
  117|       |    // without a lock. The flag and generation number are fixed for this copy of
  118|       |    // the address space.
  119|  4.88k|    return *generation_ptr;
  120|  4.88k|  }
  121|       |
  122|       |  // The flag was zero. The generation number must be incremented, but other
  123|       |  // threads may have concurrently observed the zero, so take a lock before
  124|       |  // incrementing.
  125|      0|  CRYPTO_MUTEX *const lock = &g_fork_detect_lock;
  126|      0|  CRYPTO_MUTEX_lock_write(lock);
  127|      0|  uint64_t current_generation = *generation_ptr;
  128|      0|  if (CRYPTO_atomic_load_u32(flag_ptr) == 0) {
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|       |    // A fork has occurred.
  130|      0|    current_generation++;
  131|      0|    if (current_generation == 0) {
  ------------------
  |  Branch (131:9): [True: 0, False: 0]
  ------------------
  132|       |      // Zero means fork detection isn't supported, so skip that value.
  133|      0|      current_generation = 1;
  134|      0|    }
  135|       |
  136|       |    // We must update |generation_ptr| before |flag_ptr|. Other threads may
  137|       |    // observe |flag_ptr| without taking a lock.
  138|      0|    *generation_ptr = current_generation;
  139|      0|    CRYPTO_atomic_store_u32(flag_ptr, 1);
  140|      0|  }
  141|      0|  CRYPTO_MUTEX_unlock_write(lock);
  142|       |
  143|      0|  return current_generation;
  144|  4.88k|}
fork_detect.cc:_ZL16init_fork_detectv:
   47|      1|static void init_fork_detect(void) {
   48|      1|  if (g_force_madv_wipeonfork) {
  ------------------
  |  Branch (48:7): [True: 0, False: 1]
  ------------------
   49|      0|    return;
   50|      0|  }
   51|       |
   52|      1|  long page_size = sysconf(_SC_PAGESIZE);
   53|      1|  if (page_size <= 0) {
  ------------------
  |  Branch (53:7): [True: 0, False: 1]
  ------------------
   54|      0|    return;
   55|      0|  }
   56|       |
   57|      1|  void *addr = mmap(NULL, (size_t)page_size, PROT_READ | PROT_WRITE,
   58|      1|                    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   59|      1|  if (addr == MAP_FAILED) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1]
  ------------------
   60|      0|    return;
   61|      0|  }
   62|       |
   63|       |  // Some versions of qemu (up to at least 5.0.0-rc4, see linux-user/syscall.c)
   64|       |  // ignore |madvise| calls and just return zero (i.e. success). But we need to
   65|       |  // know whether MADV_WIPEONFORK actually took effect. Therefore try an invalid
   66|       |  // call to check that the implementation of |madvise| is actually rejecting
   67|       |  // unknown |advice| values.
   68|      1|  if (madvise(addr, (size_t)page_size, -1) == 0 ||
  ------------------
  |  Branch (68:7): [True: 0, False: 1]
  ------------------
   69|      1|      madvise(addr, (size_t)page_size, MADV_WIPEONFORK) != 0) {
  ------------------
  |  Branch (69:7): [True: 0, False: 1]
  ------------------
   70|      0|    munmap(addr, (size_t)page_size);
   71|      0|    return;
   72|      0|  }
   73|       |
   74|      1|  CRYPTO_atomic_u32 *const atomic = reinterpret_cast<CRYPTO_atomic_u32 *>(addr);
   75|      1|  CRYPTO_atomic_store_u32(atomic, 1);
   76|      1|  g_fork_detect_addr = atomic;
   77|      1|  g_fork_generation = 1;
   78|      1|}

rand_fork_unsafe_buffering_enabled:
   42|  4.88k|int rand_fork_unsafe_buffering_enabled(void) {
   43|  4.88k|  return CRYPTO_atomic_load_u32(&g_buffering_enabled) != 0;
   44|  4.88k|}

RAND_bytes:
   23|  4.88k|int RAND_bytes(uint8_t *buf, size_t len) {
   24|  4.88k|  BCM_rand_bytes(buf, len);
   25|  4.88k|  return 1;
   26|  4.88k|}

CRYPTO_refcount_inc:
   21|  72.6k|void CRYPTO_refcount_inc(CRYPTO_refcount_t *count) {
   22|  72.6k|  uint32_t expected = CRYPTO_atomic_load_u32(count);
   23|       |
   24|  72.6k|  while (expected != CRYPTO_REFCOUNT_MAX) {
  ------------------
  |  |  580|  72.6k|#define CRYPTO_REFCOUNT_MAX 0xffffffff
  ------------------
  |  Branch (24:10): [True: 72.6k, False: 0]
  ------------------
   25|  72.6k|    uint32_t new_value = expected + 1;
   26|  72.6k|    if (CRYPTO_atomic_compare_exchange_weak_u32(count, &expected, new_value)) {
  ------------------
  |  Branch (26:9): [True: 72.6k, False: 0]
  ------------------
   27|  72.6k|      break;
   28|  72.6k|    }
   29|  72.6k|  }
   30|  72.6k|}
CRYPTO_refcount_dec_and_test_zero:
   32|   252k|int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count) {
   33|   252k|  uint32_t expected = CRYPTO_atomic_load_u32(count);
   34|       |
   35|   252k|  for (;;) {
   36|   252k|    if (expected == 0) {
  ------------------
  |  Branch (36:9): [True: 0, False: 252k]
  ------------------
   37|      0|      abort();
   38|   252k|    } else if (expected == CRYPTO_REFCOUNT_MAX) {
  ------------------
  |  |  580|   252k|#define CRYPTO_REFCOUNT_MAX 0xffffffff
  ------------------
  |  Branch (38:16): [True: 0, False: 252k]
  ------------------
   39|      0|      return 0;
   40|   252k|    } else {
   41|   252k|      const uint32_t new_value = expected - 1;
   42|   252k|      if (CRYPTO_atomic_compare_exchange_weak_u32(count, &expected,
  ------------------
  |  Branch (42:11): [True: 252k, False: 0]
  ------------------
   43|   252k|                                                  new_value)) {
   44|   252k|        return new_value == 0;
   45|   252k|      }
   46|   252k|    }
   47|   252k|  }
   48|   252k|}

RSA_parse_public_key:
   49|  35.2k|RSA *RSA_parse_public_key(CBS *cbs) {
   50|  35.2k|  RSA *ret = RSA_new();
   51|  35.2k|  if (ret == NULL) {
  ------------------
  |  Branch (51:7): [True: 0, False: 35.2k]
  ------------------
   52|      0|    return NULL;
   53|      0|  }
   54|  35.2k|  CBS child;
   55|  35.2k|  if (!CBS_get_asn1(cbs, &child, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  35.2k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  35.2k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  35.2k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (55:7): [True: 0, False: 35.2k]
  ------------------
   56|  35.2k|      !parse_integer(&child, &ret->n) ||
  ------------------
  |  Branch (56:7): [True: 0, False: 35.2k]
  ------------------
   57|  35.2k|      !parse_integer(&child, &ret->e) ||
  ------------------
  |  Branch (57:7): [True: 0, False: 35.2k]
  ------------------
   58|  35.2k|      CBS_len(&child) != 0) {
  ------------------
  |  Branch (58:7): [True: 0, False: 35.2k]
  ------------------
   59|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   60|      0|    RSA_free(ret);
   61|      0|    return NULL;
   62|      0|  }
   63|       |
   64|  35.2k|  if (!RSA_check_key(ret)) {
  ------------------
  |  Branch (64:7): [True: 0, False: 35.2k]
  ------------------
   65|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_RSA_PARAMETERS);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   66|      0|    RSA_free(ret);
   67|      0|    return NULL;
   68|      0|  }
   69|       |
   70|  35.2k|  return ret;
   71|  35.2k|}
RSA_parse_private_key:
  115|      2|RSA *RSA_parse_private_key(CBS *cbs) {
  116|      2|  RSA *ret = RSA_new();
  117|      2|  if (ret == NULL) {
  ------------------
  |  Branch (117:7): [True: 0, False: 2]
  ------------------
  118|      0|    return NULL;
  119|      0|  }
  120|       |
  121|      2|  CBS child;
  122|      2|  uint64_t version;
  123|      2|  if (!CBS_get_asn1(cbs, &child, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|      2|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|      2|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|      2|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (123:7): [True: 0, False: 2]
  ------------------
  124|      2|      !CBS_get_asn1_uint64(&child, &version)) {
  ------------------
  |  Branch (124:7): [True: 0, False: 2]
  ------------------
  125|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  126|      0|    goto err;
  127|      0|  }
  128|       |
  129|      2|  if (version != kVersionTwoPrime) {
  ------------------
  |  Branch (129:7): [True: 0, False: 2]
  ------------------
  130|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_VERSION);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  131|      0|    goto err;
  132|      0|  }
  133|       |
  134|      2|  if (!parse_integer(&child, &ret->n) ||
  ------------------
  |  Branch (134:7): [True: 0, False: 2]
  ------------------
  135|      2|      !parse_integer(&child, &ret->e) ||
  ------------------
  |  Branch (135:7): [True: 0, False: 2]
  ------------------
  136|      2|      !parse_integer(&child, &ret->d) ||
  ------------------
  |  Branch (136:7): [True: 0, False: 2]
  ------------------
  137|      2|      !parse_integer(&child, &ret->p) ||
  ------------------
  |  Branch (137:7): [True: 0, False: 2]
  ------------------
  138|      2|      !parse_integer(&child, &ret->q) ||
  ------------------
  |  Branch (138:7): [True: 0, False: 2]
  ------------------
  139|      2|      !parse_integer(&child, &ret->dmp1) ||
  ------------------
  |  Branch (139:7): [True: 0, False: 2]
  ------------------
  140|      2|      !parse_integer(&child, &ret->dmq1) ||
  ------------------
  |  Branch (140:7): [True: 0, False: 2]
  ------------------
  141|      2|      !parse_integer(&child, &ret->iqmp)) {
  ------------------
  |  Branch (141:7): [True: 0, False: 2]
  ------------------
  142|      0|    goto err;
  143|      0|  }
  144|       |
  145|      2|  if (CBS_len(&child) != 0) {
  ------------------
  |  Branch (145:7): [True: 0, False: 2]
  ------------------
  146|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_ENCODING);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  147|      0|    goto err;
  148|      0|  }
  149|       |
  150|      2|  if (!RSA_check_key(ret)) {
  ------------------
  |  Branch (150:7): [True: 0, False: 2]
  ------------------
  151|      0|    OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_RSA_PARAMETERS);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  152|      0|    goto err;
  153|      0|  }
  154|       |
  155|      2|  return ret;
  156|       |
  157|      0|err:
  158|      0|  RSA_free(ret);
  159|      0|  return NULL;
  160|      2|}
d2i_RSAPrivateKey:
  235|      2|RSA *d2i_RSAPrivateKey(RSA **out, const uint8_t **inp, long len) {
  236|      2|  if (len < 0) {
  ------------------
  |  Branch (236:7): [True: 0, False: 2]
  ------------------
  237|      0|    return NULL;
  238|      0|  }
  239|      2|  CBS cbs;
  240|      2|  CBS_init(&cbs, *inp, (size_t)len);
  241|      2|  RSA *ret = RSA_parse_private_key(&cbs);
  242|      2|  if (ret == NULL) {
  ------------------
  |  Branch (242:7): [True: 0, False: 2]
  ------------------
  243|      0|    return NULL;
  244|      0|  }
  245|      2|  if (out != NULL) {
  ------------------
  |  Branch (245:7): [True: 0, False: 2]
  ------------------
  246|      0|    RSA_free(*out);
  247|      0|    *out = ret;
  248|      0|  }
  249|      2|  *inp = CBS_data(&cbs);
  250|      2|  return ret;
  251|      2|}
rsa_asn1.cc:_ZL13parse_integerP6cbs_stPP9bignum_st:
   31|  70.4k|static int parse_integer(CBS *cbs, BIGNUM **out) {
   32|  70.4k|  assert(*out == NULL);
   33|  70.4k|  *out = BN_new();
   34|  70.4k|  if (*out == NULL) {
  ------------------
  |  Branch (34:7): [True: 0, False: 70.4k]
  ------------------
   35|      0|    return 0;
   36|      0|  }
   37|  70.4k|  return BN_parse_asn1_unsigned(cbs, *out);
   38|  70.4k|}

OPENSSL_sk_new:
   44|   409k|OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_cmp_func comp) {
   45|   409k|  OPENSSL_STACK *ret =
   46|   409k|      reinterpret_cast<OPENSSL_STACK *>(OPENSSL_zalloc(sizeof(OPENSSL_STACK)));
   47|   409k|  if (ret == NULL) {
  ------------------
  |  Branch (47:7): [True: 0, False: 409k]
  ------------------
   48|      0|    return NULL;
   49|      0|  }
   50|       |
   51|   409k|  ret->data =
   52|   409k|      reinterpret_cast<void **>(OPENSSL_calloc(kMinSize, sizeof(void *)));
   53|   409k|  if (ret->data == NULL) {
  ------------------
  |  Branch (53:7): [True: 0, False: 409k]
  ------------------
   54|      0|    goto err;
   55|      0|  }
   56|       |
   57|   409k|  ret->comp = comp;
   58|   409k|  ret->num_alloc = kMinSize;
   59|       |
   60|   409k|  return ret;
   61|       |
   62|      0|err:
   63|      0|  OPENSSL_free(ret);
   64|      0|  return NULL;
   65|   409k|}
OPENSSL_sk_new_null:
   67|   404k|OPENSSL_STACK *OPENSSL_sk_new_null(void) { return OPENSSL_sk_new(NULL); }
OPENSSL_sk_num:
   69|  1.37M|size_t OPENSSL_sk_num(const OPENSSL_STACK *sk) {
   70|  1.37M|  if (sk == NULL) {
  ------------------
  |  Branch (70:7): [True: 100k, False: 1.27M]
  ------------------
   71|   100k|    return 0;
   72|   100k|  }
   73|  1.27M|  return sk->num;
   74|  1.37M|}
OPENSSL_sk_value:
   85|   603k|void *OPENSSL_sk_value(const OPENSSL_STACK *sk, size_t i) {
   86|   603k|  if (!sk || i >= sk->num) {
  ------------------
  |  Branch (86:7): [True: 0, False: 603k]
  |  Branch (86:14): [True: 0, False: 603k]
  ------------------
   87|      0|    return NULL;
   88|      0|  }
   89|   603k|  return sk->data[i];
   90|   603k|}
OPENSSL_sk_set:
   92|  63.3k|void *OPENSSL_sk_set(OPENSSL_STACK *sk, size_t i, void *value) {
   93|  63.3k|  if (!sk || i >= sk->num) {
  ------------------
  |  Branch (93:7): [True: 0, False: 63.3k]
  |  Branch (93:14): [True: 0, False: 63.3k]
  ------------------
   94|      0|    return NULL;
   95|      0|  }
   96|  63.3k|  return sk->data[i] = value;
   97|  63.3k|}
OPENSSL_sk_free:
   99|   466k|void OPENSSL_sk_free(OPENSSL_STACK *sk) {
  100|   466k|  if (sk == NULL) {
  ------------------
  |  Branch (100:7): [True: 56.2k, False: 410k]
  ------------------
  101|  56.2k|    return;
  102|  56.2k|  }
  103|   410k|  OPENSSL_free(sk->data);
  104|   410k|  OPENSSL_free(sk);
  105|   410k|}
OPENSSL_sk_pop_free_ex:
  109|   457k|                            OPENSSL_sk_free_func free_func) {
  110|   457k|  if (sk == NULL) {
  ------------------
  |  Branch (110:7): [True: 153k, False: 303k]
  ------------------
  111|   153k|    return;
  112|   153k|  }
  113|       |
  114|   568k|  for (size_t i = 0; i < sk->num; i++) {
  ------------------
  |  Branch (114:22): [True: 265k, False: 303k]
  ------------------
  115|   265k|    if (sk->data[i] != NULL) {
  ------------------
  |  Branch (115:9): [True: 264k, False: 682]
  ------------------
  116|   264k|      call_free_func(free_func, sk->data[i]);
  117|   264k|    }
  118|   265k|  }
  119|   303k|  OPENSSL_sk_free(sk);
  120|   303k|}
OPENSSL_sk_insert:
  133|   594k|size_t OPENSSL_sk_insert(OPENSSL_STACK *sk, void *p, size_t where) {
  134|   594k|  if (sk == NULL) {
  ------------------
  |  Branch (134:7): [True: 0, False: 594k]
  ------------------
  135|      0|    return 0;
  136|      0|  }
  137|       |
  138|   594k|  if (sk->num >= INT_MAX) {
  ------------------
  |  Branch (138:7): [True: 0, False: 594k]
  ------------------
  139|      0|    OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  140|      0|    return 0;
  141|      0|  }
  142|       |
  143|   594k|  if (sk->num_alloc <= sk->num + 1) {
  ------------------
  |  Branch (143:7): [True: 57.6k, False: 536k]
  ------------------
  144|       |    // Attempt to double the size of the array.
  145|  57.6k|    size_t new_alloc = sk->num_alloc << 1;
  146|  57.6k|    size_t alloc_size = new_alloc * sizeof(void *);
  147|  57.6k|    void **data;
  148|       |
  149|       |    // If the doubling overflowed, try to increment.
  150|  57.6k|    if (new_alloc < sk->num_alloc || alloc_size / sizeof(void *) != new_alloc) {
  ------------------
  |  Branch (150:9): [True: 0, False: 57.6k]
  |  Branch (150:38): [True: 0, False: 57.6k]
  ------------------
  151|      0|      new_alloc = sk->num_alloc + 1;
  152|      0|      alloc_size = new_alloc * sizeof(void *);
  153|      0|    }
  154|       |
  155|       |    // If the increment also overflowed, fail.
  156|  57.6k|    if (new_alloc < sk->num_alloc || alloc_size / sizeof(void *) != new_alloc) {
  ------------------
  |  Branch (156:9): [True: 0, False: 57.6k]
  |  Branch (156:38): [True: 0, False: 57.6k]
  ------------------
  157|      0|      return 0;
  158|      0|    }
  159|       |
  160|  57.6k|    data = reinterpret_cast<void **>(OPENSSL_realloc(sk->data, alloc_size));
  161|  57.6k|    if (data == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 57.6k]
  ------------------
  162|      0|      return 0;
  163|      0|    }
  164|       |
  165|  57.6k|    sk->data = data;
  166|  57.6k|    sk->num_alloc = new_alloc;
  167|  57.6k|  }
  168|       |
  169|   594k|  if (where >= sk->num) {
  ------------------
  |  Branch (169:7): [True: 594k, False: 0]
  ------------------
  170|   594k|    sk->data[sk->num] = p;
  171|   594k|  } else {
  172|      0|    OPENSSL_memmove(&sk->data[where + 1], &sk->data[where],
  173|      0|                    sizeof(void *) * (sk->num - where));
  174|      0|    sk->data[where] = p;
  175|      0|  }
  176|       |
  177|   594k|  sk->num++;
  178|   594k|  sk->sorted = 0;
  179|       |
  180|   594k|  return sk->num;
  181|   594k|}
OPENSSL_sk_delete:
  183|  5.34k|void *OPENSSL_sk_delete(OPENSSL_STACK *sk, size_t where) {
  184|  5.34k|  void *ret;
  185|       |
  186|  5.34k|  if (!sk || where >= sk->num) {
  ------------------
  |  Branch (186:7): [True: 0, False: 5.34k]
  |  Branch (186:14): [True: 0, False: 5.34k]
  ------------------
  187|      0|    return NULL;
  188|      0|  }
  189|       |
  190|  5.34k|  ret = sk->data[where];
  191|       |
  192|  5.34k|  if (where != sk->num - 1) {
  ------------------
  |  Branch (192:7): [True: 0, False: 5.34k]
  ------------------
  193|      0|    OPENSSL_memmove(&sk->data[where], &sk->data[where + 1],
  194|      0|                    sizeof(void *) * (sk->num - where - 1));
  195|      0|  }
  196|       |
  197|  5.34k|  sk->num--;
  198|  5.34k|  return ret;
  199|  5.34k|}
OPENSSL_sk_push:
  311|   594k|size_t OPENSSL_sk_push(OPENSSL_STACK *sk, void *p) {
  312|   594k|  return OPENSSL_sk_insert(sk, p, sk->num);
  313|   594k|}
OPENSSL_sk_pop:
  315|  5.34k|void *OPENSSL_sk_pop(OPENSSL_STACK *sk) {
  316|  5.34k|  if (sk == NULL) {
  ------------------
  |  Branch (316:7): [True: 0, False: 5.34k]
  ------------------
  317|      0|    return NULL;
  318|      0|  }
  319|  5.34k|  if (sk->num == 0) {
  ------------------
  |  Branch (319:7): [True: 0, False: 5.34k]
  ------------------
  320|      0|    return NULL;
  321|      0|  }
  322|  5.34k|  return OPENSSL_sk_delete(sk, sk->num - 1);
  323|  5.34k|}
OPENSSL_sk_dup:
  325|    606|OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *sk) {
  326|    606|  if (sk == NULL) {
  ------------------
  |  Branch (326:7): [True: 0, False: 606]
  ------------------
  327|      0|    return NULL;
  328|      0|  }
  329|       |
  330|    606|  OPENSSL_STACK *ret =
  331|    606|      reinterpret_cast<OPENSSL_STACK *>(OPENSSL_zalloc(sizeof(OPENSSL_STACK)));
  332|    606|  if (ret == NULL) {
  ------------------
  |  Branch (332:7): [True: 0, False: 606]
  ------------------
  333|      0|    return NULL;
  334|      0|  }
  335|       |
  336|    606|  ret->data = reinterpret_cast<void **>(
  337|    606|      OPENSSL_memdup(sk->data, sizeof(void *) * sk->num_alloc));
  338|    606|  if (ret->data == NULL) {
  ------------------
  |  Branch (338:7): [True: 0, False: 606]
  ------------------
  339|      0|    goto err;
  340|      0|  }
  341|       |
  342|    606|  ret->num = sk->num;
  343|    606|  ret->sorted = sk->sorted;
  344|    606|  ret->num_alloc = sk->num_alloc;
  345|    606|  ret->comp = sk->comp;
  346|    606|  return ret;
  347|       |
  348|      0|err:
  349|      0|  OPENSSL_sk_free(ret);
  350|      0|  return NULL;
  351|    606|}
OPENSSL_sk_deep_copy:
  454|    606|                                    OPENSSL_sk_free_func free_func) {
  455|    606|  OPENSSL_STACK *ret = OPENSSL_sk_dup(sk);
  456|    606|  if (ret == NULL) {
  ------------------
  |  Branch (456:7): [True: 0, False: 606]
  ------------------
  457|      0|    return NULL;
  458|      0|  }
  459|       |
  460|  5.90k|  for (size_t i = 0; i < ret->num; i++) {
  ------------------
  |  Branch (460:22): [True: 5.30k, False: 606]
  ------------------
  461|  5.30k|    if (ret->data[i] == NULL) {
  ------------------
  |  Branch (461:9): [True: 341, False: 4.95k]
  ------------------
  462|    341|      continue;
  463|    341|    }
  464|  4.95k|    ret->data[i] = call_copy_func(copy_func, ret->data[i]);
  465|  4.95k|    if (ret->data[i] == NULL) {
  ------------------
  |  Branch (465:9): [True: 0, False: 4.95k]
  ------------------
  466|      0|      for (size_t j = 0; j < i; j++) {
  ------------------
  |  Branch (466:26): [True: 0, False: 0]
  ------------------
  467|      0|        if (ret->data[j] != NULL) {
  ------------------
  |  Branch (467:13): [True: 0, False: 0]
  ------------------
  468|      0|          call_free_func(free_func, ret->data[j]);
  469|      0|        }
  470|      0|      }
  471|      0|      OPENSSL_sk_free(ret);
  472|      0|      return NULL;
  473|      0|    }
  474|  4.95k|  }
  475|       |
  476|    606|  return ret;
  477|    606|}

CRYPTO_MUTEX_init:
   26|  73.1k|void CRYPTO_MUTEX_init(CRYPTO_MUTEX *lock) {
   27|  73.1k|  if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (27:7): [True: 0, False: 73.1k]
  ------------------
   28|      0|    abort();
   29|      0|  }
   30|  73.1k|}
CRYPTO_MUTEX_lock_read:
   32|    851|void CRYPTO_MUTEX_lock_read(CRYPTO_MUTEX *lock) {
   33|    851|  if (pthread_rwlock_rdlock(lock) != 0) {
  ------------------
  |  Branch (33:7): [True: 0, False: 851]
  ------------------
   34|      0|    abort();
   35|      0|  }
   36|    851|}
CRYPTO_MUTEX_lock_write:
   38|  23.7k|void CRYPTO_MUTEX_lock_write(CRYPTO_MUTEX *lock) {
   39|  23.7k|  if (pthread_rwlock_wrlock(lock) != 0) {
  ------------------
  |  Branch (39:7): [True: 0, False: 23.7k]
  ------------------
   40|      0|    abort();
   41|      0|  }
   42|  23.7k|}
CRYPTO_MUTEX_unlock_read:
   44|    851|void CRYPTO_MUTEX_unlock_read(CRYPTO_MUTEX *lock) {
   45|    851|  if (pthread_rwlock_unlock(lock) != 0) {
  ------------------
  |  Branch (45:7): [True: 0, False: 851]
  ------------------
   46|      0|    abort();
   47|      0|  }
   48|    851|}
CRYPTO_MUTEX_unlock_write:
   50|  23.7k|void CRYPTO_MUTEX_unlock_write(CRYPTO_MUTEX *lock) {
   51|  23.7k|  if (pthread_rwlock_unlock(lock) != 0) {
  ------------------
  |  Branch (51:7): [True: 0, False: 23.7k]
  ------------------
   52|      0|    abort();
   53|      0|  }
   54|  23.7k|}
CRYPTO_MUTEX_cleanup:
   56|  73.1k|void CRYPTO_MUTEX_cleanup(CRYPTO_MUTEX *lock) { pthread_rwlock_destroy(lock); }
CRYPTO_once:
   58|   254k|void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void)) {
   59|   254k|  if (pthread_once(once, init) != 0) {
  ------------------
  |  Branch (59:7): [True: 0, False: 254k]
  ------------------
   60|      0|    abort();
   61|      0|  }
   62|   254k|}
CRYPTO_get_thread_local:
  101|   142k|void *CRYPTO_get_thread_local(thread_local_data_t index) {
  102|   142k|  CRYPTO_once(&g_thread_local_init_once, thread_local_init);
  103|   142k|  if (!g_thread_local_key_created) {
  ------------------
  |  Branch (103:7): [True: 0, False: 142k]
  ------------------
  104|      0|    return NULL;
  105|      0|  }
  106|       |
  107|   142k|  void **pointers =
  108|   142k|      reinterpret_cast<void **>(pthread_getspecific(g_thread_local_key));
  109|   142k|  if (pointers == NULL) {
  ------------------
  |  Branch (109:7): [True: 2, False: 142k]
  ------------------
  110|      2|    return NULL;
  111|      2|  }
  112|   142k|  return pointers[index];
  113|   142k|}
CRYPTO_set_thread_local:
  116|      3|                            thread_local_destructor_t destructor) {
  117|      3|  CRYPTO_once(&g_thread_local_init_once, thread_local_init);
  118|      3|  if (!g_thread_local_key_created) {
  ------------------
  |  Branch (118:7): [True: 0, False: 3]
  ------------------
  119|      0|    destructor(value);
  120|      0|    return 0;
  121|      0|  }
  122|       |
  123|      3|  void **pointers =
  124|      3|      reinterpret_cast<void **>(pthread_getspecific(g_thread_local_key));
  125|      3|  if (pointers == NULL) {
  ------------------
  |  Branch (125:7): [True: 2, False: 1]
  ------------------
  126|      2|    pointers = reinterpret_cast<void **>(
  127|      2|        malloc(sizeof(void *) * NUM_OPENSSL_THREAD_LOCALS));
  128|      2|    if (pointers == NULL) {
  ------------------
  |  Branch (128:9): [True: 0, False: 2]
  ------------------
  129|      0|      destructor(value);
  130|      0|      return 0;
  131|      0|    }
  132|      2|    OPENSSL_memset(pointers, 0, sizeof(void *) * NUM_OPENSSL_THREAD_LOCALS);
  133|      2|    if (pthread_setspecific(g_thread_local_key, pointers) != 0) {
  ------------------
  |  Branch (133:9): [True: 0, False: 2]
  ------------------
  134|      0|      free(pointers);
  135|      0|      destructor(value);
  136|      0|      return 0;
  137|      0|    }
  138|      2|  }
  139|       |
  140|      3|  if (pthread_mutex_lock(&g_destructors_lock) != 0) {
  ------------------
  |  Branch (140:7): [True: 0, False: 3]
  ------------------
  141|      0|    destructor(value);
  142|      0|    return 0;
  143|      0|  }
  144|      3|  g_destructors[index] = destructor;
  145|      3|  pthread_mutex_unlock(&g_destructors_lock);
  146|       |
  147|      3|  pointers[index] = value;
  148|      3|  return 1;
  149|      3|}
thread_pthread.cc:_ZL17thread_local_initv:
   96|      2|static void thread_local_init(void) {
   97|      2|  g_thread_local_key_created =
   98|      2|      pthread_key_create(&g_thread_local_key, thread_local_destructor) == 0;
   99|      2|}

X509_get_subject_name:
   59|  3.36k|X509_NAME *X509_get_subject_name(const X509 *a) {
   60|  3.36k|  return a->cert_info->subject;
   61|  3.36k|}

X509_STORE_new:
  110|  4.88k|X509_STORE *X509_STORE_new(void) {
  111|  4.88k|  X509_STORE *ret =
  112|  4.88k|      reinterpret_cast<X509_STORE *>(OPENSSL_zalloc(sizeof(X509_STORE)));
  113|  4.88k|  if (ret == NULL) {
  ------------------
  |  Branch (113:7): [True: 0, False: 4.88k]
  ------------------
  114|      0|    return NULL;
  115|      0|  }
  116|       |
  117|  4.88k|  ret->references = 1;
  118|  4.88k|  CRYPTO_MUTEX_init(&ret->objs_lock);
  119|  4.88k|  ret->objs = sk_X509_OBJECT_new(x509_object_cmp_sk);
  120|  4.88k|  ret->get_cert_methods = sk_X509_LOOKUP_new_null();
  121|  4.88k|  ret->param = X509_VERIFY_PARAM_new();
  122|  4.88k|  if (ret->objs == NULL || ret->get_cert_methods == NULL ||
  ------------------
  |  Branch (122:7): [True: 0, False: 4.88k]
  |  Branch (122:28): [True: 0, False: 4.88k]
  ------------------
  123|  4.88k|      ret->param == NULL) {
  ------------------
  |  Branch (123:7): [True: 0, False: 4.88k]
  ------------------
  124|      0|    X509_STORE_free(ret);
  125|      0|    return NULL;
  126|      0|  }
  127|       |
  128|  4.88k|  return ret;
  129|  4.88k|}
X509_STORE_free:
  136|  14.6k|void X509_STORE_free(X509_STORE *vfy) {
  137|  14.6k|  if (vfy == nullptr || !CRYPTO_refcount_dec_and_test_zero(&vfy->references)) {
  ------------------
  |  Branch (137:7): [True: 9.77k, False: 4.88k]
  |  Branch (137:25): [True: 0, False: 4.88k]
  ------------------
  138|  9.77k|    return;
  139|  9.77k|  }
  140|       |
  141|  4.88k|  CRYPTO_MUTEX_cleanup(&vfy->objs_lock);
  142|  4.88k|  sk_X509_LOOKUP_pop_free(vfy->get_cert_methods, X509_LOOKUP_free);
  143|  4.88k|  sk_X509_OBJECT_pop_free(vfy->objs, X509_OBJECT_free);
  144|  4.88k|  X509_VERIFY_PARAM_free(vfy->param);
  145|  4.88k|  OPENSSL_free(vfy);
  146|  4.88k|}

X509_VERIFY_PARAM_new:
   76|  14.6k|X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) {
   77|  14.6k|  X509_VERIFY_PARAM *param = reinterpret_cast<X509_VERIFY_PARAM *>(
   78|  14.6k|      OPENSSL_zalloc(sizeof(X509_VERIFY_PARAM)));
   79|  14.6k|  if (!param) {
  ------------------
  |  Branch (79:7): [True: 0, False: 14.6k]
  ------------------
   80|      0|    return NULL;
   81|      0|  }
   82|  14.6k|  param->depth = -1;
   83|  14.6k|  return param;
   84|  14.6k|}
X509_VERIFY_PARAM_free:
   86|  14.6k|void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) {
   87|  14.6k|  if (param == NULL) {
  ------------------
  |  Branch (87:7): [True: 0, False: 14.6k]
  ------------------
   88|      0|    return;
   89|      0|  }
   90|  14.6k|  sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
   91|  14.6k|  sk_OPENSSL_STRING_pop_free(param->hosts, str_free);
   92|  14.6k|  OPENSSL_free(param->email);
   93|  14.6k|  OPENSSL_free(param->ip);
   94|  14.6k|  OPENSSL_free(param);
   95|  14.6k|}
X509_VERIFY_PARAM_inherit:
  178|  4.88k|                              const X509_VERIFY_PARAM *src) {
  179|       |  // Prefer the destination. That is, this function only changes unset
  180|       |  // parameters in |dest|.
  181|  4.88k|  return x509_verify_param_copy(dest, src, /*prefer_src=*/0);
  182|  4.88k|}
x509_vpm.cc:_ZL22x509_verify_param_copyP20X509_VERIFY_PARAM_stPKS_i:
  119|  4.88k|                                  int prefer_src) {
  120|  4.88k|  if (src == NULL) {
  ------------------
  |  Branch (120:7): [True: 0, False: 4.88k]
  ------------------
  121|      0|    return 1;
  122|      0|  }
  123|       |
  124|  4.88k|  copy_int_param(&dest->purpose, &src->purpose, /*default_val=*/0, prefer_src);
  125|  4.88k|  copy_int_param(&dest->trust, &src->trust, /*default_val=*/0, prefer_src);
  126|  4.88k|  copy_int_param(&dest->depth, &src->depth, /*default_val=*/-1, prefer_src);
  127|       |
  128|       |  // |check_time|, unlike all other parameters, does not honor |prefer_src|.
  129|       |  // This means |X509_VERIFY_PARAM_set1| will not overwrite it. This behavior
  130|       |  // comes from OpenSSL but may have been a bug.
  131|  4.88k|  if (!(dest->flags & X509_V_FLAG_USE_CHECK_TIME)) {
  ------------------
  |  | 3276|  4.88k|#define X509_V_FLAG_USE_CHECK_TIME 0x2
  ------------------
  |  Branch (131:7): [True: 4.88k, False: 0]
  ------------------
  132|  4.88k|    dest->check_time = src->check_time;
  133|       |    // The source |X509_V_FLAG_USE_CHECK_TIME| flag, if set, is copied below.
  134|  4.88k|  }
  135|       |
  136|  4.88k|  dest->flags |= src->flags;
  137|       |
  138|  4.88k|  if (should_copy(dest->policies != NULL, src->policies != NULL, prefer_src)) {
  ------------------
  |  Branch (138:7): [True: 0, False: 4.88k]
  ------------------
  139|      0|    if (!X509_VERIFY_PARAM_set1_policies(dest, src->policies)) {
  ------------------
  |  Branch (139:9): [True: 0, False: 0]
  ------------------
  140|      0|      return 0;
  141|      0|    }
  142|      0|  }
  143|       |
  144|  4.88k|  if (should_copy(dest->hosts != NULL, src->hosts != NULL, prefer_src)) {
  ------------------
  |  Branch (144:7): [True: 0, False: 4.88k]
  ------------------
  145|      0|    sk_OPENSSL_STRING_pop_free(dest->hosts, str_free);
  146|      0|    dest->hosts = NULL;
  147|      0|    if (src->hosts) {
  ------------------
  |  Branch (147:9): [True: 0, False: 0]
  ------------------
  148|      0|      dest->hosts =
  149|      0|          sk_OPENSSL_STRING_deep_copy(src->hosts, OPENSSL_strdup, str_free);
  150|      0|      if (dest->hosts == NULL) {
  ------------------
  |  Branch (150:11): [True: 0, False: 0]
  ------------------
  151|      0|        return 0;
  152|      0|      }
  153|       |      // Copy the host flags if and only if we're copying the host list. Note
  154|       |      // this means mechanisms like |X509_STORE_CTX_set_default| cannot be used
  155|       |      // to set host flags. E.g. we cannot change the defaults using
  156|       |      // |kDefaultParam| below.
  157|      0|      dest->hostflags = src->hostflags;
  158|      0|    }
  159|      0|  }
  160|       |
  161|  4.88k|  if (should_copy(dest->email != NULL, src->email != NULL, prefer_src)) {
  ------------------
  |  Branch (161:7): [True: 0, False: 4.88k]
  ------------------
  162|      0|    if (!X509_VERIFY_PARAM_set1_email(dest, src->email, src->emaillen)) {
  ------------------
  |  Branch (162:9): [True: 0, False: 0]
  ------------------
  163|      0|      return 0;
  164|      0|    }
  165|      0|  }
  166|       |
  167|  4.88k|  if (should_copy(dest->ip != NULL, src->ip != NULL, prefer_src)) {
  ------------------
  |  Branch (167:7): [True: 0, False: 4.88k]
  ------------------
  168|      0|    if (!X509_VERIFY_PARAM_set1_ip(dest, src->ip, src->iplen)) {
  ------------------
  |  Branch (168:9): [True: 0, False: 0]
  ------------------
  169|      0|      return 0;
  170|      0|    }
  171|      0|  }
  172|       |
  173|  4.88k|  dest->poison = src->poison;
  174|  4.88k|  return 1;
  175|  4.88k|}
x509_vpm.cc:_ZL14copy_int_paramPiPKiii:
  108|  14.6k|                           int prefer_src) {
  109|  14.6k|  if (should_copy(*dest != default_val, *src != default_val, prefer_src)) {
  ------------------
  |  Branch (109:7): [True: 0, False: 14.6k]
  ------------------
  110|      0|    *dest = *src;
  111|      0|  }
  112|  14.6k|}
x509_vpm.cc:_ZL11should_copyiii:
   97|  34.1k|static int should_copy(int dest_is_set, int src_is_set, int prefer_src) {
   98|  34.1k|  if (prefer_src) {
  ------------------
  |  Branch (98:7): [True: 0, False: 34.1k]
  ------------------
   99|       |    // We prefer the source, so as long as there is a value to copy, copy it.
  100|      0|    return src_is_set;
  101|      0|  }
  102|       |
  103|       |  // We prefer the destination, so only copy if the destination is unset.
  104|  34.1k|  return src_is_set && !dest_is_set;
  ------------------
  |  Branch (104:10): [True: 0, False: 34.1k]
  |  Branch (104:24): [True: 0, False: 0]
  ------------------
  105|  34.1k|}

x509_marshal_algorithm:
  110|  17.1k|int x509_marshal_algorithm(CBB *out, const X509_ALGOR *in) {
  111|  17.1k|  uint8_t *ptr;
  112|  17.1k|  int len = i2d_X509_ALGOR(in, NULL);
  113|  17.1k|  return len > 0 &&  //
  ------------------
  |  Branch (113:10): [True: 17.1k, False: 0]
  ------------------
  114|  17.1k|         CBB_add_space(out, &ptr, static_cast<size_t>(len)) &&
  ------------------
  |  Branch (114:10): [True: 17.1k, False: 0]
  ------------------
  115|  17.1k|         i2d_X509_ALGOR(in, &ptr) == len;
  ------------------
  |  Branch (115:10): [True: 17.1k, False: 0]
  ------------------
  116|  17.1k|}

x_name.cc:_ZL16x509_name_ex_newPP13ASN1_VALUE_stPK12ASN1_ITEM_st:
   94|   112k|static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) {
   95|   112k|  X509_NAME *ret = NULL;
   96|   112k|  ret = reinterpret_cast<X509_NAME *>(OPENSSL_malloc(sizeof(X509_NAME)));
   97|   112k|  if (!ret) {
  ------------------
  |  Branch (97:7): [True: 0, False: 112k]
  ------------------
   98|      0|    goto memerr;
   99|      0|  }
  100|   112k|  if ((ret->entries = sk_X509_NAME_ENTRY_new_null()) == NULL) {
  ------------------
  |  Branch (100:7): [True: 0, False: 112k]
  ------------------
  101|      0|    goto memerr;
  102|      0|  }
  103|   112k|  if ((ret->bytes = BUF_MEM_new()) == NULL) {
  ------------------
  |  Branch (103:7): [True: 0, False: 112k]
  ------------------
  104|      0|    goto memerr;
  105|      0|  }
  106|   112k|  ret->canon_enc = NULL;
  107|   112k|  ret->canon_enclen = 0;
  108|   112k|  ret->modified = 1;
  109|   112k|  *val = (ASN1_VALUE *)ret;
  110|   112k|  return 1;
  111|       |
  112|      0|memerr:
  113|      0|  if (ret) {
  ------------------
  |  Branch (113:7): [True: 0, False: 0]
  ------------------
  114|      0|    if (ret->entries) {
  ------------------
  |  Branch (114:9): [True: 0, False: 0]
  ------------------
  115|      0|      sk_X509_NAME_ENTRY_free(ret->entries);
  116|      0|    }
  117|      0|    OPENSSL_free(ret);
  118|      0|  }
  119|      0|  return 0;
  120|   112k|}
x_name.cc:_ZL17x509_name_ex_freePP13ASN1_VALUE_stPK12ASN1_ITEM_st:
  122|   112k|static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  123|   112k|  X509_NAME *a;
  124|   112k|  if (!pval || !*pval) {
  ------------------
  |  Branch (124:7): [True: 0, False: 112k]
  |  Branch (124:16): [True: 0, False: 112k]
  ------------------
  125|      0|    return;
  126|      0|  }
  127|   112k|  a = (X509_NAME *)*pval;
  128|       |
  129|   112k|  BUF_MEM_free(a->bytes);
  130|   112k|  sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free);
  131|   112k|  if (a->canon_enc) {
  ------------------
  |  Branch (131:7): [True: 56.2k, False: 56.2k]
  ------------------
  132|  56.2k|    OPENSSL_free(a->canon_enc);
  133|  56.2k|  }
  134|   112k|  OPENSSL_free(a);
  135|   112k|  *pval = NULL;
  136|   112k|}
x_name.cc:_ZL16x509_name_ex_d2iPP13ASN1_VALUE_stPPKhlPK12ASN1_ITEM_stiP11ASN1_TLC_st:
  148|  56.2k|                            ASN1_TLC *ctx) {
  149|  56.2k|  const unsigned char *p = *in, *q;
  150|  56.2k|  STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname = NULL;
  ------------------
  |  |   39|  56.2k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  151|  56.2k|  X509_NAME *nm = NULL;
  152|  56.2k|  size_t i, j;
  153|  56.2k|  int ret;
  154|  56.2k|  STACK_OF(X509_NAME_ENTRY) *entries;
  ------------------
  |  |   39|  56.2k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  155|  56.2k|  X509_NAME_ENTRY *entry;
  156|       |  // Bound the size of an X509_NAME we are willing to parse.
  157|  56.2k|  if (len > X509_NAME_MAX) {
  ------------------
  |  |   39|  56.2k|#define X509_NAME_MAX (1024 * 1024)
  ------------------
  |  Branch (157:7): [True: 0, False: 56.2k]
  ------------------
  158|      0|    len = X509_NAME_MAX;
  ------------------
  |  |   39|      0|#define X509_NAME_MAX (1024 * 1024)
  ------------------
  159|      0|  }
  160|  56.2k|  q = p;
  161|       |
  162|       |  // Get internal representation of Name
  163|  56.2k|  ASN1_VALUE *intname_val = NULL;
  164|  56.2k|  ret = ASN1_item_ex_d2i(&intname_val, &p, len,
  165|  56.2k|                         ASN1_ITEM_rptr(X509_NAME_INTERNAL), /*tag=*/-1,
  ------------------
  |  |  227|  56.2k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  166|  56.2k|                         /*aclass=*/0, opt, /*buf=*/NULL);
  167|  56.2k|  if (ret <= 0) {
  ------------------
  |  Branch (167:7): [True: 0, False: 56.2k]
  ------------------
  168|      0|    return ret;
  169|      0|  }
  170|  56.2k|  intname = (STACK_OF(STACK_OF_X509_NAME_ENTRY) *)intname_val;
  171|       |
  172|  56.2k|  if (*val) {
  ------------------
  |  Branch (172:7): [True: 56.2k, False: 0]
  ------------------
  173|  56.2k|    x509_name_ex_free(val, NULL);
  174|  56.2k|  }
  175|  56.2k|  ASN1_VALUE *nm_val = NULL;
  176|  56.2k|  if (!x509_name_ex_new(&nm_val, NULL)) {
  ------------------
  |  Branch (176:7): [True: 0, False: 56.2k]
  ------------------
  177|      0|    goto err;
  178|      0|  }
  179|  56.2k|  nm = (X509_NAME *)nm_val;
  180|       |  // We've decoded it: now cache encoding
  181|  56.2k|  if (!BUF_MEM_grow(nm->bytes, p - q)) {
  ------------------
  |  Branch (181:7): [True: 0, False: 56.2k]
  ------------------
  182|      0|    goto err;
  183|      0|  }
  184|  56.2k|  OPENSSL_memcpy(nm->bytes->data, q, p - q);
  185|       |
  186|       |  // Convert internal representation to X509_NAME structure
  187|   112k|  for (i = 0; i < sk_STACK_OF_X509_NAME_ENTRY_num(intname); i++) {
  ------------------
  |  Branch (187:15): [True: 56.2k, False: 56.2k]
  ------------------
  188|  56.2k|    entries = sk_STACK_OF_X509_NAME_ENTRY_value(intname, i);
  189|   112k|    for (j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
  ------------------
  |  Branch (189:17): [True: 56.2k, False: 56.2k]
  ------------------
  190|  56.2k|      entry = sk_X509_NAME_ENTRY_value(entries, j);
  191|  56.2k|      entry->set = (int)i;
  192|  56.2k|      if (!sk_X509_NAME_ENTRY_push(nm->entries, entry)) {
  ------------------
  |  Branch (192:11): [True: 0, False: 56.2k]
  ------------------
  193|      0|        goto err;
  194|      0|      }
  195|  56.2k|      (void)sk_X509_NAME_ENTRY_set(entries, j, NULL);
  196|  56.2k|    }
  197|  56.2k|  }
  198|  56.2k|  ret = x509_name_canon(nm);
  199|  56.2k|  if (!ret) {
  ------------------
  |  Branch (199:7): [True: 0, False: 56.2k]
  ------------------
  200|      0|    goto err;
  201|      0|  }
  202|  56.2k|  sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname, local_sk_X509_NAME_ENTRY_free);
  203|  56.2k|  nm->modified = 0;
  204|  56.2k|  *val = (ASN1_VALUE *)nm;
  205|  56.2k|  *in = p;
  206|  56.2k|  return ret;
  207|      0|err:
  208|      0|  X509_NAME_free(nm);
  209|      0|  sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname,
  210|      0|                                       local_sk_X509_NAME_ENTRY_pop_free);
  211|      0|  OPENSSL_PUT_ERROR(X509, ERR_R_ASN1_LIB);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  212|      0|  return 0;
  213|  56.2k|}
x_name.cc:_ZL15x509_name_canonP12X509_name_st:
  295|  56.2k|static int x509_name_canon(X509_NAME *a) {
  296|  56.2k|  unsigned char *p;
  297|  56.2k|  STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname = NULL;
  ------------------
  |  |   39|  56.2k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  298|  56.2k|  STACK_OF(X509_NAME_ENTRY) *entries = NULL;
  ------------------
  |  |   39|  56.2k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  299|  56.2k|  X509_NAME_ENTRY *entry, *tmpentry = NULL;
  300|  56.2k|  int set = -1, ret = 0, len;
  301|  56.2k|  size_t i;
  302|       |
  303|  56.2k|  if (a->canon_enc) {
  ------------------
  |  Branch (303:7): [True: 0, False: 56.2k]
  ------------------
  304|      0|    OPENSSL_free(a->canon_enc);
  305|      0|    a->canon_enc = NULL;
  306|      0|  }
  307|       |  // Special case: empty X509_NAME => null encoding
  308|  56.2k|  if (sk_X509_NAME_ENTRY_num(a->entries) == 0) {
  ------------------
  |  Branch (308:7): [True: 0, False: 56.2k]
  ------------------
  309|      0|    a->canon_enclen = 0;
  310|      0|    return 1;
  311|      0|  }
  312|  56.2k|  intname = sk_STACK_OF_X509_NAME_ENTRY_new_null();
  313|  56.2k|  if (!intname) {
  ------------------
  |  Branch (313:7): [True: 0, False: 56.2k]
  ------------------
  314|      0|    goto err;
  315|      0|  }
  316|   112k|  for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
  ------------------
  |  Branch (316:15): [True: 56.2k, False: 56.2k]
  ------------------
  317|  56.2k|    entry = sk_X509_NAME_ENTRY_value(a->entries, i);
  318|  56.2k|    if (entry->set != set) {
  ------------------
  |  Branch (318:9): [True: 56.2k, False: 0]
  ------------------
  319|  56.2k|      entries = sk_X509_NAME_ENTRY_new_null();
  320|  56.2k|      if (!entries) {
  ------------------
  |  Branch (320:11): [True: 0, False: 56.2k]
  ------------------
  321|      0|        goto err;
  322|      0|      }
  323|  56.2k|      if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries)) {
  ------------------
  |  Branch (323:11): [True: 0, False: 56.2k]
  ------------------
  324|      0|        sk_X509_NAME_ENTRY_free(entries);
  325|      0|        goto err;
  326|      0|      }
  327|  56.2k|      set = entry->set;
  328|  56.2k|    }
  329|  56.2k|    tmpentry = X509_NAME_ENTRY_new();
  330|  56.2k|    if (tmpentry == NULL) {
  ------------------
  |  Branch (330:9): [True: 0, False: 56.2k]
  ------------------
  331|      0|      goto err;
  332|      0|    }
  333|  56.2k|    tmpentry->object = OBJ_dup(entry->object);
  334|  56.2k|    if (!asn1_string_canon(tmpentry->value, entry->value)) {
  ------------------
  |  Branch (334:9): [True: 0, False: 56.2k]
  ------------------
  335|      0|      goto err;
  336|      0|    }
  337|  56.2k|    if (!sk_X509_NAME_ENTRY_push(entries, tmpentry)) {
  ------------------
  |  Branch (337:9): [True: 0, False: 56.2k]
  ------------------
  338|      0|      goto err;
  339|      0|    }
  340|  56.2k|    tmpentry = NULL;
  341|  56.2k|  }
  342|       |
  343|       |  // Finally generate encoding
  344|       |
  345|  56.2k|  len = i2d_name_canon(intname, NULL);
  346|  56.2k|  if (len < 0) {
  ------------------
  |  Branch (346:7): [True: 0, False: 56.2k]
  ------------------
  347|      0|    goto err;
  348|      0|  }
  349|  56.2k|  a->canon_enclen = len;
  350|       |
  351|  56.2k|  p = reinterpret_cast<uint8_t *>(OPENSSL_malloc(a->canon_enclen));
  352|       |
  353|  56.2k|  if (!p) {
  ------------------
  |  Branch (353:7): [True: 0, False: 56.2k]
  ------------------
  354|      0|    goto err;
  355|      0|  }
  356|       |
  357|  56.2k|  a->canon_enc = p;
  358|       |
  359|  56.2k|  i2d_name_canon(intname, &p);
  360|       |
  361|  56.2k|  ret = 1;
  362|       |
  363|  56.2k|err:
  364|       |
  365|  56.2k|  if (tmpentry) {
  ------------------
  |  Branch (365:7): [True: 0, False: 56.2k]
  ------------------
  366|      0|    X509_NAME_ENTRY_free(tmpentry);
  367|      0|  }
  368|  56.2k|  if (intname) {
  ------------------
  |  Branch (368:7): [True: 56.2k, False: 0]
  ------------------
  369|  56.2k|    sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname,
  370|  56.2k|                                         local_sk_X509_NAME_ENTRY_pop_free);
  371|  56.2k|  }
  372|  56.2k|  return ret;
  373|  56.2k|}
x_name.cc:_ZL17asn1_string_canonP14asn1_string_stS0_:
  382|  56.2k|static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in) {
  383|  56.2k|  unsigned char *to, *from;
  384|  56.2k|  int len, i;
  385|       |
  386|       |  // If type not in bitmask just copy string across
  387|  56.2k|  if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON)) {
  ------------------
  |  |  378|  56.2k|  (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | \
  |  |  ------------------
  |  |  |  |  135|  56.2k|#define B_ASN1_UTF8STRING 0x2000
  |  |  ------------------
  |  |                 (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | \
  |  |  ------------------
  |  |  |  |  134|  56.2k|#define B_ASN1_BMPSTRING 0x0800
  |  |  ------------------
  |  |                 (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | \
  |  |  ------------------
  |  |  |  |  131|  56.2k|#define B_ASN1_UNIVERSALSTRING 0x0100
  |  |  ------------------
  |  |  379|  56.2k|   B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING |  \
  |  |  ------------------
  |  |  |  |  122|  56.2k|#define B_ASN1_PRINTABLESTRING 0x0002
  |  |  ------------------
  |  |                  B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING |  \
  |  |  ------------------
  |  |  |  |  123|  56.2k|#define B_ASN1_T61STRING 0x0004
  |  |  ------------------
  |  |                  B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING |  \
  |  |  ------------------
  |  |  |  |  126|  56.2k|#define B_ASN1_IA5STRING 0x0010
  |  |  ------------------
  |  |  380|  56.2k|   B_ASN1_VISIBLESTRING)
  |  |  ------------------
  |  |  |  |  129|  56.2k|#define B_ASN1_VISIBLESTRING 0x0040
  |  |  ------------------
  ------------------
  |  Branch (387:7): [True: 0, False: 56.2k]
  ------------------
  388|      0|    if (!ASN1_STRING_copy(out, in)) {
  ------------------
  |  Branch (388:9): [True: 0, False: 0]
  ------------------
  389|      0|      return 0;
  390|      0|    }
  391|      0|    return 1;
  392|      0|  }
  393|       |
  394|  56.2k|  out->type = V_ASN1_UTF8STRING;
  ------------------
  |  |   96|  56.2k|#define V_ASN1_UTF8STRING 12
  ------------------
  395|  56.2k|  out->length = ASN1_STRING_to_UTF8(&out->data, in);
  396|  56.2k|  if (out->length == -1) {
  ------------------
  |  Branch (396:7): [True: 0, False: 56.2k]
  ------------------
  397|      0|    return 0;
  398|      0|  }
  399|       |
  400|  56.2k|  to = out->data;
  401|  56.2k|  from = to;
  402|       |
  403|  56.2k|  len = out->length;
  404|       |
  405|       |  // Convert string in place to canonical form.
  406|       |
  407|       |  // Ignore leading spaces
  408|  56.2k|  while ((len > 0) && OPENSSL_isspace(*from)) {
  ------------------
  |  Branch (408:10): [True: 56.2k, False: 0]
  |  Branch (408:23): [True: 0, False: 56.2k]
  ------------------
  409|      0|    from++;
  410|      0|    len--;
  411|      0|  }
  412|       |
  413|  56.2k|  to = from + len;
  414|       |
  415|       |  // Ignore trailing spaces
  416|  56.2k|  while ((len > 0) && OPENSSL_isspace(to[-1])) {
  ------------------
  |  Branch (416:10): [True: 56.2k, False: 0]
  |  Branch (416:23): [True: 0, False: 56.2k]
  ------------------
  417|      0|    to--;
  418|      0|    len--;
  419|      0|  }
  420|       |
  421|  56.2k|  to = out->data;
  422|       |
  423|  56.2k|  i = 0;
  424|   449k|  while (i < len) {
  ------------------
  |  Branch (424:10): [True: 393k, False: 56.2k]
  ------------------
  425|       |    // Collapse multiple spaces
  426|   393k|    if (OPENSSL_isspace(*from)) {
  ------------------
  |  Branch (426:9): [True: 56.2k, False: 337k]
  ------------------
  427|       |      // Copy one space across
  428|  56.2k|      *to++ = ' ';
  429|       |      // Ignore subsequent spaces. Note: don't need to check len here
  430|       |      // because we know the last character is a non-space so we can't
  431|       |      // overflow.
  432|  56.2k|      do {
  433|  56.2k|        from++;
  434|  56.2k|        i++;
  435|  56.2k|      } while (OPENSSL_isspace(*from));
  ------------------
  |  Branch (435:16): [True: 0, False: 56.2k]
  ------------------
  436|   337k|    } else {
  437|   337k|      *to++ = OPENSSL_tolower(*from);
  438|   337k|      from++;
  439|   337k|      i++;
  440|   337k|    }
  441|   393k|  }
  442|       |
  443|  56.2k|  out->length = to - out->data;
  444|       |
  445|  56.2k|  return 1;
  446|  56.2k|}
x_name.cc:_ZL14i2d_name_canonP33stack_st_STACK_OF_X509_NAME_ENTRYPPh:
  449|   112k|                          unsigned char **in) {
  450|   112k|  int len, ltmp;
  451|   112k|  size_t i;
  452|   112k|  ASN1_VALUE *v;
  453|   112k|  STACK_OF(ASN1_VALUE) *intname = (STACK_OF(ASN1_VALUE) *)_intname;
  ------------------
  |  |   39|   112k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  454|       |
  455|   112k|  len = 0;
  456|   224k|  for (i = 0; i < sk_ASN1_VALUE_num(intname); i++) {
  ------------------
  |  Branch (456:15): [True: 112k, False: 112k]
  ------------------
  457|   112k|    v = sk_ASN1_VALUE_value(intname, i);
  458|   112k|    ltmp = ASN1_item_ex_i2d(&v, in, ASN1_ITEM_rptr(X509_NAME_ENTRIES),
  ------------------
  |  |  227|   112k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  459|   112k|                            /*tag=*/-1, /*aclass=*/0);
  460|   112k|    if (ltmp < 0) {
  ------------------
  |  Branch (460:9): [True: 0, False: 112k]
  ------------------
  461|      0|      return ltmp;
  462|      0|    }
  463|   112k|    len += ltmp;
  464|   112k|  }
  465|   112k|  return len;
  466|   112k|}
x_name.cc:_ZL29local_sk_X509_NAME_ENTRY_freeP24stack_st_X509_NAME_ENTRY:
  138|  56.2k|static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne) {
  139|  56.2k|  sk_X509_NAME_ENTRY_free(ne);
  140|  56.2k|}
x_name.cc:_ZL33local_sk_X509_NAME_ENTRY_pop_freeP24stack_st_X509_NAME_ENTRY:
  142|  56.2k|static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne) {
  143|  56.2k|  sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
  144|  56.2k|}
x_name.cc:_ZL16x509_name_ex_i2dPP13ASN1_VALUE_stPPhPK12ASN1_ITEM_st:
  216|  6.73k|                            const ASN1_ITEM *it) {
  217|  6.73k|  X509_NAME *a = (X509_NAME *)*val;
  218|  6.73k|  if (a->modified && (!x509_name_encode(a) || !x509_name_canon(a))) {
  ------------------
  |  Branch (218:7): [True: 0, False: 6.73k]
  |  Branch (218:23): [True: 0, False: 0]
  |  Branch (218:47): [True: 0, False: 0]
  ------------------
  219|      0|    return -1;
  220|      0|  }
  221|  6.73k|  int ret = a->bytes->length;
  222|  6.73k|  if (out != NULL) {
  ------------------
  |  Branch (222:7): [True: 3.36k, False: 3.36k]
  ------------------
  223|  3.36k|    OPENSSL_memcpy(*out, a->bytes->data, ret);
  224|  3.36k|    *out += ret;
  225|  3.36k|  }
  226|  6.73k|  return ret;
  227|  6.73k|}

x_pubkey.cc:_ZL9pubkey_cbiPP13ASN1_VALUE_stPK12ASN1_ITEM_stPv:
   61|   168k|                     void *exarg) {
   62|   168k|  X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval;
   63|   168k|  if (operation == ASN1_OP_FREE_POST) {
  ------------------
  |  |  471|   168k|#define ASN1_OP_FREE_POST 3
  ------------------
  |  Branch (63:7): [True: 28.1k, False: 140k]
  ------------------
   64|  28.1k|    EVP_PKEY_free(pubkey->pkey);
   65|   140k|  } else if (operation == ASN1_OP_D2I_POST) {
  ------------------
  |  |  473|   140k|#define ASN1_OP_D2I_POST 5
  ------------------
  |  Branch (65:14): [True: 28.1k, False: 112k]
  ------------------
   66|  28.1k|    x509_pubkey_changed(pubkey);
   67|  28.1k|  }
   68|   168k|  return 1;
   69|   168k|}
x_pubkey.cc:_ZL19x509_pubkey_changedP14X509_pubkey_st:
   31|  28.1k|static void x509_pubkey_changed(X509_PUBKEY *pub) {
   32|  28.1k|  EVP_PKEY_free(pub->pkey);
   33|  28.1k|  pub->pkey = NULL;
   34|       |
   35|       |  // Re-encode the |X509_PUBKEY| to DER and parse it with EVP's APIs.
   36|  28.1k|  uint8_t *spki = NULL;
   37|  28.1k|  int spki_len = i2d_X509_PUBKEY(pub, &spki);
   38|  28.1k|  EVP_PKEY *pkey;
   39|  28.1k|  if (spki_len < 0) {
  ------------------
  |  Branch (39:7): [True: 0, False: 28.1k]
  ------------------
   40|      0|    goto err;
   41|      0|  }
   42|       |
   43|  28.1k|  CBS cbs;
   44|  28.1k|  CBS_init(&cbs, spki, (size_t)spki_len);
   45|  28.1k|  pkey = EVP_parse_public_key(&cbs);
   46|  28.1k|  if (pkey == NULL || CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (46:7): [True: 0, False: 28.1k]
  |  Branch (46:23): [True: 0, False: 28.1k]
  ------------------
   47|      0|    EVP_PKEY_free(pkey);
   48|      0|    goto err;
   49|      0|  }
   50|       |
   51|  28.1k|  pub->pkey = pkey;
   52|       |
   53|  28.1k|err:
   54|  28.1k|  OPENSSL_free(spki);
   55|       |  // If the operation failed, clear errors. An |X509_PUBKEY| whose key we cannot
   56|       |  // parse is still a valid SPKI. It just cannot be converted to an |EVP_PKEY|.
   57|  28.1k|  ERR_clear_error();
   58|  28.1k|}

X509_free:
   83|  52.7k|void X509_free(X509 *x509) {
   84|  52.7k|  if (x509 == NULL || !CRYPTO_refcount_dec_and_test_zero(&x509->references)) {
  ------------------
  |  Branch (84:7): [True: 24.6k, False: 28.1k]
  |  Branch (84:23): [True: 0, False: 28.1k]
  ------------------
   85|  24.6k|    return;
   86|  24.6k|  }
   87|       |
   88|  28.1k|  CRYPTO_free_ex_data(&g_ex_data_class, &x509->ex_data);
   89|       |
   90|  28.1k|  X509_CINF_free(x509->cert_info);
   91|  28.1k|  X509_ALGOR_free(x509->sig_alg);
   92|  28.1k|  ASN1_BIT_STRING_free(x509->signature);
   93|  28.1k|  ASN1_OCTET_STRING_free(x509->skid);
   94|  28.1k|  AUTHORITY_KEYID_free(x509->akid);
   95|  28.1k|  CRL_DIST_POINTS_free(x509->crldp);
   96|  28.1k|  GENERAL_NAMES_free(x509->altname);
   97|  28.1k|  NAME_CONSTRAINTS_free(x509->nc);
   98|  28.1k|  X509_CERT_AUX_free(x509->aux);
   99|  28.1k|  CRYPTO_MUTEX_cleanup(&x509->lock);
  100|       |
  101|  28.1k|  OPENSSL_free(x509);
  102|  28.1k|}
d2i_X509:
  191|      2|X509 *d2i_X509(X509 **out, const uint8_t **inp, long len) {
  192|      2|  X509 *ret = NULL;
  193|      2|  if (len < 0) {
  ------------------
  |  Branch (193:7): [True: 0, False: 2]
  ------------------
  194|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  195|      0|    goto err;
  196|      0|  }
  197|       |
  198|      2|  CBS cbs;
  199|      2|  CBS_init(&cbs, *inp, (size_t)len);
  200|      2|  ret = x509_parse(&cbs, NULL);
  201|      2|  if (ret == NULL) {
  ------------------
  |  Branch (201:7): [True: 0, False: 2]
  ------------------
  202|      0|    goto err;
  203|      0|  }
  204|       |
  205|      2|  *inp = CBS_data(&cbs);
  206|       |
  207|      2|err:
  208|      2|  if (out != NULL) {
  ------------------
  |  Branch (208:7): [True: 0, False: 2]
  ------------------
  209|      0|    X509_free(*out);
  210|      0|    *out = ret;
  211|      0|  }
  212|      2|  return ret;
  213|      2|}
i2d_X509:
  215|  17.1k|int i2d_X509(X509 *x509, uint8_t **outp) {
  216|  17.1k|  if (x509 == NULL) {
  ------------------
  |  Branch (216:7): [True: 0, False: 17.1k]
  ------------------
  217|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_MISSING_VALUE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  218|      0|    return -1;
  219|      0|  }
  220|       |
  221|  17.1k|  bssl::ScopedCBB cbb;
  222|  17.1k|  CBB cert;
  223|  17.1k|  if (!CBB_init(cbb.get(), 64) ||  //
  ------------------
  |  Branch (223:7): [True: 0, False: 17.1k]
  ------------------
  224|  17.1k|      !CBB_add_asn1(cbb.get(), &cert, CBS_ASN1_SEQUENCE)) {
  ------------------
  |  |  223|  17.1k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  17.1k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  17.1k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (224:7): [True: 0, False: 17.1k]
  ------------------
  225|      0|    return -1;
  226|      0|  }
  227|       |
  228|       |  // TODO(crbug.com/boringssl/443): When the rest of the library is decoupled
  229|       |  // from the tasn_*.c implementation, replace this with |CBS|-based functions.
  230|  17.1k|  uint8_t *out;
  231|  17.1k|  int len = i2d_X509_CINF(x509->cert_info, NULL);
  232|  17.1k|  if (len < 0 ||  //
  ------------------
  |  Branch (232:7): [True: 0, False: 17.1k]
  ------------------
  233|  17.1k|      !CBB_add_space(&cert, &out, static_cast<size_t>(len)) ||
  ------------------
  |  Branch (233:7): [True: 0, False: 17.1k]
  ------------------
  234|  17.1k|      i2d_X509_CINF(x509->cert_info, &out) != len ||
  ------------------
  |  Branch (234:7): [True: 0, False: 17.1k]
  ------------------
  235|  17.1k|      !x509_marshal_algorithm(&cert, x509->sig_alg) ||
  ------------------
  |  Branch (235:7): [True: 0, False: 17.1k]
  ------------------
  236|  17.1k|      !asn1_marshal_bit_string(&cert, x509->signature, /*tag=*/0)) {
  ------------------
  |  Branch (236:7): [True: 0, False: 17.1k]
  ------------------
  237|      0|    return -1;
  238|      0|  }
  239|       |
  240|  17.1k|  return CBB_finish_i2d(cbb.get(), outp);
  241|  17.1k|}
X509_parse_from_buffer:
  304|  28.1k|X509 *X509_parse_from_buffer(CRYPTO_BUFFER *buf) {
  305|  28.1k|  CBS cbs;
  306|  28.1k|  CBS_init(&cbs, CRYPTO_BUFFER_data(buf), CRYPTO_BUFFER_len(buf));
  307|  28.1k|  X509 *ret = x509_parse(&cbs, buf);
  308|  28.1k|  if (ret == NULL || CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (308:7): [True: 0, False: 28.1k]
  |  Branch (308:22): [True: 0, False: 28.1k]
  ------------------
  309|      0|    X509_free(ret);
  310|      0|    return NULL;
  311|      0|  }
  312|       |
  313|  28.1k|  return ret;
  314|  28.1k|}
X509_up_ref:
  316|      2|int X509_up_ref(X509 *x) {
  317|      2|  CRYPTO_refcount_inc(&x->references);
  318|      2|  return 1;
  319|      2|}
x_x509.cc:_ZL13x509_new_nullv:
   52|  28.1k|static X509 *x509_new_null(void) {
   53|  28.1k|  X509 *ret = reinterpret_cast<X509 *>(OPENSSL_zalloc(sizeof(X509)));
   54|  28.1k|  if (ret == NULL) {
  ------------------
  |  Branch (54:7): [True: 0, False: 28.1k]
  ------------------
   55|      0|    return NULL;
   56|      0|  }
   57|       |
   58|  28.1k|  ret->references = 1;
   59|  28.1k|  ret->ex_pathlen = -1;
   60|  28.1k|  CRYPTO_new_ex_data(&ret->ex_data);
   61|  28.1k|  CRYPTO_MUTEX_init(&ret->lock);
   62|  28.1k|  return ret;
   63|  28.1k|}
x_x509.cc:_ZL10x509_parseP6cbs_stP16crypto_buffer_st:
  104|  28.1k|static X509 *x509_parse(CBS *cbs, CRYPTO_BUFFER *buf) {
  105|  28.1k|  CBS cert, tbs, sigalg, sig;
  106|  28.1k|  if (!CBS_get_asn1(cbs, &cert, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  28.1k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  28.1k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  28.1k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (106:7): [True: 0, False: 28.1k]
  ------------------
  107|       |      // Bound the length to comfortably fit in an int. Lengths in this
  108|       |      // module often omit overflow checks.
  109|  28.1k|      CBS_len(&cert) > INT_MAX / 2 ||
  ------------------
  |  Branch (109:7): [True: 0, False: 28.1k]
  ------------------
  110|  28.1k|      !CBS_get_asn1_element(&cert, &tbs, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  28.1k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  28.1k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  28.1k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (110:7): [True: 0, False: 28.1k]
  ------------------
  111|  28.1k|      !CBS_get_asn1_element(&cert, &sigalg, CBS_ASN1_SEQUENCE)) {
  ------------------
  |  |  223|  28.1k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  28.1k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  28.1k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (111:7): [True: 0, False: 28.1k]
  ------------------
  112|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  113|      0|    return nullptr;
  114|      0|  }
  115|       |
  116|       |  // For just the signature field, we accept non-minimal BER lengths, though not
  117|       |  // indefinite-length encoding. See b/18228011.
  118|       |  //
  119|       |  // TODO(crbug.com/boringssl/354): Switch the affected callers to convert the
  120|       |  // certificate before parsing and then remove this workaround.
  121|  28.1k|  CBS_ASN1_TAG tag;
  122|  28.1k|  size_t header_len;
  123|  28.1k|  int indefinite;
  124|  28.1k|  if (!CBS_get_any_ber_asn1_element(&cert, &sig, &tag, &header_len,
  ------------------
  |  Branch (124:7): [True: 0, False: 28.1k]
  ------------------
  125|  28.1k|                                    /*out_ber_found=*/nullptr,
  126|  28.1k|                                    &indefinite) ||
  127|  28.1k|      tag != CBS_ASN1_BITSTRING || indefinite ||  //
  ------------------
  |  |  217|  56.2k|#define CBS_ASN1_BITSTRING 0x3u
  ------------------
  |  Branch (127:7): [True: 0, False: 28.1k]
  |  Branch (127:36): [True: 0, False: 28.1k]
  ------------------
  128|  28.1k|      !CBS_skip(&sig, header_len) ||              //
  ------------------
  |  Branch (128:7): [True: 0, False: 28.1k]
  ------------------
  129|  28.1k|      CBS_len(&cert) != 0) {
  ------------------
  |  Branch (129:7): [True: 0, False: 28.1k]
  ------------------
  130|      0|    OPENSSL_PUT_ERROR(ASN1, ASN1_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  131|      0|    return nullptr;
  132|      0|  }
  133|       |
  134|  28.1k|  bssl::UniquePtr<X509> ret(x509_new_null());
  135|  28.1k|  if (ret == nullptr) {
  ------------------
  |  Branch (135:7): [True: 0, False: 28.1k]
  ------------------
  136|      0|    return nullptr;
  137|      0|  }
  138|       |
  139|       |  // TODO(crbug.com/boringssl/443): When the rest of the library is decoupled
  140|       |  // from the tasn_*.c implementation, replace this with |CBS|-based
  141|       |  // functions.
  142|  28.1k|  const uint8_t *inp = CBS_data(&tbs);
  143|  28.1k|  if (ASN1_item_ex_d2i((ASN1_VALUE **)&ret->cert_info, &inp, CBS_len(&tbs),
  ------------------
  |  Branch (143:7): [True: 0, False: 28.1k]
  ------------------
  144|  28.1k|                       ASN1_ITEM_rptr(X509_CINF), /*tag=*/-1,
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  145|  28.1k|                       /*aclass=*/0, /*opt=*/0, buf) <= 0 ||
  146|  28.1k|      inp != CBS_data(&tbs) + CBS_len(&tbs)) {
  ------------------
  |  Branch (146:7): [True: 0, False: 28.1k]
  ------------------
  147|      0|    return nullptr;
  148|      0|  }
  149|       |
  150|  28.1k|  inp = CBS_data(&sigalg);
  151|  28.1k|  ret->sig_alg = d2i_X509_ALGOR(nullptr, &inp, CBS_len(&sigalg));
  152|  28.1k|  if (ret->sig_alg == nullptr || inp != CBS_data(&sigalg) + CBS_len(&sigalg)) {
  ------------------
  |  Branch (152:7): [True: 0, False: 28.1k]
  |  Branch (152:34): [True: 0, False: 28.1k]
  ------------------
  153|      0|    return nullptr;
  154|      0|  }
  155|       |
  156|  28.1k|  inp = CBS_data(&sig);
  157|  28.1k|  ret->signature = c2i_ASN1_BIT_STRING(nullptr, &inp, CBS_len(&sig));
  158|  28.1k|  if (ret->signature == nullptr || inp != CBS_data(&sig) + CBS_len(&sig)) {
  ------------------
  |  Branch (158:7): [True: 0, False: 28.1k]
  |  Branch (158:36): [True: 0, False: 28.1k]
  ------------------
  159|      0|    return nullptr;
  160|      0|  }
  161|       |
  162|       |  // The version must be one of v1(0), v2(1), or v3(2).
  163|  28.1k|  long version = X509_VERSION_1;
  ------------------
  |  |  120|  28.1k|#define X509_VERSION_1 0
  ------------------
  164|  28.1k|  if (ret->cert_info->version != nullptr) {
  ------------------
  |  Branch (164:7): [True: 28.1k, False: 0]
  ------------------
  165|  28.1k|    version = ASN1_INTEGER_get(ret->cert_info->version);
  166|       |    // TODO(https://crbug.com/boringssl/364): |X509_VERSION_1| should
  167|       |    // also be rejected here. This means an explicitly-encoded X.509v1
  168|       |    // version. v1 is DEFAULT, so DER requires it be omitted.
  169|  28.1k|    if (version < X509_VERSION_1 || version > X509_VERSION_3) {
  ------------------
  |  |  120|  56.2k|#define X509_VERSION_1 0
  ------------------
                  if (version < X509_VERSION_1 || version > X509_VERSION_3) {
  ------------------
  |  |  122|  28.1k|#define X509_VERSION_3 2
  ------------------
  |  Branch (169:9): [True: 0, False: 28.1k]
  |  Branch (169:37): [True: 0, False: 28.1k]
  ------------------
  170|      0|      OPENSSL_PUT_ERROR(X509, X509_R_INVALID_VERSION);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  171|      0|      return nullptr;
  172|      0|    }
  173|  28.1k|  }
  174|       |
  175|       |  // Per RFC 5280, section 4.1.2.8, these fields require v2 or v3.
  176|  28.1k|  if (version == X509_VERSION_1 && (ret->cert_info->issuerUID != nullptr ||
  ------------------
  |  |  120|  56.2k|#define X509_VERSION_1 0
  ------------------
  |  Branch (176:7): [True: 0, False: 28.1k]
  |  Branch (176:37): [True: 0, False: 0]
  ------------------
  177|      0|                                    ret->cert_info->subjectUID != nullptr)) {
  ------------------
  |  Branch (177:37): [True: 0, False: 0]
  ------------------
  178|      0|    OPENSSL_PUT_ERROR(X509, X509_R_INVALID_FIELD_FOR_VERSION);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  179|      0|    return nullptr;
  180|      0|  }
  181|       |
  182|       |  // Per RFC 5280, section 4.1.2.9, extensions require v3.
  183|  28.1k|  if (version != X509_VERSION_3 && ret->cert_info->extensions != nullptr) {
  ------------------
  |  |  122|  56.2k|#define X509_VERSION_3 2
  ------------------
  |  Branch (183:7): [True: 0, False: 28.1k]
  |  Branch (183:36): [True: 0, False: 0]
  ------------------
  184|      0|    OPENSSL_PUT_ERROR(X509, X509_R_INVALID_FIELD_FOR_VERSION);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  185|      0|    return nullptr;
  186|      0|  }
  187|       |
  188|  28.1k|  return ret.release();
  189|  28.1k|}

LLVMFuzzerTestOneInput:
  257|  4.88k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
  258|  4.88k|  constexpr size_t kMaxExpensiveAPIs = 100;
  259|  4.88k|  constexpr size_t kMaxAPIs = 10000;
  260|  4.88k|  unsigned expensive_api_count = 0;
  261|       |
  262|  4.88k|  const std::function<void(SSL_CTX *, CBS *)> kAPIs[] = {
  263|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  264|  4.88k|        uint8_t b;
  265|  4.88k|        if (!CBS_get_u8(cbs, &b)) {
  266|  4.88k|          return;
  267|  4.88k|        }
  268|  4.88k|        SSL_CTX_set_quiet_shutdown(ctx, b);
  269|  4.88k|      },
  270|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_quiet_shutdown(ctx); },
  271|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  272|  4.88k|        uint16_t version;
  273|  4.88k|        if (!CBS_get_u16(cbs, &version)) {
  274|  4.88k|          return;
  275|  4.88k|        }
  276|  4.88k|        SSL_CTX_set_min_proto_version(ctx, version);
  277|  4.88k|      },
  278|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  279|  4.88k|        uint16_t version;
  280|  4.88k|        if (!CBS_get_u16(cbs, &version)) {
  281|  4.88k|          return;
  282|  4.88k|        }
  283|  4.88k|        SSL_CTX_set_max_proto_version(ctx, version);
  284|  4.88k|      },
  285|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  286|  4.88k|        uint32_t options;
  287|  4.88k|        if (!CBS_get_u32(cbs, &options)) {
  288|  4.88k|          return;
  289|  4.88k|        }
  290|  4.88k|        SSL_CTX_set_options(ctx, options);
  291|  4.88k|      },
  292|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  293|  4.88k|        uint32_t options;
  294|  4.88k|        if (!CBS_get_u32(cbs, &options)) {
  295|  4.88k|          return;
  296|  4.88k|        }
  297|  4.88k|        SSL_CTX_clear_options(ctx, options);
  298|  4.88k|      },
  299|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_options(ctx); },
  300|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  301|  4.88k|        uint32_t mode;
  302|  4.88k|        if (!CBS_get_u32(cbs, &mode)) {
  303|  4.88k|          return;
  304|  4.88k|        }
  305|  4.88k|        SSL_CTX_set_mode(ctx, mode);
  306|  4.88k|      },
  307|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  308|  4.88k|        uint32_t mode;
  309|  4.88k|        if (!CBS_get_u32(cbs, &mode)) {
  310|  4.88k|          return;
  311|  4.88k|        }
  312|  4.88k|        SSL_CTX_clear_mode(ctx, mode);
  313|  4.88k|      },
  314|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_mode(ctx); },
  315|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  316|  4.88k|        SSL_CTX_use_certificate(ctx, g_state.cert_.get());
  317|  4.88k|      },
  318|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  319|  4.88k|        SSL_CTX_use_PrivateKey(ctx, g_state.pkey_.get());
  320|  4.88k|      },
  321|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  322|  4.88k|        SSL_CTX_set1_chain(ctx, g_state.certs_.get());
  323|  4.88k|      },
  324|  4.88k|      [&](SSL_CTX *ctx, CBS *cbs) {
  325|       |        // Avoid an unbounded certificate chain.
  326|  4.88k|        if (++expensive_api_count >= kMaxExpensiveAPIs) {
  327|  4.88k|          return;
  328|  4.88k|        }
  329|       |
  330|  4.88k|        SSL_CTX_add1_chain_cert(ctx, g_state.cert_.get());
  331|  4.88k|      },
  332|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_clear_chain_certs(ctx); },
  333|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_clear_extra_chain_certs(ctx); },
  334|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_check_private_key(ctx); },
  335|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get0_certificate(ctx); },
  336|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get0_privatekey(ctx); },
  337|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  338|  4.88k|        STACK_OF(X509) * chains;
  339|  4.88k|        SSL_CTX_get0_chain_certs(ctx, &chains);
  340|  4.88k|      },
  341|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  342|  4.88k|        std::vector<uint8_t> sct_data;
  343|  4.88k|        if (!GetVector(&sct_data, cbs)) {
  344|  4.88k|          return;
  345|  4.88k|        }
  346|  4.88k|        SSL_CTX_set_signed_cert_timestamp_list(ctx, sct_data.data(),
  347|  4.88k|                                               sct_data.size());
  348|  4.88k|      },
  349|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  350|  4.88k|        std::vector<uint8_t> ocsp_data;
  351|  4.88k|        if (!GetVector(&ocsp_data, cbs)) {
  352|  4.88k|          return;
  353|  4.88k|        }
  354|  4.88k|        SSL_CTX_set_ocsp_response(ctx, ocsp_data.data(), ocsp_data.size());
  355|  4.88k|      },
  356|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  357|  4.88k|        std::vector<uint16_t> algs;
  358|  4.88k|        if (!GetVector(&algs, cbs)) {
  359|  4.88k|          return;
  360|  4.88k|        }
  361|  4.88k|        SSL_CTX_set_signing_algorithm_prefs(ctx, algs.data(), algs.size());
  362|  4.88k|      },
  363|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  364|  4.88k|        std::string ciphers;
  365|  4.88k|        if (!GetString(&ciphers, cbs)) {
  366|  4.88k|          return;
  367|  4.88k|        }
  368|  4.88k|        SSL_CTX_set_strict_cipher_list(ctx, ciphers.c_str());
  369|  4.88k|      },
  370|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  371|  4.88k|        std::string ciphers;
  372|  4.88k|        if (!GetString(&ciphers, cbs)) {
  373|  4.88k|          return;
  374|  4.88k|        }
  375|  4.88k|        SSL_CTX_set_cipher_list(ctx, ciphers.c_str());
  376|  4.88k|      },
  377|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  378|  4.88k|        std::vector<uint16_t> algs;
  379|  4.88k|        if (!GetVector(&algs, cbs)) {
  380|  4.88k|          return;
  381|  4.88k|        }
  382|  4.88k|        SSL_CTX_set_verify_algorithm_prefs(ctx, algs.data(), algs.size());
  383|  4.88k|      },
  384|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  385|  4.88k|        std::vector<uint8_t> id_ctx;
  386|  4.88k|        if (!GetVector(&id_ctx, cbs)) {
  387|  4.88k|          return;
  388|  4.88k|        }
  389|  4.88k|        SSL_CTX_set_session_id_context(ctx, id_ctx.data(), id_ctx.size());
  390|  4.88k|      },
  391|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  392|  4.88k|        uint32_t size;
  393|  4.88k|        if (!CBS_get_u32(cbs, &size)) {
  394|  4.88k|          return;
  395|  4.88k|        }
  396|  4.88k|        SSL_CTX_sess_set_cache_size(ctx, size);
  397|  4.88k|      },
  398|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_sess_get_cache_size(ctx); },
  399|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_sess_number(ctx); },
  400|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  401|  4.88k|        uint32_t time;
  402|  4.88k|        if (!CBS_get_u32(cbs, &time)) {
  403|  4.88k|          return;
  404|  4.88k|        }
  405|  4.88k|        SSL_CTX_flush_sessions(ctx, time);
  406|  4.88k|      },
  407|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  408|  4.88k|        std::vector<uint8_t> keys;
  409|  4.88k|        if (!GetVector(&keys, cbs)) {
  410|  4.88k|          return;
  411|  4.88k|        }
  412|  4.88k|        SSL_CTX_set_tlsext_ticket_keys(ctx, keys.data(), keys.size());
  413|  4.88k|      },
  414|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  415|  4.88k|        std::vector<int> groups;
  416|  4.88k|        if (!GetVector(&groups, cbs)) {
  417|  4.88k|          return;
  418|  4.88k|        }
  419|  4.88k|        SSL_CTX_set1_groups(ctx, groups.data(), groups.size());
  420|  4.88k|      },
  421|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  422|  4.88k|        std::vector<uint16_t> groups;
  423|  4.88k|        if (!GetVector(&groups, cbs)) {
  424|  4.88k|          return;
  425|  4.88k|        }
  426|  4.88k|        SSL_CTX_set1_group_ids(ctx, groups.data(), groups.size());
  427|  4.88k|      },
  428|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  429|  4.88k|        std::string groups;
  430|  4.88k|        if (!GetString(&groups, cbs)) {
  431|  4.88k|          return;
  432|  4.88k|        }
  433|  4.88k|        SSL_CTX_set1_groups_list(ctx, groups.c_str());
  434|  4.88k|      },
  435|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  436|  4.88k|        SSL_CTX_enable_signed_cert_timestamps(ctx);
  437|  4.88k|      },
  438|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_enable_ocsp_stapling(ctx); },
  439|  4.88k|      [&](SSL_CTX *ctx, CBS *cbs) {
  440|       |        // Avoid an unbounded client CA list.
  441|  4.88k|        if (++expensive_api_count >= kMaxExpensiveAPIs) {
  442|  4.88k|          return;
  443|  4.88k|        }
  444|       |
  445|  4.88k|        SSL_CTX_add_client_CA(ctx, g_state.cert_.get());
  446|  4.88k|      },
  447|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  448|  4.88k|        std::vector<uint8_t> protos;
  449|  4.88k|        if (!GetVector(&protos, cbs)) {
  450|  4.88k|          return;
  451|  4.88k|        }
  452|  4.88k|        SSL_CTX_set_alpn_protos(ctx, protos.data(), protos.size());
  453|  4.88k|      },
  454|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  455|  4.88k|        std::string profiles;
  456|  4.88k|        if (!GetString(&profiles, cbs)) {
  457|  4.88k|          return;
  458|  4.88k|        }
  459|  4.88k|        SSL_CTX_set_srtp_profiles(ctx, profiles.c_str());
  460|  4.88k|      },
  461|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_max_cert_list(ctx); },
  462|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  463|  4.88k|        uint32_t size;
  464|  4.88k|        if (!CBS_get_u32(cbs, &size)) {
  465|  4.88k|          return;
  466|  4.88k|        }
  467|  4.88k|        SSL_CTX_set_max_cert_list(ctx, size);
  468|  4.88k|      },
  469|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  470|  4.88k|        uint32_t size;
  471|  4.88k|        if (!CBS_get_u32(cbs, &size)) {
  472|  4.88k|          return;
  473|  4.88k|        }
  474|  4.88k|        SSL_CTX_set_max_send_fragment(ctx, size);
  475|  4.88k|      },
  476|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  477|  4.88k|        uint8_t b;
  478|  4.88k|        if (!CBS_get_u8(cbs, &b)) {
  479|  4.88k|          return;
  480|  4.88k|        }
  481|  4.88k|        SSL_CTX_set_retain_only_sha256_of_client_certs(ctx, b);
  482|  4.88k|      },
  483|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  484|  4.88k|        uint8_t b;
  485|  4.88k|        if (!CBS_get_u8(cbs, &b)) {
  486|  4.88k|          return;
  487|  4.88k|        }
  488|  4.88k|        SSL_CTX_set_grease_enabled(ctx, b);
  489|  4.88k|      },
  490|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  491|  4.88k|        std::vector<int> sigalgs;
  492|  4.88k|        if (!GetVector(&sigalgs, cbs)) {
  493|  4.88k|          return;
  494|  4.88k|        }
  495|  4.88k|        SSL_CTX_set1_sigalgs(ctx, sigalgs.data(), sigalgs.size());
  496|  4.88k|      },
  497|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  498|  4.88k|        std::string sigalgs;
  499|  4.88k|        if (!GetString(&sigalgs, cbs)) {
  500|  4.88k|          return;
  501|  4.88k|        }
  502|  4.88k|        SSL_CTX_set1_sigalgs_list(ctx, sigalgs.c_str());
  503|  4.88k|      },
  504|  4.88k|      [](SSL_CTX *ctx, CBS *cbs) {
  505|  4.88k|        bssl::UniquePtr<SSL_ECH_KEYS> keys(SSL_ECH_KEYS_new());
  506|  4.88k|        if (keys == nullptr) {
  507|  4.88k|          return;
  508|  4.88k|        }
  509|  4.88k|        uint8_t is_retry_config;
  510|  4.88k|        CBS ech_config, private_key;
  511|  4.88k|        if (!CBS_get_u8(cbs, &is_retry_config) ||
  512|  4.88k|            !CBS_get_u16_length_prefixed(cbs, &ech_config) ||
  513|  4.88k|            !CBS_get_u16_length_prefixed(cbs, &private_key)) {
  514|  4.88k|          return;
  515|  4.88k|        }
  516|  4.88k|        bssl::ScopedEVP_HPKE_KEY key;
  517|  4.88k|        if (!EVP_HPKE_KEY_init(key.get(), EVP_hpke_x25519_hkdf_sha256(),
  518|  4.88k|                               CBS_data(&private_key), CBS_len(&private_key)) ||
  519|  4.88k|            !SSL_ECH_KEYS_add(keys.get(), is_retry_config,
  520|  4.88k|                              CBS_data(&ech_config), CBS_len(&ech_config),
  521|  4.88k|                              key.get()) ||
  522|  4.88k|            !SSL_CTX_set1_ech_keys(ctx, keys.get())) {
  523|  4.88k|          return;
  524|  4.88k|        }
  525|  4.88k|      },
  526|  4.88k|  };
  527|       |
  528|  4.88k|  bssl::UniquePtr<SSL_CTX> ctx(SSL_CTX_new(TLS_method()));
  529|       |
  530|       |  // If the number of functions exceeds this limit then the code needs to do
  531|       |  // more than sample a single uint8_t to pick the function.
  532|  4.88k|  static_assert(OPENSSL_ARRAY_SIZE(kAPIs) < 256, "kAPIs too large");
  533|       |
  534|  4.88k|  CBS cbs;
  535|  4.88k|  CBS_init(&cbs, buf, len);
  536|       |
  537|   425k|  for (unsigned i = 0; i < kMaxAPIs; i++) {
  ------------------
  |  Branch (537:24): [True: 425k, False: 18]
  ------------------
  538|   425k|    uint8_t index;
  539|   425k|    if (!CBS_get_u8(&cbs, &index)) {
  ------------------
  |  Branch (539:9): [True: 4.86k, False: 421k]
  ------------------
  540|  4.86k|      break;
  541|  4.86k|    }
  542|       |
  543|   421k|    kAPIs[index % OPENSSL_ARRAY_SIZE(kAPIs)](ctx.get(), &cbs);
  ------------------
  |  |  103|   421k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  544|   421k|  }
  545|       |
  546|  4.88k|  bssl::UniquePtr<SSL> ssl(SSL_new(ctx.get()));
  547|  4.88k|  ERR_clear_error();
  548|       |
  549|  4.88k|  return 0;
  550|  4.88k|}
_ZN11GlobalStateC2Ev:
  205|      2|  GlobalState() {
  206|      2|    const uint8_t *bufp = kRSAPrivateKeyDER;
  207|      2|    RSA *privkey = d2i_RSAPrivateKey(NULL, &bufp, sizeof(kRSAPrivateKeyDER));
  208|      2|    assert(privkey != nullptr);
  209|       |
  210|      2|    pkey_.reset(EVP_PKEY_new());
  211|      2|    EVP_PKEY_assign_RSA(pkey_.get(), privkey);
  212|       |
  213|      2|    bufp = kCertificateDER;
  214|      2|    cert_.reset(d2i_X509(NULL, &bufp, sizeof(kCertificateDER)));
  215|      2|    assert(cert_.get() != nullptr);
  216|       |
  217|      2|    certs_.reset(sk_X509_new_null());
  218|      2|    bssl::PushToStack(certs_.get(), bssl::UpRef(cert_));
  219|      2|  }
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_0clEP10ssl_ctx_stP6cbs_st:
  263|  93.7k|      [](SSL_CTX *ctx, CBS *cbs) {
  264|  93.7k|        uint8_t b;
  265|  93.7k|        if (!CBS_get_u8(cbs, &b)) {
  ------------------
  |  Branch (265:13): [True: 24, False: 93.7k]
  ------------------
  266|     24|          return;
  267|     24|        }
  268|  93.7k|        SSL_CTX_set_quiet_shutdown(ctx, b);
  269|  93.7k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_1clEP10ssl_ctx_stP6cbs_st:
  270|  17.6k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_quiet_shutdown(ctx); },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_2clEP10ssl_ctx_stP6cbs_st:
  271|  10.7k|      [](SSL_CTX *ctx, CBS *cbs) {
  272|  10.7k|        uint16_t version;
  273|  10.7k|        if (!CBS_get_u16(cbs, &version)) {
  ------------------
  |  Branch (273:13): [True: 24, False: 10.7k]
  ------------------
  274|     24|          return;
  275|     24|        }
  276|  10.7k|        SSL_CTX_set_min_proto_version(ctx, version);
  277|  10.7k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_3clEP10ssl_ctx_stP6cbs_st:
  278|  8.14k|      [](SSL_CTX *ctx, CBS *cbs) {
  279|  8.14k|        uint16_t version;
  280|  8.14k|        if (!CBS_get_u16(cbs, &version)) {
  ------------------
  |  Branch (280:13): [True: 38, False: 8.10k]
  ------------------
  281|     38|          return;
  282|     38|        }
  283|  8.10k|        SSL_CTX_set_max_proto_version(ctx, version);
  284|  8.10k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_4clEP10ssl_ctx_stP6cbs_st:
  285|  2.56k|      [](SSL_CTX *ctx, CBS *cbs) {
  286|  2.56k|        uint32_t options;
  287|  2.56k|        if (!CBS_get_u32(cbs, &options)) {
  ------------------
  |  Branch (287:13): [True: 33, False: 2.53k]
  ------------------
  288|     33|          return;
  289|     33|        }
  290|  2.53k|        SSL_CTX_set_options(ctx, options);
  ------------------
  |  | 6090|  2.53k|#define SSL_CTX_set_options SSL_CTX_set_options
  ------------------
  291|  2.53k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_5clEP10ssl_ctx_stP6cbs_st:
  292|  2.34k|      [](SSL_CTX *ctx, CBS *cbs) {
  293|  2.34k|        uint32_t options;
  294|  2.34k|        if (!CBS_get_u32(cbs, &options)) {
  ------------------
  |  Branch (294:13): [True: 30, False: 2.31k]
  ------------------
  295|     30|          return;
  296|     30|        }
  297|  2.31k|        SSL_CTX_clear_options(ctx, options);
  ------------------
  |  | 6069|  2.31k|#define SSL_CTX_clear_options SSL_CTX_clear_options
  ------------------
  298|  2.31k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_6clEP10ssl_ctx_stP6cbs_st:
  299|  7.59k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_options(ctx); },
  ------------------
  |  | 6074|  7.59k|#define SSL_CTX_get_options SSL_CTX_get_options
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_7clEP10ssl_ctx_stP6cbs_st:
  300|  3.55k|      [](SSL_CTX *ctx, CBS *cbs) {
  301|  3.55k|        uint32_t mode;
  302|  3.55k|        if (!CBS_get_u32(cbs, &mode)) {
  ------------------
  |  Branch (302:13): [True: 34, False: 3.51k]
  ------------------
  303|     34|          return;
  304|     34|        }
  305|  3.51k|        SSL_CTX_set_mode(ctx, mode);
  ------------------
  |  | 6088|  3.51k|#define SSL_CTX_set_mode SSL_CTX_set_mode
  ------------------
  306|  3.51k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_8clEP10ssl_ctx_stP6cbs_st:
  307|  4.56k|      [](SSL_CTX *ctx, CBS *cbs) {
  308|  4.56k|        uint32_t mode;
  309|  4.56k|        if (!CBS_get_u32(cbs, &mode)) {
  ------------------
  |  Branch (309:13): [True: 32, False: 4.52k]
  ------------------
  310|     32|          return;
  311|     32|        }
  312|  4.52k|        SSL_CTX_clear_mode(ctx, mode);
  ------------------
  |  | 6068|  4.52k|#define SSL_CTX_clear_mode SSL_CTX_clear_mode
  ------------------
  313|  4.52k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_9clEP10ssl_ctx_stP6cbs_st:
  314|  2.13k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_mode(ctx); },
  ------------------
  |  | 6073|  2.13k|#define SSL_CTX_get_mode SSL_CTX_get_mode
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_10clEP10ssl_ctx_stP6cbs_st:
  315|  7.09k|      [](SSL_CTX *ctx, CBS *cbs) {
  316|  7.09k|        SSL_CTX_use_certificate(ctx, g_state.cert_.get());
  317|  7.09k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_11clEP10ssl_ctx_stP6cbs_st:
  318|  8.60k|      [](SSL_CTX *ctx, CBS *cbs) {
  319|  8.60k|        SSL_CTX_use_PrivateKey(ctx, g_state.pkey_.get());
  320|  8.60k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_12clEP10ssl_ctx_stP6cbs_st:
  321|  2.09k|      [](SSL_CTX *ctx, CBS *cbs) {
  322|  2.09k|        SSL_CTX_set1_chain(ctx, g_state.certs_.get());
  ------------------
  |  | 6083|  2.09k|#define SSL_CTX_set1_chain SSL_CTX_set1_chain
  ------------------
  323|  2.09k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_13clEP10ssl_ctx_stP6cbs_st:
  324|  20.4k|      [&](SSL_CTX *ctx, CBS *cbs) {
  325|       |        // Avoid an unbounded certificate chain.
  326|  20.4k|        if (++expensive_api_count >= kMaxExpensiveAPIs) {
  ------------------
  |  Branch (326:13): [True: 12.5k, False: 7.94k]
  ------------------
  327|  12.5k|          return;
  328|  12.5k|        }
  329|       |
  330|  7.94k|        SSL_CTX_add1_chain_cert(ctx, g_state.cert_.get());
  ------------------
  |  | 6064|  7.94k|#define SSL_CTX_add1_chain_cert SSL_CTX_add1_chain_cert
  ------------------
  331|  7.94k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_14clEP10ssl_ctx_stP6cbs_st:
  332|  3.94k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_clear_chain_certs(ctx); },
  ------------------
  |  | 6067|  3.94k|#define SSL_CTX_clear_chain_certs SSL_CTX_clear_chain_certs
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_15clEP10ssl_ctx_stP6cbs_st:
  333|  40.1k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_clear_extra_chain_certs(ctx); },
  ------------------
  |  | 6066|  40.1k|#define SSL_CTX_clear_extra_chain_certs SSL_CTX_clear_extra_chain_certs
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_16clEP10ssl_ctx_stP6cbs_st:
  334|  4.63k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_check_private_key(ctx); },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_17clEP10ssl_ctx_stP6cbs_st:
  335|  5.73k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get0_certificate(ctx); },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_18clEP10ssl_ctx_stP6cbs_st:
  336|  1.24k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get0_privatekey(ctx); },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_19clEP10ssl_ctx_stP6cbs_st:
  337|  9.93k|      [](SSL_CTX *ctx, CBS *cbs) {
  338|  9.93k|        STACK_OF(X509) * chains;
  ------------------
  |  |   39|  9.93k|#define STACK_OF(type) struct stack_st_##type
  ------------------
  339|  9.93k|        SSL_CTX_get0_chain_certs(ctx, &chains);
  ------------------
  |  | 6070|  9.93k|#define SSL_CTX_get0_chain_certs SSL_CTX_get0_chain_certs
  ------------------
  340|  9.93k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_20clEP10ssl_ctx_stP6cbs_st:
  341|  2.85k|      [](SSL_CTX *ctx, CBS *cbs) {
  342|  2.85k|        std::vector<uint8_t> sct_data;
  343|  2.85k|        if (!GetVector(&sct_data, cbs)) {
  ------------------
  |  Branch (343:13): [True: 78, False: 2.77k]
  ------------------
  344|     78|          return;
  345|     78|        }
  346|  2.77k|        SSL_CTX_set_signed_cert_timestamp_list(ctx, sct_data.data(),
  347|  2.77k|                                               sct_data.size());
  348|  2.77k|      },
ssl_ctx_api.cc:_ZL9GetVectorIhEbPNSt3__16vectorIT_NS0_9allocatorIS2_EEEEP6cbs_st:
  239|  28.7k|static bool GetVector(std::vector<T> *out, CBS *cbs) {
  240|  28.7k|  static_assert(
  241|  28.7k|      std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value,
  242|  28.7k|      "GetVector may only be called on standard layout, trivially copyable "
  243|  28.7k|      "types");
  244|       |
  245|  28.7k|  CBS child;
  246|  28.7k|  if (!CBS_get_u8_length_prefixed(cbs, &child)) {
  ------------------
  |  Branch (246:7): [True: 702, False: 28.0k]
  ------------------
  247|    702|    return false;
  248|    702|  }
  249|       |
  250|  28.0k|  size_t num = CBS_len(&child) / sizeof(T);
  251|  28.0k|  out->resize(num);
  252|  28.0k|  out->shrink_to_fit();  // Ensure ASan notices out-of-bounds reads.
  253|  28.0k|  OPENSSL_memcpy(out->data(), CBS_data(&child), num * sizeof(T));
  254|  28.0k|  return true;
  255|  28.7k|}
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_21clEP10ssl_ctx_stP6cbs_st:
  349|  20.2k|      [](SSL_CTX *ctx, CBS *cbs) {
  350|  20.2k|        std::vector<uint8_t> ocsp_data;
  351|  20.2k|        if (!GetVector(&ocsp_data, cbs)) {
  ------------------
  |  Branch (351:13): [True: 110, False: 20.1k]
  ------------------
  352|    110|          return;
  353|    110|        }
  354|  20.1k|        SSL_CTX_set_ocsp_response(ctx, ocsp_data.data(), ocsp_data.size());
  355|  20.1k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_22clEP10ssl_ctx_stP6cbs_st:
  356|  2.37k|      [](SSL_CTX *ctx, CBS *cbs) {
  357|  2.37k|        std::vector<uint16_t> algs;
  358|  2.37k|        if (!GetVector(&algs, cbs)) {
  ------------------
  |  Branch (358:13): [True: 89, False: 2.28k]
  ------------------
  359|     89|          return;
  360|     89|        }
  361|  2.28k|        SSL_CTX_set_signing_algorithm_prefs(ctx, algs.data(), algs.size());
  362|  2.28k|      },
ssl_ctx_api.cc:_ZL9GetVectorItEbPNSt3__16vectorIT_NS0_9allocatorIS2_EEEEP6cbs_st:
  239|  8.32k|static bool GetVector(std::vector<T> *out, CBS *cbs) {
  240|  8.32k|  static_assert(
  241|  8.32k|      std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value,
  242|  8.32k|      "GetVector may only be called on standard layout, trivially copyable "
  243|  8.32k|      "types");
  244|       |
  245|  8.32k|  CBS child;
  246|  8.32k|  if (!CBS_get_u8_length_prefixed(cbs, &child)) {
  ------------------
  |  Branch (246:7): [True: 264, False: 8.06k]
  ------------------
  247|    264|    return false;
  248|    264|  }
  249|       |
  250|  8.06k|  size_t num = CBS_len(&child) / sizeof(T);
  251|  8.06k|  out->resize(num);
  252|  8.06k|  out->shrink_to_fit();  // Ensure ASan notices out-of-bounds reads.
  253|  8.06k|  OPENSSL_memcpy(out->data(), CBS_data(&child), num * sizeof(T));
  254|  8.06k|  return true;
  255|  8.32k|}
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_23clEP10ssl_ctx_stP6cbs_st:
  363|  10.4k|      [](SSL_CTX *ctx, CBS *cbs) {
  364|  10.4k|        std::string ciphers;
  365|  10.4k|        if (!GetString(&ciphers, cbs)) {
  ------------------
  |  Branch (365:13): [True: 142, False: 10.3k]
  ------------------
  366|    142|          return;
  367|    142|        }
  368|  10.3k|        SSL_CTX_set_strict_cipher_list(ctx, ciphers.c_str());
  369|  10.3k|      },
ssl_ctx_api.cc:_ZL9GetStringPNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEP6cbs_st:
  228|  46.0k|static bool GetString(std::string *out, CBS *cbs) {
  229|  46.0k|  CBS str;
  230|  46.0k|  if (!CBS_get_u8_length_prefixed(cbs, &str)) {
  ------------------
  |  Branch (230:7): [True: 1.05k, False: 45.0k]
  ------------------
  231|  1.05k|    return false;
  232|  1.05k|  }
  233|       |
  234|  45.0k|  *out = bssl::BytesAsStringView(str);
  235|  45.0k|  return true;
  236|  46.0k|}
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_24clEP10ssl_ctx_stP6cbs_st:
  370|  15.9k|      [](SSL_CTX *ctx, CBS *cbs) {
  371|  15.9k|        std::string ciphers;
  372|  15.9k|        if (!GetString(&ciphers, cbs)) {
  ------------------
  |  Branch (372:13): [True: 166, False: 15.7k]
  ------------------
  373|    166|          return;
  374|    166|        }
  375|  15.7k|        SSL_CTX_set_cipher_list(ctx, ciphers.c_str());
  376|  15.7k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_25clEP10ssl_ctx_stP6cbs_st:
  377|  1.38k|      [](SSL_CTX *ctx, CBS *cbs) {
  378|  1.38k|        std::vector<uint16_t> algs;
  379|  1.38k|        if (!GetVector(&algs, cbs)) {
  ------------------
  |  Branch (379:13): [True: 75, False: 1.30k]
  ------------------
  380|     75|          return;
  381|     75|        }
  382|  1.30k|        SSL_CTX_set_verify_algorithm_prefs(ctx, algs.data(), algs.size());
  383|  1.30k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_26clEP10ssl_ctx_stP6cbs_st:
  384|  2.62k|      [](SSL_CTX *ctx, CBS *cbs) {
  385|  2.62k|        std::vector<uint8_t> id_ctx;
  386|  2.62k|        if (!GetVector(&id_ctx, cbs)) {
  ------------------
  |  Branch (386:13): [True: 108, False: 2.51k]
  ------------------
  387|    108|          return;
  388|    108|        }
  389|  2.51k|        SSL_CTX_set_session_id_context(ctx, id_ctx.data(), id_ctx.size());
  390|  2.51k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_27clEP10ssl_ctx_stP6cbs_st:
  391|  2.06k|      [](SSL_CTX *ctx, CBS *cbs) {
  392|  2.06k|        uint32_t size;
  393|  2.06k|        if (!CBS_get_u32(cbs, &size)) {
  ------------------
  |  Branch (393:13): [True: 30, False: 2.03k]
  ------------------
  394|     30|          return;
  395|     30|        }
  396|  2.03k|        SSL_CTX_sess_set_cache_size(ctx, size);
  ------------------
  |  | 6081|  2.03k|#define SSL_CTX_sess_set_cache_size SSL_CTX_sess_set_cache_size
  ------------------
  397|  2.03k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_28clEP10ssl_ctx_stP6cbs_st:
  398|  8.46k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_sess_get_cache_size(ctx); },
  ------------------
  |  | 6079|  8.46k|#define SSL_CTX_sess_get_cache_size SSL_CTX_sess_get_cache_size
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_29clEP10ssl_ctx_stP6cbs_st:
  399|    851|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_sess_number(ctx); },
  ------------------
  |  | 6080|    851|#define SSL_CTX_sess_number SSL_CTX_sess_number
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_30clEP10ssl_ctx_stP6cbs_st:
  400|  3.26k|      [](SSL_CTX *ctx, CBS *cbs) {
  401|  3.26k|        uint32_t time;
  402|  3.26k|        if (!CBS_get_u32(cbs, &time)) {
  ------------------
  |  Branch (402:13): [True: 38, False: 3.22k]
  ------------------
  403|     38|          return;
  404|     38|        }
  405|  3.22k|        SSL_CTX_flush_sessions(ctx, time);
  406|  3.22k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_31clEP10ssl_ctx_stP6cbs_st:
  407|  1.52k|      [](SSL_CTX *ctx, CBS *cbs) {
  408|  1.52k|        std::vector<uint8_t> keys;
  409|  1.52k|        if (!GetVector(&keys, cbs)) {
  ------------------
  |  Branch (409:13): [True: 200, False: 1.32k]
  ------------------
  410|    200|          return;
  411|    200|        }
  412|  1.32k|        SSL_CTX_set_tlsext_ticket_keys(ctx, keys.data(), keys.size());
  ------------------
  |  | 6097|  1.32k|#define SSL_CTX_set_tlsext_ticket_keys SSL_CTX_set_tlsext_ticket_keys
  ------------------
  413|  1.32k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_32clEP10ssl_ctx_stP6cbs_st:
  414|  8.11k|      [](SSL_CTX *ctx, CBS *cbs) {
  415|  8.11k|        std::vector<int> groups;
  416|  8.11k|        if (!GetVector(&groups, cbs)) {
  ------------------
  |  Branch (416:13): [True: 98, False: 8.02k]
  ------------------
  417|     98|          return;
  418|     98|        }
  419|  8.02k|        SSL_CTX_set1_groups(ctx, groups.data(), groups.size());
  ------------------
  |  | 6085|  8.02k|#define SSL_CTX_set1_groups SSL_CTX_set1_groups
  ------------------
  420|  8.02k|      },
ssl_ctx_api.cc:_ZL9GetVectorIiEbPNSt3__16vectorIT_NS0_9allocatorIS2_EEEEP6cbs_st:
  239|  11.1k|static bool GetVector(std::vector<T> *out, CBS *cbs) {
  240|  11.1k|  static_assert(
  241|  11.1k|      std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value,
  242|  11.1k|      "GetVector may only be called on standard layout, trivially copyable "
  243|  11.1k|      "types");
  244|       |
  245|  11.1k|  CBS child;
  246|  11.1k|  if (!CBS_get_u8_length_prefixed(cbs, &child)) {
  ------------------
  |  Branch (246:7): [True: 317, False: 10.8k]
  ------------------
  247|    317|    return false;
  248|    317|  }
  249|       |
  250|  10.8k|  size_t num = CBS_len(&child) / sizeof(T);
  251|  10.8k|  out->resize(num);
  252|  10.8k|  out->shrink_to_fit();  // Ensure ASan notices out-of-bounds reads.
  253|  10.8k|  OPENSSL_memcpy(out->data(), CBS_data(&child), num * sizeof(T));
  254|  10.8k|  return true;
  255|  11.1k|}
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_33clEP10ssl_ctx_stP6cbs_st:
  421|  4.56k|      [](SSL_CTX *ctx, CBS *cbs) {
  422|  4.56k|        std::vector<uint16_t> groups;
  423|  4.56k|        if (!GetVector(&groups, cbs)) {
  ------------------
  |  Branch (423:13): [True: 100, False: 4.46k]
  ------------------
  424|    100|          return;
  425|    100|        }
  426|  4.46k|        SSL_CTX_set1_group_ids(ctx, groups.data(), groups.size());
  427|  4.46k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_34clEP10ssl_ctx_stP6cbs_st:
  428|  5.94k|      [](SSL_CTX *ctx, CBS *cbs) {
  429|  5.94k|        std::string groups;
  430|  5.94k|        if (!GetString(&groups, cbs)) {
  ------------------
  |  Branch (430:13): [True: 278, False: 5.66k]
  ------------------
  431|    278|          return;
  432|    278|        }
  433|  5.66k|        SSL_CTX_set1_groups_list(ctx, groups.c_str());
  434|  5.66k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_35clEP10ssl_ctx_stP6cbs_st:
  435|  5.93k|      [](SSL_CTX *ctx, CBS *cbs) {
  436|  5.93k|        SSL_CTX_enable_signed_cert_timestamps(ctx);
  437|  5.93k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_36clEP10ssl_ctx_stP6cbs_st:
  438|  3.90k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_enable_ocsp_stapling(ctx); },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_37clEP10ssl_ctx_stP6cbs_st:
  439|  19.5k|      [&](SSL_CTX *ctx, CBS *cbs) {
  440|       |        // Avoid an unbounded client CA list.
  441|  19.5k|        if (++expensive_api_count >= kMaxExpensiveAPIs) {
  ------------------
  |  Branch (441:13): [True: 16.1k, False: 3.36k]
  ------------------
  442|  16.1k|          return;
  443|  16.1k|        }
  444|       |
  445|  3.36k|        SSL_CTX_add_client_CA(ctx, g_state.cert_.get());
  446|  3.36k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_38clEP10ssl_ctx_stP6cbs_st:
  447|  1.51k|      [](SSL_CTX *ctx, CBS *cbs) {
  448|  1.51k|        std::vector<uint8_t> protos;
  449|  1.51k|        if (!GetVector(&protos, cbs)) {
  ------------------
  |  Branch (449:13): [True: 206, False: 1.30k]
  ------------------
  450|    206|          return;
  451|    206|        }
  452|  1.30k|        SSL_CTX_set_alpn_protos(ctx, protos.data(), protos.size());
  453|  1.30k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_39clEP10ssl_ctx_stP6cbs_st:
  454|  4.30k|      [](SSL_CTX *ctx, CBS *cbs) {
  455|  4.30k|        std::string profiles;
  456|  4.30k|        if (!GetString(&profiles, cbs)) {
  ------------------
  |  Branch (456:13): [True: 88, False: 4.21k]
  ------------------
  457|     88|          return;
  458|     88|        }
  459|  4.21k|        SSL_CTX_set_srtp_profiles(ctx, profiles.c_str());
  460|  4.21k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_40clEP10ssl_ctx_stP6cbs_st:
  461|  1.54k|      [](SSL_CTX *ctx, CBS *cbs) { SSL_CTX_get_max_cert_list(ctx); },
  ------------------
  |  | 6072|  1.54k|#define SSL_CTX_get_max_cert_list SSL_CTX_get_max_cert_list
  ------------------
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_41clEP10ssl_ctx_stP6cbs_st:
  462|  1.57k|      [](SSL_CTX *ctx, CBS *cbs) {
  463|  1.57k|        uint32_t size;
  464|  1.57k|        if (!CBS_get_u32(cbs, &size)) {
  ------------------
  |  Branch (464:13): [True: 27, False: 1.54k]
  ------------------
  465|     27|          return;
  466|     27|        }
  467|  1.54k|        SSL_CTX_set_max_cert_list(ctx, size);
  ------------------
  |  | 6086|  1.54k|#define SSL_CTX_set_max_cert_list SSL_CTX_set_max_cert_list
  ------------------
  468|  1.54k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_42clEP10ssl_ctx_stP6cbs_st:
  469|  3.69k|      [](SSL_CTX *ctx, CBS *cbs) {
  470|  3.69k|        uint32_t size;
  471|  3.69k|        if (!CBS_get_u32(cbs, &size)) {
  ------------------
  |  Branch (471:13): [True: 29, False: 3.66k]
  ------------------
  472|     29|          return;
  473|     29|        }
  474|  3.66k|        SSL_CTX_set_max_send_fragment(ctx, size);
  ------------------
  |  | 6087|  3.66k|#define SSL_CTX_set_max_send_fragment SSL_CTX_set_max_send_fragment
  ------------------
  475|  3.66k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_43clEP10ssl_ctx_stP6cbs_st:
  476|  3.80k|      [](SSL_CTX *ctx, CBS *cbs) {
  477|  3.80k|        uint8_t b;
  478|  3.80k|        if (!CBS_get_u8(cbs, &b)) {
  ------------------
  |  Branch (478:13): [True: 16, False: 3.78k]
  ------------------
  479|     16|          return;
  480|     16|        }
  481|  3.78k|        SSL_CTX_set_retain_only_sha256_of_client_certs(ctx, b);
  482|  3.78k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_44clEP10ssl_ctx_stP6cbs_st:
  483|  1.10k|      [](SSL_CTX *ctx, CBS *cbs) {
  484|  1.10k|        uint8_t b;
  485|  1.10k|        if (!CBS_get_u8(cbs, &b)) {
  ------------------
  |  Branch (485:13): [True: 9, False: 1.09k]
  ------------------
  486|      9|          return;
  487|      9|        }
  488|  1.09k|        SSL_CTX_set_grease_enabled(ctx, b);
  489|  1.09k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_45clEP10ssl_ctx_stP6cbs_st:
  490|  3.03k|      [](SSL_CTX *ctx, CBS *cbs) {
  491|  3.03k|        std::vector<int> sigalgs;
  492|  3.03k|        if (!GetVector(&sigalgs, cbs)) {
  ------------------
  |  Branch (492:13): [True: 219, False: 2.81k]
  ------------------
  493|    219|          return;
  494|    219|        }
  495|  2.81k|        SSL_CTX_set1_sigalgs(ctx, sigalgs.data(), sigalgs.size());
  496|  2.81k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_46clEP10ssl_ctx_stP6cbs_st:
  497|  9.40k|      [](SSL_CTX *ctx, CBS *cbs) {
  498|  9.40k|        std::string sigalgs;
  499|  9.40k|        if (!GetString(&sigalgs, cbs)) {
  ------------------
  |  Branch (499:13): [True: 380, False: 9.02k]
  ------------------
  500|    380|          return;
  501|    380|        }
  502|  9.02k|        SSL_CTX_set1_sigalgs_list(ctx, sigalgs.c_str());
  503|  9.02k|      },
ssl_ctx_api.cc:_ZZ22LLVMFuzzerTestOneInputENK4$_47clEP10ssl_ctx_stP6cbs_st:
  504|  13.8k|      [](SSL_CTX *ctx, CBS *cbs) {
  505|  13.8k|        bssl::UniquePtr<SSL_ECH_KEYS> keys(SSL_ECH_KEYS_new());
  506|  13.8k|        if (keys == nullptr) {
  ------------------
  |  Branch (506:13): [True: 0, False: 13.8k]
  ------------------
  507|      0|          return;
  508|      0|        }
  509|  13.8k|        uint8_t is_retry_config;
  510|  13.8k|        CBS ech_config, private_key;
  511|  13.8k|        if (!CBS_get_u8(cbs, &is_retry_config) ||
  ------------------
  |  Branch (511:13): [True: 13, False: 13.8k]
  ------------------
  512|  13.8k|            !CBS_get_u16_length_prefixed(cbs, &ech_config) ||
  ------------------
  |  Branch (512:13): [True: 918, False: 12.9k]
  ------------------
  513|  13.8k|            !CBS_get_u16_length_prefixed(cbs, &private_key)) {
  ------------------
  |  Branch (513:13): [True: 305, False: 12.6k]
  ------------------
  514|  1.23k|          return;
  515|  1.23k|        }
  516|  12.6k|        bssl::ScopedEVP_HPKE_KEY key;
  517|  12.6k|        if (!EVP_HPKE_KEY_init(key.get(), EVP_hpke_x25519_hkdf_sha256(),
  ------------------
  |  Branch (517:13): [True: 569, False: 12.0k]
  ------------------
  518|  12.6k|                               CBS_data(&private_key), CBS_len(&private_key)) ||
  519|  12.6k|            !SSL_ECH_KEYS_add(keys.get(), is_retry_config,
  ------------------
  |  Branch (519:13): [True: 12.0k, False: 0]
  ------------------
  520|  12.0k|                              CBS_data(&ech_config), CBS_len(&ech_config),
  521|  12.0k|                              key.get()) ||
  522|  12.6k|            !SSL_CTX_set1_ech_keys(ctx, keys.get())) {
  ------------------
  |  Branch (522:13): [True: 0, False: 0]
  ------------------
  523|  12.6k|          return;
  524|  12.6k|        }
  525|  12.6k|      },

d2i_X509_ALGOR:
  548|  28.1k|  stname *d2i_##fname(stname **a, const unsigned char **in, long len) {    \
  549|  28.1k|    return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,              \
  550|  28.1k|                                   ASN1_ITEM_rptr(itname));                \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  551|  28.1k|  }                                                                        \
i2d_X509_ALGOR:
  552|  34.2k|  int i2d_##fname(const stname *a, unsigned char **out) {                  \
  553|  34.2k|    return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));    \
  ------------------
  |  |  227|  34.2k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  554|  34.2k|  }
X509_ALGOR_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }
X509_NAME_ENTRY_new:
  524|  56.2k|  stname *fname##_new(void) {                                       \
  525|  56.2k|    return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname));         \
  ------------------
  |  |  227|  56.2k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  526|  56.2k|  }                                                                 \
X509_NAME_ENTRY_free:
  527|   112k|  void fname##_free(stname *a) {                                    \
  528|   112k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|   112k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|   112k|  }
i2d_X509_NAME:
  540|  3.36k|  int i2d_##fname(stname *a, unsigned char **out) {                     \
  541|  3.36k|    return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  227|  3.36k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  542|  3.36k|  }
i2d_X509_PUBKEY:
  552|  28.1k|  int i2d_##fname(const stname *a, unsigned char **out) {                  \
  553|  28.1k|    return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));    \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  554|  28.1k|  }
i2d_X509_CINF:
  540|  34.2k|  int i2d_##fname(stname *a, unsigned char **out) {                     \
  541|  34.2k|    return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  227|  34.2k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  542|  34.2k|  }
X509_CINF_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }
X509_CERT_AUX_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }
ASN1_TYPE_new:
  524|  84.3k|  stname *fname##_new(void) {                                       \
  525|  84.3k|    return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname));         \
  ------------------
  |  |  227|  84.3k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  526|  84.3k|  }                                                                 \
AUTHORITY_KEYID_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }
CRL_DIST_POINTS_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }
GENERAL_NAMES_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }
NAME_CONSTRAINTS_free:
  527|  28.1k|  void fname##_free(stname *a) {                                    \
  528|  28.1k|    ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname));        \
  ------------------
  |  |  227|  28.1k|#define ASN1_ITEM_rptr(name) (&(name##_it))
  ------------------
  529|  28.1k|  }

_ZN4bssl8internal7DeleterclI11evp_pkey_stEEvPT_:
  449|  16.1k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  16.1k|    DeleterImpl<T>::Free(ptr);
  459|  16.1k|  }
_ZN4bssl8internal11DeleterImplI11evp_pkey_stvE4FreeEPS2_:
  524|  16.1k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl5UpRefERKNSt3__110unique_ptrI7x509_stNS_8internal7DeleterEEE:
  542|      2|  inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \
  543|      2|    return UpRef(ptr.get());                                 \
  544|      2|  }
_ZN4bssl5UpRefEP7x509_st:
  535|      2|  inline UniquePtr<type> UpRef(type *v) {                    \
  536|      2|    if (v != nullptr) {                                      \
  ------------------
  |  Branch (536:9): [True: 2, False: 0]
  ------------------
  537|      2|      up_ref_func(v);                                        \
  538|      2|    }                                                        \
  539|      2|    return UniquePtr<type>(v);                               \
  540|      2|  }                                                          \
_ZN4bssl8internal7DeleterclI10ssl_ctx_stEEvPT_:
  449|  14.6k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  14.6k|    DeleterImpl<T>::Free(ptr);
  459|  14.6k|  }
_ZN4bssl8internal11DeleterImplI10ssl_ctx_stvE4FreeEPS2_:
  524|  14.6k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl8internal21StackAllocatedMovableI15evp_hpke_key_stvXadL_Z17EVP_HPKE_KEY_zeroEEXadL_Z20EVP_HPKE_KEY_cleanupEEXadL_Z17EVP_HPKE_KEY_moveEEEC2Ev:
  491|  24.6k|  StackAllocatedMovable() { init(&ctx_); }
_ZN4bssl8internal21StackAllocatedMovableI15evp_hpke_key_stvXadL_Z17EVP_HPKE_KEY_zeroEEXadL_Z20EVP_HPKE_KEY_cleanupEEXadL_Z17EVP_HPKE_KEY_moveEEE3getEv:
  503|  24.6k|  T *get() { return &ctx_; }
_ZN4bssl8internal21StackAllocatedMovableI15evp_hpke_key_stvXadL_Z17EVP_HPKE_KEY_zeroEEXadL_Z20EVP_HPKE_KEY_cleanupEEXadL_Z17EVP_HPKE_KEY_moveEEED2Ev:
  492|  24.6k|  ~StackAllocatedMovable() { cleanup(&ctx_); }
_ZN4bssl8internal7DeleterclI15ssl_ech_keys_stEEvPT_:
  449|  13.8k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  13.8k|    DeleterImpl<T>::Free(ptr);
  459|  13.8k|  }
_ZN4bssl8internal11DeleterImplI15ssl_ech_keys_stvE4FreeEPS2_:
  524|  13.8k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl8internal7DeleterclI6ssl_stEEvPT_:
  449|  4.88k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  4.88k|    DeleterImpl<T>::Free(ptr);
  459|  4.88k|  }
_ZN4bssl8internal11DeleterImplI6ssl_stvE4FreeEPS2_:
  524|  4.88k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl5UpRefEP11evp_pkey_st:
  535|  23.2k|  inline UniquePtr<type> UpRef(type *v) {                    \
  536|  23.2k|    if (v != nullptr) {                                      \
  ------------------
  |  Branch (536:9): [True: 9.00k, False: 14.2k]
  ------------------
  537|  9.00k|      up_ref_func(v);                                        \
  538|  9.00k|    }                                                        \
  539|  23.2k|    return UniquePtr<type>(v);                               \
  540|  23.2k|  }                                                          \
_ZN4bssl5UpRefERKNSt3__110unique_ptrI11evp_pkey_stNS_8internal7DeleterEEE:
  542|  14.6k|  inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \
  543|  14.6k|    return UpRef(ptr.get());                                 \
  544|  14.6k|  }
_ZN4bssl8internal11DeleterImplI10buf_mem_stvE4FreeEPS2_:
  524|  4.88k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl8internal11DeleterImplI9bignum_stvE4FreeEPS2_:
  524|      8|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl8internal11DeleterImplI16crypto_buffer_stvE4FreeEPS2_:
  524|  57.0k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl5UpRefEP16crypto_buffer_st:
  535|  35.3k|  inline UniquePtr<type> UpRef(type *v) {                    \
  536|  35.3k|    if (v != nullptr) {                                      \
  ------------------
  |  Branch (536:9): [True: 20.8k, False: 14.5k]
  ------------------
  537|  20.8k|      up_ref_func(v);                                        \
  538|  20.8k|    }                                                        \
  539|  35.3k|    return UniquePtr<type>(v);                               \
  540|  35.3k|  }                                                          \
_ZN4bssl5UpRefERKNSt3__110unique_ptrI16crypto_buffer_stNS_8internal7DeleterEEE:
  542|  14.6k|  inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \
  543|  14.6k|    return UpRef(ptr.get());                                 \
  544|  14.6k|  }
_ZN4bssl8internal11DeleterImplI17ssl_credential_stvE4FreeEPS2_:
  524|  14.6k|    static void Free(type *ptr) { deleter(ptr); } \
_ZN4bssl5UpRefEP10ssl_ctx_st:
  535|  9.77k|  inline UniquePtr<type> UpRef(type *v) {                    \
  536|  9.77k|    if (v != nullptr) {                                      \
  ------------------
  |  Branch (536:9): [True: 9.77k, False: 0]
  ------------------
  537|  9.77k|      up_ref_func(v);                                        \
  538|  9.77k|    }                                                        \
  539|  9.77k|    return UniquePtr<type>(v);                               \
  540|  9.77k|  }                                                          \
_ZN4bssl8internal7DeleterclI16crypto_buffer_stEEvPT_:
  449|  43.7k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  43.7k|    DeleterImpl<T>::Free(ptr);
  459|  43.7k|  }
_ZN4bssl8internal7DeleterclI17ssl_credential_stEEvPT_:
  449|  14.6k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  14.6k|    DeleterImpl<T>::Free(ptr);
  459|  14.6k|  }
_ZN4bssl8internal7DeleterclI32stack_st_SRTP_PROTECTION_PROFILEEEvPT_:
  449|  4.21k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  4.21k|    DeleterImpl<T>::Free(ptr);
  459|  4.21k|  }
_ZN4bssl8internal7DeleterclINS_15ECHServerConfigEEEvPT_:
  449|  12.0k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  12.0k|    DeleterImpl<T>::Free(ptr);
  459|  12.0k|  }
_ZN4bssl8internal14StackAllocatedI6cbb_stvXadL_Z8CBB_zeroEEXadL_Z11CBB_cleanupEEEC2Ev:
  466|  17.1k|  StackAllocated() { init(&ctx_); }
_ZN4bssl8internal14StackAllocatedI6cbb_stvXadL_Z8CBB_zeroEEXadL_Z11CBB_cleanupEEED2Ev:
  467|  17.1k|  ~StackAllocated() { cleanup(&ctx_); }
_ZN4bssl8internal14StackAllocatedI6cbb_stvXadL_Z8CBB_zeroEEXadL_Z11CBB_cleanupEEE3getEv:
  472|  51.3k|  T *get() { return &ctx_; }
_ZN4bssl8internal7DeleterclI22stack_st_CRYPTO_BUFFEREEvPT_:
  449|  10.9k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  10.9k|    DeleterImpl<T>::Free(ptr);
  459|  10.9k|  }
_ZN4bssl8internal7DeleterclI9bignum_stEEvPT_:
  449|      8|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|      8|    DeleterImpl<T>::Free(ptr);
  459|      8|  }
_ZN4bssl8internal14StackAllocatedI15evp_hpke_ctx_stvXadL_Z17EVP_HPKE_CTX_zeroEEXadL_Z20EVP_HPKE_CTX_cleanupEEEC2Ev:
  466|  4.88k|  StackAllocated() { init(&ctx_); }
_ZN4bssl8internal14StackAllocatedI15evp_hpke_ctx_stvXadL_Z17EVP_HPKE_CTX_zeroEEXadL_Z20EVP_HPKE_CTX_cleanupEEED2Ev:
  467|  4.88k|  ~StackAllocated() { cleanup(&ctx_); }
_ZN4bssl8internal7DeleterclINS_13SSL_HANDSHAKEEEEvPT_:
  449|  4.88k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  4.88k|    DeleterImpl<T>::Free(ptr);
  459|  4.88k|  }
_ZN4bssl8internal7DeleterclI19stack_st_SSL_CIPHEREEvPT_:
  449|  17.5k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  17.5k|    DeleterImpl<T>::Free(ptr);
  459|  17.5k|  }
_ZN4bssl8internal7DeleterclI10buf_mem_stEEvPT_:
  449|  4.88k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  4.88k|    DeleterImpl<T>::Free(ptr);
  459|  4.88k|  }
_ZN4bssl8internal14StackAllocatedI15evp_aead_ctx_stvXadL_Z17EVP_AEAD_CTX_zeroEEXadL_Z20EVP_AEAD_CTX_cleanupEEEC2Ev:
  466|  9.77k|  StackAllocated() { init(&ctx_); }
_ZN4bssl8internal14StackAllocatedI15evp_aead_ctx_stvXadL_Z17EVP_AEAD_CTX_zeroEEXadL_Z20EVP_AEAD_CTX_cleanupEEED2Ev:
  467|  9.77k|  ~StackAllocated() { cleanup(&ctx_); }
_ZN4bssl8internal7DeleterclINS_14SSLAEADContextEEEvPT_:
  449|  9.77k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  9.77k|    DeleterImpl<T>::Free(ptr);
  459|  9.77k|  }
_ZN4bssl8internal7DeleterclINS_4CERTEEEvPT_:
  449|  9.77k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  9.77k|    DeleterImpl<T>::Free(ptr);
  459|  9.77k|  }
_ZN4bssl8internal7DeleterclINS_23SSLCipherPreferenceListEEEvPT_:
  449|  17.5k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  17.5k|    DeleterImpl<T>::Free(ptr);
  459|  17.5k|  }
_ZN4bssl8internal7DeleterclINS_10SSL_CONFIGEEEvPT_:
  449|  4.88k|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|  4.88k|    DeleterImpl<T>::Free(ptr);
  459|  4.88k|  }
_ZN4bssl8internal7DeleterclINS_9TicketKeyEEEvPT_:
  449|    389|  void operator()(T *ptr) {
  450|       |    // Rather than specialize Deleter for each type, we specialize
  451|       |    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
  452|       |    // including base.h as long as the destructor is not emitted. This matches
  453|       |    // std::unique_ptr's behavior on forward-declared types.
  454|       |    //
  455|       |    // DeleterImpl itself is specialized in the corresponding module's header
  456|       |    // and must be included to release an object. If not included, the compiler
  457|       |    // will error that DeleterImpl<T> does not have a method Free.
  458|    389|    DeleterImpl<T>::Free(ptr);
  459|    389|  }
_ZN4bssl8internal21StackAllocatedMovableI13env_md_ctx_stiXadL_Z15EVP_MD_CTX_initEEXadL_Z18EVP_MD_CTX_cleanupEEXadL_Z15EVP_MD_CTX_moveEEEC2Ev:
  491|  9.77k|  StackAllocatedMovable() { init(&ctx_); }
_ZN4bssl8internal21StackAllocatedMovableI13env_md_ctx_stiXadL_Z15EVP_MD_CTX_initEEXadL_Z18EVP_MD_CTX_cleanupEEXadL_Z15EVP_MD_CTX_moveEEED2Ev:
  492|  9.77k|  ~StackAllocatedMovable() { cleanup(&ctx_); }
_ZN4bssl8internal21StackAllocatedMovableI13env_md_ctx_stiXadL_Z15EVP_MD_CTX_initEEXadL_Z18EVP_MD_CTX_cleanupEEXadL_Z15EVP_MD_CTX_moveEEE5ResetEv:
  509|  4.88k|  void Reset() {
  510|  4.88k|    cleanup(&ctx_);
  511|  4.88k|    init(&ctx_);
  512|  4.88k|  }

_ZN4bssl11BN_CTXScopeC2EP10bignum_ctx:
  955|     26|  BN_CTXScope(BN_CTX *ctx) : ctx_(ctx) { BN_CTX_start(ctx_); }
_ZN4bssl11BN_CTXScopeD2Ev:
  956|     26|  ~BN_CTXScope() { BN_CTX_end(ctx_); }

CBS_init:
   59|  4.42M|OPENSSL_INLINE void CBS_init(CBS *cbs, const uint8_t *data, size_t len) {
   60|  4.42M|  cbs->data = data;
   61|  4.42M|  cbs->len = len;
   62|  4.42M|}
CBS_len:
   72|  9.12M|OPENSSL_INLINE size_t CBS_len(const CBS *cbs) { return cbs->len; }
CBS_data:
   69|  2.01M|OPENSSL_INLINE const uint8_t *CBS_data(const CBS *cbs) { return cbs->data; }
_ZNK6cbs_stcvN4bssl4SpanIKhEEEv:
   48|  60.3k|  operator bssl::Span<const uint8_t>() const { return bssl::Span(data, len); }
_ZN6cbs_stC2EN4bssl4SpanIKhEE:
   47|  23.5k|      : data(span.data()), len(span.size()) {}

_ZN4bssl17BytesAsStringViewENS_4SpanIKhEE:
  251|  45.0k|inline std::string_view BytesAsStringView(bssl::Span<const uint8_t> b) {
  252|  45.0k|  return std::string_view(reinterpret_cast<const char *>(b.data()), b.size());
  253|  45.0k|}
_ZNK4bssl4SpanIKhE4dataEv:
  142|  68.5k|  constexpr T *data() const { return data_; }
_ZNK4bssl4SpanIKhE4sizeEv:
  143|   105k|  constexpr size_t size() const { return size_; }
_ZN4bssl4SpanIKhEC2EPS1_m:
  127|   145k|  constexpr Span(T *ptr, size_t len) : data_(ptr), size_(len) {}
_ZNK4bssl4SpanIKhE7subspanEmm:
  172|  3.42k|  constexpr Span subspan(size_t pos = 0, size_t len = npos) const {
  173|  3.42k|    if (pos > size_) {
  ------------------
  |  Branch (173:9): [True: 0, False: 3.42k]
  ------------------
  174|       |      // absl::Span throws an exception here. Note std::span and Chromium
  175|       |      // base::span additionally forbid pos + len being out of range, with a
  176|       |      // special case at npos/dynamic_extent, while absl::Span::subspan clips
  177|       |      // the span. For now, we align with absl::Span in case we switch to it in
  178|       |      // the future.
  179|      0|      abort();
  180|      0|    }
  181|  3.42k|    return Span(data_ + pos, std::min(size_ - pos, len));
  182|  3.42k|  }
_ZNK4bssl4SpanIhE4dataEv:
  142|    269|  constexpr T *data() const { return data_; }
_ZNK4bssl4SpanIhE4sizeEv:
  143|    269|  constexpr size_t size() const { return size_; }
_ZN4bssl4SpanIKhEC2INS_5ArrayIhEEvS5_EERKT_:
  135|  13.1k|      : data_(container.data()), size_(container.size()) {}
_ZNK4bssl4SpanIKhE5emptyEv:
  144|  27.0k|  constexpr bool empty() const { return size_ == 0; }
_ZN4bssl4SpanIKhEC2Ev:
  126|  57.3k|  constexpr Span() : Span(nullptr, 0) {}
_ZNK4bssl4SpanIKhE5beginEv:
  146|  37.7k|  constexpr iterator begin() const { return data_; }
_ZNK4bssl4SpanIKhE3endEv:
  148|  41.6k|  constexpr iterator end() const { return data_ + size_; }
_ZNK4bssl4SpanIKhE5frontEv:
  151|  5.31k|  constexpr T &front() const {
  152|  5.31k|    if (size_ == 0) {
  ------------------
  |  Branch (152:9): [True: 0, False: 5.31k]
  ------------------
  153|      0|      abort();
  154|      0|    }
  155|  5.31k|    return data_[0];
  156|  5.31k|  }
_ZNK4bssl4SpanIKhE4backEv:
  157|  5.12k|  constexpr T &back() const {
  158|  5.12k|    if (size_ == 0) {
  ------------------
  |  Branch (158:9): [True: 0, False: 5.12k]
  ------------------
  159|      0|      abort();
  160|      0|    }
  161|  5.12k|    return data_[size_ - 1];
  162|  5.12k|  }
_ZNK4bssl4SpanIKhEixEm:
  164|  5.59k|  constexpr T &operator[](size_t i) const {
  165|  5.59k|    if (i >= size_) {
  ------------------
  |  Branch (165:9): [True: 0, False: 5.59k]
  ------------------
  166|      0|      abort();
  167|      0|    }
  168|  5.59k|    return data_[i];
  169|  5.59k|  }
_ZN4bssl4SpanIhEC2EPhm:
  127|  5.15k|  constexpr Span(T *ptr, size_t len) : data_(ptr), size_(len) {}
_ZN4bssl4SpanIKhEC2INS0_IhEEvS4_EERKT_:
  135|    269|      : data_(container.data()), size_(container.size()) {}
_ZN4bssl8internaleqENS_4SpanIKhEES3_:
   63|    269|  friend bool operator==(Span<T> lhs, Span<T> rhs) {
   64|    269|    return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
   65|    269|  }
_ZN4bssl8internalneENS_4SpanIKhEES3_:
   67|    269|  friend bool operator!=(Span<T> lhs, Span<T> rhs) { return !(lhs == rhs); }
_ZN4bssl4SpanIKtEC2INS_5ArrayItEEvS5_EERKT_:
  135|  14.6k|      : data_(container.data()), size_(container.size()) {}
_ZN4bssl4SpanIKtEC2EPS1_m:
  127|  15.0k|  constexpr Span(T *ptr, size_t len) : data_(ptr), size_(len) {}
_ZNK4bssl4SpanIKtE5beginEv:
  146|  32.8k|  constexpr iterator begin() const { return data_; }
_ZNK4bssl4SpanIKtE3endEv:
  148|  32.8k|  constexpr iterator end() const { return data_ + size_; }
_ZNK4bssl4SpanIKtE5emptyEv:
  144|  3.17k|  constexpr bool empty() const { return size_ == 0; }
_ZNK4bssl4SpanIKtE4sizeEv:
  143|  31.6k|  constexpr size_t size() const { return size_; }
_ZN4bssl4SpanIKhEC2INS_13InplaceVectorIhLm32EEEvS5_EERKT_:
  135|  4.88k|      : data_(container.data()), size_(container.size()) {}
_ZN4bssl4SpanIhEC2Ev:
  126|  4.88k|  constexpr Span() : Span(nullptr, 0) {}
_ZNK4bssl4SpanIKbE4sizeEv:
  143|  35.1k|  constexpr size_t size() const { return size_; }
_ZN4bssl4SpanIKbEC2INS_5ArrayIbEEvS5_EERKT_:
  135|  17.5k|      : data_(container.data()), size_(container.size()) {}
_ZNK4bssl4SpanIKbE5beginEv:
  146|  17.5k|  constexpr iterator begin() const { return data_; }
_ZNK4bssl4SpanIKbE3endEv:
  148|  17.5k|  constexpr iterator end() const { return data_ + size_; }
_ZNK4bssl4SpanIKiE4sizeEv:
  143|  16.6k|  constexpr size_t size() const { return size_; }
_ZNK4bssl4SpanIKiEixEm:
  164|  5.41k|  constexpr T &operator[](size_t i) const {
  165|  5.41k|    if (i >= size_) {
  ------------------
  |  Branch (165:9): [True: 0, False: 5.41k]
  ------------------
  166|      0|      abort();
  167|      0|    }
  168|  5.41k|    return data_[i];
  169|  5.41k|  }
_ZN4bssl4SpanIKiEC2EPS1_m:
  127|  8.02k|  constexpr Span(T *ptr, size_t len) : data_(ptr), size_(len) {}
_ZN4bssl4SpanIKtEC2ILm4EEERAT__S1_:
  130|  3.69k|  constexpr Span(T (&array)[N]) : Span(array, N) {}

sk_X509_new_null:
  408|  1.89k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|  1.89k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|  1.89k|  }                                                                            \
_ZN4bssl11PushToStackI13stack_st_X509EENSt3__19enable_ifIXntsr8internal11StackTraitsIT_EE8kIsConstEbE4typeEPS4_NS2_10unique_ptrINS_8internal11StackTraitsIS4_E4TypeENS9_7DeleterEEE:
  604|  26.1k|            UniquePtr<typename internal::StackTraits<Stack>::Type> elem) {
  605|  26.1k|  if (!OPENSSL_sk_push(reinterpret_cast<OPENSSL_STACK *>(sk), elem.get())) {
  ------------------
  |  Branch (605:7): [True: 0, False: 26.1k]
  ------------------
  606|      0|    return false;
  607|      0|  }
  608|       |  // OPENSSL_sk_push takes ownership on success.
  609|  26.1k|  elem.release();
  610|  26.1k|  return true;
  611|  26.1k|}
sk_OPENSSL_STRING_pop_free:
  435|  14.6k|                                           sk_##name##_free_func free_func) {  \
  436|  14.6k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|  14.6k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|  14.6k|  }                                                                            \
sk_ASN1_OBJECT_pop_free:
  435|  14.6k|                                           sk_##name##_free_func free_func) {  \
  436|  14.6k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|  14.6k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|  14.6k|  }                                                                            \
sk_CRYPTO_BUFFER_call_copy_func:
  387|  4.95k|      OPENSSL_sk_copy_func copy_func, const void *ptr) {                       \
  388|  4.95k|    return (void *)((sk_##name##_copy_func)copy_func)((constptrtype)ptr);      \
  389|  4.95k|  }                                                                            \
sk_CRYPTO_BUFFER_new_null:
  408|  10.3k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|  10.3k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|  10.3k|  }                                                                            \
sk_CRYPTO_BUFFER_num:
  412|  81.0k|  OPENSSL_INLINE size_t sk_##name##_num(const STACK_OF(name) *sk) {            \
  413|  81.0k|    return OPENSSL_sk_num((const OPENSSL_STACK *)sk);                          \
  414|  81.0k|  }                                                                            \
sk_CRYPTO_BUFFER_value:
  421|  38.6k|                                           size_t i) {                         \
  422|  38.6k|    return (ptrtype)OPENSSL_sk_value((const OPENSSL_STACK *)sk, i);            \
  423|  38.6k|  }                                                                            \
sk_CRYPTO_BUFFER_set:
  426|  7.09k|                                         ptrtype p) {                          \
  427|  7.09k|    return (ptrtype)OPENSSL_sk_set((OPENSSL_STACK *)sk, i, (void *)p);         \
  428|  7.09k|  }                                                                            \
sk_CRYPTO_BUFFER_push:
  472|    606|  OPENSSL_INLINE size_t sk_##name##_push(STACK_OF(name) *sk, ptrtype p) {      \
  473|    606|    return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)p);                    \
  474|    606|  }                                                                            \
sk_CRYPTO_BUFFER_pop:
  476|  5.34k|  OPENSSL_INLINE ptrtype sk_##name##_pop(STACK_OF(name) *sk) {                 \
  477|  5.34k|    return (ptrtype)OPENSSL_sk_pop((OPENSSL_STACK *)sk);                       \
  478|  5.34k|  }                                                                            \
sk_CRYPTO_BUFFER_deep_copy:
  500|    606|      sk_##name##_free_func free_func) {                                       \
  501|    606|    return (STACK_OF(name) *)OPENSSL_sk_deep_copy(                             \
  502|    606|        (const OPENSSL_STACK *)sk, sk_##name##_call_copy_func,                 \
  503|    606|        (OPENSSL_sk_copy_func)copy_func, sk_##name##_call_free_func,           \
  504|    606|        (OPENSSL_sk_free_func)free_func);                                      \
  505|    606|  }                                                                            \
sk_X509_call_free_func:
  382|  26.1k|      OPENSSL_sk_free_func free_func, void *ptr) {                             \
  383|  26.1k|    ((sk_##name##_free_func)free_func)((ptrtype)ptr);                          \
  384|  26.1k|  }                                                                            \
sk_X509_pop_free:
  435|   108k|                                           sk_##name##_free_func free_func) {  \
  436|   108k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|   108k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|   108k|  }                                                                            \
sk_X509_NAME_ENTRY_call_free_func:
  382|   112k|      OPENSSL_sk_free_func free_func, void *ptr) {                             \
  383|   112k|    ((sk_##name##_free_func)free_func)((ptrtype)ptr);                          \
  384|   112k|  }                                                                            \
sk_X509_NAME_ENTRY_new_null:
  408|   168k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|   168k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|   168k|  }                                                                            \
sk_X509_NAME_ENTRY_num:
  412|   281k|  OPENSSL_INLINE size_t sk_##name##_num(const STACK_OF(name) *sk) {            \
  413|   281k|    return OPENSSL_sk_num((const OPENSSL_STACK *)sk);                          \
  414|   281k|  }                                                                            \
sk_X509_NAME_ENTRY_value:
  421|   112k|                                           size_t i) {                         \
  422|   112k|    return (ptrtype)OPENSSL_sk_value((const OPENSSL_STACK *)sk, i);            \
  423|   112k|  }                                                                            \
sk_X509_NAME_ENTRY_set:
  426|  56.2k|                                         ptrtype p) {                          \
  427|  56.2k|    return (ptrtype)OPENSSL_sk_set((OPENSSL_STACK *)sk, i, (void *)p);         \
  428|  56.2k|  }                                                                            \
sk_X509_NAME_ENTRY_free:
  430|  56.2k|  OPENSSL_INLINE void sk_##name##_free(STACK_OF(name) *sk) {                   \
  431|  56.2k|    OPENSSL_sk_free((OPENSSL_STACK *)sk);                                      \
  432|  56.2k|  }                                                                            \
sk_X509_NAME_ENTRY_pop_free:
  435|   168k|                                           sk_##name##_free_func free_func) {  \
  436|   168k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|   168k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|   168k|  }                                                                            \
sk_X509_NAME_ENTRY_push:
  472|   112k|  OPENSSL_INLINE size_t sk_##name##_push(STACK_OF(name) *sk, ptrtype p) {      \
  473|   112k|    return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)p);                    \
  474|   112k|  }                                                                            \
sk_X509_NAME_pop_free:
  435|  18.0k|                                           sk_##name##_free_func free_func) {  \
  436|  18.0k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|  18.0k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|  18.0k|  }                                                                            \
sk_X509_OBJECT_new:
  404|  4.88k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new(sk_##name##_cmp_func comp) {  \
  405|  4.88k|    return (STACK_OF(name) *)OPENSSL_sk_new((OPENSSL_sk_cmp_func)comp);        \
  406|  4.88k|  }                                                                            \
sk_X509_OBJECT_pop_free:
  435|  4.88k|                                           sk_##name##_free_func free_func) {  \
  436|  4.88k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|  4.88k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|  4.88k|  }                                                                            \
sk_SSL_CIPHER_new_null:
  408|  17.5k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|  17.5k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|  17.5k|  }                                                                            \
sk_SSL_CIPHER_num:
  412|  35.1k|  OPENSSL_INLINE size_t sk_##name##_num(const STACK_OF(name) *sk) {            \
  413|  35.1k|    return OPENSSL_sk_num((const OPENSSL_STACK *)sk);                          \
  414|  35.1k|  }                                                                            \
sk_SSL_CIPHER_push:
  472|   159k|  OPENSSL_INLINE size_t sk_##name##_push(STACK_OF(name) *sk, ptrtype p) {      \
  473|   159k|    return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)p);                    \
  474|   159k|  }                                                                            \
sk_SRTP_PROTECTION_PROFILE_new_null:
  408|  4.21k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|  4.21k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|  4.21k|  }                                                                            \
sk_SRTP_PROTECTION_PROFILE_push:
  472|    657|  OPENSSL_INLINE size_t sk_##name##_push(STACK_OF(name) *sk, ptrtype p) {      \
  473|    657|    return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)p);                    \
  474|    657|  }                                                                            \
_ZN4bssl8internal11DeleterImplI32stack_st_SRTP_PROTECTION_PROFILEvE4FreeEPS2_:
  535|  4.21k|  static void Free(Stack *sk) {
  536|  4.21k|    OPENSSL_sk_free(reinterpret_cast<OPENSSL_STACK *>(sk));
  537|  4.21k|  }
_ZN4bssl8internal11DeleterImplI22stack_st_CRYPTO_BUFFERvE4FreeEPS2_:
  544|  10.9k|  static void Free(Stack *sk) {
  545|       |    // sk_FOO_pop_free is defined by macros and bound by name, so we cannot
  546|       |    // access it from C++ here.
  547|  10.9k|    using Type = typename StackTraits<Stack>::Type;
  548|  10.9k|    OPENSSL_sk_pop_free_ex(
  549|  10.9k|        reinterpret_cast<OPENSSL_STACK *>(sk),
  550|  10.9k|        [](OPENSSL_sk_free_func /* unused */, void *ptr) {
  551|  10.9k|          DeleterImpl<Type>::Free(reinterpret_cast<Type *>(ptr));
  552|  10.9k|        },
  553|  10.9k|        nullptr);
  554|  10.9k|  }
_ZZN4bssl8internal11DeleterImplI22stack_st_CRYPTO_BUFFERvE4FreeEPS2_ENKUlPFvPvES5_E_clES7_S5_:
  550|  13.2k|        [](OPENSSL_sk_free_func /* unused */, void *ptr) {
  551|  13.2k|          DeleterImpl<Type>::Free(reinterpret_cast<Type *>(ptr));
  552|  13.2k|        },
_ZN4bssl8internal11DeleterImplI19stack_st_SSL_CIPHERvE4FreeEPS2_:
  535|  17.5k|  static void Free(Stack *sk) {
  536|  17.5k|    OPENSSL_sk_free(reinterpret_cast<OPENSSL_STACK *>(sk));
  537|  17.5k|  }
_ZN4bssl11PushToStackI22stack_st_CRYPTO_BUFFEREENSt3__19enable_ifIXntsr8internal11StackTraitsIT_EE8kIsConstEbE4typeEPS4_NS2_10unique_ptrINS_8internal11StackTraitsIS4_E4TypeENS9_7DeleterEEE:
  604|  13.4k|            UniquePtr<typename internal::StackTraits<Stack>::Type> elem) {
  605|  13.4k|  if (!OPENSSL_sk_push(reinterpret_cast<OPENSSL_STACK *>(sk), elem.get())) {
  ------------------
  |  Branch (605:7): [True: 0, False: 13.4k]
  ------------------
  606|      0|    return false;
  607|      0|  }
  608|       |  // OPENSSL_sk_push takes ownership on success.
  609|  13.4k|  elem.release();
  610|  13.4k|  return true;
  611|  13.4k|}
_Z5beginI13stack_st_X509ENSt3__19enable_ifIXsr11StackTraitsIT_EE8kIsStackEN4bssl8internal17StackIteratorImplIS3_EEE4typeEPKS3_:
  617|  46.2k|inline bssl::internal::StackIterator<Stack> begin(const Stack *sk) {
  618|  46.2k|  return bssl::internal::StackIterator<Stack>(sk, 0);
  619|  46.2k|}
_ZN4bssl8internal17StackIteratorImplI13stack_st_X509EC2EPKS2_m:
  563|  92.4k|  StackIteratorImpl(const Stack *sk, size_t idx) : sk_(sk), idx_(idx) {}
_Z3endI13stack_st_X509ENSt3__19enable_ifIXsr11StackTraitsIT_EE8kIsStackEN4bssl8internal17StackIteratorImplIS3_EEE4typeEPKS3_:
  622|  46.2k|inline bssl::internal::StackIterator<Stack> end(const Stack *sk) {
  623|  46.2k|  return bssl::internal::StackIterator<Stack>(
  624|  46.2k|      sk, OPENSSL_sk_num(reinterpret_cast<const OPENSSL_STACK *>(sk)));
  625|  46.2k|}
_ZNK4bssl8internal17StackIteratorImplI13stack_st_X509EneES3_:
  568|  48.3k|  bool operator!=(StackIteratorImpl other) const {
  569|  48.3k|    return !(*this == other);
  570|  48.3k|  }
_ZNK4bssl8internal17StackIteratorImplI13stack_st_X509EeqES3_:
  565|  48.3k|  bool operator==(StackIteratorImpl other) const {
  566|  48.3k|    return sk_ == other.sk_ && idx_ == other.idx_;
  ------------------
  |  Branch (566:12): [True: 48.3k, False: 0]
  |  Branch (566:32): [True: 46.2k, False: 2.09k]
  ------------------
  567|  48.3k|  }
_ZNK4bssl8internal17StackIteratorImplI13stack_st_X509EdeEv:
  572|  2.09k|  Type *operator*() const {
  573|  2.09k|    return reinterpret_cast<Type *>(
  574|  2.09k|        OPENSSL_sk_value(reinterpret_cast<const OPENSSL_STACK *>(sk_), idx_));
  575|  2.09k|  }
_ZN4bssl8internal17StackIteratorImplI13stack_st_X509EppEv:
  577|  2.09k|  StackIteratorImpl &operator++(/* prefix */) {
  578|  2.09k|    idx_++;
  579|  2.09k|    return *this;
  580|  2.09k|  }
sk_ASN1_VALUE_new_null:
  408|   140k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|   140k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|   140k|  }                                                                            \
sk_ASN1_VALUE_num:
  412|   815k|  OPENSSL_INLINE size_t sk_##name##_num(const STACK_OF(name) *sk) {            \
  413|   815k|    return OPENSSL_sk_num((const OPENSSL_STACK *)sk);                          \
  414|   815k|  }                                                                            \
sk_ASN1_VALUE_value:
  421|   393k|                                           size_t i) {                         \
  422|   393k|    return (ptrtype)OPENSSL_sk_value((const OPENSSL_STACK *)sk, i);            \
  423|   393k|  }                                                                            \
sk_ASN1_VALUE_free:
  430|  84.3k|  OPENSSL_INLINE void sk_##name##_free(STACK_OF(name) *sk) {                   \
  431|  84.3k|    OPENSSL_sk_free((OPENSSL_STACK *)sk);                                      \
  432|  84.3k|  }                                                                            \
sk_ASN1_VALUE_push:
  472|   224k|  OPENSSL_INLINE size_t sk_##name##_push(STACK_OF(name) *sk, ptrtype p) {      \
  473|   224k|    return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)p);                    \
  474|   224k|  }                                                                            \
sk_X509_LOOKUP_new_null:
  408|  4.88k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|  4.88k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|  4.88k|  }                                                                            \
sk_X509_LOOKUP_pop_free:
  435|  4.88k|                                           sk_##name##_free_func free_func) {  \
  436|  4.88k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|  4.88k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|  4.88k|  }                                                                            \
_Z31sk_STACK_OF_X509_NAME_ENTRY_numPK33stack_st_STACK_OF_X509_NAME_ENTRY:
  412|   112k|  OPENSSL_INLINE size_t sk_##name##_num(const STACK_OF(name) *sk) {            \
  413|   112k|    return OPENSSL_sk_num((const OPENSSL_STACK *)sk);                          \
  414|   112k|  }                                                                            \
_Z33sk_STACK_OF_X509_NAME_ENTRY_valuePK33stack_st_STACK_OF_X509_NAME_ENTRYm:
  421|  56.2k|                                           size_t i) {                         \
  422|  56.2k|    return (ptrtype)OPENSSL_sk_value((const OPENSSL_STACK *)sk, i);            \
  423|  56.2k|  }                                                                            \
_Z36sk_STACK_OF_X509_NAME_ENTRY_new_nullv:
  408|  56.2k|  OPENSSL_INLINE STACK_OF(name) *sk_##name##_new_null(void) {                  \
  409|  56.2k|    return (STACK_OF(name) *)OPENSSL_sk_new_null();                            \
  410|  56.2k|  }                                                                            \
_Z32sk_STACK_OF_X509_NAME_ENTRY_pushP33stack_st_STACK_OF_X509_NAME_ENTRYP24stack_st_X509_NAME_ENTRY:
  472|  56.2k|  OPENSSL_INLINE size_t sk_##name##_push(STACK_OF(name) *sk, ptrtype p) {      \
  473|  56.2k|    return OPENSSL_sk_push((OPENSSL_STACK *)sk, (void *)p);                    \
  474|  56.2k|  }                                                                            \
_Z36sk_STACK_OF_X509_NAME_ENTRY_pop_freeP33stack_st_STACK_OF_X509_NAME_ENTRYPFvP24stack_st_X509_NAME_ENTRYE:
  435|   112k|                                           sk_##name##_free_func free_func) {  \
  436|   112k|    OPENSSL_sk_pop_free_ex((OPENSSL_STACK *)sk, sk_##name##_call_free_func,    \
  437|   112k|                           (OPENSSL_sk_free_func)free_func);                   \
  438|   112k|  }                                                                            \
_Z42sk_STACK_OF_X509_NAME_ENTRY_call_free_funcPFvPvES_:
  382|   112k|      OPENSSL_sk_free_func free_func, void *ptr) {                             \
  383|   112k|    ((sk_##name##_free_func)free_func)((ptrtype)ptr);                          \
  384|   112k|  }                                                                            \

SSL_CTX_set_srtp_profiles:
   90|  4.21k|int SSL_CTX_set_srtp_profiles(SSL_CTX *ctx, const char *profiles) {
   91|  4.21k|  return ssl_ctx_make_profiles(profiles, &ctx->srtp_profiles);
   92|  4.21k|}
d1_srtp.cc:_ZL21ssl_ctx_make_profilesPKcPNSt3__110unique_ptrI32stack_st_SRTP_PROTECTION_PROFILEN4bssl8internal7DeleterEEE:
   57|  4.21k|    UniquePtr<STACK_OF(SRTP_PROTECTION_PROFILE)> *out) {
   58|  4.21k|  UniquePtr<STACK_OF(SRTP_PROTECTION_PROFILE)> profiles(
   59|  4.21k|      sk_SRTP_PROTECTION_PROFILE_new_null());
   60|  4.21k|  if (profiles == nullptr) {
  ------------------
  |  Branch (60:7): [True: 0, False: 4.21k]
  ------------------
   61|      0|    OPENSSL_PUT_ERROR(SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   62|      0|    return 0;
   63|      0|  }
   64|       |
   65|  4.21k|  const char *col;
   66|  4.21k|  const char *ptr = profiles_string;
   67|  4.48k|  do {
   68|  4.48k|    col = strchr(ptr, ':');
   69|       |
   70|  4.48k|    const SRTP_PROTECTION_PROFILE *profile;
   71|  4.48k|    if (!find_profile_by_name(ptr, &profile,
  ------------------
  |  Branch (71:9): [True: 3.82k, False: 657]
  ------------------
   72|  4.48k|                              col ? (size_t)(col - ptr) : strlen(ptr))) {
  ------------------
  |  Branch (72:31): [True: 643, False: 3.84k]
  ------------------
   73|  3.82k|      OPENSSL_PUT_ERROR(SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE);
  ------------------
  |  |  361|  3.82k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
   74|  3.82k|      return 0;
   75|  3.82k|    }
   76|       |
   77|    657|    if (!sk_SRTP_PROTECTION_PROFILE_push(profiles.get(), profile)) {
  ------------------
  |  Branch (77:9): [True: 0, False: 657]
  ------------------
   78|      0|      return 0;
   79|      0|    }
   80|       |
   81|    657|    if (col) {
  ------------------
  |  Branch (81:9): [True: 267, False: 390]
  ------------------
   82|    267|      ptr = col + 1;
   83|    267|    }
   84|    657|  } while (col);
  ------------------
  |  Branch (84:12): [True: 267, False: 390]
  ------------------
   85|       |
   86|    390|  *out = std::move(profiles);
   87|    390|  return 1;
   88|  4.21k|}
d1_srtp.cc:_ZL20find_profile_by_namePKcPPK26srtp_protection_profile_stm:
   41|  4.48k|                                size_t len) {
   42|  4.48k|  const SRTP_PROTECTION_PROFILE *p = kSRTPProfiles;
   43|  21.6k|  while (p->name) {
  ------------------
  |  Branch (43:10): [True: 17.8k, False: 3.82k]
  ------------------
   44|  17.8k|    if (len == strlen(p->name) && !strncmp(p->name, profile_name, len)) {
  ------------------
  |  Branch (44:9): [True: 1.70k, False: 16.1k]
  |  Branch (44:35): [True: 657, False: 1.04k]
  ------------------
   45|    657|      *pptr = p;
   46|    657|      return 1;
   47|    657|    }
   48|       |
   49|  17.1k|    p++;
   50|  17.1k|  }
   51|       |
   52|  3.82k|  return 0;
   53|  4.48k|}

_ZN4bssl28ssl_is_valid_ech_public_nameENS_4SpanIKhEE:
  365|  5.49k|bool ssl_is_valid_ech_public_name(Span<const uint8_t> public_name) {
  366|       |  // See draft-ietf-tls-esni-13, Section 4 and RFC 5890, Section 2.3.1. The
  367|       |  // public name must be a dot-separated sequence of LDH labels and not begin or
  368|       |  // end with a dot.
  369|  5.49k|  auto remaining = public_name;
  370|  5.49k|  if (remaining.empty()) {
  ------------------
  |  Branch (370:7): [True: 0, False: 5.49k]
  ------------------
  371|      0|    return false;
  372|      0|  }
  373|  5.49k|  Span<const uint8_t> last;
  374|  9.93k|  while (!remaining.empty()) {
  ------------------
  |  Branch (374:10): [True: 5.90k, False: 4.02k]
  ------------------
  375|       |    // Find the next dot-separated component.
  376|  5.90k|    auto dot = std::find(remaining.begin(), remaining.end(), '.');
  377|  5.90k|    Span<const uint8_t> component;
  378|  5.90k|    if (dot == remaining.end()) {
  ------------------
  |  Branch (378:9): [True: 4.89k, False: 1.01k]
  ------------------
  379|  4.89k|      component = remaining;
  380|  4.89k|      last = component;
  381|  4.89k|      remaining = Span<const uint8_t>();
  382|  4.89k|    } else {
  383|  1.01k|      component = remaining.subspan(0, dot - remaining.begin());
  384|       |      // Skip the dot.
  385|  1.01k|      remaining = remaining.subspan(dot - remaining.begin() + 1);
  386|  1.01k|      if (remaining.empty()) {
  ------------------
  |  Branch (386:11): [True: 198, False: 812]
  ------------------
  387|       |        // Trailing dots are not allowed.
  388|    198|        return false;
  389|    198|      }
  390|  1.01k|    }
  391|       |    // |component| must be a valid LDH label. Checking for empty components also
  392|       |    // rejects leading dots.
  393|  5.71k|    if (component.empty() || component.size() > 63 ||
  ------------------
  |  Branch (393:9): [True: 195, False: 5.51k]
  |  Branch (393:30): [True: 199, False: 5.31k]
  ------------------
  394|  5.71k|        component.front() == '-' || component.back() == '-') {
  ------------------
  |  Branch (394:9): [True: 194, False: 5.12k]
  |  Branch (394:37): [True: 421, False: 4.70k]
  ------------------
  395|  1.00k|      return false;
  396|  1.00k|    }
  397|  16.3k|    for (uint8_t c : component) {
  ------------------
  |  Branch (397:20): [True: 16.3k, False: 4.43k]
  ------------------
  398|  16.3k|      if (!OPENSSL_isalnum(c) && c != '-') {
  ------------------
  |  Branch (398:11): [True: 1.46k, False: 14.9k]
  |  Branch (398:34): [True: 268, False: 1.19k]
  ------------------
  399|    268|        return false;
  400|    268|      }
  401|  16.3k|    }
  402|  4.70k|  }
  403|       |
  404|       |  // The WHATWG URL parser additionally does not allow any DNS names that end in
  405|       |  // a numeric component. See:
  406|       |  // https://url.spec.whatwg.org/#concept-host-parser
  407|       |  // https://url.spec.whatwg.org/#ends-in-a-number-checker
  408|       |  //
  409|       |  // The WHATWG parser is formulated in terms of parsing decimal, octal, and
  410|       |  // hex, along with a separate ASCII digits check. The ASCII digits check
  411|       |  // subsumes the decimal and octal check, so we only need to check two cases.
  412|  4.02k|  return !is_hex_component(last) && !is_decimal_component(last);
  ------------------
  |  Branch (412:10): [True: 3.56k, False: 461]
  |  Branch (412:37): [True: 3.27k, False: 288]
  ------------------
  413|  5.49k|}
_ZN4bssl15ECHServerConfig4InitENS_4SpanIKhEEPK15evp_hpke_key_stb:
  494|  12.0k|                           const EVP_HPKE_KEY *key, bool is_retry_config) {
  495|  12.0k|  is_retry_config_ = is_retry_config;
  496|       |
  497|       |  // Parse the ECHConfig, rejecting all unsupported parameters and extensions.
  498|       |  // Unlike most server options, ECH's server configuration is serialized and
  499|       |  // configured in both the server and DNS. If the caller configures an
  500|       |  // unsupported parameter, this is a deployment error. To catch these errors,
  501|       |  // we fail early.
  502|  12.0k|  CBS cbs = ech_config;
  503|  12.0k|  bool supported;
  504|  12.0k|  if (!parse_ech_config(&cbs, &ech_config_, &supported,
  ------------------
  |  Branch (504:7): [True: 6.60k, False: 5.45k]
  ------------------
  505|  12.0k|                        /*all_extensions_mandatory=*/true)) {
  506|  6.60k|    return false;
  507|  6.60k|  }
  508|  5.45k|  if (CBS_len(&cbs) != 0) {
  ------------------
  |  Branch (508:7): [True: 1.02k, False: 4.42k]
  ------------------
  509|  1.02k|    OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
  ------------------
  |  |  361|  1.02k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  510|  1.02k|    return false;
  511|  1.02k|  }
  512|  4.42k|  if (!supported) {
  ------------------
  |  Branch (512:7): [True: 2.30k, False: 2.12k]
  ------------------
  513|  2.30k|    OPENSSL_PUT_ERROR(SSL, SSL_R_UNSUPPORTED_ECH_SERVER_CONFIG);
  ------------------
  |  |  361|  2.30k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  514|  2.30k|    return false;
  515|  2.30k|  }
  516|       |
  517|  2.12k|  CBS cipher_suites = ech_config_.cipher_suites;
  518|  2.63k|  while (CBS_len(&cipher_suites) > 0) {
  ------------------
  |  Branch (518:10): [True: 2.12k, False: 511]
  ------------------
  519|  2.12k|    uint16_t kdf_id, aead_id;
  520|  2.12k|    if (!CBS_get_u16(&cipher_suites, &kdf_id) ||
  ------------------
  |  Branch (520:9): [True: 0, False: 2.12k]
  ------------------
  521|  2.12k|        !CBS_get_u16(&cipher_suites, &aead_id)) {
  ------------------
  |  Branch (521:9): [True: 0, False: 2.12k]
  ------------------
  522|      0|      OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  523|      0|      return false;
  524|      0|    }
  525|       |    // The server promises to support every option in the ECHConfig, so reject
  526|       |    // any unsupported cipher suites.
  527|  2.12k|    if (kdf_id != EVP_HPKE_HKDF_SHA256 || get_ech_aead(aead_id) == nullptr) {
  ------------------
  |  |   81|  4.25k|#define EVP_HPKE_HKDF_SHA256 0x0001
  ------------------
  |  Branch (527:9): [True: 1.00k, False: 1.12k]
  |  Branch (527:43): [True: 609, False: 511]
  ------------------
  528|  1.61k|      OPENSSL_PUT_ERROR(SSL, SSL_R_UNSUPPORTED_ECH_SERVER_CONFIG);
  ------------------
  |  |  361|  1.61k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  529|  1.61k|      return false;
  530|  1.61k|    }
  531|  2.12k|  }
  532|       |
  533|       |  // Check the public key in the ECHConfig matches |key|.
  534|    511|  uint8_t expected_public_key[EVP_HPKE_MAX_PUBLIC_KEY_LENGTH];
  535|    511|  size_t expected_public_key_len;
  536|    511|  if (!EVP_HPKE_KEY_public_key(key, expected_public_key,
  ------------------
  |  Branch (536:7): [True: 0, False: 511]
  ------------------
  537|    511|                               &expected_public_key_len,
  538|    511|                               sizeof(expected_public_key))) {
  539|      0|    return false;
  540|      0|  }
  541|    511|  if (ech_config_.kem_id != EVP_HPKE_KEM_id(EVP_HPKE_KEY_kem(key)) ||
  ------------------
  |  Branch (541:7): [True: 242, False: 269]
  |  Branch (541:7): [True: 511, False: 0]
  ------------------
  542|    511|      Span(expected_public_key, expected_public_key_len) !=
  ------------------
  |  Branch (542:7): [True: 269, False: 0]
  ------------------
  543|    511|          ech_config_.public_key) {
  544|    511|    OPENSSL_PUT_ERROR(SSL, SSL_R_ECH_SERVER_CONFIG_AND_PRIVATE_KEY_MISMATCH);
  ------------------
  |  |  361|    511|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  545|    511|    return false;
  546|    511|  }
  547|       |
  548|      0|  if (!EVP_HPKE_KEY_copy(key_.get(), key)) {
  ------------------
  |  Branch (548:7): [True: 0, False: 0]
  ------------------
  549|      0|    return false;
  550|      0|  }
  551|       |
  552|      0|  return true;
  553|      0|}
SSL_ECH_KEYS_new:
 1020|  13.8k|SSL_ECH_KEYS *SSL_ECH_KEYS_new() { return New<SSL_ECH_KEYS>(); }
SSL_ECH_KEYS_free:
 1024|  13.8k|void SSL_ECH_KEYS_free(SSL_ECH_KEYS *keys) {
 1025|  13.8k|  if (keys != nullptr) {
  ------------------
  |  Branch (1025:7): [True: 13.8k, False: 0]
  ------------------
 1026|  13.8k|    keys->DecRefInternal();
 1027|  13.8k|  }
 1028|  13.8k|}
SSL_ECH_KEYS_add:
 1032|  12.0k|                     const EVP_HPKE_KEY *key) {
 1033|  12.0k|  UniquePtr<ECHServerConfig> parsed_config = MakeUnique<ECHServerConfig>();
 1034|  12.0k|  if (!parsed_config) {
  ------------------
  |  Branch (1034:7): [True: 0, False: 12.0k]
  ------------------
 1035|      0|    return 0;
 1036|      0|  }
 1037|  12.0k|  if (!parsed_config->Init(Span(ech_config, ech_config_len), key,
  ------------------
  |  Branch (1037:7): [True: 12.0k, False: 0]
  ------------------
 1038|  12.0k|                           !!is_retry_config)) {
 1039|  12.0k|    OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
  ------------------
  |  |  361|  12.0k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1040|  12.0k|    return 0;
 1041|  12.0k|  }
 1042|      0|  if (!configs->configs.Push(std::move(parsed_config))) {
  ------------------
  |  Branch (1042:7): [True: 0, False: 0]
  ------------------
 1043|      0|    return 0;
 1044|      0|  }
 1045|      0|  return 1;
 1046|      0|}
encrypted_client_hello.cc:_ZN4bsslL16is_hex_componentENS_4SpanIKhEE:
  341|  4.02k|static bool is_hex_component(Span<const uint8_t> in) {
  342|  4.02k|  if (in.size() < 2 || in[0] != '0' || (in[1] != 'x' && in[1] != 'X')) {
  ------------------
  |  Branch (342:7): [True: 1.44k, False: 2.58k]
  |  Branch (342:24): [True: 474, False: 2.10k]
  |  Branch (342:41): [True: 906, False: 1.20k]
  |  Branch (342:57): [True: 702, False: 204]
  ------------------
  343|  2.62k|    return false;
  344|  2.62k|  }
  345|  5.66k|  for (uint8_t b : in.subspan(2)) {
  ------------------
  |  Branch (345:18): [True: 5.66k, False: 461]
  ------------------
  346|  5.66k|    if (!OPENSSL_isxdigit(b)) {
  ------------------
  |  Branch (346:9): [True: 943, False: 4.72k]
  ------------------
  347|    943|      return false;
  348|    943|    }
  349|  5.66k|  }
  350|    461|  return true;
  351|  1.40k|}
encrypted_client_hello.cc:_ZN4bsslL20is_decimal_componentENS_4SpanIKhEE:
  353|  3.56k|static bool is_decimal_component(Span<const uint8_t> in) {
  354|  3.56k|  if (in.empty()) {
  ------------------
  |  Branch (354:7): [True: 0, False: 3.56k]
  ------------------
  355|      0|    return false;
  356|      0|  }
  357|  5.94k|  for (uint8_t b : in) {
  ------------------
  |  Branch (357:18): [True: 5.94k, False: 288]
  ------------------
  358|  5.94k|    if (!('0' <= b && b <= '9')) {
  ------------------
  |  Branch (358:11): [True: 5.44k, False: 500]
  |  Branch (358:23): [True: 2.66k, False: 2.77k]
  ------------------
  359|  3.27k|      return false;
  360|  3.27k|    }
  361|  5.94k|  }
  362|    288|  return true;
  363|  3.56k|}
encrypted_client_hello.cc:_ZN4bsslL16parse_ech_configEP6cbs_stPNS_9ECHConfigEPbb:
  416|  12.0k|                             bool all_extensions_mandatory) {
  417|  12.0k|  uint16_t version;
  418|  12.0k|  CBS orig = *cbs;
  419|  12.0k|  CBS contents;
  420|  12.0k|  if (!CBS_get_u16(cbs, &version) ||
  ------------------
  |  Branch (420:7): [True: 2.96k, False: 9.08k]
  ------------------
  421|  12.0k|      !CBS_get_u16_length_prefixed(cbs, &contents)) {
  ------------------
  |  Branch (421:7): [True: 278, False: 8.80k]
  ------------------
  422|  3.24k|    OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
  ------------------
  |  |  361|  3.24k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  423|  3.24k|    return false;
  424|  3.24k|  }
  425|       |
  426|  8.80k|  if (version != kECHConfigVersion) {
  ------------------
  |  Branch (426:7): [True: 566, False: 8.24k]
  ------------------
  427|    566|    *out_supported = false;
  428|    566|    return true;
  429|    566|  }
  430|       |
  431|       |  // Make a copy of the ECHConfig and parse from it, so the results alias into
  432|       |  // the saved copy.
  433|  8.24k|  if (!out->raw.CopyFrom(
  ------------------
  |  Branch (433:7): [True: 0, False: 8.24k]
  ------------------
  434|  8.24k|          Span(CBS_data(&orig), CBS_len(&orig) - CBS_len(cbs)))) {
  435|      0|    return false;
  436|      0|  }
  437|       |
  438|  8.24k|  CBS ech_config(out->raw);
  439|  8.24k|  CBS public_name, public_key, cipher_suites, extensions;
  440|  8.24k|  if (!CBS_skip(&ech_config, 2) ||  // version
  ------------------
  |  Branch (440:7): [True: 0, False: 8.24k]
  ------------------
  441|  8.24k|      !CBS_get_u16_length_prefixed(&ech_config, &contents) ||
  ------------------
  |  Branch (441:7): [True: 0, False: 8.24k]
  ------------------
  442|  8.24k|      !CBS_get_u8(&contents, &out->config_id) ||
  ------------------
  |  Branch (442:7): [True: 375, False: 7.86k]
  ------------------
  443|  8.24k|      !CBS_get_u16(&contents, &out->kem_id) ||
  ------------------
  |  Branch (443:7): [True: 198, False: 7.67k]
  ------------------
  444|  8.24k|      !CBS_get_u16_length_prefixed(&contents, &public_key) ||
  ------------------
  |  Branch (444:7): [True: 223, False: 7.44k]
  ------------------
  445|  8.24k|      CBS_len(&public_key) == 0 ||
  ------------------
  |  Branch (445:7): [True: 208, False: 7.23k]
  ------------------
  446|  8.24k|      !CBS_get_u16_length_prefixed(&contents, &cipher_suites) ||
  ------------------
  |  Branch (446:7): [True: 202, False: 7.03k]
  ------------------
  447|  8.24k|      CBS_len(&cipher_suites) == 0 || CBS_len(&cipher_suites) % 4 != 0 ||
  ------------------
  |  Branch (447:7): [True: 210, False: 6.82k]
  |  Branch (447:39): [True: 201, False: 6.62k]
  ------------------
  448|  8.24k|      !CBS_get_u8(&contents, &out->maximum_name_length) ||
  ------------------
  |  Branch (448:7): [True: 195, False: 6.43k]
  ------------------
  449|  8.24k|      !CBS_get_u8_length_prefixed(&contents, &public_name) ||
  ------------------
  |  Branch (449:7): [True: 277, False: 6.15k]
  ------------------
  450|  8.24k|      CBS_len(&public_name) == 0 ||
  ------------------
  |  Branch (450:7): [True: 194, False: 5.96k]
  ------------------
  451|  8.24k|      !CBS_get_u16_length_prefixed(&contents, &extensions) ||
  ------------------
  |  Branch (451:7): [True: 259, False: 5.70k]
  ------------------
  452|  8.24k|      CBS_len(&contents) != 0) {
  ------------------
  |  Branch (452:7): [True: 202, False: 5.49k]
  ------------------
  453|  2.74k|    OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
  ------------------
  |  |  361|  2.74k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  454|  2.74k|    return false;
  455|  2.74k|  }
  456|       |
  457|  5.49k|  if (!ssl_is_valid_ech_public_name(public_name)) {
  ------------------
  |  Branch (457:7): [True: 2.22k, False: 3.27k]
  ------------------
  458|       |    // TODO(https://crbug.com/boringssl/275): The draft says ECHConfigs with
  459|       |    // invalid public names should be ignored, but LDH syntax failures are
  460|       |    // unambiguously invalid.
  461|  2.22k|    *out_supported = false;
  462|  2.22k|    return true;
  463|  2.22k|  }
  464|       |
  465|  3.27k|  out->public_key = public_key;
  466|  3.27k|  out->public_name = public_name;
  467|       |  // This function does not ensure |out->kem_id| and |out->cipher_suites| use
  468|       |  // supported algorithms. The caller must do this.
  469|  3.27k|  out->cipher_suites = cipher_suites;
  470|       |
  471|  3.27k|  bool has_unknown_mandatory_extension = false;
  472|  4.41k|  while (CBS_len(&extensions) != 0) {
  ------------------
  |  Branch (472:10): [True: 1.75k, False: 2.66k]
  ------------------
  473|  1.75k|    uint16_t type;
  474|  1.75k|    CBS body;
  475|  1.75k|    if (!CBS_get_u16(&extensions, &type) ||
  ------------------
  |  Branch (475:9): [True: 383, False: 1.37k]
  ------------------
  476|  1.75k|        !CBS_get_u16_length_prefixed(&extensions, &body)) {
  ------------------
  |  Branch (476:9): [True: 230, False: 1.14k]
  ------------------
  477|    613|      OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
  ------------------
  |  |  361|    613|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  478|    613|      return false;
  479|    613|    }
  480|       |    // We currently do not support any extensions.
  481|  1.14k|    if (type & 0x8000 || all_extensions_mandatory) {
  ------------------
  |  Branch (481:9): [True: 668, False: 473]
  |  Branch (481:26): [True: 473, False: 0]
  ------------------
  482|       |      // Extension numbers with the high bit set are mandatory. Continue parsing
  483|       |      // to enforce syntax, but we will ultimately ignore this ECHConfig as a
  484|       |      // client and reject it as a server.
  485|  1.14k|      has_unknown_mandatory_extension = true;
  486|  1.14k|    }
  487|  1.14k|  }
  488|       |
  489|  2.66k|  *out_supported = !has_unknown_mandatory_extension;
  490|  2.66k|  return true;
  491|  3.27k|}
encrypted_client_hello.cc:_ZN4bsslL12get_ech_aeadEt:
   47|  1.12k|static const EVP_HPKE_AEAD *get_ech_aead(uint16_t aead_id) {
   48|  2.85k|  for (const auto aead_func : kSupportedAEADs) {
  ------------------
  |  Branch (48:29): [True: 2.85k, False: 609]
  ------------------
   49|  2.85k|    const EVP_HPKE_AEAD *aead = aead_func();
   50|  2.85k|    if (aead_id == EVP_HPKE_AEAD_id(aead)) {
  ------------------
  |  Branch (50:9): [True: 511, False: 2.34k]
  ------------------
   51|    511|      return aead;
   52|    511|    }
   53|  2.85k|  }
   54|    609|  return nullptr;
   55|  1.12k|}

_ZN4bssl22ssl_is_valid_alpn_listENS_4SpanIKhEE:
 1421|  1.10k|bool ssl_is_valid_alpn_list(Span<const uint8_t> in) {
 1422|  1.10k|  CBS protocol_name_list = in;
 1423|  1.10k|  if (CBS_len(&protocol_name_list) == 0) {
  ------------------
  |  Branch (1423:7): [True: 0, False: 1.10k]
  ------------------
 1424|      0|    return false;
 1425|      0|  }
 1426|  1.70k|  while (CBS_len(&protocol_name_list) > 0) {
  ------------------
  |  Branch (1426:10): [True: 1.48k, False: 222]
  ------------------
 1427|  1.48k|    CBS protocol_name;
 1428|  1.48k|    if (!CBS_get_u8_length_prefixed(&protocol_name_list, &protocol_name) ||
  ------------------
  |  Branch (1428:9): [True: 612, False: 868]
  ------------------
 1429|       |        // Empty protocol names are forbidden.
 1430|  1.48k|        CBS_len(&protocol_name) == 0) {
  ------------------
  |  Branch (1430:9): [True: 268, False: 600]
  ------------------
 1431|    880|      return false;
 1432|    880|    }
 1433|  1.48k|  }
 1434|    222|  return true;
 1435|  1.10k|}
_ZN4bssl21ssl_is_sct_list_validEPK6cbs_st:
 4742|  2.77k|bool ssl_is_sct_list_valid(const CBS *contents) {
 4743|       |  // Shallow parse the SCT list for sanity. By the RFC
 4744|       |  // (https://tools.ietf.org/html/rfc6962#section-3.3) neither the list nor any
 4745|       |  // of the SCTs may be empty.
 4746|  2.77k|  CBS copy = *contents;
 4747|  2.77k|  CBS sct_list;
 4748|  2.77k|  if (!CBS_get_u16_length_prefixed(&copy, &sct_list) || CBS_len(&copy) != 0 ||
  ------------------
  |  Branch (4748:7): [True: 1.08k, False: 1.69k]
  |  Branch (4748:57): [True: 342, False: 1.35k]
  ------------------
 4749|  2.77k|      CBS_len(&sct_list) == 0) {
  ------------------
  |  Branch (4749:7): [True: 194, False: 1.15k]
  ------------------
 4750|  1.61k|    return false;
 4751|  1.61k|  }
 4752|       |
 4753|  1.76k|  while (CBS_len(&sct_list) > 0) {
  ------------------
  |  Branch (4753:10): [True: 1.26k, False: 499]
  ------------------
 4754|  1.26k|    CBS sct;
 4755|  1.26k|    if (!CBS_get_u16_length_prefixed(&sct_list, &sct) || CBS_len(&sct) == 0) {
  ------------------
  |  Branch (4755:9): [True: 268, False: 996]
  |  Branch (4755:58): [True: 390, False: 606]
  ------------------
 4756|    658|      return false;
 4757|    658|    }
 4758|  1.26k|  }
 4759|       |
 4760|    499|  return true;
 4761|  1.15k|}

_ZN4bssl13SSL_HANDSHAKEC2EP6ssl_st:
   32|  4.88k|    : ssl(ssl_arg),
   33|  4.88k|      transcript(SSL_is_dtls(ssl_arg)),
   34|  4.88k|      inner_transcript(SSL_is_dtls(ssl_arg)),
   35|  4.88k|      ech_is_inner(false),
   36|  4.88k|      ech_authenticated_reject(false),
   37|  4.88k|      scts_requested(false),
   38|  4.88k|      handshake_finalized(false),
   39|  4.88k|      accept_psk_mode(false),
   40|  4.88k|      cert_request(false),
   41|  4.88k|      certificate_status_expected(false),
   42|  4.88k|      ocsp_stapling_requested(false),
   43|  4.88k|      should_ack_sni(false),
   44|  4.88k|      in_false_start(false),
   45|  4.88k|      in_early_data(false),
   46|  4.88k|      early_data_offered(false),
   47|  4.88k|      can_early_read(false),
   48|  4.88k|      can_early_write(false),
   49|  4.88k|      is_early_version(false),
   50|  4.88k|      next_proto_neg_seen(false),
   51|  4.88k|      ticket_expected(false),
   52|  4.88k|      extended_master_secret(false),
   53|  4.88k|      pending_private_key_op(false),
   54|  4.88k|      handback(false),
   55|  4.88k|      hints_requested(false),
   56|  4.88k|      cert_compression_negotiated(false),
   57|  4.88k|      apply_jdk11_workaround(false),
   58|  4.88k|      can_release_private_key(false),
   59|  4.88k|      channel_id_negotiated(false),
   60|  4.88k|      received_hello_verify_request(false),
   61|  4.88k|      matched_peer_trust_anchor(false),
   62|  4.88k|      peer_matched_trust_anchor(false) {
   63|  4.88k|  assert(ssl);
   64|       |
   65|       |  // Draw entropy for all GREASE values at once. This avoids calling
   66|       |  // |RAND_bytes| repeatedly and makes the values consistent within a
   67|       |  // connection. The latter is so the second ClientHello matches after
   68|       |  // HelloRetryRequest and so supported_groups and key_shares are consistent.
   69|  4.88k|  RAND_bytes(grease_seed, sizeof(grease_seed));
   70|  4.88k|}
_ZN4bssl13SSL_HANDSHAKED2Ev:
   72|  4.88k|SSL_HANDSHAKE::~SSL_HANDSHAKE() {
   73|  4.88k|  ssl->ctx->x509_method->hs_flush_cached_ca_names(this);
   74|  4.88k|}
_ZN4bssl17ssl_handshake_newEP6ssl_st:
  100|  4.88k|UniquePtr<SSL_HANDSHAKE> ssl_handshake_new(SSL *ssl) {
  101|  4.88k|  UniquePtr<SSL_HANDSHAKE> hs = MakeUnique<SSL_HANDSHAKE>(ssl);
  102|  4.88k|  if (!hs || !hs->transcript.Init()) {
  ------------------
  |  Branch (102:7): [True: 0, False: 4.88k]
  |  Branch (102:14): [True: 0, False: 4.88k]
  ------------------
  103|      0|    return nullptr;
  104|      0|  }
  105|  4.88k|  hs->config = ssl->config.get();
  106|  4.88k|  if (!hs->config) {
  ------------------
  |  Branch (106:7): [True: 0, False: 4.88k]
  ------------------
  107|      0|    assert(hs->config);
  108|      0|    return nullptr;
  109|      0|  }
  110|  4.88k|  return hs;
  111|  4.88k|}

_ZN4bssl9SSLBufferC2Ev:
 1033|  9.77k|  SSLBuffer() {}
_ZN4bssl9SSLBufferD2Ev:
 1034|  9.77k|  ~SSLBuffer() { Clear(); }
_ZNK4bssl4CERT8is_validEv:
 2391|  4.88k|  bool is_valid() const { return legacy_credential != nullptr; }
_ZN15ssl_ech_keys_stC2Ev:
 4251|  13.8k|  ssl_ech_keys_st() : RefCounted(CheckSubClass()) {}
_ZN4bssl10RefCountedI15ssl_ech_keys_stEC2ENS2_13CheckSubClassE:
  168|  13.8k|  RefCounted(CheckSubClass) {
  169|  13.8k|    static_assert(std::is_base_of<RefCounted, Derived>::value,
  170|  13.8k|                  "Derived must subclass RefCounted<Derived>");
  171|  13.8k|  }
_ZN4bssl10RefCountedI15ssl_ech_keys_stE14DecRefInternalEv:
  151|  13.8k|  void DecRefInternal() {
  152|  13.8k|    if (CRYPTO_refcount_dec_and_test_zero(&references_)) {
  ------------------
  |  Branch (152:9): [True: 13.8k, False: 0]
  ------------------
  153|  13.8k|      Derived *d = static_cast<Derived *>(this);
  154|  13.8k|      d->~Derived();
  155|  13.8k|      OPENSSL_free(d);
  156|  13.8k|    }
  157|  13.8k|  }
_ZN15ssl_ech_keys_stD2Ev:
 4257|  13.8k|  ~ssl_ech_keys_st() = default;
_ZN4bssl15ECHServerConfigC2Ev:
 1281|  12.0k|  ECHServerConfig() = default;
_ZN4bssl23SSLCipherPreferenceListC2Ev:
  332|  17.5k|  SSLCipherPreferenceList() = default;
_ZN4bssl10RefCountedI17ssl_credential_stEC2ENS2_13CheckSubClassE:
  168|  14.6k|  RefCounted(CheckSubClass) {
  169|  14.6k|    static_assert(std::is_base_of<RefCounted, Derived>::value,
  170|  14.6k|                  "Derived must subclass RefCounted<Derived>");
  171|  14.6k|  }
_ZN4bssl10RefCountedI17ssl_credential_stE14DecRefInternalEv:
  151|  14.6k|  void DecRefInternal() {
  152|  14.6k|    if (CRYPTO_refcount_dec_and_test_zero(&references_)) {
  ------------------
  |  Branch (152:9): [True: 14.6k, False: 0]
  ------------------
  153|  14.6k|      Derived *d = static_cast<Derived *>(this);
  154|  14.6k|      d->~Derived();
  155|  14.6k|      OPENSSL_free(d);
  156|  14.6k|    }
  157|  14.6k|  }
_ZN4bssl10RefCountedI10ssl_ctx_stEC2ENS2_13CheckSubClassE:
  168|  4.88k|  RefCounted(CheckSubClass) {
  169|  4.88k|    static_assert(std::is_base_of<RefCounted, Derived>::value,
  170|  4.88k|                  "Derived must subclass RefCounted<Derived>");
  171|  4.88k|  }
_ZN4bssl10RefCountedI10ssl_ctx_stE13UpRefInternalEv:
  150|  9.77k|  void UpRefInternal() { CRYPTO_refcount_inc(&references_); }
_ZN4bssl10RefCountedI10ssl_ctx_stE14DecRefInternalEv:
  151|  14.6k|  void DecRefInternal() {
  152|  14.6k|    if (CRYPTO_refcount_dec_and_test_zero(&references_)) {
  ------------------
  |  Branch (152:9): [True: 4.88k, False: 9.77k]
  ------------------
  153|  4.88k|      Derived *d = static_cast<Derived *>(this);
  154|  4.88k|      d->~Derived();
  155|  4.88k|      OPENSSL_free(d);
  156|  4.88k|    }
  157|  14.6k|  }

_ZN4bssl10SSL3_STATEC2Ev:
   35|  4.88k|    : skip_early_data(false),
   36|  4.88k|      v2_hello_done(false),
   37|  4.88k|      is_v2_hello(false),
   38|  4.88k|      has_message(false),
   39|  4.88k|      initial_handshake_complete(false),
   40|  4.88k|      session_reused(false),
   41|  4.88k|      send_connection_binding(false),
   42|  4.88k|      channel_id_valid(false),
   43|  4.88k|      key_update_pending(false),
   44|  4.88k|      early_data_accepted(false),
   45|  4.88k|      alert_dispatch(false),
   46|  4.88k|      renegotiate_pending(false),
   47|  4.88k|      used_hello_retry_request(false),
   48|  4.88k|      was_key_usage_invalid(false) {}
_ZN4bssl10SSL3_STATED2Ev:
   50|  4.88k|SSL3_STATE::~SSL3_STATE() {}
_ZN4bssl7tls_newEP6ssl_st:
   52|  4.88k|bool tls_new(SSL *ssl) {
   53|  4.88k|  UniquePtr<SSL3_STATE> s3 = MakeUnique<SSL3_STATE>();
   54|  4.88k|  if (!s3) {
  ------------------
  |  Branch (54:7): [True: 0, False: 4.88k]
  ------------------
   55|      0|    return false;
   56|      0|  }
   57|       |
   58|       |  // TODO(crbug.com/368805255): Fields that aren't used in DTLS should not be
   59|       |  // allocated at all.
   60|       |  // TODO(crbug.com/371998381): Don't create these in QUIC either, once the
   61|       |  // placeholder QUIC ones for subsequent epochs are removed.
   62|  4.88k|  if (!SSL_is_dtls(ssl)) {
  ------------------
  |  Branch (62:7): [True: 4.88k, False: 0]
  ------------------
   63|  4.88k|    s3->aead_read_ctx = SSLAEADContext::CreateNullCipher();
   64|  4.88k|    s3->aead_write_ctx = SSLAEADContext::CreateNullCipher();
   65|  4.88k|    if (!s3->aead_read_ctx || !s3->aead_write_ctx) {
  ------------------
  |  Branch (65:9): [True: 0, False: 4.88k]
  |  Branch (65:31): [True: 0, False: 4.88k]
  ------------------
   66|      0|      return false;
   67|      0|    }
   68|  4.88k|  }
   69|       |
   70|  4.88k|  s3->hs = ssl_handshake_new(ssl);
   71|  4.88k|  if (!s3->hs) {
  ------------------
  |  Branch (71:7): [True: 0, False: 4.88k]
  ------------------
   72|      0|    return false;
   73|      0|  }
   74|       |
   75|  4.88k|  ssl->s3 = s3.release();
   76|  4.88k|  return true;
   77|  4.88k|}
_ZN4bssl8tls_freeEP6ssl_st:
   79|  4.88k|void tls_free(SSL *ssl) {
   80|  4.88k|  if (ssl->s3 == NULL) {
  ------------------
  |  Branch (80:7): [True: 0, False: 4.88k]
  ------------------
   81|      0|    return;
   82|      0|  }
   83|       |
   84|  4.88k|  Delete(ssl->s3);
   85|  4.88k|  ssl->s3 = NULL;
   86|  4.88k|}

_ZN4bssl14SSLAEADContextC2EPK13ssl_cipher_st:
   31|  9.77k|    : cipher_(cipher_arg),
   32|  9.77k|      variable_nonce_included_in_record_(false),
   33|  9.77k|      random_variable_nonce_(false),
   34|  9.77k|      xor_fixed_nonce_(false),
   35|  9.77k|      omit_length_in_ad_(false),
   36|  9.77k|      ad_is_header_(false) {}
_ZN4bssl14SSLAEADContextD2Ev:
   38|  9.77k|SSLAEADContext::~SSLAEADContext() {}
_ZN4bssl14SSLAEADContext16CreateNullCipherEv:
   40|  9.77k|UniquePtr<SSLAEADContext> SSLAEADContext::CreateNullCipher() {
   41|  9.77k|  return MakeUnique<SSLAEADContext>(/*cipher=*/nullptr);
   42|  9.77k|}

_ZN4bssl9SSLBuffer5ClearEv:
   39|  9.77k|void SSLBuffer::Clear() {
   40|  9.77k|  if (buf_ != inline_buf_) {
  ------------------
  |  Branch (40:7): [True: 9.77k, False: 0]
  ------------------
   41|  9.77k|    free(buf_);  // Allocated with malloc().
   42|  9.77k|  }
   43|  9.77k|  buf_ = nullptr;
   44|  9.77k|  offset_ = 0;
   45|  9.77k|  size_ = 0;
   46|  9.77k|  cap_ = 0;
   47|  9.77k|}

_ZN4bssl4CERTC2EPKNS_15SSL_X509_METHODE:
   39|  9.77k|    : legacy_credential(MakeUnique<SSL_CREDENTIAL>(SSLCredentialType::kX509)),
   40|  9.77k|      x509_method(x509_method_arg) {}
_ZN4bssl4CERTD2Ev:
   42|  9.77k|CERT::~CERT() { x509_method->cert_free(this); }
_ZN4bssl12ssl_cert_dupEPNS_4CERTE:
   44|  4.88k|UniquePtr<CERT> ssl_cert_dup(CERT *cert) {
   45|  4.88k|  UniquePtr<CERT> ret = MakeUnique<CERT>(cert->x509_method);
   46|  4.88k|  if (!ret) {
  ------------------
  |  Branch (46:7): [True: 0, False: 4.88k]
  ------------------
   47|      0|    return nullptr;
   48|      0|  }
   49|       |
   50|       |  // TODO(crbug.com/boringssl/431): This should just be |CopyFrom|.
   51|  4.88k|  for (const auto &cred : cert->credentials) {
  ------------------
  |  Branch (51:25): [True: 0, False: 4.88k]
  ------------------
   52|      0|    if (!ret->credentials.Push(UpRef(cred))) {
  ------------------
  |  Branch (52:9): [True: 0, False: 0]
  ------------------
   53|      0|      return nullptr;
   54|      0|    }
   55|      0|  }
   56|       |
   57|       |  // |legacy_credential| is mutable, so it must be copied. We cannot simply
   58|       |  // bump the reference count.
   59|  4.88k|  ret->legacy_credential = cert->legacy_credential->Dup();
   60|  4.88k|  if (ret->legacy_credential == nullptr) {
  ------------------
  |  Branch (60:7): [True: 0, False: 4.88k]
  ------------------
   61|      0|    return nullptr;
   62|      0|  }
   63|       |
   64|  4.88k|  ret->cert_cb = cert->cert_cb;
   65|  4.88k|  ret->cert_cb_arg = cert->cert_cb_arg;
   66|       |
   67|  4.88k|  ret->x509_method->cert_dup(ret.get(), cert);
   68|       |
   69|  4.88k|  ret->sid_ctx = cert->sid_ctx;
   70|  4.88k|  return ret;
   71|  4.88k|}
_ZN4bssl12ssl_set_certEPNS_4CERTENSt3__110unique_ptrI16crypto_buffer_stNS_8internal7DeleterEEE:
  109|  7.09k|bool ssl_set_cert(CERT *cert, UniquePtr<CRYPTO_BUFFER> buffer) {
  110|       |  // Don't fail for a cert/key mismatch, just free the current private key.
  111|       |  // (When switching to a different keypair, the caller should switch the
  112|       |  // certificate, then the key.)
  113|  7.09k|  if (!cert->legacy_credential->SetLeafCert(std::move(buffer),
  ------------------
  |  Branch (113:7): [True: 0, False: 7.09k]
  ------------------
  114|  7.09k|                                            /*discard_key_on_mismatch=*/true)) {
  115|      0|    return false;
  116|      0|  }
  117|       |
  118|  7.09k|  cert->x509_method->cert_flush_cached_leaf(cert);
  119|  7.09k|  return true;
  120|  7.09k|}
_ZN4bssl21ssl_cert_parse_pubkeyEPK6cbs_st:
  262|  7.09k|UniquePtr<EVP_PKEY> ssl_cert_parse_pubkey(const CBS *in) {
  263|  7.09k|  CBS buf = *in, tbs_cert;
  264|  7.09k|  if (!ssl_cert_skip_to_spki(&buf, &tbs_cert)) {
  ------------------
  |  Branch (264:7): [True: 0, False: 7.09k]
  ------------------
  265|      0|    OPENSSL_PUT_ERROR(SSL, SSL_R_CANNOT_PARSE_LEAF_CERT);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  266|      0|    return nullptr;
  267|      0|  }
  268|       |
  269|  7.09k|  return UniquePtr<EVP_PKEY>(EVP_parse_public_key(&tbs_cert));
  270|  7.09k|}
_ZN4bssl34ssl_compare_public_and_private_keyEPK11evp_pkey_stS2_:
  273|  11.8k|                                        const EVP_PKEY *privkey) {
  274|  11.8k|  if (EVP_PKEY_is_opaque(privkey)) {
  ------------------
  |  Branch (274:7): [True: 0, False: 11.8k]
  ------------------
  275|       |    // We cannot check an opaque private key and have to trust that it
  276|       |    // matches.
  277|      0|    return true;
  278|      0|  }
  279|       |
  280|  11.8k|  switch (EVP_PKEY_cmp(pubkey, privkey)) {
  ------------------
  |  Branch (280:11): [True: 0, False: 11.8k]
  ------------------
  281|  11.8k|    case 1:
  ------------------
  |  Branch (281:5): [True: 11.8k, False: 0]
  ------------------
  282|  11.8k|      return true;
  283|      0|    case 0:
  ------------------
  |  Branch (283:5): [True: 0, False: 11.8k]
  ------------------
  284|      0|      OPENSSL_PUT_ERROR(X509, X509_R_KEY_VALUES_MISMATCH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  285|      0|      return false;
  286|      0|    case -1:
  ------------------
  |  Branch (286:5): [True: 0, False: 11.8k]
  ------------------
  287|      0|      OPENSSL_PUT_ERROR(X509, X509_R_KEY_TYPE_MISMATCH);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  288|      0|      return false;
  289|      0|    case -2:
  ------------------
  |  Branch (289:5): [True: 0, False: 11.8k]
  ------------------
  290|      0|      OPENSSL_PUT_ERROR(X509, X509_R_UNKNOWN_KEY_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  291|      0|      return false;
  292|  11.8k|  }
  293|       |
  294|      0|  assert(0);
  295|      0|  return false;
  296|      0|}
SSL_CTX_set_signed_cert_timestamp_list:
  596|  2.77k|                                           size_t list_len) {
  597|  2.77k|  UniquePtr<CRYPTO_BUFFER> buf(CRYPTO_BUFFER_new(list, list_len, nullptr));
  598|  2.77k|  return buf != nullptr && SSL_CREDENTIAL_set1_signed_cert_timestamp_list(
  ------------------
  |  Branch (598:10): [True: 2.77k, False: 0]
  |  Branch (598:28): [True: 499, False: 2.27k]
  ------------------
  599|  2.77k|                               ctx->cert->legacy_credential.get(), buf.get());
  600|  2.77k|}
SSL_CTX_set_ocsp_response:
  614|  20.1k|                              size_t response_len) {
  615|  20.1k|  UniquePtr<CRYPTO_BUFFER> buf(
  616|  20.1k|      CRYPTO_BUFFER_new(response, response_len, nullptr));
  617|  20.1k|  return buf != nullptr && SSL_CREDENTIAL_set1_ocsp_response(
  ------------------
  |  Branch (617:10): [True: 20.1k, False: 0]
  |  Branch (617:28): [True: 20.1k, False: 0]
  ------------------
  618|  20.1k|                               ctx->cert->legacy_credential.get(), buf.get());
  619|  20.1k|}
ssl_cert.cc:_ZN4bsslL21ssl_cert_skip_to_spkiEPK6cbs_stPS0_:
  187|  7.09k|static bool ssl_cert_skip_to_spki(const CBS *in, CBS *out_tbs_cert) {
  188|       |  /* From RFC 5280, section 4.1
  189|       |   *    Certificate  ::=  SEQUENCE  {
  190|       |   *      tbsCertificate       TBSCertificate,
  191|       |   *      signatureAlgorithm   AlgorithmIdentifier,
  192|       |   *      signatureValue       BIT STRING  }
  193|       |
  194|       |   * TBSCertificate  ::=  SEQUENCE  {
  195|       |   *      version         [0]  EXPLICIT Version DEFAULT v1,
  196|       |   *      serialNumber         CertificateSerialNumber,
  197|       |   *      signature            AlgorithmIdentifier,
  198|       |   *      issuer               Name,
  199|       |   *      validity             Validity,
  200|       |   *      subject              Name,
  201|       |   *      subjectPublicKeyInfo SubjectPublicKeyInfo,
  202|       |   *      ... } */
  203|  7.09k|  CBS buf = *in;
  204|       |
  205|  7.09k|  CBS toplevel;
  206|  7.09k|  if (!CBS_get_asn1(&buf, &toplevel, CBS_ASN1_SEQUENCE) ||          //
  ------------------
  |  |  223|  7.09k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (206:7): [True: 0, False: 7.09k]
  ------------------
  207|  7.09k|      CBS_len(&buf) != 0 ||                                         //
  ------------------
  |  Branch (207:7): [True: 0, False: 7.09k]
  ------------------
  208|  7.09k|      !CBS_get_asn1(&toplevel, out_tbs_cert, CBS_ASN1_SEQUENCE) ||  //
  ------------------
  |  |  223|  7.09k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (208:7): [True: 0, False: 7.09k]
  ------------------
  209|       |      // version
  210|  7.09k|      !CBS_get_optional_asn1(
  ------------------
  |  Branch (210:7): [True: 0, False: 7.09k]
  ------------------
  211|  7.09k|          out_tbs_cert, NULL, NULL,
  212|  7.09k|          CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC | 0) ||  //
  ------------------
  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  ------------------
  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
                        CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC | 0) ||  //
  ------------------
  |  |  203|  7.09k|#define CBS_ASN1_CONTEXT_SPECIFIC (0x80u << CBS_ASN1_TAG_SHIFT)
  |  |  ------------------
  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  ------------------
  ------------------
  213|       |
  214|       |      // serialNumber
  215|  7.09k|      !CBS_get_asn1(out_tbs_cert, NULL, CBS_ASN1_INTEGER) ||
  ------------------
  |  |  216|  7.09k|#define CBS_ASN1_INTEGER 0x2u
  ------------------
  |  Branch (215:7): [True: 0, False: 7.09k]
  ------------------
  216|       |      // signature algorithm
  217|  7.09k|      !CBS_get_asn1(out_tbs_cert, NULL, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  7.09k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (217:7): [True: 0, False: 7.09k]
  ------------------
  218|       |      // issuer
  219|  7.09k|      !CBS_get_asn1(out_tbs_cert, NULL, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  7.09k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (219:7): [True: 0, False: 7.09k]
  ------------------
  220|       |      // validity
  221|  7.09k|      !CBS_get_asn1(out_tbs_cert, NULL, CBS_ASN1_SEQUENCE) ||
  ------------------
  |  |  223|  7.09k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (221:7): [True: 0, False: 7.09k]
  ------------------
  222|       |      // subject
  223|  7.09k|      !CBS_get_asn1(out_tbs_cert, NULL, CBS_ASN1_SEQUENCE)) {
  ------------------
  |  |  223|  7.09k|#define CBS_ASN1_SEQUENCE (0x10u | CBS_ASN1_CONSTRUCTED)
  |  |  ------------------
  |  |  |  |  197|  7.09k|#define CBS_ASN1_CONSTRUCTED (0x20u << CBS_ASN1_TAG_SHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  7.09k|#define CBS_ASN1_TAG_SHIFT 24
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (223:7): [True: 0, False: 7.09k]
  ------------------
  224|      0|    return false;
  225|      0|  }
  226|       |
  227|  7.09k|  return true;
  228|  7.09k|}

_ZN4bssl23SSLCipherPreferenceListD2Ev:
  596|  17.5k|SSLCipherPreferenceList::~SSLCipherPreferenceList() {
  597|  17.5k|  OPENSSL_free(in_group_flags);
  598|  17.5k|}
_ZN4bssl23SSLCipherPreferenceList4InitENSt3__110unique_ptrI19stack_st_SSL_CIPHERNS_8internal7DeleterEEENS_4SpanIKbEE:
  601|  17.5k|                                   Span<const bool> in_group_flags_arg) {
  602|  17.5k|  if (sk_SSL_CIPHER_num(ciphers_arg.get()) != in_group_flags_arg.size()) {
  ------------------
  |  Branch (602:7): [True: 0, False: 17.5k]
  ------------------
  603|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  604|      0|    return false;
  605|      0|  }
  606|       |
  607|  17.5k|  Array<bool> copy;
  608|  17.5k|  if (!copy.CopyFrom(in_group_flags_arg)) {
  ------------------
  |  Branch (608:7): [True: 0, False: 17.5k]
  ------------------
  609|      0|    return false;
  610|      0|  }
  611|  17.5k|  ciphers = std::move(ciphers_arg);
  612|  17.5k|  size_t unused_len;
  613|  17.5k|  copy.Release(&in_group_flags, &unused_len);
  614|  17.5k|  return true;
  615|  17.5k|}
_ZN4bssl24ssl_cipher_is_deprecatedEPK13ssl_cipher_st:
  642|   247k|bool ssl_cipher_is_deprecated(const SSL_CIPHER *cipher) {
  643|   247k|  return cipher->id == TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA256 ||
  ------------------
  |  |  291|   494k|#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0x0300C027
  ------------------
  |  Branch (643:10): [True: 10.5k, False: 236k]
  ------------------
  644|   247k|         cipher->algorithm_enc == SSL_3DES;
  ------------------
  |  |  276|   236k|#define SSL_3DES 0x00000001u
  ------------------
  |  Branch (644:10): [True: 12.5k, False: 224k]
  ------------------
  645|   247k|}
_ZN4bssl22ssl_create_cipher_listEPNSt3__110unique_ptrINS_23SSLCipherPreferenceListENS_8internal7DeleterEEEbPKcb:
 1002|  30.9k|                            bool strict) {
 1003|       |  // Return with error if nothing to do.
 1004|  30.9k|  if (rule_str == NULL || out_cipher_list == NULL) {
  ------------------
  |  Branch (1004:7): [True: 0, False: 30.9k]
  |  Branch (1004:27): [True: 0, False: 30.9k]
  ------------------
 1005|      0|    return false;
 1006|      0|  }
 1007|       |
 1008|       |  // We prefer ECDHE ciphers over non-PFS ciphers. Then we prefer AEAD over
 1009|       |  // non-AEAD. The constants are masked by 0xffff to remove the vestigial 0x03
 1010|       |  // byte from SSL 2.0.
 1011|  30.9k|  static const uint16_t kAESCiphers[] = {
 1012|  30.9k|      TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 & 0xffff,
  ------------------
  |  |  322|  30.9k|#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B
  ------------------
 1013|  30.9k|      TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 & 0xffff,
  ------------------
  |  |  326|  30.9k|#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F
  ------------------
 1014|  30.9k|      TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 & 0xffff,
  ------------------
  |  |  323|  30.9k|#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C
  ------------------
 1015|  30.9k|      TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 & 0xffff,
  ------------------
  |  |  327|  30.9k|#define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030
  ------------------
 1016|  30.9k|  };
 1017|  30.9k|  static const uint16_t kChaChaCiphers[] = {
 1018|  30.9k|      TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 & 0xffff,
  ------------------
  |  |  333|  30.9k|#define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 0x0300CCA9
  ------------------
 1019|  30.9k|      TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 & 0xffff,
  ------------------
  |  |  332|  30.9k|#define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0x0300CCA8
  ------------------
 1020|  30.9k|      TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 & 0xffff,
  ------------------
  |  |  334|  30.9k|#define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0x0300CCAC
  ------------------
 1021|  30.9k|  };
 1022|  30.9k|  static const uint16_t kLegacyCiphers[] = {
 1023|  30.9k|      TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA & 0xffff,
  ------------------
  |  |  276|  30.9k|#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009
  ------------------
 1024|  30.9k|      TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA & 0xffff,
  ------------------
  |  |  288|  30.9k|#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013
  ------------------
 1025|  30.9k|      TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA & 0xffff,
  ------------------
  |  |  179|  30.9k|#define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035
  ------------------
 1026|  30.9k|      TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA & 0xffff,
  ------------------
  |  |  277|  30.9k|#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A
  ------------------
 1027|  30.9k|      TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA & 0xffff,
  ------------------
  |  |  289|  30.9k|#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014
  ------------------
 1028|  30.9k|      TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA & 0xffff,
  ------------------
  |  |  180|  30.9k|#define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036
  ------------------
 1029|  30.9k|      TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA256 & 0xffff,
  ------------------
  |  |  291|  30.9k|#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0x0300C027
  ------------------
 1030|  30.9k|      TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 & 0xffff,
  ------------------
  |  |  253|  30.9k|#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C
  ------------------
 1031|  30.9k|      TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 & 0xffff,
  ------------------
  |  |  254|  30.9k|#define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D
  ------------------
 1032|  30.9k|      TLS1_CK_RSA_WITH_AES_128_SHA & 0xffff,
  ------------------
  |  |  197|  30.9k|#define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F
  ------------------
 1033|  30.9k|      TLS1_CK_PSK_WITH_AES_128_CBC_SHA & 0xffff,
  ------------------
  |  |  175|  30.9k|#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C
  ------------------
 1034|  30.9k|      TLS1_CK_RSA_WITH_AES_256_SHA & 0xffff,
  ------------------
  |  |  204|  30.9k|#define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035
  ------------------
 1035|  30.9k|      TLS1_CK_PSK_WITH_AES_256_CBC_SHA & 0xffff,
  ------------------
  |  |  176|  30.9k|#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D
  ------------------
 1036|  30.9k|      SSL3_CK_RSA_DES_192_CBC3_SHA & 0xffff,
  ------------------
  |  |   45|  30.9k|#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A
  ------------------
 1037|  30.9k|  };
 1038|       |
 1039|       |  // Set up a linked list of ciphers.
 1040|  30.9k|  CIPHER_ORDER co_list[OPENSSL_ARRAY_SIZE(kAESCiphers) +
 1041|  30.9k|                       OPENSSL_ARRAY_SIZE(kChaChaCiphers) +
 1042|  30.9k|                       OPENSSL_ARRAY_SIZE(kLegacyCiphers)];
 1043|   681k|  for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(co_list); i++) {
  ------------------
  |  |  103|   681k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  |  Branch (1043:22): [True: 650k, False: 30.9k]
  ------------------
 1044|   650k|    co_list[i].next =
 1045|   650k|        i + 1 < OPENSSL_ARRAY_SIZE(co_list) ? &co_list[i + 1] : nullptr;
  ------------------
  |  |  103|   650k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  |  Branch (1045:9): [True: 619k, False: 30.9k]
  ------------------
 1046|   650k|    co_list[i].prev = i == 0 ? nullptr : &co_list[i - 1];
  ------------------
  |  Branch (1046:23): [True: 30.9k, False: 619k]
  ------------------
 1047|   650k|    co_list[i].active = false;
 1048|   650k|    co_list[i].in_group = false;
 1049|   650k|  }
 1050|  30.9k|  CIPHER_ORDER *head = &co_list[0];
 1051|  30.9k|  CIPHER_ORDER *tail = &co_list[OPENSSL_ARRAY_SIZE(co_list) - 1];
  ------------------
  |  |  103|  30.9k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
 1052|       |
 1053|       |  // Order AES ciphers vs ChaCha ciphers based on whether we have AES hardware.
 1054|       |  //
 1055|       |  // TODO(crbug.com/boringssl/29): We should also set up equipreference groups
 1056|       |  // as a server.
 1057|  30.9k|  size_t num = 0;
 1058|  30.9k|  if (has_aes_hw) {
  ------------------
  |  Branch (1058:7): [True: 30.9k, False: 0]
  ------------------
 1059|   123k|    for (uint16_t id : kAESCiphers) {
  ------------------
  |  Branch (1059:22): [True: 123k, False: 30.9k]
  ------------------
 1060|   123k|      co_list[num++].cipher = SSL_get_cipher_by_value(id);
 1061|   123k|      assert(co_list[num - 1].cipher != nullptr);
 1062|   123k|    }
 1063|  30.9k|  }
 1064|  92.9k|  for (uint16_t id : kChaChaCiphers) {
  ------------------
  |  Branch (1064:20): [True: 92.9k, False: 30.9k]
  ------------------
 1065|  92.9k|    co_list[num++].cipher = SSL_get_cipher_by_value(id);
 1066|  92.9k|    assert(co_list[num - 1].cipher != nullptr);
 1067|  92.9k|  }
 1068|  30.9k|  if (!has_aes_hw) {
  ------------------
  |  Branch (1068:7): [True: 0, False: 30.9k]
  ------------------
 1069|      0|    for (uint16_t id : kAESCiphers) {
  ------------------
  |  Branch (1069:22): [True: 0, False: 0]
  ------------------
 1070|      0|      co_list[num++].cipher = SSL_get_cipher_by_value(id);
 1071|      0|      assert(co_list[num - 1].cipher != nullptr);
 1072|      0|    }
 1073|      0|  }
 1074|   433k|  for (uint16_t id : kLegacyCiphers) {
  ------------------
  |  Branch (1074:20): [True: 433k, False: 30.9k]
  ------------------
 1075|   433k|    co_list[num++].cipher = SSL_get_cipher_by_value(id);
 1076|   433k|    assert(co_list[num - 1].cipher != nullptr);
 1077|   433k|  }
 1078|  30.9k|  assert(num == OPENSSL_ARRAY_SIZE(co_list));
 1079|  30.9k|  static_assert(OPENSSL_ARRAY_SIZE(co_list) + NumTLS13Ciphers() ==
 1080|  30.9k|                    OPENSSL_ARRAY_SIZE(kCiphers),
 1081|  30.9k|                "Not all ciphers are included in the cipher order");
 1082|       |
 1083|       |  // If the rule_string begins with DEFAULT, apply the default rule before
 1084|       |  // using the (possibly available) additional rules.
 1085|  30.9k|  const char *rule_p = rule_str;
 1086|  30.9k|  if (strncmp(rule_str, "DEFAULT", 7) == 0) {
  ------------------
  |  Branch (1086:7): [True: 1.79k, False: 29.2k]
  ------------------
 1087|  1.79k|    if (!ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, &head, &tail,
  ------------------
  |  | 1669|  1.79k|#define SSL_DEFAULT_CIPHER_LIST "ALL"
  ------------------
  |  Branch (1087:9): [True: 0, False: 1.79k]
  ------------------
 1088|  1.79k|                                    strict)) {
 1089|      0|      return false;
 1090|      0|    }
 1091|  1.79k|    rule_p += 7;
 1092|  1.79k|    if (*rule_p == ':') {
  ------------------
  |  Branch (1092:9): [True: 476, False: 1.31k]
  ------------------
 1093|    476|      rule_p++;
 1094|    476|    }
 1095|  1.79k|  }
 1096|       |
 1097|  30.9k|  if (*rule_p != '\0' &&
  ------------------
  |  Branch (1097:7): [True: 25.2k, False: 5.74k]
  ------------------
 1098|  30.9k|      !ssl_cipher_process_rulestr(rule_p, &head, &tail, strict)) {
  ------------------
  |  Branch (1098:7): [True: 13.4k, False: 11.8k]
  ------------------
 1099|  13.4k|    return false;
 1100|  13.4k|  }
 1101|       |
 1102|       |  // Allocate new "cipherstack" for the result, return with error
 1103|       |  // if we cannot get one.
 1104|  17.5k|  UniquePtr<STACK_OF(SSL_CIPHER)> cipherstack(sk_SSL_CIPHER_new_null());
 1105|  17.5k|  Array<bool> in_group_flags;
 1106|  17.5k|  if (cipherstack == nullptr ||
  ------------------
  |  Branch (1106:7): [True: 0, False: 17.5k]
  ------------------
 1107|  17.5k|      !in_group_flags.InitForOverwrite(OPENSSL_ARRAY_SIZE(kCiphers))) {
  ------------------
  |  |  103|  17.5k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  |  Branch (1107:7): [True: 0, False: 17.5k]
  ------------------
 1108|      0|    return false;
 1109|      0|  }
 1110|       |
 1111|       |  // The cipher selection for the list is done. The ciphers are added
 1112|       |  // to the resulting precedence to the STACK_OF(SSL_CIPHER).
 1113|  17.5k|  size_t num_in_group_flags = 0;
 1114|   370k|  for (CIPHER_ORDER *curr = head; curr != NULL; curr = curr->next) {
  ------------------
  |  Branch (1114:35): [True: 353k, False: 17.5k]
  ------------------
 1115|   353k|    if (curr->active) {
  ------------------
  |  Branch (1115:9): [True: 159k, False: 193k]
  ------------------
 1116|   159k|      if (!sk_SSL_CIPHER_push(cipherstack.get(), curr->cipher)) {
  ------------------
  |  Branch (1116:11): [True: 0, False: 159k]
  ------------------
 1117|      0|        return false;
 1118|      0|      }
 1119|   159k|      in_group_flags[num_in_group_flags++] = curr->in_group;
 1120|   159k|    }
 1121|   353k|  }
 1122|  17.5k|  in_group_flags.Shrink(num_in_group_flags);
 1123|       |
 1124|  17.5k|  UniquePtr<SSLCipherPreferenceList> pref_list =
 1125|  17.5k|      MakeUnique<SSLCipherPreferenceList>();
 1126|  17.5k|  if (!pref_list || !pref_list->Init(std::move(cipherstack), in_group_flags)) {
  ------------------
  |  Branch (1126:7): [True: 0, False: 17.5k]
  |  Branch (1126:7): [True: 0, False: 17.5k]
  |  Branch (1126:21): [True: 0, False: 17.5k]
  ------------------
 1127|      0|    return false;
 1128|      0|  }
 1129|       |
 1130|  17.5k|  *out_cipher_list = std::move(pref_list);
 1131|       |
 1132|       |  // Configuring an empty cipher list is an error but still updates the
 1133|       |  // output.
 1134|  17.5k|  if (sk_SSL_CIPHER_num((*out_cipher_list)->ciphers.get()) == 0) {
  ------------------
  |  Branch (1134:7): [True: 7.61k, False: 9.94k]
  ------------------
 1135|  7.61k|    OPENSSL_PUT_ERROR(SSL, SSL_R_NO_CIPHER_MATCH);
  ------------------
  |  |  361|  7.61k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1136|  7.61k|    return false;
 1137|  7.61k|  }
 1138|       |
 1139|  9.94k|  return true;
 1140|  17.5k|}
SSL_get_cipher_by_value:
 1219|   650k|const SSL_CIPHER *SSL_get_cipher_by_value(uint16_t value) {
 1220|   650k|  SSL_CIPHER c;
 1221|       |
 1222|   650k|  c.id = 0x03000000L | value;
 1223|   650k|  return reinterpret_cast<const SSL_CIPHER *>(
 1224|   650k|      bsearch(&c, kCiphers, OPENSSL_ARRAY_SIZE(kCiphers), sizeof(SSL_CIPHER),
  ------------------
  |  |  103|   650k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
 1225|   650k|              ssl_cipher_id_cmp_void));
 1226|   650k|}
SSL_CIPHER_get_min_version:
 1329|  41.0k|uint16_t SSL_CIPHER_get_min_version(const SSL_CIPHER *cipher) {
 1330|  41.0k|  if (cipher->algorithm_mkey == SSL_kGENERIC ||
  ------------------
  |  |  263|  82.1k|#define SSL_kGENERIC 0x00000008u
  ------------------
  |  Branch (1330:7): [True: 0, False: 41.0k]
  ------------------
 1331|  41.0k|      cipher->algorithm_auth == SSL_aGENERIC) {
  ------------------
  |  |  271|  41.0k|#define SSL_aGENERIC 0x00000010u
  ------------------
  |  Branch (1331:7): [True: 0, False: 41.0k]
  ------------------
 1332|      0|    return TLS1_3_VERSION;
  ------------------
  |  |  545|      0|#define TLS1_3_VERSION 0x0304
  ------------------
 1333|      0|  }
 1334|       |
 1335|  41.0k|  if (cipher->algorithm_prf != SSL_HANDSHAKE_MAC_DEFAULT) {
  ------------------
  |  |  292|  41.0k|#define SSL_HANDSHAKE_MAC_DEFAULT 0x1
  ------------------
  |  Branch (1335:7): [True: 22.5k, False: 18.5k]
  ------------------
 1336|       |    // Cipher suites before TLS 1.2 use the default PRF, while all those added
 1337|       |    // afterwards specify a particular hash.
 1338|  22.5k|    return TLS1_2_VERSION;
  ------------------
  |  |  544|  22.5k|#define TLS1_2_VERSION 0x0303
  ------------------
 1339|  22.5k|  }
 1340|  18.5k|  return SSL3_VERSION;
  ------------------
  |  |  541|  18.5k|#define SSL3_VERSION 0x0300
  ------------------
 1341|  41.0k|}
SSL_CIPHER_get_bits:
 1402|   349k|int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *out_alg_bits) {
 1403|   349k|  if (cipher == NULL) {
  ------------------
  |  Branch (1403:7): [True: 0, False: 349k]
  ------------------
 1404|      0|    return 0;
 1405|      0|  }
 1406|       |
 1407|   349k|  int alg_bits, strength_bits;
 1408|   349k|  switch (cipher->algorithm_enc) {
 1409|  89.4k|    case SSL_AES128:
  ------------------
  |  |  277|  89.4k|#define SSL_AES128 0x00000002u
  ------------------
  |  Branch (1409:5): [True: 89.4k, False: 259k]
  ------------------
 1410|   137k|    case SSL_AES128GCM:
  ------------------
  |  |  279|   137k|#define SSL_AES128GCM 0x00000008u
  ------------------
  |  Branch (1410:5): [True: 47.9k, False: 301k]
  ------------------
 1411|   137k|      alg_bits = 128;
 1412|   137k|      strength_bits = 128;
 1413|   137k|      break;
 1414|       |
 1415|  92.1k|    case SSL_AES256:
  ------------------
  |  |  278|  92.1k|#define SSL_AES256 0x00000004u
  ------------------
  |  Branch (1415:5): [True: 92.1k, False: 256k]
  ------------------
 1416|   149k|    case SSL_AES256GCM:
  ------------------
  |  |  280|   149k|#define SSL_AES256GCM 0x00000010u
  ------------------
  |  Branch (1416:5): [True: 57.3k, False: 291k]
  ------------------
 1417|   198k|    case SSL_CHACHA20POLY1305:
  ------------------
  |  |  281|   198k|#define SSL_CHACHA20POLY1305 0x00000020u
  ------------------
  |  Branch (1417:5): [True: 48.6k, False: 300k]
  ------------------
 1418|   198k|      alg_bits = 256;
 1419|   198k|      strength_bits = 256;
 1420|   198k|      break;
 1421|       |
 1422|  13.4k|    case SSL_3DES:
  ------------------
  |  |  276|  13.4k|#define SSL_3DES 0x00000001u
  ------------------
  |  Branch (1422:5): [True: 13.4k, False: 335k]
  ------------------
 1423|  13.4k|      alg_bits = 168;
 1424|  13.4k|      strength_bits = 112;
 1425|  13.4k|      break;
 1426|       |
 1427|      0|    default:
  ------------------
  |  Branch (1427:5): [True: 0, False: 349k]
  ------------------
 1428|      0|      assert(0);
 1429|      0|      alg_bits = 0;
 1430|      0|      strength_bits = 0;
 1431|   349k|  }
 1432|       |
 1433|   349k|  if (out_alg_bits != NULL) {
  ------------------
  |  Branch (1433:7): [True: 0, False: 349k]
  ------------------
 1434|      0|    *out_alg_bits = alg_bits;
 1435|      0|  }
 1436|   349k|  return strength_bits;
 1437|   349k|}
ssl_cipher.cc:_ZN4bsslL26ssl_cipher_process_rulestrEPKcPPNS_15cipher_order_stES4_b:
  819|  27.0k|                                       CIPHER_ORDER **tail_p, bool strict) {
  820|  27.0k|  const char *l, *buf;
  821|  27.0k|  bool in_group = false, has_group = false;
  822|  27.0k|  size_t j, buf_len;
  823|  27.0k|  char ch;
  824|       |
  825|  27.0k|  l = rule_str;
  826|  88.1k|  for (;;) {
  827|  88.1k|    ch = *l;
  828|       |
  829|  88.1k|    if (ch == '\0') {
  ------------------
  |  Branch (829:9): [True: 14.2k, False: 73.8k]
  ------------------
  830|  14.2k|      break;  // done
  831|  14.2k|    }
  832|       |
  833|  73.8k|    int rule;
  834|  73.8k|    if (in_group) {
  ------------------
  |  Branch (834:9): [True: 3.90k, False: 69.9k]
  ------------------
  835|  3.90k|      if (ch == ']') {
  ------------------
  |  Branch (835:11): [True: 1.79k, False: 2.11k]
  ------------------
  836|  1.79k|        if (*tail_p) {
  ------------------
  |  Branch (836:13): [True: 1.60k, False: 194]
  ------------------
  837|  1.60k|          (*tail_p)->in_group = false;
  838|  1.60k|        }
  839|  1.79k|        in_group = false;
  840|  1.79k|        l++;
  841|  1.79k|        continue;
  842|  1.79k|      }
  843|       |
  844|  2.11k|      if (ch == '|') {
  ------------------
  |  Branch (844:11): [True: 816, False: 1.29k]
  ------------------
  845|    816|        rule = CIPHER_ADD;
  ------------------
  |  |  354|    816|#define CIPHER_ADD 1
  ------------------
  846|    816|        l++;
  847|    816|        continue;
  848|  1.29k|      } else if (!OPENSSL_isalnum(ch)) {
  ------------------
  |  Branch (848:18): [True: 220, False: 1.07k]
  ------------------
  849|    220|        OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_OPERATOR_IN_GROUP);
  ------------------
  |  |  361|    220|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  850|    220|        return false;
  851|  1.07k|      } else {
  852|  1.07k|        rule = CIPHER_ADD;
  ------------------
  |  |  354|  1.07k|#define CIPHER_ADD 1
  ------------------
  853|  1.07k|      }
  854|  69.9k|    } else if (ch == '-') {
  ------------------
  |  Branch (854:16): [True: 1.23k, False: 68.7k]
  ------------------
  855|  1.23k|      rule = CIPHER_DEL;
  ------------------
  |  |  356|  1.23k|#define CIPHER_DEL 3
  ------------------
  856|  1.23k|      l++;
  857|  68.7k|    } else if (ch == '+') {
  ------------------
  |  Branch (857:16): [True: 1.90k, False: 66.8k]
  ------------------
  858|  1.90k|      rule = CIPHER_ORD;
  ------------------
  |  |  357|  1.90k|#define CIPHER_ORD 4
  ------------------
  859|  1.90k|      l++;
  860|  66.8k|    } else if (ch == '!') {
  ------------------
  |  Branch (860:16): [True: 3.24k, False: 63.5k]
  ------------------
  861|  3.24k|      rule = CIPHER_KILL;
  ------------------
  |  |  355|  3.24k|#define CIPHER_KILL 2
  ------------------
  862|  3.24k|      l++;
  863|  63.5k|    } else if (ch == '@') {
  ------------------
  |  Branch (863:16): [True: 11.7k, False: 51.8k]
  ------------------
  864|  11.7k|      rule = CIPHER_SPECIAL;
  ------------------
  |  |  358|  11.7k|#define CIPHER_SPECIAL 5
  ------------------
  865|  11.7k|      l++;
  866|  51.8k|    } else if (ch == '[') {
  ------------------
  |  Branch (866:16): [True: 2.69k, False: 49.1k]
  ------------------
  867|  2.69k|      assert(!in_group);
  868|  2.69k|      in_group = true;
  869|  2.69k|      has_group = true;
  870|  2.69k|      l++;
  871|  2.69k|      continue;
  872|  49.1k|    } else {
  873|  49.1k|      rule = CIPHER_ADD;
  ------------------
  |  |  354|  49.1k|#define CIPHER_ADD 1
  ------------------
  874|  49.1k|    }
  875|       |
  876|       |    // If preference groups are enabled, the only legal operator is +.
  877|       |    // Otherwise the in_group bits will get mixed up.
  878|  68.3k|    if (has_group && rule != CIPHER_ADD) {
  ------------------
  |  |  354|  1.65k|#define CIPHER_ADD 1
  ------------------
  |  Branch (878:9): [True: 1.65k, False: 66.6k]
  |  Branch (878:22): [True: 199, False: 1.45k]
  ------------------
  879|    199|      OPENSSL_PUT_ERROR(SSL, SSL_R_MIXED_SPECIAL_OPERATOR_WITH_GROUPS);
  ------------------
  |  |  361|    199|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  880|    199|      return false;
  881|    199|    }
  882|       |
  883|  68.1k|    if (is_cipher_list_separator(ch, strict)) {
  ------------------
  |  Branch (883:9): [True: 15.9k, False: 52.1k]
  ------------------
  884|  15.9k|      l++;
  885|  15.9k|      continue;
  886|  15.9k|    }
  887|       |
  888|  52.1k|    bool multi = false;
  889|  52.1k|    uint32_t cipher_id = 0;
  890|  52.1k|    CIPHER_ALIAS alias;
  891|  52.1k|    bool skip_rule = false;
  892|       |
  893|       |    // When adding, exclude deprecated ciphers by default.
  894|  52.1k|    alias.include_deprecated = rule != CIPHER_ADD;
  ------------------
  |  |  354|  52.1k|#define CIPHER_ADD 1
  ------------------
  895|       |
  896|  54.1k|    for (;;) {
  897|  54.1k|      ch = *l;
  898|  54.1k|      buf = l;
  899|  54.1k|      buf_len = 0;
  900|   267k|      while (OPENSSL_isalnum(ch) || ch == '-' || ch == '.' || ch == '_') {
  ------------------
  |  Branch (900:14): [True: 206k, False: 60.2k]
  |  Branch (900:37): [True: 3.22k, False: 57.0k]
  |  Branch (900:50): [True: 964, False: 56.0k]
  |  Branch (900:63): [True: 1.88k, False: 54.1k]
  ------------------
  901|   213k|        ch = *(++l);
  902|   213k|        buf_len++;
  903|   213k|      }
  904|       |
  905|  54.1k|      if (buf_len == 0) {
  ------------------
  |  Branch (905:11): [True: 8.22k, False: 45.9k]
  ------------------
  906|       |        // We hit something we cannot deal with, it is no command or separator
  907|       |        // nor alphanumeric, so we call this an error.
  908|  8.22k|        OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_COMMAND);
  ------------------
  |  |  361|  8.22k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  909|  8.22k|        return false;
  910|  8.22k|      }
  911|       |
  912|  45.9k|      if (rule == CIPHER_SPECIAL) {
  ------------------
  |  |  358|  45.9k|#define CIPHER_SPECIAL 5
  ------------------
  |  Branch (912:11): [True: 10.1k, False: 35.8k]
  ------------------
  913|  10.1k|        break;
  914|  10.1k|      }
  915|       |
  916|       |      // Look for a matching exact cipher. These aren't allowed in multipart
  917|       |      // rules.
  918|  35.8k|      if (!multi && ch != '+') {
  ------------------
  |  Branch (918:11): [True: 34.0k, False: 1.80k]
  |  Branch (918:21): [True: 32.5k, False: 1.43k]
  ------------------
  919|   804k|        for (j = 0; j < OPENSSL_ARRAY_SIZE(kCiphers); j++) {
  ------------------
  |  |  103|   804k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  |  Branch (919:21): [True: 771k, False: 32.1k]
  ------------------
  920|   771k|          const SSL_CIPHER *cipher = &kCiphers[j];
  921|   771k|          if (rule_equals(cipher->name, buf, buf_len) ||
  ------------------
  |  Branch (921:15): [True: 230, False: 771k]
  ------------------
  922|   771k|              rule_equals(cipher->standard_name, buf, buf_len)) {
  ------------------
  |  Branch (922:15): [True: 221, False: 771k]
  ------------------
  923|    451|            cipher_id = cipher->id;
  924|    451|            break;
  925|    451|          }
  926|   771k|        }
  927|  32.5k|      }
  928|  35.8k|      if (cipher_id == 0) {
  ------------------
  |  Branch (928:11): [True: 35.3k, False: 451]
  ------------------
  929|       |        // If not an exact cipher, look for a matching cipher alias.
  930|   607k|        for (j = 0; j < kCipherAliasesLen; j++) {
  ------------------
  |  Branch (930:21): [True: 594k, False: 12.8k]
  ------------------
  931|   594k|          if (rule_equals(kCipherAliases[j].name, buf, buf_len)) {
  ------------------
  |  Branch (931:15): [True: 22.4k, False: 571k]
  ------------------
  932|  22.4k|            alias.algorithm_mkey &= kCipherAliases[j].algorithm_mkey;
  933|  22.4k|            alias.algorithm_auth &= kCipherAliases[j].algorithm_auth;
  934|  22.4k|            alias.algorithm_enc &= kCipherAliases[j].algorithm_enc;
  935|  22.4k|            alias.algorithm_mac &= kCipherAliases[j].algorithm_mac;
  936|       |
  937|       |            // When specifying a combination of aliases, if any aliases
  938|       |            // enables deprecated ciphers, deprecated ciphers are included. This
  939|       |            // is slightly different from the bitmasks in that adding aliases
  940|       |            // can increase the set of matched ciphers. This is so that an alias
  941|       |            // like "RSA" will only specifiy AES-based RSA ciphers, but
  942|       |            // "RSA+3DES" will still specify 3DES.
  943|  22.4k|            alias.include_deprecated |= kCipherAliases[j].include_deprecated;
  944|       |
  945|  22.4k|            if (alias.min_version != 0 &&
  ------------------
  |  Branch (945:17): [True: 560, False: 21.9k]
  ------------------
  946|  22.4k|                alias.min_version != kCipherAliases[j].min_version) {
  ------------------
  |  Branch (946:17): [True: 365, False: 195]
  ------------------
  947|    365|              skip_rule = true;
  948|  22.0k|            } else {
  949|  22.0k|              alias.min_version = kCipherAliases[j].min_version;
  950|  22.0k|            }
  951|  22.4k|            break;
  952|  22.4k|          }
  953|   594k|        }
  954|  35.3k|        if (j == kCipherAliasesLen) {
  ------------------
  |  Branch (954:13): [True: 12.8k, False: 22.4k]
  ------------------
  955|  12.8k|          skip_rule = true;
  956|  12.8k|          if (strict) {
  ------------------
  |  Branch (956:15): [True: 2.51k, False: 10.3k]
  ------------------
  957|  2.51k|            OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_COMMAND);
  ------------------
  |  |  361|  2.51k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  958|  2.51k|            return false;
  959|  2.51k|          }
  960|  12.8k|        }
  961|  35.3k|      }
  962|       |
  963|       |      // Check for a multipart rule.
  964|  33.2k|      if (ch != '+') {
  ------------------
  |  Branch (964:11): [True: 31.2k, False: 2.00k]
  ------------------
  965|  31.2k|        break;
  966|  31.2k|      }
  967|  2.00k|      l++;
  968|  2.00k|      multi = true;
  969|  2.00k|    }
  970|       |
  971|       |    // Ok, we have the rule, now apply it.
  972|  41.4k|    if (rule == CIPHER_SPECIAL) {
  ------------------
  |  |  358|  41.4k|#define CIPHER_SPECIAL 5
  ------------------
  |  Branch (972:9): [True: 10.1k, False: 31.2k]
  ------------------
  973|  10.1k|      if (buf_len != 8 || strncmp(buf, "STRENGTH", 8) != 0) {
  ------------------
  |  Branch (973:11): [True: 952, False: 9.20k]
  |  Branch (973:27): [True: 673, False: 8.53k]
  ------------------
  974|  1.62k|        OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_COMMAND);
  ------------------
  |  |  361|  1.62k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  975|  1.62k|        return false;
  976|  1.62k|      }
  977|  8.53k|      if (!ssl_cipher_strength_sort(head_p, tail_p)) {
  ------------------
  |  Branch (977:11): [True: 0, False: 8.53k]
  ------------------
  978|      0|        return false;
  979|      0|      }
  980|       |
  981|       |      // We do not support any "multi" options together with "@", so throw away
  982|       |      // the rest of the command, if any left, until end or ':' is found.
  983|  14.9k|      while (*l != '\0' && !is_cipher_list_separator(*l, strict)) {
  ------------------
  |  Branch (983:14): [True: 13.0k, False: 1.84k]
  |  Branch (983:28): [True: 6.41k, False: 6.68k]
  ------------------
  984|  6.41k|        l++;
  985|  6.41k|      }
  986|  31.2k|    } else if (!skip_rule) {
  ------------------
  |  Branch (986:16): [True: 21.6k, False: 9.59k]
  ------------------
  987|  21.6k|      ssl_cipher_apply_rule(cipher_id, &alias, rule, -1, in_group, head_p,
  988|  21.6k|                            tail_p);
  989|  21.6k|    }
  990|  41.4k|  }
  991|       |
  992|  14.2k|  if (in_group) {
  ------------------
  |  Branch (992:7): [True: 651, False: 13.6k]
  ------------------
  993|    651|    OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_COMMAND);
  ------------------
  |  |  361|    651|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  994|    651|    return false;
  995|    651|  }
  996|       |
  997|  13.6k|  return true;
  998|  14.2k|}
ssl_cipher.cc:_ZN4bsslL24is_cipher_list_separatorEcb:
  542|  81.2k|static bool is_cipher_list_separator(char c, bool is_strict) {
  543|  81.2k|  if (c == ':') {
  ------------------
  |  Branch (543:7): [True: 15.3k, False: 65.8k]
  ------------------
  544|  15.3k|    return true;
  545|  15.3k|  }
  546|  65.8k|  return !is_strict && (c == ' ' || c == ';' || c == ',');
  ------------------
  |  Branch (546:10): [True: 52.8k, False: 13.0k]
  |  Branch (546:25): [True: 3.49k, False: 49.3k]
  |  Branch (546:37): [True: 3.39k, False: 45.9k]
  |  Branch (546:49): [True: 412, False: 45.5k]
  ------------------
  547|  81.2k|}
ssl_cipher.cc:_ZN4bsslL11rule_equalsEPKcS1_m:
  551|  2.13M|static bool rule_equals(const char *rule, const char *buf, size_t buf_len) {
  552|       |  // |strncmp| alone only checks that |buf| is a prefix of |rule|.
  553|  2.13M|  return strncmp(rule, buf, buf_len) == 0 && rule[buf_len] == '\0';
  ------------------
  |  Branch (553:10): [True: 61.5k, False: 2.07M]
  |  Branch (553:46): [True: 22.9k, False: 38.6k]
  ------------------
  554|  2.13M|}
ssl_cipher.cc:_ZN4bsslL24ssl_cipher_strength_sortEPPNS_15cipher_order_stES2_:
  778|  8.53k|                                     CIPHER_ORDER **tail_p) {
  779|       |  // This routine sorts the ciphers with descending strength. The sorting must
  780|       |  // keep the pre-sorted sequence, so we apply the normal sorting routine as
  781|       |  // '+' movement to the end of the list.
  782|  8.53k|  int max_strength_bits = 0;
  783|  8.53k|  CIPHER_ORDER *curr = *head_p;
  784|   170k|  while (curr != NULL) {
  ------------------
  |  Branch (784:10): [True: 161k, False: 8.53k]
  ------------------
  785|   161k|    if (curr->active &&
  ------------------
  |  Branch (785:9): [True: 69.8k, False: 92.1k]
  ------------------
  786|   161k|        SSL_CIPHER_get_bits(curr->cipher, NULL) > max_strength_bits) {
  ------------------
  |  Branch (786:9): [True: 8.46k, False: 61.3k]
  ------------------
  787|  8.46k|      max_strength_bits = SSL_CIPHER_get_bits(curr->cipher, NULL);
  788|  8.46k|    }
  789|   161k|    curr = curr->next;
  790|   161k|  }
  791|       |
  792|  8.53k|  Array<int> number_uses;
  793|  8.53k|  if (!number_uses.Init(max_strength_bits + 1)) {
  ------------------
  |  Branch (793:7): [True: 0, False: 8.53k]
  ------------------
  794|      0|    return false;
  795|      0|  }
  796|       |
  797|       |  // Now find the strength_bits values actually used.
  798|  8.53k|  curr = *head_p;
  799|   170k|  while (curr != NULL) {
  ------------------
  |  Branch (799:10): [True: 161k, False: 8.53k]
  ------------------
  800|   161k|    if (curr->active) {
  ------------------
  |  Branch (800:9): [True: 69.8k, False: 92.1k]
  ------------------
  801|  69.8k|      number_uses[SSL_CIPHER_get_bits(curr->cipher, NULL)]++;
  802|  69.8k|    }
  803|   161k|    curr = curr->next;
  804|   161k|  }
  805|       |
  806|       |  // Go through the list of used strength_bits values in descending order.
  807|  1.47M|  for (int i = max_strength_bits; i >= 0; i--) {
  ------------------
  |  Branch (807:35): [True: 1.46M, False: 8.53k]
  ------------------
  808|  1.46M|    if (number_uses[i] > 0) {
  ------------------
  |  Branch (808:9): [True: 10.2k, False: 1.45M]
  ------------------
  809|  10.2k|      ssl_cipher_apply_rule(/*cipher_id=*/0, /*alias=*/nullptr, CIPHER_ORD, i,
  ------------------
  |  |  357|  10.2k|#define CIPHER_ORD 4
  ------------------
  810|  10.2k|                            false, head_p, tail_p);
  811|  10.2k|    }
  812|  1.46M|  }
  813|       |
  814|  8.53k|  return true;
  815|  8.53k|}
ssl_cipher.cc:_ZN4bsslL21ssl_cipher_apply_ruleEjPKNS_15cipher_alias_stEiibPPNS_15cipher_order_stES5_:
  659|  31.9k|                                  CIPHER_ORDER **tail_p) {
  660|  31.9k|  CIPHER_ORDER *head, *tail, *curr, *next, *last;
  661|  31.9k|  const SSL_CIPHER *cp;
  662|  31.9k|  bool reverse = false;
  663|       |
  664|  31.9k|  if (cipher_id == 0 && strength_bits == -1 && alias->min_version == 0 &&
  ------------------
  |  Branch (664:7): [True: 31.4k, False: 451]
  |  Branch (664:25): [True: 21.2k, False: 10.2k]
  |  Branch (664:48): [True: 18.9k, False: 2.26k]
  ------------------
  665|  31.9k|      (alias->algorithm_mkey == 0 || alias->algorithm_auth == 0 ||
  ------------------
  |  Branch (665:8): [True: 213, False: 18.7k]
  |  Branch (665:38): [True: 241, False: 18.5k]
  ------------------
  666|  18.9k|       alias->algorithm_enc == 0 || alias->algorithm_mac == 0)) {
  ------------------
  |  Branch (666:8): [True: 198, False: 18.3k]
  |  Branch (666:37): [True: 0, False: 18.3k]
  ------------------
  667|       |    // The rule matches nothing, so bail early.
  668|    652|    return;
  669|    652|  }
  670|       |
  671|  31.2k|  if (rule == CIPHER_DEL) {
  ------------------
  |  |  356|  31.2k|#define CIPHER_DEL 3
  ------------------
  |  Branch (671:7): [True: 1.00k, False: 30.2k]
  ------------------
  672|       |    // needed to maintain sorting between currently deleted ciphers
  673|  1.00k|    reverse = true;
  674|  1.00k|  }
  675|       |
  676|  31.2k|  head = *head_p;
  677|  31.2k|  tail = *tail_p;
  678|       |
  679|  31.2k|  if (reverse) {
  ------------------
  |  Branch (679:7): [True: 1.00k, False: 30.2k]
  ------------------
  680|  1.00k|    next = tail;
  681|  1.00k|    last = head;
  682|  30.2k|  } else {
  683|  30.2k|    next = head;
  684|  30.2k|    last = tail;
  685|  30.2k|  }
  686|       |
  687|  31.2k|  curr = NULL;
  688|   637k|  for (;;) {
  689|   637k|    if (curr == last) {
  ------------------
  |  Branch (689:9): [True: 31.2k, False: 606k]
  ------------------
  690|  31.2k|      break;
  691|  31.2k|    }
  692|       |
  693|   606k|    curr = next;
  694|   606k|    if (curr == NULL) {
  ------------------
  |  Branch (694:9): [True: 0, False: 606k]
  ------------------
  695|      0|      break;
  696|      0|    }
  697|       |
  698|   606k|    next = reverse ? curr->prev : curr->next;
  ------------------
  |  Branch (698:12): [True: 8.82k, False: 597k]
  ------------------
  699|   606k|    cp = curr->cipher;
  700|       |
  701|       |    // Selection criteria is either a specific cipher, the value of
  702|       |    // |strength_bits|, or the algorithms used.
  703|   606k|    if (cipher_id != 0) {
  ------------------
  |  Branch (703:9): [True: 9.38k, False: 596k]
  ------------------
  704|  9.38k|      if (cipher_id != cp->id) {
  ------------------
  |  Branch (704:11): [True: 8.94k, False: 443]
  ------------------
  705|  8.94k|        continue;
  706|  8.94k|      }
  707|   596k|    } else if (strength_bits >= 0) {
  ------------------
  |  Branch (707:16): [True: 200k, False: 395k]
  ------------------
  708|   200k|      if (strength_bits != SSL_CIPHER_get_bits(cp, NULL)) {
  ------------------
  |  Branch (708:11): [True: 107k, False: 93.1k]
  ------------------
  709|   107k|        continue;
  710|   107k|      }
  711|   395k|    } else {
  712|   395k|      if (!(alias->algorithm_mkey & cp->algorithm_mkey) ||
  ------------------
  |  Branch (712:11): [True: 16.4k, False: 379k]
  ------------------
  713|   395k|          !(alias->algorithm_auth & cp->algorithm_auth) ||
  ------------------
  |  Branch (713:11): [True: 4.40k, False: 374k]
  ------------------
  714|   395k|          !(alias->algorithm_enc & cp->algorithm_enc) ||
  ------------------
  |  Branch (714:11): [True: 41.2k, False: 333k]
  ------------------
  715|   395k|          !(alias->algorithm_mac & cp->algorithm_mac) ||
  ------------------
  |  Branch (715:11): [True: 7.41k, False: 326k]
  ------------------
  716|   395k|          (alias->min_version != 0 &&
  ------------------
  |  Branch (716:12): [True: 41.0k, False: 285k]
  ------------------
  717|   326k|           SSL_CIPHER_get_min_version(cp) != alias->min_version) ||
  ------------------
  |  Branch (717:12): [True: 22.5k, False: 18.5k]
  ------------------
  718|   395k|          (!alias->include_deprecated && ssl_cipher_is_deprecated(cp))) {
  ------------------
  |  Branch (718:12): [True: 247k, False: 56.4k]
  |  Branch (718:42): [True: 23.0k, False: 224k]
  ------------------
  719|   115k|        continue;
  720|   115k|      }
  721|   395k|    }
  722|       |
  723|       |    // add the cipher if it has not been added yet.
  724|   374k|    if (rule == CIPHER_ADD) {
  ------------------
  |  |  354|   374k|#define CIPHER_ADD 1
  ------------------
  |  Branch (724:9): [True: 225k, False: 148k]
  ------------------
  725|       |      // reverse == false
  726|   225k|      if (!curr->active) {
  ------------------
  |  Branch (726:11): [True: 205k, False: 20.1k]
  ------------------
  727|   205k|        ll_append_tail(&head, curr, &tail);
  728|   205k|        curr->active = true;
  729|   205k|        curr->in_group = in_group;
  730|   205k|      }
  731|   225k|    }
  732|       |
  733|       |    // Move the added cipher to this location
  734|   148k|    else if (rule == CIPHER_ORD) {
  ------------------
  |  |  357|   148k|#define CIPHER_ORD 4
  ------------------
  |  Branch (734:14): [True: 113k, False: 34.6k]
  ------------------
  735|       |      // reverse == false
  736|   113k|      if (curr->active) {
  ------------------
  |  Branch (736:11): [True: 82.4k, False: 31.2k]
  ------------------
  737|  82.4k|        ll_append_tail(&head, curr, &tail);
  738|  82.4k|        curr->in_group = false;
  739|  82.4k|      }
  740|   113k|    } else if (rule == CIPHER_DEL) {
  ------------------
  |  |  356|  34.6k|#define CIPHER_DEL 3
  ------------------
  |  Branch (740:16): [True: 5.82k, False: 28.8k]
  ------------------
  741|       |      // reverse == true
  742|  5.82k|      if (curr->active) {
  ------------------
  |  Branch (742:11): [True: 1.45k, False: 4.36k]
  ------------------
  743|       |        // most recently deleted ciphersuites get best positions
  744|       |        // for any future CIPHER_ADD (note that the CIPHER_DEL loop
  745|       |        // works in reverse to maintain the order)
  746|  1.45k|        ll_append_head(&head, curr, &tail);
  747|  1.45k|        curr->active = false;
  748|  1.45k|        curr->in_group = false;
  749|  1.45k|      }
  750|  28.8k|    } else if (rule == CIPHER_KILL) {
  ------------------
  |  |  355|  28.8k|#define CIPHER_KILL 2
  ------------------
  |  Branch (750:16): [True: 28.8k, False: 0]
  ------------------
  751|       |      // reverse == false
  752|  28.8k|      if (head == curr) {
  ------------------
  |  Branch (752:11): [True: 10.6k, False: 18.2k]
  ------------------
  753|  10.6k|        head = curr->next;
  754|  18.2k|      } else {
  755|  18.2k|        curr->prev->next = curr->next;
  756|  18.2k|      }
  757|       |
  758|  28.8k|      if (tail == curr) {
  ------------------
  |  Branch (758:11): [True: 1.18k, False: 27.6k]
  ------------------
  759|  1.18k|        tail = curr->prev;
  760|  1.18k|      }
  761|  28.8k|      curr->active = false;
  762|  28.8k|      if (curr->next != NULL) {
  ------------------
  |  Branch (762:11): [True: 27.6k, False: 1.18k]
  ------------------
  763|  27.6k|        curr->next->prev = curr->prev;
  764|  27.6k|      }
  765|  28.8k|      if (curr->prev != NULL) {
  ------------------
  |  Branch (765:11): [True: 18.2k, False: 10.6k]
  ------------------
  766|  18.2k|        curr->prev->next = curr->next;
  767|  18.2k|      }
  768|  28.8k|      curr->next = NULL;
  769|  28.8k|      curr->prev = NULL;
  770|  28.8k|    }
  771|   374k|  }
  772|       |
  773|  31.2k|  *head_p = head;
  774|  31.2k|  *tail_p = tail;
  775|  31.2k|}
ssl_cipher.cc:_ZN4bsslL14ll_append_tailEPPNS_15cipher_order_stES1_S2_:
  557|   288k|                           CIPHER_ORDER **tail) {
  558|   288k|  if (curr == *tail) {
  ------------------
  |  Branch (558:7): [True: 2.86k, False: 285k]
  ------------------
  559|  2.86k|    return;
  560|  2.86k|  }
  561|   285k|  if (curr == *head) {
  ------------------
  |  Branch (561:7): [True: 127k, False: 157k]
  ------------------
  562|   127k|    *head = curr->next;
  563|   127k|  }
  564|   285k|  if (curr->prev != NULL) {
  ------------------
  |  Branch (564:7): [True: 157k, False: 127k]
  ------------------
  565|   157k|    curr->prev->next = curr->next;
  566|   157k|  }
  567|   285k|  if (curr->next != NULL) {
  ------------------
  |  Branch (567:7): [True: 285k, False: 0]
  ------------------
  568|   285k|    curr->next->prev = curr->prev;
  569|   285k|  }
  570|   285k|  (*tail)->next = curr;
  571|   285k|  curr->prev = *tail;
  572|   285k|  curr->next = NULL;
  573|   285k|  *tail = curr;
  574|   285k|}
ssl_cipher.cc:_ZN4bsslL14ll_append_headEPPNS_15cipher_order_stES1_S2_:
  577|  1.45k|                           CIPHER_ORDER **tail) {
  578|  1.45k|  if (curr == *head) {
  ------------------
  |  Branch (578:7): [True: 718, False: 739]
  ------------------
  579|    718|    return;
  580|    718|  }
  581|    739|  if (curr == *tail) {
  ------------------
  |  Branch (581:7): [True: 329, False: 410]
  ------------------
  582|    329|    *tail = curr->prev;
  583|    329|  }
  584|    739|  if (curr->next != NULL) {
  ------------------
  |  Branch (584:7): [True: 410, False: 329]
  ------------------
  585|    410|    curr->next->prev = curr->prev;
  586|    410|  }
  587|    739|  if (curr->prev != NULL) {
  ------------------
  |  Branch (587:7): [True: 739, False: 0]
  ------------------
  588|    739|    curr->prev->next = curr->next;
  589|    739|  }
  590|    739|  (*head)->prev = curr;
  591|    739|  curr->next = *head;
  592|    739|  curr->prev = NULL;
  593|    739|  *head = curr;
  594|    739|}
ssl_cipher.cc:_ZL22ssl_cipher_id_cmp_voidPKvS0_:
 1201|  2.54M|static int ssl_cipher_id_cmp_void(const void *in_a, const void *in_b) {
 1202|  2.54M|  return ssl_cipher_id_cmp(reinterpret_cast<const SSL_CIPHER *>(in_a),
 1203|  2.54M|                           reinterpret_cast<const SSL_CIPHER *>(in_b));
 1204|  2.54M|}
ssl_cipher.cc:_ZL17ssl_cipher_id_cmpPK13ssl_cipher_stS1_:
 1191|  2.54M|                                       const SSL_CIPHER *b) {
 1192|  2.54M|  if (a->id > b->id) {
  ------------------
  |  Branch (1192:7): [True: 836k, False: 1.70M]
  ------------------
 1193|   836k|    return 1;
 1194|   836k|  }
 1195|  1.70M|  if (a->id < b->id) {
  ------------------
  |  Branch (1195:7): [True: 1.05M, False: 650k]
  ------------------
 1196|  1.05M|    return -1;
 1197|  1.05M|  }
 1198|   650k|  return 0;
 1199|  1.70M|}

_ZN17ssl_credential_stC2EN4bssl17SSLCredentialTypeE:
  111|  14.6k|    : RefCounted(CheckSubClass()), type(type_arg) {
  112|  14.6k|  CRYPTO_new_ex_data(&ex_data);
  113|  14.6k|}
_ZN17ssl_credential_stD2Ev:
  115|  14.6k|ssl_credential_st::~ssl_credential_st() {
  116|  14.6k|  CRYPTO_free_ex_data(&g_ex_data_class, &ex_data);
  117|  14.6k|}
_ZNK17ssl_credential_st3DupEv:
  124|  4.88k|UniquePtr<SSL_CREDENTIAL> ssl_credential_st::Dup() const {
  125|  4.88k|  assert(type == SSLCredentialType::kX509);
  126|  4.88k|  UniquePtr<SSL_CREDENTIAL> ret = MakeUnique<SSL_CREDENTIAL>(type);
  127|  4.88k|  if (ret == nullptr) {
  ------------------
  |  Branch (127:7): [True: 0, False: 4.88k]
  ------------------
  128|      0|    return nullptr;
  129|      0|  }
  130|       |
  131|  4.88k|  ret->pubkey = UpRef(pubkey);
  132|  4.88k|  ret->privkey = UpRef(privkey);
  133|  4.88k|  ret->key_method = key_method;
  134|  4.88k|  if (!ret->sigalgs.CopyFrom(sigalgs)) {
  ------------------
  |  Branch (134:7): [True: 0, False: 4.88k]
  ------------------
  135|      0|    return nullptr;
  136|      0|  }
  137|       |
  138|  4.88k|  if (chain) {
  ------------------
  |  Branch (138:7): [True: 606, False: 4.27k]
  ------------------
  139|    606|    ret->chain.reset(sk_CRYPTO_BUFFER_deep_copy(chain.get(), buffer_up_ref,
  140|    606|                                                CRYPTO_BUFFER_free));
  141|    606|    if (!ret->chain) {
  ------------------
  |  Branch (141:9): [True: 0, False: 606]
  ------------------
  142|      0|      return nullptr;
  143|      0|    }
  144|    606|  }
  145|       |
  146|  4.88k|  ret->dc = UpRef(dc);
  147|  4.88k|  ret->signed_cert_timestamp_list = UpRef(signed_cert_timestamp_list);
  148|  4.88k|  ret->ocsp_response = UpRef(ocsp_response);
  149|  4.88k|  ret->dc_algorithm = dc_algorithm;
  150|  4.88k|  return ret;
  151|  4.88k|}
_ZNK17ssl_credential_st8UsesX509Ev:
  160|  40.0k|bool ssl_credential_st::UsesX509() const {
  161|  40.0k|  switch (type) {
  ------------------
  |  Branch (161:11): [True: 0, False: 40.0k]
  ------------------
  162|  40.0k|    case SSLCredentialType::kX509:
  ------------------
  |  Branch (162:5): [True: 40.0k, False: 0]
  ------------------
  163|  40.0k|    case SSLCredentialType::kDelegated:
  ------------------
  |  Branch (163:5): [True: 0, False: 40.0k]
  ------------------
  164|  40.0k|      return true;
  165|      0|    case SSLCredentialType::kSPAKE2PlusV1Client:
  ------------------
  |  Branch (165:5): [True: 0, False: 40.0k]
  ------------------
  166|      0|    case SSLCredentialType::kSPAKE2PlusV1Server:
  ------------------
  |  Branch (166:5): [True: 0, False: 40.0k]
  ------------------
  167|      0|      return false;
  168|  40.0k|  }
  169|      0|  abort();
  170|  40.0k|}
_ZNK17ssl_credential_st14UsesPrivateKeyEv:
  172|  13.2k|bool ssl_credential_st::UsesPrivateKey() const {
  173|  13.2k|  switch (type) {
  ------------------
  |  Branch (173:11): [True: 0, False: 13.2k]
  ------------------
  174|  13.2k|    case SSLCredentialType::kX509:
  ------------------
  |  Branch (174:5): [True: 13.2k, False: 0]
  ------------------
  175|  13.2k|    case SSLCredentialType::kDelegated:
  ------------------
  |  Branch (175:5): [True: 0, False: 13.2k]
  ------------------
  176|  13.2k|      return true;
  177|      0|    case SSLCredentialType::kSPAKE2PlusV1Client:
  ------------------
  |  Branch (177:5): [True: 0, False: 13.2k]
  ------------------
  178|      0|    case SSLCredentialType::kSPAKE2PlusV1Server:
  ------------------
  |  Branch (178:5): [True: 0, False: 13.2k]
  ------------------
  179|      0|      return false;
  180|  13.2k|  }
  181|      0|  abort();
  182|  13.2k|}
_ZN17ssl_credential_st11SetLeafCertENSt3__110unique_ptrI16crypto_buffer_stN4bssl8internal7DeleterEEEb:
  206|  7.09k|                                    bool discard_key_on_mismatch) {
  207|  7.09k|  if (!UsesX509()) {
  ------------------
  |  Branch (207:7): [True: 0, False: 7.09k]
  ------------------
  208|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  209|      0|    return false;
  210|      0|  }
  211|       |
  212|  7.09k|  const bool private_key_matches_leaf = type != SSLCredentialType::kDelegated;
  213|       |
  214|  7.09k|  CBS cbs;
  215|  7.09k|  CRYPTO_BUFFER_init_CBS(leaf.get(), &cbs);
  216|  7.09k|  UniquePtr<EVP_PKEY> new_pubkey = ssl_cert_parse_pubkey(&cbs);
  217|  7.09k|  if (new_pubkey == nullptr) {
  ------------------
  |  Branch (217:7): [True: 0, False: 7.09k]
  ------------------
  218|      0|    return false;
  219|      0|  }
  220|       |
  221|  7.09k|  if (!ssl_is_key_type_supported(EVP_PKEY_id(new_pubkey.get()))) {
  ------------------
  |  Branch (221:7): [True: 0, False: 7.09k]
  ------------------
  222|      0|    OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  223|      0|    return false;
  224|      0|  }
  225|       |
  226|       |  // An ECC certificate may be usable for ECDH or ECDSA. We only support ECDSA
  227|       |  // certificates, so sanity-check the key usage extension.
  228|  7.09k|  if (EVP_PKEY_id(new_pubkey.get()) == EVP_PKEY_EC &&
  ------------------
  |  |  136|  7.09k|#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  | 1844|  14.1k|#define NID_X9_62_id_ecPublicKey 408
  |  |  ------------------
  ------------------
  |  Branch (228:7): [True: 0, False: 7.09k]
  ------------------
  229|  7.09k|      !ssl_cert_check_key_usage(&cbs, key_usage_digital_signature)) {
  ------------------
  |  Branch (229:7): [True: 0, False: 0]
  ------------------
  230|      0|    OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  231|      0|    return false;
  232|      0|  }
  233|       |
  234|  7.09k|  if (private_key_matches_leaf && privkey != nullptr &&
  ------------------
  |  Branch (234:7): [True: 7.09k, False: 0]
  |  Branch (234:35): [True: 3.78k, False: 3.30k]
  ------------------
  235|  7.09k|      !ssl_compare_public_and_private_key(new_pubkey.get(), privkey.get())) {
  ------------------
  |  Branch (235:7): [True: 0, False: 3.78k]
  ------------------
  236|      0|    if (!discard_key_on_mismatch) {
  ------------------
  |  Branch (236:9): [True: 0, False: 0]
  ------------------
  237|      0|      return false;
  238|      0|    }
  239|      0|    ERR_clear_error();
  240|      0|    privkey = nullptr;
  241|      0|  }
  242|       |
  243|  7.09k|  if (chain == nullptr) {
  ------------------
  |  Branch (243:7): [True: 173, False: 6.92k]
  ------------------
  244|    173|    chain = new_leafless_chain();
  245|    173|    if (chain == nullptr) {
  ------------------
  |  Branch (245:9): [True: 0, False: 173]
  ------------------
  246|      0|      return false;
  247|      0|    }
  248|    173|  }
  249|       |
  250|  7.09k|  CRYPTO_BUFFER_free(sk_CRYPTO_BUFFER_value(chain.get(), 0));
  251|  7.09k|  sk_CRYPTO_BUFFER_set(chain.get(), 0, leaf.release());
  252|  7.09k|  if (private_key_matches_leaf) {
  ------------------
  |  Branch (252:7): [True: 7.09k, False: 0]
  ------------------
  253|  7.09k|    pubkey = std::move(new_pubkey);
  254|  7.09k|  }
  255|  7.09k|  return true;
  256|  7.09k|}
_ZN17ssl_credential_st22ClearIntermediateCertsEv:
  258|  46.2k|void ssl_credential_st::ClearIntermediateCerts() {
  259|  46.2k|  if (chain == nullptr) {
  ------------------
  |  Branch (259:7): [True: 2.49k, False: 43.7k]
  ------------------
  260|  2.49k|    return;
  261|  2.49k|  }
  262|       |
  263|  49.0k|  while (sk_CRYPTO_BUFFER_num(chain.get()) > 1) {
  ------------------
  |  Branch (263:10): [True: 5.34k, False: 43.7k]
  ------------------
  264|  5.34k|    CRYPTO_BUFFER_free(sk_CRYPTO_BUFFER_pop(chain.get()));
  265|  5.34k|  }
  266|  43.7k|}
_ZN17ssl_credential_st22AppendIntermediateCertENSt3__110unique_ptrI16crypto_buffer_stN4bssl8internal7DeleterEEE:
  314|  10.0k|bool ssl_credential_st::AppendIntermediateCert(UniquePtr<CRYPTO_BUFFER> cert) {
  315|  10.0k|  if (!UsesX509()) {
  ------------------
  |  Branch (315:7): [True: 0, False: 10.0k]
  ------------------
  316|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  317|      0|    return false;
  318|      0|  }
  319|       |
  320|  10.0k|  if (chain == nullptr) {
  ------------------
  |  Branch (320:7): [True: 433, False: 9.60k]
  ------------------
  321|    433|    chain = new_leafless_chain();
  322|    433|    if (chain == nullptr) {
  ------------------
  |  Branch (322:9): [True: 0, False: 433]
  ------------------
  323|      0|      return false;
  324|      0|    }
  325|    433|  }
  326|       |
  327|  10.0k|  return PushToStack(chain.get(), std::move(cert));
  328|  10.0k|}
SSL_CREDENTIAL_free:
  340|  14.6k|void SSL_CREDENTIAL_free(SSL_CREDENTIAL *cred) {
  341|  14.6k|  if (cred != nullptr) {
  ------------------
  |  Branch (341:7): [True: 14.6k, False: 0]
  ------------------
  342|  14.6k|    cred->DecRefInternal();
  343|  14.6k|  }
  344|  14.6k|}
SSL_CREDENTIAL_set1_private_key:
  346|  8.60k|int SSL_CREDENTIAL_set1_private_key(SSL_CREDENTIAL *cred, EVP_PKEY *key) {
  347|  8.60k|  if (!cred->UsesPrivateKey()) {
  ------------------
  |  Branch (347:7): [True: 0, False: 8.60k]
  ------------------
  348|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  349|      0|    return 0;
  350|      0|  }
  351|       |
  352|       |  // If the public half has been configured, check |key| matches. |pubkey| will
  353|       |  // have been extracted from the certificate, delegated credential, etc.
  354|  8.60k|  if (cred->pubkey != nullptr &&
  ------------------
  |  Branch (354:7): [True: 8.03k, False: 573]
  ------------------
  355|  8.60k|      !ssl_compare_public_and_private_key(cred->pubkey.get(), key)) {
  ------------------
  |  Branch (355:7): [True: 0, False: 8.03k]
  ------------------
  356|      0|    return false;
  357|      0|  }
  358|       |
  359|  8.60k|  cred->privkey = UpRef(key);
  360|  8.60k|  cred->key_method = nullptr;
  361|  8.60k|  return 1;
  362|  8.60k|}
SSL_CREDENTIAL_set1_ocsp_response:
  453|  20.1k|                                      CRYPTO_BUFFER *ocsp) {
  454|  20.1k|  if (!cred->UsesX509()) {
  ------------------
  |  Branch (454:7): [True: 0, False: 20.1k]
  ------------------
  455|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  456|      0|    return 0;
  457|      0|  }
  458|       |
  459|  20.1k|  cred->ocsp_response = UpRef(ocsp);
  460|  20.1k|  return 1;
  461|  20.1k|}
SSL_CREDENTIAL_set1_signed_cert_timestamp_list:
  464|  2.77k|                                                   CRYPTO_BUFFER *sct_list) {
  465|  2.77k|  if (!cred->UsesX509()) {
  ------------------
  |  Branch (465:7): [True: 0, False: 2.77k]
  ------------------
  466|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  467|      0|    return 0;
  468|      0|  }
  469|       |
  470|  2.77k|  CBS cbs;
  471|  2.77k|  CRYPTO_BUFFER_init_CBS(sct_list, &cbs);
  472|  2.77k|  if (!ssl_is_sct_list_valid(&cbs)) {
  ------------------
  |  Branch (472:7): [True: 2.27k, False: 499]
  ------------------
  473|  2.27k|    OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SCT_LIST);
  ------------------
  |  |  361|  2.27k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  474|  2.27k|    return 0;
  475|  2.27k|  }
  476|       |
  477|    499|  cred->signed_cert_timestamp_list = UpRef(sct_list);
  478|    499|  return 1;
  479|  2.77k|}
ssl_credential.cc:_ZL13buffer_up_refPK16crypto_buffer_st:
  119|  4.95k|static CRYPTO_BUFFER *buffer_up_ref(const CRYPTO_BUFFER *buffer) {
  120|  4.95k|  CRYPTO_BUFFER_up_ref(const_cast<CRYPTO_BUFFER *>(buffer));
  121|  4.95k|  return const_cast<CRYPTO_BUFFER *>(buffer);
  122|  4.95k|}
ssl_credential.cc:_ZN4bsslL18new_leafless_chainEv:
   29|    606|static UniquePtr<STACK_OF(CRYPTO_BUFFER)> new_leafless_chain(void) {
   30|    606|  UniquePtr<STACK_OF(CRYPTO_BUFFER)> chain(sk_CRYPTO_BUFFER_new_null());
   31|    606|  if (!chain || !sk_CRYPTO_BUFFER_push(chain.get(), nullptr)) {
  ------------------
  |  Branch (31:7): [True: 0, False: 606]
  |  Branch (31:17): [True: 0, False: 606]
  ------------------
   32|      0|    return nullptr;
   33|      0|  }
   34|       |
   35|    606|  return chain;
   36|    606|}

_ZN4bssl19ssl_nid_to_group_idEPti:
  411|  5.41k|bool ssl_nid_to_group_id(uint16_t *out_group_id, int nid) {
  412|  29.5k|  for (const auto &group : kNamedGroups) {
  ------------------
  |  Branch (412:26): [True: 29.5k, False: 4.79k]
  ------------------
  413|  29.5k|    if (group.nid == nid) {
  ------------------
  |  Branch (413:9): [True: 619, False: 28.9k]
  ------------------
  414|    619|      *out_group_id = group.group_id;
  415|    619|      return true;
  416|    619|    }
  417|  29.5k|  }
  418|  4.79k|  return false;
  419|  5.41k|}
_ZN4bssl20ssl_name_to_group_idEPtPKcm:
  422|  6.28k|                          size_t len) {
  423|  33.4k|  for (const auto &group : kNamedGroups) {
  ------------------
  |  Branch (423:26): [True: 33.4k, False: 5.05k]
  ------------------
  424|  33.4k|    if (len == strlen(group.name) &&  //
  ------------------
  |  Branch (424:9): [True: 3.62k, False: 29.8k]
  ------------------
  425|  33.4k|        !strncmp(group.name, name, len)) {
  ------------------
  |  Branch (425:9): [True: 823, False: 2.80k]
  ------------------
  426|    823|      *out_group_id = group.group_id;
  427|    823|      return true;
  428|    823|    }
  429|  32.6k|    if (strlen(group.alias) > 0 && len == strlen(group.alias) &&
  ------------------
  |  Branch (429:9): [True: 22.5k, False: 10.1k]
  |  Branch (429:36): [True: 1.14k, False: 21.4k]
  ------------------
  430|  32.6k|        !strncmp(group.alias, name, len)) {
  ------------------
  |  Branch (430:9): [True: 401, False: 747]
  ------------------
  431|    401|      *out_group_id = group.group_id;
  432|    401|      return true;
  433|    401|    }
  434|  32.6k|  }
  435|  5.05k|  return false;
  436|  6.28k|}
_ZN4bssl19ssl_group_id_to_nidEt:
  438|  2.96k|int ssl_group_id_to_nid(uint16_t group_id) {
  439|  14.3k|  for (const auto &group : kNamedGroups) {
  ------------------
  |  Branch (439:26): [True: 14.3k, False: 2.09k]
  ------------------
  440|  14.3k|    if (group.group_id == group_id) {
  ------------------
  |  Branch (440:9): [True: 868, False: 13.4k]
  ------------------
  441|    868|      return group.nid;
  442|    868|    }
  443|  14.3k|  }
  444|  2.09k|  return NID_undef;
  ------------------
  |  |   43|  2.09k|#define NID_undef 0
  ------------------
  445|  2.96k|}

_ZN10ssl_ctx_stC2EPK13ssl_method_st:
  387|  4.88k|    : RefCounted(CheckSubClass()),
  388|  4.88k|      method(ssl_method->method),
  389|  4.88k|      x509_method(ssl_method->x509_method),
  390|  4.88k|      retain_only_sha256_of_client_certs(false),
  391|  4.88k|      quiet_shutdown(false),
  392|  4.88k|      ocsp_stapling_enabled(false),
  393|  4.88k|      signed_cert_timestamps_enabled(false),
  394|  4.88k|      channel_id_enabled(false),
  395|  4.88k|      grease_enabled(false),
  396|  4.88k|      permute_extensions(false),
  397|  4.88k|      allow_unknown_alpn_protos(false),
  398|  4.88k|      false_start_allowed_without_alpn(false),
  399|  4.88k|      handoff(false),
  400|  4.88k|      enable_early_data(false),
  401|  4.88k|      aes_hw_override(false),
  402|  4.88k|      aes_hw_override_value(false),
  403|  4.88k|      resumption_across_names_enabled(false) {
  404|  4.88k|  CRYPTO_MUTEX_init(&lock);
  405|  4.88k|  CRYPTO_new_ex_data(&ex_data);
  406|  4.88k|}
_ZN10ssl_ctx_stD2Ev:
  408|  4.88k|ssl_ctx_st::~ssl_ctx_st() {
  409|       |  // Free the internal session cache. Note that this calls the caller-supplied
  410|       |  // remove callback, so we must do it before clearing ex_data. (See ticket
  411|       |  // [openssl.org #212].)
  412|  4.88k|  SSL_CTX_flush_sessions(this, 0);
  413|       |
  414|  4.88k|  CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx, &ex_data);
  415|       |
  416|  4.88k|  CRYPTO_MUTEX_cleanup(&lock);
  417|  4.88k|  lh_SSL_SESSION_free(sessions);
  418|  4.88k|  x509_method->ssl_ctx_free(this);
  419|  4.88k|}
SSL_CTX_new:
  421|  4.88k|SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
  422|  4.88k|  if (method == NULL) {
  ------------------
  |  Branch (422:7): [True: 0, False: 4.88k]
  ------------------
  423|      0|    OPENSSL_PUT_ERROR(SSL, SSL_R_NULL_SSL_METHOD_PASSED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  424|      0|    return nullptr;
  425|      0|  }
  426|       |
  427|  4.88k|  UniquePtr<SSL_CTX> ret = MakeUnique<SSL_CTX>(method);
  428|  4.88k|  if (!ret) {
  ------------------
  |  Branch (428:7): [True: 0, False: 4.88k]
  ------------------
  429|      0|    return nullptr;
  430|      0|  }
  431|       |
  432|  4.88k|  ret->cert = MakeUnique<CERT>(method->x509_method);
  433|  4.88k|  ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp);
  434|  4.88k|  ret->client_CA.reset(sk_CRYPTO_BUFFER_new_null());
  435|  4.88k|  ret->CA_names.reset(sk_CRYPTO_BUFFER_new_null());
  436|  4.88k|  if (ret->cert == nullptr ||       //
  ------------------
  |  Branch (436:7): [True: 0, False: 4.88k]
  ------------------
  437|  4.88k|      !ret->cert->is_valid() ||     //
  ------------------
  |  Branch (437:7): [True: 0, False: 4.88k]
  ------------------
  438|  4.88k|      ret->sessions == nullptr ||   //
  ------------------
  |  Branch (438:7): [True: 0, False: 4.88k]
  ------------------
  439|  4.88k|      ret->client_CA == nullptr ||  //
  ------------------
  |  Branch (439:7): [True: 0, False: 4.88k]
  ------------------
  440|  4.88k|      ret->CA_names == nullptr ||   //
  ------------------
  |  Branch (440:7): [True: 0, False: 4.88k]
  ------------------
  441|  4.88k|      !ret->x509_method->ssl_ctx_new(ret.get())) {
  ------------------
  |  Branch (441:7): [True: 0, False: 4.88k]
  ------------------
  442|      0|    return nullptr;
  443|      0|  }
  444|       |
  445|  4.88k|  if (!SSL_CTX_set_strict_cipher_list(ret.get(), SSL_DEFAULT_CIPHER_LIST) ||
  ------------------
  |  | 1669|  4.88k|#define SSL_DEFAULT_CIPHER_LIST "ALL"
  ------------------
  |  Branch (445:7): [True: 0, False: 4.88k]
  ------------------
  446|       |      // Lock the SSL_CTX to the specified version, for compatibility with
  447|       |      // legacy uses of SSL_METHOD.
  448|  4.88k|      !SSL_CTX_set_max_proto_version(ret.get(), method->version) ||
  ------------------
  |  Branch (448:7): [True: 0, False: 4.88k]
  ------------------
  449|  4.88k|      !SSL_CTX_set_min_proto_version(ret.get(), method->version)) {
  ------------------
  |  Branch (449:7): [True: 0, False: 4.88k]
  ------------------
  450|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  451|      0|    return nullptr;
  452|      0|  }
  453|       |
  454|  4.88k|  return ret.release();
  455|  4.88k|}
SSL_CTX_up_ref:
  457|  9.77k|int SSL_CTX_up_ref(SSL_CTX *ctx) {
  458|  9.77k|  ctx->UpRefInternal();
  459|  9.77k|  return 1;
  460|  9.77k|}
SSL_CTX_free:
  462|  14.6k|void SSL_CTX_free(SSL_CTX *ctx) {
  463|  14.6k|  if (ctx != nullptr) {
  ------------------
  |  Branch (463:7): [True: 14.6k, False: 0]
  ------------------
  464|  14.6k|    ctx->DecRefInternal();
  465|  14.6k|  }
  466|  14.6k|}
_ZN6ssl_stC2EP10ssl_ctx_st:
  469|  4.88k|    : method(ctx_arg->method),
  470|  4.88k|      max_send_fragment(ctx_arg->max_send_fragment),
  471|  4.88k|      msg_callback(ctx_arg->msg_callback),
  472|  4.88k|      msg_callback_arg(ctx_arg->msg_callback_arg),
  473|  4.88k|      ctx(UpRef(ctx_arg)),
  474|  4.88k|      session_ctx(UpRef(ctx_arg)),
  475|  4.88k|      options(ctx->options),
  476|  4.88k|      mode(ctx->mode),
  477|  4.88k|      max_cert_list(ctx->max_cert_list),
  478|  4.88k|      server(false),
  479|  4.88k|      quiet_shutdown(ctx->quiet_shutdown),
  480|  4.88k|      enable_early_data(ctx->enable_early_data),
  481|  4.88k|      resumption_across_names_enabled(ctx->resumption_across_names_enabled) {
  482|  4.88k|  CRYPTO_new_ex_data(&ex_data);
  483|  4.88k|}
_ZN6ssl_stD2Ev:
  485|  4.88k|ssl_st::~ssl_st() {
  486|  4.88k|  CRYPTO_free_ex_data(&g_ex_data_class_ssl, &ex_data);
  487|       |  // |config| refers to |this|, so we must release it earlier.
  488|  4.88k|  config.reset();
  489|  4.88k|  if (method != NULL) {
  ------------------
  |  Branch (489:7): [True: 4.88k, False: 0]
  ------------------
  490|  4.88k|    method->ssl_free(this);
  491|  4.88k|  }
  492|  4.88k|}
SSL_new:
  494|  4.88k|SSL *SSL_new(SSL_CTX *ctx) {
  495|  4.88k|  if (ctx == nullptr) {
  ------------------
  |  Branch (495:7): [True: 0, False: 4.88k]
  ------------------
  496|      0|    OPENSSL_PUT_ERROR(SSL, SSL_R_NULL_SSL_CTX);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  497|      0|    return nullptr;
  498|      0|  }
  499|       |
  500|  4.88k|  UniquePtr<SSL> ssl = MakeUnique<SSL>(ctx);
  501|  4.88k|  if (ssl == nullptr) {
  ------------------
  |  Branch (501:7): [True: 0, False: 4.88k]
  ------------------
  502|      0|    return nullptr;
  503|      0|  }
  504|       |
  505|  4.88k|  ssl->config = MakeUnique<SSL_CONFIG>(ssl.get());
  506|  4.88k|  if (ssl->config == nullptr) {
  ------------------
  |  Branch (506:7): [True: 0, False: 4.88k]
  ------------------
  507|      0|    return nullptr;
  508|      0|  }
  509|  4.88k|  ssl->config->conf_min_version = ctx->conf_min_version;
  510|  4.88k|  ssl->config->conf_max_version = ctx->conf_max_version;
  511|       |
  512|  4.88k|  ssl->config->cert = ssl_cert_dup(ctx->cert.get());
  513|  4.88k|  if (ssl->config->cert == nullptr) {
  ------------------
  |  Branch (513:7): [True: 0, False: 4.88k]
  ------------------
  514|      0|    return nullptr;
  515|      0|  }
  516|       |
  517|  4.88k|  ssl->config->verify_mode = ctx->verify_mode;
  518|  4.88k|  ssl->config->verify_callback = ctx->default_verify_callback;
  519|  4.88k|  ssl->config->custom_verify_callback = ctx->custom_verify_callback;
  520|  4.88k|  ssl->config->retain_only_sha256_of_client_certs =
  521|  4.88k|      ctx->retain_only_sha256_of_client_certs;
  522|  4.88k|  ssl->config->permute_extensions = ctx->permute_extensions;
  523|  4.88k|  ssl->config->aes_hw_override = ctx->aes_hw_override;
  524|  4.88k|  ssl->config->aes_hw_override_value = ctx->aes_hw_override_value;
  525|  4.88k|  ssl->config->compliance_policy = ctx->compliance_policy;
  526|       |
  527|  4.88k|  if (!ssl->config->supported_group_list.CopyFrom(ctx->supported_group_list) ||
  ------------------
  |  Branch (527:7): [True: 0, False: 4.88k]
  ------------------
  528|  4.88k|      !ssl->config->alpn_client_proto_list.CopyFrom(
  ------------------
  |  Branch (528:7): [True: 0, False: 4.88k]
  ------------------
  529|  4.88k|          ctx->alpn_client_proto_list) ||
  530|  4.88k|      !ssl->config->verify_sigalgs.CopyFrom(ctx->verify_sigalgs)) {
  ------------------
  |  Branch (530:7): [True: 0, False: 4.88k]
  ------------------
  531|      0|    return nullptr;
  532|      0|  }
  533|       |
  534|  4.88k|  if (ctx->requested_trust_anchors) {
  ------------------
  |  Branch (534:7): [True: 0, False: 4.88k]
  ------------------
  535|      0|    ssl->config->requested_trust_anchors.emplace();
  536|      0|    if (!ssl->config->requested_trust_anchors->CopyFrom(
  ------------------
  |  Branch (536:9): [True: 0, False: 0]
  ------------------
  537|      0|            *ctx->requested_trust_anchors)) {
  538|      0|      return nullptr;
  539|      0|    }
  540|      0|  }
  541|       |
  542|  4.88k|  if (ctx->psk_identity_hint) {
  ------------------
  |  Branch (542:7): [True: 0, False: 4.88k]
  ------------------
  543|      0|    ssl->config->psk_identity_hint.reset(
  544|      0|        OPENSSL_strdup(ctx->psk_identity_hint.get()));
  545|      0|    if (ssl->config->psk_identity_hint == nullptr) {
  ------------------
  |  Branch (545:9): [True: 0, False: 0]
  ------------------
  546|      0|      return nullptr;
  547|      0|    }
  548|      0|  }
  549|  4.88k|  ssl->config->psk_client_callback = ctx->psk_client_callback;
  550|  4.88k|  ssl->config->psk_server_callback = ctx->psk_server_callback;
  551|       |
  552|  4.88k|  ssl->config->channel_id_enabled = ctx->channel_id_enabled;
  553|  4.88k|  ssl->config->channel_id_private = UpRef(ctx->channel_id_private);
  554|       |
  555|  4.88k|  ssl->config->signed_cert_timestamps_enabled =
  556|  4.88k|      ctx->signed_cert_timestamps_enabled;
  557|  4.88k|  ssl->config->ocsp_stapling_enabled = ctx->ocsp_stapling_enabled;
  558|  4.88k|  ssl->config->handoff = ctx->handoff;
  559|  4.88k|  ssl->quic_method = ctx->quic_method;
  560|       |
  561|  4.88k|  if (!ssl->method->ssl_new(ssl.get()) ||
  ------------------
  |  Branch (561:7): [True: 0, False: 4.88k]
  ------------------
  562|  4.88k|      !ssl->ctx->x509_method->ssl_new(ssl->s3->hs.get())) {
  ------------------
  |  Branch (562:7): [True: 0, False: 4.88k]
  ------------------
  563|      0|    return nullptr;
  564|      0|  }
  565|       |
  566|  4.88k|  return ssl.release();
  567|  4.88k|}
_ZN4bssl10SSL_CONFIGC2EP6ssl_st:
  570|  4.88k|    : ssl(ssl_arg),
  571|  4.88k|      ech_grease_enabled(false),
  572|  4.88k|      signed_cert_timestamps_enabled(false),
  573|  4.88k|      ocsp_stapling_enabled(false),
  574|  4.88k|      channel_id_enabled(false),
  575|  4.88k|      enforce_rsa_key_usage(true),
  576|  4.88k|      retain_only_sha256_of_client_certs(false),
  577|  4.88k|      handoff(false),
  578|  4.88k|      shed_handshake_config(false),
  579|  4.88k|      jdk11_workaround(false),
  580|  4.88k|      quic_use_legacy_codepoint(false),
  581|  4.88k|      permute_extensions(false),
  582|  4.88k|      alps_use_new_codepoint(true) {
  583|  4.88k|  assert(ssl);
  584|  4.88k|}
_ZN4bssl10SSL_CONFIGD2Ev:
  586|  4.88k|SSL_CONFIG::~SSL_CONFIG() {
  587|  4.88k|  if (ssl->ctx != nullptr) {
  ------------------
  |  Branch (587:7): [True: 4.88k, False: 0]
  ------------------
  588|  4.88k|    ssl->ctx->x509_method->ssl_config_free(this);
  589|  4.88k|  }
  590|  4.88k|}
SSL_free:
  592|  4.88k|void SSL_free(SSL *ssl) { Delete(ssl); }
SSL_CTX_set_options:
 1320|  2.53k|uint32_t SSL_CTX_set_options(SSL_CTX *ctx, uint32_t options) {
 1321|  2.53k|  ctx->options |= options;
 1322|  2.53k|  return ctx->options;
 1323|  2.53k|}
SSL_CTX_clear_options:
 1325|  2.31k|uint32_t SSL_CTX_clear_options(SSL_CTX *ctx, uint32_t options) {
 1326|  2.31k|  ctx->options &= ~options;
 1327|  2.31k|  return ctx->options;
 1328|  2.31k|}
SSL_CTX_get_options:
 1330|  7.59k|uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) { return ctx->options; }
SSL_CTX_set_mode:
 1344|  3.51k|uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode) {
 1345|  3.51k|  ctx->mode |= mode;
 1346|  3.51k|  return ctx->mode;
 1347|  3.51k|}
SSL_CTX_clear_mode:
 1349|  4.52k|uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode) {
 1350|  4.52k|  ctx->mode &= ~mode;
 1351|  4.52k|  return ctx->mode;
 1352|  4.52k|}
SSL_CTX_get_mode:
 1354|  2.13k|uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return ctx->mode; }
SSL_CTX_set_session_id_context:
 1415|  2.51k|                                   size_t sid_ctx_len) {
 1416|  2.51k|  return set_session_id_context(ctx->cert.get(), sid_ctx, sid_ctx_len);
 1417|  2.51k|}
SSL_CTX_check_private_key:
 1606|  4.63k|int SSL_CTX_check_private_key(const SSL_CTX *ctx) {
 1607|       |  // There is no need to actually check consistency because inconsistent values
 1608|       |  // can never be configured.
 1609|  4.63k|  return has_cert_and_key(ctx->cert->legacy_credential.get());
 1610|  4.63k|}
SSL_CTX_get_max_cert_list:
 1674|  1.54k|size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx) {
 1675|  1.54k|  return ctx->max_cert_list;
 1676|  1.54k|}
SSL_CTX_set_max_cert_list:
 1678|  1.54k|void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, size_t max_cert_list) {
 1679|  1.54k|  if (max_cert_list > kMaxHandshakeSize) {
  ------------------
  |  Branch (1679:7): [True: 1.15k, False: 387]
  ------------------
 1680|  1.15k|    max_cert_list = kMaxHandshakeSize;
 1681|  1.15k|  }
 1682|  1.54k|  ctx->max_cert_list = (uint32_t)max_cert_list;
 1683|  1.54k|}
SSL_CTX_set_max_send_fragment:
 1694|  3.66k|int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment) {
 1695|  3.66k|  if (max_send_fragment < 512) {
  ------------------
  |  Branch (1695:7): [True: 298, False: 3.36k]
  ------------------
 1696|    298|    max_send_fragment = 512;
 1697|    298|  }
 1698|  3.66k|  if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
  ------------------
  |  |  133|  3.66k|#define SSL3_RT_MAX_PLAIN_LENGTH 16384
  ------------------
  |  Branch (1698:7): [True: 3.34k, False: 323]
  ------------------
 1699|  3.34k|    max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
  ------------------
  |  |  133|  3.34k|#define SSL3_RT_MAX_PLAIN_LENGTH 16384
  ------------------
 1700|  3.34k|  }
 1701|  3.66k|  ctx->max_send_fragment = (uint16_t)max_send_fragment;
 1702|       |
 1703|  3.66k|  return 1;
 1704|  3.66k|}
SSL_CTX_sess_number:
 1734|    851|size_t SSL_CTX_sess_number(const SSL_CTX *ctx) {
 1735|    851|  MutexReadLock lock(const_cast<CRYPTO_MUTEX *>(&ctx->lock));
 1736|    851|  return lh_SSL_SESSION_num_items(ctx->sessions);
 1737|    851|}
SSL_CTX_sess_set_cache_size:
 1739|  2.03k|unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, unsigned long size) {
 1740|  2.03k|  unsigned long ret = ctx->session_cache_size;
 1741|  2.03k|  ctx->session_cache_size = size;
 1742|  2.03k|  return ret;
 1743|  2.03k|}
SSL_CTX_sess_get_cache_size:
 1745|  8.46k|unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx) {
 1746|  8.46k|  return ctx->session_cache_size;
 1747|  8.46k|}
SSL_CTX_set_tlsext_ticket_keys:
 1783|  1.32k|int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
 1784|  1.32k|  if (in == NULL) {
  ------------------
  |  Branch (1784:7): [True: 210, False: 1.11k]
  ------------------
 1785|    210|    return 48;
 1786|    210|  }
 1787|  1.11k|  if (len != 48) {
  ------------------
  |  Branch (1787:7): [True: 721, False: 389]
  ------------------
 1788|    721|    OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_TICKET_KEYS_LENGTH);
  ------------------
  |  |  361|    721|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1789|    721|    return 0;
 1790|    721|  }
 1791|    389|  auto key = MakeUnique<TicketKey>();
 1792|    389|  if (!key) {
  ------------------
  |  Branch (1792:7): [True: 0, False: 389]
  ------------------
 1793|      0|    return 0;
 1794|      0|  }
 1795|    389|  const uint8_t *in_bytes = reinterpret_cast<const uint8_t *>(in);
 1796|    389|  OPENSSL_memcpy(key->name, in_bytes, 16);
 1797|    389|  OPENSSL_memcpy(key->hmac_key, in_bytes + 16, 16);
 1798|    389|  OPENSSL_memcpy(key->aes_key, in_bytes + 32, 16);
 1799|       |  // Disable automatic key rotation for manually-configured keys. This is now
 1800|       |  // the caller's responsibility.
 1801|    389|  key->next_rotation_tv_sec = 0;
 1802|    389|  ctx->ticket_key_current = std::move(key);
 1803|    389|  ctx->ticket_key_prev.reset();
 1804|    389|  return 1;
 1805|    389|}
SSL_CTX_set1_group_ids:
 1826|  4.46k|                           size_t num_group_ids) {
 1827|  4.46k|  auto span = Span(group_ids, num_group_ids);
 1828|  4.46k|  return check_group_ids(span) && ctx->supported_group_list.CopyFrom(span);
  ------------------
  |  Branch (1828:10): [True: 2.37k, False: 2.09k]
  |  Branch (1828:35): [True: 2.37k, False: 0]
  ------------------
 1829|  4.46k|}
SSL_CTX_set1_groups:
 1859|  8.02k|int SSL_CTX_set1_groups(SSL_CTX *ctx, const int *groups, size_t num_groups) {
 1860|  8.02k|  return ssl_nids_to_group_ids(&ctx->supported_group_list,
 1861|  8.02k|                               Span(groups, num_groups));
 1862|  8.02k|}
SSL_CTX_set1_groups_list:
 1909|  5.66k|int SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups) {
 1910|  5.66k|  return ssl_str_to_group_ids(&ctx->supported_group_list, groups);
 1911|  5.66k|}
SSL_CTX_set_cipher_list:
 1983|  15.7k|int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
 1984|  15.7k|  const bool has_aes_hw = ctx->aes_hw_override ? ctx->aes_hw_override_value
  ------------------
  |  Branch (1984:27): [True: 0, False: 15.7k]
  ------------------
 1985|  15.7k|                                               : EVP_has_aes_hardware();
 1986|  15.7k|  return ssl_create_cipher_list(&ctx->cipher_list, has_aes_hw, str,
 1987|  15.7k|                                false /* not strict */);
 1988|  15.7k|}
SSL_CTX_set_strict_cipher_list:
 1990|  15.2k|int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx, const char *str) {
 1991|  15.2k|  const bool has_aes_hw = ctx->aes_hw_override ? ctx->aes_hw_override_value
  ------------------
  |  Branch (1991:27): [True: 0, False: 15.2k]
  ------------------
 1992|  15.2k|                                               : EVP_has_aes_hardware();
 1993|  15.2k|  return ssl_create_cipher_list(&ctx->cipher_list, has_aes_hw, str,
 1994|  15.2k|                                true /* strict */);
 1995|  15.2k|}
SSL_CTX_enable_signed_cert_timestamps:
 2057|  5.93k|void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx) {
 2058|  5.93k|  ctx->signed_cert_timestamps_enabled = true;
 2059|  5.93k|}
SSL_CTX_enable_ocsp_stapling:
 2068|  3.90k|void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx) {
 2069|  3.90k|  ctx->ocsp_stapling_enabled = true;
 2070|  3.90k|}
SSL_CTX_set_alpn_protos:
 2209|  1.30k|                            size_t protos_len) {
 2210|       |  // Note this function's return value is backwards.
 2211|  1.30k|  auto span = Span(protos, protos_len);
 2212|  1.30k|  if (!span.empty() && !ssl_is_valid_alpn_list(span)) {
  ------------------
  |  Branch (2212:7): [True: 1.10k, False: 202]
  |  Branch (2212:24): [True: 880, False: 222]
  ------------------
 2213|    880|    OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_ALPN_PROTOCOL_LIST);
  ------------------
  |  |  361|    880|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 2214|    880|    return 1;
 2215|    880|  }
 2216|    424|  return ctx->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
  ------------------
  |  Branch (2216:10): [True: 424, False: 0]
  ------------------
 2217|  1.30k|}
SSL_CTX_get0_privatekey:
 2409|  1.24k|EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) {
 2410|  1.24k|  return ctx->cert->legacy_credential->privkey.get();
 2411|  1.24k|}
SSL_CTX_set_quiet_shutdown:
 2428|  93.7k|void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode) {
 2429|  93.7k|  ctx->quiet_shutdown = (mode != 0);
 2430|  93.7k|}
SSL_CTX_get_quiet_shutdown:
 2432|  17.6k|int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) {
 2433|  17.6k|  return ctx->quiet_shutdown;
 2434|  17.6k|}
SSL_is_dtls:
 2756|  14.6k|int SSL_is_dtls(const SSL *ssl) { return ssl->method->is_dtls; }
SSL_CTX_set_retain_only_sha256_of_client_certs:
 2986|  3.78k|void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enabled) {
 2987|  3.78k|  ctx->retain_only_sha256_of_client_certs = !!enabled;
 2988|  3.78k|}
SSL_CTX_set_grease_enabled:
 2990|  1.09k|void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled) {
 2991|  1.09k|  ctx->grease_enabled = !!enabled;
 2992|  1.09k|}
ssl_lib.cc:_ZL22set_session_id_contextPN4bssl4CERTEPKhm:
 1405|  2.51k|                                  size_t sid_ctx_len) {
 1406|  2.51k|  if (!cert->sid_ctx.TryCopyFrom(Span(sid_ctx, sid_ctx_len))) {
  ------------------
  |  Branch (1406:7): [True: 1.36k, False: 1.14k]
  ------------------
 1407|  1.36k|    OPENSSL_PUT_ERROR(SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG);
  ------------------
  |  |  361|  1.36k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1408|  1.36k|    return 0;
 1409|  1.36k|  }
 1410|       |
 1411|  1.14k|  return 1;
 1412|  2.51k|}
ssl_lib.cc:_ZL16has_cert_and_keyPK17ssl_credential_st:
 1590|  4.63k|static bool has_cert_and_key(const SSL_CREDENTIAL *cred) {
 1591|       |  // TODO(davidben): If |cred->key_method| is set, that should be fine too.
 1592|  4.63k|  if (cred->privkey == nullptr) {
  ------------------
  |  Branch (1592:7): [True: 1.38k, False: 3.25k]
  ------------------
 1593|  1.38k|    OPENSSL_PUT_ERROR(SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED);
  ------------------
  |  |  361|  1.38k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1594|  1.38k|    return false;
 1595|  1.38k|  }
 1596|       |
 1597|  3.25k|  if (cred->chain == nullptr ||
  ------------------
  |  Branch (1597:7): [True: 196, False: 3.05k]
  ------------------
 1598|  3.25k|      sk_CRYPTO_BUFFER_value(cred->chain.get(), 0) == nullptr) {
  ------------------
  |  Branch (1598:7): [True: 209, False: 2.84k]
  ------------------
 1599|    405|    OPENSSL_PUT_ERROR(SSL, SSL_R_NO_CERTIFICATE_ASSIGNED);
  ------------------
  |  |  361|    405|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1600|    405|    return false;
 1601|    405|  }
 1602|       |
 1603|  2.84k|  return true;
 1604|  3.25k|}
ssl_lib.cc:_ZL15check_group_idsN4bssl4SpanIKtEE:
 1815|  4.46k|static bool check_group_ids(Span<const uint16_t> group_ids) {
 1816|  4.46k|  for (uint16_t group_id : group_ids) {
  ------------------
  |  Branch (1816:26): [True: 2.96k, False: 2.37k]
  ------------------
 1817|  2.96k|    if (ssl_group_id_to_nid(group_id) == NID_undef) {
  ------------------
  |  |   43|  2.96k|#define NID_undef 0
  ------------------
  |  Branch (1817:9): [True: 2.09k, False: 868]
  ------------------
 1818|  2.09k|      OPENSSL_PUT_ERROR(SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
  ------------------
  |  |  361|  2.09k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1819|  2.09k|      return false;
 1820|  2.09k|    }
 1821|  2.96k|  }
 1822|  2.37k|  return true;
 1823|  4.46k|}
ssl_lib.cc:_ZL21ssl_nids_to_group_idsPN4bssl5ArrayItEENS_4SpanIKiEE:
 1842|  8.02k|                                  Span<const int> nids) {
 1843|  8.02k|  Array<uint16_t> group_ids;
 1844|  8.02k|  if (!group_ids.InitForOverwrite(nids.size())) {
  ------------------
  |  Branch (1844:7): [True: 0, False: 8.02k]
  ------------------
 1845|      0|    return false;
 1846|      0|  }
 1847|       |
 1848|  8.64k|  for (size_t i = 0; i < nids.size(); i++) {
  ------------------
  |  Branch (1848:22): [True: 5.41k, False: 3.22k]
  ------------------
 1849|  5.41k|    if (!ssl_nid_to_group_id(&group_ids[i], nids[i])) {
  ------------------
  |  Branch (1849:9): [True: 4.79k, False: 619]
  ------------------
 1850|  4.79k|      OPENSSL_PUT_ERROR(SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
  ------------------
  |  |  361|  4.79k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1851|  4.79k|      return false;
 1852|  4.79k|    }
 1853|  5.41k|  }
 1854|       |
 1855|  3.22k|  *out_group_ids = std::move(group_ids);
 1856|  3.22k|  return true;
 1857|  8.02k|}
ssl_lib.cc:_ZL20ssl_str_to_group_idsPN4bssl5ArrayItEEPKc:
 1873|  5.66k|                                 const char *str) {
 1874|       |  // Count the number of groups in the list.
 1875|  5.66k|  size_t count = 0;
 1876|  5.66k|  const char *ptr = str, *col;
 1877|  18.9k|  do {
 1878|  18.9k|    col = strchr(ptr, ':');
 1879|  18.9k|    count++;
 1880|  18.9k|    if (col) {
  ------------------
  |  Branch (1880:9): [True: 13.2k, False: 5.66k]
  ------------------
 1881|  13.2k|      ptr = col + 1;
 1882|  13.2k|    }
 1883|  18.9k|  } while (col);
  ------------------
  |  Branch (1883:12): [True: 13.2k, False: 5.66k]
  ------------------
 1884|       |
 1885|  5.66k|  Array<uint16_t> group_ids;
 1886|  5.66k|  if (!group_ids.InitForOverwrite(count)) {
  ------------------
  |  Branch (1886:7): [True: 0, False: 5.66k]
  ------------------
 1887|      0|    return false;
 1888|      0|  }
 1889|       |
 1890|  5.66k|  size_t i = 0;
 1891|  5.66k|  ptr = str;
 1892|  6.28k|  do {
 1893|  6.28k|    col = strchr(ptr, ':');
 1894|  6.28k|    if (!ssl_name_to_group_id(&group_ids[i++], ptr,
  ------------------
  |  Branch (1894:9): [True: 5.05k, False: 1.22k]
  ------------------
 1895|  6.28k|                              col ? (size_t)(col - ptr) : strlen(ptr))) {
  ------------------
  |  Branch (1895:31): [True: 4.16k, False: 2.12k]
  ------------------
 1896|  5.05k|      OPENSSL_PUT_ERROR(SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE);
  ------------------
  |  |  361|  5.05k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
 1897|  5.05k|      return false;
 1898|  5.05k|    }
 1899|  1.22k|    if (col) {
  ------------------
  |  Branch (1899:9): [True: 618, False: 606]
  ------------------
 1900|    618|      ptr = col + 1;
 1901|    618|    }
 1902|  1.22k|  } while (col);
  ------------------
  |  Branch (1902:12): [True: 618, False: 606]
  ------------------
 1903|       |
 1904|    606|  assert(i == count);
 1905|    606|  *out_group_ids = std::move(group_ids);
 1906|    606|  return true;
 1907|    606|}

_ZN4bssl25ssl_is_key_type_supportedEi:
   35|  7.09k|bool ssl_is_key_type_supported(int key_type) {
   36|  7.09k|  return key_type == EVP_PKEY_RSA || key_type == EVP_PKEY_EC ||
  ------------------
  |  |  133|  7.09k|#define EVP_PKEY_RSA NID_rsaEncryption
  |  |  ------------------
  |  |  |  |   72|  14.1k|#define NID_rsaEncryption 6
  |  |  ------------------
  ------------------
                return key_type == EVP_PKEY_RSA || key_type == EVP_PKEY_EC ||
  ------------------
  |  |  136|      0|#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  | 1844|  7.09k|#define NID_X9_62_id_ecPublicKey 408
  |  |  ------------------
  ------------------
  |  Branch (36:10): [True: 7.09k, False: 0]
  |  Branch (36:38): [True: 0, False: 0]
  ------------------
   37|  7.09k|         key_type == EVP_PKEY_ED25519;
  ------------------
  |  |  137|      0|#define EVP_PKEY_ED25519 NID_ED25519
  |  |  ------------------
  |  |  |  | 4157|      0|#define NID_ED25519 949
  |  |  ------------------
  ------------------
  |  Branch (37:10): [True: 0, False: 0]
  ------------------
   38|  7.09k|}
SSL_CTX_use_PrivateKey:
  404|  8.60k|int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) {
  405|  8.60k|  if (pkey == NULL) {
  ------------------
  |  Branch (405:7): [True: 0, False: 8.60k]
  ------------------
  406|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  407|      0|    return 0;
  408|      0|  }
  409|       |
  410|  8.60k|  return SSL_CREDENTIAL_set1_private_key(ctx->cert->legacy_credential.get(),
  411|  8.60k|                                         pkey);
  412|  8.60k|}
SSL_CREDENTIAL_set1_signing_algorithm_prefs:
  585|  4.66k|                                                size_t num_prefs) {
  586|  4.66k|  if (!cred->UsesPrivateKey()) {
  ------------------
  |  Branch (586:7): [True: 0, False: 4.66k]
  ------------------
  587|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  588|      0|    return 0;
  589|      0|  }
  590|       |
  591|       |  // Delegated credentials are constrained to a single algorithm, so there is no
  592|       |  // need to configure this.
  593|  4.66k|  if (cred->type == SSLCredentialType::kDelegated) {
  ------------------
  |  Branch (593:7): [True: 0, False: 4.66k]
  ------------------
  594|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  595|      0|    return 0;
  596|      0|  }
  597|       |
  598|  4.66k|  return set_sigalg_prefs(&cred->sigalgs, Span(prefs, num_prefs));
  599|  4.66k|}
SSL_CTX_set_signing_algorithm_prefs:
  602|  4.66k|                                        size_t num_prefs) {
  603|  4.66k|  return SSL_CREDENTIAL_set1_signing_algorithm_prefs(
  604|  4.66k|      ctx->cert->legacy_credential.get(), prefs, num_prefs);
  605|  4.66k|}
SSL_CTX_set1_sigalgs:
  669|  2.81k|int SSL_CTX_set1_sigalgs(SSL_CTX *ctx, const int *values, size_t num_values) {
  670|  2.81k|  Array<uint16_t> sigalgs;
  671|  2.81k|  if (!parse_sigalg_pairs(&sigalgs, values, num_values)) {
  ------------------
  |  Branch (671:7): [True: 1.98k, False: 832]
  ------------------
  672|  1.98k|    return 0;
  673|  1.98k|  }
  674|       |
  675|    832|  if (!SSL_CTX_set_signing_algorithm_prefs(ctx, sigalgs.data(),
  ------------------
  |  Branch (675:7): [True: 282, False: 550]
  ------------------
  676|    832|                                           sigalgs.size()) ||
  677|    832|      !SSL_CTX_set_verify_algorithm_prefs(ctx, sigalgs.data(),
  ------------------
  |  Branch (677:7): [True: 0, False: 550]
  ------------------
  678|    550|                                          sigalgs.size())) {
  679|    282|    return 0;
  680|    282|  }
  681|       |
  682|    550|  return 1;
  683|    832|}
SSL_CTX_set1_sigalgs_list:
  857|  9.02k|int SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str) {
  858|  9.02k|  Array<uint16_t> sigalgs;
  859|  9.02k|  if (!parse_sigalgs_list(&sigalgs, str)) {
  ------------------
  |  Branch (859:7): [True: 7.47k, False: 1.54k]
  ------------------
  860|  7.47k|    return 0;
  861|  7.47k|  }
  862|       |
  863|  1.54k|  if (!SSL_CTX_set_signing_algorithm_prefs(ctx, sigalgs.data(),
  ------------------
  |  Branch (863:7): [True: 1.14k, False: 400]
  ------------------
  864|  1.54k|                                           sigalgs.size()) ||
  865|  1.54k|      !SSL_CTX_set_verify_algorithm_prefs(ctx, sigalgs.data(),
  ------------------
  |  Branch (865:7): [True: 0, False: 400]
  ------------------
  866|  1.14k|                                          sigalgs.size())) {
  867|  1.14k|    return 0;
  868|  1.14k|  }
  869|       |
  870|    400|  return 1;
  871|  1.54k|}
SSL_CTX_set_verify_algorithm_prefs:
  893|  2.25k|                                       size_t num_prefs) {
  894|  2.25k|  return set_sigalg_prefs(&ctx->verify_sigalgs, Span(prefs, num_prefs));
  895|  2.25k|}
ssl_privkey.cc:_ZN4bsslL23get_signature_algorithmEt:
  103|  2.96k|static const SSL_SIGNATURE_ALGORITHM *get_signature_algorithm(uint16_t sigalg) {
  104|  27.0k|  for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(kSignatureAlgorithms); i++) {
  ------------------
  |  |  103|  27.0k|#define OPENSSL_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  |  Branch (104:22): [True: 26.1k, False: 920]
  ------------------
  105|  26.1k|    if (kSignatureAlgorithms[i].sigalg == sigalg) {
  ------------------
  |  Branch (105:9): [True: 2.04k, False: 24.1k]
  ------------------
  106|  2.04k|      return &kSignatureAlgorithms[i];
  107|  2.04k|    }
  108|  26.1k|  }
  109|    920|  return NULL;
  110|  2.96k|}
ssl_privkey.cc:_ZL16set_sigalg_prefsPN4bssl5ArrayItEENS_4SpanIKtEE:
  543|  6.92k|static bool set_sigalg_prefs(Array<uint16_t> *out, Span<const uint16_t> prefs) {
  544|  6.92k|  if (!sigalgs_unique(prefs)) {
  ------------------
  |  Branch (544:7): [True: 2.83k, False: 4.09k]
  ------------------
  545|  2.83k|    return false;
  546|  2.83k|  }
  547|       |
  548|       |  // Check for invalid algorithms, and filter out |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
  549|  4.09k|  Array<uint16_t> filtered;
  550|  4.09k|  if (!filtered.InitForOverwrite(prefs.size())) {
  ------------------
  |  Branch (550:7): [True: 0, False: 4.09k]
  ------------------
  551|      0|    return false;
  552|      0|  }
  553|  4.09k|  size_t added = 0;
  554|  4.09k|  for (uint16_t pref : prefs) {
  ------------------
  |  Branch (554:22): [True: 3.22k, False: 3.17k]
  ------------------
  555|  3.22k|    if (pref == SSL_SIGN_RSA_PKCS1_MD5_SHA1) {
  ------------------
  |  | 1151|  3.22k|#define SSL_SIGN_RSA_PKCS1_MD5_SHA1 0xff01
  ------------------
  |  Branch (555:9): [True: 259, False: 2.96k]
  ------------------
  556|       |      // Though not intended to be used with this API, we treat
  557|       |      // |SSL_SIGN_RSA_PKCS1_MD5_SHA1| as a real signature algorithm in
  558|       |      // |SSL_PRIVATE_KEY_METHOD|. Not accepting it here makes for a confusing
  559|       |      // abstraction.
  560|    259|      continue;
  561|    259|    }
  562|  2.96k|    if (get_signature_algorithm(pref) == nullptr) {
  ------------------
  |  Branch (562:9): [True: 920, False: 2.04k]
  ------------------
  563|    920|      OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    920|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  564|    920|      return false;
  565|    920|    }
  566|  2.04k|    filtered[added] = pref;
  567|  2.04k|    added++;
  568|  2.04k|  }
  569|  3.17k|  filtered.Shrink(added);
  570|       |
  571|       |  // This can happen if |prefs| contained only |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
  572|       |  // Leaving it empty would revert to the default, so treat this as an error
  573|       |  // condition.
  574|  3.17k|  if (!prefs.empty() && filtered.empty()) {
  ------------------
  |  Branch (574:7): [True: 1.77k, False: 1.39k]
  |  Branch (574:25): [True: 257, False: 1.51k]
  ------------------
  575|    257|    OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    257|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  576|    257|    return false;
  577|    257|  }
  578|       |
  579|  2.91k|  *out = std::move(filtered);
  580|  2.91k|  return true;
  581|  3.17k|}
ssl_privkey.cc:_ZL14sigalgs_uniqueN4bssl4SpanIKtEE:
  522|  6.92k|static bool sigalgs_unique(Span<const uint16_t> in_sigalgs) {
  523|  6.92k|  if (in_sigalgs.size() < 2) {
  ------------------
  |  Branch (523:7): [True: 3.32k, False: 3.60k]
  ------------------
  524|  3.32k|    return true;
  525|  3.32k|  }
  526|       |
  527|  3.60k|  Array<uint16_t> sigalgs;
  528|  3.60k|  if (!sigalgs.CopyFrom(in_sigalgs)) {
  ------------------
  |  Branch (528:7): [True: 0, False: 3.60k]
  ------------------
  529|      0|    return false;
  530|      0|  }
  531|       |
  532|  3.60k|  std::sort(sigalgs.begin(), sigalgs.end());
  533|  30.0k|  for (size_t i = 1; i < sigalgs.size(); i++) {
  ------------------
  |  Branch (533:22): [True: 29.2k, False: 768]
  ------------------
  534|  29.2k|    if (sigalgs[i - 1] == sigalgs[i]) {
  ------------------
  |  Branch (534:9): [True: 2.83k, False: 26.4k]
  ------------------
  535|  2.83k|      OPENSSL_PUT_ERROR(SSL, SSL_R_DUPLICATE_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|  2.83k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  536|  2.83k|      return false;
  537|  2.83k|    }
  538|  29.2k|  }
  539|       |
  540|    768|  return true;
  541|  3.60k|}
ssl_privkey.cc:_ZL18parse_sigalg_pairsPN4bssl5ArrayItEEPKim:
  636|  2.81k|                               size_t num_values) {
  637|  2.81k|  if ((num_values & 1) == 1) {
  ------------------
  |  Branch (637:7): [True: 597, False: 2.22k]
  ------------------
  638|    597|    return false;
  639|    597|  }
  640|       |
  641|  2.22k|  const size_t num_pairs = num_values / 2;
  642|  2.22k|  if (!out->InitForOverwrite(num_pairs)) {
  ------------------
  |  Branch (642:7): [True: 0, False: 2.22k]
  ------------------
  643|      0|    return false;
  644|      0|  }
  645|       |
  646|  3.21k|  for (size_t i = 0; i < num_values; i += 2) {
  ------------------
  |  Branch (646:22): [True: 2.37k, False: 832]
  ------------------
  647|  2.37k|    const int hash_nid = values[i];
  648|  2.37k|    const int pkey_type = values[i + 1];
  649|       |
  650|  2.37k|    bool found = false;
  651|  26.6k|    for (const auto &candidate : kSignatureAlgorithmsMapping) {
  ------------------
  |  Branch (651:32): [True: 26.6k, False: 1.39k]
  ------------------
  652|  26.6k|      if (candidate.pkey_type == pkey_type && candidate.hash_nid == hash_nid) {
  ------------------
  |  Branch (652:11): [True: 1.87k, False: 24.7k]
  |  Branch (652:47): [True: 989, False: 883]
  ------------------
  653|    989|        (*out)[i / 2] = candidate.signature_algorithm;
  654|    989|        found = true;
  655|    989|        break;
  656|    989|      }
  657|  26.6k|    }
  658|       |
  659|  2.37k|    if (!found) {
  ------------------
  |  Branch (659:9): [True: 1.39k, False: 989]
  ------------------
  660|  1.39k|      OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|  1.39k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  661|  1.39k|      ERR_add_error_dataf("unknown hash:%d pkey:%d", hash_nid, pkey_type);
  662|  1.39k|      return false;
  663|  1.39k|    }
  664|  2.37k|  }
  665|       |
  666|    832|  return true;
  667|  2.22k|}
ssl_privkey.cc:_ZL18parse_sigalgs_listPN4bssl5ArrayItEEPKc:
  704|  9.02k|static bool parse_sigalgs_list(Array<uint16_t> *out, const char *str) {
  705|       |  // str looks like "RSA+SHA1:ECDSA+SHA256:ecdsa_secp256r1_sha256".
  706|       |
  707|       |  // Count colons to give the number of output elements from any successful
  708|       |  // parse.
  709|  9.02k|  size_t num_elements = 1;
  710|  9.02k|  size_t len = 0;
  711|   118k|  for (const char *p = str; *p; p++) {
  ------------------
  |  Branch (711:29): [True: 109k, False: 9.02k]
  ------------------
  712|   109k|    len++;
  713|   109k|    if (*p == ':') {
  ------------------
  |  Branch (713:9): [True: 4.07k, False: 105k]
  ------------------
  714|  4.07k|      num_elements++;
  715|  4.07k|    }
  716|   109k|  }
  717|       |
  718|  9.02k|  if (!out->InitForOverwrite(num_elements)) {
  ------------------
  |  Branch (718:7): [True: 0, False: 9.02k]
  ------------------
  719|      0|    return false;
  720|      0|  }
  721|  9.02k|  size_t out_i = 0;
  722|       |
  723|  9.02k|  enum {
  724|  9.02k|    pkey_or_name,
  725|  9.02k|    hash_name,
  726|  9.02k|  } state = pkey_or_name;
  727|       |
  728|  9.02k|  char buf[kMaxSignatureAlgorithmNameLen];
  729|       |  // buf_used is always < sizeof(buf). I.e. it's always safe to write
  730|       |  // buf[buf_used] = 0.
  731|  9.02k|  size_t buf_used = 0;
  732|       |
  733|  9.02k|  int pkey_type = 0, hash_nid = 0;
  734|       |
  735|       |  // Note that the loop runs to len+1, i.e. it'll process the terminating NUL.
  736|  71.8k|  for (size_t offset = 0; offset < len + 1; offset++) {
  ------------------
  |  Branch (736:27): [True: 70.2k, False: 1.54k]
  ------------------
  737|  70.2k|    const unsigned char c = str[offset];
  738|       |
  739|  70.2k|    switch (c) {
  740|  6.23k|      case '+':
  ------------------
  |  Branch (740:7): [True: 6.23k, False: 64.0k]
  ------------------
  741|  6.23k|        if (state == hash_name) {
  ------------------
  |  Branch (741:13): [True: 480, False: 5.75k]
  ------------------
  742|    480|          OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    480|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  743|    480|          ERR_add_error_dataf("+ found in hash name at offset %zu", offset);
  744|    480|          return false;
  745|    480|        }
  746|  5.75k|        if (buf_used == 0) {
  ------------------
  |  Branch (746:13): [True: 195, False: 5.56k]
  ------------------
  747|    195|          OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    195|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  748|    195|          ERR_add_error_dataf("empty public key type at offset %zu", offset);
  749|    195|          return false;
  750|    195|        }
  751|  5.56k|        buf[buf_used] = 0;
  752|       |
  753|  5.56k|        if (strcmp(buf, "RSA") == 0) {
  ------------------
  |  Branch (753:13): [True: 4.12k, False: 1.43k]
  ------------------
  754|  4.12k|          pkey_type = EVP_PKEY_RSA;
  ------------------
  |  |  133|  4.12k|#define EVP_PKEY_RSA NID_rsaEncryption
  |  |  ------------------
  |  |  |  |   72|  4.12k|#define NID_rsaEncryption 6
  |  |  ------------------
  ------------------
  755|  4.12k|        } else if (strcmp(buf, "RSA-PSS") == 0 ||  //
  ------------------
  |  Branch (755:20): [True: 308, False: 1.13k]
  ------------------
  756|  1.43k|                   strcmp(buf, "PSS") == 0) {
  ------------------
  |  Branch (756:20): [True: 617, False: 513]
  ------------------
  757|    925|          pkey_type = EVP_PKEY_RSA_PSS;
  ------------------
  |  |  134|    925|#define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  | 3997|    925|#define NID_rsassaPss 912
  |  |  ------------------
  ------------------
  758|    925|        } else if (strcmp(buf, "ECDSA") == 0) {
  ------------------
  |  Branch (758:20): [True: 199, False: 314]
  ------------------
  759|    199|          pkey_type = EVP_PKEY_EC;
  ------------------
  |  |  136|    199|#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  | 1844|    199|#define NID_X9_62_id_ecPublicKey 408
  |  |  ------------------
  ------------------
  760|    314|        } else {
  761|    314|          OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    314|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  762|    314|          ERR_add_error_dataf("unknown public key type '%s'", buf);
  763|    314|          return false;
  764|    314|        }
  765|       |
  766|  5.24k|        state = hash_name;
  767|  5.24k|        buf_used = 0;
  768|  5.24k|        break;
  769|       |
  770|  1.85k|      case ':':
  ------------------
  |  Branch (770:7): [True: 1.85k, False: 68.4k]
  ------------------
  771|  1.85k|        [[fallthrough]];
  772|  7.56k|      case 0:
  ------------------
  |  Branch (772:7): [True: 5.70k, False: 64.5k]
  ------------------
  773|  7.56k|        if (buf_used == 0) {
  ------------------
  |  Branch (773:13): [True: 3.01k, False: 4.55k]
  ------------------
  774|  3.01k|          OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|  3.01k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  775|  3.01k|          ERR_add_error_dataf("empty element at offset %zu", offset);
  776|  3.01k|          return false;
  777|  3.01k|        }
  778|       |
  779|  4.55k|        buf[buf_used] = 0;
  780|       |
  781|  4.55k|        if (state == pkey_or_name) {
  ------------------
  |  Branch (781:13): [True: 1.00k, False: 3.55k]
  ------------------
  782|       |          // No '+' was seen thus this is a TLS 1.3-style name.
  783|  1.00k|          bool found = false;
  784|  13.4k|          for (const auto &candidate : kSignatureAlgorithmNames) {
  ------------------
  |  Branch (784:38): [True: 13.4k, False: 755]
  ------------------
  785|  13.4k|            if (strcmp(candidate.name, buf) == 0) {
  ------------------
  |  Branch (785:17): [True: 247, False: 13.2k]
  ------------------
  786|    247|              assert(out_i < num_elements);
  787|    247|              (*out)[out_i++] = candidate.signature_algorithm;
  788|    247|              found = true;
  789|    247|              break;
  790|    247|            }
  791|  13.4k|          }
  792|       |
  793|  1.00k|          if (!found) {
  ------------------
  |  Branch (793:15): [True: 755, False: 247]
  ------------------
  794|    755|            OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    755|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  795|    755|            ERR_add_error_dataf("unknown signature algorithm '%s'", buf);
  796|    755|            return false;
  797|    755|          }
  798|  3.55k|        } else {
  799|  3.55k|          if (strcmp(buf, "SHA1") == 0) {
  ------------------
  |  Branch (799:15): [True: 561, False: 2.99k]
  ------------------
  800|    561|            hash_nid = NID_sha1;
  ------------------
  |  |  330|    561|#define NID_sha1 64
  ------------------
  801|  2.99k|          } else if (strcmp(buf, "SHA256") == 0) {
  ------------------
  |  Branch (801:22): [True: 1.94k, False: 1.04k]
  ------------------
  802|  1.94k|            hash_nid = NID_sha256;
  ------------------
  |  | 2951|  1.94k|#define NID_sha256 672
  ------------------
  803|  1.94k|          } else if (strcmp(buf, "SHA384") == 0) {
  ------------------
  |  Branch (803:22): [True: 201, False: 841]
  ------------------
  804|    201|            hash_nid = NID_sha384;
  ------------------
  |  | 2956|    201|#define NID_sha384 673
  ------------------
  805|    841|          } else if (strcmp(buf, "SHA512") == 0) {
  ------------------
  |  Branch (805:22): [True: 201, False: 640]
  ------------------
  806|    201|            hash_nid = NID_sha512;
  ------------------
  |  | 2961|    201|#define NID_sha512 674
  ------------------
  807|    640|          } else {
  808|    640|            OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    640|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  809|    640|            ERR_add_error_dataf("unknown hash function '%s'", buf);
  810|    640|            return false;
  811|    640|          }
  812|       |
  813|  2.91k|          bool found = false;
  814|  9.95k|          for (const auto &candidate : kSignatureAlgorithmsMapping) {
  ------------------
  |  Branch (814:38): [True: 9.95k, False: 363]
  ------------------
  815|  9.95k|            if (candidate.pkey_type == pkey_type &&
  ------------------
  |  Branch (815:17): [True: 6.57k, False: 3.38k]
  ------------------
  816|  9.95k|                candidate.hash_nid == hash_nid) {
  ------------------
  |  Branch (816:17): [True: 2.54k, False: 4.02k]
  ------------------
  817|  2.54k|              assert(out_i < num_elements);
  818|  2.54k|              (*out)[out_i++] = candidate.signature_algorithm;
  819|  2.54k|              found = true;
  820|  2.54k|              break;
  821|  2.54k|            }
  822|  9.95k|          }
  823|       |
  824|  2.91k|          if (!found) {
  ------------------
  |  Branch (824:15): [True: 363, False: 2.54k]
  ------------------
  825|    363|            OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    363|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  826|    363|            ERR_add_error_dataf("unknown pkey:%d hash:%s", pkey_type, buf);
  827|    363|            return false;
  828|    363|          }
  829|  2.91k|        }
  830|       |
  831|  2.79k|        state = pkey_or_name;
  832|  2.79k|        buf_used = 0;
  833|  2.79k|        break;
  834|       |
  835|  56.4k|      default:
  ------------------
  |  Branch (835:7): [True: 56.4k, False: 13.8k]
  ------------------
  836|  56.4k|        if (buf_used == sizeof(buf) - 1) {
  ------------------
  |  Branch (836:13): [True: 303, False: 56.1k]
  ------------------
  837|    303|          OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|    303|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  838|    303|          ERR_add_error_dataf("substring too long at offset %zu", offset);
  839|    303|          return false;
  840|    303|        }
  841|       |
  842|  56.1k|        if (OPENSSL_isalnum(c) || c == '-' || c == '_') {
  ------------------
  |  Branch (842:13): [True: 52.5k, False: 3.56k]
  |  Branch (842:35): [True: 609, False: 2.95k]
  |  Branch (842:47): [True: 1.54k, False: 1.41k]
  ------------------
  843|  54.7k|          buf[buf_used++] = c;
  844|  54.7k|        } else {
  845|  1.41k|          OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_SIGNATURE_ALGORITHM);
  ------------------
  |  |  361|  1.41k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  846|  1.41k|          ERR_add_error_dataf("invalid character 0x%02x at offest %zu", c,
  847|  1.41k|                              offset);
  848|  1.41k|          return false;
  849|  1.41k|        }
  850|  70.2k|    }
  851|  70.2k|  }
  852|       |
  853|  1.54k|  assert(out_i == out->size());
  854|  1.54k|  return true;
  855|  1.54k|}

SSL_CTX_flush_sessions:
 1158|  8.11k|void SSL_CTX_flush_sessions(SSL_CTX *ctx, uint64_t time) {
 1159|  8.11k|  TIMEOUT_PARAM tp;
 1160|       |
 1161|  8.11k|  tp.ctx = ctx;
 1162|  8.11k|  tp.cache = ctx->sessions;
 1163|  8.11k|  if (tp.cache == NULL) {
  ------------------
  |  Branch (1163:7): [True: 0, False: 8.11k]
  ------------------
 1164|      0|    return;
 1165|      0|  }
 1166|  8.11k|  tp.time = time;
 1167|  8.11k|  MutexWriteLock lock(&ctx->lock);
 1168|  8.11k|  lh_SSL_SESSION_doall_arg(tp.cache, timeout_doall_arg, &tp);
 1169|  8.11k|}

_ZN4bssl13SSLTranscriptC2Eb:
   29|  9.77k|SSLTranscript::SSLTranscript(bool is_dtls) : is_dtls_(is_dtls) {}
_ZN4bssl13SSLTranscriptD2Ev:
   31|  9.77k|SSLTranscript::~SSLTranscript() {}
_ZN4bssl13SSLTranscript4InitEv:
   33|  4.88k|bool SSLTranscript::Init() {
   34|  4.88k|  buffer_.reset(BUF_MEM_new());
   35|  4.88k|  if (!buffer_) {
  ------------------
  |  Branch (35:7): [True: 0, False: 4.88k]
  ------------------
   36|      0|    return false;
   37|      0|  }
   38|       |
   39|  4.88k|  hash_.Reset();
   40|  4.88k|  return true;
   41|  4.88k|}

_ZN4bssl30ssl_protocol_version_from_wireEPtt:
   31|  16.3k|bool ssl_protocol_version_from_wire(uint16_t *out, uint16_t version) {
   32|  16.3k|  switch (version) {
   33|    620|    case TLS1_VERSION:
  ------------------
  |  |  542|    620|#define TLS1_VERSION 0x0301
  ------------------
  |  Branch (33:5): [True: 620, False: 15.7k]
  ------------------
   34|  1.06k|    case TLS1_1_VERSION:
  ------------------
  |  |  543|  1.06k|#define TLS1_1_VERSION 0x0302
  ------------------
  |  Branch (34:5): [True: 447, False: 15.8k]
  ------------------
   35|  1.86k|    case TLS1_2_VERSION:
  ------------------
  |  |  544|  1.86k|#define TLS1_2_VERSION 0x0303
  ------------------
  |  Branch (35:5): [True: 801, False: 15.5k]
  ------------------
   36|  2.29k|    case TLS1_3_VERSION:
  ------------------
  |  |  545|  2.29k|#define TLS1_3_VERSION 0x0304
  ------------------
  |  Branch (36:5): [True: 422, False: 15.9k]
  ------------------
   37|  2.29k|      *out = version;
   38|  2.29k|      return true;
   39|       |
   40|    405|    case DTLS1_VERSION:
  ------------------
  |  |  547|    405|#define DTLS1_VERSION 0xfeff
  ------------------
  |  Branch (40:5): [True: 405, False: 15.9k]
  ------------------
   41|       |      // DTLS 1.0 is analogous to TLS 1.1, not TLS 1.0.
   42|    405|      *out = TLS1_1_VERSION;
  ------------------
  |  |  543|    405|#define TLS1_1_VERSION 0x0302
  ------------------
   43|    405|      return true;
   44|       |
   45|    558|    case DTLS1_2_VERSION:
  ------------------
  |  |  548|    558|#define DTLS1_2_VERSION 0xfefd
  ------------------
  |  Branch (45:5): [True: 558, False: 15.7k]
  ------------------
   46|    558|      *out = TLS1_2_VERSION;
  ------------------
  |  |  544|    558|#define TLS1_2_VERSION 0x0303
  ------------------
   47|    558|      return true;
   48|       |
   49|    439|    case DTLS1_3_VERSION:
  ------------------
  |  |  549|    439|#define DTLS1_3_VERSION 0xfefc
  ------------------
  |  Branch (49:5): [True: 439, False: 15.8k]
  ------------------
   50|    439|      *out = TLS1_3_VERSION;
  ------------------
  |  |  545|    439|#define TLS1_3_VERSION 0x0304
  ------------------
   51|    439|      return true;
   52|       |
   53|  12.6k|    default:
  ------------------
  |  Branch (53:5): [True: 12.6k, False: 3.69k]
  ------------------
   54|  12.6k|      return false;
   55|  16.3k|  }
   56|  16.3k|}
_ZN4bssl27ssl_method_supports_versionEPKNS_19SSL_PROTOCOL_METHODEt:
   81|  3.69k|                                 uint16_t version) {
   82|  11.4k|  for (uint16_t supported : get_method_versions(method)) {
  ------------------
  |  Branch (82:27): [True: 11.4k, False: 1.40k]
  ------------------
   83|  11.4k|    if (supported == version) {
  ------------------
  |  Branch (83:9): [True: 2.29k, False: 9.16k]
  ------------------
   84|  2.29k|      return true;
   85|  2.29k|    }
   86|  11.4k|  }
   87|  1.40k|  return false;
   88|  3.69k|}
SSL_CTX_set_min_proto_version:
  357|  15.5k|int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, uint16_t version) {
  358|  15.5k|  return set_min_version(ctx->method, &ctx->conf_min_version, version);
  359|  15.5k|}
SSL_CTX_set_max_proto_version:
  361|  12.9k|int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, uint16_t version) {
  362|  12.9k|  return set_max_version(ctx->method, &ctx->conf_max_version, version);
  363|  12.9k|}
ssl_versions.cc:_ZN4bsslL19get_method_versionsEPKNS_19SSL_PROTOCOL_METHODE:
   75|  3.69k|    const SSL_PROTOCOL_METHOD *method) {
   76|  3.69k|  return method->is_dtls ? Span<const uint16_t>(kDTLSVersions)
  ------------------
  |  Branch (76:10): [True: 0, False: 3.69k]
  ------------------
   77|  3.69k|                         : Span<const uint16_t>(kTLSVersions);
   78|  3.69k|}
ssl_versions.cc:_ZN4bsslL15set_min_versionEPKNS_19SSL_PROTOCOL_METHODEPtt:
  146|  15.5k|                            uint16_t version) {
  147|       |  // Zero is interpreted as the default minimum version.
  148|  15.5k|  if (version == 0) {
  ------------------
  |  Branch (148:7): [True: 5.22k, False: 10.3k]
  ------------------
  149|  5.22k|    *out = method->is_dtls ? DTLS1_2_VERSION : TLS1_2_VERSION;
  ------------------
  |  |  548|      0|#define DTLS1_2_VERSION 0xfefd
  ------------------
                  *out = method->is_dtls ? DTLS1_2_VERSION : TLS1_2_VERSION;
  ------------------
  |  |  544|  10.4k|#define TLS1_2_VERSION 0x0303
  ------------------
  |  Branch (149:12): [True: 0, False: 5.22k]
  ------------------
  150|  5.22k|    return true;
  151|  5.22k|  }
  152|       |
  153|  10.3k|  return set_version_bound(method, out, version);
  154|  15.5k|}
ssl_versions.cc:_ZN4bsslL17set_version_boundEPKNS_19SSL_PROTOCOL_METHODEPtt:
  134|  16.3k|                              uint16_t version) {
  135|  16.3k|  if (!api_version_to_wire(&version, version) ||
  ------------------
  |  Branch (135:7): [True: 12.6k, False: 3.69k]
  ------------------
  136|  16.3k|      !ssl_method_supports_version(method, version)) {
  ------------------
  |  Branch (136:7): [True: 1.40k, False: 2.29k]
  ------------------
  137|  14.0k|    OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_SSL_VERSION);
  ------------------
  |  |  361|  14.0k|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  138|  14.0k|    return false;
  139|  14.0k|  }
  140|       |
  141|  2.29k|  *out = version;
  142|  2.29k|  return true;
  143|  16.3k|}
ssl_versions.cc:_ZN4bsslL15set_max_versionEPKNS_19SSL_PROTOCOL_METHODEPtt:
  157|  12.9k|                            uint16_t version) {
  158|       |  // Zero is interpreted as the default maximum version.
  159|       |  // TODO(crbug.com/42290594): Enable DTLS 1.3 by default, after it's
  160|       |  // successfully shipped in WebRTC.
  161|  12.9k|  if (version == 0) {
  ------------------
  |  Branch (161:7): [True: 7.02k, False: 5.96k]
  ------------------
  162|  7.02k|    *out = method->is_dtls ? DTLS1_2_VERSION : TLS1_3_VERSION;
  ------------------
  |  |  548|      0|#define DTLS1_2_VERSION 0xfefd
  ------------------
                  *out = method->is_dtls ? DTLS1_2_VERSION : TLS1_3_VERSION;
  ------------------
  |  |  545|  14.0k|#define TLS1_3_VERSION 0x0304
  ------------------
  |  Branch (162:12): [True: 0, False: 7.02k]
  ------------------
  163|  7.02k|    return true;
  164|  7.02k|  }
  165|       |
  166|  5.96k|  return set_version_bound(method, out, version);
  167|  12.9k|}
ssl_versions.cc:_ZN4bsslL19api_version_to_wireEPtt:
  122|  16.3k|static bool api_version_to_wire(uint16_t *out, uint16_t version) {
  123|       |  // Check it is a real protocol version.
  124|  16.3k|  uint16_t unused;
  125|  16.3k|  if (!ssl_protocol_version_from_wire(&unused, version)) {
  ------------------
  |  Branch (125:7): [True: 12.6k, False: 3.69k]
  ------------------
  126|  12.6k|    return false;
  127|  12.6k|  }
  128|       |
  129|  3.69k|  *out = version;
  130|  3.69k|  return true;
  131|  16.3k|}

SSL_CTX_use_certificate:
  588|  7.09k|int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) {
  589|  7.09k|  check_ssl_ctx_x509_method(ctx);
  590|  7.09k|  return ssl_use_certificate(ctx->cert.get(), x);
  591|  7.09k|}
SSL_CTX_get0_certificate:
  630|  5.73k|X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx) {
  631|  5.73k|  check_ssl_ctx_x509_method(ctx);
  632|  5.73k|  MutexWriteLock lock(const_cast<CRYPTO_MUTEX *>(&ctx->lock));
  633|  5.73k|  return ssl_cert_get0_leaf(ctx->cert.get());
  634|  5.73k|}
SSL_CTX_set0_chain:
  659|  44.1k|int SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *chain) {
  660|  44.1k|  check_ssl_ctx_x509_method(ctx);
  661|  44.1k|  if (!ssl_cert_set1_chain(ctx->cert.get(), chain)) {
  ------------------
  |  Branch (661:7): [True: 0, False: 44.1k]
  ------------------
  662|      0|    return 0;
  663|      0|  }
  664|  44.1k|  sk_X509_pop_free(chain, X509_free);
  665|  44.1k|  return 1;
  666|  44.1k|}
SSL_CTX_set1_chain:
  668|  2.09k|int SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *chain) {
  669|  2.09k|  check_ssl_ctx_x509_method(ctx);
  670|  2.09k|  return ssl_cert_set1_chain(ctx->cert.get(), chain);
  671|  2.09k|}
SSL_CTX_add1_chain_cert:
  698|  7.94k|int SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509) {
  699|  7.94k|  check_ssl_ctx_x509_method(ctx);
  700|  7.94k|  return ssl_cert_add1_chain_cert(ctx->cert.get(), x509);
  701|  7.94k|}
SSL_CTX_clear_chain_certs:
  724|  44.1k|int SSL_CTX_clear_chain_certs(SSL_CTX *ctx) {
  725|  44.1k|  check_ssl_ctx_x509_method(ctx);
  726|  44.1k|  return SSL_CTX_set0_chain(ctx, NULL);
  ------------------
  |  | 6082|  44.1k|#define SSL_CTX_set0_chain SSL_CTX_set0_chain
  ------------------
  727|  44.1k|}
SSL_CTX_clear_extra_chain_certs:
  729|  40.1k|int SSL_CTX_clear_extra_chain_certs(SSL_CTX *ctx) {
  730|  40.1k|  check_ssl_ctx_x509_method(ctx);
  731|  40.1k|  return SSL_CTX_clear_chain_certs(ctx);
  ------------------
  |  | 6067|  40.1k|#define SSL_CTX_clear_chain_certs SSL_CTX_clear_chain_certs
  ------------------
  732|  40.1k|}
SSL_CTX_get0_chain_certs:
  768|  9.93k|int SSL_CTX_get0_chain_certs(const SSL_CTX *ctx, STACK_OF(X509) **out_chain) {
  769|  9.93k|  check_ssl_ctx_x509_method(ctx);
  770|  9.93k|  MutexWriteLock lock(const_cast<CRYPTO_MUTEX *>(&ctx->lock));
  771|  9.93k|  if (!ssl_cert_cache_chain_certs(ctx->cert.get())) {
  ------------------
  |  Branch (771:7): [True: 0, False: 9.93k]
  ------------------
  772|      0|    *out_chain = NULL;
  773|      0|    return 0;
  774|      0|  }
  775|       |
  776|  9.93k|  *out_chain = ctx->cert->x509_chain;
  777|  9.93k|  return 1;
  778|  9.93k|}
SSL_CTX_add_client_CA:
 1015|  3.36k|int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x509) {
 1016|  3.36k|  check_ssl_ctx_x509_method(ctx);
 1017|  3.36k|  if (!add_client_CA(&ctx->client_CA, x509, ctx->pool)) {
  ------------------
  |  Branch (1017:7): [True: 0, False: 3.36k]
  ------------------
 1018|      0|    return 0;
 1019|      0|  }
 1020|       |
 1021|  3.36k|  ssl_crypto_x509_ssl_ctx_flush_cached_client_CA(ctx);
 1022|  3.36k|  return 1;
 1023|  3.36k|}
ssl_x509.cc:_ZN4bsslL26ssl_crypto_x509_cert_clearEPNS_4CERTE:
  105|  9.77k|static void ssl_crypto_x509_cert_clear(CERT *cert) {
  106|  9.77k|  ssl_crypto_x509_cert_flush_cached_leaf(cert);
  107|  9.77k|  ssl_crypto_x509_cert_flush_cached_chain(cert);
  108|       |
  109|  9.77k|  X509_free(cert->x509_stash);
  110|  9.77k|  cert->x509_stash = nullptr;
  111|  9.77k|}
ssl_x509.cc:_ZN4bsslL25ssl_crypto_x509_cert_freeEPNS_4CERTE:
  113|  9.77k|static void ssl_crypto_x509_cert_free(CERT *cert) {
  114|  9.77k|  ssl_crypto_x509_cert_clear(cert);
  115|  9.77k|  X509_STORE_free(cert->verify_store);
  116|  9.77k|}
ssl_x509.cc:_ZN4bsslL24ssl_crypto_x509_cert_dupEPNS_4CERTEPKS0_:
  118|  4.88k|static void ssl_crypto_x509_cert_dup(CERT *new_cert, const CERT *cert) {
  119|  4.88k|  if (cert->verify_store != nullptr) {
  ------------------
  |  Branch (119:7): [True: 0, False: 4.88k]
  ------------------
  120|      0|    X509_STORE_up_ref(cert->verify_store);
  121|      0|    new_cert->verify_store = cert->verify_store;
  122|      0|  }
  123|  4.88k|}
ssl_x509.cc:_ZN4bsslL39ssl_crypto_x509_cert_flush_cached_chainEPNS_4CERTE:
   67|  63.9k|static void ssl_crypto_x509_cert_flush_cached_chain(CERT *cert) {
   68|  63.9k|  sk_X509_pop_free(cert->x509_chain, X509_free);
   69|  63.9k|  cert->x509_chain = nullptr;
   70|  63.9k|}
ssl_x509.cc:_ZN4bsslL38ssl_crypto_x509_cert_flush_cached_leafEPNS_4CERTE:
   62|  16.8k|static void ssl_crypto_x509_cert_flush_cached_leaf(CERT *cert) {
   63|  16.8k|  X509_free(cert->x509_leaf);
   64|  16.8k|  cert->x509_leaf = nullptr;
   65|  16.8k|}
ssl_x509.cc:_ZN4bsslL40ssl_crypto_x509_hs_flush_cached_ca_namesEPNS_13SSL_HANDSHAKEE:
  266|  4.88k|static void ssl_crypto_x509_hs_flush_cached_ca_names(SSL_HANDSHAKE *hs) {
  267|  4.88k|  sk_X509_NAME_pop_free(hs->cached_x509_ca_names, X509_NAME_free);
  268|  4.88k|  hs->cached_x509_ca_names = nullptr;
  269|  4.88k|}
ssl_x509.cc:_ZN4bsslL23ssl_crypto_x509_ssl_newEPNS_13SSL_HANDSHAKEE:
  271|  4.88k|static bool ssl_crypto_x509_ssl_new(SSL_HANDSHAKE *hs) {
  272|  4.88k|  hs->config->param = X509_VERIFY_PARAM_new();
  273|  4.88k|  if (hs->config->param == nullptr) {
  ------------------
  |  Branch (273:7): [True: 0, False: 4.88k]
  ------------------
  274|      0|    return false;
  275|      0|  }
  276|  4.88k|  X509_VERIFY_PARAM_inherit(hs->config->param, hs->ssl->ctx->param);
  277|  4.88k|  return true;
  278|  4.88k|}
ssl_x509.cc:_ZN4bsslL31ssl_crypto_x509_ssl_config_freeEPNS_10SSL_CONFIGE:
  285|  4.88k|static void ssl_crypto_x509_ssl_config_free(SSL_CONFIG *cfg) {
  286|  4.88k|  sk_X509_NAME_pop_free(cfg->cached_x509_client_CA, X509_NAME_free);
  287|  4.88k|  cfg->cached_x509_client_CA = nullptr;
  288|  4.88k|  X509_VERIFY_PARAM_free(cfg->param);
  289|  4.88k|}
ssl_x509.cc:_ZN4bsslL27ssl_crypto_x509_ssl_ctx_newEP10ssl_ctx_st:
  334|  4.88k|static bool ssl_crypto_x509_ssl_ctx_new(SSL_CTX *ctx) {
  335|  4.88k|  ctx->cert_store = X509_STORE_new();
  336|  4.88k|  ctx->param = X509_VERIFY_PARAM_new();
  337|  4.88k|  return (ctx->cert_store != nullptr && ctx->param != nullptr);
  ------------------
  |  Branch (337:11): [True: 4.88k, False: 0]
  |  Branch (337:41): [True: 4.88k, False: 0]
  ------------------
  338|  4.88k|}
ssl_x509.cc:_ZN4bsslL28ssl_crypto_x509_ssl_ctx_freeEP10ssl_ctx_st:
  340|  4.88k|static void ssl_crypto_x509_ssl_ctx_free(SSL_CTX *ctx) {
  341|  4.88k|  ssl_crypto_x509_ssl_ctx_flush_cached_client_CA(ctx);
  342|  4.88k|  X509_VERIFY_PARAM_free(ctx->param);
  343|  4.88k|  X509_STORE_free(ctx->cert_store);
  344|  4.88k|}
ssl_x509.cc:_ZN4bsslL46ssl_crypto_x509_ssl_ctx_flush_cached_client_CAEP10ssl_ctx_st:
  329|  8.25k|static void ssl_crypto_x509_ssl_ctx_flush_cached_client_CA(SSL_CTX *ctx) {
  330|  8.25k|  sk_X509_NAME_pop_free(ctx->cached_x509_client_CA, X509_NAME_free);
  331|  8.25k|  ctx->cached_x509_client_CA = nullptr;
  332|  8.25k|}
ssl_x509.cc:_ZN4bsslL25check_ssl_ctx_x509_methodEPK10ssl_ctx_st:
   43|   164k|static void check_ssl_ctx_x509_method(const SSL_CTX *ctx) {
   44|   164k|  assert(ctx == NULL || ctx->x509_method == &ssl_crypto_x509_method);
   45|   164k|}
ssl_x509.cc:_ZL19ssl_use_certificatePN4bssl4CERTEP7x509_st:
  566|  7.09k|static int ssl_use_certificate(CERT *cert, X509 *x) {
  567|  7.09k|  if (x == NULL) {
  ------------------
  |  Branch (567:7): [True: 0, False: 7.09k]
  ------------------
  568|      0|    OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  361|      0|  ERR_put_error(ERR_LIB_##library, 0, reason, __FILE__, __LINE__)
  ------------------
  569|      0|    return 0;
  570|      0|  }
  571|       |
  572|  7.09k|  UniquePtr<CRYPTO_BUFFER> buffer = x509_to_buffer(x);
  573|  7.09k|  if (!buffer) {
  ------------------
  |  Branch (573:7): [True: 0, False: 7.09k]
  ------------------
  574|      0|    return 0;
  575|      0|  }
  576|       |
  577|  7.09k|  return ssl_set_cert(cert, std::move(buffer));
  578|  7.09k|}
ssl_x509.cc:_ZN4bsslL14x509_to_bufferEP7x509_st:
   49|  17.1k|static UniquePtr<CRYPTO_BUFFER> x509_to_buffer(X509 *x509) {
   50|  17.1k|  uint8_t *buf = NULL;
   51|  17.1k|  int cert_len = i2d_X509(x509, &buf);
   52|  17.1k|  if (cert_len <= 0) {
  ------------------
  |  Branch (52:7): [True: 0, False: 17.1k]
  ------------------
   53|      0|    return 0;
   54|      0|  }
   55|       |
   56|  17.1k|  UniquePtr<CRYPTO_BUFFER> buffer(CRYPTO_BUFFER_new(buf, cert_len, NULL));
   57|  17.1k|  OPENSSL_free(buf);
   58|       |
   59|  17.1k|  return buffer;
   60|  17.1k|}
ssl_x509.cc:_ZL18ssl_cert_get0_leafPN4bssl4CERTE:
  612|  5.73k|static X509 *ssl_cert_get0_leaf(CERT *cert) {
  613|  5.73k|  if (cert->x509_leaf == NULL &&  //
  ------------------
  |  Branch (613:7): [True: 2.73k, False: 3.00k]
  ------------------
  614|  5.73k|      !ssl_cert_cache_leaf_cert(cert)) {
  ------------------
  |  Branch (614:7): [True: 0, False: 2.73k]
  ------------------
  615|      0|    return NULL;
  616|      0|  }
  617|       |
  618|  5.73k|  return cert->x509_leaf;
  619|  5.73k|}
ssl_x509.cc:_ZL24ssl_cert_cache_leaf_certPN4bssl4CERTE:
  595|  2.73k|static int ssl_cert_cache_leaf_cert(CERT *cert) {
  596|  2.73k|  assert(cert->x509_method);
  597|       |
  598|  2.73k|  const SSL_CREDENTIAL *cred = cert->legacy_credential.get();
  599|  2.73k|  if (cert->x509_leaf != NULL || cred->chain == NULL) {
  ------------------
  |  Branch (599:7): [True: 0, False: 2.73k]
  |  Branch (599:34): [True: 356, False: 2.37k]
  ------------------
  600|    356|    return 1;
  601|    356|  }
  602|       |
  603|  2.37k|  CRYPTO_BUFFER *leaf = sk_CRYPTO_BUFFER_value(cred->chain.get(), 0);
  604|  2.37k|  if (!leaf) {
  ------------------
  |  Branch (604:7): [True: 378, False: 2.00k]
  ------------------
  605|    378|    return 1;
  606|    378|  }
  607|       |
  608|  2.00k|  cert->x509_leaf = X509_parse_from_buffer(leaf);
  609|  2.00k|  return cert->x509_leaf != NULL;
  610|  2.37k|}
ssl_x509.cc:_ZN4bsslL19ssl_cert_set1_chainEPNS_4CERTEP13stack_st_X509:
   76|  46.2k|static bool ssl_cert_set1_chain(CERT *cert, STACK_OF(X509) *chain) {
   77|  46.2k|  cert->legacy_credential->ClearIntermediateCerts();
   78|  46.2k|  for (X509 *x509 : chain) {
  ------------------
  |  Branch (78:19): [True: 2.09k, False: 46.2k]
  ------------------
   79|  2.09k|    UniquePtr<CRYPTO_BUFFER> buffer = x509_to_buffer(x509);
   80|  2.09k|    if (!buffer ||
  ------------------
  |  Branch (80:9): [True: 0, False: 2.09k]
  |  Branch (80:9): [True: 0, False: 2.09k]
  ------------------
   81|  2.09k|        !cert->legacy_credential->AppendIntermediateCert(std::move(buffer))) {
  ------------------
  |  Branch (81:9): [True: 0, False: 2.09k]
  ------------------
   82|      0|      return false;
   83|      0|    }
   84|  2.09k|  }
   85|       |
   86|  46.2k|  ssl_crypto_x509_cert_flush_cached_chain(cert);
   87|  46.2k|  return true;
   88|  46.2k|}
ssl_x509.cc:_ZL24ssl_cert_add1_chain_certPN4bssl4CERTEP7x509_st:
  636|  7.94k|static int ssl_cert_add1_chain_cert(CERT *cert, X509 *x509) {
  637|  7.94k|  assert(cert->x509_method);
  638|       |
  639|  7.94k|  UniquePtr<CRYPTO_BUFFER> buffer = x509_to_buffer(x509);
  640|  7.94k|  if (!buffer ||
  ------------------
  |  Branch (640:7): [True: 0, False: 7.94k]
  |  Branch (640:7): [True: 0, False: 7.94k]
  ------------------
  641|  7.94k|      !cert->legacy_credential->AppendIntermediateCert(std::move(buffer))) {
  ------------------
  |  Branch (641:7): [True: 0, False: 7.94k]
  ------------------
  642|      0|    return 0;
  643|      0|  }
  644|       |
  645|  7.94k|  ssl_crypto_x509_cert_flush_cached_chain(cert);
  646|  7.94k|  return 1;
  647|  7.94k|}
ssl_x509.cc:_ZL26ssl_cert_cache_chain_certsPN4bssl4CERTE:
  741|  9.93k|static int ssl_cert_cache_chain_certs(CERT *cert) {
  742|  9.93k|  assert(cert->x509_method);
  743|       |
  744|  9.93k|  const SSL_CREDENTIAL *cred = cert->legacy_credential.get();
  745|  9.93k|  if (cert->x509_chain != nullptr || cred->chain == nullptr ||
  ------------------
  |  Branch (745:7): [True: 5.27k, False: 4.66k]
  |  Branch (745:38): [True: 706, False: 3.96k]
  ------------------
  746|  9.93k|      sk_CRYPTO_BUFFER_num(cred->chain.get()) < 2) {
  ------------------
  |  Branch (746:7): [True: 2.06k, False: 1.89k]
  ------------------
  747|  8.04k|    return 1;
  748|  8.04k|  }
  749|       |
  750|  1.89k|  UniquePtr<STACK_OF(X509)> chain(sk_X509_new_null());
  751|  1.89k|  if (!chain) {
  ------------------
  |  Branch (751:7): [True: 0, False: 1.89k]
  ------------------
  752|      0|    return 0;
  753|      0|  }
  754|       |
  755|  28.0k|  for (size_t i = 1; i < sk_CRYPTO_BUFFER_num(cred->chain.get()); i++) {
  ------------------
  |  Branch (755:22): [True: 26.1k, False: 1.89k]
  ------------------
  756|  26.1k|    CRYPTO_BUFFER *buffer = sk_CRYPTO_BUFFER_value(cred->chain.get(), i);
  757|  26.1k|    UniquePtr<X509> x509(X509_parse_from_buffer(buffer));
  758|  26.1k|    if (!x509 ||  //
  ------------------
  |  Branch (758:9): [True: 0, False: 26.1k]
  |  Branch (758:9): [True: 0, False: 26.1k]
  ------------------
  759|  26.1k|        !PushToStack(chain.get(), std::move(x509))) {
  ------------------
  |  Branch (759:9): [True: 0, False: 26.1k]
  ------------------
  760|      0|      return 0;
  761|      0|    }
  762|  26.1k|  }
  763|       |
  764|  1.89k|  cert->x509_chain = chain.release();
  765|  1.89k|  return 1;
  766|  1.89k|}
ssl_x509.cc:_ZL13add_client_CAPNSt3__110unique_ptrI22stack_st_CRYPTO_BUFFERN4bssl8internal7DeleterEEEP7x509_stP21crypto_buffer_pool_st:
  965|  3.36k|                         CRYPTO_BUFFER_POOL *pool) {
  966|  3.36k|  if (x509 == NULL) {
  ------------------
  |  Branch (966:7): [True: 0, False: 3.36k]
  ------------------
  967|      0|    return 0;
  968|      0|  }
  969|       |
  970|  3.36k|  uint8_t *outp = NULL;
  971|  3.36k|  int len = i2d_X509_NAME(X509_get_subject_name(x509), &outp);
  972|  3.36k|  if (len < 0) {
  ------------------
  |  Branch (972:7): [True: 0, False: 3.36k]
  ------------------
  973|      0|    return 0;
  974|      0|  }
  975|       |
  976|  3.36k|  UniquePtr<CRYPTO_BUFFER> buffer(CRYPTO_BUFFER_new(outp, len, pool));
  977|  3.36k|  OPENSSL_free(outp);
  978|  3.36k|  if (!buffer) {
  ------------------
  |  Branch (978:7): [True: 0, False: 3.36k]
  ------------------
  979|      0|    return 0;
  980|      0|  }
  981|       |
  982|  3.36k|  int alloced = 0;
  983|  3.36k|  if (*names == nullptr) {
  ------------------
  |  Branch (983:7): [True: 0, False: 3.36k]
  ------------------
  984|      0|    names->reset(sk_CRYPTO_BUFFER_new_null());
  985|      0|    alloced = 1;
  986|       |
  987|      0|    if (*names == NULL) {
  ------------------
  |  Branch (987:9): [True: 0, False: 0]
  ------------------
  988|      0|      return 0;
  989|      0|    }
  990|      0|  }
  991|       |
  992|  3.36k|  if (!PushToStack(names->get(), std::move(buffer))) {
  ------------------
  |  Branch (992:7): [True: 0, False: 3.36k]
  ------------------
  993|      0|    if (alloced) {
  ------------------
  |  Branch (993:9): [True: 0, False: 0]
  ------------------
  994|      0|      names->reset();
  995|      0|    }
  996|      0|    return 0;
  997|      0|  }
  998|       |
  999|  3.36k|  return 1;
 1000|  3.36k|}

TLS_method:
  197|  4.88k|const SSL_METHOD *TLS_method(void) {
  198|  4.88k|  static const SSL_METHOD kMethod = {
  199|  4.88k|      0,
  200|  4.88k|      &kTLSProtocolMethod,
  201|  4.88k|      &ssl_crypto_x509_method,
  202|  4.88k|  };
  203|  4.88k|  return &kMethod;
  204|  4.88k|}

curve25519.cc:_ZL20fiat_25519_carry_mulPmPKmS1_:
  133|   144k|static FIAT_25519_FIAT_INLINE void fiat_25519_carry_mul(fiat_25519_tight_field_element out1, const fiat_25519_loose_field_element arg1, const fiat_25519_loose_field_element arg2) {
  134|   144k|  fiat_25519_uint128 x1;
  135|   144k|  fiat_25519_uint128 x2;
  136|   144k|  fiat_25519_uint128 x3;
  137|   144k|  fiat_25519_uint128 x4;
  138|   144k|  fiat_25519_uint128 x5;
  139|   144k|  fiat_25519_uint128 x6;
  140|   144k|  fiat_25519_uint128 x7;
  141|   144k|  fiat_25519_uint128 x8;
  142|   144k|  fiat_25519_uint128 x9;
  143|   144k|  fiat_25519_uint128 x10;
  144|   144k|  fiat_25519_uint128 x11;
  145|   144k|  fiat_25519_uint128 x12;
  146|   144k|  fiat_25519_uint128 x13;
  147|   144k|  fiat_25519_uint128 x14;
  148|   144k|  fiat_25519_uint128 x15;
  149|   144k|  fiat_25519_uint128 x16;
  150|   144k|  fiat_25519_uint128 x17;
  151|   144k|  fiat_25519_uint128 x18;
  152|   144k|  fiat_25519_uint128 x19;
  153|   144k|  fiat_25519_uint128 x20;
  154|   144k|  fiat_25519_uint128 x21;
  155|   144k|  fiat_25519_uint128 x22;
  156|   144k|  fiat_25519_uint128 x23;
  157|   144k|  fiat_25519_uint128 x24;
  158|   144k|  fiat_25519_uint128 x25;
  159|   144k|  fiat_25519_uint128 x26;
  160|   144k|  uint64_t x27;
  161|   144k|  uint64_t x28;
  162|   144k|  fiat_25519_uint128 x29;
  163|   144k|  fiat_25519_uint128 x30;
  164|   144k|  fiat_25519_uint128 x31;
  165|   144k|  fiat_25519_uint128 x32;
  166|   144k|  fiat_25519_uint128 x33;
  167|   144k|  uint64_t x34;
  168|   144k|  uint64_t x35;
  169|   144k|  fiat_25519_uint128 x36;
  170|   144k|  uint64_t x37;
  171|   144k|  uint64_t x38;
  172|   144k|  fiat_25519_uint128 x39;
  173|   144k|  uint64_t x40;
  174|   144k|  uint64_t x41;
  175|   144k|  fiat_25519_uint128 x42;
  176|   144k|  uint64_t x43;
  177|   144k|  uint64_t x44;
  178|   144k|  uint64_t x45;
  179|   144k|  uint64_t x46;
  180|   144k|  uint64_t x47;
  181|   144k|  uint64_t x48;
  182|   144k|  uint64_t x49;
  183|   144k|  fiat_25519_uint1 x50;
  184|   144k|  uint64_t x51;
  185|   144k|  uint64_t x52;
  186|   144k|  x1 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[4]) * UINT8_C(0x13)));
  187|   144k|  x2 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[3]) * UINT8_C(0x13)));
  188|   144k|  x3 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[2]) * UINT8_C(0x13)));
  189|   144k|  x4 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[1]) * UINT8_C(0x13)));
  190|   144k|  x5 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[4]) * UINT8_C(0x13)));
  191|   144k|  x6 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[3]) * UINT8_C(0x13)));
  192|   144k|  x7 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[2]) * UINT8_C(0x13)));
  193|   144k|  x8 = ((fiat_25519_uint128)(arg1[2]) * ((arg2[4]) * UINT8_C(0x13)));
  194|   144k|  x9 = ((fiat_25519_uint128)(arg1[2]) * ((arg2[3]) * UINT8_C(0x13)));
  195|   144k|  x10 = ((fiat_25519_uint128)(arg1[1]) * ((arg2[4]) * UINT8_C(0x13)));
  196|   144k|  x11 = ((fiat_25519_uint128)(arg1[4]) * (arg2[0]));
  197|   144k|  x12 = ((fiat_25519_uint128)(arg1[3]) * (arg2[1]));
  198|   144k|  x13 = ((fiat_25519_uint128)(arg1[3]) * (arg2[0]));
  199|   144k|  x14 = ((fiat_25519_uint128)(arg1[2]) * (arg2[2]));
  200|   144k|  x15 = ((fiat_25519_uint128)(arg1[2]) * (arg2[1]));
  201|   144k|  x16 = ((fiat_25519_uint128)(arg1[2]) * (arg2[0]));
  202|   144k|  x17 = ((fiat_25519_uint128)(arg1[1]) * (arg2[3]));
  203|   144k|  x18 = ((fiat_25519_uint128)(arg1[1]) * (arg2[2]));
  204|   144k|  x19 = ((fiat_25519_uint128)(arg1[1]) * (arg2[1]));
  205|   144k|  x20 = ((fiat_25519_uint128)(arg1[1]) * (arg2[0]));
  206|   144k|  x21 = ((fiat_25519_uint128)(arg1[0]) * (arg2[4]));
  207|   144k|  x22 = ((fiat_25519_uint128)(arg1[0]) * (arg2[3]));
  208|   144k|  x23 = ((fiat_25519_uint128)(arg1[0]) * (arg2[2]));
  209|   144k|  x24 = ((fiat_25519_uint128)(arg1[0]) * (arg2[1]));
  210|   144k|  x25 = ((fiat_25519_uint128)(arg1[0]) * (arg2[0]));
  211|   144k|  x26 = (x25 + (x10 + (x9 + (x7 + x4))));
  212|   144k|  x27 = (uint64_t)(x26 >> 51);
  213|   144k|  x28 = (uint64_t)(x26 & UINT64_C(0x7ffffffffffff));
  214|   144k|  x29 = (x21 + (x17 + (x14 + (x12 + x11))));
  215|   144k|  x30 = (x22 + (x18 + (x15 + (x13 + x1))));
  216|   144k|  x31 = (x23 + (x19 + (x16 + (x5 + x2))));
  217|   144k|  x32 = (x24 + (x20 + (x8 + (x6 + x3))));
  218|   144k|  x33 = (x27 + x32);
  219|   144k|  x34 = (uint64_t)(x33 >> 51);
  220|   144k|  x35 = (uint64_t)(x33 & UINT64_C(0x7ffffffffffff));
  221|   144k|  x36 = (x34 + x31);
  222|   144k|  x37 = (uint64_t)(x36 >> 51);
  223|   144k|  x38 = (uint64_t)(x36 & UINT64_C(0x7ffffffffffff));
  224|   144k|  x39 = (x37 + x30);
  225|   144k|  x40 = (uint64_t)(x39 >> 51);
  226|   144k|  x41 = (uint64_t)(x39 & UINT64_C(0x7ffffffffffff));
  227|   144k|  x42 = (x40 + x29);
  228|   144k|  x43 = (uint64_t)(x42 >> 51);
  229|   144k|  x44 = (uint64_t)(x42 & UINT64_C(0x7ffffffffffff));
  230|   144k|  x45 = (x43 * UINT8_C(0x13));
  231|   144k|  x46 = (x28 + x45);
  232|   144k|  x47 = (x46 >> 51);
  233|   144k|  x48 = (x46 & UINT64_C(0x7ffffffffffff));
  234|   144k|  x49 = (x47 + x35);
  235|   144k|  x50 = (fiat_25519_uint1)(x49 >> 51);
  236|   144k|  x51 = (x49 & UINT64_C(0x7ffffffffffff));
  237|   144k|  x52 = (x50 + x38);
  238|   144k|  out1[0] = x48;
  239|   144k|  out1[1] = x51;
  240|   144k|  out1[2] = x52;
  241|   144k|  out1[3] = x41;
  242|   144k|  out1[4] = x44;
  243|   144k|}
curve25519.cc:_ZL19fiat_25519_to_bytesPhPKm:
  517|  12.0k|static FIAT_25519_FIAT_INLINE void fiat_25519_to_bytes(uint8_t out1[32], const fiat_25519_tight_field_element arg1) {
  518|  12.0k|  uint64_t x1;
  519|  12.0k|  fiat_25519_uint1 x2;
  520|  12.0k|  uint64_t x3;
  521|  12.0k|  fiat_25519_uint1 x4;
  522|  12.0k|  uint64_t x5;
  523|  12.0k|  fiat_25519_uint1 x6;
  524|  12.0k|  uint64_t x7;
  525|  12.0k|  fiat_25519_uint1 x8;
  526|  12.0k|  uint64_t x9;
  527|  12.0k|  fiat_25519_uint1 x10;
  528|  12.0k|  uint64_t x11;
  529|  12.0k|  uint64_t x12;
  530|  12.0k|  fiat_25519_uint1 x13;
  531|  12.0k|  uint64_t x14;
  532|  12.0k|  fiat_25519_uint1 x15;
  533|  12.0k|  uint64_t x16;
  534|  12.0k|  fiat_25519_uint1 x17;
  535|  12.0k|  uint64_t x18;
  536|  12.0k|  fiat_25519_uint1 x19;
  537|  12.0k|  uint64_t x20;
  538|  12.0k|  fiat_25519_uint1 x21;
  539|  12.0k|  uint64_t x22;
  540|  12.0k|  uint64_t x23;
  541|  12.0k|  uint64_t x24;
  542|  12.0k|  uint64_t x25;
  543|  12.0k|  uint8_t x26;
  544|  12.0k|  uint64_t x27;
  545|  12.0k|  uint8_t x28;
  546|  12.0k|  uint64_t x29;
  547|  12.0k|  uint8_t x30;
  548|  12.0k|  uint64_t x31;
  549|  12.0k|  uint8_t x32;
  550|  12.0k|  uint64_t x33;
  551|  12.0k|  uint8_t x34;
  552|  12.0k|  uint64_t x35;
  553|  12.0k|  uint8_t x36;
  554|  12.0k|  uint8_t x37;
  555|  12.0k|  uint64_t x38;
  556|  12.0k|  uint8_t x39;
  557|  12.0k|  uint64_t x40;
  558|  12.0k|  uint8_t x41;
  559|  12.0k|  uint64_t x42;
  560|  12.0k|  uint8_t x43;
  561|  12.0k|  uint64_t x44;
  562|  12.0k|  uint8_t x45;
  563|  12.0k|  uint64_t x46;
  564|  12.0k|  uint8_t x47;
  565|  12.0k|  uint64_t x48;
  566|  12.0k|  uint8_t x49;
  567|  12.0k|  uint8_t x50;
  568|  12.0k|  uint64_t x51;
  569|  12.0k|  uint8_t x52;
  570|  12.0k|  uint64_t x53;
  571|  12.0k|  uint8_t x54;
  572|  12.0k|  uint64_t x55;
  573|  12.0k|  uint8_t x56;
  574|  12.0k|  uint64_t x57;
  575|  12.0k|  uint8_t x58;
  576|  12.0k|  uint64_t x59;
  577|  12.0k|  uint8_t x60;
  578|  12.0k|  uint64_t x61;
  579|  12.0k|  uint8_t x62;
  580|  12.0k|  uint64_t x63;
  581|  12.0k|  uint8_t x64;
  582|  12.0k|  fiat_25519_uint1 x65;
  583|  12.0k|  uint64_t x66;
  584|  12.0k|  uint8_t x67;
  585|  12.0k|  uint64_t x68;
  586|  12.0k|  uint8_t x69;
  587|  12.0k|  uint64_t x70;
  588|  12.0k|  uint8_t x71;
  589|  12.0k|  uint64_t x72;
  590|  12.0k|  uint8_t x73;
  591|  12.0k|  uint64_t x74;
  592|  12.0k|  uint8_t x75;
  593|  12.0k|  uint64_t x76;
  594|  12.0k|  uint8_t x77;
  595|  12.0k|  uint8_t x78;
  596|  12.0k|  uint64_t x79;
  597|  12.0k|  uint8_t x80;
  598|  12.0k|  uint64_t x81;
  599|  12.0k|  uint8_t x82;
  600|  12.0k|  uint64_t x83;
  601|  12.0k|  uint8_t x84;
  602|  12.0k|  uint64_t x85;
  603|  12.0k|  uint8_t x86;
  604|  12.0k|  uint64_t x87;
  605|  12.0k|  uint8_t x88;
  606|  12.0k|  uint64_t x89;
  607|  12.0k|  uint8_t x90;
  608|  12.0k|  uint8_t x91;
  609|  12.0k|  fiat_25519_subborrowx_u51(&x1, &x2, 0x0, (arg1[0]), UINT64_C(0x7ffffffffffed));
  610|  12.0k|  fiat_25519_subborrowx_u51(&x3, &x4, x2, (arg1[1]), UINT64_C(0x7ffffffffffff));
  611|  12.0k|  fiat_25519_subborrowx_u51(&x5, &x6, x4, (arg1[2]), UINT64_C(0x7ffffffffffff));
  612|  12.0k|  fiat_25519_subborrowx_u51(&x7, &x8, x6, (arg1[3]), UINT64_C(0x7ffffffffffff));
  613|  12.0k|  fiat_25519_subborrowx_u51(&x9, &x10, x8, (arg1[4]), UINT64_C(0x7ffffffffffff));
  614|  12.0k|  fiat_25519_cmovznz_u64(&x11, x10, 0x0, UINT64_C(0xffffffffffffffff));
  615|  12.0k|  fiat_25519_addcarryx_u51(&x12, &x13, 0x0, x1, (x11 & UINT64_C(0x7ffffffffffed)));
  616|  12.0k|  fiat_25519_addcarryx_u51(&x14, &x15, x13, x3, (x11 & UINT64_C(0x7ffffffffffff)));
  617|  12.0k|  fiat_25519_addcarryx_u51(&x16, &x17, x15, x5, (x11 & UINT64_C(0x7ffffffffffff)));
  618|  12.0k|  fiat_25519_addcarryx_u51(&x18, &x19, x17, x7, (x11 & UINT64_C(0x7ffffffffffff)));
  619|  12.0k|  fiat_25519_addcarryx_u51(&x20, &x21, x19, x9, (x11 & UINT64_C(0x7ffffffffffff)));
  620|  12.0k|  x22 = (x20 << 4);
  621|  12.0k|  x23 = (x18 * (uint64_t)0x2);
  622|  12.0k|  x24 = (x16 << 6);
  623|  12.0k|  x25 = (x14 << 3);
  624|  12.0k|  x26 = (uint8_t)(x12 & UINT8_C(0xff));
  625|  12.0k|  x27 = (x12 >> 8);
  626|  12.0k|  x28 = (uint8_t)(x27 & UINT8_C(0xff));
  627|  12.0k|  x29 = (x27 >> 8);
  628|  12.0k|  x30 = (uint8_t)(x29 & UINT8_C(0xff));
  629|  12.0k|  x31 = (x29 >> 8);
  630|  12.0k|  x32 = (uint8_t)(x31 & UINT8_C(0xff));
  631|  12.0k|  x33 = (x31 >> 8);
  632|  12.0k|  x34 = (uint8_t)(x33 & UINT8_C(0xff));
  633|  12.0k|  x35 = (x33 >> 8);
  634|  12.0k|  x36 = (uint8_t)(x35 & UINT8_C(0xff));
  635|  12.0k|  x37 = (uint8_t)(x35 >> 8);
  636|  12.0k|  x38 = (x25 + (uint64_t)x37);
  637|  12.0k|  x39 = (uint8_t)(x38 & UINT8_C(0xff));
  638|  12.0k|  x40 = (x38 >> 8);
  639|  12.0k|  x41 = (uint8_t)(x40 & UINT8_C(0xff));
  640|  12.0k|  x42 = (x40 >> 8);
  641|  12.0k|  x43 = (uint8_t)(x42 & UINT8_C(0xff));
  642|  12.0k|  x44 = (x42 >> 8);
  643|  12.0k|  x45 = (uint8_t)(x44 & UINT8_C(0xff));
  644|  12.0k|  x46 = (x44 >> 8);
  645|  12.0k|  x47 = (uint8_t)(x46 & UINT8_C(0xff));
  646|  12.0k|  x48 = (x46 >> 8);
  647|  12.0k|  x49 = (uint8_t)(x48 & UINT8_C(0xff));
  648|  12.0k|  x50 = (uint8_t)(x48 >> 8);
  649|  12.0k|  x51 = (x24 + (uint64_t)x50);
  650|  12.0k|  x52 = (uint8_t)(x51 & UINT8_C(0xff));
  651|  12.0k|  x53 = (x51 >> 8);
  652|  12.0k|  x54 = (uint8_t)(x53 & UINT8_C(0xff));
  653|  12.0k|  x55 = (x53 >> 8);
  654|  12.0k|  x56 = (uint8_t)(x55 & UINT8_C(0xff));
  655|  12.0k|  x57 = (x55 >> 8);
  656|  12.0k|  x58 = (uint8_t)(x57 & UINT8_C(0xff));
  657|  12.0k|  x59 = (x57 >> 8);
  658|  12.0k|  x60 = (uint8_t)(x59 & UINT8_C(0xff));
  659|  12.0k|  x61 = (x59 >> 8);
  660|  12.0k|  x62 = (uint8_t)(x61 & UINT8_C(0xff));
  661|  12.0k|  x63 = (x61 >> 8);
  662|  12.0k|  x64 = (uint8_t)(x63 & UINT8_C(0xff));
  663|  12.0k|  x65 = (fiat_25519_uint1)(x63 >> 8);
  664|  12.0k|  x66 = (x23 + (uint64_t)x65);
  665|  12.0k|  x67 = (uint8_t)(x66 & UINT8_C(0xff));
  666|  12.0k|  x68 = (x66 >> 8);
  667|  12.0k|  x69 = (uint8_t)(x68 & UINT8_C(0xff));
  668|  12.0k|  x70 = (x68 >> 8);
  669|  12.0k|  x71 = (uint8_t)(x70 & UINT8_C(0xff));
  670|  12.0k|  x72 = (x70 >> 8);
  671|  12.0k|  x73 = (uint8_t)(x72 & UINT8_C(0xff));
  672|  12.0k|  x74 = (x72 >> 8);
  673|  12.0k|  x75 = (uint8_t)(x74 & UINT8_C(0xff));
  674|  12.0k|  x76 = (x74 >> 8);
  675|  12.0k|  x77 = (uint8_t)(x76 & UINT8_C(0xff));
  676|  12.0k|  x78 = (uint8_t)(x76 >> 8);
  677|  12.0k|  x79 = (x22 + (uint64_t)x78);
  678|  12.0k|  x80 = (uint8_t)(x79 & UINT8_C(0xff));
  679|  12.0k|  x81 = (x79 >> 8);
  680|  12.0k|  x82 = (uint8_t)(x81 & UINT8_C(0xff));
  681|  12.0k|  x83 = (x81 >> 8);
  682|  12.0k|  x84 = (uint8_t)(x83 & UINT8_C(0xff));
  683|  12.0k|  x85 = (x83 >> 8);
  684|  12.0k|  x86 = (uint8_t)(x85 & UINT8_C(0xff));
  685|  12.0k|  x87 = (x85 >> 8);
  686|  12.0k|  x88 = (uint8_t)(x87 & UINT8_C(0xff));
  687|  12.0k|  x89 = (x87 >> 8);
  688|  12.0k|  x90 = (uint8_t)(x89 & UINT8_C(0xff));
  689|  12.0k|  x91 = (uint8_t)(x89 >> 8);
  690|  12.0k|  out1[0] = x26;
  691|  12.0k|  out1[1] = x28;
  692|  12.0k|  out1[2] = x30;
  693|  12.0k|  out1[3] = x32;
  694|  12.0k|  out1[4] = x34;
  695|  12.0k|  out1[5] = x36;
  696|  12.0k|  out1[6] = x39;
  697|  12.0k|  out1[7] = x41;
  698|  12.0k|  out1[8] = x43;
  699|  12.0k|  out1[9] = x45;
  700|  12.0k|  out1[10] = x47;
  701|  12.0k|  out1[11] = x49;
  702|  12.0k|  out1[12] = x52;
  703|  12.0k|  out1[13] = x54;
  704|  12.0k|  out1[14] = x56;
  705|  12.0k|  out1[15] = x58;
  706|  12.0k|  out1[16] = x60;
  707|  12.0k|  out1[17] = x62;
  708|  12.0k|  out1[18] = x64;
  709|  12.0k|  out1[19] = x67;
  710|  12.0k|  out1[20] = x69;
  711|  12.0k|  out1[21] = x71;
  712|  12.0k|  out1[22] = x73;
  713|  12.0k|  out1[23] = x75;
  714|  12.0k|  out1[24] = x77;
  715|  12.0k|  out1[25] = x80;
  716|  12.0k|  out1[26] = x82;
  717|  12.0k|  out1[27] = x84;
  718|  12.0k|  out1[28] = x86;
  719|  12.0k|  out1[29] = x88;
  720|  12.0k|  out1[30] = x90;
  721|  12.0k|  out1[31] = x91;
  722|  12.0k|}
curve25519.cc:_ZL25fiat_25519_subborrowx_u51PmPhhmm:
   92|  60.2k|static FIAT_25519_FIAT_INLINE void fiat_25519_subborrowx_u51(uint64_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
   93|  60.2k|  int64_t x1;
   94|  60.2k|  fiat_25519_int1 x2;
   95|  60.2k|  uint64_t x3;
   96|  60.2k|  x1 = ((int64_t)(arg2 - (int64_t)arg1) - (int64_t)arg3);
   97|  60.2k|  x2 = (fiat_25519_int1)(x1 >> 51);
   98|  60.2k|  x3 = (x1 & UINT64_C(0x7ffffffffffff));
   99|  60.2k|  *out1 = x3;
  100|  60.2k|  *out2 = (fiat_25519_uint1)(0x0 - x2);
  101|  60.2k|}
curve25519.cc:_ZL22fiat_25519_cmovznz_u64Pmhmm:
  116|  12.0k|static FIAT_25519_FIAT_INLINE void fiat_25519_cmovznz_u64(uint64_t* out1, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
  117|  12.0k|  fiat_25519_uint1 x1;
  118|  12.0k|  uint64_t x2;
  119|  12.0k|  uint64_t x3;
  120|  12.0k|  x1 = (!(!arg1));
  121|  12.0k|  x2 = ((fiat_25519_int1)(0x0 - x1) & UINT64_C(0xffffffffffffffff));
  122|  12.0k|  x3 = ((fiat_25519_value_barrier_u64(x2) & arg3) | (fiat_25519_value_barrier_u64((~x2)) & arg2));
  123|  12.0k|  *out1 = x3;
  124|  12.0k|}
curve25519.cc:_ZL28fiat_25519_value_barrier_u64m:
   42|  24.1k|static __inline__ uint64_t fiat_25519_value_barrier_u64(uint64_t a) {
   43|  24.1k|  __asm__("" : "+r"(a) : /* no inputs */);
   44|  24.1k|  return a;
   45|  24.1k|}
curve25519.cc:_ZL24fiat_25519_addcarryx_u51PmPhhmm:
   66|  60.2k|static FIAT_25519_FIAT_INLINE void fiat_25519_addcarryx_u51(uint64_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
   67|  60.2k|  uint64_t x1;
   68|  60.2k|  uint64_t x2;
   69|  60.2k|  fiat_25519_uint1 x3;
   70|  60.2k|  x1 = ((arg1 + arg2) + arg3);
   71|  60.2k|  x2 = (x1 & UINT64_C(0x7ffffffffffff));
   72|  60.2k|  x3 = (fiat_25519_uint1)(x1 >> 51);
   73|  60.2k|  *out1 = x2;
   74|  60.2k|  *out2 = x3;
   75|  60.2k|}
curve25519.cc:_ZL23fiat_25519_carry_squarePmPKm:
  252|  3.06M|static FIAT_25519_FIAT_INLINE void fiat_25519_carry_square(fiat_25519_tight_field_element out1, const fiat_25519_loose_field_element arg1) {
  253|  3.06M|  uint64_t x1;
  254|  3.06M|  uint64_t x2;
  255|  3.06M|  uint64_t x3;
  256|  3.06M|  uint64_t x4;
  257|  3.06M|  uint64_t x5;
  258|  3.06M|  uint64_t x6;
  259|  3.06M|  uint64_t x7;
  260|  3.06M|  uint64_t x8;
  261|  3.06M|  fiat_25519_uint128 x9;
  262|  3.06M|  fiat_25519_uint128 x10;
  263|  3.06M|  fiat_25519_uint128 x11;
  264|  3.06M|  fiat_25519_uint128 x12;
  265|  3.06M|  fiat_25519_uint128 x13;
  266|  3.06M|  fiat_25519_uint128 x14;
  267|  3.06M|  fiat_25519_uint128 x15;
  268|  3.06M|  fiat_25519_uint128 x16;
  269|  3.06M|  fiat_25519_uint128 x17;
  270|  3.06M|  fiat_25519_uint128 x18;
  271|  3.06M|  fiat_25519_uint128 x19;
  272|  3.06M|  fiat_25519_uint128 x20;
  273|  3.06M|  fiat_25519_uint128 x21;
  274|  3.06M|  fiat_25519_uint128 x22;
  275|  3.06M|  fiat_25519_uint128 x23;
  276|  3.06M|  fiat_25519_uint128 x24;
  277|  3.06M|  uint64_t x25;
  278|  3.06M|  uint64_t x26;
  279|  3.06M|  fiat_25519_uint128 x27;
  280|  3.06M|  fiat_25519_uint128 x28;
  281|  3.06M|  fiat_25519_uint128 x29;
  282|  3.06M|  fiat_25519_uint128 x30;
  283|  3.06M|  fiat_25519_uint128 x31;
  284|  3.06M|  uint64_t x32;
  285|  3.06M|  uint64_t x33;
  286|  3.06M|  fiat_25519_uint128 x34;
  287|  3.06M|  uint64_t x35;
  288|  3.06M|  uint64_t x36;
  289|  3.06M|  fiat_25519_uint128 x37;
  290|  3.06M|  uint64_t x38;
  291|  3.06M|  uint64_t x39;
  292|  3.06M|  fiat_25519_uint128 x40;
  293|  3.06M|  uint64_t x41;
  294|  3.06M|  uint64_t x42;
  295|  3.06M|  uint64_t x43;
  296|  3.06M|  uint64_t x44;
  297|  3.06M|  uint64_t x45;
  298|  3.06M|  uint64_t x46;
  299|  3.06M|  uint64_t x47;
  300|  3.06M|  fiat_25519_uint1 x48;
  301|  3.06M|  uint64_t x49;
  302|  3.06M|  uint64_t x50;
  303|  3.06M|  x1 = ((arg1[4]) * UINT8_C(0x13));
  304|  3.06M|  x2 = (x1 * 0x2);
  305|  3.06M|  x3 = ((arg1[4]) * 0x2);
  306|  3.06M|  x4 = ((arg1[3]) * UINT8_C(0x13));
  307|  3.06M|  x5 = (x4 * 0x2);
  308|  3.06M|  x6 = ((arg1[3]) * 0x2);
  309|  3.06M|  x7 = ((arg1[2]) * 0x2);
  310|  3.06M|  x8 = ((arg1[1]) * 0x2);
  311|  3.06M|  x9 = ((fiat_25519_uint128)(arg1[4]) * x1);
  312|  3.06M|  x10 = ((fiat_25519_uint128)(arg1[3]) * x2);
  313|  3.06M|  x11 = ((fiat_25519_uint128)(arg1[3]) * x4);
  314|  3.06M|  x12 = ((fiat_25519_uint128)(arg1[2]) * x2);
  315|  3.06M|  x13 = ((fiat_25519_uint128)(arg1[2]) * x5);
  316|  3.06M|  x14 = ((fiat_25519_uint128)(arg1[2]) * (arg1[2]));
  317|  3.06M|  x15 = ((fiat_25519_uint128)(arg1[1]) * x2);
  318|  3.06M|  x16 = ((fiat_25519_uint128)(arg1[1]) * x6);
  319|  3.06M|  x17 = ((fiat_25519_uint128)(arg1[1]) * x7);
  320|  3.06M|  x18 = ((fiat_25519_uint128)(arg1[1]) * (arg1[1]));
  321|  3.06M|  x19 = ((fiat_25519_uint128)(arg1[0]) * x3);
  322|  3.06M|  x20 = ((fiat_25519_uint128)(arg1[0]) * x6);
  323|  3.06M|  x21 = ((fiat_25519_uint128)(arg1[0]) * x7);
  324|  3.06M|  x22 = ((fiat_25519_uint128)(arg1[0]) * x8);
  325|  3.06M|  x23 = ((fiat_25519_uint128)(arg1[0]) * (arg1[0]));
  326|  3.06M|  x24 = (x23 + (x15 + x13));
  327|  3.06M|  x25 = (uint64_t)(x24 >> 51);
  328|  3.06M|  x26 = (uint64_t)(x24 & UINT64_C(0x7ffffffffffff));
  329|  3.06M|  x27 = (x19 + (x16 + x14));
  330|  3.06M|  x28 = (x20 + (x17 + x9));
  331|  3.06M|  x29 = (x21 + (x18 + x10));
  332|  3.06M|  x30 = (x22 + (x12 + x11));
  333|  3.06M|  x31 = (x25 + x30);
  334|  3.06M|  x32 = (uint64_t)(x31 >> 51);
  335|  3.06M|  x33 = (uint64_t)(x31 & UINT64_C(0x7ffffffffffff));
  336|  3.06M|  x34 = (x32 + x29);
  337|  3.06M|  x35 = (uint64_t)(x34 >> 51);
  338|  3.06M|  x36 = (uint64_t)(x34 & UINT64_C(0x7ffffffffffff));
  339|  3.06M|  x37 = (x35 + x28);
  340|  3.06M|  x38 = (uint64_t)(x37 >> 51);
  341|  3.06M|  x39 = (uint64_t)(x37 & UINT64_C(0x7ffffffffffff));
  342|  3.06M|  x40 = (x38 + x27);
  343|  3.06M|  x41 = (uint64_t)(x40 >> 51);
  344|  3.06M|  x42 = (uint64_t)(x40 & UINT64_C(0x7ffffffffffff));
  345|  3.06M|  x43 = (x41 * UINT8_C(0x13));
  346|  3.06M|  x44 = (x26 + x43);
  347|  3.06M|  x45 = (x44 >> 51);
  348|  3.06M|  x46 = (x44 & UINT64_C(0x7ffffffffffff));
  349|  3.06M|  x47 = (x45 + x33);
  350|  3.06M|  x48 = (fiat_25519_uint1)(x47 >> 51);
  351|  3.06M|  x49 = (x47 & UINT64_C(0x7ffffffffffff));
  352|  3.06M|  x50 = (x48 + x36);
  353|  3.06M|  out1[0] = x46;
  354|  3.06M|  out1[1] = x49;
  355|  3.06M|  out1[2] = x50;
  356|  3.06M|  out1[3] = x39;
  357|  3.06M|  out1[4] = x42;
  358|  3.06M|}
curve25519.cc:_ZL14fiat_25519_subPmPKmS1_:
  431|  12.0k|static FIAT_25519_FIAT_INLINE void fiat_25519_sub(fiat_25519_loose_field_element out1, const fiat_25519_tight_field_element arg1, const fiat_25519_tight_field_element arg2) {
  432|  12.0k|  uint64_t x1;
  433|  12.0k|  uint64_t x2;
  434|  12.0k|  uint64_t x3;
  435|  12.0k|  uint64_t x4;
  436|  12.0k|  uint64_t x5;
  437|  12.0k|  x1 = ((UINT64_C(0xfffffffffffda) + (arg1[0])) - (arg2[0]));
  438|  12.0k|  x2 = ((UINT64_C(0xffffffffffffe) + (arg1[1])) - (arg2[1]));
  439|  12.0k|  x3 = ((UINT64_C(0xffffffffffffe) + (arg1[2])) - (arg2[2]));
  440|  12.0k|  x4 = ((UINT64_C(0xffffffffffffe) + (arg1[3])) - (arg2[3]));
  441|  12.0k|  x5 = ((UINT64_C(0xffffffffffffe) + (arg1[4])) - (arg2[4]));
  442|  12.0k|  out1[0] = x1;
  443|  12.0k|  out1[1] = x2;
  444|  12.0k|  out1[2] = x3;
  445|  12.0k|  out1[3] = x4;
  446|  12.0k|  out1[4] = x5;
  447|  12.0k|}
curve25519.cc:_ZL14fiat_25519_addPmPKmS1_:
  406|  12.0k|static FIAT_25519_FIAT_INLINE void fiat_25519_add(fiat_25519_loose_field_element out1, const fiat_25519_tight_field_element arg1, const fiat_25519_tight_field_element arg2) {
  407|  12.0k|  uint64_t x1;
  408|  12.0k|  uint64_t x2;
  409|  12.0k|  uint64_t x3;
  410|  12.0k|  uint64_t x4;
  411|  12.0k|  uint64_t x5;
  412|  12.0k|  x1 = ((arg1[0]) + (arg2[0]));
  413|  12.0k|  x2 = ((arg1[1]) + (arg2[1]));
  414|  12.0k|  x3 = ((arg1[2]) + (arg2[2]));
  415|  12.0k|  x4 = ((arg1[3]) + (arg2[3]));
  416|  12.0k|  x5 = ((arg1[4]) + (arg2[4]));
  417|  12.0k|  out1[0] = x1;
  418|  12.0k|  out1[1] = x2;
  419|  12.0k|  out1[2] = x3;
  420|  12.0k|  out1[3] = x4;
  421|  12.0k|  out1[4] = x5;
  422|  12.0k|}
curve25519.cc:_ZL21fiat_25519_from_bytesPmPKh:
  733|  48.2k|static FIAT_25519_FIAT_INLINE void fiat_25519_from_bytes(fiat_25519_tight_field_element out1, const uint8_t arg1[32]) {
  734|  48.2k|  uint64_t x1;
  735|  48.2k|  uint64_t x2;
  736|  48.2k|  uint64_t x3;
  737|  48.2k|  uint64_t x4;
  738|  48.2k|  uint64_t x5;
  739|  48.2k|  uint64_t x6;
  740|  48.2k|  uint64_t x7;
  741|  48.2k|  uint64_t x8;
  742|  48.2k|  uint64_t x9;
  743|  48.2k|  uint64_t x10;
  744|  48.2k|  uint64_t x11;
  745|  48.2k|  uint64_t x12;
  746|  48.2k|  uint64_t x13;
  747|  48.2k|  uint64_t x14;
  748|  48.2k|  uint64_t x15;
  749|  48.2k|  uint64_t x16;
  750|  48.2k|  uint64_t x17;
  751|  48.2k|  uint64_t x18;
  752|  48.2k|  uint64_t x19;
  753|  48.2k|  uint64_t x20;
  754|  48.2k|  uint64_t x21;
  755|  48.2k|  uint64_t x22;
  756|  48.2k|  uint64_t x23;
  757|  48.2k|  uint64_t x24;
  758|  48.2k|  uint64_t x25;
  759|  48.2k|  uint64_t x26;
  760|  48.2k|  uint64_t x27;
  761|  48.2k|  uint64_t x28;
  762|  48.2k|  uint64_t x29;
  763|  48.2k|  uint64_t x30;
  764|  48.2k|  uint64_t x31;
  765|  48.2k|  uint8_t x32;
  766|  48.2k|  uint64_t x33;
  767|  48.2k|  uint64_t x34;
  768|  48.2k|  uint64_t x35;
  769|  48.2k|  uint64_t x36;
  770|  48.2k|  uint64_t x37;
  771|  48.2k|  uint64_t x38;
  772|  48.2k|  uint64_t x39;
  773|  48.2k|  uint8_t x40;
  774|  48.2k|  uint64_t x41;
  775|  48.2k|  uint64_t x42;
  776|  48.2k|  uint64_t x43;
  777|  48.2k|  uint64_t x44;
  778|  48.2k|  uint64_t x45;
  779|  48.2k|  uint64_t x46;
  780|  48.2k|  uint64_t x47;
  781|  48.2k|  uint8_t x48;
  782|  48.2k|  uint64_t x49;
  783|  48.2k|  uint64_t x50;
  784|  48.2k|  uint64_t x51;
  785|  48.2k|  uint64_t x52;
  786|  48.2k|  uint64_t x53;
  787|  48.2k|  uint64_t x54;
  788|  48.2k|  uint64_t x55;
  789|  48.2k|  uint64_t x56;
  790|  48.2k|  uint8_t x57;
  791|  48.2k|  uint64_t x58;
  792|  48.2k|  uint64_t x59;
  793|  48.2k|  uint64_t x60;
  794|  48.2k|  uint64_t x61;
  795|  48.2k|  uint64_t x62;
  796|  48.2k|  uint64_t x63;
  797|  48.2k|  uint64_t x64;
  798|  48.2k|  uint8_t x65;
  799|  48.2k|  uint64_t x66;
  800|  48.2k|  uint64_t x67;
  801|  48.2k|  uint64_t x68;
  802|  48.2k|  uint64_t x69;
  803|  48.2k|  uint64_t x70;
  804|  48.2k|  uint64_t x71;
  805|  48.2k|  x1 = ((uint64_t)(arg1[31]) << 44);
  806|  48.2k|  x2 = ((uint64_t)(arg1[30]) << 36);
  807|  48.2k|  x3 = ((uint64_t)(arg1[29]) << 28);
  808|  48.2k|  x4 = ((uint64_t)(arg1[28]) << 20);
  809|  48.2k|  x5 = ((uint64_t)(arg1[27]) << 12);
  810|  48.2k|  x6 = ((uint64_t)(arg1[26]) << 4);
  811|  48.2k|  x7 = ((uint64_t)(arg1[25]) << 47);
  812|  48.2k|  x8 = ((uint64_t)(arg1[24]) << 39);
  813|  48.2k|  x9 = ((uint64_t)(arg1[23]) << 31);
  814|  48.2k|  x10 = ((uint64_t)(arg1[22]) << 23);
  815|  48.2k|  x11 = ((uint64_t)(arg1[21]) << 15);
  816|  48.2k|  x12 = ((uint64_t)(arg1[20]) << 7);
  817|  48.2k|  x13 = ((uint64_t)(arg1[19]) << 50);
  818|  48.2k|  x14 = ((uint64_t)(arg1[18]) << 42);
  819|  48.2k|  x15 = ((uint64_t)(arg1[17]) << 34);
  820|  48.2k|  x16 = ((uint64_t)(arg1[16]) << 26);
  821|  48.2k|  x17 = ((uint64_t)(arg1[15]) << 18);
  822|  48.2k|  x18 = ((uint64_t)(arg1[14]) << 10);
  823|  48.2k|  x19 = ((uint64_t)(arg1[13]) << 2);
  824|  48.2k|  x20 = ((uint64_t)(arg1[12]) << 45);
  825|  48.2k|  x21 = ((uint64_t)(arg1[11]) << 37);
  826|  48.2k|  x22 = ((uint64_t)(arg1[10]) << 29);
  827|  48.2k|  x23 = ((uint64_t)(arg1[9]) << 21);
  828|  48.2k|  x24 = ((uint64_t)(arg1[8]) << 13);
  829|  48.2k|  x25 = ((uint64_t)(arg1[7]) << 5);
  830|  48.2k|  x26 = ((uint64_t)(arg1[6]) << 48);
  831|  48.2k|  x27 = ((uint64_t)(arg1[5]) << 40);
  832|  48.2k|  x28 = ((uint64_t)(arg1[4]) << 32);
  833|  48.2k|  x29 = ((uint64_t)(arg1[3]) << 24);
  834|  48.2k|  x30 = ((uint64_t)(arg1[2]) << 16);
  835|  48.2k|  x31 = ((uint64_t)(arg1[1]) << 8);
  836|  48.2k|  x32 = (arg1[0]);
  837|  48.2k|  x33 = (x31 + (uint64_t)x32);
  838|  48.2k|  x34 = (x30 + x33);
  839|  48.2k|  x35 = (x29 + x34);
  840|  48.2k|  x36 = (x28 + x35);
  841|  48.2k|  x37 = (x27 + x36);
  842|  48.2k|  x38 = (x26 + x37);
  843|  48.2k|  x39 = (x38 & UINT64_C(0x7ffffffffffff));
  844|  48.2k|  x40 = (uint8_t)(x38 >> 51);
  845|  48.2k|  x41 = (x25 + (uint64_t)x40);
  846|  48.2k|  x42 = (x24 + x41);
  847|  48.2k|  x43 = (x23 + x42);
  848|  48.2k|  x44 = (x22 + x43);
  849|  48.2k|  x45 = (x21 + x44);
  850|  48.2k|  x46 = (x20 + x45);
  851|  48.2k|  x47 = (x46 & UINT64_C(0x7ffffffffffff));
  852|  48.2k|  x48 = (uint8_t)(x46 >> 51);
  853|  48.2k|  x49 = (x19 + (uint64_t)x48);
  854|  48.2k|  x50 = (x18 + x49);
  855|  48.2k|  x51 = (x17 + x50);
  856|  48.2k|  x52 = (x16 + x51);
  857|  48.2k|  x53 = (x15 + x52);
  858|  48.2k|  x54 = (x14 + x53);
  859|  48.2k|  x55 = (x13 + x54);
  860|  48.2k|  x56 = (x55 & UINT64_C(0x7ffffffffffff));
  861|  48.2k|  x57 = (uint8_t)(x55 >> 51);
  862|  48.2k|  x58 = (x12 + (uint64_t)x57);
  863|  48.2k|  x59 = (x11 + x58);
  864|  48.2k|  x60 = (x10 + x59);
  865|  48.2k|  x61 = (x9 + x60);
  866|  48.2k|  x62 = (x8 + x61);
  867|  48.2k|  x63 = (x7 + x62);
  868|  48.2k|  x64 = (x63 & UINT64_C(0x7ffffffffffff));
  869|  48.2k|  x65 = (uint8_t)(x63 >> 51);
  870|  48.2k|  x66 = (x6 + (uint64_t)x65);
  871|  48.2k|  x67 = (x5 + x66);
  872|  48.2k|  x68 = (x4 + x67);
  873|  48.2k|  x69 = (x3 + x68);
  874|  48.2k|  x70 = (x2 + x69);
  875|  48.2k|  x71 = (x1 + x70);
  876|  48.2k|  out1[0] = x39;
  877|  48.2k|  out1[1] = x47;
  878|  48.2k|  out1[2] = x56;
  879|  48.2k|  out1[3] = x64;
  880|  48.2k|  out1[4] = x71;
  881|  48.2k|}

x25519_ge_scalarmult_base_adx:
  649|  12.0k|void x25519_ge_scalarmult_base_adx(uint8_t h[4][32], const uint8_t a[32]) {
  650|  12.0k|  signed char e[64];
  651|  12.0k|  signed char carry;
  652|       |
  653|   397k|  for (unsigned i = 0; i < 32; ++i) {
  ------------------
  |  Branch (653:24): [True: 385k, False: 12.0k]
  ------------------
  654|   385k|    e[2 * i + 0] = (a[i] >> 0) & 15;
  655|   385k|    e[2 * i + 1] = (a[i] >> 4) & 15;
  656|   385k|  }
  657|       |  // each e[i] is between 0 and 15
  658|       |  // e[63] is between 0 and 7
  659|       |
  660|  12.0k|  carry = 0;
  661|   771k|  for (unsigned i = 0; i < 63; ++i) {
  ------------------
  |  Branch (661:24): [True: 759k, False: 12.0k]
  ------------------
  662|   759k|    e[i] += carry;
  663|   759k|    carry = e[i] + 8;
  664|   759k|    carry >>= 4;
  665|   759k|    e[i] -= carry << 4;
  666|   759k|  }
  667|  12.0k|  e[63] += carry;
  668|       |  // each e[i] is between -8 and 8
  669|       |
  670|  12.0k|  ge_p3_4 r = {{0}, {1}, {1}, {0}};
  671|   397k|  for (unsigned i = 1; i < 64; i += 2) {
  ------------------
  |  Branch (671:24): [True: 385k, False: 12.0k]
  ------------------
  672|   385k|    ge_precomp_4 t;
  673|   385k|    table_select_4(&t, i / 2, e[i]);
  674|   385k|    ge_p3_add_p3_precomp_4(&r, &r, &t);
  675|   385k|  }
  676|       |
  677|  12.0k|  inline_x25519_ge_dbl_4(&r, &r, /*skip_t=*/true);
  678|  12.0k|  inline_x25519_ge_dbl_4(&r, &r, /*skip_t=*/true);
  679|  12.0k|  inline_x25519_ge_dbl_4(&r, &r, /*skip_t=*/true);
  680|  12.0k|  inline_x25519_ge_dbl_4(&r, &r, /*skip_t=*/false);
  681|       |
  682|   397k|  for (unsigned i = 0; i < 64; i += 2) {
  ------------------
  |  Branch (682:24): [True: 385k, False: 12.0k]
  ------------------
  683|   385k|    ge_precomp_4 t;
  684|   385k|    table_select_4(&t, i / 2, e[i]);
  685|   385k|    ge_p3_add_p3_precomp_4(&r, &r, &t);
  686|   385k|  }
  687|       |
  688|       |  // fe4 uses saturated 64-bit limbs, so converting to bytes is just a copy.
  689|       |  // Satisfy stated precondition of fiat_25519_from_bytes; tests pass either way
  690|  12.0k|  fe4_canon(r.X, r.X);
  691|  12.0k|  fe4_canon(r.Y, r.Y);
  692|  12.0k|  fe4_canon(r.Z, r.Z);
  693|  12.0k|  fe4_canon(r.T, r.T);
  694|  12.0k|  static_assert(sizeof(ge_p3_4) == sizeof(uint8_t[4][32]), "");
  695|  12.0k|  OPENSSL_memcpy(h, &r, sizeof(ge_p3_4));
  696|  12.0k|}
curve25519_64_adx.cc:_ZL16fiat_cmovznz_u64Pmhmm:
  147|  13.3M|static inline void fiat_cmovznz_u64(uint64_t* out1, fiat_uint1 arg1, uint64_t arg2, uint64_t arg3) {
  148|  13.3M|  fiat_uint1 x1;
  149|  13.3M|  uint64_t x2;
  150|  13.3M|  uint64_t x3;
  151|  13.3M|  x1 = (!(!arg1));
  152|  13.3M|  x2 = ((fiat_int1)(0x0 - x1) & UINT64_C(0xffffffffffffffff));
  153|  13.3M|  x3 = ((fiat_value_barrier_u64(x2) & arg3) | (fiat_value_barrier_u64((~x2)) & arg2));
  154|  13.3M|  *out1 = x3;
  155|  13.3M|}
curve25519_64_adx.cc:_ZL22fiat_value_barrier_u64m:
   12|  26.6M|static __inline__ uint64_t fiat_value_barrier_u64(uint64_t a) {
   13|  26.6M|  __asm__("" : "+r"(a) : /* no inputs */);
   14|  26.6M|  return a;
   15|  26.6M|}
curve25519_64_adx.cc:_ZL7fe4_subPmPKmS1_:
  211|  3.23M|static void fe4_sub(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) {
  212|  3.23M|  uint64_t x1;
  213|  3.23M|  uint64_t x2;
  214|  3.23M|  fiat_uint1 x3;
  215|  3.23M|  uint64_t x4;
  216|  3.23M|  uint64_t x5;
  217|  3.23M|  fiat_uint1 x6;
  218|  3.23M|  uint64_t x7;
  219|  3.23M|  uint64_t x8;
  220|  3.23M|  fiat_uint1 x9;
  221|  3.23M|  uint64_t x10;
  222|  3.23M|  uint64_t x11;
  223|  3.23M|  fiat_uint1 x12;
  224|  3.23M|  uint64_t x13;
  225|  3.23M|  uint64_t x14;
  226|  3.23M|  fiat_uint1 x15;
  227|  3.23M|  uint64_t x16;
  228|  3.23M|  fiat_uint1 x17;
  229|  3.23M|  uint64_t x18;
  230|  3.23M|  fiat_uint1 x19;
  231|  3.23M|  uint64_t x20;
  232|  3.23M|  fiat_uint1 x21;
  233|  3.23M|  uint64_t x22;
  234|  3.23M|  uint64_t x23;
  235|  3.23M|  fiat_uint1 x24;
  236|  3.23M|  x1 = (arg2[0]);
  237|  3.23M|  fiat_subborrowx_u64(&x2, &x3, 0x0, (arg1[0]), x1);
  238|  3.23M|  x4 = (arg2[1]);
  239|  3.23M|  fiat_subborrowx_u64(&x5, &x6, x3, (arg1[1]), x4);
  240|  3.23M|  x7 = (arg2[2]);
  241|  3.23M|  fiat_subborrowx_u64(&x8, &x9, x6, (arg1[2]), x7);
  242|  3.23M|  x10 = (arg2[3]);
  243|  3.23M|  fiat_subborrowx_u64(&x11, &x12, x9, (arg1[3]), x10);
  244|  3.23M|  fiat_cmovznz_u64(&x13, x12, 0x0, UINT8_C(0x26)); // NOTE: clang 14 for Zen 2 uses sbb, and
  245|  3.23M|  fiat_subborrowx_u64(&x14, &x15, 0x0, x2, x13);
  246|  3.23M|  fiat_subborrowx_u64(&x16, &x17, x15, x5, 0x0);
  247|  3.23M|  fiat_subborrowx_u64(&x18, &x19, x17, x8, 0x0);
  248|  3.23M|  fiat_subborrowx_u64(&x20, &x21, x19, x11, 0x0);
  249|  3.23M|  fiat_cmovznz_u64(&x22, x21, 0x0, UINT8_C(0x26)); // NOTE: clang 14 for Zen 2 uses sbb, and
  250|  3.23M|  fiat_subborrowx_u64(&x23, &x24, 0x0, x14, x22);
  251|  3.23M|  out1[0] = x23;
  252|  3.23M|  out1[1] = x16;
  253|  3.23M|  out1[2] = x18;
  254|  3.23M|  out1[3] = x20;
  255|  3.23M|}
curve25519_64_adx.cc:_ZL19fiat_subborrowx_u64PmPhhmm:
  112|  29.4M|static inline void fiat_subborrowx_u64(uint64_t* out1, fiat_uint1* out2, fiat_uint1 arg1, uint64_t arg2, uint64_t arg3) {
  113|  29.4M|#if defined(__has_builtin)
  114|  29.4M|#  if __has_builtin(__builtin_ia32_subborrow_u64)
  115|  29.4M|#    define subborrow64 __builtin_ia32_subborrow_u64
  116|  29.4M|#  endif
  117|  29.4M|#endif
  118|  29.4M|#if defined(subborrow64)
  119|  29.4M|  long long unsigned int t;
  120|  29.4M|  *out2 = subborrow64(arg1, arg2, arg3, &t);
  ------------------
  |  |  115|  29.4M|#    define subborrow64 __builtin_ia32_subborrow_u64
  ------------------
  121|  29.4M|  *out1 = t;
  122|       |#elif defined(_M_X64)
  123|       |  long long unsigned int t;
  124|       |  *out2 = _subborrow_u64(arg1, arg2, arg3, &t); // NOTE: edited after generation
  125|       |  *out1 = t;
  126|       |#else
  127|       |  *out1 = arg2 - arg3 - arg1;
  128|       |  *out2 = (arg2 < arg3) | ((arg2 == arg3) & arg1);
  129|       |#endif
  130|  29.4M|#undef subborrow64
  131|  29.4M|}
curve25519_64_adx.cc:_ZL7fe4_addPmPKmS1_:
  165|  3.23M|static void fe4_add(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) {
  166|  3.23M|  uint64_t x1;
  167|  3.23M|  fiat_uint1 x2;
  168|  3.23M|  uint64_t x3;
  169|  3.23M|  fiat_uint1 x4;
  170|  3.23M|  uint64_t x5;
  171|  3.23M|  fiat_uint1 x6;
  172|  3.23M|  uint64_t x7;
  173|  3.23M|  fiat_uint1 x8;
  174|  3.23M|  uint64_t x9;
  175|  3.23M|  uint64_t x10;
  176|  3.23M|  fiat_uint1 x11;
  177|  3.23M|  uint64_t x12;
  178|  3.23M|  fiat_uint1 x13;
  179|  3.23M|  uint64_t x14;
  180|  3.23M|  fiat_uint1 x15;
  181|  3.23M|  uint64_t x16;
  182|  3.23M|  fiat_uint1 x17;
  183|  3.23M|  uint64_t x18;
  184|  3.23M|  uint64_t x19;
  185|  3.23M|  fiat_uint1 x20;
  186|  3.23M|  fiat_addcarryx_u64(&x1, &x2, 0x0, (arg1[0]), (arg2[0]));
  187|  3.23M|  fiat_addcarryx_u64(&x3, &x4, x2, (arg1[1]), (arg2[1]));
  188|  3.23M|  fiat_addcarryx_u64(&x5, &x6, x4, (arg1[2]), (arg2[2]));
  189|  3.23M|  fiat_addcarryx_u64(&x7, &x8, x6, (arg1[3]), (arg2[3]));
  190|  3.23M|  fiat_cmovznz_u64(&x9, x8, 0x0, UINT8_C(0x26)); // NOTE: clang 14 for Zen 2 uses sbb, and
  191|  3.23M|  fiat_addcarryx_u64(&x10, &x11, 0x0, x1, x9);
  192|  3.23M|  fiat_addcarryx_u64(&x12, &x13, x11, x3, 0x0);
  193|  3.23M|  fiat_addcarryx_u64(&x14, &x15, x13, x5, 0x0);
  194|  3.23M|  fiat_addcarryx_u64(&x16, &x17, x15, x7, 0x0);
  195|  3.23M|  fiat_cmovznz_u64(&x18, x17, 0x0, UINT8_C(0x26)); // NOTE: clang 14 for Zen 2 uses sbb, and
  196|  3.23M|  fiat_addcarryx_u64(&x19, &x20, 0x0, x10, x18);
  197|  3.23M|  out1[0] = x19;
  198|  3.23M|  out1[1] = x12;
  199|  3.23M|  out1[2] = x14;
  200|  3.23M|  out1[3] = x16;
  201|  3.23M|}
curve25519_64_adx.cc:_ZL18fiat_addcarryx_u64PmPhhmm:
   70|  29.0M|static inline void fiat_addcarryx_u64(uint64_t* out1, fiat_uint1* out2, fiat_uint1 arg1, uint64_t arg2, uint64_t arg3) {
   71|       |// NOTE: edited after generation
   72|  29.0M|#if defined(__has_builtin)
   73|  29.0M|#  if __has_builtin(__builtin_ia32_addcarryx_u64)
   74|  29.0M|#    define addcarry64 __builtin_ia32_addcarryx_u64
   75|  29.0M|#  endif
   76|  29.0M|#endif
   77|  29.0M|#if defined(addcarry64)
   78|  29.0M|  long long unsigned int t;
   79|  29.0M|  *out2 = addcarry64(arg1, arg2, arg3, &t);
  ------------------
  |  |   74|  29.0M|#    define addcarry64 __builtin_ia32_addcarryx_u64
  ------------------
   80|  29.0M|  *out1 = t;
   81|       |#elif defined(_M_X64)
   82|       |  long long unsigned int t;
   83|       |  *out2 = _addcarry_u64(arg1, arg2, arg3, out1);
   84|       |  *out1 = t;
   85|       |#else
   86|       |  arg2 += arg1;
   87|       |  arg1 = arg2 < arg1;
   88|       |  uint64_t ret = arg2 + arg3;
   89|       |  arg1 += ret < arg2;
   90|       |  *out1 = ret;
   91|       |  *out2 = arg1;
   92|       |#endif
   93|  29.0M|#undef addcarry64
   94|  29.0M|}
curve25519_64_adx.cc:_ZL7fe4_mulPmPKmS1_:
   18|  5.55M|static inline void fe4_mul(fe4 out, const fe4 x, const fe4 y) { fiat_curve25519_adx_mul(out, x, y); }
curve25519_64_adx.cc:_ZL6fe4_sqPmPKm:
   21|   192k|static inline void fe4_sq(fe4 out, const fe4 x) { fiat_curve25519_adx_square(out, x); }
curve25519_64_adx.cc:_ZL9fe4_canonPmPKm:
  320|  48.2k|static void fe4_canon(uint64_t out1[4], const uint64_t arg1[4]) {
  321|  48.2k|  uint64_t x1;
  322|  48.2k|  fiat_uint1 x2;
  323|  48.2k|  uint64_t x3;
  324|  48.2k|  fiat_uint1 x4;
  325|  48.2k|  uint64_t x5;
  326|  48.2k|  fiat_uint1 x6;
  327|  48.2k|  uint64_t x7;
  328|  48.2k|  fiat_uint1 x8;
  329|  48.2k|  uint64_t x9;
  330|  48.2k|  uint64_t x10;
  331|  48.2k|  uint64_t x11;
  332|  48.2k|  uint64_t x12;
  333|  48.2k|  uint64_t x13;
  334|  48.2k|  fiat_uint1 x14;
  335|  48.2k|  uint64_t x15;
  336|  48.2k|  fiat_uint1 x16;
  337|  48.2k|  uint64_t x17;
  338|  48.2k|  fiat_uint1 x18;
  339|  48.2k|  uint64_t x19;
  340|  48.2k|  fiat_uint1 x20;
  341|  48.2k|  uint64_t x21;
  342|  48.2k|  uint64_t x22;
  343|  48.2k|  uint64_t x23;
  344|  48.2k|  uint64_t x24;
  345|  48.2k|  fiat_subborrowx_u64(&x1, &x2, 0x0, (arg1[0]), UINT64_C(0xffffffffffffffed));
  346|  48.2k|  fiat_subborrowx_u64(&x3, &x4, x2, (arg1[1]), UINT64_C(0xffffffffffffffff));
  347|  48.2k|  fiat_subborrowx_u64(&x5, &x6, x4, (arg1[2]), UINT64_C(0xffffffffffffffff));
  348|  48.2k|  fiat_subborrowx_u64(&x7, &x8, x6, (arg1[3]), UINT64_C(0x7fffffffffffffff));
  349|  48.2k|  fiat_cmovznz_u64(&x9, x8, x1, (arg1[0]));
  350|  48.2k|  fiat_cmovznz_u64(&x10, x8, x3, (arg1[1]));
  351|  48.2k|  fiat_cmovznz_u64(&x11, x8, x5, (arg1[2]));
  352|  48.2k|  fiat_cmovznz_u64(&x12, x8, x7, (arg1[3]));
  353|  48.2k|  fiat_subborrowx_u64(&x13, &x14, 0x0, x9, UINT64_C(0xffffffffffffffed));
  354|  48.2k|  fiat_subborrowx_u64(&x15, &x16, x14, x10, UINT64_C(0xffffffffffffffff));
  355|  48.2k|  fiat_subborrowx_u64(&x17, &x18, x16, x11, UINT64_C(0xffffffffffffffff));
  356|  48.2k|  fiat_subborrowx_u64(&x19, &x20, x18, x12, UINT64_C(0x7fffffffffffffff));
  357|  48.2k|  fiat_cmovznz_u64(&x21, x20, x13, x9);
  358|  48.2k|  fiat_cmovznz_u64(&x22, x20, x15, x10);
  359|  48.2k|  fiat_cmovznz_u64(&x23, x20, x17, x11);
  360|  48.2k|  fiat_cmovznz_u64(&x24, x20, x19, x12);
  361|  48.2k|  out1[0] = x21;
  362|  48.2k|  out1[1] = x22;
  363|  48.2k|  out1[2] = x23;
  364|  48.2k|  out1[3] = x24;
  365|  48.2k|}
curve25519_64_adx.cc:_ZL14table_select_4P12ge_precomp_4ia:
  609|   771k|                                  const signed char b) {
  610|   771k|  uint8_t bnegative = constant_time_msb_w(b);
  611|   771k|  uint8_t babs = b - ((bnegative & b) << 1);
  612|       |
  613|   771k|  uint8_t t_bytes[3][32] = {
  614|   771k|    {static_cast<uint8_t>(constant_time_is_zero_w(b) & 1)},
  615|   771k|    {static_cast<uint8_t>(constant_time_is_zero_w(b) & 1)},
  616|   771k|    {0},
  617|   771k|  };
  618|   771k|#if defined(__clang__)
  619|   771k|  __asm__("" : "+m" (t_bytes) : /*no inputs*/);
  620|   771k|#endif
  621|   771k|  static_assert(sizeof(t_bytes) == sizeof(k25519Precomp[pos][0]), "");
  622|  6.94M|  for (int i = 0; i < 8; i++) {
  ------------------
  |  Branch (622:19): [True: 6.17M, False: 771k]
  ------------------
  623|  6.17M|    constant_time_conditional_memxor(t_bytes, k25519Precomp[pos][i],
  624|  6.17M|                                     sizeof(t_bytes),
  625|  6.17M|                                     constant_time_eq_w(babs, 1 + i));
  626|  6.17M|  }
  627|       |
  628|   771k|  static_assert(sizeof(t_bytes) == sizeof(ge_precomp_4), "");
  629|       |
  630|       |  // fe4 uses saturated 64-bit limbs, so converting from bytes is just a copy.
  631|   771k|  OPENSSL_memcpy(t, t_bytes, sizeof(ge_precomp_4));
  632|       |
  633|   771k|  fe4 xy2d_neg = {0};
  634|   771k|  fe4_sub(xy2d_neg, xy2d_neg, t->xy2d);
  635|   771k|  constant_time_conditional_memcpy(t->yplusx, t_bytes[1], sizeof(fe4),
  636|   771k|                                   bnegative);
  637|   771k|  constant_time_conditional_memcpy(t->yminusx, t_bytes[0], sizeof(fe4),
  638|   771k|                                   bnegative);
  639|   771k|  constant_time_conditional_memcpy(t->xy2d, xy2d_neg, sizeof(fe4), bnegative);
  640|   771k|}
curve25519_64_adx.cc:_ZL22ge_p3_add_p3_precomp_4P7ge_p3_4PKS_PK12ge_precomp_4:
  587|   771k|ge_p3_add_p3_precomp_4(ge_p3_4 *r, const ge_p3_4 *p, const ge_precomp_4 *q) {
  588|   771k|  fe4 A, B, C, YplusX, YminusX, D, X3, Y3, Z3, T3;
  589|       |  // Transcribed from a Coq function proven against affine coordinates.
  590|       |  // https://github.com/mit-plv/fiat-crypto/blob/a36568d1d73aff5d7accc79fd28be672882f9c17/src/Curves/Edwards/XYZT/Precomputed.v#L38-L56
  591|   771k|  fe4_add(YplusX, p->Y, p->X);
  592|   771k|  fe4_sub(YminusX, p->Y, p->X);
  593|   771k|  fe4_mul(A, YplusX, q->yplusx);
  594|   771k|  fe4_mul(B, YminusX, q->yminusx);
  595|   771k|  fe4_mul(C, q->xy2d, p->T);
  596|   771k|  fe4_add(D, p->Z, p->Z);
  597|   771k|  fe4_sub(X3, A, B);
  598|   771k|  fe4_add(Y3, A, B);
  599|   771k|  fe4_add(Z3, D, C);
  600|   771k|  fe4_sub(T3, D, C);
  601|   771k|  fe4_mul(r->X, X3, T3);
  602|   771k|  fe4_mul(r->Y, Y3, Z3);
  603|   771k|  fe4_mul(r->Z, Z3, T3);
  604|   771k|  fe4_mul(r->T, X3, Y3);
  605|   771k|}
curve25519_64_adx.cc:_ZL22inline_x25519_ge_dbl_4P7ge_p3_4PKS_b:
  562|  48.2k|static void inline_x25519_ge_dbl_4(ge_p3_4 *r, const ge_p3_4 *p, bool skip_t) {
  563|       |  // Transcribed from a Coq function proven against affine coordinates.
  564|       |  // https://github.com/mit-plv/fiat-crypto/blob/9943ba9e7d8f3e1c0054b2c94a5edca46ea73ef8/src/Curves/Edwards/XYZT/Basic.v#L136-L165
  565|  48.2k|  fe4 trX, trZ, trT, t0, cX, cY, cZ, cT;
  566|  48.2k|  fe4_sq(trX, p->X);
  567|  48.2k|  fe4_sq(trZ, p->Y);
  568|  48.2k|  fe4_sq(trT, p->Z);
  569|  48.2k|  fe4_add(trT, trT, trT);
  570|  48.2k|  fe4_add(cY, p->X, p->Y);
  571|  48.2k|  fe4_sq(t0, cY);
  572|  48.2k|  fe4_add(cY, trZ, trX);
  573|  48.2k|  fe4_sub(cZ, trZ, trX);
  574|  48.2k|  fe4_sub(cX, t0, cY);
  575|  48.2k|  fe4_sub(cT, trT, cZ);
  576|  48.2k|  fe4_mul(r->X, cX, cT);
  577|  48.2k|  fe4_mul(r->Y, cY, cZ);
  578|  48.2k|  fe4_mul(r->Z, cZ, cT);
  579|  48.2k|  if (!skip_t) {
  ------------------
  |  Branch (579:7): [True: 12.0k, False: 36.1k]
  ------------------
  580|  12.0k|    fe4_mul(r->T, cX, cY);
  581|  12.0k|  }
  582|  48.2k|}

