asn1_generalizedtime_to_tm:
   22|  8.64k|{
   23|       |    /* wrapper around asn1_time_to_tm */
   24|  8.64k|    if (d->type != V_ASN1_GENERALIZEDTIME)
  ------------------
  |  |   71|  8.64k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (24:9): [True: 0, False: 8.64k]
  ------------------
   25|      0|        return 0;
   26|  8.64k|    return asn1_time_to_tm(tm, d);
   27|  8.64k|}
ASN1_GENERALIZEDTIME_check:
   30|  8.64k|{
   31|  8.64k|    return asn1_generalizedtime_to_tm(NULL, d);
   32|  8.64k|}
ASN1_GENERALIZEDTIME_set_string:
   35|  8.64k|{
   36|  8.64k|    ASN1_GENERALIZEDTIME t;
   37|       |
   38|  8.64k|    t.type = V_ASN1_GENERALIZEDTIME;
  ------------------
  |  |   71|  8.64k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
   39|  8.64k|    t.length = strlen(str);
   40|  8.64k|    t.data = (unsigned char *)str;
   41|  8.64k|    t.flags = 0;
   42|       |
   43|  8.64k|    if (!ASN1_GENERALIZEDTIME_check(&t))
  ------------------
  |  Branch (43:9): [True: 3.21k, False: 5.42k]
  ------------------
   44|  3.21k|        return 0;
   45|       |
   46|  5.42k|    if (s != NULL && !ASN1_STRING_copy(s, &t))
  ------------------
  |  Branch (46:9): [True: 5.42k, False: 0]
  |  Branch (46:22): [True: 0, False: 5.42k]
  ------------------
   47|      0|        return 0;
   48|       |
   49|  5.42k|    return 1;
   50|  5.42k|}
ASN1_GENERALIZEDTIME_adj:
   61|  8.64k|{
   62|  8.64k|    struct tm *ts;
   63|  8.64k|    struct tm data;
   64|       |
   65|  8.64k|    ts = OPENSSL_gmtime(&t, &data);
   66|  8.64k|    if (ts == NULL)
  ------------------
  |  Branch (66:9): [True: 0, False: 8.64k]
  ------------------
   67|      0|        return NULL;
   68|       |
   69|  8.64k|    if (offset_day || offset_sec) {
  ------------------
  |  Branch (69:9): [True: 6.67k, False: 1.96k]
  |  Branch (69:23): [True: 1.18k, False: 780]
  ------------------
   70|  7.86k|        if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
  ------------------
  |  Branch (70:13): [True: 3.21k, False: 4.64k]
  ------------------
   71|  3.21k|            return NULL;
   72|  7.86k|    }
   73|       |
   74|  5.42k|    return asn1_time_from_tm(s, ts, V_ASN1_GENERALIZEDTIME);
  ------------------
  |  |   71|  5.42k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
   75|  8.64k|}
ASN1_GENERALIZEDTIME_print:
   78|  5.42k|{
   79|  5.42k|    if (tm->type != V_ASN1_GENERALIZEDTIME)
  ------------------
  |  |   71|  5.42k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (79:9): [True: 0, False: 5.42k]
  ------------------
   80|      0|        return 0;
   81|  5.42k|    return ASN1_TIME_print(bp, tm);
   82|  5.42k|}

asn1_time_to_tm:
   75|  14.0k|{
   76|  14.0k|    static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
   77|  14.0k|    static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
   78|  14.0k|    static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
   79|  14.0k|    char *a;
   80|  14.0k|    int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md;
   81|  14.0k|    struct tm tmp;
   82|       |#if defined(CHARSET_EBCDIC)
   83|       |    const char upper_z = 0x5A, num_zero = 0x30, period = 0x2E, minus = 0x2D, plus = 0x2B;
   84|       |#else
   85|  14.0k|    const char upper_z = 'Z', num_zero = '0', period = '.', minus = '-', plus = '+';
   86|  14.0k|#endif
   87|       |    /*
   88|       |     * ASN1_STRING_FLAG_X509_TIME is used to enforce RFC 5280
   89|       |     * time string format, in which:
   90|       |     *
   91|       |     * 1. "seconds" is a 'MUST'
   92|       |     * 2. "Zulu" timezone is a 'MUST'
   93|       |     * 3. "+|-" is not allowed to indicate a time zone
   94|       |     */
   95|  14.0k|    if (d->type == V_ASN1_UTCTIME) {
  ------------------
  |  |   70|  14.0k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (95:9): [True: 0, False: 14.0k]
  ------------------
   96|      0|        if (d->flags & ASN1_STRING_FLAG_X509_TIME) {
  ------------------
  |  |  144|      0|# define ASN1_STRING_FLAG_X509_TIME 0x100
  ------------------
  |  Branch (96:13): [True: 0, False: 0]
  ------------------
   97|      0|            min_l = 13;
   98|      0|            strict = 1;
   99|      0|        }
  100|  14.0k|    } else if (d->type == V_ASN1_GENERALIZEDTIME) {
  ------------------
  |  |   71|  14.0k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (100:16): [True: 14.0k, False: 0]
  ------------------
  101|  14.0k|        end = 7;
  102|  14.0k|        btz = 6;
  103|  14.0k|        if (d->flags & ASN1_STRING_FLAG_X509_TIME) {
  ------------------
  |  |  144|  14.0k|# define ASN1_STRING_FLAG_X509_TIME 0x100
  ------------------
  |  Branch (103:13): [True: 0, False: 14.0k]
  ------------------
  104|      0|            min_l = 15;
  105|      0|            strict = 1;
  106|  14.0k|        } else {
  107|  14.0k|            min_l = 13;
  108|  14.0k|        }
  109|  14.0k|    } else {
  110|      0|        return 0;
  111|      0|    }
  112|       |
  113|  14.0k|    l = d->length;
  114|  14.0k|    a = (char *)d->data;
  115|  14.0k|    o = 0;
  116|  14.0k|    memset(&tmp, 0, sizeof(tmp));
  117|       |
  118|       |    /*
  119|       |     * GENERALIZEDTIME is similar to UTCTIME except the year is represented
  120|       |     * as YYYY. This stuff treats everything as a two digit field so make
  121|       |     * first two fields 00 to 99
  122|       |     */
  123|       |
  124|  14.0k|    if (l < min_l)
  ------------------
  |  Branch (124:9): [True: 3.21k, False: 10.8k]
  ------------------
  125|  3.21k|        goto err;
  126|  86.8k|    for (i = 0; i < end; i++) {
  ------------------
  |  Branch (126:17): [True: 75.9k, False: 10.8k]
  ------------------
  127|  75.9k|        if (!strict && (i == btz) && ((a[o] == upper_z) || (a[o] == plus) || (a[o] == minus))) {
  ------------------
  |  Branch (127:13): [True: 75.9k, False: 0]
  |  Branch (127:24): [True: 10.8k, False: 65.1k]
  |  Branch (127:39): [True: 0, False: 10.8k]
  |  Branch (127:60): [True: 0, False: 10.8k]
  |  Branch (127:78): [True: 0, False: 10.8k]
  ------------------
  128|      0|            i++;
  129|      0|            break;
  130|      0|        }
  131|  75.9k|        if (!ascii_isdigit(a[o]))
  ------------------
  |  Branch (131:13): [True: 0, False: 75.9k]
  ------------------
  132|      0|            goto err;
  133|  75.9k|        n = a[o] - num_zero;
  134|       |        /* incomplete 2-digital number */
  135|  75.9k|        if (++o == l)
  ------------------
  |  Branch (135:13): [True: 0, False: 75.9k]
  ------------------
  136|      0|            goto err;
  137|       |
  138|  75.9k|        if (!ascii_isdigit(a[o]))
  ------------------
  |  Branch (138:13): [True: 0, False: 75.9k]
  ------------------
  139|      0|            goto err;
  140|  75.9k|        n = (n * 10) + a[o] - num_zero;
  141|       |        /* no more bytes to read, but we haven't seen time-zone yet */
  142|  75.9k|        if (++o == l)
  ------------------
  |  Branch (142:13): [True: 0, False: 75.9k]
  ------------------
  143|      0|            goto err;
  144|       |
  145|  75.9k|        i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
  ------------------
  |  |   70|  75.9k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (145:14): [True: 0, False: 75.9k]
  ------------------
  146|       |
  147|  75.9k|        if ((n < min[i2]) || (n > max[i2]))
  ------------------
  |  Branch (147:13): [True: 0, False: 75.9k]
  |  Branch (147:30): [True: 0, False: 75.9k]
  ------------------
  148|      0|            goto err;
  149|  75.9k|        switch (i2) {
  ------------------
  |  Branch (149:17): [True: 0, False: 75.9k]
  ------------------
  150|  10.8k|        case 0:
  ------------------
  |  Branch (150:9): [True: 10.8k, False: 65.1k]
  ------------------
  151|       |            /* UTC will never be here */
  152|  10.8k|            tmp.tm_year = n * 100 - 1900;
  153|  10.8k|            break;
  154|  10.8k|        case 1:
  ------------------
  |  Branch (154:9): [True: 10.8k, False: 65.1k]
  ------------------
  155|  10.8k|            if (d->type == V_ASN1_UTCTIME)
  ------------------
  |  |   70|  10.8k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (155:17): [True: 0, False: 10.8k]
  ------------------
  156|      0|                tmp.tm_year = n < 50 ? n + 100 : n;
  ------------------
  |  Branch (156:31): [True: 0, False: 0]
  ------------------
  157|  10.8k|            else
  158|  10.8k|                tmp.tm_year += n;
  159|  10.8k|            break;
  160|  10.8k|        case 2:
  ------------------
  |  Branch (160:9): [True: 10.8k, False: 65.1k]
  ------------------
  161|  10.8k|            tmp.tm_mon = n - 1;
  162|  10.8k|            break;
  163|  10.8k|        case 3:
  ------------------
  |  Branch (163:9): [True: 10.8k, False: 65.1k]
  ------------------
  164|       |            /* check if tm_mday is valid in tm_mon */
  165|  10.8k|            if (tmp.tm_mon == 1) {
  ------------------
  |  Branch (165:17): [True: 2.65k, False: 8.19k]
  ------------------
  166|       |                /* it's February */
  167|  2.65k|                md = mdays[1] + leap_year(tmp.tm_year + 1900);
  168|  8.19k|            } else {
  169|  8.19k|                md = mdays[tmp.tm_mon];
  170|  8.19k|            }
  171|  10.8k|            if (n > md)
  ------------------
  |  Branch (171:17): [True: 0, False: 10.8k]
  ------------------
  172|      0|                goto err;
  173|  10.8k|            tmp.tm_mday = n;
  174|  10.8k|            determine_days(&tmp);
  175|  10.8k|            break;
  176|  10.8k|        case 4:
  ------------------
  |  Branch (176:9): [True: 10.8k, False: 65.1k]
  ------------------
  177|  10.8k|            tmp.tm_hour = n;
  178|  10.8k|            break;
  179|  10.8k|        case 5:
  ------------------
  |  Branch (179:9): [True: 10.8k, False: 65.1k]
  ------------------
  180|  10.8k|            tmp.tm_min = n;
  181|  10.8k|            break;
  182|  10.8k|        case 6:
  ------------------
  |  Branch (182:9): [True: 10.8k, False: 65.1k]
  ------------------
  183|  10.8k|            tmp.tm_sec = n;
  184|  10.8k|            break;
  185|  75.9k|        }
  186|  75.9k|    }
  187|       |
  188|       |    /*
  189|       |     * Optional fractional seconds: decimal point followed by one or more
  190|       |     * digits.
  191|       |     */
  192|  10.8k|    if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == period) {
  ------------------
  |  |   71|  21.7k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (192:9): [True: 10.8k, False: 0]
  |  Branch (192:46): [True: 10.8k, False: 0]
  ------------------
  193|  10.8k|        if (strict)
  ------------------
  |  Branch (193:13): [True: 0, False: 10.8k]
  ------------------
  194|       |            /* RFC 5280 forbids fractional seconds */
  195|      0|            goto err;
  196|  10.8k|        if (++o == l)
  ------------------
  |  Branch (196:13): [True: 0, False: 10.8k]
  ------------------
  197|      0|            goto err;
  198|  10.8k|        i = o;
  199|  43.4k|        while ((o < l) && ascii_isdigit(a[o]))
  ------------------
  |  Branch (199:16): [True: 43.4k, False: 0]
  |  Branch (199:27): [True: 32.5k, False: 10.8k]
  ------------------
  200|  32.5k|            o++;
  201|       |        /* Must have at least one digit after decimal point */
  202|  10.8k|        if (i == o)
  ------------------
  |  Branch (202:13): [True: 0, False: 10.8k]
  ------------------
  203|      0|            goto err;
  204|       |        /* no more bytes to read, but we haven't seen time-zone yet */
  205|  10.8k|        if (o == l)
  ------------------
  |  Branch (205:13): [True: 0, False: 10.8k]
  ------------------
  206|      0|            goto err;
  207|  10.8k|    }
  208|       |
  209|       |    /*
  210|       |     * 'o' will never point to '\0' at this point, the only chance
  211|       |     * 'o' can point to '\0' is either the subsequent if or the first
  212|       |     * else if is true.
  213|       |     */
  214|  10.8k|    if (a[o] == upper_z) {
  ------------------
  |  Branch (214:9): [True: 10.8k, False: 0]
  ------------------
  215|  10.8k|        o++;
  216|  10.8k|    } else if (!strict && ((a[o] == plus) || (a[o] == minus))) {
  ------------------
  |  Branch (216:16): [True: 0, False: 0]
  |  Branch (216:28): [True: 0, False: 0]
  |  Branch (216:46): [True: 0, False: 0]
  ------------------
  217|      0|        int offsign = a[o] == minus ? 1 : -1;
  ------------------
  |  Branch (217:23): [True: 0, False: 0]
  ------------------
  218|      0|        int offset = 0;
  219|       |
  220|      0|        o++;
  221|       |        /*
  222|       |         * if not equal, no need to do subsequent checks
  223|       |         * since the following for-loop will add 'o' by 4
  224|       |         * and the final return statement will check if 'l'
  225|       |         * and 'o' are equal.
  226|       |         */
  227|      0|        if (o + 4 != l)
  ------------------
  |  Branch (227:13): [True: 0, False: 0]
  ------------------
  228|      0|            goto err;
  229|      0|        for (i = end; i < end + 2; i++) {
  ------------------
  |  Branch (229:23): [True: 0, False: 0]
  ------------------
  230|      0|            if (!ascii_isdigit(a[o]))
  ------------------
  |  Branch (230:17): [True: 0, False: 0]
  ------------------
  231|      0|                goto err;
  232|      0|            n = a[o] - num_zero;
  233|      0|            o++;
  234|      0|            if (!ascii_isdigit(a[o]))
  ------------------
  |  Branch (234:17): [True: 0, False: 0]
  ------------------
  235|      0|                goto err;
  236|      0|            n = (n * 10) + a[o] - num_zero;
  237|      0|            i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
  ------------------
  |  |   70|      0|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (237:18): [True: 0, False: 0]
  ------------------
  238|      0|            if ((n < min[i2]) || (n > max[i2]))
  ------------------
  |  Branch (238:17): [True: 0, False: 0]
  |  Branch (238:34): [True: 0, False: 0]
  ------------------
  239|      0|                goto err;
  240|       |            /* if tm is NULL, no need to adjust */
  241|      0|            if (tm != NULL) {
  ------------------
  |  Branch (241:17): [True: 0, False: 0]
  ------------------
  242|      0|                if (i == end)
  ------------------
  |  Branch (242:21): [True: 0, False: 0]
  ------------------
  243|      0|                    offset = n * 3600;
  244|      0|                else if (i == end + 1)
  ------------------
  |  Branch (244:26): [True: 0, False: 0]
  ------------------
  245|      0|                    offset += n * 60;
  246|      0|            }
  247|      0|            o++;
  248|      0|        }
  249|      0|        if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign))
  ------------------
  |  Branch (249:13): [True: 0, False: 0]
  |  Branch (249:23): [True: 0, False: 0]
  ------------------
  250|      0|            goto err;
  251|      0|    } else {
  252|       |        /* not Z, or not +/- in non-strict mode */
  253|      0|        goto err;
  254|      0|    }
  255|  10.8k|    if (o == l) {
  ------------------
  |  Branch (255:9): [True: 10.8k, False: 0]
  ------------------
  256|       |        /* success, check if tm should be filled */
  257|  10.8k|        if (tm != NULL)
  ------------------
  |  Branch (257:13): [True: 5.42k, False: 5.42k]
  ------------------
  258|  5.42k|            *tm = tmp;
  259|  10.8k|        return 1;
  260|  10.8k|    }
  261|  3.21k| err:
  262|  3.21k|    return 0;
  263|  10.8k|}
asn1_time_from_tm:
  266|  5.42k|{
  267|  5.42k|    char* p;
  268|  5.42k|    ASN1_TIME *tmps = NULL;
  269|  5.42k|    const size_t len = 20;
  270|       |
  271|  5.42k|    if (type == V_ASN1_UNDEF) {
  ------------------
  |  |   48|  5.42k|# define V_ASN1_UNDEF                    -1
  ------------------
  |  Branch (271:9): [True: 0, False: 5.42k]
  ------------------
  272|      0|        if (is_utc(ts->tm_year))
  ------------------
  |  Branch (272:13): [True: 0, False: 0]
  ------------------
  273|      0|            type = V_ASN1_UTCTIME;
  ------------------
  |  |   70|      0|# define V_ASN1_UTCTIME                  23
  ------------------
  274|      0|        else
  275|      0|            type = V_ASN1_GENERALIZEDTIME;
  ------------------
  |  |   71|      0|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  276|  5.42k|    } else if (type == V_ASN1_UTCTIME) {
  ------------------
  |  |   70|  5.42k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (276:16): [True: 0, False: 5.42k]
  ------------------
  277|      0|        if (!is_utc(ts->tm_year))
  ------------------
  |  Branch (277:13): [True: 0, False: 0]
  ------------------
  278|      0|            goto err;
  279|  5.42k|    } else if (type != V_ASN1_GENERALIZEDTIME) {
  ------------------
  |  |   71|  5.42k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (279:16): [True: 0, False: 5.42k]
  ------------------
  280|      0|        goto err;
  281|      0|    }
  282|       |
  283|  5.42k|    if (s == NULL)
  ------------------
  |  Branch (283:9): [True: 0, False: 5.42k]
  ------------------
  284|      0|        tmps = ASN1_STRING_new();
  285|  5.42k|    else
  286|  5.42k|        tmps = s;
  287|  5.42k|    if (tmps == NULL)
  ------------------
  |  Branch (287:9): [True: 0, False: 5.42k]
  ------------------
  288|      0|        return NULL;
  289|       |
  290|  5.42k|    if (!ASN1_STRING_set(tmps, NULL, len))
  ------------------
  |  Branch (290:9): [True: 0, False: 5.42k]
  ------------------
  291|      0|        goto err;
  292|       |
  293|  5.42k|    tmps->type = type;
  294|  5.42k|    p = (char*)tmps->data;
  295|       |
  296|  5.42k|    if (type == V_ASN1_GENERALIZEDTIME)
  ------------------
  |  |   71|  5.42k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (296:9): [True: 5.42k, False: 0]
  ------------------
  297|  5.42k|        tmps->length = BIO_snprintf(p, len, "%04d%02d%02d%02d%02d%02dZ",
  298|  5.42k|                                    ts->tm_year + 1900, ts->tm_mon + 1,
  299|  5.42k|                                    ts->tm_mday, ts->tm_hour, ts->tm_min,
  300|  5.42k|                                    ts->tm_sec);
  301|      0|    else
  302|      0|        tmps->length = BIO_snprintf(p, len, "%02d%02d%02d%02d%02d%02dZ",
  303|      0|                                    ts->tm_year % 100, ts->tm_mon + 1,
  304|      0|                                    ts->tm_mday, ts->tm_hour, ts->tm_min,
  305|      0|                                    ts->tm_sec);
  306|       |
  307|       |#ifdef CHARSET_EBCDIC
  308|       |    ebcdic2ascii(tmps->data, tmps->data, tmps->length);
  309|       |#endif
  310|  5.42k|    return tmps;
  311|      0| err:
  312|      0|    if (tmps != s)
  ------------------
  |  Branch (312:9): [True: 0, False: 0]
  ------------------
  313|      0|        ASN1_STRING_free(tmps);
  314|      0|    return NULL;
  315|  5.42k|}
ASN1_TIME_print:
  470|  5.42k|{
  471|  5.42k|    char *v;
  472|  5.42k|    int gmt = 0, l;
  473|  5.42k|    struct tm stm;
  474|  5.42k|    const char upper_z = 0x5A, period = 0x2E;
  475|       |
  476|  5.42k|    if (!asn1_time_to_tm(&stm, tm)) {
  ------------------
  |  Branch (476:9): [True: 0, False: 5.42k]
  ------------------
  477|       |        /* asn1_time_to_tm will check the time type */
  478|      0|        goto err;
  479|      0|    }
  480|       |
  481|  5.42k|    l = tm->length;
  482|  5.42k|    v = (char *)tm->data;
  483|  5.42k|    if (v[l - 1] == upper_z)
  ------------------
  |  Branch (483:9): [True: 5.42k, False: 0]
  ------------------
  484|  5.42k|        gmt = 1;
  485|       |
  486|  5.42k|    if (tm->type == V_ASN1_GENERALIZEDTIME) {
  ------------------
  |  |   71|  5.42k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (486:9): [True: 5.42k, False: 0]
  ------------------
  487|  5.42k|        char *f = NULL;
  488|  5.42k|        int f_len = 0;
  489|       |
  490|       |        /*
  491|       |         * Try to parse fractional seconds. '14' is the place of
  492|       |         * 'fraction point' in a GeneralizedTime string.
  493|       |         */
  494|  5.42k|        if (tm->length > 15 && v[14] == period) {
  ------------------
  |  Branch (494:13): [True: 5.42k, False: 0]
  |  Branch (494:32): [True: 5.42k, False: 0]
  ------------------
  495|  5.42k|            f = &v[14];
  496|  5.42k|            f_len = 1;
  497|  21.7k|            while (14 + f_len < l && ascii_isdigit(f[f_len]))
  ------------------
  |  Branch (497:20): [True: 21.7k, False: 0]
  |  Branch (497:38): [True: 16.2k, False: 5.42k]
  ------------------
  498|  16.2k|                ++f_len;
  499|  5.42k|        }
  500|       |
  501|  5.42k|        return BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
  502|  5.42k|                          _asn1_mon[stm.tm_mon], stm.tm_mday, stm.tm_hour,
  503|  5.42k|                          stm.tm_min, stm.tm_sec, f_len, f, stm.tm_year + 1900,
  504|  5.42k|                          (gmt ? " GMT" : "")) > 0;
  ------------------
  |  Branch (504:28): [True: 5.42k, False: 0]
  ------------------
  505|  5.42k|    } else {
  506|      0|        return BIO_printf(bp, "%s %2d %02d:%02d:%02d %d%s",
  507|      0|                          _asn1_mon[stm.tm_mon], stm.tm_mday, stm.tm_hour,
  508|      0|                          stm.tm_min, stm.tm_sec, stm.tm_year + 1900,
  509|      0|                          (gmt ? " GMT" : "")) > 0;
  ------------------
  |  Branch (509:28): [True: 0, False: 0]
  ------------------
  510|      0|    }
  511|      0| err:
  512|      0|    BIO_write(bp, "Bad time value", 14);
  513|      0|    return 0;
  514|  5.42k|}
a_time.c:leap_year:
   36|  6.47k|{
   37|  6.47k|    if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
  ------------------
  |  Branch (37:9): [True: 470, False: 6.00k]
  |  Branch (37:29): [True: 4.40k, False: 1.60k]
  |  Branch (37:48): [True: 1.46k, False: 2.93k]
  ------------------
   38|  1.93k|        return 1;
   39|  4.54k|    return 0;
   40|  6.47k|}
a_time.c:determine_days:
   49|  10.8k|{
   50|  10.8k|    static const int ydays[12] = {
   51|  10.8k|        0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
   52|  10.8k|    };
   53|  10.8k|    int y = tm->tm_year + 1900;
   54|  10.8k|    int m = tm->tm_mon;
   55|  10.8k|    int d = tm->tm_mday;
   56|  10.8k|    int c;
   57|       |
   58|  10.8k|    tm->tm_yday = ydays[m] + d - 1;
   59|  10.8k|    if (m >= 2) {
  ------------------
  |  Branch (59:9): [True: 3.81k, False: 7.03k]
  ------------------
   60|       |        /* March and onwards can be one day further into the year */
   61|  3.81k|        tm->tm_yday += leap_year(y);
   62|  3.81k|        m += 2;
   63|  7.03k|    } else {
   64|       |        /* Treat January and February as part of the previous year */
   65|  7.03k|        m += 14;
   66|  7.03k|        y--;
   67|  7.03k|    }
   68|  10.8k|    c = y / 100;
   69|  10.8k|    y %= 100;
   70|       |    /* Zeller's congruence */
   71|  10.8k|    tm->tm_wday = (d + (13 * m) / 5 + y + y / 4 + c / 4 + 5 * c + 6) % 7;
   72|  10.8k|}

ERR_load_ASN1_strings:
  344|      2|{
  345|      2|#ifndef OPENSSL_NO_ERR
  346|      2|    if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (346:9): [True: 2, False: 0]
  ------------------
  347|      2|        ERR_load_strings_const(ASN1_str_functs);
  348|      2|        ERR_load_strings_const(ASN1_str_reasons);
  349|      2|    }
  350|      2|#endif
  351|      2|    return 1;
  352|      2|}

ASN1_get_object:
   46|  35.0k|{
   47|  35.0k|    int i, ret;
   48|  35.0k|    long l;
   49|  35.0k|    const unsigned char *p = *pp;
   50|  35.0k|    int tag, xclass, inf;
   51|  35.0k|    long max = omax;
   52|       |
   53|  35.0k|    if (!max)
  ------------------
  |  Branch (53:9): [True: 0, False: 35.0k]
  ------------------
   54|      0|        goto err;
   55|  35.0k|    ret = (*p & V_ASN1_CONSTRUCTED);
  ------------------
  |  |   40|  35.0k|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
   56|  35.0k|    xclass = (*p & V_ASN1_PRIVATE);
  ------------------
  |  |   38|  35.0k|# define V_ASN1_PRIVATE                  0xc0
  ------------------
   57|  35.0k|    i = *p & V_ASN1_PRIMITIVE_TAG;
  ------------------
  |  |   41|  35.0k|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
   58|  35.0k|    if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */
  ------------------
  |  |   41|  35.0k|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
  |  Branch (58:9): [True: 618, False: 34.4k]
  ------------------
   59|    618|        p++;
   60|    618|        if (--max == 0)
  ------------------
  |  Branch (60:13): [True: 2, False: 616]
  ------------------
   61|      2|            goto err;
   62|    616|        l = 0;
   63|  1.23k|        while (*p & 0x80) {
  ------------------
  |  Branch (63:16): [True: 647, False: 588]
  ------------------
   64|    647|            l <<= 7L;
   65|    647|            l |= *(p++) & 0x7f;
   66|    647|            if (--max == 0)
  ------------------
  |  Branch (66:17): [True: 14, False: 633]
  ------------------
   67|     14|                goto err;
   68|    633|            if (l > (INT_MAX >> 7L))
  ------------------
  |  Branch (68:17): [True: 14, False: 619]
  ------------------
   69|     14|                goto err;
   70|    633|        }
   71|    588|        l <<= 7L;
   72|    588|        l |= *(p++) & 0x7f;
   73|    588|        tag = (int)l;
   74|    588|        if (--max == 0)
  ------------------
  |  Branch (74:13): [True: 12, False: 576]
  ------------------
   75|     12|            goto err;
   76|  34.4k|    } else {
   77|  34.4k|        tag = i;
   78|  34.4k|        p++;
   79|  34.4k|        if (--max == 0)
  ------------------
  |  Branch (79:13): [True: 34, False: 34.4k]
  ------------------
   80|     34|            goto err;
   81|  34.4k|    }
   82|  34.9k|    *ptag = tag;
   83|  34.9k|    *pclass = xclass;
   84|  34.9k|    if (!asn1_get_length(&p, &inf, plength, max))
  ------------------
  |  Branch (84:9): [True: 115, False: 34.8k]
  ------------------
   85|    115|        goto err;
   86|       |
   87|  34.8k|    if (inf && !(ret & V_ASN1_CONSTRUCTED))
  ------------------
  |  |   40|  1.28k|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (87:9): [True: 1.28k, False: 33.5k]
  |  Branch (87:16): [True: 4, False: 1.28k]
  ------------------
   88|      4|        goto err;
   89|       |
   90|  34.8k|    if (*plength > (omax - (p - *pp))) {
  ------------------
  |  Branch (90:9): [True: 188, False: 34.6k]
  ------------------
   91|    188|        ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_TOO_LONG);
  ------------------
  |  |  111|    188|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    188|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   92|       |        /*
   93|       |         * Set this so that even if things are not long enough the values are
   94|       |         * set correctly
   95|       |         */
   96|    188|        ret |= 0x80;
   97|    188|    }
   98|  34.8k|    *pp = p;
   99|  34.8k|    return ret | inf;
  100|    195| err:
  101|    195|    ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_HEADER_TOO_LONG);
  ------------------
  |  |  111|    195|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    195|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  102|    195|    return 0x80;
  103|  34.8k|}
ASN1_put_object:
  157|    442|{
  158|    442|    unsigned char *p = *pp;
  159|    442|    int i, ttag;
  160|       |
  161|    442|    i = (constructed) ? V_ASN1_CONSTRUCTED : 0;
  ------------------
  |  |   40|      0|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (161:9): [True: 0, False: 442]
  ------------------
  162|    442|    i |= (xclass & V_ASN1_PRIVATE);
  ------------------
  |  |   38|    442|# define V_ASN1_PRIVATE                  0xc0
  ------------------
  163|    442|    if (tag < 31)
  ------------------
  |  Branch (163:9): [True: 442, False: 0]
  ------------------
  164|    442|        *(p++) = i | (tag & V_ASN1_PRIMITIVE_TAG);
  ------------------
  |  |   41|    442|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
  165|      0|    else {
  166|      0|        *(p++) = i | V_ASN1_PRIMITIVE_TAG;
  ------------------
  |  |   41|      0|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
  167|      0|        for (i = 0, ttag = tag; ttag > 0; i++)
  ------------------
  |  Branch (167:33): [True: 0, False: 0]
  ------------------
  168|      0|            ttag >>= 7;
  169|      0|        ttag = i;
  170|      0|        while (i-- > 0) {
  ------------------
  |  Branch (170:16): [True: 0, False: 0]
  ------------------
  171|      0|            p[i] = tag & 0x7f;
  172|      0|            if (i != (ttag - 1))
  ------------------
  |  Branch (172:17): [True: 0, False: 0]
  ------------------
  173|      0|                p[i] |= 0x80;
  174|      0|            tag >>= 7;
  175|      0|        }
  176|      0|        p += ttag;
  177|      0|    }
  178|    442|    if (constructed == 2)
  ------------------
  |  Branch (178:9): [True: 0, False: 442]
  ------------------
  179|      0|        *(p++) = 0x80;
  180|    442|    else
  181|    442|        asn1_put_length(&p, length);
  182|    442|    *pp = p;
  183|    442|}
ASN1_object_size:
  216|    884|{
  217|    884|    int ret = 1;
  218|    884|    if (length < 0)
  ------------------
  |  Branch (218:9): [True: 0, False: 884]
  ------------------
  219|      0|        return -1;
  220|    884|    if (tag >= 31) {
  ------------------
  |  Branch (220:9): [True: 0, False: 884]
  ------------------
  221|      0|        while (tag > 0) {
  ------------------
  |  Branch (221:16): [True: 0, False: 0]
  ------------------
  222|      0|            tag >>= 7;
  223|      0|            ret++;
  224|      0|        }
  225|      0|    }
  226|    884|    if (constructed == 2) {
  ------------------
  |  Branch (226:9): [True: 0, False: 884]
  ------------------
  227|      0|        ret += 3;
  228|    884|    } else {
  229|    884|        ret++;
  230|    884|        if (length > 127) {
  ------------------
  |  Branch (230:13): [True: 366, False: 518]
  ------------------
  231|    366|            int tmplen = length;
  232|  1.02k|            while (tmplen > 0) {
  ------------------
  |  Branch (232:20): [True: 656, False: 366]
  ------------------
  233|    656|                tmplen >>= 8;
  234|    656|                ret++;
  235|    656|            }
  236|    366|        }
  237|    884|    }
  238|    884|    if (ret >= INT_MAX - length)
  ------------------
  |  Branch (238:9): [True: 0, False: 884]
  ------------------
  239|      0|        return -1;
  240|    884|    return ret + length;
  241|    884|}
ASN1_STRING_copy:
  244|  5.42k|{
  245|  5.42k|    if (str == NULL)
  ------------------
  |  Branch (245:9): [True: 0, False: 5.42k]
  ------------------
  246|      0|        return 0;
  247|  5.42k|    dst->type = str->type;
  248|  5.42k|    if (!ASN1_STRING_set(dst, str->data, str->length))
  ------------------
  |  Branch (248:9): [True: 0, False: 5.42k]
  ------------------
  249|      0|        return 0;
  250|       |    /* Copy flags but preserve embed value */
  251|  5.42k|    dst->flags &= ASN1_STRING_FLAG_EMBED;
  ------------------
  |  |  142|  5.42k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  252|  5.42k|    dst->flags |= str->flags & ~ASN1_STRING_FLAG_EMBED;
  ------------------
  |  |  142|  5.42k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  253|  5.42k|    return 1;
  254|  5.42k|}
ASN1_STRING_set:
  272|  11.6k|{
  273|  11.6k|    unsigned char *c;
  274|  11.6k|    const char *data = _data;
  275|  11.6k|    size_t len;
  276|       |
  277|  11.6k|    if (len_in < 0) {
  ------------------
  |  Branch (277:9): [True: 0, False: 11.6k]
  ------------------
  278|      0|        if (data == NULL)
  ------------------
  |  Branch (278:13): [True: 0, False: 0]
  ------------------
  279|      0|            return 0;
  280|      0|        len = strlen(data);
  281|  11.6k|    } else {
  282|  11.6k|        len = (size_t)len_in;
  283|  11.6k|    }
  284|       |    /*
  285|       |     * Verify that the length fits within an integer for assignment to
  286|       |     * str->length below.  The additional 1 is subtracted to allow for the
  287|       |     * '\0' terminator even though this isn't strictly necessary.
  288|       |     */
  289|  11.6k|    if (len > INT_MAX - 1) {
  ------------------
  |  Branch (289:9): [True: 0, False: 11.6k]
  ------------------
  290|      0|        ASN1err(0, ASN1_R_TOO_LARGE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  291|      0|        return 0;
  292|      0|    }
  293|  11.6k|    if ((size_t)str->length <= len || str->data == NULL) {
  ------------------
  |  Branch (293:9): [True: 11.6k, False: 0]
  |  Branch (293:39): [True: 0, False: 0]
  ------------------
  294|  11.6k|        c = str->data;
  295|  11.6k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  296|       |        /* No NUL terminator in fuzzing builds */
  297|  11.6k|        str->data = OPENSSL_realloc(c, len != 0 ? len : 1);
  ------------------
  |  |  122|  23.3k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  11.6k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  11.6k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (122:30): [True: 11.6k, False: 1]
  |  |  ------------------
  ------------------
  298|       |#else
  299|       |        str->data = OPENSSL_realloc(c, len + 1);
  300|       |#endif
  301|  11.6k|        if (str->data == NULL) {
  ------------------
  |  Branch (301:13): [True: 0, False: 11.6k]
  ------------------
  302|      0|            ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  303|      0|            str->data = c;
  304|      0|            return 0;
  305|      0|        }
  306|  11.6k|    }
  307|  11.6k|    str->length = len;
  308|  11.6k|    if (data != NULL) {
  ------------------
  |  Branch (308:9): [True: 6.25k, False: 5.42k]
  ------------------
  309|  6.25k|        memcpy(str->data, data, len);
  310|  6.25k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  311|       |        /* Set the unused byte to something non NUL and printable. */
  312|  6.25k|        if (len == 0)
  ------------------
  |  Branch (312:13): [True: 1, False: 6.24k]
  ------------------
  313|      1|            str->data[len] = '~';
  314|       |#else
  315|       |        /*
  316|       |         * Add a NUL terminator. This should not be necessary - but we add it as
  317|       |         * a safety precaution
  318|       |         */
  319|       |        str->data[len] = '\0';
  320|       |#endif
  321|  6.25k|    }
  322|  11.6k|    return 1;
  323|  11.6k|}
ASN1_STRING_type_new:
  338|  9.62k|{
  339|  9.62k|    ASN1_STRING *ret;
  340|       |
  341|  9.62k|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |  120|  9.62k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  9.62k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  9.62k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  342|  9.62k|    if (ret == NULL) {
  ------------------
  |  Branch (342:9): [True: 0, False: 9.62k]
  ------------------
  343|      0|        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  344|      0|        return NULL;
  345|      0|    }
  346|  9.62k|    ret->type = type;
  347|  9.62k|    return ret;
  348|  9.62k|}
asn1_string_embed_free:
  351|  9.62k|{
  352|  9.62k|    if (a == NULL)
  ------------------
  |  Branch (352:9): [True: 0, False: 9.62k]
  ------------------
  353|      0|        return;
  354|  9.62k|    if (!(a->flags & ASN1_STRING_FLAG_NDEF))
  ------------------
  |  |  127|  9.62k|# define ASN1_STRING_FLAG_NDEF 0x010
  ------------------
  |  Branch (354:9): [True: 9.62k, False: 0]
  ------------------
  355|  9.62k|        OPENSSL_free(a->data);
  ------------------
  |  |  128|  9.62k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  9.62k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  9.62k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  356|  9.62k|    if (embed == 0)
  ------------------
  |  Branch (356:9): [True: 9.62k, False: 0]
  ------------------
  357|  9.62k|        OPENSSL_free(a);
  ------------------
  |  |  128|  9.62k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  9.62k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  9.62k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  358|  9.62k|}
ASN1_STRING_free:
  361|  9.62k|{
  362|  9.62k|    if (a == NULL)
  ------------------
  |  Branch (362:9): [True: 0, False: 9.62k]
  ------------------
  363|      0|        return;
  364|  9.62k|    asn1_string_embed_free(a, a->flags & ASN1_STRING_FLAG_EMBED);
  ------------------
  |  |  142|  9.62k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  365|  9.62k|}
ASN1_STRING_get0_data:
  408|  8.64k|{
  409|  8.64k|    return x->data;
  410|  8.64k|}
asn1_lib.c:asn1_get_length:
  114|  34.9k|{
  115|  34.9k|    const unsigned char *p = *pp;
  116|  34.9k|    unsigned long ret = 0;
  117|  34.9k|    int i;
  118|       |
  119|  34.9k|    if (max-- < 1)
  ------------------
  |  Branch (119:9): [True: 0, False: 34.9k]
  ------------------
  120|      0|        return 0;
  121|  34.9k|    if (*p == 0x80) {
  ------------------
  |  Branch (121:9): [True: 1.28k, False: 33.7k]
  ------------------
  122|  1.28k|        *inf = 1;
  123|  1.28k|        p++;
  124|  33.7k|    } else {
  125|  33.7k|        *inf = 0;
  126|  33.7k|        i = *p & 0x7f;
  127|  33.7k|        if (*p++ & 0x80) {
  ------------------
  |  Branch (127:13): [True: 6.51k, False: 27.1k]
  ------------------
  128|  6.51k|            if (max < i + 1)
  ------------------
  |  Branch (128:17): [True: 15, False: 6.49k]
  ------------------
  129|     15|                return 0;
  130|       |            /* Skip leading zeroes */
  131|  7.66k|            while (i > 0 && *p == 0) {
  ------------------
  |  Branch (131:20): [True: 7.41k, False: 249]
  |  Branch (131:29): [True: 1.16k, False: 6.24k]
  ------------------
  132|  1.16k|                p++;
  133|  1.16k|                i--;
  134|  1.16k|            }
  135|  6.49k|            if (i > (int)sizeof(long))
  ------------------
  |  Branch (135:17): [True: 34, False: 6.46k]
  ------------------
  136|     34|                return 0;
  137|  15.1k|            while (i > 0) {
  ------------------
  |  Branch (137:20): [True: 8.67k, False: 6.46k]
  ------------------
  138|  8.67k|                ret <<= 8;
  139|  8.67k|                ret |= *p++;
  140|  8.67k|                i--;
  141|  8.67k|            }
  142|  6.46k|            if (ret > LONG_MAX)
  ------------------
  |  Branch (142:17): [True: 66, False: 6.39k]
  ------------------
  143|     66|                return 0;
  144|  6.46k|        } else
  145|  27.1k|            ret = i;
  146|  33.7k|    }
  147|  34.8k|    *pp = p;
  148|  34.8k|    *rl = (long)ret;
  149|  34.8k|    return 1;
  150|  34.9k|}
asn1_lib.c:asn1_put_length:
  195|    442|{
  196|    442|    unsigned char *p = *pp;
  197|    442|    int i, l;
  198|    442|    if (length <= 127)
  ------------------
  |  Branch (198:9): [True: 259, False: 183]
  ------------------
  199|    259|        *(p++) = (unsigned char)length;
  200|    183|    else {
  201|    183|        l = length;
  202|    511|        for (i = 0; l > 0; i++)
  ------------------
  |  Branch (202:21): [True: 328, False: 183]
  ------------------
  203|    328|            l >>= 8;
  204|    183|        *(p++) = i | 0x80;
  205|    183|        l = i;
  206|    511|        while (i-- > 0) {
  ------------------
  |  Branch (206:16): [True: 328, False: 183]
  ------------------
  207|    328|            p[i] = length & 0xff;
  208|    328|            length >>= 8;
  209|    328|        }
  210|    183|        p += l;
  211|    183|    }
  212|    442|    *pp = p;
  213|    442|}

ASN1_item_d2i:
  108|  1.62k|{
  109|  1.62k|    ASN1_TLC c;
  110|  1.62k|    ASN1_VALUE *ptmpval = NULL;
  111|  1.62k|    if (!pval)
  ------------------
  |  Branch (111:9): [True: 0, False: 1.62k]
  ------------------
  112|      0|        pval = &ptmpval;
  113|  1.62k|    asn1_tlc_clear_nc(&c);
  ------------------
  |  |   96|  1.62k|#define asn1_tlc_clear_nc(c)    (c)->valid = 0
  ------------------
  114|  1.62k|    if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
  ------------------
  |  Branch (114:9): [True: 986, False: 637]
  ------------------
  115|    986|        return *pval;
  116|    637|    return NULL;
  117|  1.62k|}
ASN1_item_ex_d2i:
  122|  1.62k|{
  123|  1.62k|    int rv;
  124|  1.62k|    rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0);
  125|  1.62k|    if (rv <= 0)
  ------------------
  |  Branch (125:9): [True: 637, False: 986]
  ------------------
  126|    637|        ASN1_item_ex_free(pval, it);
  127|  1.62k|    return rv;
  128|  1.62k|}
tasn_dec.c:asn1_item_embed_d2i:
  139|  1.62k|{
  140|  1.62k|    const ASN1_TEMPLATE *tt, *errtt = NULL;
  141|  1.62k|    const ASN1_EXTERN_FUNCS *ef;
  142|  1.62k|    const ASN1_AUX *aux = it->funcs;
  143|  1.62k|    ASN1_aux_cb *asn1_cb;
  144|  1.62k|    const unsigned char *p = NULL, *q;
  145|  1.62k|    unsigned char oclass;
  146|  1.62k|    char seq_eoc, seq_nolen, cst, isopt;
  147|  1.62k|    long tmplen;
  148|  1.62k|    int i;
  149|  1.62k|    int otag;
  150|  1.62k|    int ret = 0;
  151|  1.62k|    ASN1_VALUE **pchptr;
  152|  1.62k|    if (!pval)
  ------------------
  |  Branch (152:9): [True: 0, False: 1.62k]
  ------------------
  153|      0|        return 0;
  154|  1.62k|    if (aux && aux->asn1_cb)
  ------------------
  |  Branch (154:9): [True: 0, False: 1.62k]
  |  Branch (154:16): [True: 0, False: 0]
  ------------------
  155|      0|        asn1_cb = aux->asn1_cb;
  156|  1.62k|    else
  157|  1.62k|        asn1_cb = 0;
  158|       |
  159|  1.62k|    if (++depth > ASN1_MAX_CONSTRUCTED_NEST) {
  ------------------
  |  |   27|  1.62k|#define ASN1_MAX_CONSTRUCTED_NEST 30
  ------------------
  |  Branch (159:9): [True: 0, False: 1.62k]
  ------------------
  160|      0|        ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_NESTED_TOO_DEEP);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  161|      0|        goto err;
  162|      0|    }
  163|       |
  164|  1.62k|    switch (it->itype) {
  165|  1.62k|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  633|  1.62k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (165:5): [True: 1.62k, False: 0]
  ------------------
  166|  1.62k|        if (it->templates) {
  ------------------
  |  Branch (166:13): [True: 0, False: 1.62k]
  ------------------
  167|       |            /*
  168|       |             * tagging or OPTIONAL is currently illegal on an item template
  169|       |             * because the flags can't get passed down. In practice this
  170|       |             * isn't a problem: we include the relevant flags from the item
  171|       |             * template in the template itself.
  172|       |             */
  173|      0|            if ((tag != -1) || opt) {
  ------------------
  |  Branch (173:17): [True: 0, False: 0]
  |  Branch (173:32): [True: 0, False: 0]
  ------------------
  174|      0|                ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I,
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  175|      0|                        ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
  176|      0|                goto err;
  177|      0|            }
  178|      0|            return asn1_template_ex_d2i(pval, in, len,
  179|      0|                                        it->templates, opt, ctx, depth);
  180|      0|        }
  181|  1.62k|        return asn1_d2i_ex_primitive(pval, in, len, it,
  182|  1.62k|                                     tag, aclass, opt, ctx);
  183|       |
  184|      0|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  641|      0|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (184:5): [True: 0, False: 1.62k]
  ------------------
  185|       |        /*
  186|       |         * It never makes sense for multi-strings to have implicit tagging, so
  187|       |         * if tag != -1, then this looks like an error in the template.
  188|       |         */
  189|      0|        if (tag != -1) {
  ------------------
  |  Branch (189:13): [True: 0, False: 0]
  ------------------
  190|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  191|      0|            goto err;
  192|      0|        }
  193|       |
  194|      0|        p = *in;
  195|       |        /* Just read in tag and class */
  196|      0|        ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
  197|      0|                              &p, len, -1, 0, 1, ctx);
  198|      0|        if (!ret) {
  ------------------
  |  Branch (198:13): [True: 0, False: 0]
  ------------------
  199|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  200|      0|            goto err;
  201|      0|        }
  202|       |
  203|       |        /* Must be UNIVERSAL class */
  204|      0|        if (oclass != V_ASN1_UNIVERSAL) {
  ------------------
  |  |   35|      0|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (204:13): [True: 0, False: 0]
  ------------------
  205|       |            /* If OPTIONAL, assume this is OK */
  206|      0|            if (opt)
  ------------------
  |  Branch (206:17): [True: 0, False: 0]
  ------------------
  207|      0|                return -1;
  208|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_MSTRING_NOT_UNIVERSAL);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  209|      0|            goto err;
  210|      0|        }
  211|       |
  212|       |        /* Check tag matches bit map */
  213|      0|        if (!(ASN1_tag2bit(otag) & it->utype)) {
  ------------------
  |  Branch (213:13): [True: 0, False: 0]
  ------------------
  214|       |            /* If OPTIONAL, assume this is OK */
  215|      0|            if (opt)
  ------------------
  |  Branch (215:17): [True: 0, False: 0]
  ------------------
  216|      0|                return -1;
  217|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_MSTRING_WRONG_TAG);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  218|      0|            goto err;
  219|      0|        }
  220|      0|        return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);
  221|       |
  222|      0|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |  639|      0|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (222:5): [True: 0, False: 1.62k]
  ------------------
  223|       |        /* Use new style d2i */
  224|      0|        ef = it->funcs;
  225|      0|        return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
  226|       |
  227|      0|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |  637|      0|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (227:5): [True: 0, False: 1.62k]
  ------------------
  228|       |        /*
  229|       |         * It never makes sense for CHOICE types to have implicit tagging, so
  230|       |         * if tag != -1, then this looks like an error in the template.
  231|       |         */
  232|      0|        if (tag != -1) {
  ------------------
  |  Branch (232:13): [True: 0, False: 0]
  ------------------
  233|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  234|      0|            goto err;
  235|      0|        }
  236|       |
  237|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
  ------------------
  |  |  760|      0|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  |  Branch (237:24): [True: 0, False: 0]
  ------------------
  238|      0|            goto auxerr;
  239|      0|        if (*pval) {
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  ------------------
  240|       |            /* Free up and zero CHOICE value if initialised */
  241|      0|            i = asn1_get_choice_selector(pval, it);
  242|      0|            if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (242:17): [True: 0, False: 0]
  |  Branch (242:29): [True: 0, False: 0]
  ------------------
  243|      0|                tt = it->templates + i;
  244|      0|                pchptr = asn1_get_field_ptr(pval, tt);
  245|      0|                asn1_template_free(pchptr, tt);
  246|      0|                asn1_set_choice_selector(pval, -1, it);
  247|      0|            }
  248|      0|        } else if (!ASN1_item_ex_new(pval, it)) {
  ------------------
  |  Branch (248:20): [True: 0, False: 0]
  ------------------
  249|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  250|      0|            goto err;
  251|      0|        }
  252|       |        /* CHOICE type, try each possibility in turn */
  253|      0|        p = *in;
  254|      0|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (254:41): [True: 0, False: 0]
  ------------------
  255|      0|            pchptr = asn1_get_field_ptr(pval, tt);
  256|       |            /*
  257|       |             * We mark field as OPTIONAL so its absence can be recognised.
  258|       |             */
  259|      0|            ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx, depth);
  260|       |            /* If field not present, try the next one */
  261|      0|            if (ret == -1)
  ------------------
  |  Branch (261:17): [True: 0, False: 0]
  ------------------
  262|      0|                continue;
  263|       |            /* If positive return, read OK, break loop */
  264|      0|            if (ret > 0)
  ------------------
  |  Branch (264:17): [True: 0, False: 0]
  ------------------
  265|      0|                break;
  266|       |            /*
  267|       |             * Must be an ASN1 parsing error.
  268|       |             * Free up any partial choice value
  269|       |             */
  270|      0|            asn1_template_free(pchptr, tt);
  271|      0|            errtt = tt;
  272|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  273|      0|            goto err;
  274|      0|        }
  275|       |
  276|       |        /* Did we fall off the end without reading anything? */
  277|      0|        if (i == it->tcount) {
  ------------------
  |  Branch (277:13): [True: 0, False: 0]
  ------------------
  278|       |            /* If OPTIONAL, this is OK */
  279|      0|            if (opt) {
  ------------------
  |  Branch (279:17): [True: 0, False: 0]
  ------------------
  280|       |                /* Free and zero it */
  281|      0|                ASN1_item_ex_free(pval, it);
  282|      0|                return -1;
  283|      0|            }
  284|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_NO_MATCHING_CHOICE_TYPE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  285|      0|            goto err;
  286|      0|        }
  287|       |
  288|      0|        asn1_set_choice_selector(pval, i, it);
  289|       |
  290|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
  ------------------
  |  |  761|      0|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (290:13): [True: 0, False: 0]
  |  Branch (290:24): [True: 0, False: 0]
  ------------------
  291|      0|            goto auxerr;
  292|      0|        *in = p;
  293|      0|        return 1;
  294|       |
  295|      0|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |  643|      0|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (295:5): [True: 0, False: 1.62k]
  ------------------
  296|      0|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |  635|      0|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (296:5): [True: 0, False: 1.62k]
  ------------------
  297|      0|        p = *in;
  298|      0|        tmplen = len;
  299|       |
  300|       |        /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
  301|      0|        if (tag == -1) {
  ------------------
  |  Branch (301:13): [True: 0, False: 0]
  ------------------
  302|      0|            tag = V_ASN1_SEQUENCE;
  ------------------
  |  |   62|      0|# define V_ASN1_SEQUENCE                 16
  ------------------
  303|      0|            aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   35|      0|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  304|      0|        }
  305|       |        /* Get SEQUENCE length and update len, p */
  306|      0|        ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst,
  307|      0|                              &p, len, tag, aclass, opt, ctx);
  308|      0|        if (!ret) {
  ------------------
  |  Branch (308:13): [True: 0, False: 0]
  ------------------
  309|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  310|      0|            goto err;
  311|      0|        } else if (ret == -1)
  ------------------
  |  Branch (311:20): [True: 0, False: 0]
  ------------------
  312|      0|            return -1;
  313|      0|        if (aux && (aux->flags & ASN1_AFLG_BROKEN)) {
  ------------------
  |  |  752|      0|# define ASN1_AFLG_BROKEN        4
  ------------------
  |  Branch (313:13): [True: 0, False: 0]
  |  Branch (313:20): [True: 0, False: 0]
  ------------------
  314|      0|            len = tmplen - (p - *in);
  315|      0|            seq_nolen = 1;
  316|      0|        }
  317|       |        /* If indefinite we don't do a length check */
  318|      0|        else
  319|      0|            seq_nolen = seq_eoc;
  320|      0|        if (!cst) {
  ------------------
  |  Branch (320:13): [True: 0, False: 0]
  ------------------
  321|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  322|      0|            goto err;
  323|      0|        }
  324|       |
  325|      0|        if (!*pval && !ASN1_item_ex_new(pval, it)) {
  ------------------
  |  Branch (325:13): [True: 0, False: 0]
  |  Branch (325:23): [True: 0, False: 0]
  ------------------
  326|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  327|      0|            goto err;
  328|      0|        }
  329|       |
  330|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
  ------------------
  |  |  760|      0|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (330:13): [True: 0, False: 0]
  |  Branch (330:24): [True: 0, False: 0]
  ------------------
  331|      0|            goto auxerr;
  332|       |
  333|       |        /* Free up and zero any ADB found */
  334|      0|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (334:41): [True: 0, False: 0]
  ------------------
  335|      0|            if (tt->flags & ASN1_TFLG_ADB_MASK) {
  ------------------
  |  |  562|      0|# define ASN1_TFLG_ADB_MASK      (0x3<<8)
  ------------------
  |  Branch (335:17): [True: 0, False: 0]
  ------------------
  336|      0|                const ASN1_TEMPLATE *seqtt;
  337|      0|                ASN1_VALUE **pseqval;
  338|      0|                seqtt = asn1_do_adb(pval, tt, 0);
  339|      0|                if (seqtt == NULL)
  ------------------
  |  Branch (339:21): [True: 0, False: 0]
  ------------------
  340|      0|                    continue;
  341|      0|                pseqval = asn1_get_field_ptr(pval, seqtt);
  342|      0|                asn1_template_free(pseqval, seqtt);
  343|      0|            }
  344|      0|        }
  345|       |
  346|       |        /* Get each field entry */
  347|      0|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (347:41): [True: 0, False: 0]
  ------------------
  348|      0|            const ASN1_TEMPLATE *seqtt;
  349|      0|            ASN1_VALUE **pseqval;
  350|      0|            seqtt = asn1_do_adb(pval, tt, 1);
  351|      0|            if (seqtt == NULL)
  ------------------
  |  Branch (351:17): [True: 0, False: 0]
  ------------------
  352|      0|                goto err;
  353|      0|            pseqval = asn1_get_field_ptr(pval, seqtt);
  354|       |            /* Have we ran out of data? */
  355|      0|            if (!len)
  ------------------
  |  Branch (355:17): [True: 0, False: 0]
  ------------------
  356|      0|                break;
  357|      0|            q = p;
  358|      0|            if (asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (358:17): [True: 0, False: 0]
  ------------------
  359|      0|                if (!seq_eoc) {
  ------------------
  |  Branch (359:21): [True: 0, False: 0]
  ------------------
  360|      0|                    ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_UNEXPECTED_EOC);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  361|      0|                    goto err;
  362|      0|                }
  363|      0|                len -= p - q;
  364|      0|                seq_eoc = 0;
  365|      0|                q = p;
  366|      0|                break;
  367|      0|            }
  368|       |            /*
  369|       |             * This determines the OPTIONAL flag value. The field cannot be
  370|       |             * omitted if it is the last of a SEQUENCE and there is still
  371|       |             * data to be read. This isn't strictly necessary but it
  372|       |             * increases efficiency in some cases.
  373|       |             */
  374|      0|            if (i == (it->tcount - 1))
  ------------------
  |  Branch (374:17): [True: 0, False: 0]
  ------------------
  375|      0|                isopt = 0;
  376|      0|            else
  377|      0|                isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
  ------------------
  |  |  502|      0|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  378|       |            /*
  379|       |             * attempt to read in field, allowing each to be OPTIONAL
  380|       |             */
  381|       |
  382|      0|            ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx,
  383|      0|                                       depth);
  384|      0|            if (!ret) {
  ------------------
  |  Branch (384:17): [True: 0, False: 0]
  ------------------
  385|      0|                errtt = seqtt;
  386|      0|                goto err;
  387|      0|            } else if (ret == -1) {
  ------------------
  |  Branch (387:24): [True: 0, False: 0]
  ------------------
  388|       |                /*
  389|       |                 * OPTIONAL component absent. Free and zero the field.
  390|       |                 */
  391|      0|                asn1_template_free(pseqval, seqtt);
  392|      0|                continue;
  393|      0|            }
  394|       |            /* Update length */
  395|      0|            len -= p - q;
  396|      0|        }
  397|       |
  398|       |        /* Check for EOC if expecting one */
  399|      0|        if (seq_eoc && !asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (399:13): [True: 0, False: 0]
  |  Branch (399:24): [True: 0, False: 0]
  ------------------
  400|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_MISSING_EOC);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  401|      0|            goto err;
  402|      0|        }
  403|       |        /* Check all data read */
  404|      0|        if (!seq_nolen && len) {
  ------------------
  |  Branch (404:13): [True: 0, False: 0]
  |  Branch (404:27): [True: 0, False: 0]
  ------------------
  405|      0|            ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_SEQUENCE_LENGTH_MISMATCH);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  406|      0|            goto err;
  407|      0|        }
  408|       |
  409|       |        /*
  410|       |         * If we get here we've got no more data in the SEQUENCE, however we
  411|       |         * may not have read all fields so check all remaining are OPTIONAL
  412|       |         * and clear any that are.
  413|       |         */
  414|      0|        for (; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (414:16): [True: 0, False: 0]
  ------------------
  415|      0|            const ASN1_TEMPLATE *seqtt;
  416|      0|            seqtt = asn1_do_adb(pval, tt, 1);
  417|      0|            if (seqtt == NULL)
  ------------------
  |  Branch (417:17): [True: 0, False: 0]
  ------------------
  418|      0|                goto err;
  419|      0|            if (seqtt->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  502|      0|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  |  Branch (419:17): [True: 0, False: 0]
  ------------------
  420|      0|                ASN1_VALUE **pseqval;
  421|      0|                pseqval = asn1_get_field_ptr(pval, seqtt);
  422|      0|                asn1_template_free(pseqval, seqtt);
  423|      0|            } else {
  424|      0|                errtt = seqtt;
  425|      0|                ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_FIELD_MISSING);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  426|      0|                goto err;
  427|      0|            }
  428|      0|        }
  429|       |        /* Save encoding */
  430|      0|        if (!asn1_enc_save(pval, *in, p - *in, it))
  ------------------
  |  Branch (430:13): [True: 0, False: 0]
  ------------------
  431|      0|            goto auxerr;
  432|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
  ------------------
  |  |  761|      0|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  |  Branch (432:24): [True: 0, False: 0]
  ------------------
  433|      0|            goto auxerr;
  434|      0|        *in = p;
  435|      0|        return 1;
  436|       |
  437|      0|    default:
  ------------------
  |  Branch (437:5): [True: 0, False: 1.62k]
  ------------------
  438|      0|        return 0;
  439|  1.62k|    }
  440|      0| auxerr:
  441|      0|    ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_AUX_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  442|      0| err:
  443|      0|    if (errtt)
  ------------------
  |  Branch (443:9): [True: 0, False: 0]
  ------------------
  444|      0|        ERR_add_error_data(4, "Field=", errtt->field_name,
  445|      0|                           ", Type=", it->sname);
  446|      0|    else
  447|      0|        ERR_add_error_data(2, "Type=", it->sname);
  448|      0|    return 0;
  449|      0|}
tasn_dec.c:asn1_d2i_ex_primitive:
  663|  1.62k|{
  664|  1.62k|    int ret = 0, utype;
  665|  1.62k|    long plen;
  666|  1.62k|    char cst, inf, free_cont = 0;
  667|  1.62k|    const unsigned char *p;
  668|  1.62k|    BUF_MEM buf = { 0, NULL, 0, 0 };
  669|  1.62k|    const unsigned char *cont = NULL;
  670|  1.62k|    long len;
  671|  1.62k|    if (!pval) {
  ------------------
  |  Branch (671:9): [True: 0, False: 1.62k]
  ------------------
  672|      0|        ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  673|      0|        return 0;               /* Should never happen */
  674|      0|    }
  675|       |
  676|  1.62k|    if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |  641|  1.62k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (676:9): [True: 0, False: 1.62k]
  ------------------
  677|      0|        utype = tag;
  678|      0|        tag = -1;
  679|      0|    } else
  680|  1.62k|        utype = it->utype;
  681|       |
  682|  1.62k|    if (utype == V_ASN1_ANY) {
  ------------------
  |  |   46|  1.62k|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (682:9): [True: 0, False: 1.62k]
  ------------------
  683|       |        /* If type is ANY need to figure out type from tag */
  684|      0|        unsigned char oclass;
  685|      0|        if (tag >= 0) {
  ------------------
  |  Branch (685:13): [True: 0, False: 0]
  ------------------
  686|      0|            ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_TAGGED_ANY);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  687|      0|            return 0;
  688|      0|        }
  689|      0|        if (opt) {
  ------------------
  |  Branch (689:13): [True: 0, False: 0]
  ------------------
  690|      0|            ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  691|      0|                    ASN1_R_ILLEGAL_OPTIONAL_ANY);
  692|      0|            return 0;
  693|      0|        }
  694|      0|        p = *in;
  695|      0|        ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL,
  696|      0|                              &p, inlen, -1, 0, 0, ctx);
  697|      0|        if (!ret) {
  ------------------
  |  Branch (697:13): [True: 0, False: 0]
  ------------------
  698|      0|            ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  699|      0|            return 0;
  700|      0|        }
  701|      0|        if (oclass != V_ASN1_UNIVERSAL)
  ------------------
  |  |   35|      0|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (701:13): [True: 0, False: 0]
  ------------------
  702|      0|            utype = V_ASN1_OTHER;
  ------------------
  |  |   45|      0|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  703|      0|    }
  704|  1.62k|    if (tag == -1) {
  ------------------
  |  Branch (704:9): [True: 1.62k, False: 0]
  ------------------
  705|  1.62k|        tag = utype;
  706|  1.62k|        aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   35|  1.62k|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  707|  1.62k|    }
  708|  1.62k|    p = *in;
  709|       |    /* Check header */
  710|  1.62k|    ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst,
  711|  1.62k|                          &p, inlen, tag, aclass, opt, ctx);
  712|  1.62k|    if (!ret) {
  ------------------
  |  Branch (712:9): [True: 379, False: 1.24k]
  ------------------
  713|    379|        ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|    379|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    379|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  714|    379|        return 0;
  715|  1.24k|    } else if (ret == -1)
  ------------------
  |  Branch (715:16): [True: 0, False: 1.24k]
  ------------------
  716|      0|        return -1;
  717|  1.24k|    ret = 0;
  718|       |    /* SEQUENCE, SET and "OTHER" are left in encoded form */
  719|  1.24k|    if ((utype == V_ASN1_SEQUENCE)
  ------------------
  |  |   62|  1.24k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (719:9): [True: 0, False: 1.24k]
  ------------------
  720|  1.24k|        || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
  ------------------
  |  |   63|  1.24k|# define V_ASN1_SET                      17
  ------------------
                      || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
  ------------------
  |  |   45|  1.24k|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (720:12): [True: 0, False: 1.24k]
  |  Branch (720:37): [True: 0, False: 1.24k]
  ------------------
  721|       |        /*
  722|       |         * Clear context cache for type OTHER because the auto clear when we
  723|       |         * have a exact match won't work
  724|       |         */
  725|      0|        if (utype == V_ASN1_OTHER) {
  ------------------
  |  |   45|      0|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (725:13): [True: 0, False: 0]
  ------------------
  726|      0|            asn1_tlc_clear(ctx);
  ------------------
  |  |   94|      0|#define asn1_tlc_clear(c)       if (c) (c)->valid = 0
  |  |  ------------------
  |  |  |  Branch (94:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  727|      0|        }
  728|       |        /* SEQUENCE and SET must be constructed */
  729|      0|        else if (!cst) {
  ------------------
  |  Branch (729:18): [True: 0, False: 0]
  ------------------
  730|      0|            ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  731|      0|                    ASN1_R_TYPE_NOT_CONSTRUCTED);
  732|      0|            return 0;
  733|      0|        }
  734|       |
  735|      0|        cont = *in;
  736|       |        /* If indefinite length constructed find the real end */
  737|      0|        if (inf) {
  ------------------
  |  Branch (737:13): [True: 0, False: 0]
  ------------------
  738|      0|            if (!asn1_find_end(&p, plen, inf))
  ------------------
  |  Branch (738:17): [True: 0, False: 0]
  ------------------
  739|      0|                goto err;
  740|      0|            len = p - cont;
  741|      0|        } else {
  742|      0|            len = p - cont + plen;
  743|      0|            p += plen;
  744|      0|        }
  745|  1.24k|    } else if (cst) {
  ------------------
  |  Branch (745:16): [True: 420, False: 824]
  ------------------
  746|    420|        if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN
  ------------------
  |  |   55|    840|# define V_ASN1_NULL                     5
  ------------------
                      if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN
  ------------------
  |  |   51|    840|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (746:13): [True: 0, False: 420]
  |  Branch (746:37): [True: 0, False: 420]
  ------------------
  747|    420|            || utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER
  ------------------
  |  |   56|    840|# define V_ASN1_OBJECT                   6
  ------------------
                          || utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER
  ------------------
  |  |   52|    840|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (747:16): [True: 0, False: 420]
  |  Branch (747:42): [True: 0, False: 420]
  ------------------
  748|    420|            || utype == V_ASN1_ENUMERATED) {
  ------------------
  |  |   60|    420|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (748:16): [True: 0, False: 420]
  ------------------
  749|      0|            ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_PRIMITIVE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  750|      0|            return 0;
  751|      0|        }
  752|       |
  753|       |        /* Free any returned 'buf' content */
  754|    420|        free_cont = 1;
  755|       |        /*
  756|       |         * Should really check the internal tags are correct but some things
  757|       |         * may get this wrong. The relevant specs say that constructed string
  758|       |         * types should be OCTET STRINGs internally irrespective of the type.
  759|       |         * So instead just check for UNIVERSAL class and ignore the tag.
  760|       |         */
  761|    420|        if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
  ------------------
  |  |   35|    420|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (761:13): [True: 258, False: 162]
  ------------------
  762|    258|            goto err;
  763|    258|        }
  764|    162|        len = buf.length;
  765|       |        /* Append a final null to string */
  766|    162|        if (!BUF_MEM_grow_clean(&buf, len + 1)) {
  ------------------
  |  Branch (766:13): [True: 0, False: 162]
  ------------------
  767|      0|            ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  768|      0|            goto err;
  769|      0|        }
  770|    162|        buf.data[len] = 0;
  771|    162|        cont = (const unsigned char *)buf.data;
  772|    824|    } else {
  773|    824|        cont = p;
  774|    824|        len = plen;
  775|    824|        p += plen;
  776|    824|    }
  777|       |
  778|       |    /* We now have content length and type: translate into a structure */
  779|       |    /* asn1_ex_c2i may reuse allocated buffer, and so sets free_cont to 0 */
  780|    986|    if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it))
  ------------------
  |  Branch (780:9): [True: 0, False: 986]
  ------------------
  781|      0|        goto err;
  782|       |
  783|    986|    *in = p;
  784|    986|    ret = 1;
  785|  1.24k| err:
  786|  1.24k|    if (free_cont)
  ------------------
  |  Branch (786:9): [True: 258, False: 986]
  ------------------
  787|    258|        OPENSSL_free(buf.data);
  ------------------
  |  |  128|    258|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    258|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    258|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  788|  1.24k|    return ret;
  789|    986|}
tasn_dec.c:asn1_collect:
 1005|  2.77k|{
 1006|  2.77k|    const unsigned char *p, *q;
 1007|  2.77k|    long plen;
 1008|  2.77k|    char cst, ininf;
 1009|  2.77k|    p = *in;
 1010|  2.77k|    inf &= 1;
 1011|       |    /*
 1012|       |     * If no buffer and not indefinite length constructed just pass over the
 1013|       |     * encoded data
 1014|       |     */
 1015|  2.77k|    if (!buf && !inf) {
  ------------------
  |  Branch (1015:9): [True: 0, False: 2.77k]
  |  Branch (1015:17): [True: 0, False: 0]
  ------------------
 1016|      0|        *in += len;
 1017|      0|        return 1;
 1018|      0|    }
 1019|  35.9k|    while (len > 0) {
  ------------------
  |  Branch (1019:12): [True: 34.3k, False: 1.64k]
  ------------------
 1020|  34.3k|        q = p;
 1021|       |        /* Check for EOC */
 1022|  34.3k|        if (asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (1022:13): [True: 897, False: 33.4k]
  ------------------
 1023|       |            /*
 1024|       |             * EOC is illegal outside indefinite length constructed form
 1025|       |             */
 1026|    897|            if (!inf) {
  ------------------
  |  Branch (1026:17): [True: 1, False: 896]
  ------------------
 1027|      1|                ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_UNEXPECTED_EOC);
  ------------------
  |  |  111|      1|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      1|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1028|      1|                return 0;
 1029|      1|            }
 1030|    896|            inf = 0;
 1031|    896|            break;
 1032|    897|        }
 1033|       |
 1034|  33.4k|        if (!asn1_check_tlen(&plen, NULL, NULL, &ininf, &cst, &p,
  ------------------
  |  Branch (1034:13): [True: 105, False: 33.3k]
  ------------------
 1035|  33.4k|                             len, tag, aclass, 0, NULL)) {
 1036|    105|            ASN1err(ASN1_F_ASN1_COLLECT, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  111|    105|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    105|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1037|    105|            return 0;
 1038|    105|        }
 1039|       |
 1040|       |        /* If indefinite length constructed update max length */
 1041|  33.3k|        if (cst) {
  ------------------
  |  Branch (1041:13): [True: 2.36k, False: 30.9k]
  ------------------
 1042|  2.36k|            if (depth >= ASN1_MAX_STRING_NEST) {
  ------------------
  |  | 1000|  2.36k|# define ASN1_MAX_STRING_NEST 5
  ------------------
  |  Branch (1042:17): [True: 10, False: 2.35k]
  ------------------
 1043|     10|                ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_NESTED_ASN1_STRING);
  ------------------
  |  |  111|     10|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     10|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1044|     10|                return 0;
 1045|     10|            }
 1046|  2.35k|            if (!asn1_collect(buf, &p, plen, ininf, tag, aclass, depth + 1))
  ------------------
  |  Branch (1046:17): [True: 125, False: 2.23k]
  ------------------
 1047|    125|                return 0;
 1048|  30.9k|        } else if (plen && !collect_data(buf, &p, plen))
  ------------------
  |  Branch (1048:20): [True: 30.3k, False: 659]
  |  Branch (1048:28): [True: 0, False: 30.3k]
  ------------------
 1049|      0|            return 0;
 1050|  33.2k|        len -= p - q;
 1051|  33.2k|    }
 1052|  2.53k|    if (inf) {
  ------------------
  |  Branch (1052:9): [True: 142, False: 2.39k]
  ------------------
 1053|    142|        ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_MISSING_EOC);
  ------------------
  |  |  111|    142|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    142|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1054|    142|        return 0;
 1055|    142|    }
 1056|  2.39k|    *in = p;
 1057|  2.39k|    return 1;
 1058|  2.53k|}
tasn_dec.c:collect_data:
 1061|  30.3k|{
 1062|  30.3k|    int len;
 1063|  30.3k|    if (buf) {
  ------------------
  |  Branch (1063:9): [True: 30.3k, False: 0]
  ------------------
 1064|  30.3k|        len = buf->length;
 1065|  30.3k|        if (!BUF_MEM_grow_clean(buf, len + plen)) {
  ------------------
  |  Branch (1065:13): [True: 0, False: 30.3k]
  ------------------
 1066|      0|            ASN1err(ASN1_F_COLLECT_DATA, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1067|      0|            return 0;
 1068|      0|        }
 1069|  30.3k|        memcpy(buf->data + len, *p, plen);
 1070|  30.3k|    }
 1071|  30.3k|    *p += plen;
 1072|  30.3k|    return 1;
 1073|  30.3k|}
tasn_dec.c:asn1_ex_c2i:
  795|    986|{
  796|    986|    ASN1_VALUE **opval = NULL;
  797|    986|    ASN1_STRING *stmp;
  798|    986|    ASN1_TYPE *typ = NULL;
  799|    986|    int ret = 0;
  800|    986|    const ASN1_PRIMITIVE_FUNCS *pf;
  801|    986|    ASN1_INTEGER **tint;
  802|    986|    pf = it->funcs;
  803|       |
  804|    986|    if (pf && pf->prim_c2i)
  ------------------
  |  Branch (804:9): [True: 0, False: 986]
  |  Branch (804:15): [True: 0, False: 0]
  ------------------
  805|      0|        return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
  806|       |    /* If ANY type clear type and set pointer to internal value */
  807|    986|    if (it->utype == V_ASN1_ANY) {
  ------------------
  |  |   46|    986|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (807:9): [True: 0, False: 986]
  ------------------
  808|      0|        if (!*pval) {
  ------------------
  |  Branch (808:13): [True: 0, False: 0]
  ------------------
  809|      0|            typ = ASN1_TYPE_new();
  810|      0|            if (typ == NULL)
  ------------------
  |  Branch (810:17): [True: 0, False: 0]
  ------------------
  811|      0|                goto err;
  812|      0|            *pval = (ASN1_VALUE *)typ;
  813|      0|        } else
  814|      0|            typ = (ASN1_TYPE *)*pval;
  815|       |
  816|      0|        if (utype != typ->type)
  ------------------
  |  Branch (816:13): [True: 0, False: 0]
  ------------------
  817|      0|            ASN1_TYPE_set(typ, utype, NULL);
  818|      0|        opval = pval;
  819|      0|        pval = &typ->value.asn1_value;
  820|      0|    }
  821|    986|    switch (utype) {
  822|      0|    case V_ASN1_OBJECT:
  ------------------
  |  |   56|      0|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (822:5): [True: 0, False: 986]
  ------------------
  823|      0|        if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len))
  ------------------
  |  Branch (823:13): [True: 0, False: 0]
  ------------------
  824|      0|            goto err;
  825|      0|        break;
  826|       |
  827|      0|    case V_ASN1_NULL:
  ------------------
  |  |   55|      0|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (827:5): [True: 0, False: 986]
  ------------------
  828|      0|        if (len) {
  ------------------
  |  Branch (828:13): [True: 0, False: 0]
  ------------------
  829|      0|            ASN1err(ASN1_F_ASN1_EX_C2I, ASN1_R_NULL_IS_WRONG_LENGTH);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  830|      0|            goto err;
  831|      0|        }
  832|      0|        *pval = (ASN1_VALUE *)1;
  833|      0|        break;
  834|       |
  835|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   51|      0|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (835:5): [True: 0, False: 986]
  ------------------
  836|      0|        if (len != 1) {
  ------------------
  |  Branch (836:13): [True: 0, False: 0]
  ------------------
  837|      0|            ASN1err(ASN1_F_ASN1_EX_C2I, ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  838|      0|            goto err;
  839|      0|        } else {
  840|      0|            ASN1_BOOLEAN *tbool;
  841|      0|            tbool = (ASN1_BOOLEAN *)pval;
  842|      0|            *tbool = *cont;
  843|      0|        }
  844|      0|        break;
  845|       |
  846|      0|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   53|      0|# define V_ASN1_BIT_STRING               3
  ------------------
  |  Branch (846:5): [True: 0, False: 986]
  ------------------
  847|      0|        if (!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len))
  ------------------
  |  Branch (847:13): [True: 0, False: 0]
  ------------------
  848|      0|            goto err;
  849|      0|        break;
  850|       |
  851|      0|    case V_ASN1_INTEGER:
  ------------------
  |  |   52|      0|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (851:5): [True: 0, False: 986]
  ------------------
  852|      0|    case V_ASN1_ENUMERATED:
  ------------------
  |  |   60|      0|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (852:5): [True: 0, False: 986]
  ------------------
  853|      0|        tint = (ASN1_INTEGER **)pval;
  854|      0|        if (!c2i_ASN1_INTEGER(tint, &cont, len))
  ------------------
  |  Branch (854:13): [True: 0, False: 0]
  ------------------
  855|      0|            goto err;
  856|       |        /* Fixup type to match the expected form */
  857|      0|        (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
  ------------------
  |  |   85|      0|# define V_ASN1_NEG                      0x100
  ------------------
  858|      0|        break;
  859|       |
  860|    986|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   54|    986|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (860:5): [True: 986, False: 0]
  ------------------
  861|    986|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   64|    986|# define V_ASN1_NUMERICSTRING            18 /**/
  ------------------
  |  Branch (861:5): [True: 0, False: 986]
  ------------------
  862|    986|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |   65|    986|# define V_ASN1_PRINTABLESTRING          19
  ------------------
  |  Branch (862:5): [True: 0, False: 986]
  ------------------
  863|    986|    case V_ASN1_T61STRING:
  ------------------
  |  |   66|    986|# define V_ASN1_T61STRING                20
  ------------------
  |  Branch (863:5): [True: 0, False: 986]
  ------------------
  864|    986|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |   68|    986|# define V_ASN1_VIDEOTEXSTRING           21 /**/
  ------------------
  |  Branch (864:5): [True: 0, False: 986]
  ------------------
  865|    986|    case V_ASN1_IA5STRING:
  ------------------
  |  |   69|    986|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (865:5): [True: 0, False: 986]
  ------------------
  866|    986|    case V_ASN1_UTCTIME:
  ------------------
  |  |   70|    986|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (866:5): [True: 0, False: 986]
  ------------------
  867|    986|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |   71|    986|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (867:5): [True: 0, False: 986]
  ------------------
  868|    986|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |   72|    986|# define V_ASN1_GRAPHICSTRING            25 /**/
  ------------------
  |  Branch (868:5): [True: 0, False: 986]
  ------------------
  869|    986|    case V_ASN1_VISIBLESTRING:
  ------------------
  |  |   74|    986|# define V_ASN1_VISIBLESTRING            26/* alias */
  ------------------
  |  Branch (869:5): [True: 0, False: 986]
  ------------------
  870|    986|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |   75|    986|# define V_ASN1_GENERALSTRING            27 /**/
  ------------------
  |  Branch (870:5): [True: 0, False: 986]
  ------------------
  871|    986|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |   76|    986|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  |  Branch (871:5): [True: 0, False: 986]
  ------------------
  872|    986|    case V_ASN1_BMPSTRING:
  ------------------
  |  |   77|    986|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (872:5): [True: 0, False: 986]
  ------------------
  873|    986|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   61|    986|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (873:5): [True: 0, False: 986]
  ------------------
  874|    986|    case V_ASN1_OTHER:
  ------------------
  |  |   45|    986|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (874:5): [True: 0, False: 986]
  ------------------
  875|    986|    case V_ASN1_SET:
  ------------------
  |  |   63|    986|# define V_ASN1_SET                      17
  ------------------
  |  Branch (875:5): [True: 0, False: 986]
  ------------------
  876|    986|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   62|    986|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (876:5): [True: 0, False: 986]
  ------------------
  877|    986|    default:
  ------------------
  |  Branch (877:5): [True: 0, False: 986]
  ------------------
  878|    986|        if (utype == V_ASN1_BMPSTRING && (len & 1)) {
  ------------------
  |  |   77|  1.97k|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (878:13): [True: 0, False: 986]
  |  Branch (878:42): [True: 0, False: 0]
  ------------------
  879|      0|            ASN1err(ASN1_F_ASN1_EX_C2I, ASN1_R_BMPSTRING_IS_WRONG_LENGTH);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  880|      0|            goto err;
  881|      0|        }
  882|    986|        if (utype == V_ASN1_UNIVERSALSTRING && (len & 3)) {
  ------------------
  |  |   76|  1.97k|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  |  Branch (882:13): [True: 0, False: 986]
  |  Branch (882:48): [True: 0, False: 0]
  ------------------
  883|      0|            ASN1err(ASN1_F_ASN1_EX_C2I,
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  884|      0|                    ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH);
  885|      0|            goto err;
  886|      0|        }
  887|       |        /* All based on ASN1_STRING and handled the same */
  888|    986|        if (!*pval) {
  ------------------
  |  Branch (888:13): [True: 986, False: 0]
  ------------------
  889|    986|            stmp = ASN1_STRING_type_new(utype);
  890|    986|            if (stmp == NULL) {
  ------------------
  |  Branch (890:17): [True: 0, False: 986]
  ------------------
  891|      0|                ASN1err(ASN1_F_ASN1_EX_C2I, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  892|      0|                goto err;
  893|      0|            }
  894|    986|            *pval = (ASN1_VALUE *)stmp;
  895|    986|        } else {
  896|      0|            stmp = (ASN1_STRING *)*pval;
  897|      0|            stmp->type = utype;
  898|      0|        }
  899|       |        /* If we've already allocated a buffer use it */
  900|    986|        if (*free_cont) {
  ------------------
  |  Branch (900:13): [True: 162, False: 824]
  ------------------
  901|    162|            OPENSSL_free(stmp->data);
  ------------------
  |  |  128|    162|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    162|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    162|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  902|    162|            stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */
  903|    162|            stmp->length = len;
  904|    162|            *free_cont = 0;
  905|    824|        } else {
  906|    824|            if (!ASN1_STRING_set(stmp, cont, len)) {
  ------------------
  |  Branch (906:17): [True: 0, False: 824]
  ------------------
  907|      0|                ASN1err(ASN1_F_ASN1_EX_C2I, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  908|      0|                ASN1_STRING_free(stmp);
  909|      0|                *pval = NULL;
  910|      0|                goto err;
  911|      0|            }
  912|    824|        }
  913|    986|        break;
  914|    986|    }
  915|       |    /* If ASN1_ANY and NULL type fix up value */
  916|    986|    if (typ && (utype == V_ASN1_NULL))
  ------------------
  |  |   55|      0|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (916:9): [True: 0, False: 986]
  |  Branch (916:16): [True: 0, False: 0]
  ------------------
  917|      0|        typ->value.ptr = NULL;
  918|       |
  919|    986|    ret = 1;
  920|    986| err:
  921|    986|    if (!ret) {
  ------------------
  |  Branch (921:9): [True: 0, False: 986]
  ------------------
  922|      0|        ASN1_TYPE_free(typ);
  923|      0|        if (opval)
  ------------------
  |  Branch (923:13): [True: 0, False: 0]
  ------------------
  924|      0|            *opval = NULL;
  925|      0|    }
  926|    986|    return ret;
  927|    986|}
tasn_dec.c:asn1_check_tlen:
 1101|  35.0k|{
 1102|  35.0k|    int i;
 1103|  35.0k|    int ptag, pclass;
 1104|  35.0k|    long plen;
 1105|  35.0k|    const unsigned char *p, *q;
 1106|  35.0k|    p = *in;
 1107|  35.0k|    q = p;
 1108|       |
 1109|  35.0k|    if (ctx && ctx->valid) {
  ------------------
  |  Branch (1109:9): [True: 1.62k, False: 33.4k]
  |  Branch (1109:16): [True: 0, False: 1.62k]
  ------------------
 1110|      0|        i = ctx->ret;
 1111|      0|        plen = ctx->plen;
 1112|      0|        pclass = ctx->pclass;
 1113|      0|        ptag = ctx->ptag;
 1114|      0|        p += ctx->hdrlen;
 1115|  35.0k|    } else {
 1116|  35.0k|        i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
 1117|  35.0k|        if (ctx) {
  ------------------
  |  Branch (1117:13): [True: 1.62k, False: 33.4k]
  ------------------
 1118|  1.62k|            ctx->ret = i;
 1119|  1.62k|            ctx->plen = plen;
 1120|  1.62k|            ctx->pclass = pclass;
 1121|  1.62k|            ctx->ptag = ptag;
 1122|  1.62k|            ctx->hdrlen = p - q;
 1123|  1.62k|            ctx->valid = 1;
 1124|       |            /*
 1125|       |             * If definite length, and no error, length + header can't exceed
 1126|       |             * total amount of data available.
 1127|       |             */
 1128|  1.62k|            if (!(i & 0x81) && ((plen + ctx->hdrlen) > len)) {
  ------------------
  |  Branch (1128:17): [True: 962, False: 661]
  |  Branch (1128:32): [True: 0, False: 962]
  ------------------
 1129|      0|                ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1130|      0|                asn1_tlc_clear(ctx);
  ------------------
  |  |   94|      0|#define asn1_tlc_clear(c)       if (c) (c)->valid = 0
  |  |  ------------------
  |  |  |  Branch (94:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1131|      0|                return 0;
 1132|      0|            }
 1133|  1.62k|        }
 1134|  35.0k|    }
 1135|       |
 1136|  35.0k|    if (i & 0x80) {
  ------------------
  |  Branch (1136:9): [True: 383, False: 34.6k]
  ------------------
 1137|    383|        ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_BAD_OBJECT_HEADER);
  ------------------
  |  |  111|    383|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    383|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1138|    383|        asn1_tlc_clear(ctx);
  ------------------
  |  |   94|    383|#define asn1_tlc_clear(c)       if (c) (c)->valid = 0
  |  |  ------------------
  |  |  |  Branch (94:37): [True: 278, False: 105]
  |  |  ------------------
  ------------------
 1139|    383|        return 0;
 1140|    383|    }
 1141|  34.6k|    if (exptag >= 0) {
  ------------------
  |  Branch (1141:9): [True: 1.34k, False: 33.3k]
  ------------------
 1142|  1.34k|        if ((exptag != ptag) || (expclass != pclass)) {
  ------------------
  |  Branch (1142:13): [True: 93, False: 1.25k]
  |  Branch (1142:33): [True: 8, False: 1.24k]
  ------------------
 1143|       |            /*
 1144|       |             * If type is OPTIONAL, not an error: indicate missing type.
 1145|       |             */
 1146|    101|            if (opt)
  ------------------
  |  Branch (1146:17): [True: 0, False: 101]
  ------------------
 1147|      0|                return -1;
 1148|    101|            asn1_tlc_clear(ctx);
  ------------------
  |  |   94|    101|#define asn1_tlc_clear(c)       if (c) (c)->valid = 0
  |  |  ------------------
  |  |  |  Branch (94:37): [True: 101, False: 0]
  |  |  ------------------
  ------------------
 1149|    101|            ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_WRONG_TAG);
  ------------------
  |  |  111|    101|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    101|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
 1150|    101|            return 0;
 1151|    101|        }
 1152|       |        /*
 1153|       |         * We have a tag and class match: assume we are going to do something
 1154|       |         * with it
 1155|       |         */
 1156|  1.24k|        asn1_tlc_clear(ctx);
  ------------------
  |  |   94|  1.24k|#define asn1_tlc_clear(c)       if (c) (c)->valid = 0
  |  |  ------------------
  |  |  |  Branch (94:37): [True: 1.24k, False: 0]
  |  |  ------------------
  ------------------
 1157|  1.24k|    }
 1158|       |
 1159|  34.5k|    if (i & 1)
  ------------------
  |  Branch (1159:9): [True: 1.27k, False: 33.3k]
  ------------------
 1160|  1.27k|        plen = len - (p - q);
 1161|       |
 1162|  34.5k|    if (inf)
  ------------------
  |  Branch (1162:9): [True: 34.5k, False: 0]
  ------------------
 1163|  34.5k|        *inf = i & 1;
 1164|       |
 1165|  34.5k|    if (cst)
  ------------------
  |  Branch (1165:9): [True: 34.5k, False: 0]
  ------------------
 1166|  34.5k|        *cst = i & V_ASN1_CONSTRUCTED;
  ------------------
  |  |   40|  34.5k|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
 1167|       |
 1168|  34.5k|    if (olen)
  ------------------
  |  Branch (1168:9): [True: 34.5k, False: 0]
  ------------------
 1169|  34.5k|        *olen = plen;
 1170|       |
 1171|  34.5k|    if (oclass)
  ------------------
  |  Branch (1171:9): [True: 0, False: 34.5k]
  ------------------
 1172|      0|        *oclass = pclass;
 1173|       |
 1174|  34.5k|    if (otag)
  ------------------
  |  Branch (1174:9): [True: 0, False: 34.5k]
  ------------------
 1175|      0|        *otag = ptag;
 1176|       |
 1177|  34.5k|    *in = p;
 1178|  34.5k|    return 1;
 1179|  34.6k|}
tasn_dec.c:asn1_check_eoc:
 1078|  34.3k|{
 1079|  34.3k|    const unsigned char *p;
 1080|  34.3k|    if (len < 2)
  ------------------
  |  Branch (1080:9): [True: 29, False: 34.3k]
  ------------------
 1081|     29|        return 0;
 1082|  34.3k|    p = *in;
 1083|  34.3k|    if (!p[0] && !p[1]) {
  ------------------
  |  Branch (1083:9): [True: 3.35k, False: 30.9k]
  |  Branch (1083:18): [True: 897, False: 2.45k]
  ------------------
 1084|    897|        *in += 2;
 1085|    897|        return 1;
 1086|    897|    }
 1087|  33.4k|    return 0;
 1088|  34.3k|}

ASN1_item_i2d:
   43|    442|{
   44|    442|    return asn1_item_flags_i2d(val, out, it, 0);
   45|    442|}
ASN1_item_ex_i2d:
   84|    884|{
   85|    884|    const ASN1_TEMPLATE *tt = NULL;
   86|    884|    int i, seqcontlen, seqlen, ndef = 1;
   87|    884|    const ASN1_EXTERN_FUNCS *ef;
   88|    884|    const ASN1_AUX *aux = it->funcs;
   89|    884|    ASN1_aux_cb *asn1_cb = 0;
   90|       |
   91|    884|    if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)
  ------------------
  |  |  633|    884|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (91:9): [True: 0, False: 884]
  |  Branch (91:48): [True: 0, False: 0]
  ------------------
   92|      0|        return 0;
   93|       |
   94|    884|    if (aux && aux->asn1_cb)
  ------------------
  |  Branch (94:9): [True: 0, False: 884]
  |  Branch (94:16): [True: 0, False: 0]
  ------------------
   95|      0|        asn1_cb = aux->asn1_cb;
   96|       |
   97|    884|    switch (it->itype) {
   98|       |
   99|    884|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  633|    884|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (99:5): [True: 884, False: 0]
  ------------------
  100|    884|        if (it->templates)
  ------------------
  |  Branch (100:13): [True: 0, False: 884]
  ------------------
  101|      0|            return asn1_template_ex_i2d(pval, out, it->templates,
  102|      0|                                        tag, aclass);
  103|    884|        return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
  104|       |
  105|      0|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  641|      0|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (105:5): [True: 0, False: 884]
  ------------------
  106|       |        /*
  107|       |         * It never makes sense for multi-strings to have implicit tagging, so
  108|       |         * if tag != -1, then this looks like an error in the template.
  109|       |         */
  110|      0|        if (tag != -1) {
  ------------------
  |  Branch (110:13): [True: 0, False: 0]
  ------------------
  111|      0|            ASN1err(ASN1_F_ASN1_ITEM_EX_I2D, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  112|      0|            return -1;
  113|      0|        }
  114|      0|        return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
  115|       |
  116|      0|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |  637|      0|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (116:5): [True: 0, False: 884]
  ------------------
  117|       |        /*
  118|       |         * It never makes sense for CHOICE types to have implicit tagging, so
  119|       |         * if tag != -1, then this looks like an error in the template.
  120|       |         */
  121|      0|        if (tag != -1) {
  ------------------
  |  Branch (121:13): [True: 0, False: 0]
  ------------------
  122|      0|            ASN1err(ASN1_F_ASN1_ITEM_EX_I2D, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  123|      0|            return -1;
  124|      0|        }
  125|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
  ------------------
  |  |  762|      0|# define ASN1_OP_I2D_PRE         6
  ------------------
  |  Branch (125:13): [True: 0, False: 0]
  |  Branch (125:24): [True: 0, False: 0]
  ------------------
  126|      0|            return 0;
  127|      0|        i = asn1_get_choice_selector(pval, it);
  128|      0|        if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  |  Branch (128:25): [True: 0, False: 0]
  ------------------
  129|      0|            ASN1_VALUE **pchval;
  130|      0|            const ASN1_TEMPLATE *chtt;
  131|      0|            chtt = it->templates + i;
  132|      0|            pchval = asn1_get_field_ptr(pval, chtt);
  133|      0|            return asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);
  134|      0|        }
  135|       |        /* Fixme: error condition if selector out of range */
  136|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
  ------------------
  |  |  763|      0|# define ASN1_OP_I2D_POST        7
  ------------------
  |  Branch (136:13): [True: 0, False: 0]
  |  Branch (136:24): [True: 0, False: 0]
  ------------------
  137|      0|            return 0;
  138|      0|        break;
  139|       |
  140|      0|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |  639|      0|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (140:5): [True: 0, False: 884]
  ------------------
  141|       |        /* If new style i2d it does all the work */
  142|      0|        ef = it->funcs;
  143|      0|        return ef->asn1_ex_i2d(pval, out, it, tag, aclass);
  144|       |
  145|      0|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |  643|      0|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (145:5): [True: 0, False: 884]
  ------------------
  146|       |        /* Use indefinite length constructed if requested */
  147|      0|        if (aclass & ASN1_TFLG_NDEF)
  ------------------
  |  |  573|      0|# define ASN1_TFLG_NDEF          (0x1<<11)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            ndef = 2;
  149|       |        /* fall through */
  150|       |
  151|      0|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |  635|      0|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (151:5): [True: 0, False: 884]
  ------------------
  152|      0|        i = asn1_enc_restore(&seqcontlen, out, pval, it);
  153|       |        /* An error occurred */
  154|      0|        if (i < 0)
  ------------------
  |  Branch (154:13): [True: 0, False: 0]
  ------------------
  155|      0|            return 0;
  156|       |        /* We have a valid cached encoding... */
  157|      0|        if (i > 0)
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  ------------------
  158|      0|            return seqcontlen;
  159|       |        /* Otherwise carry on */
  160|      0|        seqcontlen = 0;
  161|       |        /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
  162|      0|        if (tag == -1) {
  ------------------
  |  Branch (162:13): [True: 0, False: 0]
  ------------------
  163|      0|            tag = V_ASN1_SEQUENCE;
  ------------------
  |  |   62|      0|# define V_ASN1_SEQUENCE                 16
  ------------------
  164|       |            /* Retain any other flags in aclass */
  165|      0|            aclass = (aclass & ~ASN1_TFLG_TAG_CLASS)
  ------------------
  |  |  554|      0|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  166|      0|                | V_ASN1_UNIVERSAL;
  ------------------
  |  |   35|      0|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  167|      0|        }
  168|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
  ------------------
  |  |  762|      0|# define ASN1_OP_I2D_PRE         6
  ------------------
  |  Branch (168:13): [True: 0, False: 0]
  |  Branch (168:24): [True: 0, False: 0]
  ------------------
  169|      0|            return 0;
  170|       |        /* First work out sequence content length */
  171|      0|        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (171:41): [True: 0, False: 0]
  ------------------
  172|      0|            const ASN1_TEMPLATE *seqtt;
  173|      0|            ASN1_VALUE **pseqval;
  174|      0|            int tmplen;
  175|      0|            seqtt = asn1_do_adb(pval, tt, 1);
  176|      0|            if (!seqtt)
  ------------------
  |  Branch (176:17): [True: 0, False: 0]
  ------------------
  177|      0|                return 0;
  178|      0|            pseqval = asn1_get_field_ptr(pval, seqtt);
  179|      0|            tmplen = asn1_template_ex_i2d(pseqval, NULL, seqtt, -1, aclass);
  180|      0|            if (tmplen == -1 || (tmplen > INT_MAX - seqcontlen))
  ------------------
  |  Branch (180:17): [True: 0, False: 0]
  |  Branch (180:33): [True: 0, False: 0]
  ------------------
  181|      0|                return -1;
  182|      0|            seqcontlen += tmplen;
  183|      0|        }
  184|       |
  185|      0|        seqlen = ASN1_object_size(ndef, seqcontlen, tag);
  186|      0|        if (!out || seqlen == -1)
  ------------------
  |  Branch (186:13): [True: 0, False: 0]
  |  Branch (186:21): [True: 0, False: 0]
  ------------------
  187|      0|            return seqlen;
  188|       |        /* Output SEQUENCE header */
  189|      0|        ASN1_put_object(out, ndef, seqcontlen, tag, aclass);
  190|      0|        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (190:41): [True: 0, False: 0]
  ------------------
  191|      0|            const ASN1_TEMPLATE *seqtt;
  192|      0|            ASN1_VALUE **pseqval;
  193|      0|            seqtt = asn1_do_adb(pval, tt, 1);
  194|      0|            if (!seqtt)
  ------------------
  |  Branch (194:17): [True: 0, False: 0]
  ------------------
  195|      0|                return 0;
  196|      0|            pseqval = asn1_get_field_ptr(pval, seqtt);
  197|       |            /* FIXME: check for errors in enhanced version */
  198|      0|            asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass);
  199|      0|        }
  200|      0|        if (ndef == 2)
  ------------------
  |  Branch (200:13): [True: 0, False: 0]
  ------------------
  201|      0|            ASN1_put_eoc(out);
  202|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
  ------------------
  |  |  763|      0|# define ASN1_OP_I2D_POST        7
  ------------------
  |  Branch (202:13): [True: 0, False: 0]
  |  Branch (202:24): [True: 0, False: 0]
  ------------------
  203|      0|            return 0;
  204|      0|        return seqlen;
  205|       |
  206|      0|    default:
  ------------------
  |  Branch (206:5): [True: 0, False: 884]
  ------------------
  207|      0|        return 0;
  208|       |
  209|    884|    }
  210|      0|    return 0;
  211|    884|}
tasn_enc.c:asn1_item_flags_i2d:
   56|    442|{
   57|    442|    if (out && !*out) {
  ------------------
  |  Branch (57:9): [True: 442, False: 0]
  |  Branch (57:16): [True: 442, False: 0]
  ------------------
   58|    442|        unsigned char *p, *buf;
   59|    442|        int len;
   60|       |
   61|    442|        len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);
   62|    442|        if (len <= 0)
  ------------------
  |  Branch (62:13): [True: 0, False: 442]
  ------------------
   63|      0|            return len;
   64|    442|        if ((buf = OPENSSL_malloc(len)) == NULL) {
  ------------------
  |  |  118|    442|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    442|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    442|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (64:13): [True: 0, False: 442]
  ------------------
   65|      0|            ASN1err(ASN1_F_ASN1_ITEM_FLAGS_I2D, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  111|      0|# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   66|      0|            return -1;
   67|      0|        }
   68|    442|        p = buf;
   69|    442|        ASN1_item_ex_i2d(&val, &p, it, -1, flags);
   70|    442|        *out = buf;
   71|    442|        return len;
   72|    442|    }
   73|       |
   74|      0|    return ASN1_item_ex_i2d(&val, out, it, -1, flags);
   75|    442|}
tasn_enc.c:asn1_i2d_ex_primitive:
  449|    884|{
  450|    884|    int len;
  451|    884|    int utype;
  452|    884|    int usetag;
  453|    884|    int ndef = 0;
  454|       |
  455|    884|    utype = it->utype;
  456|       |
  457|       |    /*
  458|       |     * Get length of content octets and maybe find out the underlying type.
  459|       |     */
  460|       |
  461|    884|    len = asn1_ex_i2c(pval, NULL, &utype, it);
  462|       |
  463|       |    /*
  464|       |     * If SEQUENCE, SET or OTHER then header is included in pseudo content
  465|       |     * octets so don't include tag+length. We need to check here because the
  466|       |     * call to asn1_ex_i2c() could change utype.
  467|       |     */
  468|    884|    if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
  ------------------
  |  |   62|    884|# define V_ASN1_SEQUENCE                 16
  ------------------
                  if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
  ------------------
  |  |   63|    884|# define V_ASN1_SET                      17
  ------------------
  |  Branch (468:9): [True: 0, False: 884]
  |  Branch (468:39): [True: 0, False: 884]
  ------------------
  469|    884|        (utype == V_ASN1_OTHER))
  ------------------
  |  |   45|    884|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (469:9): [True: 0, False: 884]
  ------------------
  470|      0|        usetag = 0;
  471|    884|    else
  472|    884|        usetag = 1;
  473|       |
  474|       |    /* -1 means omit type */
  475|       |
  476|    884|    if (len == -1)
  ------------------
  |  Branch (476:9): [True: 0, False: 884]
  ------------------
  477|      0|        return 0;
  478|       |
  479|       |    /* -2 return is special meaning use ndef */
  480|    884|    if (len == -2) {
  ------------------
  |  Branch (480:9): [True: 0, False: 884]
  ------------------
  481|      0|        ndef = 2;
  482|      0|        len = 0;
  483|      0|    }
  484|       |
  485|       |    /* If not implicitly tagged get tag from underlying type */
  486|    884|    if (tag == -1)
  ------------------
  |  Branch (486:9): [True: 884, False: 0]
  ------------------
  487|    884|        tag = utype;
  488|       |
  489|       |    /* Output tag+length followed by content octets */
  490|    884|    if (out) {
  ------------------
  |  Branch (490:9): [True: 442, False: 442]
  ------------------
  491|    442|        if (usetag)
  ------------------
  |  Branch (491:13): [True: 442, False: 0]
  ------------------
  492|    442|            ASN1_put_object(out, ndef, len, tag, aclass);
  493|    442|        asn1_ex_i2c(pval, *out, &utype, it);
  494|    442|        if (ndef)
  ------------------
  |  Branch (494:13): [True: 0, False: 442]
  ------------------
  495|      0|            ASN1_put_eoc(out);
  496|    442|        else
  497|    442|            *out += len;
  498|    442|    }
  499|       |
  500|    884|    if (usetag)
  ------------------
  |  Branch (500:9): [True: 884, False: 0]
  ------------------
  501|    884|        return ASN1_object_size(ndef, len, tag);
  502|      0|    return len;
  503|    884|}
tasn_enc.c:asn1_ex_i2c:
  509|  1.32k|{
  510|  1.32k|    ASN1_BOOLEAN *tbool = NULL;
  511|  1.32k|    ASN1_STRING *strtmp;
  512|  1.32k|    ASN1_OBJECT *otmp;
  513|  1.32k|    int utype;
  514|  1.32k|    const unsigned char *cont;
  515|  1.32k|    unsigned char c;
  516|  1.32k|    int len;
  517|  1.32k|    const ASN1_PRIMITIVE_FUNCS *pf;
  518|  1.32k|    pf = it->funcs;
  519|  1.32k|    if (pf && pf->prim_i2c)
  ------------------
  |  Branch (519:9): [True: 0, False: 1.32k]
  |  Branch (519:15): [True: 0, False: 0]
  ------------------
  520|      0|        return pf->prim_i2c(pval, cout, putype, it);
  521|       |
  522|       |    /* Should type be omitted? */
  523|  1.32k|    if ((it->itype != ASN1_ITYPE_PRIMITIVE)
  ------------------
  |  |  633|  1.32k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (523:9): [True: 0, False: 1.32k]
  ------------------
  524|  1.32k|        || (it->utype != V_ASN1_BOOLEAN)) {
  ------------------
  |  |   51|  1.32k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (524:12): [True: 1.32k, False: 0]
  ------------------
  525|  1.32k|        if (!*pval)
  ------------------
  |  Branch (525:13): [True: 0, False: 1.32k]
  ------------------
  526|      0|            return -1;
  527|  1.32k|    }
  528|       |
  529|  1.32k|    if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |  641|  1.32k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (529:9): [True: 0, False: 1.32k]
  ------------------
  530|       |        /* If MSTRING type set the underlying type */
  531|      0|        strtmp = (ASN1_STRING *)*pval;
  532|      0|        utype = strtmp->type;
  533|      0|        *putype = utype;
  534|  1.32k|    } else if (it->utype == V_ASN1_ANY) {
  ------------------
  |  |   46|  1.32k|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (534:16): [True: 0, False: 1.32k]
  ------------------
  535|       |        /* If ANY set type and pointer to value */
  536|      0|        ASN1_TYPE *typ;
  537|      0|        typ = (ASN1_TYPE *)*pval;
  538|      0|        utype = typ->type;
  539|      0|        *putype = utype;
  540|      0|        pval = &typ->value.asn1_value;
  541|      0|    } else
  542|  1.32k|        utype = *putype;
  543|       |
  544|  1.32k|    switch (utype) {
  545|      0|    case V_ASN1_OBJECT:
  ------------------
  |  |   56|      0|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (545:5): [True: 0, False: 1.32k]
  ------------------
  546|      0|        otmp = (ASN1_OBJECT *)*pval;
  547|      0|        cont = otmp->data;
  548|      0|        len = otmp->length;
  549|      0|        if (cont == NULL || len == 0)
  ------------------
  |  Branch (549:13): [True: 0, False: 0]
  |  Branch (549:29): [True: 0, False: 0]
  ------------------
  550|      0|            return -1;
  551|      0|        break;
  552|       |
  553|      0|    case V_ASN1_NULL:
  ------------------
  |  |   55|      0|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (553:5): [True: 0, False: 1.32k]
  ------------------
  554|      0|        cont = NULL;
  555|      0|        len = 0;
  556|      0|        break;
  557|       |
  558|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   51|      0|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (558:5): [True: 0, False: 1.32k]
  ------------------
  559|      0|        tbool = (ASN1_BOOLEAN *)pval;
  560|      0|        if (*tbool == -1)
  ------------------
  |  Branch (560:13): [True: 0, False: 0]
  ------------------
  561|      0|            return -1;
  562|      0|        if (it->utype != V_ASN1_ANY) {
  ------------------
  |  |   46|      0|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (562:13): [True: 0, False: 0]
  ------------------
  563|       |            /*
  564|       |             * Default handling if value == size field then omit
  565|       |             */
  566|      0|            if (*tbool && (it->size > 0))
  ------------------
  |  Branch (566:17): [True: 0, False: 0]
  |  Branch (566:27): [True: 0, False: 0]
  ------------------
  567|      0|                return -1;
  568|      0|            if (!*tbool && !it->size)
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  |  Branch (568:28): [True: 0, False: 0]
  ------------------
  569|      0|                return -1;
  570|      0|        }
  571|      0|        c = (unsigned char)*tbool;
  572|      0|        cont = &c;
  573|      0|        len = 1;
  574|      0|        break;
  575|       |
  576|      0|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   53|      0|# define V_ASN1_BIT_STRING               3
  ------------------
  |  Branch (576:5): [True: 0, False: 1.32k]
  ------------------
  577|      0|        return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval,
  578|      0|                                   cout ? &cout : NULL);
  ------------------
  |  Branch (578:36): [True: 0, False: 0]
  ------------------
  579|       |
  580|      0|    case V_ASN1_INTEGER:
  ------------------
  |  |   52|      0|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (580:5): [True: 0, False: 1.32k]
  ------------------
  581|      0|    case V_ASN1_ENUMERATED:
  ------------------
  |  |   60|      0|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (581:5): [True: 0, False: 1.32k]
  ------------------
  582|       |        /*
  583|       |         * These are all have the same content format as ASN1_INTEGER
  584|       |         */
  585|      0|        return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
  ------------------
  |  Branch (585:56): [True: 0, False: 0]
  ------------------
  586|       |
  587|  1.32k|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   54|  1.32k|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (587:5): [True: 1.32k, False: 0]
  ------------------
  588|  1.32k|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   64|  1.32k|# define V_ASN1_NUMERICSTRING            18 /**/
  ------------------
  |  Branch (588:5): [True: 0, False: 1.32k]
  ------------------
  589|  1.32k|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |   65|  1.32k|# define V_ASN1_PRINTABLESTRING          19
  ------------------
  |  Branch (589:5): [True: 0, False: 1.32k]
  ------------------
  590|  1.32k|    case V_ASN1_T61STRING:
  ------------------
  |  |   66|  1.32k|# define V_ASN1_T61STRING                20
  ------------------
  |  Branch (590:5): [True: 0, False: 1.32k]
  ------------------
  591|  1.32k|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |   68|  1.32k|# define V_ASN1_VIDEOTEXSTRING           21 /**/
  ------------------
  |  Branch (591:5): [True: 0, False: 1.32k]
  ------------------
  592|  1.32k|    case V_ASN1_IA5STRING:
  ------------------
  |  |   69|  1.32k|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (592:5): [True: 0, False: 1.32k]
  ------------------
  593|  1.32k|    case V_ASN1_UTCTIME:
  ------------------
  |  |   70|  1.32k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (593:5): [True: 0, False: 1.32k]
  ------------------
  594|  1.32k|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |   71|  1.32k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (594:5): [True: 0, False: 1.32k]
  ------------------
  595|  1.32k|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |   72|  1.32k|# define V_ASN1_GRAPHICSTRING            25 /**/
  ------------------
  |  Branch (595:5): [True: 0, False: 1.32k]
  ------------------
  596|  1.32k|    case V_ASN1_VISIBLESTRING:
  ------------------
  |  |   74|  1.32k|# define V_ASN1_VISIBLESTRING            26/* alias */
  ------------------
  |  Branch (596:5): [True: 0, False: 1.32k]
  ------------------
  597|  1.32k|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |   75|  1.32k|# define V_ASN1_GENERALSTRING            27 /**/
  ------------------
  |  Branch (597:5): [True: 0, False: 1.32k]
  ------------------
  598|  1.32k|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |   76|  1.32k|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  |  Branch (598:5): [True: 0, False: 1.32k]
  ------------------
  599|  1.32k|    case V_ASN1_BMPSTRING:
  ------------------
  |  |   77|  1.32k|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (599:5): [True: 0, False: 1.32k]
  ------------------
  600|  1.32k|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   61|  1.32k|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (600:5): [True: 0, False: 1.32k]
  ------------------
  601|  1.32k|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   62|  1.32k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (601:5): [True: 0, False: 1.32k]
  ------------------
  602|  1.32k|    case V_ASN1_SET:
  ------------------
  |  |   63|  1.32k|# define V_ASN1_SET                      17
  ------------------
  |  Branch (602:5): [True: 0, False: 1.32k]
  ------------------
  603|  1.32k|    default:
  ------------------
  |  Branch (603:5): [True: 0, False: 1.32k]
  ------------------
  604|       |        /* All based on ASN1_STRING and handled the same */
  605|  1.32k|        strtmp = (ASN1_STRING *)*pval;
  606|       |        /* Special handling for NDEF */
  607|  1.32k|        if ((it->size == ASN1_TFLG_NDEF)
  ------------------
  |  |  573|  1.32k|# define ASN1_TFLG_NDEF          (0x1<<11)
  ------------------
  |  Branch (607:13): [True: 0, False: 1.32k]
  ------------------
  608|  1.32k|            && (strtmp->flags & ASN1_STRING_FLAG_NDEF)) {
  ------------------
  |  |  127|      0|# define ASN1_STRING_FLAG_NDEF 0x010
  ------------------
  |  Branch (608:16): [True: 0, False: 0]
  ------------------
  609|      0|            if (cout) {
  ------------------
  |  Branch (609:17): [True: 0, False: 0]
  ------------------
  610|      0|                strtmp->data = cout;
  611|      0|                strtmp->length = 0;
  612|      0|            }
  613|       |            /* Special return code */
  614|      0|            return -2;
  615|      0|        }
  616|  1.32k|        cont = strtmp->data;
  617|  1.32k|        len = strtmp->length;
  618|       |
  619|  1.32k|        break;
  620|       |
  621|  1.32k|    }
  622|  1.32k|    if (cout && len)
  ------------------
  |  Branch (622:9): [True: 442, False: 884]
  |  Branch (622:17): [True: 442, False: 0]
  ------------------
  623|    442|        memcpy(cout, cont, len);
  624|  1.32k|    return len;
  625|  1.32k|}

ASN1_item_ex_free:
   24|    637|{
   25|    637|    asn1_item_embed_free(pval, it, 0);
   26|    637|}
asn1_item_embed_free:
   29|    637|{
   30|    637|    const ASN1_TEMPLATE *tt = NULL, *seqtt;
   31|    637|    const ASN1_EXTERN_FUNCS *ef;
   32|    637|    const ASN1_AUX *aux = it->funcs;
   33|    637|    ASN1_aux_cb *asn1_cb;
   34|    637|    int i;
   35|       |
   36|    637|    if (!pval)
  ------------------
  |  Branch (36:9): [True: 0, False: 637]
  ------------------
   37|      0|        return;
   38|    637|    if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)
  ------------------
  |  |  633|    637|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (38:9): [True: 0, False: 637]
  |  Branch (38:48): [True: 0, False: 0]
  ------------------
   39|      0|        return;
   40|    637|    if (aux && aux->asn1_cb)
  ------------------
  |  Branch (40:9): [True: 0, False: 637]
  |  Branch (40:16): [True: 0, False: 0]
  ------------------
   41|      0|        asn1_cb = aux->asn1_cb;
   42|    637|    else
   43|    637|        asn1_cb = 0;
   44|       |
   45|    637|    switch (it->itype) {
  ------------------
  |  Branch (45:13): [True: 0, False: 637]
  ------------------
   46|       |
   47|    637|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |  633|    637|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (47:5): [True: 637, False: 0]
  ------------------
   48|    637|        if (it->templates)
  ------------------
  |  Branch (48:13): [True: 0, False: 637]
  ------------------
   49|      0|            asn1_template_free(pval, it->templates);
   50|    637|        else
   51|    637|            asn1_primitive_free(pval, it, embed);
   52|    637|        break;
   53|       |
   54|      0|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |  641|      0|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (54:5): [True: 0, False: 637]
  ------------------
   55|      0|        asn1_primitive_free(pval, it, embed);
   56|      0|        break;
   57|       |
   58|      0|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |  637|      0|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (58:5): [True: 0, False: 637]
  ------------------
   59|      0|        if (asn1_cb) {
  ------------------
  |  Branch (59:13): [True: 0, False: 0]
  ------------------
   60|      0|            i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
  ------------------
  |  |  758|      0|# define ASN1_OP_FREE_PRE        2
  ------------------
   61|      0|            if (i == 2)
  ------------------
  |  Branch (61:17): [True: 0, False: 0]
  ------------------
   62|      0|                return;
   63|      0|        }
   64|      0|        i = asn1_get_choice_selector(pval, it);
   65|      0|        if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (65:13): [True: 0, False: 0]
  |  Branch (65:25): [True: 0, False: 0]
  ------------------
   66|      0|            ASN1_VALUE **pchval;
   67|       |
   68|      0|            tt = it->templates + i;
   69|      0|            pchval = asn1_get_field_ptr(pval, tt);
   70|      0|            asn1_template_free(pchval, tt);
   71|      0|        }
   72|      0|        if (asn1_cb)
  ------------------
  |  Branch (72:13): [True: 0, False: 0]
  ------------------
   73|      0|            asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
  ------------------
  |  |  759|      0|# define ASN1_OP_FREE_POST       3
  ------------------
   74|      0|        if (embed == 0) {
  ------------------
  |  Branch (74:13): [True: 0, False: 0]
  ------------------
   75|      0|            OPENSSL_free(*pval);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   76|      0|            *pval = NULL;
   77|      0|        }
   78|      0|        break;
   79|       |
   80|      0|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |  639|      0|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (80:5): [True: 0, False: 637]
  ------------------
   81|      0|        ef = it->funcs;
   82|      0|        if (ef && ef->asn1_ex_free)
  ------------------
  |  Branch (82:13): [True: 0, False: 0]
  |  Branch (82:19): [True: 0, False: 0]
  ------------------
   83|      0|            ef->asn1_ex_free(pval, it);
   84|      0|        break;
   85|       |
   86|      0|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |  643|      0|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (86:5): [True: 0, False: 637]
  ------------------
   87|      0|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |  635|      0|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (87:5): [True: 0, False: 637]
  ------------------
   88|      0|        if (asn1_do_lock(pval, -1, it) != 0) /* if error or ref-counter > 0 */
  ------------------
  |  Branch (88:13): [True: 0, False: 0]
  ------------------
   89|      0|            return;
   90|      0|        if (asn1_cb) {
  ------------------
  |  Branch (90:13): [True: 0, False: 0]
  ------------------
   91|      0|            i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
  ------------------
  |  |  758|      0|# define ASN1_OP_FREE_PRE        2
  ------------------
   92|      0|            if (i == 2)
  ------------------
  |  Branch (92:17): [True: 0, False: 0]
  ------------------
   93|      0|                return;
   94|      0|        }
   95|      0|        asn1_enc_free(pval, it);
   96|       |        /*
   97|       |         * If we free up as normal we will invalidate any ANY DEFINED BY
   98|       |         * field and we won't be able to determine the type of the field it
   99|       |         * defines. So free up in reverse order.
  100|       |         */
  101|      0|        tt = it->templates + it->tcount;
  102|      0|        for (i = 0; i < it->tcount; i++) {
  ------------------
  |  Branch (102:21): [True: 0, False: 0]
  ------------------
  103|      0|            ASN1_VALUE **pseqval;
  104|       |
  105|      0|            tt--;
  106|      0|            seqtt = asn1_do_adb(pval, tt, 0);
  107|      0|            if (!seqtt)
  ------------------
  |  Branch (107:17): [True: 0, False: 0]
  ------------------
  108|      0|                continue;
  109|      0|            pseqval = asn1_get_field_ptr(pval, seqtt);
  110|      0|            asn1_template_free(pseqval, seqtt);
  111|      0|        }
  112|      0|        if (asn1_cb)
  ------------------
  |  Branch (112:13): [True: 0, False: 0]
  ------------------
  113|      0|            asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
  ------------------
  |  |  759|      0|# define ASN1_OP_FREE_POST       3
  ------------------
  114|      0|        if (embed == 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|            OPENSSL_free(*pval);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  116|      0|            *pval = NULL;
  117|      0|        }
  118|      0|        break;
  119|    637|    }
  120|    637|}
asn1_primitive_free:
  147|    637|{
  148|    637|    int utype;
  149|       |
  150|       |    /* Special case: if 'it' is a primitive with a free_func, use that. */
  151|    637|    if (it) {
  ------------------
  |  Branch (151:9): [True: 637, False: 0]
  ------------------
  152|    637|        const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
  153|       |
  154|    637|        if (embed) {
  ------------------
  |  Branch (154:13): [True: 0, False: 637]
  ------------------
  155|      0|            if (pf && pf->prim_clear) {
  ------------------
  |  Branch (155:17): [True: 0, False: 0]
  |  Branch (155:23): [True: 0, False: 0]
  ------------------
  156|      0|                pf->prim_clear(pval, it);
  157|      0|                return;
  158|      0|            }
  159|    637|        } else if (pf && pf->prim_free) {
  ------------------
  |  Branch (159:20): [True: 0, False: 637]
  |  Branch (159:26): [True: 0, False: 0]
  ------------------
  160|      0|            pf->prim_free(pval, it);
  161|      0|            return;
  162|      0|        }
  163|    637|    }
  164|       |
  165|       |    /* Special case: if 'it' is NULL, free contents of ASN1_TYPE */
  166|    637|    if (!it) {
  ------------------
  |  Branch (166:9): [True: 0, False: 637]
  ------------------
  167|      0|        ASN1_TYPE *typ = (ASN1_TYPE *)*pval;
  168|       |
  169|      0|        utype = typ->type;
  170|      0|        pval = &typ->value.asn1_value;
  171|      0|        if (!*pval)
  ------------------
  |  Branch (171:13): [True: 0, False: 0]
  ------------------
  172|      0|            return;
  173|    637|    } else if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |  641|    637|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (173:16): [True: 0, False: 637]
  ------------------
  174|      0|        utype = -1;
  175|      0|        if (!*pval)
  ------------------
  |  Branch (175:13): [True: 0, False: 0]
  ------------------
  176|      0|            return;
  177|    637|    } else {
  178|    637|        utype = it->utype;
  179|    637|        if ((utype != V_ASN1_BOOLEAN) && !*pval)
  ------------------
  |  |   51|    637|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (179:13): [True: 637, False: 0]
  |  Branch (179:42): [True: 637, False: 0]
  ------------------
  180|    637|            return;
  181|    637|    }
  182|       |
  183|      0|    switch (utype) {
  184|      0|    case V_ASN1_OBJECT:
  ------------------
  |  |   56|      0|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (184:5): [True: 0, False: 0]
  ------------------
  185|      0|        ASN1_OBJECT_free((ASN1_OBJECT *)*pval);
  186|      0|        break;
  187|       |
  188|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   51|      0|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (188:5): [True: 0, False: 0]
  ------------------
  189|      0|        if (it)
  ------------------
  |  Branch (189:13): [True: 0, False: 0]
  ------------------
  190|      0|            *(ASN1_BOOLEAN *)pval = it->size;
  191|      0|        else
  192|      0|            *(ASN1_BOOLEAN *)pval = -1;
  193|      0|        return;
  194|       |
  195|      0|    case V_ASN1_NULL:
  ------------------
  |  |   55|      0|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (195:5): [True: 0, False: 0]
  ------------------
  196|      0|        break;
  197|       |
  198|      0|    case V_ASN1_ANY:
  ------------------
  |  |   46|      0|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (198:5): [True: 0, False: 0]
  ------------------
  199|      0|        asn1_primitive_free(pval, NULL, 0);
  200|      0|        OPENSSL_free(*pval);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  201|      0|        break;
  202|       |
  203|      0|    default:
  ------------------
  |  Branch (203:5): [True: 0, False: 0]
  ------------------
  204|      0|        asn1_string_embed_free((ASN1_STRING *)*pval, embed);
  205|      0|        break;
  206|      0|    }
  207|      0|    *pval = NULL;
  208|      0|}

ASN1_OCTET_STRING_free:
   23|    986|void sname##_free(sname *x) \
   24|    986|{ \
   25|    986|    ASN1_STRING_free(x); \
   26|    986|}
ASN1_GENERALIZEDTIME_new:
   19|  8.64k|sname *sname##_new(void) \
   20|  8.64k|{ \
   21|  8.64k|    return ASN1_STRING_type_new(V_##sname); \
   22|  8.64k|} \
ASN1_GENERALIZEDTIME_free:
   23|  8.64k|void sname##_free(sname *x) \
   24|  8.64k|{ \
   25|  8.64k|    ASN1_STRING_free(x); \
   26|  8.64k|}

ERR_load_ASYNC_strings:
   43|      2|{
   44|      2|#ifndef OPENSSL_NO_ERR
   45|      2|    if (ERR_func_error_string(ASYNC_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (45:9): [True: 2, False: 0]
  ------------------
   46|      2|        ERR_load_strings_const(ASYNC_str_functs);
   47|      2|        ERR_load_strings_const(ASYNC_str_reasons);
   48|      2|    }
   49|      2|#endif
   50|      2|    return 1;
   51|      2|}

BIO_hex_string:
  127|   171k|{
  128|   171k|    int i, j = 0;
  129|       |
  130|   171k|    if (datalen < 1)
  ------------------
  |  Branch (130:9): [True: 2.25k, False: 169k]
  ------------------
  131|  2.25k|        return 1;
  132|       |
  133|  3.41M|    for (i = 0; i < datalen - 1; i++) {
  ------------------
  |  Branch (133:17): [True: 3.24M, False: 169k]
  ------------------
  134|  3.24M|        if (i && !j)
  ------------------
  |  Branch (134:13): [True: 3.22M, False: 14.9k]
  |  Branch (134:18): [True: 191k, False: 3.03M]
  ------------------
  135|   191k|            BIO_printf(out, "%*s", indent, "");
  136|       |
  137|  3.24M|        BIO_printf(out, "%02X:", data[i]);
  138|       |
  139|  3.24M|        j = (j + 1) % width;
  140|  3.24M|        if (!j)
  ------------------
  |  Branch (140:13): [True: 192k, False: 3.04M]
  ------------------
  141|   192k|            BIO_printf(out, "\n");
  142|  3.24M|    }
  143|       |
  144|   169k|    if (i && !j)
  ------------------
  |  Branch (144:9): [True: 14.9k, False: 154k]
  |  Branch (144:14): [True: 1.32k, False: 13.6k]
  ------------------
  145|  1.32k|        BIO_printf(out, "%*s", indent, "");
  146|   169k|    BIO_printf(out, "%02X", data[datalen - 1]);
  147|   169k|    return 1;
  148|   171k|}

BIO_printf:
  877|  4.50M|{
  878|  4.50M|    va_list args;
  879|  4.50M|    int ret;
  880|       |
  881|  4.50M|    va_start(args, format);
  882|       |
  883|  4.50M|    ret = BIO_vprintf(bio, format, args);
  884|       |
  885|  4.50M|    va_end(args);
  886|  4.50M|    return ret;
  887|  4.50M|}
BIO_vprintf:
  890|  4.50M|{
  891|  4.50M|    int ret;
  892|  4.50M|    size_t retlen;
  893|  4.50M|    char hugebuf[1024 * 2];     /* Was previously 10k, which is unreasonable
  894|       |                                 * in small-stack environments, like threads
  895|       |                                 * or DOS programs. */
  896|  4.50M|    char *hugebufp = hugebuf;
  897|  4.50M|    size_t hugebufsize = sizeof(hugebuf);
  898|  4.50M|    char *dynbuf = NULL;
  899|  4.50M|    int ignored;
  900|       |
  901|  4.50M|    dynbuf = NULL;
  902|  4.50M|    if (!_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format,
  ------------------
  |  Branch (902:9): [True: 0, False: 4.50M]
  ------------------
  903|  4.50M|                args)) {
  904|      0|        OPENSSL_free(dynbuf);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  905|      0|        return -1;
  906|      0|    }
  907|  4.50M|    if (dynbuf) {
  ------------------
  |  Branch (907:9): [True: 0, False: 4.50M]
  ------------------
  908|      0|        ret = BIO_write(bio, dynbuf, (int)retlen);
  909|      0|        OPENSSL_free(dynbuf);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  910|  4.50M|    } else {
  911|  4.50M|        ret = BIO_write(bio, hugebuf, (int)retlen);
  912|  4.50M|    }
  913|  4.50M|    return ret;
  914|  4.50M|}
BIO_snprintf:
  923|  14.0k|{
  924|  14.0k|    va_list args;
  925|  14.0k|    int ret;
  926|       |
  927|  14.0k|    va_start(args, format);
  928|       |
  929|  14.0k|    ret = BIO_vsnprintf(buf, n, format, args);
  930|       |
  931|  14.0k|    va_end(args);
  932|  14.0k|    return ret;
  933|  14.0k|}
BIO_vsnprintf:
  936|  14.0k|{
  937|  14.0k|    size_t retlen;
  938|  14.0k|    int truncated;
  939|       |
  940|  14.0k|    if (!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args))
  ------------------
  |  Branch (940:9): [True: 0, False: 14.0k]
  ------------------
  941|      0|        return -1;
  942|       |
  943|  14.0k|    if (truncated)
  ------------------
  |  Branch (943:9): [True: 0, False: 14.0k]
  ------------------
  944|       |        /*
  945|       |         * In case of truncation, return -1 like traditional snprintf.
  946|       |         * (Current drafts for ISO/IEC 9899 say snprintf should return the
  947|       |         * number of characters that would have been written, had the buffer
  948|       |         * been large enough.)
  949|       |         */
  950|      0|        return -1;
  951|  14.0k|    else
  952|  14.0k|        return (retlen <= INT_MAX) ? (int)retlen : -1;
  ------------------
  |  Branch (952:16): [True: 14.0k, False: 0]
  ------------------
  953|  14.0k|}
b_print.c:_dopr:
   91|  4.52M|{
   92|  4.52M|    char ch;
   93|  4.52M|    int64_t value;
   94|  4.52M|#ifndef OPENSSL_SYS_UEFI
   95|  4.52M|    LDOUBLE fvalue;
  ------------------
  |  |   28|  4.52M|# define LDOUBLE double
  ------------------
   96|  4.52M|#endif
   97|  4.52M|    char *strvalue;
   98|  4.52M|    int min;
   99|  4.52M|    int max;
  100|  4.52M|    int state;
  101|  4.52M|    int flags;
  102|  4.52M|    int cflags;
  103|  4.52M|    size_t currlen;
  104|       |
  105|  4.52M|    state = DP_S_DEFAULT;
  ------------------
  |  |   45|  4.52M|#define DP_S_DEFAULT    0
  ------------------
  106|  4.52M|    flags = currlen = cflags = min = 0;
  107|  4.52M|    max = -1;
  108|  4.52M|    ch = *format++;
  109|       |
  110|  54.4M|    while (state != DP_S_DONE) {
  ------------------
  |  |   52|  54.4M|#define DP_S_DONE       7
  ------------------
  |  Branch (110:12): [True: 49.9M, False: 4.52M]
  ------------------
  111|  49.9M|        if (ch == '\0' || (buffer == NULL && currlen >= *maxlen))
  ------------------
  |  Branch (111:13): [True: 4.52M, False: 45.4M]
  |  Branch (111:28): [True: 430k, False: 45.0M]
  |  Branch (111:46): [True: 0, False: 430k]
  ------------------
  112|  4.52M|            state = DP_S_DONE;
  ------------------
  |  |   52|  4.52M|#define DP_S_DONE       7
  ------------------
  113|       |
  114|  49.9M|        switch (state) {
  115|  16.5M|        case DP_S_DEFAULT:
  ------------------
  |  |   45|  16.5M|#define DP_S_DEFAULT    0
  ------------------
  |  Branch (115:9): [True: 16.5M, False: 33.4M]
  ------------------
  116|  16.5M|            if (ch == '%')
  ------------------
  |  Branch (116:17): [True: 4.38M, False: 12.1M]
  ------------------
  117|  4.38M|                state = DP_S_FLAGS;
  ------------------
  |  |   46|  4.38M|#define DP_S_FLAGS      1
  ------------------
  118|  12.1M|            else
  119|  12.1M|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
  ------------------
  |  Branch (119:21): [True: 0, False: 12.1M]
  ------------------
  120|      0|                    return 0;
  121|  16.5M|            ch = *format++;
  122|  16.5M|            break;
  123|  7.85M|        case DP_S_FLAGS:
  ------------------
  |  |   46|  7.85M|#define DP_S_FLAGS      1
  ------------------
  |  Branch (123:9): [True: 7.85M, False: 42.1M]
  ------------------
  124|  7.85M|            switch (ch) {
  125|      0|            case '-':
  ------------------
  |  Branch (125:13): [True: 0, False: 7.85M]
  ------------------
  126|      0|                flags |= DP_F_MINUS;
  ------------------
  |  |   56|      0|#define DP_F_MINUS      (1 << 0)
  ------------------
  127|      0|                ch = *format++;
  128|      0|                break;
  129|      0|            case '+':
  ------------------
  |  Branch (129:13): [True: 0, False: 7.85M]
  ------------------
  130|      0|                flags |= DP_F_PLUS;
  ------------------
  |  |   58|      0|#define DP_F_PLUS       (1 << 1)
  ------------------
  131|      0|                ch = *format++;
  132|      0|                break;
  133|      0|            case ' ':
  ------------------
  |  Branch (133:13): [True: 0, False: 7.85M]
  ------------------
  134|      0|                flags |= DP_F_SPACE;
  ------------------
  |  |   60|      0|#define DP_F_SPACE      (1 << 2)
  ------------------
  135|      0|                ch = *format++;
  136|      0|                break;
  137|      0|            case '#':
  ------------------
  |  Branch (137:13): [True: 0, False: 7.85M]
  ------------------
  138|      0|                flags |= DP_F_NUM;
  ------------------
  |  |   62|      0|#define DP_F_NUM        (1 << 3)
  ------------------
  139|      0|                ch = *format++;
  140|      0|                break;
  141|  3.46M|            case '0':
  ------------------
  |  Branch (141:13): [True: 3.46M, False: 4.38M]
  ------------------
  142|  3.46M|                flags |= DP_F_ZERO;
  ------------------
  |  |   64|  3.46M|#define DP_F_ZERO       (1 << 4)
  ------------------
  143|  3.46M|                ch = *format++;
  144|  3.46M|                break;
  145|  4.38M|            default:
  ------------------
  |  Branch (145:13): [True: 4.38M, False: 3.46M]
  ------------------
  146|  4.38M|                state = DP_S_MIN;
  ------------------
  |  |   47|  4.38M|#define DP_S_MIN        2
  ------------------
  147|  4.38M|                break;
  148|  7.85M|            }
  149|  7.85M|            break;
  150|  7.85M|        case DP_S_MIN:
  ------------------
  |  |   47|  7.85M|#define DP_S_MIN        2
  ------------------
  |  Branch (150:9): [True: 7.85M, False: 42.0M]
  ------------------
  151|  7.85M|            if (ossl_isdigit(ch)) {
  ------------------
  |  |   71|  7.85M|# define ossl_isdigit(c)        (ossl_ctype_check((c), CTYPE_MASK_digit))
  |  |  ------------------
  |  |  |  |   26|  7.85M|# define CTYPE_MASK_digit       0x4
  |  |  ------------------
  |  |  |  Branch (71:33): [True: 3.47M, False: 4.38M]
  |  |  ------------------
  ------------------
  152|  3.47M|                min = 10 * min + char_to_int(ch);
  ------------------
  |  |   83|  3.47M|#define char_to_int(p) (p - '0')
  ------------------
  153|  3.47M|                ch = *format++;
  154|  4.38M|            } else if (ch == '*') {
  ------------------
  |  Branch (154:24): [True: 711k, False: 3.67M]
  ------------------
  155|   711k|                min = va_arg(args, int);
  156|   711k|                ch = *format++;
  157|   711k|                state = DP_S_DOT;
  ------------------
  |  |   48|   711k|#define DP_S_DOT        3
  ------------------
  158|   711k|            } else
  159|  3.67M|                state = DP_S_DOT;
  ------------------
  |  |   48|  3.67M|#define DP_S_DOT        3
  ------------------
  160|  7.85M|            break;
  161|  4.38M|        case DP_S_DOT:
  ------------------
  |  |   48|  4.38M|#define DP_S_DOT        3
  ------------------
  |  Branch (161:9): [True: 4.38M, False: 45.5M]
  ------------------
  162|  4.38M|            if (ch == '.') {
  ------------------
  |  Branch (162:17): [True: 14.0k, False: 4.37M]
  ------------------
  163|  14.0k|                state = DP_S_MAX;
  ------------------
  |  |   49|  14.0k|#define DP_S_MAX        4
  ------------------
  164|  14.0k|                ch = *format++;
  165|  14.0k|            } else
  166|  4.37M|                state = DP_S_MOD;
  ------------------
  |  |   50|  4.37M|#define DP_S_MOD        5
  ------------------
  167|  4.38M|            break;
  168|  31.3k|        case DP_S_MAX:
  ------------------
  |  |   49|  31.3k|#define DP_S_MAX        4
  ------------------
  |  Branch (168:9): [True: 31.3k, False: 49.9M]
  ------------------
  169|  31.3k|            if (ossl_isdigit(ch)) {
  ------------------
  |  |   71|  31.3k|# define ossl_isdigit(c)        (ossl_ctype_check((c), CTYPE_MASK_digit))
  |  |  ------------------
  |  |  |  |   26|  31.3k|# define CTYPE_MASK_digit       0x4
  |  |  ------------------
  |  |  |  Branch (71:33): [True: 17.2k, False: 14.0k]
  |  |  ------------------
  ------------------
  170|  17.2k|                if (max < 0)
  ------------------
  |  Branch (170:21): [True: 8.64k, False: 8.64k]
  ------------------
  171|  8.64k|                    max = 0;
  172|  17.2k|                max = 10 * max + char_to_int(ch);
  ------------------
  |  |   83|  17.2k|#define char_to_int(p) (p - '0')
  ------------------
  173|  17.2k|                ch = *format++;
  174|  17.2k|            } else if (ch == '*') {
  ------------------
  |  Branch (174:24): [True: 5.42k, False: 8.64k]
  ------------------
  175|  5.42k|                max = va_arg(args, int);
  176|  5.42k|                ch = *format++;
  177|  5.42k|                state = DP_S_MOD;
  ------------------
  |  |   50|  5.42k|#define DP_S_MOD        5
  ------------------
  178|  5.42k|            } else
  179|  8.64k|                state = DP_S_MOD;
  ------------------
  |  |   50|  8.64k|#define DP_S_MOD        5
  ------------------
  180|  31.3k|            break;
  181|  4.38M|        case DP_S_MOD:
  ------------------
  |  |   50|  4.38M|#define DP_S_MOD        5
  ------------------
  |  Branch (181:9): [True: 4.38M, False: 45.5M]
  ------------------
  182|  4.38M|            switch (ch) {
  183|      0|            case 'h':
  ------------------
  |  Branch (183:13): [True: 0, False: 4.38M]
  ------------------
  184|      0|                cflags = DP_C_SHORT;
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  185|      0|                ch = *format++;
  186|      0|                break;
  187|      0|            case 'l':
  ------------------
  |  Branch (187:13): [True: 0, False: 4.38M]
  ------------------
  188|      0|                if (*format == 'l') {
  ------------------
  |  Branch (188:21): [True: 0, False: 0]
  ------------------
  189|      0|                    cflags = DP_C_LLONG;
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  190|      0|                    format++;
  191|      0|                } else
  192|      0|                    cflags = DP_C_LONG;
  ------------------
  |  |   72|      0|#define DP_C_LONG       2
  ------------------
  193|      0|                ch = *format++;
  194|      0|                break;
  195|      0|            case 'q':
  ------------------
  |  Branch (195:13): [True: 0, False: 4.38M]
  ------------------
  196|      0|            case 'j':
  ------------------
  |  Branch (196:13): [True: 0, False: 4.38M]
  ------------------
  197|      0|                cflags = DP_C_LLONG;
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  198|      0|                ch = *format++;
  199|      0|                break;
  200|      0|            case 'L':
  ------------------
  |  Branch (200:13): [True: 0, False: 4.38M]
  ------------------
  201|      0|                cflags = DP_C_LDOUBLE;
  ------------------
  |  |   73|      0|#define DP_C_LDOUBLE    3
  ------------------
  202|      0|                ch = *format++;
  203|      0|                break;
  204|      0|            case 'z':
  ------------------
  |  Branch (204:13): [True: 0, False: 4.38M]
  ------------------
  205|      0|                cflags = DP_C_SIZE;
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  206|      0|                ch = *format++;
  207|      0|                break;
  208|  4.38M|            default:
  ------------------
  |  Branch (208:13): [True: 4.38M, False: 0]
  ------------------
  209|  4.38M|                break;
  210|  4.38M|            }
  211|  4.38M|            state = DP_S_CONV;
  ------------------
  |  |   51|  4.38M|#define DP_S_CONV       6
  ------------------
  212|  4.38M|            break;
  213|  4.38M|        case DP_S_CONV:
  ------------------
  |  |   51|  4.38M|#define DP_S_CONV       6
  ------------------
  |  Branch (213:9): [True: 4.38M, False: 45.5M]
  ------------------
  214|  4.38M|            switch (ch) {
  215|  68.3k|            case 'd':
  ------------------
  |  Branch (215:13): [True: 68.3k, False: 4.31M]
  ------------------
  216|  68.3k|            case 'i':
  ------------------
  |  Branch (216:13): [True: 0, False: 4.38M]
  ------------------
  217|  68.3k|                switch (cflags) {
  218|      0|                case DP_C_SHORT:
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  |  Branch (218:17): [True: 0, False: 68.3k]
  ------------------
  219|      0|                    value = (short int)va_arg(args, int);
  220|      0|                    break;
  221|      0|                case DP_C_LONG:
  ------------------
  |  |   72|      0|#define DP_C_LONG       2
  ------------------
  |  Branch (221:17): [True: 0, False: 68.3k]
  ------------------
  222|      0|                    value = va_arg(args, long int);
  223|      0|                    break;
  224|      0|                case DP_C_LLONG:
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  |  Branch (224:17): [True: 0, False: 68.3k]
  ------------------
  225|      0|                    value = va_arg(args, int64_t);
  226|      0|                    break;
  227|      0|                case DP_C_SIZE:
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  |  Branch (227:17): [True: 0, False: 68.3k]
  ------------------
  228|      0|                    value = va_arg(args, ossl_ssize_t);
  229|      0|                    break;
  230|  68.3k|                default:
  ------------------
  |  Branch (230:17): [True: 68.3k, False: 0]
  ------------------
  231|  68.3k|                    value = va_arg(args, int);
  232|  68.3k|                    break;
  233|  68.3k|                }
  234|  68.3k|                if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 10, min,
  ------------------
  |  Branch (234:21): [True: 0, False: 68.3k]
  ------------------
  235|  68.3k|                            max, flags))
  236|      0|                    return 0;
  237|  68.3k|                break;
  238|  3.41M|            case 'X':
  ------------------
  |  Branch (238:13): [True: 3.41M, False: 974k]
  ------------------
  239|  3.41M|                flags |= DP_F_UP;
  ------------------
  |  |   66|  3.41M|#define DP_F_UP         (1 << 5)
  ------------------
  240|       |                /* FALLTHROUGH */
  241|  3.41M|            case 'x':
  ------------------
  |  Branch (241:13): [True: 0, False: 4.38M]
  ------------------
  242|  3.41M|            case 'o':
  ------------------
  |  Branch (242:13): [True: 0, False: 4.38M]
  ------------------
  243|  3.41M|            case 'u':
  ------------------
  |  Branch (243:13): [True: 0, False: 4.38M]
  ------------------
  244|  3.41M|                flags |= DP_F_UNSIGNED;
  ------------------
  |  |   68|  3.41M|#define DP_F_UNSIGNED   (1 << 6)
  ------------------
  245|  3.41M|                switch (cflags) {
  246|      0|                case DP_C_SHORT:
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  |  Branch (246:17): [True: 0, False: 3.41M]
  ------------------
  247|      0|                    value = (unsigned short int)va_arg(args, unsigned int);
  248|      0|                    break;
  249|      0|                case DP_C_LONG:
  ------------------
  |  |   72|      0|#define DP_C_LONG       2
  ------------------
  |  Branch (249:17): [True: 0, False: 3.41M]
  ------------------
  250|      0|                    value = va_arg(args, unsigned long int);
  251|      0|                    break;
  252|      0|                case DP_C_LLONG:
  ------------------
  |  |   74|      0|#define DP_C_LLONG      4
  ------------------
  |  Branch (252:17): [True: 0, False: 3.41M]
  ------------------
  253|      0|                    value = va_arg(args, uint64_t);
  254|      0|                    break;
  255|      0|                case DP_C_SIZE:
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  |  Branch (255:17): [True: 0, False: 3.41M]
  ------------------
  256|      0|                    value = va_arg(args, size_t);
  257|      0|                    break;
  258|  3.41M|                default:
  ------------------
  |  Branch (258:17): [True: 3.41M, False: 0]
  ------------------
  259|  3.41M|                    value = va_arg(args, unsigned int);
  260|  3.41M|                    break;
  261|  3.41M|                }
  262|  3.41M|                if (!fmtint(sbuffer, buffer, &currlen, maxlen, value,
  ------------------
  |  Branch (262:21): [True: 0, False: 3.41M]
  ------------------
  263|  3.41M|                            ch == 'o' ? 8 : (ch == 'u' ? 10 : 16),
  ------------------
  |  Branch (263:29): [True: 0, False: 3.41M]
  |  Branch (263:46): [True: 0, False: 3.41M]
  ------------------
  264|  3.41M|                            min, max, flags))
  265|      0|                    return 0;
  266|  3.41M|                break;
  267|  3.41M|#ifndef OPENSSL_SYS_UEFI
  268|  3.41M|            case 'f':
  ------------------
  |  Branch (268:13): [True: 0, False: 4.38M]
  ------------------
  269|      0|                if (cflags == DP_C_LDOUBLE)
  ------------------
  |  |   73|      0|#define DP_C_LDOUBLE    3
  ------------------
  |  Branch (269:21): [True: 0, False: 0]
  ------------------
  270|      0|                    fvalue = va_arg(args, LDOUBLE);
  271|      0|                else
  272|      0|                    fvalue = va_arg(args, double);
  273|      0|                if (!fmtfp(sbuffer, buffer, &currlen, maxlen, fvalue, min, max,
  ------------------
  |  Branch (273:21): [True: 0, False: 0]
  ------------------
  274|      0|                           flags, F_FORMAT))
  ------------------
  |  |   78|      0|#define F_FORMAT        0
  ------------------
  275|      0|                    return 0;
  276|      0|                break;
  277|      0|            case 'E':
  ------------------
  |  Branch (277:13): [True: 0, False: 4.38M]
  ------------------
  278|      0|                flags |= DP_F_UP;
  ------------------
  |  |   66|      0|#define DP_F_UP         (1 << 5)
  ------------------
  279|       |                /* fall thru */
  280|      0|            case 'e':
  ------------------
  |  Branch (280:13): [True: 0, False: 4.38M]
  ------------------
  281|      0|                if (cflags == DP_C_LDOUBLE)
  ------------------
  |  |   73|      0|#define DP_C_LDOUBLE    3
  ------------------
  |  Branch (281:21): [True: 0, False: 0]
  ------------------
  282|      0|                    fvalue = va_arg(args, LDOUBLE);
  283|      0|                else
  284|      0|                    fvalue = va_arg(args, double);
  285|      0|                if (!fmtfp(sbuffer, buffer, &currlen, maxlen, fvalue, min, max,
  ------------------
  |  Branch (285:21): [True: 0, False: 0]
  ------------------
  286|      0|                           flags, E_FORMAT))
  ------------------
  |  |   79|      0|#define E_FORMAT        1
  ------------------
  287|      0|                    return 0;
  288|      0|                break;
  289|      0|            case 'G':
  ------------------
  |  Branch (289:13): [True: 0, False: 4.38M]
  ------------------
  290|      0|                flags |= DP_F_UP;
  ------------------
  |  |   66|      0|#define DP_F_UP         (1 << 5)
  ------------------
  291|       |                /* fall thru */
  292|      0|            case 'g':
  ------------------
  |  Branch (292:13): [True: 0, False: 4.38M]
  ------------------
  293|      0|                if (cflags == DP_C_LDOUBLE)
  ------------------
  |  |   73|      0|#define DP_C_LDOUBLE    3
  ------------------
  |  Branch (293:21): [True: 0, False: 0]
  ------------------
  294|      0|                    fvalue = va_arg(args, LDOUBLE);
  295|      0|                else
  296|      0|                    fvalue = va_arg(args, double);
  297|      0|                if (!fmtfp(sbuffer, buffer, &currlen, maxlen, fvalue, min, max,
  ------------------
  |  Branch (297:21): [True: 0, False: 0]
  ------------------
  298|      0|                           flags, G_FORMAT))
  ------------------
  |  |   80|      0|#define G_FORMAT        2
  ------------------
  299|      0|                    return 0;
  300|      0|                break;
  301|       |#else
  302|       |            case 'f':
  303|       |            case 'E':
  304|       |            case 'e':
  305|       |            case 'G':
  306|       |            case 'g':
  307|       |                /* not implemented for UEFI */
  308|       |                return 0;
  309|       |#endif
  310|      0|            case 'c':
  ------------------
  |  Branch (310:13): [True: 0, False: 4.38M]
  ------------------
  311|      0|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen,
  ------------------
  |  Branch (311:21): [True: 0, False: 0]
  ------------------
  312|      0|                                 va_arg(args, int)))
  313|      0|                    return 0;
  314|      0|                break;
  315|   906k|            case 's':
  ------------------
  |  Branch (315:13): [True: 906k, False: 3.47M]
  ------------------
  316|   906k|                strvalue = va_arg(args, char *);
  317|   906k|                if (max < 0) {
  ------------------
  |  Branch (317:21): [True: 892k, False: 14.0k]
  ------------------
  318|   892k|                    if (buffer)
  ------------------
  |  Branch (318:25): [True: 892k, False: 0]
  ------------------
  319|   892k|                        max = INT_MAX;
  320|      0|                    else
  321|      0|                        max = *maxlen;
  322|   892k|                }
  323|   906k|                if (!fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue,
  ------------------
  |  Branch (323:21): [True: 0, False: 906k]
  ------------------
  324|   906k|                            flags, min, max))
  325|      0|                    return 0;
  326|   906k|                break;
  327|   906k|            case 'p':
  ------------------
  |  Branch (327:13): [True: 0, False: 4.38M]
  ------------------
  328|      0|                value = (size_t)va_arg(args, void *);
  329|      0|                if (!fmtint(sbuffer, buffer, &currlen, maxlen,
  ------------------
  |  Branch (329:21): [True: 0, False: 0]
  ------------------
  330|      0|                            value, 16, min, max, flags | DP_F_NUM))
  ------------------
  |  |   62|      0|#define DP_F_NUM        (1 << 3)
  ------------------
  331|      0|                    return 0;
  332|      0|                break;
  333|      0|            case 'n':
  ------------------
  |  Branch (333:13): [True: 0, False: 4.38M]
  ------------------
  334|      0|                {
  335|      0|                    int *num;
  336|      0|                    num = va_arg(args, int *);
  337|      0|                    *num = currlen;
  338|      0|                }
  339|      0|                break;
  340|      0|            case '%':
  ------------------
  |  Branch (340:13): [True: 0, False: 4.38M]
  ------------------
  341|      0|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
  ------------------
  |  Branch (341:21): [True: 0, False: 0]
  ------------------
  342|      0|                    return 0;
  343|      0|                break;
  344|      0|            case 'w':
  ------------------
  |  Branch (344:13): [True: 0, False: 4.38M]
  ------------------
  345|       |                /* not supported yet, treat as next char */
  346|      0|                ch = *format++;
  347|      0|                break;
  348|      0|            default:
  ------------------
  |  Branch (348:13): [True: 0, False: 4.38M]
  ------------------
  349|       |                /* unknown, skip */
  350|      0|                break;
  351|  4.38M|            }
  352|  4.38M|            ch = *format++;
  353|  4.38M|            state = DP_S_DEFAULT;
  ------------------
  |  |   45|  4.38M|#define DP_S_DEFAULT    0
  ------------------
  354|  4.38M|            flags = cflags = min = 0;
  355|  4.38M|            max = -1;
  356|  4.38M|            break;
  357|  4.52M|        case DP_S_DONE:
  ------------------
  |  |   52|  4.52M|#define DP_S_DONE       7
  ------------------
  |  Branch (357:9): [True: 4.52M, False: 45.4M]
  ------------------
  358|  4.52M|            break;
  359|      0|        default:
  ------------------
  |  Branch (359:9): [True: 0, False: 49.9M]
  ------------------
  360|      0|            break;
  361|  49.9M|        }
  362|  49.9M|    }
  363|       |    /*
  364|       |     * We have to truncate if there is no dynamic buffer and we have filled the
  365|       |     * static buffer.
  366|       |     */
  367|  4.52M|    if (buffer == NULL) {
  ------------------
  |  Branch (367:9): [True: 14.0k, False: 4.50M]
  ------------------
  368|  14.0k|        *truncated = (currlen > *maxlen - 1);
  369|  14.0k|        if (*truncated)
  ------------------
  |  Branch (369:13): [True: 0, False: 14.0k]
  ------------------
  370|      0|            currlen = *maxlen - 1;
  371|  14.0k|    }
  372|  4.52M|    if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'))
  ------------------
  |  Branch (372:9): [True: 0, False: 4.52M]
  ------------------
  373|      0|        return 0;
  374|  4.52M|    *retlen = currlen - 1;
  375|  4.52M|    return 1;
  376|  4.52M|}
b_print.c:doapr_outch:
  830|  33.3M|{
  831|       |    /* If we haven't at least one buffer, someone has done a big booboo */
  832|  33.3M|    if (!ossl_assert(*sbuffer != NULL || buffer != NULL))
  ------------------
  |  |   40|  33.3M|# define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (40:42): [True: 33.3M, False: 0]
  |  |  |  Branch (40:42): [True: 0, False: 0]
  |  |  ------------------
  |  |   41|  33.3M|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (832:9): [True: 0, False: 33.3M]
  ------------------
  833|      0|        return 0;
  834|       |
  835|       |    /* |currlen| must always be <= |*maxlen| */
  836|  33.3M|    if (!ossl_assert(*currlen <= *maxlen))
  ------------------
  |  |   40|  33.3M|# define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   41|  33.3M|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (836:9): [True: 0, False: 33.3M]
  ------------------
  837|      0|        return 0;
  838|       |
  839|  33.3M|    if (buffer && *currlen == *maxlen) {
  ------------------
  |  Branch (839:9): [True: 33.1M, False: 233k]
  |  Branch (839:19): [True: 0, False: 33.1M]
  ------------------
  840|      0|        if (*maxlen > INT_MAX - BUFFER_INC)
  ------------------
  |  |  825|      0|#define BUFFER_INC  1024
  ------------------
  |  Branch (840:13): [True: 0, False: 0]
  ------------------
  841|      0|            return 0;
  842|       |
  843|      0|        *maxlen += BUFFER_INC;
  ------------------
  |  |  825|      0|#define BUFFER_INC  1024
  ------------------
  844|      0|        if (*buffer == NULL) {
  ------------------
  |  Branch (844:13): [True: 0, False: 0]
  ------------------
  845|      0|            if ((*buffer = OPENSSL_malloc(*maxlen)) == NULL) {
  ------------------
  |  |  118|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (845:17): [True: 0, False: 0]
  ------------------
  846|      0|                BIOerr(BIO_F_DOAPR_OUTCH, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  116|      0|# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  847|      0|                return 0;
  848|      0|            }
  849|      0|            if (*currlen > 0) {
  ------------------
  |  Branch (849:17): [True: 0, False: 0]
  ------------------
  850|      0|                if (!ossl_assert(*sbuffer != NULL))
  ------------------
  |  |   40|      0|# define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   41|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (850:21): [True: 0, False: 0]
  ------------------
  851|      0|                    return 0;
  852|      0|                memcpy(*buffer, *sbuffer, *currlen);
  853|      0|            }
  854|      0|            *sbuffer = NULL;
  855|      0|        } else {
  856|      0|            char *tmpbuf;
  857|      0|            tmpbuf = OPENSSL_realloc(*buffer, *maxlen);
  ------------------
  |  |  122|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  858|      0|            if (tmpbuf == NULL)
  ------------------
  |  Branch (858:17): [True: 0, False: 0]
  ------------------
  859|      0|                return 0;
  860|      0|            *buffer = tmpbuf;
  861|      0|        }
  862|      0|    }
  863|       |
  864|  33.3M|    if (*currlen < *maxlen) {
  ------------------
  |  Branch (864:9): [True: 33.3M, False: 0]
  ------------------
  865|  33.3M|        if (*sbuffer)
  ------------------
  |  Branch (865:13): [True: 33.3M, False: 0]
  ------------------
  866|  33.3M|            (*sbuffer)[(*currlen)++] = (char)c;
  867|      0|        else
  868|      0|            (*buffer)[(*currlen)++] = (char)c;
  869|  33.3M|    }
  870|       |
  871|  33.3M|    return 1;
  872|  33.3M|}
b_print.c:fmtint:
  435|  3.47M|{
  436|  3.47M|    int signvalue = 0;
  437|  3.47M|    const char *prefix = "";
  438|  3.47M|    uint64_t uvalue;
  439|  3.47M|    char convert[DECIMAL_SIZE(value) + 3];
  440|  3.47M|    int place = 0;
  441|  3.47M|    int spadlen = 0;
  442|  3.47M|    int zpadlen = 0;
  443|  3.47M|    int caps = 0;
  444|       |
  445|  3.47M|    if (max < 0)
  ------------------
  |  Branch (445:9): [True: 3.47M, False: 0]
  ------------------
  446|  3.47M|        max = 0;
  447|  3.47M|    uvalue = value;
  448|  3.47M|    if (!(flags & DP_F_UNSIGNED)) {
  ------------------
  |  |   68|  3.47M|#define DP_F_UNSIGNED   (1 << 6)
  ------------------
  |  Branch (448:9): [True: 68.3k, False: 3.41M]
  ------------------
  449|  68.3k|        if (value < 0) {
  ------------------
  |  Branch (449:13): [True: 0, False: 68.3k]
  ------------------
  450|      0|            signvalue = '-';
  451|      0|            uvalue = 0 - (uint64_t)value;
  452|  68.3k|        } else if (flags & DP_F_PLUS)
  ------------------
  |  |   58|  68.3k|#define DP_F_PLUS       (1 << 1)
  ------------------
  |  Branch (452:20): [True: 0, False: 68.3k]
  ------------------
  453|      0|            signvalue = '+';
  454|  68.3k|        else if (flags & DP_F_SPACE)
  ------------------
  |  |   60|  68.3k|#define DP_F_SPACE      (1 << 2)
  ------------------
  |  Branch (454:18): [True: 0, False: 68.3k]
  ------------------
  455|      0|            signvalue = ' ';
  456|  68.3k|    }
  457|  3.47M|    if (flags & DP_F_NUM) {
  ------------------
  |  |   62|  3.47M|#define DP_F_NUM        (1 << 3)
  ------------------
  |  Branch (457:9): [True: 0, False: 3.47M]
  ------------------
  458|      0|        if (base == 8)
  ------------------
  |  Branch (458:13): [True: 0, False: 0]
  ------------------
  459|      0|            prefix = "0";
  460|      0|        if (base == 16)
  ------------------
  |  Branch (460:13): [True: 0, False: 0]
  ------------------
  461|      0|            prefix = "0x";
  462|      0|    }
  463|  3.47M|    if (flags & DP_F_UP)
  ------------------
  |  |   66|  3.47M|#define DP_F_UP         (1 << 5)
  ------------------
  |  Branch (463:9): [True: 3.41M, False: 68.3k]
  ------------------
  464|  3.41M|        caps = 1;
  465|  5.08M|    do {
  466|  5.08M|        convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
  ------------------
  |  Branch (466:29): [True: 4.94M, False: 140k]
  ------------------
  467|  5.08M|            [uvalue % (unsigned)base];
  468|  5.08M|        uvalue = (uvalue / (unsigned)base);
  469|  5.08M|    } while (uvalue && (place < (int)sizeof(convert)));
  ------------------
  |  Branch (469:14): [True: 1.60M, False: 3.47M]
  |  Branch (469:24): [True: 1.60M, False: 0]
  ------------------
  470|  3.47M|    if (place == sizeof(convert))
  ------------------
  |  Branch (470:9): [True: 0, False: 3.47M]
  ------------------
  471|      0|        place--;
  472|  3.47M|    convert[place] = 0;
  473|       |
  474|  3.47M|    zpadlen = max - place;
  475|  3.47M|    spadlen =
  476|  3.47M|        min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix);
  ------------------
  |  |   84|  3.47M|#define OSSL_MAX(p,q) ((p >= q) ? p : q)
  |  |  ------------------
  |  |  |  Branch (84:24): [True: 0, False: 3.47M]
  |  |  ------------------
  ------------------
  |  Branch (476:39): [True: 0, False: 3.47M]
  ------------------
  477|  3.47M|    if (zpadlen < 0)
  ------------------
  |  Branch (477:9): [True: 3.47M, False: 0]
  ------------------
  478|  3.47M|        zpadlen = 0;
  479|  3.47M|    if (spadlen < 0)
  ------------------
  |  Branch (479:9): [True: 5.42k, False: 3.47M]
  ------------------
  480|  5.42k|        spadlen = 0;
  481|  3.47M|    if (flags & DP_F_ZERO) {
  ------------------
  |  |   64|  3.47M|#define DP_F_ZERO       (1 << 4)
  ------------------
  |  Branch (481:9): [True: 3.46M, False: 10.8k]
  ------------------
  482|  3.46M|        zpadlen = OSSL_MAX(zpadlen, spadlen);
  ------------------
  |  |   84|  3.46M|#define OSSL_MAX(p,q) ((p >= q) ? p : q)
  |  |  ------------------
  |  |  |  Branch (84:24): [True: 1.56M, False: 1.89M]
  |  |  ------------------
  ------------------
  483|  3.46M|        spadlen = 0;
  484|  3.46M|    }
  485|  3.47M|    if (flags & DP_F_MINUS)
  ------------------
  |  |   56|  3.47M|#define DP_F_MINUS      (1 << 0)
  ------------------
  |  Branch (485:9): [True: 0, False: 3.47M]
  ------------------
  486|      0|        spadlen = -spadlen;
  487|       |
  488|       |    /* spaces */
  489|  3.48M|    while (spadlen > 0) {
  ------------------
  |  Branch (489:12): [True: 2.57k, False: 3.47M]
  ------------------
  490|  2.57k|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (490:13): [True: 0, False: 2.57k]
  ------------------
  491|      0|            return 0;
  492|  2.57k|        --spadlen;
  493|  2.57k|    }
  494|       |
  495|       |    /* sign */
  496|  3.47M|    if (signvalue)
  ------------------
  |  Branch (496:9): [True: 0, False: 3.47M]
  ------------------
  497|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
  ------------------
  |  Branch (497:13): [True: 0, False: 0]
  ------------------
  498|      0|            return 0;
  499|       |
  500|       |    /* prefix */
  501|  3.47M|    while (*prefix) {
  ------------------
  |  Branch (501:12): [True: 0, False: 3.47M]
  ------------------
  502|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
  ------------------
  |  Branch (502:13): [True: 0, False: 0]
  ------------------
  503|      0|            return 0;
  504|      0|        prefix++;
  505|      0|    }
  506|       |
  507|       |    /* zeros */
  508|  3.47M|    if (zpadlen > 0) {
  ------------------
  |  Branch (508:9): [True: 1.89M, False: 1.57M]
  ------------------
  509|  3.80M|        while (zpadlen > 0) {
  ------------------
  |  Branch (509:16): [True: 1.90M, False: 1.89M]
  ------------------
  510|  1.90M|            if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
  ------------------
  |  Branch (510:17): [True: 0, False: 1.90M]
  ------------------
  511|      0|                return 0;
  512|  1.90M|            --zpadlen;
  513|  1.90M|        }
  514|  1.89M|    }
  515|       |    /* digits */
  516|  8.56M|    while (place > 0) {
  ------------------
  |  Branch (516:12): [True: 5.08M, False: 3.47M]
  ------------------
  517|  5.08M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]))
  ------------------
  |  Branch (517:13): [True: 0, False: 5.08M]
  ------------------
  518|      0|            return 0;
  519|  5.08M|    }
  520|       |
  521|       |    /* left justified spaces */
  522|  3.47M|    while (spadlen < 0) {
  ------------------
  |  Branch (522:12): [True: 0, False: 3.47M]
  ------------------
  523|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (523:13): [True: 0, False: 0]
  ------------------
  524|      0|            return 0;
  525|      0|        ++spadlen;
  526|      0|    }
  527|  3.47M|    return 1;
  528|  3.47M|}
b_print.c:fmtstr:
  383|   906k|{
  384|   906k|    int padlen;
  385|   906k|    size_t strln;
  386|   906k|    int cnt = 0;
  387|       |
  388|   906k|    if (value == 0)
  ------------------
  |  Branch (388:9): [True: 3.21k, False: 902k]
  ------------------
  389|  3.21k|        value = "<NULL>";
  390|       |
  391|   906k|    strln = OPENSSL_strnlen(value, max < 0 ? SIZE_MAX : (size_t)max);
  ------------------
  |  Branch (391:36): [True: 0, False: 906k]
  ------------------
  392|       |
  393|   906k|    padlen = min - strln;
  394|   906k|    if (min < 0 || padlen < 0)
  ------------------
  |  Branch (394:9): [True: 0, False: 906k]
  |  Branch (394:20): [True: 194k, False: 711k]
  ------------------
  395|   194k|        padlen = 0;
  396|   906k|    if (max >= 0) {
  ------------------
  |  Branch (396:9): [True: 906k, False: 0]
  ------------------
  397|       |        /*
  398|       |         * Calculate the maximum output including padding.
  399|       |         * Make sure max doesn't overflow into negativity
  400|       |         */
  401|   906k|        if (max < INT_MAX - padlen)
  ------------------
  |  Branch (401:13): [True: 14.0k, False: 892k]
  ------------------
  402|  14.0k|            max += padlen;
  403|   892k|        else
  404|   892k|            max = INT_MAX;
  405|   906k|    }
  406|   906k|    if (flags & DP_F_MINUS)
  ------------------
  |  |   56|   906k|#define DP_F_MINUS      (1 << 0)
  ------------------
  |  Branch (406:9): [True: 0, False: 906k]
  ------------------
  407|      0|        padlen = -padlen;
  408|       |
  409|  10.0M|    while ((padlen > 0) && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (409:12): [True: 9.19M, False: 906k]
  |  Branch (409:29): [True: 0, False: 9.19M]
  |  Branch (409:40): [True: 9.19M, False: 0]
  ------------------
  410|  9.19M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (410:13): [True: 0, False: 9.19M]
  ------------------
  411|      0|            return 0;
  412|  9.19M|        --padlen;
  413|  9.19M|        ++cnt;
  414|  9.19M|    }
  415|  1.41M|    while (strln > 0 && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (415:12): [True: 508k, False: 906k]
  |  Branch (415:26): [True: 0, False: 508k]
  |  Branch (415:37): [True: 508k, False: 0]
  ------------------
  416|   508k|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++))
  ------------------
  |  Branch (416:13): [True: 0, False: 508k]
  ------------------
  417|      0|            return 0;
  418|   508k|        --strln;
  419|   508k|        ++cnt;
  420|   508k|    }
  421|   906k|    while ((padlen < 0) && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (421:12): [True: 0, False: 906k]
  |  Branch (421:29): [True: 0, False: 0]
  |  Branch (421:40): [True: 0, False: 0]
  ------------------
  422|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  ------------------
  423|      0|            return 0;
  424|      0|        ++padlen;
  425|      0|        ++cnt;
  426|      0|    }
  427|   906k|    return 1;
  428|   906k|}

bio_sock_cleanup_int:
  152|      2|{
  153|       |# ifdef OPENSSL_SYS_WINDOWS
  154|       |    if (wsa_init_done) {
  155|       |        wsa_init_done = 0;
  156|       |        WSACleanup();
  157|       |    }
  158|       |# endif
  159|      2|}

ERR_load_BIO_strings:
  137|      2|{
  138|      2|#ifndef OPENSSL_NO_ERR
  139|      2|    if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (139:9): [True: 2, False: 0]
  ------------------
  140|      2|        ERR_load_strings_const(BIO_str_functs);
  141|      2|        ERR_load_strings_const(BIO_str_reasons);
  142|      2|    }
  143|      2|#endif
  144|      2|    return 1;
  145|      2|}

BIO_new:
   72|    604|{
   73|    604|    BIO *bio = OPENSSL_zalloc(sizeof(*bio));
  ------------------
  |  |  120|    604|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    604|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    604|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   74|       |
   75|    604|    if (bio == NULL) {
  ------------------
  |  Branch (75:9): [True: 0, False: 604]
  ------------------
   76|      0|        BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  116|      0|# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   77|      0|        return NULL;
   78|      0|    }
   79|       |
   80|    604|    bio->method = method;
   81|    604|    bio->shutdown = 1;
   82|    604|    bio->references = 1;
   83|       |
   84|    604|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data))
  ------------------
  |  |  106|    604|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
  |  Branch (84:9): [True: 0, False: 604]
  ------------------
   85|      0|        goto err;
   86|       |
   87|    604|    bio->lock = CRYPTO_THREAD_lock_new();
   88|    604|    if (bio->lock == NULL) {
  ------------------
  |  Branch (88:9): [True: 0, False: 604]
  ------------------
   89|      0|        BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  116|      0|# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   90|      0|        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data);
  ------------------
  |  |  106|      0|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
   91|      0|        goto err;
   92|      0|    }
   93|       |
   94|    604|    if (method->create != NULL && !method->create(bio)) {
  ------------------
  |  Branch (94:9): [True: 0, False: 604]
  |  Branch (94:35): [True: 0, False: 0]
  ------------------
   95|      0|        BIOerr(BIO_F_BIO_NEW, ERR_R_INIT_FAIL);
  ------------------
  |  |  116|      0|# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   96|      0|        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data);
  ------------------
  |  |  106|      0|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
   97|      0|        CRYPTO_THREAD_lock_free(bio->lock);
   98|      0|        goto err;
   99|      0|    }
  100|    604|    if (method->create == NULL)
  ------------------
  |  Branch (100:9): [True: 604, False: 0]
  ------------------
  101|    604|        bio->init = 1;
  102|       |
  103|    604|    return bio;
  104|       |
  105|      0|err:
  106|      0|    OPENSSL_free(bio);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  107|      0|    return NULL;
  108|    604|}
BIO_free:
  111|    604|{
  112|    604|    int ret;
  113|       |
  114|    604|    if (a == NULL)
  ------------------
  |  Branch (114:9): [True: 0, False: 604]
  ------------------
  115|      0|        return 0;
  116|       |
  117|    604|    if (CRYPTO_DOWN_REF(&a->references, &ret, a->lock) <= 0)
  ------------------
  |  Branch (117:9): [True: 0, False: 604]
  ------------------
  118|      0|        return 0;
  119|       |
  120|    604|    REF_PRINT_COUNT("BIO", a);
  121|    604|    if (ret > 0)
  ------------------
  |  Branch (121:9): [True: 0, False: 604]
  ------------------
  122|      0|        return 1;
  123|    604|    REF_ASSERT_ISNT(ret < 0);
  ------------------
  |  |  138|    604|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (138:12): [True: 0, False: 604]
  |  |  ------------------
  ------------------
  124|       |
  125|    604|    if (a->callback != NULL || a->callback_ex != NULL) {
  ------------------
  |  Branch (125:9): [True: 0, False: 604]
  |  Branch (125:32): [True: 0, False: 604]
  ------------------
  126|      0|        ret = (int)bio_call_callback(a, BIO_CB_FREE, NULL, 0, 0, 0L, 1L, NULL);
  ------------------
  |  |  220|      0|# define BIO_CB_FREE     0x01
  ------------------
  127|      0|        if (ret <= 0)
  ------------------
  |  Branch (127:13): [True: 0, False: 0]
  ------------------
  128|      0|            return ret;
  129|      0|    }
  130|       |
  131|    604|    if ((a->method != NULL) && (a->method->destroy != NULL))
  ------------------
  |  Branch (131:9): [True: 604, False: 0]
  |  Branch (131:32): [True: 0, False: 604]
  ------------------
  132|      0|        a->method->destroy(a);
  133|       |
  134|    604|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
  ------------------
  |  |  106|    604|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
  135|       |
  136|    604|    CRYPTO_THREAD_lock_free(a->lock);
  137|       |
  138|    604|    OPENSSL_free(a);
  ------------------
  |  |  128|    604|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    604|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    604|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  139|       |
  140|    604|    return 1;
  141|    604|}
BIO_write:
  356|  4.50M|{
  357|  4.50M|    size_t written;
  358|  4.50M|    int ret;
  359|       |
  360|  4.50M|    if (dlen < 0)
  ------------------
  |  Branch (360:9): [True: 0, False: 4.50M]
  ------------------
  361|      0|        return 0;
  362|       |
  363|  4.50M|    ret = bio_write_intern(b, data, (size_t)dlen, &written);
  364|       |
  365|  4.50M|    if (ret > 0) {
  ------------------
  |  Branch (365:9): [True: 4.50M, False: 0]
  ------------------
  366|       |        /* *written should always be <= dlen */
  367|  4.50M|        ret = (int)written;
  368|  4.50M|    }
  369|       |
  370|  4.50M|    return ret;
  371|  4.50M|}
bio_cleanup:
  778|      2|{
  779|      2|#ifndef OPENSSL_NO_SOCK
  780|      2|    bio_sock_cleanup_int();
  781|      2|    CRYPTO_THREAD_lock_free(bio_lookup_lock);
  782|      2|    bio_lookup_lock = NULL;
  783|      2|#endif
  784|      2|    CRYPTO_THREAD_lock_free(bio_type_lock);
  785|      2|    bio_type_lock = NULL;
  786|      2|}
bio_lib.c:bio_write_intern:
  322|  4.50M|{
  323|  4.50M|    int ret;
  324|       |
  325|  4.50M|    if (b == NULL)
  ------------------
  |  Branch (325:9): [True: 0, False: 4.50M]
  ------------------
  326|      0|        return 0;
  327|       |
  328|  4.50M|    if ((b->method == NULL) || (b->method->bwrite == NULL)) {
  ------------------
  |  Branch (328:9): [True: 0, False: 4.50M]
  |  Branch (328:32): [True: 0, False: 4.50M]
  ------------------
  329|      0|        BIOerr(BIO_F_BIO_WRITE_INTERN, BIO_R_UNSUPPORTED_METHOD);
  ------------------
  |  |  116|      0|# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  330|      0|        return -2;
  331|      0|    }
  332|       |
  333|  4.50M|    if ((b->callback != NULL || b->callback_ex != NULL) &&
  ------------------
  |  Branch (333:10): [True: 0, False: 4.50M]
  |  Branch (333:33): [True: 0, False: 4.50M]
  ------------------
  334|  4.50M|        ((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L,
  ------------------
  |  |  222|      0|# define BIO_CB_WRITE    0x03
  ------------------
  |  Branch (334:9): [True: 0, False: 0]
  ------------------
  335|      0|                                       NULL)) <= 0))
  336|      0|        return ret;
  337|       |
  338|  4.50M|    if (!b->init) {
  ------------------
  |  Branch (338:9): [True: 0, False: 4.50M]
  ------------------
  339|      0|        BIOerr(BIO_F_BIO_WRITE_INTERN, BIO_R_UNINITIALIZED);
  ------------------
  |  |  116|      0|# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  340|      0|        return -2;
  341|      0|    }
  342|       |
  343|  4.50M|    ret = b->method->bwrite(b, data, dlen, written);
  344|       |
  345|  4.50M|    if (ret > 0)
  ------------------
  |  Branch (345:9): [True: 4.50M, False: 0]
  ------------------
  346|  4.50M|        b->num_write += (uint64_t)*written;
  347|       |
  348|  4.50M|    if (b->callback != NULL || b->callback_ex != NULL)
  ------------------
  |  Branch (348:9): [True: 0, False: 4.50M]
  |  Branch (348:32): [True: 0, False: 4.50M]
  ------------------
  349|      0|        ret = (int)bio_call_callback(b, BIO_CB_WRITE | BIO_CB_RETURN, data,
  ------------------
  |  |  222|      0|# define BIO_CB_WRITE    0x03
  ------------------
                      ret = (int)bio_call_callback(b, BIO_CB_WRITE | BIO_CB_RETURN, data,
  ------------------
  |  |  231|      0|# define BIO_CB_RETURN   0x80
  ------------------
  350|      0|                                     dlen, 0, 0L, ret, written);
  351|       |
  352|  4.50M|    return ret;
  353|  4.50M|}

bwrite_conv:
   71|  4.50M|{
   72|  4.50M|    int ret;
   73|       |
   74|  4.50M|    if (datal > INT_MAX)
  ------------------
  |  Branch (74:9): [True: 0, False: 4.50M]
  ------------------
   75|      0|        datal = INT_MAX;
   76|       |
   77|  4.50M|    ret = bio->method->bwrite_old(bio, data, (int)datal);
   78|       |
   79|  4.50M|    if (ret <= 0) {
  ------------------
  |  Branch (79:9): [True: 0, False: 4.50M]
  ------------------
   80|      0|        *written = 0;
   81|      0|        return ret;
   82|      0|    }
   83|       |
   84|  4.50M|    *written = (size_t)ret;
   85|       |
   86|  4.50M|    return 1;
   87|  4.50M|}

BIO_s_null:
   38|    604|{
   39|    604|    return &null_method;
   40|    604|}
bss_null.c:null_write:
   48|  4.50M|{
   49|  4.50M|    return inl;
   50|  4.50M|}

ERR_load_BN_strings:
  110|      2|{
  111|      2|#ifndef OPENSSL_NO_ERR
  112|      2|    if (ERR_func_error_string(BN_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (112:9): [True: 2, False: 0]
  ------------------
  113|      2|        ERR_load_strings_const(BN_str_functs);
  114|      2|        ERR_load_strings_const(BN_str_reasons);
  115|      2|    }
  116|      2|#endif
  117|      2|    return 1;
  118|      2|}

ERR_load_BUF_strings:
   30|      2|{
   31|      2|#ifndef OPENSSL_NO_ERR
   32|      2|    if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (32:9): [True: 2, False: 0]
  ------------------
   33|      2|        ERR_load_strings_const(BUF_str_functs);
   34|      2|        ERR_load_strings_const(BUF_str_reasons);
   35|      2|    }
   36|      2|#endif
   37|      2|    return 1;
   38|      2|}

BUF_MEM_grow_clean:
  111|  30.4k|{
  112|  30.4k|    char *ret;
  113|  30.4k|    size_t n;
  114|       |
  115|  30.4k|    if (str->length >= len) {
  ------------------
  |  Branch (115:9): [True: 0, False: 30.4k]
  ------------------
  116|      0|        if (str->data != NULL)
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|            memset(&str->data[len], 0, str->length - len);
  118|      0|        str->length = len;
  119|      0|        return len;
  120|      0|    }
  121|  30.4k|    if (str->max >= len) {
  ------------------
  |  Branch (121:9): [True: 29.3k, False: 1.13k]
  ------------------
  122|  29.3k|        memset(&str->data[str->length], 0, len - str->length);
  123|  29.3k|        str->length = len;
  124|  29.3k|        return len;
  125|  29.3k|    }
  126|       |    /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
  127|  1.13k|    if (len > LIMIT_BEFORE_EXPANSION) {
  ------------------
  |  |   19|  1.13k|#define LIMIT_BEFORE_EXPANSION 0x5ffffffc
  ------------------
  |  Branch (127:9): [True: 0, False: 1.13k]
  ------------------
  128|      0|        BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  106|      0|# define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  129|      0|        return 0;
  130|      0|    }
  131|  1.13k|    n = (len + 3) / 3 * 4;
  132|  1.13k|    if ((str->flags & BUF_MEM_FLAG_SECURE))
  ------------------
  |  |   45|  1.13k|# define BUF_MEM_FLAG_SECURE  0x01
  ------------------
  |  Branch (132:9): [True: 0, False: 1.13k]
  ------------------
  133|      0|        ret = sec_alloc_realloc(str, n);
  134|  1.13k|    else
  135|  1.13k|        ret = OPENSSL_clear_realloc(str->data, str->max, n);
  ------------------
  |  |  124|  1.13k|        CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  1.13k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  1.13k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  136|  1.13k|    if (ret == NULL) {
  ------------------
  |  Branch (136:9): [True: 0, False: 1.13k]
  ------------------
  137|      0|        BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  106|      0|# define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  138|      0|        len = 0;
  139|  1.13k|    } else {
  140|  1.13k|        str->data = ret;
  141|  1.13k|        str->max = n;
  142|  1.13k|        memset(&str->data[str->length], 0, len - str->length);
  143|  1.13k|        str->length = len;
  144|  1.13k|    }
  145|  1.13k|    return len;
  146|  1.13k|}

ERR_load_CMS_strings:
  291|      2|{
  292|      2|#ifndef OPENSSL_NO_ERR
  293|      2|    if (ERR_func_error_string(CMS_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (293:9): [True: 2, False: 0]
  ------------------
  294|      2|        ERR_load_strings_const(CMS_str_functs);
  295|      2|        ERR_load_strings_const(CMS_str_reasons);
  296|      2|    }
  297|      2|#endif
  298|      2|    return 1;
  299|      2|}

ERR_load_COMP_strings:
   38|      2|{
   39|      2|#ifndef OPENSSL_NO_ERR
   40|      2|    if (ERR_func_error_string(COMP_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (40:9): [True: 2, False: 0]
  ------------------
   41|      2|        ERR_load_strings_const(COMP_str_functs);
   42|      2|        ERR_load_strings_const(COMP_str_reasons);
   43|      2|    }
   44|      2|#endif
   45|      2|    return 1;
   46|      2|}

ERR_load_CONF_strings:
   87|      2|{
   88|      2|#ifndef OPENSSL_NO_ERR
   89|      2|    if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (89:9): [True: 2, False: 0]
  ------------------
   90|      2|        ERR_load_strings_const(CONF_str_functs);
   91|      2|        ERR_load_strings_const(CONF_str_reasons);
   92|      2|    }
   93|      2|#endif
   94|      2|    return 1;
   95|      2|}

CONF_modules_unload:
  360|      2|{
  361|      2|    int i;
  362|      2|    CONF_MODULE *md;
  363|      2|    CONF_modules_finish();
  364|       |    /* unload modules in reverse order */
  365|      2|    for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) {
  ------------------
  |  Branch (365:57): [True: 0, False: 2]
  ------------------
  366|      0|        md = sk_CONF_MODULE_value(supported_modules, i);
  367|       |        /* If static or in use and 'all' not set ignore it */
  368|      0|        if (((md->links > 0) || !md->dso) && !all)
  ------------------
  |  Branch (368:14): [True: 0, False: 0]
  |  Branch (368:33): [True: 0, False: 0]
  |  Branch (368:46): [True: 0, False: 0]
  ------------------
  369|      0|            continue;
  370|       |        /* Since we're working in reverse this is OK */
  371|      0|        (void)sk_CONF_MODULE_delete(supported_modules, i);
  372|      0|        module_free(md);
  373|      0|    }
  374|      2|    if (sk_CONF_MODULE_num(supported_modules) == 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 2]
  ------------------
  375|      0|        sk_CONF_MODULE_free(supported_modules);
  376|      0|        supported_modules = NULL;
  377|      0|    }
  378|      2|}
CONF_modules_finish:
  391|      4|{
  392|      4|    CONF_IMODULE *imod;
  393|      4|    while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  ------------------
  |  Branch (393:12): [True: 0, False: 4]
  ------------------
  394|      0|        imod = sk_CONF_IMODULE_pop(initialized_modules);
  395|      0|        module_finish(imod);
  396|      0|    }
  397|      4|    sk_CONF_IMODULE_free(initialized_modules);
  398|      4|    initialized_modules = NULL;
  399|      4|}
conf_modules_free_int:
  427|      2|{
  428|      2|    CONF_modules_finish();
  429|      2|    CONF_modules_unload(1);
  430|      2|}

ERR_load_CRYPTO_strings:
   69|      2|{
   70|      2|#ifndef OPENSSL_NO_ERR
   71|      2|    if (ERR_func_error_string(CRYPTO_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (71:9): [True: 2, False: 0]
  ------------------
   72|      2|        ERR_load_strings_const(CRYPTO_str_functs);
   73|      2|        ERR_load_strings_const(CRYPTO_str_reasons);
   74|      2|    }
   75|      2|#endif
   76|      2|    return 1;
   77|      2|}

OPENSSL_cpuid_setup:
   98|      4|{
   99|      4|    static int trigger = 0;
  100|      4|    IA32CAP OPENSSL_ia32_cpuid(unsigned int *);
  101|      4|    IA32CAP vec;
  102|      4|    const variant_char *env;
  103|       |
  104|      4|    if (trigger)
  ------------------
  |  Branch (104:9): [True: 2, False: 2]
  ------------------
  105|      2|        return;
  106|       |
  107|      2|    trigger = 1;
  108|      2|    if ((env = ossl_getenv("OPENSSL_ia32cap")) != NULL) {
  ------------------
  |  |   49|      2|#   define ossl_getenv getenv
  ------------------
  |  Branch (108:9): [True: 0, False: 2]
  ------------------
  109|      0|        int off = (env[0] == '~') ? 1 : 0;
  ------------------
  |  Branch (109:19): [True: 0, False: 0]
  ------------------
  110|       |
  111|      0|        vec = ossl_strtouint64(env + off);
  112|       |
  113|      0|        if (off) {
  ------------------
  |  Branch (113:13): [True: 0, False: 0]
  ------------------
  114|      0|            IA32CAP mask = vec;
  115|      0|            vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P) & ~mask;
  116|      0|            if (mask & (1<<24)) {
  ------------------
  |  Branch (116:17): [True: 0, False: 0]
  ------------------
  117|       |                /*
  118|       |                 * User disables FXSR bit, mask even other capabilities
  119|       |                 * that operate exclusively on XMM, so we don't have to
  120|       |                 * double-check all the time. We mask PCLMULQDQ, AMD XOP,
  121|       |                 * AES-NI and AVX. Formally speaking we don't have to
  122|       |                 * do it in x86_64 case, but we can safely assume that
  123|       |                 * x86_64 users won't actually flip this flag.
  124|       |                 */
  125|      0|                vec &= ~((IA32CAP)(1<<1|1<<11|1<<25|1<<28) << 32);
  126|      0|            }
  127|      0|        } else if (env[0] == ':') {
  ------------------
  |  Branch (127:20): [True: 0, False: 0]
  ------------------
  128|      0|            vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
  129|      0|        }
  130|       |
  131|      0|        if ((env = ossl_strchr(env, ':')) != NULL) {
  ------------------
  |  Branch (131:13): [True: 0, False: 0]
  ------------------
  132|      0|            IA32CAP vecx;
  133|       |
  134|      0|            env++;
  135|      0|            off = (env[0] == '~') ? 1 : 0;
  ------------------
  |  Branch (135:19): [True: 0, False: 0]
  ------------------
  136|      0|            vecx = ossl_strtouint64(env + off);
  137|      0|            if (off) {
  ------------------
  |  Branch (137:17): [True: 0, False: 0]
  ------------------
  138|      0|                OPENSSL_ia32cap_P[2] &= ~(unsigned int)vecx;
  139|      0|                OPENSSL_ia32cap_P[3] &= ~(unsigned int)(vecx >> 32);
  140|      0|            } else {
  141|      0|                OPENSSL_ia32cap_P[2] = (unsigned int)vecx;
  142|      0|                OPENSSL_ia32cap_P[3] = (unsigned int)(vecx >> 32);
  143|      0|            }
  144|      0|        } else {
  145|      0|            OPENSSL_ia32cap_P[2] = 0;
  146|      0|            OPENSSL_ia32cap_P[3] = 0;
  147|      0|        }
  148|      2|    } else {
  149|      2|        vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
  150|      2|    }
  151|       |
  152|       |    /*
  153|       |     * |(1<<10) sets a reserved bit to signal that variable
  154|       |     * was initialized already... This is to avoid interference
  155|       |     * with cpuid snippets in ELF .init segment.
  156|       |     */
  157|      2|    OPENSSL_ia32cap_P[0] = (unsigned int)vec | (1 << 10);
  158|      2|    OPENSSL_ia32cap_P[1] = (unsigned int)(vec >> 32);
  159|      2|}

ERR_load_CT_strings:
   88|      2|{
   89|      2|#ifndef OPENSSL_NO_ERR
   90|      2|    if (ERR_func_error_string(CT_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (90:9): [True: 2, False: 0]
  ------------------
   91|      2|        ERR_load_strings_const(CT_str_functs);
   92|      2|        ERR_load_strings_const(CT_str_reasons);
   93|      2|    }
   94|      2|#endif
   95|      2|    return 1;
   96|      2|}

o2i_SCT_signature:
   25|  9.10k|{
   26|  9.10k|    size_t siglen;
   27|  9.10k|    size_t len_remaining = len;
   28|  9.10k|    const unsigned char *p;
   29|       |
   30|  9.10k|    if (sct->version != SCT_VERSION_V1) {
  ------------------
  |  Branch (30:9): [True: 0, False: 9.10k]
  ------------------
   31|      0|        CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_UNSUPPORTED_VERSION);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   32|      0|        return -1;
   33|      0|    }
   34|       |    /*
   35|       |     * digitally-signed struct header: (1 byte) Hash algorithm (1 byte)
   36|       |     * Signature algorithm (2 bytes + ?) Signature
   37|       |     *
   38|       |     * This explicitly rejects empty signatures: they're invalid for
   39|       |     * all supported algorithms.
   40|       |     */
   41|  9.10k|    if (len <= 4) {
  ------------------
  |  Branch (41:9): [True: 9, False: 9.09k]
  ------------------
   42|      9|        CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE);
  ------------------
  |  |  133|      9|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      9|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   43|      9|        return -1;
   44|      9|    }
   45|       |
   46|  9.09k|    p = *in;
   47|       |    /* Get hash and signature algorithm */
   48|  9.09k|    sct->hash_alg = *p++;
   49|  9.09k|    sct->sig_alg = *p++;
   50|  9.09k|    if (SCT_get_signature_nid(sct) == NID_undef) {
  ------------------
  |  |   14|  9.09k|#define NID_undef                       0
  ------------------
  |  Branch (50:9): [True: 58, False: 9.04k]
  ------------------
   51|     58|        CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE);
  ------------------
  |  |  133|     58|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     58|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   52|     58|        return -1;
   53|     58|    }
   54|       |    /* Retrieve signature and check it is consistent with the buffer length */
   55|  9.04k|    n2s(p, siglen);
  ------------------
  |  |   28|  9.04k|#define n2s(c,s)        ((s=(((unsigned int)((c)[0]))<< 8)| \
  |  |   29|  9.04k|                            (((unsigned int)((c)[1]))    )),c+=2)
  ------------------
   56|  9.04k|    len_remaining -= (p - *in);
   57|  9.04k|    if (siglen > len_remaining) {
  ------------------
  |  Branch (57:9): [True: 25, False: 9.01k]
  ------------------
   58|     25|        CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE);
  ------------------
  |  |  133|     25|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     25|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   59|     25|        return -1;
   60|     25|    }
   61|       |
   62|  9.01k|    if (SCT_set1_signature(sct, p, siglen) != 1)
  ------------------
  |  Branch (62:9): [True: 0, False: 9.01k]
  ------------------
   63|      0|        return -1;
   64|  9.01k|    len_remaining -= siglen;
   65|  9.01k|    *in = p + siglen;
   66|       |
   67|  9.01k|    return len - len_remaining;
   68|  9.01k|}
o2i_SCT:
   71|   178k|{
   72|   178k|    SCT *sct = NULL;
   73|   178k|    const unsigned char *p;
   74|       |
   75|   178k|    if (len == 0 || len > MAX_SCT_SIZE) {
  ------------------
  |  |   21|   178k|# define MAX_SCT_SIZE            65535
  ------------------
  |  Branch (75:9): [True: 0, False: 178k]
  |  Branch (75:21): [True: 0, False: 178k]
  ------------------
   76|      0|        CTerr(CT_F_O2I_SCT, CT_R_SCT_INVALID);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   77|      0|        goto err;
   78|      0|    }
   79|       |
   80|   178k|    if ((sct = SCT_new()) == NULL)
  ------------------
  |  Branch (80:9): [True: 0, False: 178k]
  ------------------
   81|      0|        goto err;
   82|       |
   83|   178k|    p = *in;
   84|       |
   85|   178k|    sct->version = *p;
   86|   178k|    if (sct->version == SCT_VERSION_V1) {
  ------------------
  |  Branch (86:9): [True: 9.14k, False: 169k]
  ------------------
   87|  9.14k|        int sig_len;
   88|  9.14k|        size_t len2;
   89|       |        /*-
   90|       |         * Fixed-length header:
   91|       |         *   struct {
   92|       |         *     Version sct_version;     (1 byte)
   93|       |         *     log_id id;               (32 bytes)
   94|       |         *     uint64 timestamp;        (8 bytes)
   95|       |         *     CtExtensions extensions; (2 bytes + ?)
   96|       |         *   }
   97|       |         */
   98|  9.14k|        if (len < 43) {
  ------------------
  |  Branch (98:13): [True: 13, False: 9.12k]
  ------------------
   99|     13|            CTerr(CT_F_O2I_SCT, CT_R_SCT_INVALID);
  ------------------
  |  |  133|     13|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     13|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  100|     13|            goto err;
  101|     13|        }
  102|  9.12k|        len -= 43;
  103|  9.12k|        p++;
  104|  9.12k|        sct->log_id = BUF_memdup(p, CT_V1_HASHLEN);
  ------------------
  |  |   33|  9.12k|# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
  |  |  ------------------
  |  |  |  |  130|  9.12k|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  9.12k|#  define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  9.12k|#  define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  105|  9.12k|        if (sct->log_id == NULL)
  ------------------
  |  Branch (105:13): [True: 0, False: 9.12k]
  ------------------
  106|      0|            goto err;
  107|  9.12k|        sct->log_id_len = CT_V1_HASHLEN;
  ------------------
  |  |   29|  9.12k|# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
  |  |  ------------------
  |  |  |  |   69|  9.12k|# define SHA256_DIGEST_LENGTH    32
  |  |  ------------------
  ------------------
  108|  9.12k|        p += CT_V1_HASHLEN;
  ------------------
  |  |   29|  9.12k|# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
  |  |  ------------------
  |  |  |  |   69|  9.12k|# define SHA256_DIGEST_LENGTH    32
  |  |  ------------------
  ------------------
  109|       |
  110|  9.12k|        n2l8(p, sct->timestamp);
  ------------------
  |  |   38|  9.12k|#define n2l8(c,l)       (l =((uint64_t)(*((c)++)))<<56, \
  |  |   39|  9.12k|                         l|=((uint64_t)(*((c)++)))<<48, \
  |  |   40|  9.12k|                         l|=((uint64_t)(*((c)++)))<<40, \
  |  |   41|  9.12k|                         l|=((uint64_t)(*((c)++)))<<32, \
  |  |   42|  9.12k|                         l|=((uint64_t)(*((c)++)))<<24, \
  |  |   43|  9.12k|                         l|=((uint64_t)(*((c)++)))<<16, \
  |  |   44|  9.12k|                         l|=((uint64_t)(*((c)++)))<< 8, \
  |  |   45|  9.12k|                         l|=((uint64_t)(*((c)++))))
  ------------------
  111|       |
  112|  9.12k|        n2s(p, len2);
  ------------------
  |  |   28|  9.12k|#define n2s(c,s)        ((s=(((unsigned int)((c)[0]))<< 8)| \
  |  |   29|  9.12k|                            (((unsigned int)((c)[1]))    )),c+=2)
  ------------------
  113|  9.12k|        if (len < len2) {
  ------------------
  |  Branch (113:13): [True: 21, False: 9.10k]
  ------------------
  114|     21|            CTerr(CT_F_O2I_SCT, CT_R_SCT_INVALID);
  ------------------
  |  |  133|     21|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     21|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  115|     21|            goto err;
  116|     21|        }
  117|  9.10k|        if (len2 > 0) {
  ------------------
  |  Branch (117:13): [True: 1.24k, False: 7.86k]
  ------------------
  118|  1.24k|            sct->ext = BUF_memdup(p, len2);
  ------------------
  |  |   33|  1.24k|# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
  |  |  ------------------
  |  |  |  |  130|  1.24k|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  1.24k|#  define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  1.24k|#  define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  119|  1.24k|            if (sct->ext == NULL)
  ------------------
  |  Branch (119:17): [True: 0, False: 1.24k]
  ------------------
  120|      0|                goto err;
  121|  1.24k|        }
  122|  9.10k|        sct->ext_len = len2;
  123|  9.10k|        p += len2;
  124|  9.10k|        len -= len2;
  125|       |
  126|  9.10k|        sig_len = o2i_SCT_signature(sct, &p, len);
  127|  9.10k|        if (sig_len <= 0) {
  ------------------
  |  Branch (127:13): [True: 92, False: 9.01k]
  ------------------
  128|     92|            CTerr(CT_F_O2I_SCT, CT_R_SCT_INVALID);
  ------------------
  |  |  133|     92|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     92|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  129|     92|            goto err;
  130|     92|        }
  131|  9.01k|        len -= sig_len;
  132|  9.01k|        *in = p + len;
  133|   169k|    } else {
  134|       |        /* If not V1 just cache encoding */
  135|   169k|        sct->sct = BUF_memdup(p, len);
  ------------------
  |  |   33|   169k|# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
  |  |  ------------------
  |  |  |  |  130|   169k|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|   169k|#  define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|   169k|#  define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|   169k|        if (sct->sct == NULL)
  ------------------
  |  Branch (136:13): [True: 0, False: 169k]
  ------------------
  137|      0|            goto err;
  138|   169k|        sct->sct_len = len;
  139|   169k|        *in = p + len;
  140|   169k|    }
  141|       |
  142|   178k|    if (psct != NULL) {
  ------------------
  |  Branch (142:9): [True: 0, False: 178k]
  ------------------
  143|      0|        SCT_free(*psct);
  144|      0|        *psct = sct;
  145|      0|    }
  146|       |
  147|   178k|    return sct;
  148|    126|err:
  149|    126|    SCT_free(sct);
  150|    126|    return NULL;
  151|   178k|}
i2o_SCT_signature:
  154|  1.74k|{
  155|  1.74k|    size_t len;
  156|  1.74k|    unsigned char *p = NULL, *pstart = NULL;
  157|       |
  158|  1.74k|    if (!SCT_signature_is_complete(sct)) {
  ------------------
  |  Branch (158:9): [True: 0, False: 1.74k]
  ------------------
  159|      0|        CTerr(CT_F_I2O_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  160|      0|        goto err;
  161|      0|    }
  162|       |
  163|  1.74k|    if (sct->version != SCT_VERSION_V1) {
  ------------------
  |  Branch (163:9): [True: 0, False: 1.74k]
  ------------------
  164|      0|        CTerr(CT_F_I2O_SCT_SIGNATURE, CT_R_UNSUPPORTED_VERSION);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  165|      0|        goto err;
  166|      0|    }
  167|       |
  168|       |    /*
  169|       |    * (1 byte) Hash algorithm
  170|       |    * (1 byte) Signature algorithm
  171|       |    * (2 bytes + ?) Signature
  172|       |    */
  173|  1.74k|    len = 4 + sct->sig_len;
  174|       |
  175|  1.74k|    if (out != NULL) {
  ------------------
  |  Branch (175:9): [True: 1.74k, False: 0]
  ------------------
  176|  1.74k|        if (*out != NULL) {
  ------------------
  |  Branch (176:13): [True: 1.74k, False: 0]
  ------------------
  177|  1.74k|            p = *out;
  178|  1.74k|            *out += len;
  179|  1.74k|        } else {
  180|      0|            pstart = p = OPENSSL_malloc(len);
  ------------------
  |  |  118|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  181|      0|            if (p == NULL) {
  ------------------
  |  Branch (181:17): [True: 0, False: 0]
  ------------------
  182|      0|                CTerr(CT_F_I2O_SCT_SIGNATURE, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  183|      0|                goto err;
  184|      0|            }
  185|      0|            *out = p;
  186|      0|        }
  187|       |
  188|  1.74k|        *p++ = sct->hash_alg;
  189|  1.74k|        *p++ = sct->sig_alg;
  190|  1.74k|        s2n(sct->sig_len, p);
  ------------------
  |  |   31|  1.74k|#define s2n(s,c)        ((c[0]=(unsigned char)(((s)>> 8)&0xff), \
  |  |   32|  1.74k|                          c[1]=(unsigned char)(((s)    )&0xff)),c+=2)
  ------------------
  191|  1.74k|        memcpy(p, sct->sig, sct->sig_len);
  192|  1.74k|    }
  193|       |
  194|  1.74k|    return len;
  195|      0|err:
  196|      0|    OPENSSL_free(pstart);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  197|      0|    return -1;
  198|  1.74k|}
i2o_SCT:
  201|   276k|{
  202|   276k|    size_t len;
  203|   276k|    unsigned char *p = NULL, *pstart = NULL;
  204|       |
  205|   276k|    if (!SCT_is_complete(sct)) {
  ------------------
  |  Branch (205:9): [True: 162, False: 276k]
  ------------------
  206|    162|        CTerr(CT_F_I2O_SCT, CT_R_SCT_NOT_SET);
  ------------------
  |  |  133|    162|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    162|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  207|    162|        goto err;
  208|    162|    }
  209|       |    /*
  210|       |     * Fixed-length header: struct { (1 byte) Version sct_version; (32 bytes)
  211|       |     * log_id id; (8 bytes) uint64 timestamp; (2 bytes + ?) CtExtensions
  212|       |     * extensions; (1 byte) Hash algorithm (1 byte) Signature algorithm (2
  213|       |     * bytes + ?) Signature
  214|       |     */
  215|   276k|    if (sct->version == SCT_VERSION_V1)
  ------------------
  |  Branch (215:9): [True: 3.89k, False: 272k]
  ------------------
  216|  3.89k|        len = 43 + sct->ext_len + 4 + sct->sig_len;
  217|   272k|    else
  218|   272k|        len = sct->sct_len;
  219|       |
  220|   276k|    if (out == NULL)
  ------------------
  |  Branch (220:9): [True: 139k, False: 137k]
  ------------------
  221|   139k|        return len;
  222|       |
  223|   137k|    if (*out != NULL) {
  ------------------
  |  Branch (223:9): [True: 137k, False: 0]
  ------------------
  224|   137k|        p = *out;
  225|   137k|        *out += len;
  226|   137k|    } else {
  227|      0|        pstart = p = OPENSSL_malloc(len);
  ------------------
  |  |  118|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  228|      0|        if (p == NULL) {
  ------------------
  |  Branch (228:13): [True: 0, False: 0]
  ------------------
  229|      0|            CTerr(CT_F_I2O_SCT, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  230|      0|            goto err;
  231|      0|        }
  232|      0|        *out = p;
  233|      0|    }
  234|       |
  235|   137k|    if (sct->version == SCT_VERSION_V1) {
  ------------------
  |  Branch (235:9): [True: 1.74k, False: 135k]
  ------------------
  236|  1.74k|        *p++ = sct->version;
  237|  1.74k|        memcpy(p, sct->log_id, CT_V1_HASHLEN);
  ------------------
  |  |   29|  1.74k|# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
  |  |  ------------------
  |  |  |  |   69|  1.74k|# define SHA256_DIGEST_LENGTH    32
  |  |  ------------------
  ------------------
  238|  1.74k|        p += CT_V1_HASHLEN;
  ------------------
  |  |   29|  1.74k|# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
  |  |  ------------------
  |  |  |  |   69|  1.74k|# define SHA256_DIGEST_LENGTH    32
  |  |  ------------------
  ------------------
  239|  1.74k|        l2n8(sct->timestamp, p);
  ------------------
  |  |   47|  1.74k|#define l2n8(l,c)       (*((c)++)=(unsigned char)(((l)>>56)&0xff), \
  |  |   48|  1.74k|                         *((c)++)=(unsigned char)(((l)>>48)&0xff), \
  |  |   49|  1.74k|                         *((c)++)=(unsigned char)(((l)>>40)&0xff), \
  |  |   50|  1.74k|                         *((c)++)=(unsigned char)(((l)>>32)&0xff), \
  |  |   51|  1.74k|                         *((c)++)=(unsigned char)(((l)>>24)&0xff), \
  |  |   52|  1.74k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff), \
  |  |   53|  1.74k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
  |  |   54|  1.74k|                         *((c)++)=(unsigned char)(((l)    )&0xff))
  ------------------
  240|  1.74k|        s2n(sct->ext_len, p);
  ------------------
  |  |   31|  1.74k|#define s2n(s,c)        ((c[0]=(unsigned char)(((s)>> 8)&0xff), \
  |  |   32|  1.74k|                          c[1]=(unsigned char)(((s)    )&0xff)),c+=2)
  ------------------
  241|  1.74k|        if (sct->ext_len > 0) {
  ------------------
  |  Branch (241:13): [True: 901, False: 841]
  ------------------
  242|    901|            memcpy(p, sct->ext, sct->ext_len);
  243|    901|            p += sct->ext_len;
  244|    901|        }
  245|  1.74k|        if (i2o_SCT_signature(sct, &p) <= 0)
  ------------------
  |  Branch (245:13): [True: 0, False: 1.74k]
  ------------------
  246|      0|            goto err;
  247|   135k|    } else {
  248|   135k|        memcpy(p, sct->sct, len);
  249|   135k|    }
  250|       |
  251|   137k|    return len;
  252|    162|err:
  253|    162|    OPENSSL_free(pstart);
  ------------------
  |  |  128|    162|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    162|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    162|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  254|    162|    return -1;
  255|   137k|}
o2i_SCT_LIST:
  259|    986|{
  260|    986|    STACK_OF(SCT) *sk = NULL;
  ------------------
  |  |   20|    986|# define STACK_OF(type) struct stack_st_##type
  ------------------
  261|    986|    size_t list_len, sct_len;
  262|       |
  263|    986|    if (len < 2 || len > MAX_SCT_LIST_SIZE) {
  ------------------
  |  |   22|    963|# define MAX_SCT_LIST_SIZE       MAX_SCT_SIZE
  |  |  ------------------
  |  |  |  |   21|    963|# define MAX_SCT_SIZE            65535
  |  |  ------------------
  ------------------
  |  Branch (263:9): [True: 23, False: 963]
  |  Branch (263:20): [True: 28, False: 935]
  ------------------
  264|     51|        CTerr(CT_F_O2I_SCT_LIST, CT_R_SCT_LIST_INVALID);
  ------------------
  |  |  133|     51|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     51|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  265|     51|        return NULL;
  266|     51|    }
  267|       |
  268|    935|    n2s(*pp, list_len);
  ------------------
  |  |   28|    935|#define n2s(c,s)        ((s=(((unsigned int)((c)[0]))<< 8)| \
  |  |   29|    935|                            (((unsigned int)((c)[1]))    )),c+=2)
  ------------------
  269|    935|    if (list_len != len - 2) {
  ------------------
  |  Branch (269:9): [True: 138, False: 797]
  ------------------
  270|    138|        CTerr(CT_F_O2I_SCT_LIST, CT_R_SCT_LIST_INVALID);
  ------------------
  |  |  133|    138|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    138|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  271|    138|        return NULL;
  272|    138|    }
  273|       |
  274|    797|    if (a == NULL || *a == NULL) {
  ------------------
  |  Branch (274:9): [True: 797, False: 0]
  |  Branch (274:22): [True: 0, False: 0]
  ------------------
  275|    797|        sk = sk_SCT_new_null();
  276|    797|        if (sk == NULL)
  ------------------
  |  Branch (276:13): [True: 0, False: 797]
  ------------------
  277|      0|            return NULL;
  278|    797|    } else {
  279|      0|        SCT *sct;
  280|       |
  281|       |        /* Use the given stack, but empty it first. */
  282|      0|        sk = *a;
  283|      0|        while ((sct = sk_SCT_pop(sk)) != NULL)
  ------------------
  |  Branch (283:16): [True: 0, False: 0]
  ------------------
  284|      0|            SCT_free(sct);
  285|      0|    }
  286|       |
  287|   179k|    while (list_len > 0) {
  ------------------
  |  Branch (287:12): [True: 178k, False: 604]
  ------------------
  288|   178k|        SCT *sct;
  289|       |
  290|   178k|        if (list_len < 2) {
  ------------------
  |  Branch (290:13): [True: 7, False: 178k]
  ------------------
  291|      7|            CTerr(CT_F_O2I_SCT_LIST, CT_R_SCT_LIST_INVALID);
  ------------------
  |  |  133|      7|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      7|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  292|      7|            goto err;
  293|      7|        }
  294|   178k|        n2s(*pp, sct_len);
  ------------------
  |  |   28|   178k|#define n2s(c,s)        ((s=(((unsigned int)((c)[0]))<< 8)| \
  |  |   29|   178k|                            (((unsigned int)((c)[1]))    )),c+=2)
  ------------------
  295|   178k|        list_len -= 2;
  296|       |
  297|   178k|        if (sct_len == 0 || sct_len > list_len) {
  ------------------
  |  Branch (297:13): [True: 6, False: 178k]
  |  Branch (297:29): [True: 54, False: 178k]
  ------------------
  298|     60|            CTerr(CT_F_O2I_SCT_LIST, CT_R_SCT_LIST_INVALID);
  ------------------
  |  |  133|     60|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|     60|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  299|     60|            goto err;
  300|     60|        }
  301|   178k|        list_len -= sct_len;
  302|       |
  303|   178k|        if ((sct = o2i_SCT(NULL, pp, sct_len)) == NULL)
  ------------------
  |  Branch (303:13): [True: 126, False: 178k]
  ------------------
  304|    126|            goto err;
  305|   178k|        if (!sk_SCT_push(sk, sct)) {
  ------------------
  |  Branch (305:13): [True: 0, False: 178k]
  ------------------
  306|      0|            SCT_free(sct);
  307|      0|            goto err;
  308|      0|        }
  309|   178k|    }
  310|       |
  311|    604|    if (a != NULL && *a == NULL)
  ------------------
  |  Branch (311:9): [True: 0, False: 604]
  |  Branch (311:22): [True: 0, False: 0]
  ------------------
  312|      0|        *a = sk;
  313|    604|    return sk;
  314|       |
  315|    193| err:
  316|    193|    if (a == NULL || *a == NULL)
  ------------------
  |  Branch (316:9): [True: 193, False: 0]
  |  Branch (316:22): [True: 0, False: 0]
  ------------------
  317|    193|        SCT_LIST_free(sk);
  318|    193|    return NULL;
  319|    797|}
i2o_SCT_LIST:
  322|  1.20k|{
  323|  1.20k|    int len, sct_len, i, is_pp_new = 0;
  324|  1.20k|    size_t len2;
  325|  1.20k|    unsigned char *p = NULL, *p2;
  326|       |
  327|  1.20k|    if (pp != NULL) {
  ------------------
  |  Branch (327:9): [True: 604, False: 604]
  ------------------
  328|    604|        if (*pp == NULL) {
  ------------------
  |  Branch (328:13): [True: 604, False: 0]
  ------------------
  329|    604|            if ((len = i2o_SCT_LIST(a, NULL)) == -1) {
  ------------------
  |  Branch (329:17): [True: 162, False: 442]
  ------------------
  330|    162|                CTerr(CT_F_I2O_SCT_LIST, CT_R_SCT_LIST_INVALID);
  ------------------
  |  |  133|    162|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|    162|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  331|    162|                return -1;
  332|    162|            }
  333|    442|            if ((*pp = OPENSSL_malloc(len)) == NULL) {
  ------------------
  |  |  118|    442|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    442|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    442|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (333:17): [True: 0, False: 442]
  ------------------
  334|      0|                CTerr(CT_F_I2O_SCT_LIST, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  335|      0|                return -1;
  336|      0|            }
  337|    442|            is_pp_new = 1;
  338|    442|        }
  339|    442|        p = *pp + 2;
  340|    442|    }
  341|       |
  342|  1.04k|    len2 = 2;
  343|   277k|    for (i = 0; i < sk_SCT_num(a); i++) {
  ------------------
  |  Branch (343:17): [True: 276k, False: 884]
  ------------------
  344|   276k|        if (pp != NULL) {
  ------------------
  |  Branch (344:13): [True: 137k, False: 139k]
  ------------------
  345|   137k|            p2 = p;
  346|   137k|            p += 2;
  347|   137k|            if ((sct_len = i2o_SCT(sk_SCT_value(a, i), &p)) == -1)
  ------------------
  |  Branch (347:17): [True: 0, False: 137k]
  ------------------
  348|      0|                goto err;
  349|   137k|            s2n(sct_len, p2);
  ------------------
  |  |   31|   137k|#define s2n(s,c)        ((c[0]=(unsigned char)(((s)>> 8)&0xff), \
  |  |   32|   137k|                          c[1]=(unsigned char)(((s)    )&0xff)),c+=2)
  ------------------
  350|   139k|        } else {
  351|   139k|          if ((sct_len = i2o_SCT(sk_SCT_value(a, i), NULL)) == -1)
  ------------------
  |  Branch (351:15): [True: 162, False: 139k]
  ------------------
  352|    162|              goto err;
  353|   139k|        }
  354|   276k|        len2 += 2 + sct_len;
  355|   276k|    }
  356|       |
  357|    884|    if (len2 > MAX_SCT_LIST_SIZE)
  ------------------
  |  |   22|    884|# define MAX_SCT_LIST_SIZE       MAX_SCT_SIZE
  |  |  ------------------
  |  |  |  |   21|    884|# define MAX_SCT_SIZE            65535
  |  |  ------------------
  ------------------
  |  Branch (357:9): [True: 0, False: 884]
  ------------------
  358|      0|        goto err;
  359|       |
  360|    884|    if (pp != NULL) {
  ------------------
  |  Branch (360:9): [True: 442, False: 442]
  ------------------
  361|    442|        p = *pp;
  362|    442|        s2n(len2 - 2, p);
  ------------------
  |  |   31|    442|#define s2n(s,c)        ((c[0]=(unsigned char)(((s)>> 8)&0xff), \
  |  |   32|    442|                          c[1]=(unsigned char)(((s)    )&0xff)),c+=2)
  ------------------
  363|    442|        if (!is_pp_new)
  ------------------
  |  Branch (363:13): [True: 0, False: 442]
  ------------------
  364|      0|            *pp += len2;
  365|    442|    }
  366|    884|    return len2;
  367|       |
  368|    162| err:
  369|    162|    if (is_pp_new) {
  ------------------
  |  Branch (369:9): [True: 0, False: 162]
  ------------------
  370|      0|        OPENSSL_free(*pp);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  371|      0|        *pp = NULL;
  372|      0|    }
  373|    162|    return -1;
  374|    884|}
d2i_SCT_LIST:
  378|  1.62k|{
  379|  1.62k|    ASN1_OCTET_STRING *oct = NULL;
  380|  1.62k|    STACK_OF(SCT) *sk = NULL;
  ------------------
  |  |   20|  1.62k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  381|  1.62k|    const unsigned char *p;
  382|       |
  383|  1.62k|    p = *pp;
  384|  1.62k|    if (d2i_ASN1_OCTET_STRING(&oct, &p, len) == NULL)
  ------------------
  |  Branch (384:9): [True: 637, False: 986]
  ------------------
  385|    637|        return NULL;
  386|       |
  387|    986|    p = oct->data;
  388|    986|    if ((sk = o2i_SCT_LIST(a, &p, oct->length)) != NULL)
  ------------------
  |  Branch (388:9): [True: 604, False: 382]
  ------------------
  389|    604|        *pp += len;
  390|       |
  391|    986|    ASN1_OCTET_STRING_free(oct);
  392|    986|    return sk;
  393|  1.62k|}
i2d_SCT_LIST:
  396|    604|{
  397|    604|    ASN1_OCTET_STRING oct;
  398|    604|    int len;
  399|       |
  400|    604|    oct.data = NULL;
  401|    604|    if ((oct.length = i2o_SCT_LIST(a, &oct.data)) == -1)
  ------------------
  |  Branch (401:9): [True: 162, False: 442]
  ------------------
  402|    162|        return -1;
  403|       |
  404|    442|    len = i2d_ASN1_OCTET_STRING(&oct, out);
  405|    442|    OPENSSL_free(oct.data);
  ------------------
  |  |  128|    442|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    442|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    442|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  406|    442|    return len;
  407|    604|}

SCT_print:
   72|   161k|{
   73|   161k|    const CTLOG *log = NULL;
   74|       |
   75|   161k|    if (log_store != NULL) {
  ------------------
  |  Branch (75:9): [True: 0, False: 161k]
  ------------------
   76|      0|        log = CTLOG_STORE_get0_log_by_id(log_store, sct->log_id,
   77|      0|                                         sct->log_id_len);
   78|      0|    }
   79|       |
   80|   161k|    BIO_printf(out, "%*sSigned Certificate Timestamp:", indent, "");
   81|   161k|    BIO_printf(out, "\n%*sVersion   : ", indent + 4, "");
   82|       |
   83|   161k|    if (sct->version != SCT_VERSION_V1) {
  ------------------
  |  Branch (83:9): [True: 152k, False: 8.64k]
  ------------------
   84|   152k|        BIO_printf(out, "unknown\n%*s", indent + 16, "");
   85|   152k|        BIO_hex_string(out, indent + 16, 16, sct->sct, sct->sct_len);
   86|   152k|        return;
   87|   152k|    }
   88|       |
   89|  8.64k|    BIO_printf(out, "v1 (0x0)");
   90|       |
   91|  8.64k|    if (log != NULL) {
  ------------------
  |  Branch (91:9): [True: 0, False: 8.64k]
  ------------------
   92|      0|        BIO_printf(out, "\n%*sLog       : %s", indent + 4, "",
   93|      0|                   CTLOG_get0_name(log));
   94|      0|    }
   95|       |
   96|  8.64k|    BIO_printf(out, "\n%*sLog ID    : ", indent + 4, "");
   97|  8.64k|    BIO_hex_string(out, indent + 16, 16, sct->log_id, sct->log_id_len);
   98|       |
   99|  8.64k|    BIO_printf(out, "\n%*sTimestamp : ", indent + 4, "");
  100|  8.64k|    timestamp_print(sct->timestamp, out);
  101|       |
  102|  8.64k|    BIO_printf(out, "\n%*sExtensions: ", indent + 4, "");
  103|  8.64k|    if (sct->ext_len == 0)
  ------------------
  |  Branch (103:9): [True: 7.55k, False: 1.08k]
  ------------------
  104|  7.55k|        BIO_printf(out, "none");
  105|  1.08k|    else
  106|  1.08k|        BIO_hex_string(out, indent + 16, 16, sct->ext, sct->ext_len);
  107|       |
  108|  8.64k|    BIO_printf(out, "\n%*sSignature : ", indent + 4, "");
  109|  8.64k|    SCT_signature_algorithms_print(sct, out);
  110|  8.64k|    BIO_printf(out, "\n%*s            ", indent + 4, "");
  111|  8.64k|    BIO_hex_string(out, indent + 16, 16, sct->sig, sct->sig_len);
  112|  8.64k|}
SCT_LIST_print:
  116|    604|{
  117|    604|    int sct_count = sk_SCT_num(sct_list);
  118|    604|    int i;
  119|       |
  120|   162k|    for (i = 0; i < sct_count; ++i) {
  ------------------
  |  Branch (120:17): [True: 161k, False: 604]
  ------------------
  121|   161k|        SCT *sct = sk_SCT_value(sct_list, i);
  122|       |
  123|   161k|        SCT_print(sct, out, indent, log_store);
  124|   161k|        if (i < sk_SCT_num(sct_list) - 1)
  ------------------
  |  Branch (124:13): [True: 160k, False: 603]
  ------------------
  125|   160k|            BIO_printf(out, "%s", separator);
  126|   161k|    }
  127|    604|}
ct_prn.c:timestamp_print:
   30|  8.64k|{
   31|  8.64k|    ASN1_GENERALIZEDTIME *gen = ASN1_GENERALIZEDTIME_new();
   32|  8.64k|    char genstr[20];
   33|       |
   34|  8.64k|    if (gen == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 8.64k]
  ------------------
   35|      0|        return;
   36|  8.64k|    ASN1_GENERALIZEDTIME_adj(gen, (time_t)0,
   37|  8.64k|                             (int)(timestamp / 86400000),
   38|  8.64k|                             (timestamp % 86400000) / 1000);
   39|       |    /*
   40|       |     * Note GeneralizedTime from ASN1_GENERALIZETIME_adj is always 15
   41|       |     * characters long with a final Z. Update it with fractional seconds.
   42|       |     */
   43|  8.64k|    BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ",
   44|  8.64k|                 ASN1_STRING_get0_data(gen), (unsigned int)(timestamp % 1000));
   45|  8.64k|    if (ASN1_GENERALIZEDTIME_set_string(gen, genstr))
  ------------------
  |  Branch (45:9): [True: 5.42k, False: 3.21k]
  ------------------
   46|  5.42k|        ASN1_GENERALIZEDTIME_print(out, gen);
   47|  8.64k|    ASN1_GENERALIZEDTIME_free(gen);
   48|  8.64k|}
ct_prn.c:SCT_signature_algorithms_print:
   20|  8.64k|{
   21|  8.64k|    int nid = SCT_get_signature_nid(sct);
   22|       |
   23|  8.64k|    if (nid == NID_undef)
  ------------------
  |  |   14|  8.64k|#define NID_undef                       0
  ------------------
  |  Branch (23:9): [True: 0, False: 8.64k]
  ------------------
   24|      0|        BIO_printf(out, "%02X%02X", sct->hash_alg, sct->sig_alg);
   25|  8.64k|    else
   26|  8.64k|        BIO_printf(out, "%s", OBJ_nid2ln(nid));
   27|  8.64k|}

SCT_new:
   23|   178k|{
   24|   178k|    SCT *sct = OPENSSL_zalloc(sizeof(*sct));
  ------------------
  |  |  120|   178k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|   178k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|   178k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   25|       |
   26|   178k|    if (sct == NULL) {
  ------------------
  |  Branch (26:9): [True: 0, False: 178k]
  ------------------
   27|      0|        CTerr(CT_F_SCT_NEW, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   28|      0|        return NULL;
   29|      0|    }
   30|       |
   31|   178k|    sct->entry_type = CT_LOG_ENTRY_TYPE_NOT_SET;
   32|   178k|    sct->version = SCT_VERSION_NOT_SET;
   33|   178k|    return sct;
   34|   178k|}
SCT_free:
   37|   178k|{
   38|   178k|    if (sct == NULL)
  ------------------
  |  Branch (38:9): [True: 0, False: 178k]
  ------------------
   39|      0|        return;
   40|       |
   41|   178k|    OPENSSL_free(sct->log_id);
  ------------------
  |  |  128|   178k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|   178k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|   178k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   42|   178k|    OPENSSL_free(sct->ext);
  ------------------
  |  |  128|   178k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|   178k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|   178k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   43|   178k|    OPENSSL_free(sct->sig);
  ------------------
  |  |  128|   178k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|   178k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|   178k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   44|   178k|    OPENSSL_free(sct->sct);
  ------------------
  |  |  128|   178k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|   178k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|   178k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   45|   178k|    OPENSSL_free(sct);
  ------------------
  |  |  128|   178k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|   178k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|   178k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   46|   178k|}
SCT_LIST_free:
   49|    797|{
   50|    797|    sk_SCT_pop_free(a, SCT_free);
   51|    797|}
SCT_set1_signature:
  178|  9.01k|{
  179|  9.01k|    OPENSSL_free(sct->sig);
  ------------------
  |  |  128|  9.01k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  9.01k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  9.01k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  180|  9.01k|    sct->sig = NULL;
  181|  9.01k|    sct->sig_len = 0;
  182|  9.01k|    sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;
  183|       |
  184|  9.01k|    if (sig != NULL && sig_len > 0) {
  ------------------
  |  Branch (184:9): [True: 9.01k, False: 0]
  |  Branch (184:24): [True: 6.62k, False: 2.39k]
  ------------------
  185|  6.62k|        sct->sig = OPENSSL_memdup(sig, sig_len);
  ------------------
  |  |  130|  6.62k|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  6.62k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  6.62k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  186|  6.62k|        if (sct->sig == NULL) {
  ------------------
  |  Branch (186:13): [True: 0, False: 6.62k]
  ------------------
  187|      0|            CTerr(CT_F_SCT_SET1_SIGNATURE, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  133|      0|# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  188|      0|            return 0;
  189|      0|        }
  190|  6.62k|        sct->sig_len = sig_len;
  191|  6.62k|    }
  192|  9.01k|    return 1;
  193|  9.01k|}
SCT_get_signature_nid:
  217|  23.5k|{
  218|  23.5k|    if (sct->version == SCT_VERSION_V1) {
  ------------------
  |  Branch (218:9): [True: 23.5k, False: 0]
  ------------------
  219|  23.5k|        if (sct->hash_alg == TLSEXT_hash_sha256) {
  ------------------
  |  |  184|  23.5k|# define TLSEXT_hash_sha256                              4
  ------------------
  |  Branch (219:13): [True: 23.4k, False: 46]
  ------------------
  220|  23.4k|            switch (sct->sig_alg) {
  221|  4.59k|            case TLSEXT_signature_ecdsa:
  ------------------
  |  |  172|  4.59k|# define TLSEXT_signature_ecdsa                          3
  ------------------
  |  Branch (221:13): [True: 4.59k, False: 18.8k]
  ------------------
  222|  4.59k|                return NID_ecdsa_with_SHA256;
  ------------------
  |  |  305|  4.59k|#define NID_ecdsa_with_SHA256           794
  ------------------
  223|  18.8k|            case TLSEXT_signature_rsa:
  ------------------
  |  |  170|  18.8k|# define TLSEXT_signature_rsa                            1
  ------------------
  |  Branch (223:13): [True: 18.8k, False: 4.60k]
  ------------------
  224|  18.8k|                return NID_sha256WithRSAEncryption;
  ------------------
  |  |  579|  18.8k|#define NID_sha256WithRSAEncryption             668
  ------------------
  225|     12|            default:
  ------------------
  |  Branch (225:13): [True: 12, False: 23.4k]
  ------------------
  226|     12|                return NID_undef;
  ------------------
  |  |   14|     12|#define NID_undef                       0
  ------------------
  227|  23.4k|            }
  228|  23.4k|        }
  229|  23.5k|    }
  230|     46|    return NID_undef;
  ------------------
  |  |   14|     46|#define NID_undef                       0
  ------------------
  231|  23.5k|}
SCT_is_complete:
  246|   276k|{
  247|   276k|    switch (sct->version) {
  248|      0|    case SCT_VERSION_NOT_SET:
  ------------------
  |  Branch (248:5): [True: 0, False: 276k]
  ------------------
  249|      0|        return 0;
  250|  4.05k|    case SCT_VERSION_V1:
  ------------------
  |  Branch (250:5): [True: 4.05k, False: 272k]
  ------------------
  251|  4.05k|        return sct->log_id != NULL && SCT_signature_is_complete(sct);
  ------------------
  |  Branch (251:16): [True: 4.05k, False: 0]
  |  Branch (251:39): [True: 3.89k, False: 162]
  ------------------
  252|   272k|    default:
  ------------------
  |  Branch (252:5): [True: 272k, False: 4.05k]
  ------------------
  253|   272k|        return sct->sct != NULL; /* Just need cached encoding */
  254|   276k|    }
  255|   276k|}
SCT_signature_is_complete:
  258|  5.79k|{
  259|  5.79k|    return SCT_get_signature_nid(sct) != NID_undef &&
  ------------------
  |  |   14|  11.5k|#define NID_undef                       0
  ------------------
  |  Branch (259:12): [True: 5.79k, False: 0]
  ------------------
  260|  5.79k|        sct->sig != NULL && sct->sig_len > 0;
  ------------------
  |  Branch (260:9): [True: 5.63k, False: 162]
  |  Branch (260:29): [True: 5.63k, False: 0]
  ------------------
  261|  5.79k|}

ossl_ctype_check:
  253|  7.89M|{
  254|  7.89M|    const int max = sizeof(ctype_char_map) / sizeof(*ctype_char_map);
  255|  7.89M|    const int a = ossl_toascii(c);
  ------------------
  |  |   53|  7.89M|#  define ossl_toascii(c)       (c)
  ------------------
  256|       |
  257|  7.89M|    return a >= 0 && a < max && (ctype_char_map[a] & mask) != 0;
  ------------------
  |  Branch (257:12): [True: 7.89M, False: 0]
  |  Branch (257:22): [True: 7.89M, False: 0]
  |  Branch (257:33): [True: 3.49M, False: 4.39M]
  ------------------
  258|  7.89M|}
ascii_isdigit:
  276|   217k|int ascii_isdigit(const char inchar) {
  277|   217k|    if (inchar > 0x2F && inchar < 0x3A)
  ------------------
  |  Branch (277:9): [True: 217k, False: 0]
  |  Branch (277:26): [True: 200k, False: 16.2k]
  ------------------
  278|   200k|        return 1;
  279|  16.2k|    return 0;
  280|   217k|}

ERR_load_DH_strings:
   94|      2|{
   95|      2|#ifndef OPENSSL_NO_ERR
   96|      2|    if (ERR_func_error_string(DH_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (96:9): [True: 2, False: 0]
  ------------------
   97|      2|        ERR_load_strings_const(DH_str_functs);
   98|      2|        ERR_load_strings_const(DH_str_reasons);
   99|      2|    }
  100|      2|#endif
  101|      2|    return 1;
  102|      2|}

ERR_load_DSA_strings:
   70|      2|{
   71|      2|#ifndef OPENSSL_NO_ERR
   72|      2|    if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (72:9): [True: 2, False: 0]
  ------------------
   73|      2|        ERR_load_strings_const(DSA_str_functs);
   74|      2|        ERR_load_strings_const(DSA_str_reasons);
   75|      2|    }
   76|      2|#endif
   77|      2|    return 1;
   78|      2|}

ERR_load_DSO_strings:
   92|      2|{
   93|      2|#ifndef OPENSSL_NO_ERR
   94|      2|    if (ERR_func_error_string(DSO_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (94:9): [True: 2, False: 0]
  ------------------
   95|      2|        ERR_load_strings_const(DSO_str_functs);
   96|      2|        ERR_load_strings_const(DSO_str_reasons);
   97|      2|    }
   98|      2|#endif
   99|      2|    return 1;
  100|      2|}

ERR_load_EC_strings:
  387|      2|{
  388|      2|#ifndef OPENSSL_NO_ERR
  389|      2|    if (ERR_func_error_string(EC_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (389:9): [True: 2, False: 0]
  ------------------
  390|      2|        ERR_load_strings_const(EC_str_functs);
  391|      2|        ERR_load_strings_const(EC_str_reasons);
  392|      2|    }
  393|      2|#endif
  394|      2|    return 1;
  395|      2|}

ERR_load_ENGINE_strings:
  146|      2|{
  147|      2|#ifndef OPENSSL_NO_ERR
  148|      2|    if (ERR_func_error_string(ENGINE_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (148:9): [True: 2, False: 0]
  ------------------
  149|      2|        ERR_load_strings_const(ENGINE_str_functs);
  150|      2|        ERR_load_strings_const(ENGINE_str_reasons);
  151|      2|    }
  152|      2|#endif
  153|      2|    return 1;
  154|      2|}

engine_cleanup_int:
  169|      2|{
  170|      2|    if (int_cleanup_check(0)) {
  ------------------
  |  Branch (170:9): [True: 0, False: 2]
  ------------------
  171|      0|        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
  172|      0|                                        engine_cleanup_cb_free);
  173|      0|        cleanup_stack = NULL;
  174|      0|    }
  175|      2|    CRYPTO_THREAD_lock_free(global_engine_lock);
  176|      2|    global_engine_lock = NULL;
  177|      2|}
eng_lib.c:int_cleanup_check:
  117|      2|{
  118|      2|    if (cleanup_stack)
  ------------------
  |  Branch (118:9): [True: 0, False: 2]
  ------------------
  119|      0|        return 1;
  120|      2|    if (!create)
  ------------------
  |  Branch (120:9): [True: 2, False: 0]
  ------------------
  121|      2|        return 0;
  122|      0|    cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null();
  123|      0|    return (cleanup_stack ? 1 : 0);
  ------------------
  |  Branch (123:13): [True: 0, False: 0]
  ------------------
  124|      2|}

err_cleanup:
  321|      2|{
  322|      2|    if (set_err_thread_local != 0)
  ------------------
  |  Branch (322:9): [True: 2, False: 0]
  ------------------
  323|      2|        CRYPTO_THREAD_cleanup_local(&err_thread_local);
  324|      2|    CRYPTO_THREAD_lock_free(err_string_lock);
  325|      2|    err_string_lock = NULL;
  326|      2|#ifndef OPENSSL_NO_ERR
  327|      2|    lh_ERR_STRING_DATA_free(int_error_hash);
  328|      2|    int_error_hash = NULL;
  329|      2|#endif
  330|      2|}
ERR_load_ERR_strings:
  359|    118|{
  360|    118|#ifndef OPENSSL_NO_ERR
  361|    118|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  119|    118|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 118, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (361:9): [True: 0, False: 118]
  ------------------
  362|      0|        return 0;
  363|       |
  364|    118|    err_load_strings(ERR_str_libraries);
  365|    118|    err_load_strings(ERR_str_reasons);
  366|    118|    err_patch(ERR_LIB_SYS, ERR_str_functs);
  ------------------
  |  |   55|    118|# define ERR_LIB_SYS             2
  ------------------
  367|    118|    err_load_strings(ERR_str_functs);
  368|    118|    build_SYS_str_reasons();
  369|    118|#endif
  370|    118|    return 1;
  371|    118|}
ERR_load_strings_const:
  387|    116|{
  388|    116|#ifndef OPENSSL_NO_ERR
  389|    116|    if (ERR_load_ERR_strings() == 0)
  ------------------
  |  Branch (389:9): [True: 0, False: 116]
  ------------------
  390|      0|        return 0;
  391|    116|    err_load_strings(str);
  392|    116|#endif
  393|       |
  394|    116|    return 1;
  395|    116|}
ERR_put_error:
  424|  2.30k|{
  425|  2.30k|    ERR_STATE *es;
  426|       |
  427|       |#ifdef _OSD_POSIX
  428|       |    /*
  429|       |     * In the BS2000-OSD POSIX subsystem, the compiler generates path names
  430|       |     * in the form "*POSIX(/etc/passwd)". This dirty hack strips them to
  431|       |     * something sensible. @@@ We shouldn't modify a const string, though.
  432|       |     */
  433|       |    if (strncmp(file, "*POSIX(", sizeof("*POSIX(") - 1) == 0) {
  434|       |        char *end;
  435|       |
  436|       |        /* Skip the "*POSIX(" prefix */
  437|       |        file += sizeof("*POSIX(") - 1;
  438|       |        end = &file[strlen(file) - 1];
  439|       |        if (*end == ')')
  440|       |            *end = '\0';
  441|       |        /* Optional: use the basename of the path only. */
  442|       |        if ((end = strrchr(file, '/')) != NULL)
  443|       |            file = &end[1];
  444|       |    }
  445|       |#endif
  446|  2.30k|    es = ERR_get_state();
  447|  2.30k|    if (es == NULL)
  ------------------
  |  Branch (447:9): [True: 0, False: 2.30k]
  ------------------
  448|      0|        return;
  449|       |
  450|  2.30k|    es->top = (es->top + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   42|  2.30k|# define ERR_NUM_ERRORS  16
  ------------------
  451|  2.30k|    if (es->top == es->bottom)
  ------------------
  |  Branch (451:9): [True: 0, False: 2.30k]
  ------------------
  452|      0|        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   42|      0|# define ERR_NUM_ERRORS  16
  ------------------
  453|  2.30k|    es->err_flags[es->top] = 0;
  454|  2.30k|    es->err_buffer[es->top] = ERR_PACK(lib, func, reason);
  ------------------
  |  |  138|  2.30k|# define ERR_PACK(l,f,r) ( \
  |  |  139|  2.30k|        (((unsigned int)(l) & 0x0FF) << 24L) | \
  |  |  140|  2.30k|        (((unsigned int)(f) & 0xFFF) << 12L) | \
  |  |  141|  2.30k|        (((unsigned int)(r) & 0xFFF)       ) )
  ------------------
  455|  2.30k|    es->err_file[es->top] = file;
  456|  2.30k|    es->err_line[es->top] = line;
  457|  2.30k|    err_clear_data(es, es->top);
  ------------------
  |  |  272|  2.30k|        do { \
  |  |  273|  2.30k|            if ((p)->err_data_flags[i] & ERR_TXT_MALLOCED) {\
  |  |  ------------------
  |  |  |  |   36|  2.30k|# define ERR_TXT_MALLOCED        0x01
  |  |  ------------------
  |  |  |  Branch (273:17): [True: 0, False: 2.30k]
  |  |  ------------------
  |  |  274|      0|                OPENSSL_free((p)->err_data[i]); \
  |  |  ------------------
  |  |  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  275|      0|                (p)->err_data[i] = NULL; \
  |  |  276|      0|            } \
  |  |  277|  2.30k|            (p)->err_data_flags[i] = 0; \
  |  |  278|  2.30k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (278:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  458|  2.30k|}
ERR_clear_error:
  461|  1.62k|{
  462|  1.62k|    int i;
  463|  1.62k|    ERR_STATE *es;
  464|       |
  465|  1.62k|    es = ERR_get_state();
  466|  1.62k|    if (es == NULL)
  ------------------
  |  Branch (466:9): [True: 0, False: 1.62k]
  ------------------
  467|      0|        return;
  468|       |
  469|  27.5k|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   42|  27.5k|# define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (469:17): [True: 25.9k, False: 1.62k]
  ------------------
  470|  25.9k|        err_clear(es, i);
  ------------------
  |  |  281|  25.9k|        do { \
  |  |  282|  25.9k|            err_clear_data(p, i); \
  |  |  ------------------
  |  |  |  |  272|  25.9k|        do { \
  |  |  |  |  273|  25.9k|            if ((p)->err_data_flags[i] & ERR_TXT_MALLOCED) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  25.9k|# define ERR_TXT_MALLOCED        0x01
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (273:17): [True: 0, False: 25.9k]
  |  |  |  |  ------------------
  |  |  |  |  274|      0|                OPENSSL_free((p)->err_data[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  275|      0|                (p)->err_data[i] = NULL; \
  |  |  |  |  276|      0|            } \
  |  |  |  |  277|  25.9k|            (p)->err_data_flags[i] = 0; \
  |  |  |  |  278|  25.9k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  283|  25.9k|            (p)->err_flags[i] = 0; \
  |  |  284|  25.9k|            (p)->err_buffer[i] = 0; \
  |  |  285|  25.9k|            (p)->err_file[i] = NULL; \
  |  |  286|  25.9k|            (p)->err_line[i] = -1; \
  |  |  287|  25.9k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (287:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  471|  25.9k|    }
  472|  1.62k|    es->top = es->bottom = 0;
  473|  1.62k|}
ERR_func_error_string:
  676|     58|{
  677|     58|#ifndef OPENSSL_NO_ERR
  678|     58|    ERR_STRING_DATA d, *p;
  679|     58|    unsigned long l, f;
  680|       |
  681|     58|    if (!RUN_ONCE(&err_string_init, do_err_strings_init)) {
  ------------------
  |  |  119|     58|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 58, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (681:9): [True: 0, False: 58]
  ------------------
  682|      0|        return NULL;
  683|      0|    }
  684|       |
  685|     58|    l = ERR_GET_LIB(e);
  ------------------
  |  |  142|     58|# define ERR_GET_LIB(l)          (int)(((l) >> 24L) & 0x0FFL)
  ------------------
  686|     58|    f = ERR_GET_FUNC(e);
  ------------------
  |  |  143|     58|# define ERR_GET_FUNC(l)         (int)(((l) >> 12L) & 0xFFFL)
  ------------------
  687|     58|    d.error = ERR_PACK(l, f, 0);
  ------------------
  |  |  138|     58|# define ERR_PACK(l,f,r) ( \
  |  |  139|     58|        (((unsigned int)(l) & 0x0FF) << 24L) | \
  |  |  140|     58|        (((unsigned int)(f) & 0xFFF) << 12L) | \
  |  |  141|     58|        (((unsigned int)(r) & 0xFFF)       ) )
  ------------------
  688|     58|    p = int_err_get_item(&d);
  689|     58|    return ((p == NULL) ? NULL : p->string);
  ------------------
  |  Branch (689:13): [True: 58, False: 0]
  ------------------
  690|       |#else
  691|       |    return NULL;
  692|       |#endif
  693|     58|}
err_delete_thread_state:
  720|      2|{
  721|      2|    ERR_STATE *state = CRYPTO_THREAD_get_local(&err_thread_local);
  722|      2|    if (state == NULL)
  ------------------
  |  Branch (722:9): [True: 0, False: 2]
  ------------------
  723|      0|        return;
  724|       |
  725|      2|    CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  726|      2|    ERR_STATE_free(state);
  727|      2|}
ERR_get_state:
  748|  3.92k|{
  749|  3.92k|    ERR_STATE *state;
  750|  3.92k|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   75|  3.92k|# define get_last_sys_error()    errno
  ------------------
  751|       |
  752|  3.92k|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   28|  3.92k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (752:9): [True: 0, False: 3.92k]
  ------------------
  753|      0|        return NULL;
  754|       |
  755|  3.92k|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  119|  3.92k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 3.92k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (755:9): [True: 0, False: 3.92k]
  ------------------
  756|      0|        return NULL;
  757|       |
  758|  3.92k|    state = CRYPTO_THREAD_get_local(&err_thread_local);
  759|  3.92k|    if (state == (ERR_STATE*)-1)
  ------------------
  |  Branch (759:9): [True: 0, False: 3.92k]
  ------------------
  760|      0|        return NULL;
  761|       |
  762|  3.92k|    if (state == NULL) {
  ------------------
  |  Branch (762:9): [True: 2, False: 3.92k]
  ------------------
  763|      2|        if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (763:13): [True: 0, False: 2]
  ------------------
  764|      0|            return NULL;
  765|       |
  766|      2|        if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) {
  ------------------
  |  |  120|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (766:13): [True: 0, False: 2]
  ------------------
  767|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  768|      0|            return NULL;
  769|      0|        }
  770|       |
  771|      2|        if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
  ------------------
  |  |   32|      2|# define OPENSSL_INIT_THREAD_ERR_STATE       0x02
  ------------------
  |  Branch (771:13): [True: 0, False: 2]
  ------------------
  772|      2|                || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  ------------------
  |  Branch (772:20): [True: 0, False: 2]
  ------------------
  773|      0|            ERR_STATE_free(state);
  774|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  775|      0|            return NULL;
  776|      0|        }
  777|       |
  778|       |        /* Ignore failures from these */
  779|      2|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  357|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  780|      2|    }
  781|       |
  782|  3.92k|    set_sys_error(saveerrno);
  ------------------
  |  |   77|  3.92k|# define set_sys_error(e)        errno=(e)
  ------------------
  783|  3.92k|    return state;
  784|  3.92k|}
err.c:do_err_strings_init:
  302|      2|{
  303|      2|    if (!OPENSSL_init_crypto(0, NULL))
  ------------------
  |  Branch (303:9): [True: 0, False: 2]
  ------------------
  304|      0|        return 0;
  305|      2|    err_string_lock = CRYPTO_THREAD_lock_new();
  306|      2|    if (err_string_lock == NULL)
  ------------------
  |  Branch (306:9): [True: 0, False: 2]
  ------------------
  307|      0|        return 0;
  308|      2|#ifndef OPENSSL_NO_ERR
  309|      2|    int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
  310|      2|                                            err_string_data_cmp);
  311|      2|    if (int_error_hash == NULL) {
  ------------------
  |  Branch (311:9): [True: 0, False: 2]
  ------------------
  312|      0|        CRYPTO_THREAD_lock_free(err_string_lock);
  313|      0|        err_string_lock = NULL;
  314|      0|        return 0;
  315|      0|    }
  316|      2|#endif
  317|      2|    return 1;
  318|      2|}
err.c:err_string_data_hash:
  167|  15.2k|{
  168|  15.2k|    unsigned long ret, l;
  169|       |
  170|  15.2k|    l = a->error;
  171|  15.2k|    ret = l ^ ERR_GET_LIB(l) ^ ERR_GET_FUNC(l);
  ------------------
  |  |  142|  15.2k|# define ERR_GET_LIB(l)          (int)(((l) >> 24L) & 0x0FFL)
  ------------------
                  ret = l ^ ERR_GET_LIB(l) ^ ERR_GET_FUNC(l);
  ------------------
  |  |  143|  15.2k|# define ERR_GET_FUNC(l)         (int)(((l) >> 12L) & 0xFFFL)
  ------------------
  172|  15.2k|    return (ret ^ ret % 19 * 13);
  173|  15.2k|}
err.c:err_string_data_cmp:
  177|  10.5k|{
  178|  10.5k|    if (a->error == b->error)
  ------------------
  |  Branch (178:9): [True: 10.3k, False: 246]
  ------------------
  179|  10.3k|        return 0;
  180|    246|    return a->error > b->error ? 1 : -1;
  ------------------
  |  Branch (180:12): [True: 150, False: 96]
  ------------------
  181|  10.5k|}
err.c:err_load_strings:
  348|    472|{
  349|    472|    CRYPTO_THREAD_write_lock(err_string_lock);
  350|  15.6k|    for (; str->error; str++)
  ------------------
  |  Branch (350:12): [True: 15.1k, False: 472]
  ------------------
  351|  15.1k|        (void)lh_ERR_STRING_DATA_insert(int_error_hash,
  352|  15.1k|                                       (ERR_STRING_DATA *)str);
  353|    472|    CRYPTO_THREAD_unlock(err_string_lock);
  354|    472|    return 1;
  355|    472|}
err.c:err_patch:
  337|    118|{
  338|    118|    unsigned long plib = ERR_PACK(lib, 0, 0);
  ------------------
  |  |  138|    118|# define ERR_PACK(l,f,r) ( \
  |  |  139|    118|        (((unsigned int)(l) & 0x0FF) << 24L) | \
  |  |  140|    118|        (((unsigned int)(f) & 0xFFF) << 12L) | \
  |  |  141|    118|        (((unsigned int)(r) & 0xFFF)       ) )
  ------------------
  339|       |
  340|  2.83k|    for (; str->error != 0; str++)
  ------------------
  |  Branch (340:12): [True: 2.71k, False: 118]
  ------------------
  341|  2.71k|        str->error |= plib;
  342|    118|}
err.c:build_SYS_str_reasons:
  210|    118|{
  211|       |    /* OPENSSL_malloc cannot be used here, use static storage instead */
  212|    118|    static char strerror_pool[SPACE_SYS_STR_REASONS];
  213|    118|    char *cur = strerror_pool;
  214|    118|    size_t cnt = 0;
  215|    118|    static int init = 1;
  216|    118|    int i;
  217|    118|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   75|    118|# define get_last_sys_error()    errno
  ------------------
  218|       |
  219|    118|    CRYPTO_THREAD_write_lock(err_string_lock);
  220|    118|    if (!init) {
  ------------------
  |  Branch (220:9): [True: 116, False: 2]
  ------------------
  221|    116|        CRYPTO_THREAD_unlock(err_string_lock);
  222|    116|        return;
  223|    116|    }
  224|       |
  225|    256|    for (i = 1; i <= NUM_SYS_STR_REASONS; i++) {
  ------------------
  |  |  196|    256|# define NUM_SYS_STR_REASONS 127
  ------------------
  |  Branch (225:17): [True: 254, False: 2]
  ------------------
  226|    254|        ERR_STRING_DATA *str = &SYS_str_reasons[i - 1];
  227|       |
  228|    254|        str->error = ERR_PACK(ERR_LIB_SYS, 0, i);
  ------------------
  |  |  138|    254|# define ERR_PACK(l,f,r) ( \
  |  |  139|    254|        (((unsigned int)(l) & 0x0FF) << 24L) | \
  |  |  140|    254|        (((unsigned int)(f) & 0xFFF) << 12L) | \
  |  |  141|    254|        (((unsigned int)(r) & 0xFFF)       ) )
  ------------------
  229|       |        /*
  230|       |         * If we have used up all the space in strerror_pool,
  231|       |         * there's no point in calling openssl_strerror_r()
  232|       |         */
  233|    254|        if (str->string == NULL && cnt < sizeof(strerror_pool)) {
  ------------------
  |  Branch (233:13): [True: 254, False: 0]
  |  Branch (233:36): [True: 254, False: 0]
  ------------------
  234|    254|            if (openssl_strerror_r(i, cur, sizeof(strerror_pool) - cnt)) {
  ------------------
  |  Branch (234:17): [True: 250, False: 4]
  ------------------
  235|    250|                size_t l = strlen(cur);
  236|       |
  237|    250|                str->string = cur;
  238|    250|                cnt += l;
  239|    250|                cur += l;
  240|       |
  241|       |                /*
  242|       |                 * VMS has an unusual quirk of adding spaces at the end of
  243|       |                 * some (most? all?) messages. Lets trim them off.
  244|       |                 */
  245|    250|                while (cur > strerror_pool && ossl_isspace(cur[-1])) {
  ------------------
  |  |   76|    250|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   27|    250|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (76:33): [True: 0, False: 250]
  |  |  ------------------
  ------------------
  |  Branch (245:24): [True: 250, False: 0]
  ------------------
  246|      0|                    cur--;
  247|      0|                    cnt--;
  248|      0|                }
  249|    250|                *cur++ = '\0';
  250|    250|                cnt++;
  251|    250|            }
  252|    254|        }
  253|    254|        if (str->string == NULL)
  ------------------
  |  Branch (253:13): [True: 4, False: 250]
  ------------------
  254|      4|            str->string = "unknown";
  255|    254|    }
  256|       |
  257|       |    /*
  258|       |     * Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, as
  259|       |     * required by ERR_load_strings.
  260|       |     */
  261|       |
  262|      2|    init = 0;
  263|       |
  264|      2|    CRYPTO_THREAD_unlock(err_string_lock);
  265|       |    /* openssl_strerror_r could change errno, but we want to preserve it */
  266|      2|    set_sys_error(saveerrno);
  ------------------
  |  |   77|      2|# define set_sys_error(e)        errno=(e)
  ------------------
  267|      2|    err_load_strings(SYS_str_reasons);
  268|      2|}
err.c:int_err_get_item:
  184|     58|{
  185|     58|    ERR_STRING_DATA *p = NULL;
  186|       |
  187|     58|    CRYPTO_THREAD_read_lock(err_string_lock);
  188|     58|    p = lh_ERR_STRING_DATA_retrieve(int_error_hash, d);
  189|     58|    CRYPTO_THREAD_unlock(err_string_lock);
  190|       |
  191|     58|    return p;
  192|     58|}
err.c:ERR_STATE_free:
  290|      2|{
  291|      2|    int i;
  292|       |
  293|      2|    if (s == NULL)
  ------------------
  |  Branch (293:9): [True: 0, False: 2]
  ------------------
  294|      0|        return;
  295|     34|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   42|     34|# define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (295:17): [True: 32, False: 2]
  ------------------
  296|     32|        err_clear_data(s, i);
  ------------------
  |  |  272|     32|        do { \
  |  |  273|     32|            if ((p)->err_data_flags[i] & ERR_TXT_MALLOCED) {\
  |  |  ------------------
  |  |  |  |   36|     32|# define ERR_TXT_MALLOCED        0x01
  |  |  ------------------
  |  |  |  Branch (273:17): [True: 0, False: 32]
  |  |  ------------------
  |  |  274|      0|                OPENSSL_free((p)->err_data[i]); \
  |  |  ------------------
  |  |  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  275|      0|                (p)->err_data[i] = NULL; \
  |  |  276|      0|            } \
  |  |  277|     32|            (p)->err_data_flags[i] = 0; \
  |  |  278|     32|        } while (0)
  |  |  ------------------
  |  |  |  Branch (278:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  297|     32|    }
  298|      2|    OPENSSL_free(s);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  299|      2|}
err.c:err_do_init:
  742|      2|{
  743|      2|    set_err_thread_local = 1;
  744|      2|    return CRYPTO_THREAD_init_local(&err_thread_local, NULL);
  745|      2|}

err_load_crypto_strings_int:
   43|      2|{
   44|      2|    if (
   45|      2|#ifndef OPENSSL_NO_ERR
   46|      2|        ERR_load_ERR_strings() == 0 ||    /* include error strings for SYSerr */
  ------------------
  |  Branch (46:9): [True: 0, False: 2]
  ------------------
   47|      2|        ERR_load_BN_strings() == 0 ||
  ------------------
  |  Branch (47:9): [True: 0, False: 2]
  ------------------
   48|      2|# ifndef OPENSSL_NO_RSA
   49|      2|        ERR_load_RSA_strings() == 0 ||
  ------------------
  |  Branch (49:9): [True: 0, False: 2]
  ------------------
   50|      2|# endif
   51|      2|# ifndef OPENSSL_NO_DH
   52|      2|        ERR_load_DH_strings() == 0 ||
  ------------------
  |  Branch (52:9): [True: 0, False: 2]
  ------------------
   53|      2|# endif
   54|      2|        ERR_load_EVP_strings() == 0 ||
  ------------------
  |  Branch (54:9): [True: 0, False: 2]
  ------------------
   55|      2|        ERR_load_BUF_strings() == 0 ||
  ------------------
  |  Branch (55:9): [True: 0, False: 2]
  ------------------
   56|      2|        ERR_load_OBJ_strings() == 0 ||
  ------------------
  |  Branch (56:9): [True: 0, False: 2]
  ------------------
   57|      2|        ERR_load_PEM_strings() == 0 ||
  ------------------
  |  Branch (57:9): [True: 0, False: 2]
  ------------------
   58|      2|# ifndef OPENSSL_NO_DSA
   59|      2|        ERR_load_DSA_strings() == 0 ||
  ------------------
  |  Branch (59:9): [True: 0, False: 2]
  ------------------
   60|      2|# endif
   61|      2|        ERR_load_X509_strings() == 0 ||
  ------------------
  |  Branch (61:9): [True: 0, False: 2]
  ------------------
   62|      2|        ERR_load_ASN1_strings() == 0 ||
  ------------------
  |  Branch (62:9): [True: 0, False: 2]
  ------------------
   63|      2|        ERR_load_CONF_strings() == 0 ||
  ------------------
  |  Branch (63:9): [True: 0, False: 2]
  ------------------
   64|      2|        ERR_load_CRYPTO_strings() == 0 ||
  ------------------
  |  Branch (64:9): [True: 0, False: 2]
  ------------------
   65|      2|# ifndef OPENSSL_NO_COMP
   66|      2|        ERR_load_COMP_strings() == 0 ||
  ------------------
  |  Branch (66:9): [True: 0, False: 2]
  ------------------
   67|      2|# endif
   68|      2|# ifndef OPENSSL_NO_EC
   69|      2|        ERR_load_EC_strings() == 0 ||
  ------------------
  |  Branch (69:9): [True: 0, False: 2]
  ------------------
   70|      2|# endif
   71|       |        /* skip ERR_load_SSL_strings() because it is not in this library */
   72|      2|        ERR_load_BIO_strings() == 0 ||
  ------------------
  |  Branch (72:9): [True: 0, False: 2]
  ------------------
   73|      2|        ERR_load_PKCS7_strings() == 0 ||
  ------------------
  |  Branch (73:9): [True: 0, False: 2]
  ------------------
   74|      2|        ERR_load_X509V3_strings() == 0 ||
  ------------------
  |  Branch (74:9): [True: 0, False: 2]
  ------------------
   75|      2|        ERR_load_PKCS12_strings() == 0 ||
  ------------------
  |  Branch (75:9): [True: 0, False: 2]
  ------------------
   76|      2|        ERR_load_RAND_strings() == 0 ||
  ------------------
  |  Branch (76:9): [True: 0, False: 2]
  ------------------
   77|      2|        ERR_load_DSO_strings() == 0 ||
  ------------------
  |  Branch (77:9): [True: 0, False: 2]
  ------------------
   78|      2|# ifndef OPENSSL_NO_TS
   79|      2|        ERR_load_TS_strings() == 0 ||
  ------------------
  |  Branch (79:9): [True: 0, False: 2]
  ------------------
   80|      2|# endif
   81|      2|# ifndef OPENSSL_NO_ENGINE
   82|      2|        ERR_load_ENGINE_strings() == 0 ||
  ------------------
  |  Branch (82:9): [True: 0, False: 2]
  ------------------
   83|      2|# endif
   84|      2|# ifndef OPENSSL_NO_OCSP
   85|      2|        ERR_load_OCSP_strings() == 0 ||
  ------------------
  |  Branch (85:9): [True: 0, False: 2]
  ------------------
   86|      2|# endif
   87|      2|        ERR_load_UI_strings() == 0 ||
  ------------------
  |  Branch (87:9): [True: 0, False: 2]
  ------------------
   88|      2|# ifndef OPENSSL_NO_CMS
   89|      2|        ERR_load_CMS_strings() == 0 ||
  ------------------
  |  Branch (89:9): [True: 0, False: 2]
  ------------------
   90|      2|# endif
   91|      2|# ifndef OPENSSL_NO_CT
   92|      2|        ERR_load_CT_strings() == 0 ||
  ------------------
  |  Branch (92:9): [True: 0, False: 2]
  ------------------
   93|      2|# endif
   94|      2|        ERR_load_ASYNC_strings() == 0 ||
  ------------------
  |  Branch (94:9): [True: 0, False: 2]
  ------------------
   95|      2|#endif
   96|      2|        ERR_load_KDF_strings() == 0 ||
  ------------------
  |  Branch (96:9): [True: 0, False: 2]
  ------------------
   97|      2|        ERR_load_OSSL_STORE_strings() == 0)
  ------------------
  |  Branch (97:9): [True: 0, False: 2]
  ------------------
   98|      0|        return 0;
   99|       |
  100|      2|    return 1;
  101|      2|}

ERR_load_EVP_strings:
  287|      2|{
  288|      2|#ifndef OPENSSL_NO_ERR
  289|      2|    if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (289:9): [True: 2, False: 0]
  ------------------
  290|      2|        ERR_load_strings_const(EVP_str_functs);
  291|      2|        ERR_load_strings_const(EVP_str_reasons);
  292|      2|    }
  293|      2|#endif
  294|      2|    return 1;
  295|      2|}

EVP_PBE_cleanup:
  244|      2|{
  245|      2|    sk_EVP_PBE_CTL_pop_free(pbe_algs, free_evp_pbe_ctl);
  246|      2|    pbe_algs = NULL;
  247|      2|}

evp_cleanup_int:
   81|      2|{
   82|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   20|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
   83|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   19|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
   84|       |    /*
   85|       |     * The above calls will only clean out the contents of the name hash
   86|       |     * table, but not the hash table itself.  The following line does that
   87|       |     * part.  -- Richard Levitte
   88|       |     */
   89|      2|    OBJ_NAME_cleanup(-1);
   90|       |
   91|      2|    EVP_PBE_cleanup();
   92|      2|    OBJ_sigid_free();
   93|       |
   94|      2|    evp_app_cleanup_int();
   95|      2|}

evp_app_cleanup_int:
  317|      2|{
  318|      2|    if (app_pkey_methods != NULL)
  ------------------
  |  Branch (318:9): [True: 0, False: 2]
  ------------------
  319|      0|        sk_EVP_PKEY_METHOD_pop_free(app_pkey_methods, EVP_PKEY_meth_free);
  320|      2|}

crypto_cleanup_all_ex_data_int:
   94|      2|{
   95|      2|    int i;
   96|       |
   97|     34|    for (i = 0; i < CRYPTO_EX_INDEX__COUNT; ++i) {
  ------------------
  |  |  110|     34|# define CRYPTO_EX_INDEX__COUNT          16
  ------------------
  |  Branch (97:17): [True: 32, False: 2]
  ------------------
   98|     32|        EX_CALLBACKS *ip = &ex_data[i];
   99|       |
  100|     32|        sk_EX_CALLBACK_pop_free(ip->meth, cleanup_cb);
  101|     32|        ip->meth = NULL;
  102|     32|    }
  103|       |
  104|      2|    CRYPTO_THREAD_lock_free(ex_data_lock);
  105|      2|    ex_data_lock = NULL;
  106|      2|}
CRYPTO_free_ex_index:
  131|      2|{
  132|      2|    EX_CALLBACKS *ip = get_and_lock(class_index);
  133|      2|    EX_CALLBACK *a;
  134|      2|    int toret = 0;
  135|       |
  136|      2|    if (ip == NULL)
  ------------------
  |  Branch (136:9): [True: 0, False: 2]
  ------------------
  137|      0|        return 0;
  138|      2|    if (idx < 0 || idx >= sk_EX_CALLBACK_num(ip->meth))
  ------------------
  |  Branch (138:9): [True: 2, False: 0]
  |  Branch (138:20): [True: 0, False: 0]
  ------------------
  139|      2|        goto err;
  140|      0|    a = sk_EX_CALLBACK_value(ip->meth, idx);
  141|      0|    if (a == NULL)
  ------------------
  |  Branch (141:9): [True: 0, False: 0]
  ------------------
  142|      0|        goto err;
  143|      0|    a->new_func = dummy_new;
  144|      0|    a->dup_func = dummy_dup;
  145|      0|    a->free_func = dummy_free;
  146|      0|    toret = 1;
  147|      2|err:
  148|      2|    CRYPTO_THREAD_unlock(ex_data_lock);
  149|      2|    return toret;
  150|      0|}
CRYPTO_new_ex_data:
  209|    604|{
  210|    604|    int mx, i;
  211|    604|    void *ptr;
  212|    604|    EX_CALLBACK **storage = NULL;
  213|    604|    EX_CALLBACK *stack[10];
  214|    604|    EX_CALLBACKS *ip = get_and_lock(class_index);
  215|       |
  216|    604|    if (ip == NULL)
  ------------------
  |  Branch (216:9): [True: 0, False: 604]
  ------------------
  217|      0|        return 0;
  218|       |
  219|    604|    ad->sk = NULL;
  220|       |
  221|    604|    mx = sk_EX_CALLBACK_num(ip->meth);
  222|    604|    if (mx > 0) {
  ------------------
  |  Branch (222:9): [True: 0, False: 604]
  ------------------
  223|      0|        if (mx < (int)OSSL_NELEM(stack))
  ------------------
  |  |   13|      0|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (223:13): [True: 0, False: 0]
  ------------------
  224|      0|            storage = stack;
  225|      0|        else
  226|      0|            storage = OPENSSL_malloc(sizeof(*storage) * mx);
  ------------------
  |  |  118|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  227|      0|        if (storage != NULL)
  ------------------
  |  Branch (227:13): [True: 0, False: 0]
  ------------------
  228|      0|            for (i = 0; i < mx; i++)
  ------------------
  |  Branch (228:25): [True: 0, False: 0]
  ------------------
  229|      0|                storage[i] = sk_EX_CALLBACK_value(ip->meth, i);
  230|      0|    }
  231|    604|    CRYPTO_THREAD_unlock(ex_data_lock);
  232|       |
  233|    604|    if (mx > 0 && storage == NULL) {
  ------------------
  |  Branch (233:9): [True: 0, False: 604]
  |  Branch (233:19): [True: 0, False: 0]
  ------------------
  234|      0|        CRYPTOerr(CRYPTO_F_CRYPTO_NEW_EX_DATA, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  113|      0|# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  235|      0|        return 0;
  236|      0|    }
  237|    604|    for (i = 0; i < mx; i++) {
  ------------------
  |  Branch (237:17): [True: 0, False: 604]
  ------------------
  238|      0|        if (storage[i] != NULL && storage[i]->new_func != NULL) {
  ------------------
  |  Branch (238:13): [True: 0, False: 0]
  |  Branch (238:35): [True: 0, False: 0]
  ------------------
  239|      0|            ptr = CRYPTO_get_ex_data(ad, i);
  240|      0|            storage[i]->new_func(obj, ptr, ad, i,
  241|      0|                                 storage[i]->argl, storage[i]->argp);
  242|      0|        }
  243|      0|    }
  244|    604|    if (storage != stack)
  ------------------
  |  Branch (244:9): [True: 604, False: 0]
  ------------------
  245|    604|        OPENSSL_free(storage);
  ------------------
  |  |  128|    604|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    604|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    604|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  246|    604|    return 1;
  247|    604|}
CRYPTO_free_ex_data:
  321|    604|{
  322|    604|    int mx, i;
  323|    604|    EX_CALLBACKS *ip;
  324|    604|    void *ptr;
  325|    604|    EX_CALLBACK *f;
  326|    604|    EX_CALLBACK *stack[10];
  327|    604|    EX_CALLBACK **storage = NULL;
  328|       |
  329|    604|    if ((ip = get_and_lock(class_index)) == NULL)
  ------------------
  |  Branch (329:9): [True: 0, False: 604]
  ------------------
  330|      0|        goto err;
  331|       |
  332|    604|    mx = sk_EX_CALLBACK_num(ip->meth);
  333|    604|    if (mx > 0) {
  ------------------
  |  Branch (333:9): [True: 0, False: 604]
  ------------------
  334|      0|        if (mx < (int)OSSL_NELEM(stack))
  ------------------
  |  |   13|      0|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (334:13): [True: 0, False: 0]
  ------------------
  335|      0|            storage = stack;
  336|      0|        else
  337|      0|            storage = OPENSSL_malloc(sizeof(*storage) * mx);
  ------------------
  |  |  118|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  338|      0|        if (storage != NULL)
  ------------------
  |  Branch (338:13): [True: 0, False: 0]
  ------------------
  339|      0|            for (i = 0; i < mx; i++)
  ------------------
  |  Branch (339:25): [True: 0, False: 0]
  ------------------
  340|      0|                storage[i] = sk_EX_CALLBACK_value(ip->meth, i);
  341|      0|    }
  342|    604|    CRYPTO_THREAD_unlock(ex_data_lock);
  343|       |
  344|    604|    for (i = 0; i < mx; i++) {
  ------------------
  |  Branch (344:17): [True: 0, False: 604]
  ------------------
  345|      0|        if (storage != NULL)
  ------------------
  |  Branch (345:13): [True: 0, False: 0]
  ------------------
  346|      0|            f = storage[i];
  347|      0|        else {
  348|      0|            CRYPTO_THREAD_write_lock(ex_data_lock);
  349|      0|            f = sk_EX_CALLBACK_value(ip->meth, i);
  350|      0|            CRYPTO_THREAD_unlock(ex_data_lock);
  351|      0|        }
  352|      0|        if (f != NULL && f->free_func != NULL) {
  ------------------
  |  Branch (352:13): [True: 0, False: 0]
  |  Branch (352:26): [True: 0, False: 0]
  ------------------
  353|      0|            ptr = CRYPTO_get_ex_data(ad, i);
  354|      0|            f->free_func(obj, ptr, ad, i, f->argl, f->argp);
  355|      0|        }
  356|      0|    }
  357|       |
  358|    604|    if (storage != stack)
  ------------------
  |  Branch (358:9): [True: 604, False: 0]
  ------------------
  359|    604|        OPENSSL_free(storage);
  ------------------
  |  |  128|    604|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    604|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    604|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  360|    604| err:
  361|    604|    sk_void_free(ad->sk);
  362|    604|    ad->sk = NULL;
  363|    604|}
ex_data.c:get_and_lock:
   51|  1.21k|{
   52|  1.21k|    EX_CALLBACKS *ip;
   53|       |
   54|  1.21k|    if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
  ------------------
  |  |  110|  1.21k|# define CRYPTO_EX_INDEX__COUNT          16
  ------------------
  |  Branch (54:9): [True: 0, False: 1.21k]
  |  Branch (54:28): [True: 0, False: 1.21k]
  ------------------
   55|      0|        CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  113|      0|# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   56|      0|        return NULL;
   57|      0|    }
   58|       |
   59|  1.21k|    if (!RUN_ONCE(&ex_data_init, do_ex_data_init)) {
  ------------------
  |  |  119|  1.21k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 1.21k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (59:9): [True: 0, False: 1.21k]
  ------------------
   60|      0|        CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  113|      0|# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   61|      0|        return NULL;
   62|      0|    }
   63|       |
   64|  1.21k|    if (ex_data_lock == NULL) {
  ------------------
  |  Branch (64:9): [True: 0, False: 1.21k]
  ------------------
   65|       |        /*
   66|       |         * This can happen in normal operation when using CRYPTO_mem_leaks().
   67|       |         * The CRYPTO_mem_leaks() function calls OPENSSL_cleanup() which cleans
   68|       |         * up the locks. Subsequently the BIO that CRYPTO_mem_leaks() uses gets
   69|       |         * freed, which also attempts to free the ex_data. However
   70|       |         * CRYPTO_mem_leaks() ensures that the ex_data is freed early (i.e.
   71|       |         * before OPENSSL_cleanup() is called), so if we get here we can safely
   72|       |         * ignore this operation. We just treat it as an error.
   73|       |         */
   74|      0|         return NULL;
   75|      0|    }
   76|       |
   77|  1.21k|    ip = &ex_data[class_index];
   78|  1.21k|    CRYPTO_THREAD_write_lock(ex_data_lock);
   79|  1.21k|    return ip;
   80|  1.21k|}
ex_data.c:do_ex_data_init:
   39|      2|{
   40|      2|    if (!OPENSSL_init_crypto(0, NULL))
  ------------------
  |  Branch (40:9): [True: 0, False: 2]
  ------------------
   41|      0|        return 0;
   42|      2|    ex_data_lock = CRYPTO_THREAD_lock_new();
   43|      2|    return ex_data_lock != NULL;
   44|      2|}

ossl_init_thread_start:
  458|      2|{
  459|      2|    struct thread_local_inits_st *locals;
  460|       |
  461|      2|    if (!OPENSSL_init_crypto(0, NULL))
  ------------------
  |  Branch (461:9): [True: 0, False: 2]
  ------------------
  462|      0|        return 0;
  463|       |
  464|      2|    locals = ossl_init_get_thread_local(1);
  465|       |
  466|      2|    if (locals == NULL)
  ------------------
  |  Branch (466:9): [True: 0, False: 2]
  ------------------
  467|      0|        return 0;
  468|       |
  469|      2|    if (opts & OPENSSL_INIT_THREAD_ASYNC) {
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_THREAD_ASYNC           0x01
  ------------------
  |  Branch (469:9): [True: 0, False: 2]
  ------------------
  470|       |#ifdef OPENSSL_INIT_DEBUG
  471|       |        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
  472|       |                        "marking thread for async\n");
  473|       |#endif
  474|      0|        locals->async = 1;
  475|      0|    }
  476|       |
  477|      2|    if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
  ------------------
  |  |   32|      2|# define OPENSSL_INIT_THREAD_ERR_STATE       0x02
  ------------------
  |  Branch (477:9): [True: 2, False: 0]
  ------------------
  478|       |#ifdef OPENSSL_INIT_DEBUG
  479|       |        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
  480|       |                        "marking thread for err_state\n");
  481|       |#endif
  482|      2|        locals->err_state = 1;
  483|      2|    }
  484|       |
  485|      2|    if (opts & OPENSSL_INIT_THREAD_RAND) {
  ------------------
  |  |   33|      2|# define OPENSSL_INIT_THREAD_RAND            0x04
  ------------------
  |  Branch (485:9): [True: 0, False: 2]
  ------------------
  486|       |#ifdef OPENSSL_INIT_DEBUG
  487|       |        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
  488|       |                        "marking thread for rand\n");
  489|       |#endif
  490|      0|        locals->rand = 1;
  491|      0|    }
  492|       |
  493|      2|    return 1;
  494|      2|}
OPENSSL_cleanup:
  497|      2|{
  498|      2|    OPENSSL_INIT_STOP *currhandler, *lasthandler;
  499|      2|    CRYPTO_THREAD_LOCAL key;
  500|       |
  501|       |    /* If we've not been inited then no need to deinit */
  502|      2|    if (!base_inited)
  ------------------
  |  Branch (502:9): [True: 0, False: 2]
  ------------------
  503|      0|        return;
  504|       |
  505|       |    /* Might be explicitly called and also by atexit */
  506|      2|    if (stopped)
  ------------------
  |  Branch (506:9): [True: 0, False: 2]
  ------------------
  507|      0|        return;
  508|      2|    stopped = 1;
  509|       |
  510|       |    /*
  511|       |     * Thread stop may not get automatically called by the thread library for
  512|       |     * the very last thread in some situations, so call it directly.
  513|       |     */
  514|      2|    ossl_init_thread_stop(ossl_init_get_thread_local(0));
  515|       |
  516|      2|    currhandler = stop_handlers;
  517|      2|    while (currhandler != NULL) {
  ------------------
  |  Branch (517:12): [True: 0, False: 2]
  ------------------
  518|      0|        currhandler->handler();
  519|      0|        lasthandler = currhandler;
  520|      0|        currhandler = currhandler->next;
  521|      0|        OPENSSL_free(lasthandler);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  522|      0|    }
  523|      2|    stop_handlers = NULL;
  524|       |
  525|      2|    CRYPTO_THREAD_lock_free(init_lock);
  526|      2|    init_lock = NULL;
  527|       |
  528|       |    /*
  529|       |     * We assume we are single-threaded for this function, i.e. no race
  530|       |     * conditions for the various "*_inited" vars below.
  531|       |     */
  532|       |
  533|      2|#ifndef OPENSSL_NO_COMP
  534|      2|    if (zlib_inited) {
  ------------------
  |  Branch (534:9): [True: 0, False: 2]
  ------------------
  535|       |#ifdef OPENSSL_INIT_DEBUG
  536|       |        fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  537|       |                        "comp_zlib_cleanup_int()\n");
  538|       |#endif
  539|      0|        comp_zlib_cleanup_int();
  540|      0|    }
  541|      2|#endif
  542|       |
  543|      2|    if (async_inited) {
  ------------------
  |  Branch (543:9): [True: 0, False: 2]
  ------------------
  544|       |# ifdef OPENSSL_INIT_DEBUG
  545|       |        fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  546|       |                        "async_deinit()\n");
  547|       |# endif
  548|      0|        async_deinit();
  549|      0|    }
  550|       |
  551|      2|    key = destructor_key.value;
  552|      2|    destructor_key.sane = -1;
  553|      2|    CRYPTO_THREAD_cleanup_local(&key);
  554|       |
  555|       |#ifdef OPENSSL_INIT_DEBUG
  556|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  557|       |                    "rand_cleanup_int()\n");
  558|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  559|       |                    "conf_modules_free_int()\n");
  560|       |#ifndef OPENSSL_NO_ENGINE
  561|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  562|       |                    "engine_cleanup_int()\n");
  563|       |#endif
  564|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  565|       |                    "crypto_cleanup_all_ex_data_int()\n");
  566|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  567|       |                    "bio_sock_cleanup_int()\n");
  568|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  569|       |                    "bio_cleanup()\n");
  570|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  571|       |                    "evp_cleanup_int()\n");
  572|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  573|       |                    "obj_cleanup_int()\n");
  574|       |    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
  575|       |                    "err_cleanup()\n");
  576|       |#endif
  577|       |    /*
  578|       |     * Note that cleanup order is important:
  579|       |     * - rand_cleanup_int could call an ENGINE's RAND cleanup function so
  580|       |     * must be called before engine_cleanup_int()
  581|       |     * - ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
  582|       |     * before the ex data handlers are wiped in CRYPTO_cleanup_all_ex_data().
  583|       |     * - conf_modules_free_int() can end up in ENGINE code so must be called
  584|       |     * before engine_cleanup_int()
  585|       |     * - ENGINEs and additional EVP algorithms might use added OIDs names so
  586|       |     * obj_cleanup_int() must be called last
  587|       |     */
  588|      2|    rand_cleanup_int();
  589|      2|    rand_drbg_cleanup_int();
  590|      2|    conf_modules_free_int();
  591|      2|#ifndef OPENSSL_NO_ENGINE
  592|      2|    engine_cleanup_int();
  593|      2|#endif
  594|      2|    ossl_store_cleanup_int();
  595|      2|    crypto_cleanup_all_ex_data_int();
  596|      2|    bio_cleanup();
  597|      2|    evp_cleanup_int();
  598|      2|    obj_cleanup_int();
  599|      2|    err_cleanup();
  600|       |
  601|      2|    CRYPTO_secure_malloc_done();
  602|       |
  603|      2|    base_inited = 0;
  604|      2|}
OPENSSL_init_crypto:
  612|  3.93k|{
  613|  3.93k|    if (stopped) {
  ------------------
  |  Branch (613:9): [True: 0, False: 3.93k]
  ------------------
  614|      0|        if (!(opts & OPENSSL_INIT_BASE_ONLY))
  ------------------
  |  |   28|      0|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (614:13): [True: 0, False: 0]
  ------------------
  615|      0|            CRYPTOerr(CRYPTO_F_OPENSSL_INIT_CRYPTO, ERR_R_INIT_FAIL);
  ------------------
  |  |  113|      0|# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  616|      0|        return 0;
  617|      0|    }
  618|       |
  619|       |    /*
  620|       |     * When the caller specifies OPENSSL_INIT_BASE_ONLY, that should be the
  621|       |     * *only* option specified.  With that option we return immediately after
  622|       |     * doing the requested limited initialization.  Note that
  623|       |     * err_shelve_state() called by us via ossl_init_load_crypto_nodelete()
  624|       |     * re-enters OPENSSL_init_crypto() with OPENSSL_INIT_BASE_ONLY, but with
  625|       |     * base already initialized this is a harmless NOOP.
  626|       |     *
  627|       |     * If we remain the only caller of err_shelve_state() the recursion should
  628|       |     * perhaps be removed, but if in doubt, it can be left in place.
  629|       |     */
  630|  3.93k|    if (!RUN_ONCE(&base, ossl_init_base))
  ------------------
  |  |  119|  3.93k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 3.93k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (630:9): [True: 0, False: 3.93k]
  ------------------
  631|      0|        return 0;
  632|  3.93k|    if (opts & OPENSSL_INIT_BASE_ONLY)
  ------------------
  |  |   28|  3.93k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (632:9): [True: 3.92k, False: 10]
  ------------------
  633|  3.92k|        return 1;
  634|       |
  635|       |    /*
  636|       |     * Now we don't always set up exit handlers, the INIT_BASE_ONLY calls
  637|       |     * should not have the side-effect of setting up exit handlers, and
  638|       |     * therefore, this code block is below the INIT_BASE_ONLY-conditioned early
  639|       |     * return above.
  640|       |     */
  641|     10|    if ((opts & OPENSSL_INIT_NO_ATEXIT) != 0) {
  ------------------
  |  |  375|     10|# define OPENSSL_INIT_NO_ATEXIT              0x00080000L
  ------------------
  |  Branch (641:9): [True: 0, False: 10]
  ------------------
  642|      0|        if (!RUN_ONCE_ALT(&register_atexit, ossl_init_no_register_atexit,
  ------------------
  |  |  137|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (137:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (642:13): [True: 0, False: 0]
  ------------------
  643|      0|                          ossl_init_register_atexit))
  644|      0|            return 0;
  645|     10|    } else if (!RUN_ONCE(&register_atexit, ossl_init_register_atexit)) {
  ------------------
  |  |  119|     10|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 10, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (645:16): [True: 0, False: 10]
  ------------------
  646|      0|        return 0;
  647|      0|    }
  648|       |
  649|     10|    if (!RUN_ONCE(&load_crypto_nodelete, ossl_init_load_crypto_nodelete))
  ------------------
  |  |  119|     10|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 10, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (649:9): [True: 0, False: 10]
  ------------------
  650|      0|        return 0;
  651|       |
  652|     10|    if ((opts & OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  356|     10|# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
  ------------------
  |  Branch (652:9): [True: 0, False: 10]
  ------------------
  653|     10|            && !RUN_ONCE_ALT(&load_crypto_strings,
  ------------------
  |  |  137|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (137:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (653:16): [True: 0, False: 0]
  ------------------
  654|     10|                             ossl_init_no_load_crypto_strings,
  655|     10|                             ossl_init_load_crypto_strings))
  656|      0|        return 0;
  657|       |
  658|     10|    if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  357|     10|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  |  Branch (658:9): [True: 4, False: 6]
  ------------------
  659|     10|            && !RUN_ONCE(&load_crypto_strings, ossl_init_load_crypto_strings))
  ------------------
  |  |  119|      4|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (659:16): [True: 0, False: 4]
  ------------------
  660|      0|        return 0;
  661|       |
  662|     10|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_CIPHERS)
  ------------------
  |  |  360|     10|# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS     0x00000010L
  ------------------
  |  Branch (662:9): [True: 0, False: 10]
  ------------------
  663|     10|            && !RUN_ONCE_ALT(&add_all_ciphers, ossl_init_no_add_all_ciphers,
  ------------------
  |  |  137|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (137:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (663:16): [True: 0, False: 0]
  ------------------
  664|     10|                             ossl_init_add_all_ciphers))
  665|      0|        return 0;
  666|       |
  667|     10|    if ((opts & OPENSSL_INIT_ADD_ALL_CIPHERS)
  ------------------
  |  |  358|     10|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  |  Branch (667:9): [True: 0, False: 10]
  ------------------
  668|     10|            && !RUN_ONCE(&add_all_ciphers, ossl_init_add_all_ciphers))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (668:16): [True: 0, False: 0]
  ------------------
  669|      0|        return 0;
  670|       |
  671|     10|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_DIGESTS)
  ------------------
  |  |  361|     10|# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS     0x00000020L
  ------------------
  |  Branch (671:9): [True: 0, False: 10]
  ------------------
  672|     10|            && !RUN_ONCE_ALT(&add_all_digests, ossl_init_no_add_all_digests,
  ------------------
  |  |  137|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (137:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (672:16): [True: 0, False: 0]
  ------------------
  673|     10|                             ossl_init_add_all_digests))
  674|      0|        return 0;
  675|       |
  676|     10|    if ((opts & OPENSSL_INIT_ADD_ALL_DIGESTS)
  ------------------
  |  |  359|     10|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  |  Branch (676:9): [True: 0, False: 10]
  ------------------
  677|     10|            && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (677:16): [True: 0, False: 0]
  ------------------
  678|      0|        return 0;
  679|       |
  680|     10|    if ((opts & OPENSSL_INIT_ATFORK)
  ------------------
  |  |  373|     10|# define OPENSSL_INIT_ATFORK                 0x00020000L
  ------------------
  |  Branch (680:9): [True: 0, False: 10]
  ------------------
  681|     10|            && !openssl_init_fork_handlers())
  ------------------
  |  Branch (681:16): [True: 0, False: 0]
  ------------------
  682|      0|        return 0;
  683|       |
  684|     10|    if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG)
  ------------------
  |  |  363|     10|# define OPENSSL_INIT_NO_LOAD_CONFIG         0x00000080L
  ------------------
  |  Branch (684:9): [True: 0, False: 10]
  ------------------
  685|     10|            && !RUN_ONCE_ALT(&config, ossl_init_no_config, ossl_init_config))
  ------------------
  |  |  137|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (137:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (685:16): [True: 0, False: 0]
  ------------------
  686|      0|        return 0;
  687|       |
  688|     10|    if (opts & OPENSSL_INIT_LOAD_CONFIG) {
  ------------------
  |  |  362|     10|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (688:9): [True: 0, False: 10]
  ------------------
  689|      0|        int ret;
  690|      0|        CRYPTO_THREAD_write_lock(init_lock);
  691|      0|        conf_settings = settings;
  692|      0|        ret = RUN_ONCE(&config, ossl_init_config);
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  693|      0|        conf_settings = NULL;
  694|      0|        CRYPTO_THREAD_unlock(init_lock);
  695|      0|        if (ret <= 0)
  ------------------
  |  Branch (695:13): [True: 0, False: 0]
  ------------------
  696|      0|            return 0;
  697|      0|    }
  698|       |
  699|     10|    if ((opts & OPENSSL_INIT_ASYNC)
  ------------------
  |  |  364|     10|# define OPENSSL_INIT_ASYNC                  0x00000100L
  ------------------
  |  Branch (699:9): [True: 0, False: 10]
  ------------------
  700|     10|            && !RUN_ONCE(&async, ossl_init_async))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (700:16): [True: 0, False: 0]
  ------------------
  701|      0|        return 0;
  702|       |
  703|     10|#ifndef OPENSSL_NO_ENGINE
  704|     10|    if ((opts & OPENSSL_INIT_ENGINE_OPENSSL)
  ------------------
  |  |  367|     10|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  |  Branch (704:9): [True: 0, False: 10]
  ------------------
  705|     10|            && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (705:16): [True: 0, False: 0]
  ------------------
  706|      0|        return 0;
  707|       |# if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_DEVCRYPTOENG)
  708|       |    if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV)
  709|       |            && !RUN_ONCE(&engine_devcrypto, ossl_init_engine_devcrypto))
  710|       |        return 0;
  711|       |# endif
  712|     10|# ifndef OPENSSL_NO_RDRAND
  713|     10|    if ((opts & OPENSSL_INIT_ENGINE_RDRAND)
  ------------------
  |  |  365|     10|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  ------------------
  |  Branch (713:9): [True: 0, False: 10]
  ------------------
  714|     10|            && !RUN_ONCE(&engine_rdrand, ossl_init_engine_rdrand))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (714:16): [True: 0, False: 0]
  ------------------
  715|      0|        return 0;
  716|     10|# endif
  717|     10|    if ((opts & OPENSSL_INIT_ENGINE_DYNAMIC)
  ------------------
  |  |  366|     10|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  ------------------
  |  Branch (717:9): [True: 0, False: 10]
  ------------------
  718|     10|            && !RUN_ONCE(&engine_dynamic, ossl_init_engine_dynamic))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (718:16): [True: 0, False: 0]
  ------------------
  719|      0|        return 0;
  720|     10|# ifndef OPENSSL_NO_STATIC_ENGINE
  721|     10|#  if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK)
  722|     10|    if ((opts & OPENSSL_INIT_ENGINE_PADLOCK)
  ------------------
  |  |  370|     10|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  ------------------
  |  Branch (722:9): [True: 0, False: 10]
  ------------------
  723|     10|            && !RUN_ONCE(&engine_padlock, ossl_init_engine_padlock))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (723:16): [True: 0, False: 0]
  ------------------
  724|      0|        return 0;
  725|     10|#  endif
  726|       |#  if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
  727|       |    if ((opts & OPENSSL_INIT_ENGINE_CAPI)
  728|       |            && !RUN_ONCE(&engine_capi, ossl_init_engine_capi))
  729|       |        return 0;
  730|       |#  endif
  731|     10|#  if !defined(OPENSSL_NO_AFALGENG)
  732|     10|    if ((opts & OPENSSL_INIT_ENGINE_AFALG)
  ------------------
  |  |  371|     10|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  |  Branch (732:9): [True: 0, False: 10]
  ------------------
  733|     10|            && !RUN_ONCE(&engine_afalg, ossl_init_engine_afalg))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (733:16): [True: 0, False: 0]
  ------------------
  734|      0|        return 0;
  735|     10|#  endif
  736|     10|# endif
  737|     10|    if (opts & (OPENSSL_INIT_ENGINE_ALL_BUILTIN
  ------------------
  |  |  381|     10|    (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  365|     10|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  |  |  ------------------
  |  |                   (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  366|     10|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  |  |  ------------------
  |  |  382|     10|    | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  368|     10|# define OPENSSL_INIT_ENGINE_CRYPTODEV       0x00001000L
  |  |  ------------------
  |  |                   | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  369|     10|# define OPENSSL_INIT_ENGINE_CAPI            0x00002000L
  |  |  ------------------
  |  |  383|     10|    OPENSSL_INIT_ENGINE_PADLOCK)
  |  |  ------------------
  |  |  |  |  370|     10|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  |  |  ------------------
  ------------------
  |  Branch (737:9): [True: 0, False: 10]
  ------------------
  738|     10|                | OPENSSL_INIT_ENGINE_OPENSSL
  ------------------
  |  |  367|     10|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  739|     10|                | OPENSSL_INIT_ENGINE_AFALG)) {
  ------------------
  |  |  371|     10|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  740|      0|        ENGINE_register_all_complete();
  741|      0|    }
  742|     10|#endif
  743|       |
  744|     10|#ifndef OPENSSL_NO_COMP
  745|     10|    if ((opts & OPENSSL_INIT_ZLIB)
  ------------------
  |  |   27|     10|# define OPENSSL_INIT_ZLIB                   0x00010000L
  ------------------
  |  Branch (745:9): [True: 0, False: 10]
  ------------------
  746|     10|            && !RUN_ONCE(&zlib, ossl_init_zlib))
  ------------------
  |  |  119|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (119:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (746:16): [True: 0, False: 0]
  ------------------
  747|      0|        return 0;
  748|     10|#endif
  749|       |
  750|     10|    return 1;
  751|     10|}
init.c:ossl_init_thread_stop:
  419|      2|{
  420|       |    /* Can't do much about this */
  421|      2|    if (locals == NULL)
  ------------------
  |  Branch (421:9): [True: 0, False: 2]
  ------------------
  422|      0|        return;
  423|       |
  424|      2|    if (locals->async) {
  ------------------
  |  Branch (424:9): [True: 0, False: 2]
  ------------------
  425|       |#ifdef OPENSSL_INIT_DEBUG
  426|       |        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
  427|       |                        "async_delete_thread_state()\n");
  428|       |#endif
  429|      0|        async_delete_thread_state();
  430|      0|    }
  431|       |
  432|      2|    if (locals->err_state) {
  ------------------
  |  Branch (432:9): [True: 2, False: 0]
  ------------------
  433|       |#ifdef OPENSSL_INIT_DEBUG
  434|       |        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
  435|       |                        "err_delete_thread_state()\n");
  436|       |#endif
  437|      2|        err_delete_thread_state();
  438|      2|    }
  439|       |
  440|      2|    if (locals->rand) {
  ------------------
  |  Branch (440:9): [True: 0, False: 2]
  ------------------
  441|       |#ifdef OPENSSL_INIT_DEBUG
  442|       |        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
  443|       |                        "drbg_delete_thread_state()\n");
  444|       |#endif
  445|      0|        drbg_delete_thread_state();
  446|      0|    }
  447|       |
  448|      2|    OPENSSL_free(locals);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  449|      2|}
init.c:ossl_init_get_thread_local:
   60|      4|{
   61|      4|    struct thread_local_inits_st *local =
   62|      4|        CRYPTO_THREAD_get_local(&destructor_key.value);
   63|       |
   64|      4|    if (alloc) {
  ------------------
  |  Branch (64:9): [True: 2, False: 2]
  ------------------
   65|      2|        if (local == NULL
  ------------------
  |  Branch (65:13): [True: 2, False: 0]
  ------------------
   66|      2|            && (local = OPENSSL_zalloc(sizeof(*local))) != NULL
  ------------------
  |  |  120|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (66:16): [True: 2, False: 0]
  ------------------
   67|      2|            && !CRYPTO_THREAD_set_local(&destructor_key.value, local)) {
  ------------------
  |  Branch (67:16): [True: 0, False: 2]
  ------------------
   68|      0|            OPENSSL_free(local);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   69|      0|            return NULL;
   70|      0|        }
   71|      2|    } else {
   72|      2|        CRYPTO_THREAD_set_local(&destructor_key.value, NULL);
   73|      2|    }
   74|       |
   75|      4|    return local;
   76|      4|}
init.c:ossl_init_base:
   90|      2|{
   91|      2|    CRYPTO_THREAD_LOCAL key;
   92|       |
   93|       |#ifdef OPENSSL_INIT_DEBUG
   94|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_base: Setting up stop handlers\n");
   95|       |#endif
   96|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
   97|       |    ossl_malloc_setup_failures();
   98|       |#endif
   99|      2|    if (!CRYPTO_THREAD_init_local(&key, ossl_init_thread_destructor))
  ------------------
  |  Branch (99:9): [True: 0, False: 2]
  ------------------
  100|      0|        return 0;
  101|      2|    if ((init_lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (101:9): [True: 0, False: 2]
  ------------------
  102|      0|        goto err;
  103|      2|    OPENSSL_cpuid_setup();
  104|       |
  105|      2|    destructor_key.value = key;
  106|      2|    base_inited = 1;
  107|      2|    return 1;
  108|       |
  109|      0|err:
  110|       |#ifdef OPENSSL_INIT_DEBUG
  111|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_base not ok!\n");
  112|       |#endif
  113|      0|    CRYPTO_THREAD_lock_free(init_lock);
  114|      0|    init_lock = NULL;
  115|       |
  116|      0|    CRYPTO_THREAD_cleanup_local(&key);
  117|      0|    return 0;
  118|      2|}
init.c:ossl_init_register_atexit:
  130|      2|{
  131|       |#ifdef OPENSSL_INIT_DEBUG
  132|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
  133|       |#endif
  134|      2|#ifndef OPENSSL_SYS_UEFI
  135|       |# ifdef _WIN32
  136|       |    /* We use _onexit() in preference because it gets called on DLL unload */
  137|       |    if (_onexit(win32atexit) == NULL)
  138|       |        return 0;
  139|       |# else
  140|      2|    if (atexit(OPENSSL_cleanup) != 0)
  ------------------
  |  Branch (140:9): [True: 0, False: 2]
  ------------------
  141|      0|        return 0;
  142|      2|# endif
  143|      2|#endif
  144|       |
  145|      2|    return 1;
  146|      2|}
init.c:ossl_init_load_crypto_nodelete:
  160|      2|{
  161|       |#ifdef OPENSSL_INIT_DEBUG
  162|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_load_crypto_nodelete()\n");
  163|       |#endif
  164|       |#if !defined(OPENSSL_USE_NODELETE) \
  165|       |    && !defined(OPENSSL_NO_PINSHARED)
  166|       |# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
  167|       |    {
  168|       |        HMODULE handle = NULL;
  169|       |        BOOL ret;
  170|       |
  171|       |        /* We don't use the DSO route for WIN32 because there is a better way */
  172|       |        ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
  173|       |                                | GET_MODULE_HANDLE_EX_FLAG_PIN,
  174|       |                                (void *)&base_inited, &handle);
  175|       |
  176|       |#  ifdef OPENSSL_INIT_DEBUG
  177|       |        fprintf(stderr, "OPENSSL_INIT: obtained DSO reference? %s\n",
  178|       |                (ret == TRUE ? "No!" : "Yes."));
  179|       |#  endif
  180|       |        return (ret == TRUE) ? 1 : 0;
  181|       |    }
  182|       |# elif !defined(DSO_NONE)
  183|       |    /*
  184|       |     * Deliberately leak a reference to ourselves. This will force the library
  185|       |     * to remain loaded until the atexit() handler is run at process exit.
  186|       |     */
  187|       |    {
  188|       |        DSO *dso;
  189|       |        void *err;
  190|       |
  191|       |        if (!err_shelve_state(&err))
  192|       |            return 0;
  193|       |
  194|       |        dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
  195|       |#  ifdef OPENSSL_INIT_DEBUG
  196|       |        fprintf(stderr, "OPENSSL_INIT: obtained DSO reference? %s\n",
  197|       |                (dso == NULL ? "No!" : "Yes."));
  198|       |        /*
  199|       |         * In case of No!, it is uncertain our exit()-handlers can still be
  200|       |         * called. After dlclose() the whole library might have been unloaded
  201|       |         * already.
  202|       |         */
  203|       |#  endif
  204|       |        DSO_free(dso);
  205|       |        err_unshelve_state(err);
  206|       |    }
  207|       |# endif
  208|       |#endif
  209|       |
  210|      2|    return 1;
  211|      2|}
init.c:ossl_init_load_crypto_strings:
  216|      2|{
  217|      2|    int ret = 1;
  218|       |    /*
  219|       |     * OPENSSL_NO_AUTOERRINIT is provided here to prevent at compile time
  220|       |     * pulling in all the error strings during static linking
  221|       |     */
  222|      2|#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
  223|       |# ifdef OPENSSL_INIT_DEBUG
  224|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_load_crypto_strings: "
  225|       |                    "err_load_crypto_strings_int()\n");
  226|       |# endif
  227|      2|    ret = err_load_crypto_strings_int();
  228|      2|#endif
  229|      2|    return ret;
  230|      2|}

ERR_load_KDF_strings:
   59|      2|{
   60|      2|#ifndef OPENSSL_NO_ERR
   61|      2|    if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (61:9): [True: 2, False: 0]
  ------------------
   62|      2|        ERR_load_strings_const(KDF_str_functs);
   63|      2|        ERR_load_strings_const(KDF_str_reasons);
   64|      2|    }
   65|      2|#endif
   66|      2|    return 1;
   67|      2|}

OPENSSL_LH_new:
   48|      2|{
   49|      2|    OPENSSL_LHASH *ret;
   50|       |
   51|      2|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  ------------------
  |  |  120|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (51:9): [True: 0, False: 2]
  ------------------
   52|       |        /*
   53|       |         * Do not set the error code, because the ERR code uses LHASH
   54|       |         * and we want to avoid possible endless error loop.
   55|       |         * CRYPTOerr(CRYPTO_F_OPENSSL_LH_NEW, ERR_R_MALLOC_FAILURE);
   56|       |         */
   57|      0|        return NULL;
   58|      0|    }
   59|      2|    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
  ------------------
  |  |  120|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (59:9): [True: 0, False: 2]
  ------------------
   60|      0|        goto err;
   61|      2|    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
  ------------------
  |  Branch (61:18): [True: 0, False: 2]
  ------------------
   62|      2|    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
  ------------------
  |  Branch (62:18): [True: 0, False: 2]
  ------------------
   63|      2|    ret->num_nodes = MIN_NODES / 2;
  ------------------
  |  |   39|      2|#define MIN_NODES       16
  ------------------
   64|      2|    ret->num_alloc_nodes = MIN_NODES;
  ------------------
  |  |   39|      2|#define MIN_NODES       16
  ------------------
   65|      2|    ret->pmax = MIN_NODES / 2;
  ------------------
  |  |   39|      2|#define MIN_NODES       16
  ------------------
   66|      2|    ret->up_load = UP_LOAD;
  ------------------
  |  |   40|      2|#define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
  |  |  ------------------
  |  |  |  |   70|      2|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   67|      2|    ret->down_load = DOWN_LOAD;
  ------------------
  |  |   41|      2|#define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
  |  |  ------------------
  |  |  |  |   70|      2|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   68|      2|    return ret;
   69|       |
   70|      0|err:
   71|      0|    OPENSSL_free(ret->b);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   72|      0|    OPENSSL_free(ret);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   73|      0|    return NULL;
   74|      2|}
OPENSSL_LH_free:
   77|      4|{
   78|      4|    unsigned int i;
   79|      4|    OPENSSL_LH_NODE *n, *nn;
   80|       |
   81|      4|    if (lh == NULL)
  ------------------
  |  Branch (81:9): [True: 2, False: 2]
  ------------------
   82|      2|        return;
   83|       |
   84|  2.43k|    for (i = 0; i < lh->num_nodes; i++) {
  ------------------
  |  Branch (84:17): [True: 2.43k, False: 2]
  ------------------
   85|  2.43k|        n = lh->b[i];
   86|  7.30k|        while (n != NULL) {
  ------------------
  |  Branch (86:16): [True: 4.87k, False: 2.43k]
  ------------------
   87|  4.87k|            nn = n->next;
   88|  4.87k|            OPENSSL_free(n);
  ------------------
  |  |  128|  4.87k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  4.87k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  4.87k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   89|  4.87k|            n = nn;
   90|  4.87k|        }
   91|  2.43k|    }
   92|      2|    OPENSSL_free(lh->b);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|      2|    OPENSSL_free(lh);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|      2|}
OPENSSL_LH_insert:
   97|  15.1k|{
   98|  15.1k|    unsigned long hash;
   99|  15.1k|    OPENSSL_LH_NODE *nn, **rn;
  100|  15.1k|    void *ret;
  101|       |
  102|  15.1k|    lh->error = 0;
  103|  15.1k|    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
  ------------------
  |  |   70|  15.1k|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (103:9): [True: 2.42k, False: 12.7k]
  |  Branch (103:76): [True: 0, False: 2.42k]
  ------------------
  104|      0|        return NULL;        /* 'lh->error++' already done in 'expand' */
  105|       |
  106|  15.1k|    rn = getrn(lh, data, &hash);
  107|       |
  108|  15.1k|    if (*rn == NULL) {
  ------------------
  |  Branch (108:9): [True: 4.87k, False: 10.3k]
  ------------------
  109|  4.87k|        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
  ------------------
  |  |  118|  4.87k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  4.87k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  4.87k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (109:13): [True: 0, False: 4.87k]
  ------------------
  110|      0|            lh->error++;
  111|      0|            return NULL;
  112|      0|        }
  113|  4.87k|        nn->data = data;
  114|  4.87k|        nn->next = NULL;
  115|  4.87k|        nn->hash = hash;
  116|  4.87k|        *rn = nn;
  117|  4.87k|        ret = NULL;
  118|  4.87k|        lh->num_insert++;
  119|  4.87k|        lh->num_items++;
  120|  10.3k|    } else {                    /* replace same key */
  121|  10.3k|        ret = (*rn)->data;
  122|  10.3k|        (*rn)->data = data;
  123|  10.3k|        lh->num_replace++;
  124|  10.3k|    }
  125|  15.1k|    return ret;
  126|  15.1k|}
OPENSSL_LH_retrieve:
  157|     58|{
  158|     58|    unsigned long hash;
  159|     58|    OPENSSL_LH_NODE **rn;
  160|     58|    void *ret;
  161|       |
  162|     58|    tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);
  ------------------
  |  |   58|     58|#  define tsan_store(ptr, val) atomic_store_explicit((ptr), (val), memory_order_relaxed)
  ------------------
  163|       |
  164|     58|    rn = getrn(lh, data, &hash);
  165|       |
  166|     58|    if (*rn == NULL) {
  ------------------
  |  Branch (166:9): [True: 58, False: 0]
  ------------------
  167|     58|        tsan_counter(&lh->num_retrieve_miss);
  ------------------
  |  |   59|     58|#  define tsan_counter(ptr) atomic_fetch_add_explicit((ptr), 1, memory_order_relaxed)
  ------------------
  168|     58|        return NULL;
  169|     58|    } else {
  170|      0|        ret = (*rn)->data;
  171|      0|        tsan_counter(&lh->num_retrieve);
  ------------------
  |  |   59|      0|#  define tsan_counter(ptr) atomic_fetch_add_explicit((ptr), 1, memory_order_relaxed)
  ------------------
  172|      0|    }
  173|       |
  174|      0|    return ret;
  175|     58|}
OPENSSL_LH_num_items:
  378|      2|{
  379|      2|    return lh ? lh->num_items : 0;
  ------------------
  |  Branch (379:12): [True: 0, False: 2]
  ------------------
  380|      2|}
lhash.c:expand:
  215|  2.42k|{
  216|  2.42k|    OPENSSL_LH_NODE **n, **n1, **n2, *np;
  217|  2.42k|    unsigned int p, pmax, nni, j;
  218|  2.42k|    unsigned long hash;
  219|       |
  220|  2.42k|    nni = lh->num_alloc_nodes;
  221|  2.42k|    p = lh->p;
  222|  2.42k|    pmax = lh->pmax;
  223|  2.42k|    if (p + 1 >= pmax) {
  ------------------
  |  Branch (223:9): [True: 14, False: 2.40k]
  ------------------
  224|     14|        j = nni * 2;
  225|     14|        n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
  ------------------
  |  |  122|     14|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|     14|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|     14|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  226|     14|        if (n == NULL) {
  ------------------
  |  Branch (226:13): [True: 0, False: 14]
  ------------------
  227|      0|            lh->error++;
  228|      0|            return 0;
  229|      0|        }
  230|     14|        lh->b = n;
  231|     14|        memset(n + nni, 0, sizeof(*n) * (j - nni));
  232|     14|        lh->pmax = nni;
  233|     14|        lh->num_alloc_nodes = j;
  234|     14|        lh->num_expand_reallocs++;
  235|     14|        lh->p = 0;
  236|  2.40k|    } else {
  237|  2.40k|        lh->p++;
  238|  2.40k|    }
  239|       |
  240|  2.42k|    lh->num_nodes++;
  241|  2.42k|    lh->num_expands++;
  242|  2.42k|    n1 = &(lh->b[p]);
  243|  2.42k|    n2 = &(lh->b[p + pmax]);
  244|  2.42k|    *n2 = NULL;
  245|       |
  246|  11.3k|    for (np = *n1; np != NULL;) {
  ------------------
  |  Branch (246:20): [True: 8.93k, False: 2.42k]
  ------------------
  247|  8.93k|        hash = np->hash;
  248|  8.93k|        if ((hash % nni) != p) { /* move it */
  ------------------
  |  Branch (248:13): [True: 704, False: 8.22k]
  ------------------
  249|    704|            *n1 = (*n1)->next;
  250|    704|            np->next = *n2;
  251|    704|            *n2 = np;
  252|    704|        } else
  253|  8.22k|            n1 = &((*n1)->next);
  254|  8.93k|        np = *n1;
  255|  8.93k|    }
  256|       |
  257|  2.42k|    return 1;
  258|  2.42k|}
lhash.c:getrn:
  297|  15.2k|{
  298|  15.2k|    OPENSSL_LH_NODE **ret, *n1;
  299|  15.2k|    unsigned long hash, nn;
  300|  15.2k|    OPENSSL_LH_COMPFUNC cf;
  301|       |
  302|  15.2k|    hash = (*(lh->hash)) (data);
  303|  15.2k|    tsan_counter(&lh->num_hash_calls);
  ------------------
  |  |   59|  15.2k|#  define tsan_counter(ptr) atomic_fetch_add_explicit((ptr), 1, memory_order_relaxed)
  ------------------
  304|  15.2k|    *rhash = hash;
  305|       |
  306|  15.2k|    nn = hash % lh->pmax;
  307|  15.2k|    if (nn < lh->p)
  ------------------
  |  Branch (307:9): [True: 8.94k, False: 6.30k]
  ------------------
  308|  8.94k|        nn = hash % lh->num_alloc_nodes;
  309|       |
  310|  15.2k|    cf = lh->comp;
  311|  15.2k|    ret = &(lh->b[(int)nn]);
  312|  44.6k|    for (n1 = *ret; n1 != NULL; n1 = n1->next) {
  ------------------
  |  Branch (312:21): [True: 39.6k, False: 4.92k]
  ------------------
  313|  39.6k|        tsan_counter(&lh->num_hash_comps);
  ------------------
  |  |   59|  39.6k|#  define tsan_counter(ptr) atomic_fetch_add_explicit((ptr), 1, memory_order_relaxed)
  ------------------
  314|  39.6k|        if (n1->hash != hash) {
  ------------------
  |  Branch (314:13): [True: 29.1k, False: 10.5k]
  ------------------
  315|  29.1k|            ret = &(n1->next);
  316|  29.1k|            continue;
  317|  29.1k|        }
  318|  39.6k|        tsan_counter(&lh->num_comp_calls);
  ------------------
  |  |   59|  39.6k|#  define tsan_counter(ptr) atomic_fetch_add_explicit((ptr), 1, memory_order_relaxed)
  ------------------
  319|  10.5k|        if (cf(n1->data, data) == 0)
  ------------------
  |  Branch (319:13): [True: 10.3k, False: 246]
  ------------------
  320|  10.3k|            break;
  321|    246|        ret = &(n1->next);
  322|    246|    }
  323|  15.2k|    return ret;
  324|  15.2k|}

CRYPTO_malloc:
  193|   391k|{
  194|   391k|    void *ret = NULL;
  195|       |
  196|   391k|    INCREMENT(malloc_count);
  197|   391k|    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
  ------------------
  |  Branch (197:9): [True: 391k, False: 0]
  |  Branch (197:32): [True: 0, False: 391k]
  ------------------
  198|      0|        return malloc_impl(num, file, line);
  199|       |
  200|   391k|    if (num == 0)
  ------------------
  |  Branch (200:9): [True: 0, False: 391k]
  ------------------
  201|      0|        return NULL;
  202|       |
  203|   391k|    FAILTEST();
  204|   391k|    if (allow_customize) {
  ------------------
  |  Branch (204:9): [True: 2, False: 391k]
  ------------------
  205|       |        /*
  206|       |         * Disallow customization after the first allocation. We only set this
  207|       |         * if necessary to avoid a store to the same cache line on every
  208|       |         * allocation.
  209|       |         */
  210|      2|        allow_customize = 0;
  211|      2|    }
  212|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
  213|       |    if (call_malloc_debug) {
  214|       |        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);
  215|       |        ret = malloc(num);
  216|       |        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);
  217|       |    } else {
  218|       |        ret = malloc(num);
  219|       |    }
  220|       |#else
  221|   391k|    (void)(file); (void)(line);
  222|   391k|    ret = malloc(num);
  223|   391k|#endif
  224|       |
  225|   391k|    return ret;
  226|   391k|}
CRYPTO_zalloc:
  229|   191k|{
  230|   191k|    void *ret = CRYPTO_malloc(num, file, line);
  231|       |
  232|   191k|    FAILTEST();
  233|   191k|    if (ret != NULL)
  ------------------
  |  Branch (233:9): [True: 191k, False: 0]
  ------------------
  234|   191k|        memset(ret, 0, num);
  235|   191k|    return ret;
  236|   191k|}
CRYPTO_realloc:
  239|  13.6k|{
  240|  13.6k|    INCREMENT(realloc_count);
  241|  13.6k|    if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
  ------------------
  |  Branch (241:9): [True: 13.6k, False: 0]
  |  Branch (241:33): [True: 0, False: 13.6k]
  ------------------
  242|      0|        return realloc_impl(str, num, file, line);
  243|       |
  244|  13.6k|    FAILTEST();
  245|  13.6k|    if (str == NULL)
  ------------------
  |  Branch (245:9): [True: 6.25k, False: 7.42k]
  ------------------
  246|  6.25k|        return CRYPTO_malloc(num, file, line);
  247|       |
  248|  7.42k|    if (num == 0) {
  ------------------
  |  Branch (248:9): [True: 0, False: 7.42k]
  ------------------
  249|      0|        CRYPTO_free(str, file, line);
  250|      0|        return NULL;
  251|      0|    }
  252|       |
  253|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
  254|       |    if (call_malloc_debug) {
  255|       |        void *ret;
  256|       |        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);
  257|       |        ret = realloc(str, num);
  258|       |        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);
  259|       |        return ret;
  260|       |    }
  261|       |#else
  262|  7.42k|    (void)(file); (void)(line);
  263|  7.42k|#endif
  264|  7.42k|    return realloc(str, num);
  265|       |
  266|  7.42k|}
CRYPTO_clear_realloc:
  270|  1.13k|{
  271|  1.13k|    void *ret = NULL;
  272|       |
  273|  1.13k|    if (str == NULL)
  ------------------
  |  Branch (273:9): [True: 323, False: 809]
  ------------------
  274|    323|        return CRYPTO_malloc(num, file, line);
  275|       |
  276|    809|    if (num == 0) {
  ------------------
  |  Branch (276:9): [True: 0, False: 809]
  ------------------
  277|      0|        CRYPTO_clear_free(str, old_len, file, line);
  278|      0|        return NULL;
  279|      0|    }
  280|       |
  281|       |    /* Can't shrink the buffer since memcpy below copies |old_len| bytes. */
  282|    809|    if (num < old_len) {
  ------------------
  |  Branch (282:9): [True: 0, False: 809]
  ------------------
  283|      0|        OPENSSL_cleanse((char*)str + num, old_len - num);
  284|      0|        return str;
  285|      0|    }
  286|       |
  287|    809|    ret = CRYPTO_malloc(num, file, line);
  288|    809|    if (ret != NULL) {
  ------------------
  |  Branch (288:9): [True: 809, False: 0]
  ------------------
  289|    809|        memcpy(ret, str, old_len);
  290|    809|        CRYPTO_clear_free(str, old_len, file, line);
  291|    809|    }
  292|    809|    return ret;
  293|    809|}
CRYPTO_free:
  296|   934k|{
  297|   934k|    INCREMENT(free_count);
  298|   934k|    if (free_impl != NULL && free_impl != &CRYPTO_free) {
  ------------------
  |  Branch (298:9): [True: 934k, False: 0]
  |  Branch (298:30): [True: 0, False: 934k]
  ------------------
  299|      0|        free_impl(str, file, line);
  300|      0|        return;
  301|      0|    }
  302|       |
  303|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
  304|       |    if (call_malloc_debug) {
  305|       |        CRYPTO_mem_debug_free(str, 0, file, line);
  306|       |        free(str);
  307|       |        CRYPTO_mem_debug_free(str, 1, file, line);
  308|       |    } else {
  309|       |        free(str);
  310|       |    }
  311|       |#else
  312|   934k|    free(str);
  313|   934k|#endif
  314|   934k|}
CRYPTO_clear_free:
  317|    809|{
  318|    809|    if (str == NULL)
  ------------------
  |  Branch (318:9): [True: 0, False: 809]
  ------------------
  319|      0|        return;
  320|    809|    if (num)
  ------------------
  |  Branch (320:9): [True: 809, False: 0]
  ------------------
  321|    809|        OPENSSL_cleanse(str, num);
  322|    809|    CRYPTO_free(str, file, line);
  323|    809|}

CRYPTO_secure_malloc_done:
   98|      2|{
   99|      2|#ifdef OPENSSL_SECURE_MEMORY
  100|      2|    if (secure_mem_used == 0) {
  ------------------
  |  Branch (100:9): [True: 2, False: 0]
  ------------------
  101|      2|        sh_done();
  102|      2|        secure_mem_initialized = 0;
  103|      2|        CRYPTO_THREAD_lock_free(sec_malloc_lock);
  104|      2|        sec_malloc_lock = NULL;
  105|      2|        return 1;
  106|      2|    }
  107|      0|#endif /* OPENSSL_SECURE_MEMORY */
  108|      0|    return 0;
  109|      2|}
mem_sec.c:sh_done:
  507|      2|{
  508|      2|    OPENSSL_free(sh.freelist);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  509|      2|    OPENSSL_free(sh.bittable);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  510|      2|    OPENSSL_free(sh.bitmalloc);
  ------------------
  |  |  128|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      2|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      2|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  511|      2|    if (sh.map_result != MAP_FAILED && sh.map_size)
  ------------------
  |  Branch (511:9): [True: 2, False: 0]
  |  Branch (511:40): [True: 0, False: 2]
  ------------------
  512|      0|        munmap(sh.map_result, sh.map_size);
  513|      2|    memset(&sh, 0, sizeof(sh));
  514|      2|}

CRYPTO_memdup:
   58|   186k|{
   59|   186k|    void *ret;
   60|       |
   61|   186k|    if (data == NULL || siz >= INT_MAX)
  ------------------
  |  Branch (61:9): [True: 0, False: 186k]
  |  Branch (61:25): [True: 0, False: 186k]
  ------------------
   62|      0|        return NULL;
   63|       |
   64|   186k|    ret = CRYPTO_malloc(siz, file, line);
   65|   186k|    if (ret == NULL) {
  ------------------
  |  Branch (65:9): [True: 0, False: 186k]
  ------------------
   66|      0|        CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  113|      0|# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
   67|      0|        return NULL;
   68|      0|    }
   69|   186k|    return memcpy(ret, data, siz);
   70|   186k|}
OPENSSL_strnlen:
   73|   906k|{
   74|   906k|    const char *p;
   75|       |
   76|  1.41M|    for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
  ------------------
  |  Branch (76:19): [True: 1.40M, False: 10.8k]
  |  Branch (76:36): [True: 508k, False: 895k]
  ------------------
   77|       |
   78|   906k|    return p - str;
   79|   906k|}
openssl_strerror_r:
  222|    254|{
  223|       |#if defined(_MSC_VER) && _MSC_VER>=1400 && !defined(_WIN32_WCE)
  224|       |    return !strerror_s(buf, buflen, errnum);
  225|       |#elif defined(_GNU_SOURCE)
  226|       |    char *err;
  227|       |
  228|       |    /*
  229|       |     * GNU strerror_r may not actually set buf.
  230|       |     * It can return a pointer to some (immutable) static string in which case
  231|       |     * buf is left unused.
  232|       |     */
  233|       |    err = strerror_r(errnum, buf, buflen);
  234|       |    if (err == NULL || buflen == 0)
  235|       |        return 0;
  236|       |    /*
  237|       |     * If err is statically allocated, err != buf and we need to copy the data.
  238|       |     * If err points somewhere inside buf, OPENSSL_strlcpy can handle this,
  239|       |     * since src and dest are not annotated with __restrict and the function
  240|       |     * reads src byte for byte and writes to dest.
  241|       |     * If err == buf we do not have to copy anything.
  242|       |     */
  243|       |    if (err != buf)
  244|       |        OPENSSL_strlcpy(buf, err, buflen);
  245|       |    return 1;
  246|       |#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
  247|       |      (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)
  248|       |    /*
  249|       |     * We can use "real" strerror_r. The OpenSSL version differs in that it
  250|       |     * gives 1 on success and 0 on failure for consistency with other OpenSSL
  251|       |     * functions. Real strerror_r does it the other way around
  252|       |     */
  253|    254|    return !strerror_r(errnum, buf, buflen);
  254|       |#else
  255|       |    char *err;
  256|       |
  257|       |    /* Fall back to non-thread safe strerror()...its all we can do */
  258|       |    if (buflen < 2)
  259|       |        return 0;
  260|       |    err = strerror(errnum);
  261|       |    /* Can this ever happen? */
  262|       |    if (err == NULL)
  263|       |        return 0;
  264|       |    OPENSSL_strlcpy(buf, err, buflen);
  265|       |    return 1;
  266|       |#endif
  267|    254|}

OPENSSL_gmtime:
   15|  8.64k|{
   16|  8.64k|    struct tm *ts = NULL;
   17|       |
   18|       |#if defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_VMS)
   19|       |    {
   20|       |        /*
   21|       |         * On VMS, gmtime_r() takes a 32-bit pointer as second argument.
   22|       |         * Since we can't know that |result| is in a space that can easily
   23|       |         * translate to a 32-bit pointer, we must store temporarily on stack
   24|       |         * and copy the result.  The stack is always reachable with 32-bit
   25|       |         * pointers.
   26|       |         */
   27|       |#if defined(OPENSSL_SYS_VMS) && __INITIAL_POINTER_SIZE
   28|       |# pragma pointer_size save
   29|       |# pragma pointer_size 32
   30|       |#endif
   31|       |        struct tm data, *ts2 = &data;
   32|       |#if defined OPENSSL_SYS_VMS && __INITIAL_POINTER_SIZE
   33|       |# pragma pointer_size restore
   34|       |#endif
   35|       |        if (gmtime_r(timer, ts2) == NULL)
   36|       |            return NULL;
   37|       |        memcpy(result, ts2, sizeof(struct tm));
   38|       |        ts = result;
   39|       |    }
   40|       |#elif defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_MACOSX)
   41|  8.64k|    if (gmtime_r(timer, result) == NULL)
  ------------------
  |  Branch (41:9): [True: 0, False: 8.64k]
  ------------------
   42|      0|        return NULL;
   43|  8.64k|    ts = result;
   44|       |#elif defined (OPENSSL_SYS_WINDOWS) && defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(_WIN32_WCE)
   45|       |    if (gmtime_s(result, timer))
   46|       |        return NULL;
   47|       |    ts = result;
   48|       |#else
   49|       |    ts = gmtime(timer);
   50|       |    if (ts == NULL)
   51|       |        return NULL;
   52|       |
   53|       |    memcpy(result, ts, sizeof(struct tm));
   54|       |    ts = result;
   55|       |#endif
   56|  8.64k|    return ts;
   57|  8.64k|}
OPENSSL_gmtime_adj:
   73|  7.86k|{
   74|  7.86k|    int time_sec, time_year, time_month, time_day;
   75|  7.86k|    long time_jd;
   76|       |
   77|       |    /* Convert time and offset into Julian day and seconds */
   78|  7.86k|    if (!julian_adj(tm, off_day, offset_sec, &time_jd, &time_sec))
  ------------------
  |  Branch (78:9): [True: 1.26k, False: 6.59k]
  ------------------
   79|  1.26k|        return 0;
   80|       |
   81|       |    /* Convert Julian day back to date */
   82|       |
   83|  6.59k|    julian_to_date(time_jd, &time_year, &time_month, &time_day);
   84|       |
   85|  6.59k|    if (time_year < 1900 || time_year > 9999)
  ------------------
  |  Branch (85:9): [True: 108, False: 6.48k]
  |  Branch (85:29): [True: 1.84k, False: 4.64k]
  ------------------
   86|  1.94k|        return 0;
   87|       |
   88|       |    /* Update tm structure */
   89|       |
   90|  4.64k|    tm->tm_year = time_year - 1900;
   91|  4.64k|    tm->tm_mon = time_month - 1;
   92|  4.64k|    tm->tm_mday = time_day;
   93|       |
   94|  4.64k|    tm->tm_hour = time_sec / 3600;
   95|  4.64k|    tm->tm_min = (time_sec / 60) % 60;
   96|  4.64k|    tm->tm_sec = time_sec % 60;
   97|       |
   98|  4.64k|    return 1;
   99|       |
  100|  6.59k|}
o_time.c:julian_adj:
  135|  7.86k|{
  136|  7.86k|    int offset_hms;
  137|  7.86k|    long offset_day, time_jd;
  138|  7.86k|    int time_year, time_month, time_day;
  139|       |    /* split offset into days and day seconds */
  140|  7.86k|    offset_day = offset_sec / SECS_PER_DAY;
  ------------------
  |  |   65|  7.86k|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  141|       |    /* Avoid sign issues with % operator */
  142|  7.86k|    offset_hms = offset_sec - (offset_day * SECS_PER_DAY);
  ------------------
  |  |   65|  7.86k|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  143|  7.86k|    offset_day += off_day;
  144|       |    /* Add current time seconds to offset */
  145|  7.86k|    offset_hms += tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
  146|       |    /* Adjust day seconds if overflow */
  147|  7.86k|    if (offset_hms >= SECS_PER_DAY) {
  ------------------
  |  |   65|  7.86k|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  |  Branch (147:9): [True: 0, False: 7.86k]
  ------------------
  148|      0|        offset_day++;
  149|      0|        offset_hms -= SECS_PER_DAY;
  ------------------
  |  |   65|      0|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  150|  7.86k|    } else if (offset_hms < 0) {
  ------------------
  |  Branch (150:16): [True: 0, False: 7.86k]
  ------------------
  151|      0|        offset_day--;
  152|      0|        offset_hms += SECS_PER_DAY;
  ------------------
  |  |   65|      0|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  153|      0|    }
  154|       |
  155|       |    /*
  156|       |     * Convert date of time structure into a Julian day number.
  157|       |     */
  158|       |
  159|  7.86k|    time_year = tm->tm_year + 1900;
  160|  7.86k|    time_month = tm->tm_mon + 1;
  161|  7.86k|    time_day = tm->tm_mday;
  162|       |
  163|  7.86k|    time_jd = date_to_julian(time_year, time_month, time_day);
  164|       |
  165|       |    /* Work out Julian day of new date */
  166|  7.86k|    time_jd += offset_day;
  167|       |
  168|  7.86k|    if (time_jd < 0)
  ------------------
  |  Branch (168:9): [True: 1.26k, False: 6.59k]
  ------------------
  169|  1.26k|        return 0;
  170|       |
  171|  6.59k|    *pday = time_jd;
  172|  6.59k|    *psec = offset_hms;
  173|  6.59k|    return 1;
  174|  7.86k|}
o_time.c:date_to_julian:
  180|  7.86k|{
  181|  7.86k|    return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +
  182|  7.86k|        (367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -
  183|  7.86k|        (3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 + d - 32075;
  184|  7.86k|}
o_time.c:julian_to_date:
  187|  6.59k|{
  188|  6.59k|    long L = jd + 68569;
  189|  6.59k|    long n = (4 * L) / 146097;
  190|  6.59k|    long i, j;
  191|       |
  192|  6.59k|    L = L - (146097 * n + 3) / 4;
  193|  6.59k|    i = (4000 * (L + 1)) / 1461001;
  194|  6.59k|    L = L - (1461 * i) / 4 + 31;
  195|  6.59k|    j = (80 * L) / 2447;
  196|  6.59k|    *d = L - (2447 * j) / 80;
  197|  6.59k|    L = j / 11;
  198|  6.59k|    *m = j + 2 - (12 * L);
  199|  6.59k|    *y = 100 * (n - 49) + i + L;
  200|  6.59k|}

OBJ_NAME_cleanup:
  390|      6|{
  391|      6|    unsigned long down_load;
  392|       |
  393|      6|    if (names_lh == NULL)
  ------------------
  |  Branch (393:9): [True: 6, False: 0]
  ------------------
  394|      6|        return;
  395|       |
  396|      0|    free_type = type;
  397|      0|    down_load = lh_OBJ_NAME_get_down_load(names_lh);
  398|      0|    lh_OBJ_NAME_set_down_load(names_lh, 0);
  399|       |
  400|      0|    lh_OBJ_NAME_doall(names_lh, names_lh_free_doall);
  401|      0|    if (type < 0) {
  ------------------
  |  Branch (401:9): [True: 0, False: 0]
  ------------------
  402|      0|        lh_OBJ_NAME_free(names_lh);
  403|      0|        sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
  404|      0|        CRYPTO_THREAD_lock_free(obj_lock);
  405|      0|        names_lh = NULL;
  406|      0|        name_funcs_stack = NULL;
  407|      0|        obj_lock = NULL;
  408|      0|    } else
  409|      0|        lh_OBJ_NAME_set_down_load(names_lh, down_load);
  410|      0|}

obj_cleanup_int:
  154|      2|{
  155|      2|    if (added == NULL)
  ------------------
  |  Branch (155:9): [True: 2, False: 0]
  ------------------
  156|      2|        return;
  157|      0|    lh_ADDED_OBJ_set_down_load(added, 0);
  158|      0|    lh_ADDED_OBJ_doall(added, cleanup1_doall); /* zero counters */
  159|      0|    lh_ADDED_OBJ_doall(added, cleanup2_doall); /* set counters */
  160|      0|    lh_ADDED_OBJ_doall(added, cleanup3_doall); /* free objects */
  161|      0|    lh_ADDED_OBJ_free(added);
  162|      0|    added = NULL;
  163|      0|}
OBJ_nid2ln:
  276|  8.64k|{
  277|  8.64k|    ADDED_OBJ ad, *adp;
  278|  8.64k|    ASN1_OBJECT ob;
  279|       |
  280|  8.64k|    if ((n >= 0) && (n < NUM_NID)) {
  ------------------
  |  | 1081|  8.64k|#define NUM_NID 1195
  ------------------
  |  Branch (280:9): [True: 8.64k, False: 0]
  |  Branch (280:21): [True: 8.64k, False: 0]
  ------------------
  281|  8.64k|        if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
  ------------------
  |  |   14|  8.64k|#define NID_undef                       0
  ------------------
                      if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
  ------------------
  |  |   14|  8.64k|#define NID_undef                       0
  ------------------
  |  Branch (281:13): [True: 8.64k, False: 0]
  |  Branch (281:33): [True: 0, False: 8.64k]
  ------------------
  282|      0|            OBJerr(OBJ_F_OBJ_NID2LN, OBJ_R_UNKNOWN_NID);
  ------------------
  |  |  107|      0|# define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  283|      0|            return NULL;
  284|      0|        }
  285|  8.64k|        return nid_objs[n].ln;
  286|  8.64k|    } else if (added == NULL)
  ------------------
  |  Branch (286:16): [True: 0, False: 0]
  ------------------
  287|      0|        return NULL;
  288|      0|    else {
  289|      0|        ad.type = ADDED_NID;
  ------------------
  |  |   31|      0|#define ADDED_NID       3
  ------------------
  290|      0|        ad.obj = &ob;
  291|      0|        ob.nid = n;
  292|      0|        adp = lh_ADDED_OBJ_retrieve(added, &ad);
  293|      0|        if (adp != NULL)
  ------------------
  |  Branch (293:13): [True: 0, False: 0]
  ------------------
  294|      0|            return adp->obj->ln;
  295|      0|        else {
  296|      0|            OBJerr(OBJ_F_OBJ_NID2LN, OBJ_R_UNKNOWN_NID);
  ------------------
  |  |  107|      0|# define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  297|      0|            return NULL;
  298|      0|        }
  299|      0|    }
  300|  8.64k|}

ERR_load_OBJ_strings:
   38|      2|{
   39|      2|#ifndef OPENSSL_NO_ERR
   40|      2|    if (ERR_func_error_string(OBJ_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (40:9): [True: 2, False: 0]
  ------------------
   41|      2|        ERR_load_strings_const(OBJ_str_functs);
   42|      2|        ERR_load_strings_const(OBJ_str_reasons);
   43|      2|    }
   44|      2|#endif
   45|      2|    return 1;
   46|      2|}

OBJ_sigid_free:
  134|      2|{
  135|      2|    sk_nid_triple_pop_free(sig_app, sid_free);
  136|      2|    sig_app = NULL;
  137|      2|    sk_nid_triple_free(sigx_app);
  138|      2|    sigx_app = NULL;
  139|      2|}

ERR_load_OCSP_strings:
   93|      2|{
   94|      2|#ifndef OPENSSL_NO_ERR
   95|      2|    if (ERR_func_error_string(OCSP_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (95:9): [True: 2, False: 0]
  ------------------
   96|      2|        ERR_load_strings_const(OCSP_str_functs);
   97|      2|        ERR_load_strings_const(OCSP_str_reasons);
   98|      2|    }
   99|      2|#endif
  100|      2|    return 1;
  101|      2|}

ERR_load_PEM_strings:
  122|      2|{
  123|      2|#ifndef OPENSSL_NO_ERR
  124|      2|    if (ERR_func_error_string(PEM_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (124:9): [True: 2, False: 0]
  ------------------
  125|      2|        ERR_load_strings_const(PEM_str_functs);
  126|      2|        ERR_load_strings_const(PEM_str_reasons);
  127|      2|    }
  128|      2|#endif
  129|      2|    return 1;
  130|      2|}

ERR_load_PKCS12_strings:
  109|      2|{
  110|      2|#ifndef OPENSSL_NO_ERR
  111|      2|    if (ERR_func_error_string(PKCS12_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (111:9): [True: 2, False: 0]
  ------------------
  112|      2|        ERR_load_strings_const(PKCS12_str_functs);
  113|      2|        ERR_load_strings_const(PKCS12_str_reasons);
  114|      2|    }
  115|      2|#endif
  116|      2|    return 1;
  117|      2|}

ERR_load_PKCS7_strings:
  148|      2|{
  149|      2|#ifndef OPENSSL_NO_ERR
  150|      2|    if (ERR_func_error_string(PKCS7_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (150:9): [True: 2, False: 0]
  ------------------
  151|      2|        ERR_load_strings_const(PKCS7_str_functs);
  152|      2|        ERR_load_strings_const(PKCS7_str_reasons);
  153|      2|    }
  154|      2|#endif
  155|      2|    return 1;
  156|      2|}

rand_drbg_cleanup_int:
  925|      2|{
  926|      2|    if (master_drbg != NULL) {
  ------------------
  |  Branch (926:9): [True: 0, False: 2]
  ------------------
  927|      0|        RAND_DRBG_free(master_drbg);
  928|      0|        master_drbg = NULL;
  929|       |
  930|      0|        CRYPTO_THREAD_cleanup_local(&private_drbg);
  931|      0|        CRYPTO_THREAD_cleanup_local(&public_drbg);
  932|      0|    }
  933|      2|}

ERR_load_RAND_strings:
  131|      2|{
  132|      2|#ifndef OPENSSL_NO_ERR
  133|      2|    if (ERR_func_error_string(RAND_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (133:9): [True: 2, False: 0]
  ------------------
  134|      2|        ERR_load_strings_const(RAND_str_functs);
  135|      2|        ERR_load_strings_const(RAND_str_reasons);
  136|      2|    }
  137|      2|#endif
  138|      2|    return 1;
  139|      2|}

rand_cleanup_int:
  345|      2|{
  346|      2|    const RAND_METHOD *meth = default_RAND_meth;
  347|       |
  348|      2|    if (!rand_inited)
  ------------------
  |  Branch (348:9): [True: 2, False: 0]
  ------------------
  349|      2|        return;
  350|       |
  351|      0|    if (meth != NULL && meth->cleanup != NULL)
  ------------------
  |  Branch (351:9): [True: 0, False: 0]
  |  Branch (351:25): [True: 0, False: 0]
  ------------------
  352|      0|        meth->cleanup();
  353|      0|    RAND_set_rand_method(NULL);
  354|      0|    rand_pool_cleanup();
  355|      0|#ifndef OPENSSL_NO_ENGINE
  356|      0|    CRYPTO_THREAD_lock_free(rand_engine_lock);
  357|      0|    rand_engine_lock = NULL;
  358|      0|#endif
  359|      0|    CRYPTO_THREAD_lock_free(rand_meth_lock);
  360|      0|    rand_meth_lock = NULL;
  361|      0|    CRYPTO_THREAD_lock_free(rand_nonce_lock);
  362|      0|    rand_nonce_lock = NULL;
  363|      0|    rand_inited = 0;
  364|      0|}

ERR_load_RSA_strings:
  240|      2|{
  241|      2|#ifndef OPENSSL_NO_ERR
  242|      2|    if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (242:9): [True: 2, False: 0]
  ------------------
  243|      2|        ERR_load_strings_const(RSA_str_functs);
  244|      2|        ERR_load_strings_const(RSA_str_reasons);
  245|      2|    }
  246|      2|#endif
  247|      2|    return 1;
  248|      2|}

OPENSSL_sk_new_null:
  117|    797|{
  118|    797|    return OPENSSL_sk_new_reserve(NULL, 0);
  119|    797|}
OPENSSL_sk_new_reserve:
  208|    797|{
  209|    797|    OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK));
  ------------------
  |  |  120|    797|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    797|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    797|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  210|       |
  211|    797|    if (st == NULL)
  ------------------
  |  Branch (211:9): [True: 0, False: 797]
  ------------------
  212|      0|        return NULL;
  213|       |
  214|    797|    st->comp = c;
  215|       |
  216|    797|    if (n <= 0)
  ------------------
  |  Branch (216:9): [True: 797, False: 0]
  ------------------
  217|    797|        return st;
  218|       |
  219|      0|    if (!sk_reserve(st, n, 1)) {
  ------------------
  |  Branch (219:9): [True: 0, False: 0]
  ------------------
  220|      0|        OPENSSL_sk_free(st);
  221|      0|        return NULL;
  222|      0|    }
  223|       |
  224|      0|    return st;
  225|      0|}
OPENSSL_sk_insert:
  238|   178k|{
  239|   178k|    if (st == NULL || st->num == max_nodes)
  ------------------
  |  Branch (239:9): [True: 0, False: 178k]
  |  Branch (239:23): [True: 0, False: 178k]
  ------------------
  240|      0|        return 0;
  241|       |
  242|   178k|    if (!sk_reserve(st, 1, 0))
  ------------------
  |  Branch (242:9): [True: 0, False: 178k]
  ------------------
  243|      0|        return 0;
  244|       |
  245|   178k|    if ((loc >= st->num) || (loc < 0)) {
  ------------------
  |  Branch (245:9): [True: 178k, False: 0]
  |  Branch (245:29): [True: 0, False: 0]
  ------------------
  246|   178k|        st->data[st->num] = data;
  247|   178k|    } else {
  248|      0|        memmove(&st->data[loc + 1], &st->data[loc],
  249|      0|                sizeof(st->data[0]) * (st->num - loc));
  250|      0|        st->data[loc] = data;
  251|      0|    }
  252|   178k|    st->num++;
  253|   178k|    st->sorted = 0;
  254|   178k|    return st->num;
  255|   178k|}
OPENSSL_sk_push:
  327|   178k|{
  328|   178k|    if (st == NULL)
  ------------------
  |  Branch (328:9): [True: 0, False: 178k]
  ------------------
  329|      0|        return -1;
  330|   178k|    return OPENSSL_sk_insert(st, data, st->num);
  331|   178k|}
OPENSSL_sk_pop_free:
  361|    833|{
  362|    833|    int i;
  363|       |
  364|    833|    if (st == NULL)
  ------------------
  |  Branch (364:9): [True: 36, False: 797]
  ------------------
  365|     36|        return;
  366|   179k|    for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (366:17): [True: 178k, False: 797]
  ------------------
  367|   178k|        if (st->data[i] != NULL)
  ------------------
  |  Branch (367:13): [True: 178k, False: 0]
  ------------------
  368|   178k|            func((char *)st->data[i]);
  369|    797|    OPENSSL_sk_free(st);
  370|    797|}
OPENSSL_sk_free:
  373|  1.40k|{
  374|  1.40k|    if (st == NULL)
  ------------------
  |  Branch (374:9): [True: 610, False: 797]
  ------------------
  375|    610|        return;
  376|    797|    OPENSSL_free(st->data);
  ------------------
  |  |  128|    797|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    797|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    797|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  377|    797|    OPENSSL_free(st);
  ------------------
  |  |  128|    797|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    797|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    797|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  378|    797|}
OPENSSL_sk_num:
  381|   440k|{
  382|   440k|    return st == NULL ? -1 : st->num;
  ------------------
  |  Branch (382:12): [True: 1.21k, False: 439k]
  ------------------
  383|   440k|}
OPENSSL_sk_value:
  386|   438k|{
  387|   438k|    if (st == NULL || i < 0 || i >= st->num)
  ------------------
  |  Branch (387:9): [True: 0, False: 438k]
  |  Branch (387:23): [True: 0, False: 438k]
  |  Branch (387:32): [True: 0, False: 438k]
  ------------------
  388|      0|        return NULL;
  389|   438k|    return (void *)st->data[i];
  390|   438k|}
stack.c:sk_reserve:
  161|   178k|{
  162|   178k|    const void **tmpdata;
  163|   178k|    int num_alloc;
  164|       |
  165|       |    /* Check to see the reservation isn't exceeding the hard limit */
  166|   178k|    if (n > max_nodes - st->num)
  ------------------
  |  Branch (166:9): [True: 0, False: 178k]
  ------------------
  167|      0|        return 0;
  168|       |
  169|       |    /* Figure out the new size */
  170|   178k|    num_alloc = st->num + n;
  171|   178k|    if (num_alloc < min_nodes)
  ------------------
  |  Branch (171:9): [True: 1.35k, False: 177k]
  ------------------
  172|  1.35k|        num_alloc = min_nodes;
  173|       |
  174|       |    /* If |st->data| allocation was postponed */
  175|   178k|    if (st->data == NULL) {
  ------------------
  |  Branch (175:9): [True: 672, False: 178k]
  ------------------
  176|       |        /*
  177|       |         * At this point, |st->num_alloc| and |st->num| are 0;
  178|       |         * so |num_alloc| value is |n| or |min_nodes| if greater than |n|.
  179|       |         */
  180|    672|        if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL) {
  ------------------
  |  |  120|    672|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    672|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    672|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (180:13): [True: 0, False: 672]
  ------------------
  181|      0|            CRYPTOerr(CRYPTO_F_SK_RESERVE, ERR_R_MALLOC_FAILURE);
  ------------------
  |  |  113|      0|# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |   29|      0|#  define ERR_PUT_error(a,b,c,d,e)        ERR_put_error(a,b,c,d,e)
  |  |  ------------------
  ------------------
  182|      0|            return 0;
  183|      0|        }
  184|    672|        st->num_alloc = num_alloc;
  185|    672|        return 1;
  186|    672|    }
  187|       |
  188|   178k|    if (!exact) {
  ------------------
  |  Branch (188:9): [True: 178k, False: 0]
  ------------------
  189|   178k|        if (num_alloc <= st->num_alloc)
  ------------------
  |  Branch (189:13): [True: 176k, False: 1.98k]
  ------------------
  190|   176k|            return 1;
  191|  1.98k|        num_alloc = compute_growth(num_alloc, st->num_alloc);
  192|  1.98k|        if (num_alloc == 0)
  ------------------
  |  Branch (192:13): [True: 0, False: 1.98k]
  ------------------
  193|      0|            return 0;
  194|  1.98k|    } else if (num_alloc == st->num_alloc) {
  ------------------
  |  Branch (194:16): [True: 0, False: 0]
  ------------------
  195|      0|        return 1;
  196|      0|    }
  197|       |
  198|  1.98k|    tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
  ------------------
  |  |  122|  1.98k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|  1.98k|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|  1.98k|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  199|  1.98k|    if (tmpdata == NULL)
  ------------------
  |  Branch (199:9): [True: 0, False: 1.98k]
  ------------------
  200|      0|        return 0;
  201|       |
  202|  1.98k|    st->data = tmpdata;
  203|  1.98k|    st->num_alloc = num_alloc;
  204|  1.98k|    return 1;
  205|  1.98k|}
stack.c:compute_growth:
  145|  1.98k|{
  146|  1.98k|    const int limit = (max_nodes / 3) * 2 + (max_nodes % 3 ? 1 : 0);
  ------------------
  |  Branch (146:46): [Folded - Ignored]
  ------------------
  147|       |
  148|  3.96k|    while (current < target) {
  ------------------
  |  Branch (148:12): [True: 1.98k, False: 1.98k]
  ------------------
  149|       |        /* Check to see if we're at the hard limit */
  150|  1.98k|        if (current >= max_nodes)
  ------------------
  |  Branch (150:13): [True: 0, False: 1.98k]
  ------------------
  151|      0|            return 0;
  152|       |
  153|       |        /* Expand the size by a factor of 3/2 if it is within range */
  154|  1.98k|        current = current < limit ? current + current / 2 : max_nodes;
  ------------------
  |  Branch (154:19): [True: 1.98k, False: 0]
  ------------------
  155|  1.98k|    }
  156|  1.98k|    return current;
  157|  1.98k|}

ERR_load_OSSL_STORE_strings:
  138|      2|{
  139|      2|#ifndef OPENSSL_NO_ERR
  140|      2|    if (ERR_func_error_string(OSSL_STORE_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (140:9): [True: 2, False: 0]
  ------------------
  141|      2|        ERR_load_strings_const(OSSL_STORE_str_functs);
  142|      2|        ERR_load_strings_const(OSSL_STORE_str_reasons);
  143|      2|    }
  144|      2|#endif
  145|      2|    return 1;
  146|      2|}

ossl_store_cleanup_int:
   31|      2|{
   32|      2|    ossl_store_destroy_loaders_int();
   33|      2|}

ossl_store_destroy_loaders_int:
  278|      2|{
  279|      2|    assert(lh_OSSL_STORE_LOADER_num_items(loader_register) == 0);
  280|      2|    lh_OSSL_STORE_LOADER_free(loader_register);
  281|      2|    loader_register = NULL;
  282|      2|    CRYPTO_THREAD_lock_free(registry_lock);
  283|      2|    registry_lock = NULL;
  284|      2|}

CRYPTO_THREAD_lock_new:
   25|    610|{
   26|    610|# ifdef USE_RWLOCK
   27|    610|    CRYPTO_RWLOCK *lock;
   28|       |
   29|    610|    if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL) {
  ------------------
  |  |  120|    610|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    610|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    610|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (29:9): [True: 0, False: 610]
  ------------------
   30|       |        /* Don't set error, to avoid recursion blowup. */
   31|      0|        return NULL;
   32|      0|    }
   33|       |
   34|    610|    if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (34:9): [True: 0, False: 610]
  ------------------
   35|      0|        OPENSSL_free(lock);
  ------------------
  |  |  128|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|      0|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|      0|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   36|      0|        return NULL;
   37|      0|    }
   38|       |# else
   39|       |    pthread_mutexattr_t attr;
   40|       |    CRYPTO_RWLOCK *lock;
   41|       |
   42|       |    if ((lock = OPENSSL_zalloc(sizeof(pthread_mutex_t))) == NULL) {
   43|       |        /* Don't set error, to avoid recursion blowup. */
   44|       |        return NULL;
   45|       |    }
   46|       |
   47|       |    pthread_mutexattr_init(&attr);
   48|       |    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   49|       |
   50|       |    if (pthread_mutex_init(lock, &attr) != 0) {
   51|       |        pthread_mutexattr_destroy(&attr);
   52|       |        OPENSSL_free(lock);
   53|       |        return NULL;
   54|       |    }
   55|       |
   56|       |    pthread_mutexattr_destroy(&attr);
   57|       |# endif
   58|       |
   59|    610|    return lock;
   60|    610|}
CRYPTO_THREAD_read_lock:
   63|     58|{
   64|     58|# ifdef USE_RWLOCK
   65|     58|    if (pthread_rwlock_rdlock(lock) != 0)
  ------------------
  |  Branch (65:9): [True: 0, False: 58]
  ------------------
   66|      0|        return 0;
   67|       |# else
   68|       |    if (pthread_mutex_lock(lock) != 0)
   69|       |        return 0;
   70|       |# endif
   71|       |
   72|     58|    return 1;
   73|     58|}
CRYPTO_THREAD_write_lock:
   76|  1.80k|{
   77|  1.80k|# ifdef USE_RWLOCK
   78|  1.80k|    if (pthread_rwlock_wrlock(lock) != 0)
  ------------------
  |  Branch (78:9): [True: 0, False: 1.80k]
  ------------------
   79|      0|        return 0;
   80|       |# else
   81|       |    if (pthread_mutex_lock(lock) != 0)
   82|       |        return 0;
   83|       |# endif
   84|       |
   85|  1.80k|    return 1;
   86|  1.80k|}
CRYPTO_THREAD_unlock:
   89|  1.85k|{
   90|  1.85k|# ifdef USE_RWLOCK
   91|  1.85k|    if (pthread_rwlock_unlock(lock) != 0)
  ------------------
  |  Branch (91:9): [True: 0, False: 1.85k]
  ------------------
   92|      0|        return 0;
   93|       |# else
   94|       |    if (pthread_mutex_unlock(lock) != 0)
   95|       |        return 0;
   96|       |# endif
   97|       |
   98|  1.85k|    return 1;
   99|  1.85k|}
CRYPTO_THREAD_lock_free:
  102|    620|{
  103|    620|    if (lock == NULL)
  ------------------
  |  Branch (103:9): [True: 10, False: 610]
  ------------------
  104|     10|        return;
  105|       |
  106|    610|# ifdef USE_RWLOCK
  107|    610|    pthread_rwlock_destroy(lock);
  108|       |# else
  109|       |    pthread_mutex_destroy(lock);
  110|       |# endif
  111|    610|    OPENSSL_free(lock);
  ------------------
  |  |  128|    610|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    610|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    610|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  112|       |
  113|    610|    return;
  114|    620|}
CRYPTO_THREAD_run_once:
  117|  9.27k|{
  118|  9.27k|    if (pthread_once(once, init) != 0)
  ------------------
  |  Branch (118:9): [True: 0, False: 9.27k]
  ------------------
  119|      0|        return 0;
  120|       |
  121|  9.27k|    return 1;
  122|  9.27k|}
CRYPTO_THREAD_init_local:
  125|      4|{
  126|      4|    if (pthread_key_create(key, cleanup) != 0)
  ------------------
  |  Branch (126:9): [True: 0, False: 4]
  ------------------
  127|      0|        return 0;
  128|       |
  129|      4|    return 1;
  130|      4|}
CRYPTO_THREAD_get_local:
  133|  3.93k|{
  134|  3.93k|    return pthread_getspecific(*key);
  135|  3.93k|}
CRYPTO_THREAD_set_local:
  138|     10|{
  139|     10|    if (pthread_setspecific(*key, val) != 0)
  ------------------
  |  Branch (139:9): [True: 0, False: 10]
  ------------------
  140|      0|        return 0;
  141|       |
  142|     10|    return 1;
  143|     10|}
CRYPTO_THREAD_cleanup_local:
  146|      4|{
  147|      4|    if (pthread_key_delete(*key) != 0)
  ------------------
  |  Branch (147:9): [True: 0, False: 4]
  ------------------
  148|      0|        return 0;
  149|       |
  150|      4|    return 1;
  151|      4|}

ERR_load_TS_strings:
  176|      2|{
  177|      2|#ifndef OPENSSL_NO_ERR
  178|      2|    if (ERR_func_error_string(TS_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (178:9): [True: 2, False: 0]
  ------------------
  179|      2|        ERR_load_strings_const(TS_str_functs);
  180|      2|        ERR_load_strings_const(TS_str_reasons);
  181|      2|    }
  182|      2|#endif
  183|      2|    return 1;
  184|      2|}

ERR_load_UI_strings:
   70|      2|{
   71|      2|#ifndef OPENSSL_NO_ERR
   72|      2|    if (ERR_func_error_string(UI_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (72:9): [True: 2, False: 0]
  ------------------
   73|      2|        ERR_load_strings_const(UI_str_functs);
   74|      2|        ERR_load_strings_const(UI_str_reasons);
   75|      2|    }
   76|      2|#endif
   77|      2|    return 1;
   78|      2|}

ERR_load_X509_strings:
  176|      2|{
  177|      2|#ifndef OPENSSL_NO_ERR
  178|      2|    if (ERR_func_error_string(X509_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (178:9): [True: 2, False: 0]
  ------------------
  179|      2|        ERR_load_strings_const(X509_str_functs);
  180|      2|        ERR_load_strings_const(X509_str_reasons);
  181|      2|    }
  182|      2|#endif
  183|      2|    return 1;
  184|      2|}

ERR_load_X509V3_strings:
  253|      2|{
  254|      2|#ifndef OPENSSL_NO_ERR
  255|      2|    if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) {
  ------------------
  |  Branch (255:9): [True: 2, False: 0]
  ------------------
  256|      2|        ERR_load_strings_const(X509V3_str_functs);
  257|      2|        ERR_load_strings_const(X509V3_str_reasons);
  258|      2|    }
  259|      2|#endif
  260|      2|    return 1;
  261|      2|}

FuzzerInitialize:
   21|      2|{
   22|      2|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  357|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
   23|      2|    CRYPTO_free_ex_index(0, -1);
   24|      2|    ERR_get_state();
   25|      2|    return 1;
   26|      2|}
FuzzerTestOneInput:
   29|  1.62k|{
   30|  1.62k|    const uint8_t **pp = &buf;
   31|  1.62k|    unsigned char *der = NULL;
   32|  1.62k|    STACK_OF(SCT) *scts = d2i_SCT_LIST(NULL, pp, len);
  ------------------
  |  |   20|  1.62k|# define STACK_OF(type) struct stack_st_##type
  ------------------
   33|  1.62k|    if (scts != NULL) {
  ------------------
  |  Branch (33:9): [True: 604, False: 1.01k]
  ------------------
   34|    604|        BIO *bio = BIO_new(BIO_s_null());
   35|    604|        SCT_LIST_print(scts, bio, 4, "\n", NULL);
   36|    604|        BIO_free(bio);
   37|       |
   38|    604|        if (i2d_SCT_LIST(scts, &der)) {
  ------------------
  |  Branch (38:13): [True: 604, False: 0]
  ------------------
   39|       |            /* Silence unused result warning */
   40|    604|        }
   41|    604|        OPENSSL_free(der);
  ------------------
  |  |  128|    604|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  109|    604|#  define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  110|    604|#  define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   42|       |
   43|    604|        SCT_LIST_free(scts);
   44|    604|    }
   45|  1.62k|    ERR_clear_error();
   46|  1.62k|    return 0;
   47|  1.62k|}

LLVMFuzzerInitialize:
   22|      2|{
   23|      2|    return FuzzerInitialize(argc, argv);
   24|      2|}
LLVMFuzzerTestOneInput:
   27|  1.62k|{
   28|  1.62k|    return FuzzerTestOneInput(buf, len);
   29|  1.62k|}

b_print.c:ossl_assert_int:
   33|  66.7M|{
   34|  66.7M|    if (!expr)
  ------------------
  |  Branch (34:9): [True: 0, False: 66.7M]
  ------------------
   35|      0|        OPENSSL_die(exprstr, file, line);
   36|       |
   37|  66.7M|    return expr;
   38|  66.7M|}

bio_lib.c:CRYPTO_DOWN_REF:
   49|    604|{
   50|    604|    *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
   51|    604|    if (*ret == 0)
  ------------------
  |  Branch (51:9): [True: 604, False: 0]
  ------------------
   52|    604|        atomic_thread_fence(memory_order_acquire);
   53|    604|    return 1;
   54|    604|}

err.c:do_err_strings_init_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \
err.c:err_do_init_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \
ex_data.c:do_ex_data_init_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \
init.c:ossl_init_base_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \
init.c:ossl_init_register_atexit_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \
init.c:ossl_init_load_crypto_nodelete_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \
init.c:ossl_init_load_crypto_strings_ossl_:
   62|      2|    {                                           \
   63|      2|        init##_ossl_ret_ = init();              \
   64|      2|    }                                           \

d2i_ASN1_OCTET_STRING:
  836|  1.62k|        { \
  837|  1.62k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  326|  1.62k|#  define ASN1_ITEM_rptr(ref) (&(ref##_it))
  ------------------
  838|  1.62k|        } \
i2d_ASN1_OCTET_STRING:
  840|    442|        { \
  841|    442|                return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  326|    442|#  define ASN1_ITEM_rptr(ref) (&(ref##_it))
  ------------------
  842|    442|        }

err.c:lh_ERR_STRING_DATA_free:
  130|      2|    { \
  131|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  132|      2|    } \
err.c:lh_ERR_STRING_DATA_new:
  125|      2|    { \
  126|      2|        return (LHASH_OF(type) *) \
  127|      2|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  128|      2|    } \
err.c:lh_ERR_STRING_DATA_insert:
  134|  15.1k|    { \
  135|  15.1k|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  136|  15.1k|    } \
err.c:lh_ERR_STRING_DATA_retrieve:
  142|     58|    { \
  143|     58|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  144|     58|    } \
store_register.c:lh_OSSL_STORE_LOADER_num_items:
  150|      2|    { \
  151|      2|        return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \
  152|      2|    } \
store_register.c:lh_OSSL_STORE_LOADER_free:
  130|      2|    { \
  131|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  132|      2|    } \

ct_oct.c:sk_SCT_new_null:
   40|    797|    { \
   41|    797|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   42|    797|    } \
ct_oct.c:sk_SCT_push:
   69|   178k|    { \
   70|   178k|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
   71|   178k|    } \
ct_oct.c:sk_SCT_num:
   28|   277k|    { \
   29|   277k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   30|   277k|    } \
ct_oct.c:sk_SCT_value:
   32|   276k|    { \
   33|   276k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   34|   276k|    } \
ct_prn.c:sk_SCT_num:
   28|   162k|    { \
   29|   162k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   30|   162k|    } \
ct_prn.c:sk_SCT_value:
   32|   161k|    { \
   33|   161k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   34|   161k|    } \
ct_sct.c:sk_SCT_pop_free:
   85|    797|    { \
   86|    797|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
   87|    797|    } \
ex_data.c:sk_EX_CALLBACK_pop_free:
   85|     32|    { \
   86|     32|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
   87|     32|    } \
ex_data.c:sk_EX_CALLBACK_num:
   28|  1.20k|    { \
   29|  1.20k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   30|  1.20k|    } \
ex_data.c:sk_void_free:
   52|    604|    { \
   53|    604|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   54|    604|    } \
obj_xref.c:sk_nid_triple_pop_free:
   85|      2|    { \
   86|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
   87|      2|    } \
obj_xref.c:sk_nid_triple_free:
   52|      2|    { \
   53|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   54|      2|    } \
conf_mod.c:sk_CONF_MODULE_num:
   28|      4|    { \
   29|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   30|      4|    } \
conf_mod.c:sk_CONF_IMODULE_num:
   28|      4|    { \
   29|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   30|      4|    } \
conf_mod.c:sk_CONF_IMODULE_free:
   52|      4|    { \
   53|      4|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   54|      4|    } \
evp_pbe.c:sk_EVP_PBE_CTL_pop_free:
   85|      2|    { \
   86|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
   87|      2|    } \

