ASN1_BIT_STRING_set:
   17|     83|{
   18|     83|    return ASN1_STRING_set(x, d, len);
   19|     83|}
ossl_i2c_ASN1_BIT_STRING:
   22|  51.0k|{
   23|  51.0k|    int ret, j, bits, len;
   24|  51.0k|    unsigned char *p, *d;
   25|       |
   26|  51.0k|    if (a == NULL)
  ------------------
  |  Branch (26:9): [True: 0, False: 51.0k]
  ------------------
   27|      0|        return 0;
   28|       |
   29|  51.0k|    len = a->length;
   30|       |
   31|  51.0k|    if (len > 0) {
  ------------------
  |  Branch (31:9): [True: 25.4k, False: 25.6k]
  ------------------
   32|  25.4k|        if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) {
  ------------------
  |  |  161|  25.4k|# define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
  ------------------
  |  Branch (32:13): [True: 25.4k, False: 0]
  ------------------
   33|  25.4k|            bits = (int)a->flags & 0x07;
   34|  25.4k|        } else {
   35|      0|            for (; len > 0; len--) {
  ------------------
  |  Branch (35:20): [True: 0, False: 0]
  ------------------
   36|      0|                if (a->data[len - 1])
  ------------------
  |  Branch (36:21): [True: 0, False: 0]
  ------------------
   37|      0|                    break;
   38|      0|            }
   39|      0|            j = a->data[len - 1];
   40|      0|            if (j & 0x01)
  ------------------
  |  Branch (40:17): [True: 0, False: 0]
  ------------------
   41|      0|                bits = 0;
   42|      0|            else if (j & 0x02)
  ------------------
  |  Branch (42:22): [True: 0, False: 0]
  ------------------
   43|      0|                bits = 1;
   44|      0|            else if (j & 0x04)
  ------------------
  |  Branch (44:22): [True: 0, False: 0]
  ------------------
   45|      0|                bits = 2;
   46|      0|            else if (j & 0x08)
  ------------------
  |  Branch (46:22): [True: 0, False: 0]
  ------------------
   47|      0|                bits = 3;
   48|      0|            else if (j & 0x10)
  ------------------
  |  Branch (48:22): [True: 0, False: 0]
  ------------------
   49|      0|                bits = 4;
   50|      0|            else if (j & 0x20)
  ------------------
  |  Branch (50:22): [True: 0, False: 0]
  ------------------
   51|      0|                bits = 5;
   52|      0|            else if (j & 0x40)
  ------------------
  |  Branch (52:22): [True: 0, False: 0]
  ------------------
   53|      0|                bits = 6;
   54|      0|            else if (j & 0x80)
  ------------------
  |  Branch (54:22): [True: 0, False: 0]
  ------------------
   55|      0|                bits = 7;
   56|      0|            else
   57|      0|                bits = 0;       /* should not happen */
   58|      0|        }
   59|  25.4k|    } else
   60|  25.6k|        bits = 0;
   61|       |
   62|  51.0k|    ret = 1 + len;
   63|  51.0k|    if (pp == NULL)
  ------------------
  |  Branch (63:9): [True: 38.7k, False: 12.3k]
  ------------------
   64|  38.7k|        return ret;
   65|       |
   66|  12.3k|    p = *pp;
   67|       |
   68|  12.3k|    *(p++) = (unsigned char)bits;
   69|  12.3k|    d = a->data;
   70|  12.3k|    if (len > 0) {
  ------------------
  |  Branch (70:9): [True: 6.05k, False: 6.27k]
  ------------------
   71|  6.05k|        memcpy(p, d, len);
   72|  6.05k|        p += len;
   73|  6.05k|        p[-1] &= (0xff << bits);
   74|  6.05k|    }
   75|  12.3k|    *pp = p;
   76|  12.3k|    return ret;
   77|  51.0k|}
ossl_c2i_ASN1_BIT_STRING:
   81|   150k|{
   82|   150k|    ASN1_BIT_STRING *ret = NULL;
   83|   150k|    const unsigned char *p;
   84|   150k|    unsigned char *s;
   85|   150k|    int i = 0;
   86|       |
   87|   150k|    if (len < 1) {
  ------------------
  |  Branch (87:9): [True: 112, False: 150k]
  ------------------
   88|    112|        i = ASN1_R_STRING_TOO_SHORT;
  ------------------
  |  |  115|    112|# define ASN1_R_STRING_TOO_SHORT                          152
  ------------------
   89|    112|        goto err;
   90|    112|    }
   91|       |
   92|   150k|    if (len > INT_MAX) {
  ------------------
  |  Branch (92:9): [True: 0, False: 150k]
  ------------------
   93|      0|        i = ASN1_R_STRING_TOO_LONG;
  ------------------
  |  |  114|      0|# define ASN1_R_STRING_TOO_LONG                           151
  ------------------
   94|      0|        goto err;
   95|      0|    }
   96|       |
   97|   150k|    if ((a == NULL) || ((*a) == NULL)) {
  ------------------
  |  Branch (97:9): [True: 0, False: 150k]
  |  Branch (97:24): [True: 43.4k, False: 106k]
  ------------------
   98|  43.4k|        if ((ret = ASN1_BIT_STRING_new()) == NULL)
  ------------------
  |  Branch (98:13): [True: 0, False: 43.4k]
  ------------------
   99|      0|            return NULL;
  100|  43.4k|    } else
  101|   106k|        ret = (*a);
  102|       |
  103|   150k|    p = *pp;
  104|   150k|    i = *(p++);
  105|   150k|    if (i > 7) {
  ------------------
  |  Branch (105:9): [True: 143, False: 150k]
  ------------------
  106|    143|        i = ASN1_R_INVALID_BIT_STRING_BITS_LEFT;
  ------------------
  |  |   71|    143|# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT              220
  ------------------
  107|    143|        goto err;
  108|    143|    }
  109|       |    /*
  110|       |     * We do this to preserve the settings.  If we modify the settings, via
  111|       |     * the _set_bit function, we will recalculate on output
  112|       |     */
  113|   150k|    ossl_asn1_string_set_bits_left(ret, i);
  114|       |
  115|   150k|    if (len-- > 1) {            /* using one because of the bits left byte */
  ------------------
  |  Branch (115:9): [True: 100k, False: 49.7k]
  ------------------
  116|   100k|        s = OPENSSL_malloc((int)len);
  ------------------
  |  |   97|   100k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   100k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   100k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  117|   100k|        if (s == NULL) {
  ------------------
  |  Branch (117:13): [True: 0, False: 100k]
  ------------------
  118|      0|            goto err;
  119|      0|        }
  120|   100k|        memcpy(s, p, (int)len);
  121|   100k|        s[len - 1] &= (0xff << i);
  122|   100k|        p += len;
  123|   100k|    } else
  124|  49.7k|        s = NULL;
  125|       |
  126|   150k|    ASN1_STRING_set0(ret, s, (int)len);
  127|   150k|    ret->type = V_ASN1_BIT_STRING;
  ------------------
  |  |   65|   150k|# define V_ASN1_BIT_STRING               3
  ------------------
  128|   150k|    if (a != NULL)
  ------------------
  |  Branch (128:9): [True: 150k, False: 0]
  ------------------
  129|   150k|        (*a) = ret;
  130|   150k|    *pp = p;
  131|   150k|    return ret;
  132|    255| err:
  133|    255|    if (i != 0)
  ------------------
  |  Branch (133:9): [True: 255, False: 0]
  ------------------
  134|    255|        ERR_raise(ERR_LIB_ASN1, i);
  ------------------
  |  |  401|    255|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    255|    (ERR_new(),                                                 \
  |  |  |  |  404|    255|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    255|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    255|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    255|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    255|     ERR_set_error)
  |  |  ------------------
  ------------------
  135|    255|    if ((a == NULL) || (*a != ret))
  ------------------
  |  Branch (135:9): [True: 0, False: 255]
  |  Branch (135:24): [True: 141, False: 114]
  ------------------
  136|    141|        ASN1_BIT_STRING_free(ret);
  137|    255|    return NULL;
  138|   150k|}
ASN1_BIT_STRING_get_bit:
  180|  15.5k|{
  181|  15.5k|    int w, v;
  182|       |
  183|  15.5k|    if (n < 0)
  ------------------
  |  Branch (183:9): [True: 0, False: 15.5k]
  ------------------
  184|      0|        return 0;
  185|       |
  186|  15.5k|    w = n / 8;
  187|  15.5k|    v = 1 << (7 - (n & 0x07));
  188|  15.5k|    if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL))
  ------------------
  |  Branch (188:9): [True: 0, False: 15.5k]
  |  Branch (188:24): [True: 3.33k, False: 12.2k]
  |  Branch (188:49): [True: 0, False: 12.2k]
  ------------------
  189|  3.33k|        return 0;
  190|  12.2k|    return ((a->data[w] & v) != 0);
  191|  15.5k|}

asn1_d2i_read_bio:
  110|   264k|{
  111|   264k|    BUF_MEM *b;
  112|   264k|    unsigned char *p;
  113|   264k|    int i;
  114|   264k|    size_t want = HEADER_SIZE;
  ------------------
  |  |  107|   264k|#define HEADER_SIZE   8
  ------------------
  115|   264k|    uint32_t eos = 0;
  116|   264k|    size_t off = 0;
  117|   264k|    size_t len = 0;
  118|   264k|    size_t diff;
  119|       |
  120|   264k|    const unsigned char *q;
  121|   264k|    long slen;
  122|   264k|    int inf, tag, xclass;
  123|       |
  124|   264k|    b = BUF_MEM_new();
  125|   264k|    if (b == NULL) {
  ------------------
  |  Branch (125:9): [True: 0, False: 264k]
  ------------------
  126|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  127|      0|        return -1;
  128|      0|    }
  129|       |
  130|   264k|    ERR_set_mark();
  131|   116M|    for (;;) {
  132|   116M|        diff = len - off;
  133|   116M|        if (want >= diff) {
  ------------------
  |  Branch (133:13): [True: 116M, False: 0]
  ------------------
  134|   116M|            want -= diff;
  135|       |
  136|   116M|            if (len + want < len || !BUF_MEM_grow_clean(b, len + want)) {
  ------------------
  |  Branch (136:17): [True: 0, False: 116M]
  |  Branch (136:37): [True: 0, False: 116M]
  ------------------
  137|      0|                ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  138|      0|                goto err;
  139|      0|            }
  140|   116M|            i = BIO_read(in, &(b->data[len]), want);
  141|   116M|            if (i < 0 && diff == 0) {
  ------------------
  |  Branch (141:17): [True: 0, False: 116M]
  |  Branch (141:26): [True: 0, False: 0]
  ------------------
  142|      0|                ERR_raise(ERR_LIB_ASN1, ASN1_R_NOT_ENOUGH_DATA);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  143|      0|                goto err;
  144|      0|            }
  145|   116M|            if (i > 0) {
  ------------------
  |  Branch (145:17): [True: 116M, False: 164k]
  ------------------
  146|   116M|                if (len + i < len) {
  ------------------
  |  Branch (146:21): [True: 0, False: 116M]
  ------------------
  147|      0|                    ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  148|      0|                    goto err;
  149|      0|                }
  150|   116M|                len += i;
  151|   116M|            }
  152|   116M|        }
  153|       |        /* else data already loaded */
  154|       |
  155|   116M|        p = (unsigned char *)&(b->data[off]);
  156|   116M|        q = p;
  157|   116M|        diff = len - off;
  158|   116M|        if (diff == 0)
  ------------------
  |  Branch (158:13): [True: 17.9k, False: 116M]
  ------------------
  159|  17.9k|            goto err;
  160|   116M|        inf = ASN1_get_object(&q, &slen, &tag, &xclass, diff);
  161|   116M|        if (inf & 0x80) {
  ------------------
  |  Branch (161:13): [True: 4.07M, False: 112M]
  ------------------
  162|  4.07M|            unsigned long e;
  163|       |
  164|  4.07M|            e = ERR_GET_REASON(ERR_peek_last_error());
  165|  4.07M|            if (e != ASN1_R_TOO_LONG)
  ------------------
  |  |  119|  4.07M|# define ASN1_R_TOO_LONG                                  155
  ------------------
  |  Branch (165:17): [True: 18.8k, False: 4.05M]
  ------------------
  166|  18.8k|                goto err;
  167|  4.05M|            ERR_pop_to_mark();
  168|  4.05M|        }
  169|   116M|        i = q - p;            /* header length */
  170|   116M|        off += i;               /* end of data */
  171|       |
  172|   116M|        if (inf & 1) {
  ------------------
  |  Branch (172:13): [True: 19.5M, False: 96.8M]
  ------------------
  173|       |            /* no data body so go round again */
  174|  19.5M|            if (eos == UINT32_MAX) {
  ------------------
  |  Branch (174:17): [True: 0, False: 19.5M]
  ------------------
  175|      0|                ERR_raise(ERR_LIB_ASN1, ASN1_R_HEADER_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  176|      0|                goto err;
  177|      0|            }
  178|  19.5M|            eos++;
  179|  19.5M|            want = HEADER_SIZE;
  ------------------
  |  |  107|  19.5M|#define HEADER_SIZE   8
  ------------------
  180|  96.8M|        } else if (eos && (slen == 0) && (tag == V_ASN1_EOC)) {
  ------------------
  |  |   62|  78.2M|# define V_ASN1_EOC                      0
  ------------------
  |  Branch (180:20): [True: 96.7M, False: 103k]
  |  Branch (180:27): [True: 78.2M, False: 18.5M]
  |  Branch (180:42): [True: 6.92M, False: 71.3M]
  ------------------
  181|       |            /* eos value, so go back and read another header */
  182|  6.92M|            eos--;
  183|  6.92M|            if (eos == 0)
  ------------------
  |  Branch (183:17): [True: 109k, False: 6.81M]
  ------------------
  184|   109k|                break;
  185|  6.81M|            else
  186|  6.81M|                want = HEADER_SIZE;
  ------------------
  |  |  107|  6.81M|#define HEADER_SIZE   8
  ------------------
  187|  89.9M|        } else {
  188|       |            /* suck in slen bytes of data */
  189|  89.9M|            want = slen;
  190|  89.9M|            if (want > (len - off)) {
  ------------------
  |  Branch (190:17): [True: 4.05M, False: 85.9M]
  ------------------
  191|  4.05M|                size_t chunk_max = ASN1_CHUNK_INITIAL_SIZE;
  ------------------
  |  |  108|  4.05M|#define ASN1_CHUNK_INITIAL_SIZE (16 * 1024)
  ------------------
  192|       |
  193|  4.05M|                want -= (len - off);
  194|  4.05M|                if (want > INT_MAX /* BIO_read takes an int length */  ||
  ------------------
  |  Branch (194:21): [True: 817, False: 4.05M]
  ------------------
  195|  4.05M|                    len + want < len) {
  ------------------
  |  Branch (195:21): [True: 0, False: 4.05M]
  ------------------
  196|    817|                    ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  401|    817|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    817|    (ERR_new(),                                                 \
  |  |  |  |  404|    817|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    817|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    817|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    817|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    817|     ERR_set_error)
  |  |  ------------------
  ------------------
  197|    817|                    goto err;
  198|    817|                }
  199|  8.12M|                while (want > 0) {
  ------------------
  |  Branch (199:24): [True: 4.09M, False: 4.03M]
  ------------------
  200|       |                    /*
  201|       |                     * Read content in chunks of increasing size
  202|       |                     * so we can return an error for EOF without
  203|       |                     * having to allocate the entire content length
  204|       |                     * in one go.
  205|       |                     */
  206|  4.09M|                    size_t chunk = want > chunk_max ? chunk_max : want;
  ------------------
  |  Branch (206:36): [True: 39.4k, False: 4.05M]
  ------------------
  207|       |
  208|  4.09M|                    if (!BUF_MEM_grow_clean(b, len + chunk)) {
  ------------------
  |  Branch (208:25): [True: 0, False: 4.09M]
  ------------------
  209|      0|                        ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  210|      0|                        goto err;
  211|      0|                    }
  212|  4.09M|                    want -= chunk;
  213|  8.17M|                    while (chunk > 0) {
  ------------------
  |  Branch (213:28): [True: 4.09M, False: 4.07M]
  ------------------
  214|  4.09M|                        i = BIO_read(in, &(b->data[len]), chunk);
  215|  4.09M|                        if (i <= 0) {
  ------------------
  |  Branch (215:29): [True: 16.8k, False: 4.08M]
  ------------------
  216|  16.8k|                            ERR_raise(ERR_LIB_ASN1, ASN1_R_NOT_ENOUGH_DATA);
  ------------------
  |  |  401|  16.8k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  16.8k|    (ERR_new(),                                                 \
  |  |  |  |  404|  16.8k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  16.8k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  16.8k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  16.8k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  16.8k|     ERR_set_error)
  |  |  ------------------
  ------------------
  217|  16.8k|                            goto err;
  218|  16.8k|                        }
  219|       |                    /*
  220|       |                     * This can't overflow because |len+want| didn't
  221|       |                     * overflow.
  222|       |                     */
  223|  4.08M|                        len += i;
  224|  4.08M|                        chunk -= i;
  225|  4.08M|                    }
  226|  4.07M|                    if (chunk_max < INT_MAX/2)
  ------------------
  |  Branch (226:25): [True: 4.07M, False: 0]
  ------------------
  227|  4.07M|                        chunk_max *= 2;
  228|  4.07M|                }
  229|  4.05M|            }
  230|  89.9M|            if (off + slen < off) {
  ------------------
  |  Branch (230:17): [True: 0, False: 89.9M]
  ------------------
  231|      0|                ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  232|      0|                goto err;
  233|      0|            }
  234|  89.9M|            off += slen;
  235|  89.9M|            if (eos == 0) {
  ------------------
  |  Branch (235:17): [True: 100k, False: 89.8M]
  ------------------
  236|   100k|                break;
  237|   100k|            } else
  238|  89.8M|                want = HEADER_SIZE;
  ------------------
  |  |  107|  89.8M|#define HEADER_SIZE   8
  ------------------
  239|  89.9M|        }
  240|   116M|    }
  241|       |
  242|   210k|    if (off > INT_MAX) {
  ------------------
  |  Branch (242:9): [True: 0, False: 210k]
  ------------------
  243|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  244|      0|        goto err;
  245|      0|    }
  246|       |
  247|   210k|    *pb = b;
  248|   210k|    return off;
  249|  54.4k| err:
  250|  54.4k|    ERR_clear_last_mark();
  251|  54.4k|    BUF_MEM_free(b);
  252|  54.4k|    return -1;
  253|   210k|}

ossl_asn1_item_digest_ex:
   57|  7.33k|{
   58|  7.33k|    int i, ret = 0;
   59|  7.33k|    unsigned char *str = NULL;
   60|  7.33k|    EVP_MD *fetched_md = (EVP_MD *)md;
   61|       |
   62|  7.33k|    i = ASN1_item_i2d(asn, &str, it);
   63|  7.33k|    if (i < 0 || str == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 7.33k]
  |  Branch (63:18): [True: 0, False: 7.33k]
  ------------------
   64|      0|        return 0;
   65|       |
   66|  7.33k|    if (EVP_MD_get0_provider(md) == NULL) {
  ------------------
  |  Branch (66:9): [True: 7.33k, False: 0]
  ------------------
   67|  7.33k|#if !defined(OPENSSL_NO_ENGINE)
   68|  7.33k|        ENGINE *tmpeng = ENGINE_get_digest_engine(EVP_MD_get_type(md));
   69|       |
   70|  7.33k|        if (tmpeng != NULL)
  ------------------
  |  Branch (70:13): [True: 0, False: 7.33k]
  ------------------
   71|      0|            ENGINE_finish(tmpeng);
   72|  7.33k|        else
   73|  7.33k|#endif
   74|  7.33k|            fetched_md = EVP_MD_fetch(libctx, EVP_MD_get0_name(md), propq);
   75|  7.33k|    }
   76|  7.33k|    if (fetched_md == NULL)
  ------------------
  |  Branch (76:9): [True: 0, False: 7.33k]
  ------------------
   77|      0|        goto err;
   78|       |
   79|  7.33k|    ret = EVP_Digest(str, i, data, len, fetched_md, NULL);
   80|  7.33k|err:
   81|  7.33k|    OPENSSL_free(str);
  ------------------
  |  |  107|  7.33k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  7.33k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  7.33k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   82|  7.33k|    if (fetched_md != md)
  ------------------
  |  Branch (82:9): [True: 7.33k, False: 0]
  ------------------
   83|  7.33k|        EVP_MD_free(fetched_md);
   84|  7.33k|    return ret;
   85|  7.33k|}

ASN1_item_dup:
   51|  2.97k|{
   52|  2.97k|    ASN1_aux_cb *asn1_cb = NULL;
   53|  2.97k|    unsigned char *b = NULL;
   54|  2.97k|    const unsigned char *p;
   55|  2.97k|    long i;
   56|  2.97k|    ASN1_VALUE *ret;
   57|  2.97k|    OSSL_LIB_CTX *libctx = NULL;
   58|  2.97k|    const char *propq = NULL;
   59|       |
   60|  2.97k|    if (x == NULL)
  ------------------
  |  Branch (60:9): [True: 0, False: 2.97k]
  ------------------
   61|      0|        return NULL;
   62|       |
   63|  2.97k|    if (it->itype == ASN1_ITYPE_SEQUENCE || it->itype == ASN1_ITYPE_CHOICE
  ------------------
  |  |   81|  5.94k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
                  if (it->itype == ASN1_ITYPE_SEQUENCE || it->itype == ASN1_ITYPE_CHOICE
  ------------------
  |  |   82|  3.56k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (63:9): [True: 2.37k, False: 597]
  |  Branch (63:45): [True: 0, False: 597]
  ------------------
   64|  2.97k|        || it->itype == ASN1_ITYPE_NDEF_SEQUENCE) {
  ------------------
  |  |   86|    597|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (64:12): [True: 0, False: 597]
  ------------------
   65|  2.37k|        const ASN1_AUX *aux = it->funcs;
   66|       |
   67|  2.37k|        asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
  ------------------
  |  Branch (67:19): [True: 0, False: 2.37k]
  ------------------
   68|  2.37k|    }
   69|       |
   70|  2.97k|    if (asn1_cb != NULL) {
  ------------------
  |  Branch (70:9): [True: 0, False: 2.97k]
  ------------------
   71|      0|        if (!asn1_cb(ASN1_OP_DUP_PRE, (ASN1_VALUE **)&x, it, NULL)
  ------------------
  |  |  756|      0|# define ASN1_OP_DUP_PRE         14
  ------------------
  |  Branch (71:13): [True: 0, False: 0]
  ------------------
   72|      0|                || !asn1_cb(ASN1_OP_GET0_LIBCTX, (ASN1_VALUE **)&x, it, &libctx)
  ------------------
  |  |  758|      0|# define ASN1_OP_GET0_LIBCTX     16
  ------------------
  |  Branch (72:20): [True: 0, False: 0]
  ------------------
   73|      0|                || !asn1_cb(ASN1_OP_GET0_PROPQ, (ASN1_VALUE **)&x, it, &propq))
  ------------------
  |  |  759|      0|# define ASN1_OP_GET0_PROPQ      17
  ------------------
  |  Branch (73:20): [True: 0, False: 0]
  ------------------
   74|      0|            goto auxerr;
   75|      0|    }
   76|       |
   77|  2.97k|    i = ASN1_item_i2d(x, &b, it);
   78|  2.97k|    if (b == NULL) {
  ------------------
  |  Branch (78:9): [True: 0, False: 2.97k]
  ------------------
   79|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   80|      0|        return NULL;
   81|      0|    }
   82|  2.97k|    p = b;
   83|  2.97k|    ret = ASN1_item_d2i_ex(NULL, &p, i, it, libctx, propq);
   84|  2.97k|    OPENSSL_free(b);
  ------------------
  |  |  107|  2.97k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.97k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.97k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   85|       |
   86|  2.97k|    if (asn1_cb != NULL
  ------------------
  |  Branch (86:9): [True: 0, False: 2.97k]
  ------------------
   87|  2.97k|        && !asn1_cb(ASN1_OP_DUP_POST, &ret, it, (void *)x))
  ------------------
  |  |  757|      0|# define ASN1_OP_DUP_POST        15
  ------------------
  |  Branch (87:12): [True: 0, False: 0]
  ------------------
   88|      0|        goto auxerr;
   89|       |
   90|  2.97k|    return ret;
   91|       |
   92|      0| auxerr:
   93|      0|    ERR_raise_data(ERR_LIB_ASN1, ASN1_R_AUX_ERROR, "Type=%s", it->sname);
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                  ERR_raise_data(ERR_LIB_ASN1, ASN1_R_AUX_ERROR, "Type=%s", it->sname);
  ------------------
  |  |   83|      0|# define ERR_LIB_ASN1            13
  ------------------
                  ERR_raise_data(ERR_LIB_ASN1, ASN1_R_AUX_ERROR, "Type=%s", it->sname);
  ------------------
  |  |   27|      0|# define ASN1_R_AUX_ERROR                                 100
  ------------------
   94|      0|    return NULL;
   95|  2.97k|}

ASN1_GENERALIZEDTIME_print:
   82|  3.17k|{
   83|  3.17k|    if (tm->type != V_ASN1_GENERALIZEDTIME)
  ------------------
  |  |   83|  3.17k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (83:9): [True: 0, False: 3.17k]
  ------------------
   84|      0|        return 0;
   85|  3.17k|    return ASN1_TIME_print(bp, tm);
   86|  3.17k|}

ASN1_i2d_bio:
   35|     35|{
   36|     35|    char *b;
   37|     35|    unsigned char *p;
   38|     35|    int i, j = 0, n, ret = 1;
   39|       |
   40|     35|    n = i2d(x, NULL);
   41|     35|    if (n <= 0)
  ------------------
  |  Branch (41:9): [True: 0, False: 35]
  ------------------
   42|      0|        return 0;
   43|       |
   44|     35|    b = OPENSSL_malloc(n);
  ------------------
  |  |   97|     35|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     35|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     35|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   45|     35|    if (b == NULL)
  ------------------
  |  Branch (45:9): [True: 0, False: 35]
  ------------------
   46|      0|        return 0;
   47|       |
   48|     35|    p = (unsigned char *)b;
   49|     35|    i2d(x, &p);
   50|       |
   51|     35|    for (;;) {
   52|     35|        i = BIO_write(out, &(b[j]), n);
   53|     35|        if (i == n)
  ------------------
  |  Branch (53:13): [True: 35, False: 0]
  ------------------
   54|     35|            break;
   55|      0|        if (i <= 0) {
  ------------------
  |  Branch (55:13): [True: 0, False: 0]
  ------------------
   56|      0|            ret = 0;
   57|      0|            break;
   58|      0|        }
   59|      0|        j += i;
   60|      0|        n -= i;
   61|      0|    }
   62|     35|    OPENSSL_free(b);
  ------------------
  |  |  107|     35|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     35|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     35|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   63|     35|    return ret;
   64|     35|}

ossl_i2c_ASN1_INTEGER:
  208|  80.4k|{
  209|  80.4k|    return i2c_ibuf(a->data, a->length, a->type & V_ASN1_NEG, pp);
  ------------------
  |  |   97|  80.4k|# define V_ASN1_NEG                      0x100
  ------------------
  210|  80.4k|}
ossl_c2i_ASN1_INTEGER:
  288|   542k|{
  289|   542k|    ASN1_INTEGER *ret = NULL;
  290|   542k|    size_t r;
  291|   542k|    int neg;
  292|       |
  293|   542k|    r = c2i_ibuf(NULL, NULL, *pp, len);
  294|       |
  295|   542k|    if (r == 0)
  ------------------
  |  Branch (295:9): [True: 63.7k, False: 479k]
  ------------------
  296|  63.7k|        return NULL;
  297|       |
  298|   479k|    if ((a == NULL) || ((*a) == NULL)) {
  ------------------
  |  Branch (298:9): [True: 0, False: 479k]
  |  Branch (298:24): [True: 330k, False: 148k]
  ------------------
  299|   330k|        ret = ASN1_INTEGER_new();
  300|   330k|        if (ret == NULL)
  ------------------
  |  Branch (300:13): [True: 0, False: 330k]
  ------------------
  301|      0|            return NULL;
  302|   330k|        ret->type = V_ASN1_INTEGER;
  ------------------
  |  |   64|   330k|# define V_ASN1_INTEGER                  2
  ------------------
  303|   330k|    } else
  304|   148k|        ret = *a;
  305|       |
  306|   479k|    if (ASN1_STRING_set(ret, NULL, r) == 0) {
  ------------------
  |  Branch (306:9): [True: 0, False: 479k]
  ------------------
  307|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  308|      0|        goto err;
  309|      0|    }
  310|       |
  311|   479k|    c2i_ibuf(ret->data, &neg, *pp, len);
  312|       |
  313|   479k|    if (neg != 0)
  ------------------
  |  Branch (313:9): [True: 110k, False: 368k]
  ------------------
  314|   110k|        ret->type |= V_ASN1_NEG;
  ------------------
  |  |   97|   110k|# define V_ASN1_NEG                      0x100
  ------------------
  315|   368k|    else
  316|   368k|        ret->type &= ~V_ASN1_NEG;
  ------------------
  |  |   97|   368k|# define V_ASN1_NEG                      0x100
  ------------------
  317|       |
  318|   479k|    *pp += len;
  319|   479k|    if (a != NULL)
  ------------------
  |  Branch (319:9): [True: 479k, False: 0]
  ------------------
  320|   479k|        (*a) = ret;
  321|   479k|    return ret;
  322|      0| err:
  323|      0|    if (a == NULL || *a != ret)
  ------------------
  |  Branch (323:9): [True: 0, False: 0]
  |  Branch (323:22): [True: 0, False: 0]
  ------------------
  324|      0|        ASN1_INTEGER_free(ret);
  325|      0|    return NULL;
  326|   479k|}
ASN1_INTEGER_get_int64:
  524|  1.46k|{
  525|  1.46k|    return asn1_string_get_int64(pr, a, V_ASN1_INTEGER);
  ------------------
  |  |   64|  1.46k|# define V_ASN1_INTEGER                  2
  ------------------
  526|  1.46k|}
ASN1_INTEGER_set_int64:
  529|     39|{
  530|     39|    return asn1_string_set_int64(a, r, V_ASN1_INTEGER);
  ------------------
  |  |   64|     39|# define V_ASN1_INTEGER                  2
  ------------------
  531|     39|}
ASN1_INTEGER_set:
  544|     39|{
  545|     39|    return ASN1_INTEGER_set_int64(a, v);
  546|     39|}
ASN1_INTEGER_get:
  549|  1.46k|{
  550|  1.46k|    int i;
  551|  1.46k|    int64_t r;
  552|  1.46k|    if (a == NULL)
  ------------------
  |  Branch (552:9): [True: 0, False: 1.46k]
  ------------------
  553|      0|        return 0;
  554|  1.46k|    i = ASN1_INTEGER_get_int64(&r, a);
  555|  1.46k|    if (i == 0)
  ------------------
  |  Branch (555:9): [True: 160, False: 1.30k]
  ------------------
  556|    160|        return -1;
  557|  1.30k|    if (r > LONG_MAX || r < LONG_MIN)
  ------------------
  |  Branch (557:9): [True: 0, False: 1.30k]
  |  Branch (557:25): [True: 0, False: 1.30k]
  ------------------
  558|      0|        return -1;
  559|  1.30k|    return (long)r;
  560|  1.30k|}
BN_to_ASN1_INTEGER:
  563|    700|{
  564|    700|    return bn_to_asn1_string(bn, ai, V_ASN1_INTEGER);
  ------------------
  |  |   64|    700|# define V_ASN1_INTEGER                  2
  ------------------
  565|    700|}
ASN1_INTEGER_to_BN:
  568|  21.5k|{
  569|  21.5k|    return asn1_string_to_bn(ai, bn, V_ASN1_INTEGER);
  ------------------
  |  |   64|  21.5k|# define V_ASN1_INTEGER                  2
  ------------------
  570|  21.5k|}
ASN1_ENUMERATED_get_int64:
  573|  1.02k|{
  574|  1.02k|    return asn1_string_get_int64(pr, a, V_ASN1_ENUMERATED);
  ------------------
  |  |   72|  1.02k|# define V_ASN1_ENUMERATED               10
  ------------------
  575|  1.02k|}
ASN1_ENUMERATED_get:
  588|  1.11k|{
  589|  1.11k|    int i;
  590|  1.11k|    int64_t r;
  591|  1.11k|    if (a == NULL)
  ------------------
  |  Branch (591:9): [True: 0, False: 1.11k]
  ------------------
  592|      0|        return 0;
  593|  1.11k|    if ((a->type & ~V_ASN1_NEG) != V_ASN1_ENUMERATED)
  ------------------
  |  |   97|  1.11k|# define V_ASN1_NEG                      0x100
  ------------------
                  if ((a->type & ~V_ASN1_NEG) != V_ASN1_ENUMERATED)
  ------------------
  |  |   72|  1.11k|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (593:9): [True: 0, False: 1.11k]
  ------------------
  594|      0|        return -1;
  595|  1.11k|    if (a->length > (int)sizeof(long))
  ------------------
  |  Branch (595:9): [True: 89, False: 1.02k]
  ------------------
  596|     89|        return 0xffffffffL;
  597|  1.02k|    i = ASN1_ENUMERATED_get_int64(&r, a);
  598|  1.02k|    if (i == 0)
  ------------------
  |  Branch (598:9): [True: 196, False: 833]
  ------------------
  599|    196|        return -1;
  600|    833|    if (r > LONG_MAX || r < LONG_MIN)
  ------------------
  |  Branch (600:9): [True: 0, False: 833]
  |  Branch (600:25): [True: 0, False: 833]
  ------------------
  601|      0|        return -1;
  602|    833|    return (long)r;
  603|    833|}
ASN1_ENUMERATED_to_BN:
  611|    110|{
  612|    110|    return asn1_string_to_bn(ai, bn, V_ASN1_ENUMERATED);
  ------------------
  |  |   72|    110|# define V_ASN1_ENUMERATED               10
  ------------------
  613|    110|}
ossl_c2i_uint64_int:
  618|  63.9k|{
  619|  63.9k|    unsigned char buf[sizeof(uint64_t)];
  620|  63.9k|    size_t buflen;
  621|       |
  622|  63.9k|    buflen = c2i_ibuf(NULL, NULL, *pp, len);
  623|  63.9k|    if (buflen == 0)
  ------------------
  |  Branch (623:9): [True: 1.01k, False: 62.9k]
  ------------------
  624|  1.01k|        return 0;
  625|  62.9k|    if (buflen > sizeof(uint64_t)) {
  ------------------
  |  Branch (625:9): [True: 1.79k, False: 61.1k]
  ------------------
  626|  1.79k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LARGE);
  ------------------
  |  |  401|  1.79k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.79k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.79k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.79k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.79k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.79k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.79k|     ERR_set_error)
  |  |  ------------------
  ------------------
  627|  1.79k|        return 0;
  628|  1.79k|    }
  629|  61.1k|    (void)c2i_ibuf(buf, neg, *pp, len);
  630|  61.1k|    return asn1_get_uint64(ret, buf, buflen);
  631|  62.9k|}
ossl_i2c_uint64_int:
  634|  35.0k|{
  635|  35.0k|    unsigned char buf[sizeof(uint64_t)];
  636|  35.0k|    size_t off;
  637|       |
  638|  35.0k|    off = asn1_put_uint64(buf, r);
  639|  35.0k|    return i2c_ibuf(buf + off, sizeof(buf) - off, neg, &p);
  640|  35.0k|}
a_int.c:i2c_ibuf:
   99|   115k|{
  100|   115k|    unsigned int pad = 0;
  101|   115k|    size_t ret, i;
  102|   115k|    unsigned char *p, pb = 0;
  103|       |
  104|   115k|    if (b != NULL && blen) {
  ------------------
  |  Branch (104:9): [True: 115k, False: 0]
  |  Branch (104:22): [True: 115k, False: 0]
  ------------------
  105|   115k|        ret = blen;
  106|   115k|        i = b[0];
  107|   115k|        if (!neg && (i > 127)) {
  ------------------
  |  Branch (107:13): [True: 92.1k, False: 23.3k]
  |  Branch (107:21): [True: 6.77k, False: 85.3k]
  ------------------
  108|  6.77k|            pad = 1;
  109|  6.77k|            pb = 0;
  110|   108k|        } else if (neg) {
  ------------------
  |  Branch (110:20): [True: 23.3k, False: 85.3k]
  ------------------
  111|  23.3k|            pb = 0xFF;
  112|  23.3k|            if (i > 128) {
  ------------------
  |  Branch (112:17): [True: 2.02k, False: 21.3k]
  ------------------
  113|  2.02k|                pad = 1;
  114|  21.3k|            } else if (i == 128) {
  ------------------
  |  Branch (114:24): [True: 6.21k, False: 15.1k]
  ------------------
  115|       |                /*
  116|       |                 * Special case [of minimal negative for given length]:
  117|       |                 * if any other bytes non zero we pad, otherwise we don't.
  118|       |                 */
  119|  11.0k|                for (pad = 0, i = 1; i < blen; i++)
  ------------------
  |  Branch (119:38): [True: 4.84k, False: 6.21k]
  ------------------
  120|  4.84k|                    pad |= b[i];
  121|  6.21k|                pb = pad != 0 ? 0xffU : 0;
  ------------------
  |  Branch (121:22): [True: 1.27k, False: 4.93k]
  ------------------
  122|  6.21k|                pad = pb & 1;
  123|  6.21k|            }
  124|  23.3k|        }
  125|   115k|        ret += pad;
  126|   115k|    } else {
  127|      0|        ret = 1;
  128|      0|        blen = 0;   /* reduce '(b == NULL || blen == 0)' to '(blen == 0)' */
  129|      0|    }
  130|       |
  131|   115k|    if (pp == NULL || (p = *pp) == NULL)
  ------------------
  |  Branch (131:9): [True: 63.3k, False: 52.1k]
  |  Branch (131:23): [True: 27.3k, False: 24.7k]
  ------------------
  132|  90.7k|        return ret;
  133|       |
  134|       |    /*
  135|       |     * This magically handles all corner cases, such as '(b == NULL ||
  136|       |     * blen == 0)', non-negative value, "negative" zero, 0x80 followed
  137|       |     * by any number of zeros...
  138|       |     */
  139|  24.7k|    *p = pb;
  140|  24.7k|    p += pad;       /* yes, p[0] can be written twice, but it's little
  141|       |                     * price to pay for eliminated branches */
  142|  24.7k|    twos_complement(p, b, blen, pb);
  143|       |
  144|  24.7k|    *pp += ret;
  145|  24.7k|    return ret;
  146|   115k|}
a_int.c:twos_complement:
   78|   380k|{
   79|   380k|    unsigned int carry = pad & 1;
   80|       |
   81|       |    /* Begin at the end of the encoding */
   82|   380k|    if (len != 0) {
  ------------------
  |  Branch (82:9): [True: 380k, False: 0]
  ------------------
   83|       |        /*
   84|       |         * if len == 0 then src/dst could be NULL, and this would be undefined
   85|       |         * behaviour.
   86|       |         */
   87|   380k|        dst += len;
   88|   380k|        src += len;
   89|   380k|    }
   90|       |    /* two's complement value: ~value + 1 */
   91|  35.1M|    while (len-- != 0) {
  ------------------
  |  Branch (91:12): [True: 34.7M, False: 380k]
  ------------------
   92|  34.7M|        *(--dst) = (unsigned char)(carry += *(--src) ^ pad);
   93|  34.7M|        carry >>= 8;
   94|  34.7M|    }
   95|   380k|}
a_int.c:c2i_ibuf:
  156|  1.14M|{
  157|  1.14M|    int neg, pad;
  158|       |    /* Zero content length is illegal */
  159|  1.14M|    if (plen == 0) {
  ------------------
  |  Branch (159:9): [True: 52.4k, False: 1.09M]
  ------------------
  160|  52.4k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT);
  ------------------
  |  |  401|  52.4k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  52.4k|    (ERR_new(),                                                 \
  |  |  |  |  404|  52.4k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  52.4k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  52.4k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  52.4k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  52.4k|     ERR_set_error)
  |  |  ------------------
  ------------------
  161|  52.4k|        return 0;
  162|  52.4k|    }
  163|  1.09M|    neg = p[0] & 0x80;
  164|  1.09M|    if (pneg)
  ------------------
  |  Branch (164:9): [True: 540k, False: 554k]
  ------------------
  165|   540k|        *pneg = neg;
  166|       |    /* Handle common case where length is 1 octet separately */
  167|  1.09M|    if (plen == 1) {
  ------------------
  |  Branch (167:9): [True: 369k, False: 725k]
  ------------------
  168|   369k|        if (b != NULL) {
  ------------------
  |  Branch (168:13): [True: 184k, False: 184k]
  ------------------
  169|   184k|            if (neg)
  ------------------
  |  Branch (169:17): [True: 42.1k, False: 142k]
  ------------------
  170|  42.1k|                b[0] = (p[0] ^ 0xFF) + 1;
  171|   142k|            else
  172|   142k|                b[0] = p[0];
  173|   184k|        }
  174|   369k|        return 1;
  175|   369k|    }
  176|       |
  177|   725k|    pad = 0;
  178|   725k|    if (p[0] == 0) {
  ------------------
  |  Branch (178:9): [True: 42.0k, False: 683k]
  ------------------
  179|  42.0k|        pad = 1;
  180|   683k|    } else if (p[0] == 0xFF) {
  ------------------
  |  Branch (180:16): [True: 14.2k, False: 668k]
  ------------------
  181|  14.2k|        size_t i;
  182|       |
  183|       |        /*
  184|       |         * Special case [of "one less minimal negative" for given length]:
  185|       |         * if any other bytes non zero it was padded, otherwise not.
  186|       |         */
  187|  3.69M|        for (pad = 0, i = 1; i < plen; i++)
  ------------------
  |  Branch (187:30): [True: 3.68M, False: 14.2k]
  ------------------
  188|  3.68M|            pad |= p[i];
  189|  14.2k|        pad = pad != 0 ? 1 : 0;
  ------------------
  |  Branch (189:15): [True: 13.5k, False: 696]
  ------------------
  190|  14.2k|    }
  191|       |    /* reject illegal padding: first two octets MSB can't match */
  192|   725k|    if (pad && (neg == (p[1] & 0x80))) {
  ------------------
  |  Branch (192:9): [True: 55.6k, False: 669k]
  |  Branch (192:16): [True: 12.3k, False: 43.3k]
  ------------------
  193|  12.3k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_PADDING);
  ------------------
  |  |  401|  12.3k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  12.3k|    (ERR_new(),                                                 \
  |  |  |  |  404|  12.3k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  12.3k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  12.3k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  12.3k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  12.3k|     ERR_set_error)
  |  |  ------------------
  ------------------
  194|  12.3k|        return 0;
  195|  12.3k|    }
  196|       |
  197|       |    /* skip over pad */
  198|   712k|    p += pad;
  199|   712k|    plen -= pad;
  200|       |
  201|   712k|    if (b != NULL)
  ------------------
  |  Branch (201:9): [True: 355k, False: 357k]
  ------------------
  202|   355k|        twos_complement(b, p, plen, neg ? 0xffU : 0);
  ------------------
  |  Branch (202:37): [True: 85.4k, False: 270k]
  ------------------
  203|       |
  204|   712k|    return plen;
  205|   725k|}
a_int.c:asn1_string_get_int64:
  329|  2.49k|{
  330|  2.49k|    if (a == NULL) {
  ------------------
  |  Branch (330:9): [True: 0, False: 2.49k]
  ------------------
  331|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  332|      0|        return 0;
  333|      0|    }
  334|  2.49k|    if ((a->type & ~V_ASN1_NEG) != itype) {
  ------------------
  |  |   97|  2.49k|# define V_ASN1_NEG                      0x100
  ------------------
  |  Branch (334:9): [True: 0, False: 2.49k]
  ------------------
  335|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_WRONG_INTEGER_TYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  336|      0|        return 0;
  337|      0|    }
  338|  2.49k|    return asn1_get_int64(pr, a->data, a->length, a->type & V_ASN1_NEG);
  ------------------
  |  |   97|  2.49k|# define V_ASN1_NEG                      0x100
  ------------------
  339|  2.49k|}
a_int.c:asn1_get_int64:
  257|  2.49k|{
  258|  2.49k|    uint64_t r;
  259|  2.49k|    if (asn1_get_uint64(&r, b, blen) == 0)
  ------------------
  |  Branch (259:9): [True: 41, False: 2.45k]
  ------------------
  260|     41|        return 0;
  261|  2.45k|    if (neg) {
  ------------------
  |  Branch (261:9): [True: 957, False: 1.49k]
  ------------------
  262|    957|        if (r <= INT64_MAX) {
  ------------------
  |  Branch (262:13): [True: 783, False: 174]
  ------------------
  263|       |            /* Most significant bit is guaranteed to be clear, negation
  264|       |             * is guaranteed to be meaningful in platform-neutral sense. */
  265|    783|            *pr = -(int64_t)r;
  266|    783|        } else if (r == ABS_INT64_MIN) {
  ------------------
  |  |  252|    174|#define ABS_INT64_MIN ((uint64_t)INT64_MAX + (-(INT64_MIN + INT64_MAX)))
  ------------------
  |  Branch (266:20): [True: 101, False: 73]
  ------------------
  267|       |            /* This never happens if INT64_MAX == ABS_INT64_MIN, e.g.
  268|       |             * on ones'-complement system. */
  269|    101|            *pr = (int64_t)(0 - r);
  270|    101|        } else {
  271|     73|            ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
  ------------------
  |  |  401|     73|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     73|    (ERR_new(),                                                 \
  |  |  |  |  404|     73|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     73|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     73|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     73|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     73|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|     73|            return 0;
  273|     73|        }
  274|  1.49k|    } else {
  275|  1.49k|        if (r <= INT64_MAX) {
  ------------------
  |  Branch (275:13): [True: 1.25k, False: 242]
  ------------------
  276|  1.25k|            *pr = (int64_t)r;
  277|  1.25k|        } else {
  278|    242|            ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LARGE);
  ------------------
  |  |  401|    242|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    242|    (ERR_new(),                                                 \
  |  |  |  |  404|    242|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    242|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    242|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    242|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    242|     ERR_set_error)
  |  |  ------------------
  ------------------
  279|    242|            return 0;
  280|    242|        }
  281|  1.49k|    }
  282|  2.13k|    return 1;
  283|  2.45k|}
a_int.c:asn1_string_set_int64:
  342|     39|{
  343|     39|    unsigned char tbuf[sizeof(r)];
  344|     39|    size_t off;
  345|       |
  346|     39|    a->type = itype;
  347|     39|    if (r < 0) {
  ------------------
  |  Branch (347:9): [True: 0, False: 39]
  ------------------
  348|       |        /* Most obvious '-r' triggers undefined behaviour for most
  349|       |         * common INT64_MIN. Even though below '0 - (uint64_t)r' can
  350|       |         * appear two's-complement centric, it does produce correct/
  351|       |         * expected result even on one's-complement. This is because
  352|       |         * cast to unsigned has to change bit pattern... */
  353|      0|        off = asn1_put_uint64(tbuf, 0 - (uint64_t)r);
  354|      0|        a->type |= V_ASN1_NEG;
  ------------------
  |  |   97|      0|# define V_ASN1_NEG                      0x100
  ------------------
  355|     39|    } else {
  356|     39|        off = asn1_put_uint64(tbuf, r);
  357|     39|        a->type &= ~V_ASN1_NEG;
  ------------------
  |  |   97|     39|# define V_ASN1_NEG                      0x100
  ------------------
  358|     39|    }
  359|     39|    return ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);
  360|     39|}
a_int.c:bn_to_asn1_string:
  461|    700|{
  462|    700|    ASN1_INTEGER *ret;
  463|    700|    int len;
  464|       |
  465|    700|    if (ai == NULL) {
  ------------------
  |  Branch (465:9): [True: 475, False: 225]
  ------------------
  466|    475|        ret = ASN1_STRING_type_new(atype);
  467|    475|    } else {
  468|    225|        ret = ai;
  469|    225|        ret->type = atype;
  470|    225|    }
  471|       |
  472|    700|    if (ret == NULL) {
  ------------------
  |  Branch (472:9): [True: 0, False: 700]
  ------------------
  473|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  474|      0|        goto err;
  475|      0|    }
  476|       |
  477|    700|    if (BN_is_negative(bn) && !BN_is_zero(bn))
  ------------------
  |  Branch (477:9): [True: 5, False: 695]
  |  Branch (477:31): [True: 5, False: 0]
  ------------------
  478|      5|        ret->type |= V_ASN1_NEG_INTEGER;
  ------------------
  |  |   98|      5|# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   97|      5|# define V_ASN1_NEG                      0x100
  |  |  ------------------
  ------------------
  479|       |
  480|    700|    len = BN_num_bytes(bn);
  ------------------
  |  |  189|    700|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  481|       |
  482|    700|    if (len == 0)
  ------------------
  |  Branch (482:9): [True: 119, False: 581]
  ------------------
  483|    119|        len = 1;
  484|       |
  485|    700|    if (ASN1_STRING_set(ret, NULL, len) == 0) {
  ------------------
  |  Branch (485:9): [True: 0, False: 700]
  ------------------
  486|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  487|      0|        goto err;
  488|      0|    }
  489|       |
  490|       |    /* Correct zero case */
  491|    700|    if (BN_is_zero(bn))
  ------------------
  |  Branch (491:9): [True: 119, False: 581]
  ------------------
  492|    119|        ret->data[0] = 0;
  493|    581|    else
  494|    581|        len = BN_bn2bin(bn, ret->data);
  495|    700|    ret->length = len;
  496|    700|    return ret;
  497|      0| err:
  498|      0|    if (ret != ai)
  ------------------
  |  Branch (498:9): [True: 0, False: 0]
  ------------------
  499|      0|        ASN1_INTEGER_free(ret);
  500|      0|    return NULL;
  501|    700|}
a_int.c:asn1_string_to_bn:
  505|  21.6k|{
  506|  21.6k|    BIGNUM *ret;
  507|       |
  508|  21.6k|    if ((ai->type & ~V_ASN1_NEG) != itype) {
  ------------------
  |  |   97|  21.6k|# define V_ASN1_NEG                      0x100
  ------------------
  |  Branch (508:9): [True: 73, False: 21.5k]
  ------------------
  509|     73|        ERR_raise(ERR_LIB_ASN1, ASN1_R_WRONG_INTEGER_TYPE);
  ------------------
  |  |  401|     73|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     73|    (ERR_new(),                                                 \
  |  |  |  |  404|     73|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     73|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     73|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     73|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     73|     ERR_set_error)
  |  |  ------------------
  ------------------
  510|     73|        return NULL;
  511|     73|    }
  512|       |
  513|  21.5k|    ret = BN_bin2bn(ai->data, ai->length, bn);
  514|  21.5k|    if (ret == NULL) {
  ------------------
  |  Branch (514:9): [True: 0, False: 21.5k]
  ------------------
  515|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  516|      0|        return NULL;
  517|      0|    }
  518|  21.5k|    if (ai->type & V_ASN1_NEG)
  ------------------
  |  |   97|  21.5k|# define V_ASN1_NEG                      0x100
  ------------------
  |  Branch (518:9): [True: 3.73k, False: 17.8k]
  ------------------
  519|  3.73k|        BN_set_negative(ret, 1);
  520|  21.5k|    return ret;
  521|  21.5k|}
a_int.c:asn1_get_uint64:
  214|  63.6k|{
  215|  63.6k|    size_t i;
  216|  63.6k|    uint64_t r;
  217|       |
  218|  63.6k|    if (blen > sizeof(*pr)) {
  ------------------
  |  Branch (218:9): [True: 41, False: 63.5k]
  ------------------
  219|     41|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LARGE);
  ------------------
  |  |  401|     41|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     41|    (ERR_new(),                                                 \
  |  |  |  |  404|     41|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     41|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     41|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     41|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     41|     ERR_set_error)
  |  |  ------------------
  ------------------
  220|     41|        return 0;
  221|     41|    }
  222|  63.5k|    if (b == NULL)
  ------------------
  |  Branch (222:9): [True: 0, False: 63.5k]
  ------------------
  223|      0|        return 0;
  224|   195k|    for (r = 0, i = 0; i < blen; i++) {
  ------------------
  |  Branch (224:24): [True: 132k, False: 63.5k]
  ------------------
  225|   132k|        r <<= 8;
  226|   132k|        r |= b[i];
  227|   132k|    }
  228|  63.5k|    *pr = r;
  229|  63.5k|    return 1;
  230|  63.5k|}
a_int.c:asn1_put_uint64:
  238|  35.0k|{
  239|  35.0k|    size_t off = sizeof(uint64_t);
  240|       |
  241|  67.3k|    do {
  242|  67.3k|        b[--off] = (unsigned char)r;
  243|  67.3k|    } while (r >>= 8);
  ------------------
  |  Branch (243:14): [True: 32.3k, False: 35.0k]
  ------------------
  244|       |
  245|  35.0k|    return off;
  246|  35.0k|}

ASN1_mbstring_copy:
   38|   215k|{
   39|   215k|    return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);
   40|   215k|}
ASN1_mbstring_ncopy:
   45|   215k|{
   46|   215k|    int str_type;
   47|   215k|    int ret;
   48|   215k|    char free_out;
   49|   215k|    int outform, outlen = 0;
   50|   215k|    ASN1_STRING *dest;
   51|   215k|    unsigned char *p;
   52|   215k|    int nchar;
   53|   215k|    int (*cpyfunc) (unsigned long, void *) = NULL;
   54|   215k|    if (len == -1)
  ------------------
  |  Branch (54:9): [True: 0, False: 215k]
  ------------------
   55|      0|        len = strlen((const char *)in);
   56|   215k|    if (!mask)
  ------------------
  |  Branch (56:9): [True: 0, False: 215k]
  ------------------
   57|      0|        mask = DIRSTRING_TYPE;
  ------------------
  |  |  223|      0| (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
  |  |  ------------------
  |  |  |  |  103|      0|# define B_ASN1_PRINTABLESTRING  0x0002
  |  |  ------------------
  |  |                (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
  |  |  ------------------
  |  |  |  |  104|      0|# define B_ASN1_T61STRING        0x0004
  |  |  ------------------
  |  |                (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
  |  |  ------------------
  |  |  |  |  115|      0|# define B_ASN1_BMPSTRING        0x0800
  |  |  ------------------
  |  |                (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
  |  |  ------------------
  |  |  |  |  117|      0|# define B_ASN1_UTF8STRING       0x2000
  |  |  ------------------
  ------------------
   58|   215k|    if (len < 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 215k]
  ------------------
   59|      0|        return -1;
   60|       |
   61|       |    /* First do a string check and work out the number of characters */
   62|   215k|    switch (inform) {
   63|       |
   64|   140k|    case MBSTRING_BMP:
  ------------------
  |  |  125|   140k|# define MBSTRING_BMP            (MBSTRING_FLAG|2)
  |  |  ------------------
  |  |  |  |  122|   140k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (64:5): [True: 140k, False: 75.1k]
  ------------------
   65|   140k|        if (len & 1) {
  ------------------
  |  Branch (65:13): [True: 0, False: 140k]
  ------------------
   66|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_BMPSTRING_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   67|      0|            return -1;
   68|      0|        }
   69|   140k|        nchar = len >> 1;
   70|   140k|        break;
   71|       |
   72|  2.47k|    case MBSTRING_UNIV:
  ------------------
  |  |  126|  2.47k|# define MBSTRING_UNIV           (MBSTRING_FLAG|4)
  |  |  ------------------
  |  |  |  |  122|  2.47k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (72:5): [True: 2.47k, False: 213k]
  ------------------
   73|  2.47k|        if (len & 3) {
  ------------------
  |  Branch (73:13): [True: 0, False: 2.47k]
  ------------------
   74|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   75|      0|            return -1;
   76|      0|        }
   77|  2.47k|        nchar = len >> 2;
   78|  2.47k|        break;
   79|       |
   80|  70.7k|    case MBSTRING_UTF8:
  ------------------
  |  |  123|  70.7k|# define MBSTRING_UTF8           (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  122|  70.7k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (80:5): [True: 70.7k, False: 144k]
  ------------------
   81|  70.7k|        nchar = 0;
   82|       |        /* This counts the characters and does utf8 syntax checking */
   83|  70.7k|        ret = traverse_string(in, len, MBSTRING_UTF8, in_utf8, &nchar);
  ------------------
  |  |  123|  70.7k|# define MBSTRING_UTF8           (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  122|  70.7k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
   84|  70.7k|        if (ret < 0) {
  ------------------
  |  Branch (84:13): [True: 610, False: 70.1k]
  ------------------
   85|    610|            ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_UTF8STRING);
  ------------------
  |  |  401|    610|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    610|    (ERR_new(),                                                 \
  |  |  |  |  404|    610|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    610|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    610|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    610|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    610|     ERR_set_error)
  |  |  ------------------
  ------------------
   86|    610|            return -1;
   87|    610|        }
   88|  70.1k|        break;
   89|       |
   90|  70.1k|    case MBSTRING_ASC:
  ------------------
  |  |  124|  1.94k|# define MBSTRING_ASC            (MBSTRING_FLAG|1)
  |  |  ------------------
  |  |  |  |  122|  1.94k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (90:5): [True: 1.94k, False: 213k]
  ------------------
   91|  1.94k|        nchar = len;
   92|  1.94k|        break;
   93|       |
   94|      0|    default:
  ------------------
  |  Branch (94:5): [True: 0, False: 215k]
  ------------------
   95|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNKNOWN_FORMAT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   96|      0|        return -1;
   97|   215k|    }
   98|       |
   99|   214k|    if ((minsize > 0) && (nchar < minsize)) {
  ------------------
  |  Branch (99:9): [True: 0, False: 214k]
  |  Branch (99:26): [True: 0, False: 0]
  ------------------
  100|      0|        ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT,
  ------------------
  |  |   83|      0|# define ERR_LIB_ASN1            13
  ------------------
                      ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT,
  ------------------
  |  |  115|      0|# define ASN1_R_STRING_TOO_SHORT                          152
  ------------------
  101|      0|                       "minsize=%ld", minsize);
  102|      0|        return -1;
  103|      0|    }
  104|       |
  105|   214k|    if ((maxsize > 0) && (nchar > maxsize)) {
  ------------------
  |  Branch (105:9): [True: 0, False: 214k]
  |  Branch (105:26): [True: 0, False: 0]
  ------------------
  106|      0|        ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG,
  ------------------
  |  |   83|      0|# define ERR_LIB_ASN1            13
  ------------------
                      ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG,
  ------------------
  |  |  114|      0|# define ASN1_R_STRING_TOO_LONG                           151
  ------------------
  107|      0|                       "maxsize=%ld", maxsize);
  108|      0|        return -1;
  109|      0|    }
  110|       |
  111|       |    /* Now work out minimal type (if any) */
  112|   214k|    if (traverse_string(in, len, inform, type_str, &mask) < 0) {
  ------------------
  |  Branch (112:9): [True: 55, False: 214k]
  ------------------
  113|     55|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_CHARACTERS);
  ------------------
  |  |  401|     55|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     55|    (ERR_new(),                                                 \
  |  |  |  |  404|     55|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     55|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     55|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     55|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     55|     ERR_set_error)
  |  |  ------------------
  ------------------
  114|     55|        return -1;
  115|     55|    }
  116|       |
  117|       |    /* Now work out output format and string type */
  118|   214k|    outform = MBSTRING_ASC;
  ------------------
  |  |  124|   214k|# define MBSTRING_ASC            (MBSTRING_FLAG|1)
  |  |  ------------------
  |  |  |  |  122|   214k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  119|   214k|    if (mask & B_ASN1_NUMERICSTRING)
  ------------------
  |  |  102|   214k|# define B_ASN1_NUMERICSTRING    0x0001
  ------------------
  |  Branch (119:9): [True: 0, False: 214k]
  ------------------
  120|      0|        str_type = V_ASN1_NUMERICSTRING;
  ------------------
  |  |   76|      0|# define V_ASN1_NUMERICSTRING            18 /**/
  ------------------
  121|   214k|    else if (mask & B_ASN1_PRINTABLESTRING)
  ------------------
  |  |  103|   214k|# define B_ASN1_PRINTABLESTRING  0x0002
  ------------------
  |  Branch (121:14): [True: 0, False: 214k]
  ------------------
  122|      0|        str_type = V_ASN1_PRINTABLESTRING;
  ------------------
  |  |   77|      0|# define V_ASN1_PRINTABLESTRING          19
  ------------------
  123|   214k|    else if (mask & B_ASN1_IA5STRING)
  ------------------
  |  |  107|   214k|# define B_ASN1_IA5STRING        0x0010
  ------------------
  |  Branch (123:14): [True: 0, False: 214k]
  ------------------
  124|      0|        str_type = V_ASN1_IA5STRING;
  ------------------
  |  |   81|      0|# define V_ASN1_IA5STRING                22
  ------------------
  125|   214k|    else if (mask & B_ASN1_T61STRING)
  ------------------
  |  |  104|   214k|# define B_ASN1_T61STRING        0x0004
  ------------------
  |  Branch (125:14): [True: 0, False: 214k]
  ------------------
  126|      0|        str_type = V_ASN1_T61STRING;
  ------------------
  |  |   78|      0|# define V_ASN1_T61STRING                20
  ------------------
  127|   214k|    else if (mask & B_ASN1_BMPSTRING) {
  ------------------
  |  |  115|   214k|# define B_ASN1_BMPSTRING        0x0800
  ------------------
  |  Branch (127:14): [True: 0, False: 214k]
  ------------------
  128|      0|        str_type = V_ASN1_BMPSTRING;
  ------------------
  |  |   89|      0|# define V_ASN1_BMPSTRING                30
  ------------------
  129|      0|        outform = MBSTRING_BMP;
  ------------------
  |  |  125|      0|# define MBSTRING_BMP            (MBSTRING_FLAG|2)
  |  |  ------------------
  |  |  |  |  122|      0|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  130|   214k|    } else if (mask & B_ASN1_UNIVERSALSTRING) {
  ------------------
  |  |  112|   214k|# define B_ASN1_UNIVERSALSTRING  0x0100
  ------------------
  |  Branch (130:16): [True: 0, False: 214k]
  ------------------
  131|      0|        str_type = V_ASN1_UNIVERSALSTRING;
  ------------------
  |  |   88|      0|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  132|      0|        outform = MBSTRING_UNIV;
  ------------------
  |  |  126|      0|# define MBSTRING_UNIV           (MBSTRING_FLAG|4)
  |  |  ------------------
  |  |  |  |  122|      0|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  133|   214k|    } else {
  134|   214k|        str_type = V_ASN1_UTF8STRING;
  ------------------
  |  |   73|   214k|# define V_ASN1_UTF8STRING               12
  ------------------
  135|   214k|        outform = MBSTRING_UTF8;
  ------------------
  |  |  123|   214k|# define MBSTRING_UTF8           (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  122|   214k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  136|   214k|    }
  137|   214k|    if (!out)
  ------------------
  |  Branch (137:9): [True: 0, False: 214k]
  ------------------
  138|      0|        return str_type;
  139|   214k|    if (*out) {
  ------------------
  |  Branch (139:9): [True: 214k, False: 0]
  ------------------
  140|   214k|        free_out = 0;
  141|   214k|        dest = *out;
  142|   214k|        ASN1_STRING_set0(dest,  NULL, 0);
  143|   214k|        dest->type = str_type;
  144|   214k|    } else {
  145|      0|        free_out = 1;
  146|      0|        dest = ASN1_STRING_type_new(str_type);
  147|      0|        if (dest == NULL) {
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  149|      0|            return -1;
  150|      0|        }
  151|      0|        *out = dest;
  152|      0|    }
  153|       |    /* If both the same type just copy across */
  154|   214k|    if (inform == outform) {
  ------------------
  |  Branch (154:9): [True: 70.1k, False: 144k]
  ------------------
  155|  70.1k|        if (!ASN1_STRING_set(dest, in, len)) {
  ------------------
  |  Branch (155:13): [True: 0, False: 70.1k]
  ------------------
  156|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  157|      0|            return -1;
  158|      0|        }
  159|  70.1k|        return str_type;
  160|  70.1k|    }
  161|       |
  162|       |    /* Work out how much space the destination will need */
  163|   144k|    switch (outform) {
  ------------------
  |  Branch (163:13): [True: 0, False: 144k]
  ------------------
  164|      0|    case MBSTRING_ASC:
  ------------------
  |  |  124|      0|# define MBSTRING_ASC            (MBSTRING_FLAG|1)
  |  |  ------------------
  |  |  |  |  122|      0|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (164:5): [True: 0, False: 144k]
  ------------------
  165|      0|        outlen = nchar;
  166|      0|        cpyfunc = cpy_asc;
  167|      0|        break;
  168|       |
  169|      0|    case MBSTRING_BMP:
  ------------------
  |  |  125|      0|# define MBSTRING_BMP            (MBSTRING_FLAG|2)
  |  |  ------------------
  |  |  |  |  122|      0|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (169:5): [True: 0, False: 144k]
  ------------------
  170|      0|        outlen = nchar << 1;
  171|      0|        cpyfunc = cpy_bmp;
  172|      0|        break;
  173|       |
  174|      0|    case MBSTRING_UNIV:
  ------------------
  |  |  126|      0|# define MBSTRING_UNIV           (MBSTRING_FLAG|4)
  |  |  ------------------
  |  |  |  |  122|      0|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (174:5): [True: 0, False: 144k]
  ------------------
  175|      0|        outlen = nchar << 2;
  176|      0|        cpyfunc = cpy_univ;
  177|      0|        break;
  178|       |
  179|   144k|    case MBSTRING_UTF8:
  ------------------
  |  |  123|   144k|# define MBSTRING_UTF8           (MBSTRING_FLAG)
  |  |  ------------------
  |  |  |  |  122|   144k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (179:5): [True: 144k, False: 0]
  ------------------
  180|   144k|        outlen = 0;
  181|   144k|        traverse_string(in, len, inform, out_utf8, &outlen);
  182|   144k|        cpyfunc = cpy_utf8;
  183|   144k|        break;
  184|   144k|    }
  185|   144k|    if ((p = OPENSSL_malloc(outlen + 1)) == NULL) {
  ------------------
  |  |   97|   144k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   144k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   144k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (185:9): [True: 0, False: 144k]
  ------------------
  186|      0|        if (free_out)
  ------------------
  |  Branch (186:13): [True: 0, False: 0]
  ------------------
  187|      0|            ASN1_STRING_free(dest);
  188|      0|        return -1;
  189|      0|    }
  190|   144k|    dest->length = outlen;
  191|   144k|    dest->data = p;
  192|   144k|    p[outlen] = 0;
  193|   144k|    traverse_string(in, len, inform, cpyfunc, &p);
  194|   144k|    return str_type;
  195|   144k|}
a_mbstr.c:traverse_string:
  205|   575k|{
  206|   575k|    unsigned long value;
  207|   575k|    int ret;
  208|  10.6M|    while (len) {
  ------------------
  |  Branch (208:12): [True: 10.0M, False: 574k]
  ------------------
  209|  10.0M|        if (inform == MBSTRING_ASC) {
  ------------------
  |  |  124|  10.0M|# define MBSTRING_ASC            (MBSTRING_FLAG|1)
  |  |  ------------------
  |  |  |  |  122|  10.0M|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (209:13): [True: 10.0M, False: 10.8k]
  ------------------
  210|  10.0M|            value = *p++;
  211|  10.0M|            len--;
  212|  10.0M|        } else if (inform == MBSTRING_BMP) {
  ------------------
  |  |  125|  10.8k|# define MBSTRING_BMP            (MBSTRING_FLAG|2)
  |  |  ------------------
  |  |  |  |  122|  10.8k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (212:20): [True: 5.33k, False: 5.56k]
  ------------------
  213|  5.33k|            value = *p++ << 8;
  214|  5.33k|            value |= *p++;
  215|  5.33k|            len -= 2;
  216|  5.56k|        } else if (inform == MBSTRING_UNIV) {
  ------------------
  |  |  126|  5.56k|# define MBSTRING_UNIV           (MBSTRING_FLAG|4)
  |  |  ------------------
  |  |  |  |  122|  5.56k|# define MBSTRING_FLAG           0x1000
  |  |  ------------------
  ------------------
  |  Branch (216:20): [True: 534, False: 5.02k]
  ------------------
  217|    534|            value = ((unsigned long)*p++) << 24;
  218|    534|            value |= ((unsigned long)*p++) << 16;
  219|    534|            value |= *p++ << 8;
  220|    534|            value |= *p++;
  221|    534|            len -= 4;
  222|  5.02k|        } else {
  223|  5.02k|            ret = UTF8_getc(p, len, &value);
  224|  5.02k|            if (ret < 0)
  ------------------
  |  Branch (224:17): [True: 605, False: 4.42k]
  ------------------
  225|    605|                return -1;
  226|  4.42k|            len -= ret;
  227|  4.42k|            p += ret;
  228|  4.42k|        }
  229|  10.0M|        if (rfunc) {
  ------------------
  |  Branch (229:13): [True: 10.0M, False: 0]
  ------------------
  230|  10.0M|            ret = rfunc(value, arg);
  231|  10.0M|            if (ret <= 0)
  ------------------
  |  Branch (231:17): [True: 60, False: 10.0M]
  ------------------
  232|     60|                return ret;
  233|  10.0M|        }
  234|  10.0M|    }
  235|   574k|    return 1;
  236|   575k|}
a_mbstr.c:in_utf8:
  243|  2.45k|{
  244|  2.45k|    int *nchar;
  245|       |
  246|  2.45k|    if (!is_unicode_valid(value))
  ------------------
  |  Branch (246:9): [True: 5, False: 2.44k]
  ------------------
  247|      5|        return -2;
  248|  2.44k|    nchar = arg;
  249|  2.44k|    (*nchar)++;
  250|  2.44k|    return 1;
  251|  2.45k|}
a_mbstr.c:out_utf8:
  256|  3.34M|{
  257|  3.34M|    int *outlen, len;
  258|       |
  259|  3.34M|    len = UTF8_putc(NULL, -1, value);
  260|  3.34M|    if (len <= 0)
  ------------------
  |  Branch (260:9): [True: 0, False: 3.34M]
  ------------------
  261|      0|        return len;
  262|  3.34M|    outlen = arg;
  263|  3.34M|    *outlen += len;
  264|  3.34M|    return 1;
  265|  3.34M|}
a_mbstr.c:type_str:
  273|  3.35M|{
  274|  3.35M|    unsigned long types = *((unsigned long *)arg);
  275|  3.35M|    const int native = value > INT_MAX ? INT_MAX : ossl_fromascii(value);
  ------------------
  |  |   57|  6.70M|#  define ossl_fromascii(c)     (c)
  ------------------
  |  Branch (275:24): [True: 13, False: 3.35M]
  ------------------
  276|       |
  277|  3.35M|    if ((types & B_ASN1_NUMERICSTRING) && !(ossl_isdigit(native)
  ------------------
  |  |  102|  3.35M|# define B_ASN1_NUMERICSTRING    0x0001
  ------------------
  |  Branch (277:9): [True: 0, False: 3.35M]
  |  Branch (277:45): [True: 0, False: 0]
  ------------------
  278|      0|                                            || native == ' '))
  ------------------
  |  Branch (278:48): [True: 0, False: 0]
  ------------------
  279|      0|        types &= ~B_ASN1_NUMERICSTRING;
  ------------------
  |  |  102|      0|# define B_ASN1_NUMERICSTRING    0x0001
  ------------------
  280|  3.35M|    if ((types & B_ASN1_PRINTABLESTRING) && !ossl_isasn1print(native))
  ------------------
  |  |  103|  3.35M|# define B_ASN1_PRINTABLESTRING  0x0002
  ------------------
                  if ((types & B_ASN1_PRINTABLESTRING) && !ossl_isasn1print(native))
  ------------------
  |  |   85|      0|# define ossl_isasn1print(c)    (ossl_ctype_check((c), CTYPE_MASK_asn1print))
  |  |  ------------------
  |  |  |  |   38|      0|# define CTYPE_MASK_asn1print   0x800
  |  |  ------------------
  ------------------
  |  Branch (280:9): [True: 0, False: 3.35M]
  |  Branch (280:45): [True: 0, False: 0]
  ------------------
  281|      0|        types &= ~B_ASN1_PRINTABLESTRING;
  ------------------
  |  |  103|      0|# define B_ASN1_PRINTABLESTRING  0x0002
  ------------------
  282|  3.35M|    if ((types & B_ASN1_IA5STRING) && !ossl_isascii(native))
  ------------------
  |  |  107|  3.35M|# define B_ASN1_IA5STRING        0x0010
  ------------------
                  if ((types & B_ASN1_IA5STRING) && !ossl_isascii(native))
  ------------------
  |  |   75|      0|# define ossl_isascii(c)        (((c) & ~127) == 0)
  ------------------
  |  Branch (282:9): [True: 0, False: 3.35M]
  |  Branch (282:39): [True: 0, False: 0]
  ------------------
  283|      0|        types &= ~B_ASN1_IA5STRING;
  ------------------
  |  |  107|      0|# define B_ASN1_IA5STRING        0x0010
  ------------------
  284|  3.35M|    if ((types & B_ASN1_T61STRING) && (value > 0xff))
  ------------------
  |  |  104|  3.35M|# define B_ASN1_T61STRING        0x0004
  ------------------
  |  Branch (284:9): [True: 0, False: 3.35M]
  |  Branch (284:39): [True: 0, False: 0]
  ------------------
  285|      0|        types &= ~B_ASN1_T61STRING;
  ------------------
  |  |  104|      0|# define B_ASN1_T61STRING        0x0004
  ------------------
  286|  3.35M|    if ((types & B_ASN1_BMPSTRING) && (value > 0xffff))
  ------------------
  |  |  115|  3.35M|# define B_ASN1_BMPSTRING        0x0800
  ------------------
  |  Branch (286:9): [True: 0, False: 3.35M]
  |  Branch (286:39): [True: 0, False: 0]
  ------------------
  287|      0|        types &= ~B_ASN1_BMPSTRING;
  ------------------
  |  |  115|      0|# define B_ASN1_BMPSTRING        0x0800
  ------------------
  288|  3.35M|    if ((types & B_ASN1_UTF8STRING) && !is_unicode_valid(value))
  ------------------
  |  |  117|  3.35M|# define B_ASN1_UTF8STRING       0x2000
  ------------------
  |  Branch (288:9): [True: 3.35M, False: 0]
  |  Branch (288:40): [True: 55, False: 3.35M]
  ------------------
  289|     55|        types &= ~B_ASN1_UTF8STRING;
  ------------------
  |  |  117|     55|# define B_ASN1_UTF8STRING       0x2000
  ------------------
  290|  3.35M|    if (!types)
  ------------------
  |  Branch (290:9): [True: 55, False: 3.35M]
  ------------------
  291|     55|        return -1;
  292|  3.35M|    *((unsigned long *)arg) = types;
  293|  3.35M|    return 1;
  294|  3.35M|}
a_mbstr.c:cpy_utf8:
  339|  3.34M|{
  340|  3.34M|    unsigned char **p;
  341|  3.34M|    int ret;
  342|  3.34M|    p = arg;
  343|       |    /* We already know there is enough room so pass 0xff as the length */
  344|  3.34M|    ret = UTF8_putc(*p, 0xff, value);
  345|  3.34M|    *p += ret;
  346|  3.34M|    return 1;
  347|  3.34M|}

i2t_ASN1_OBJECT:
  178|  1.17M|{
  179|  1.17M|    return OBJ_obj2txt(buf, buf_len, a, 0);
  180|  1.17M|}
i2a_ASN1_OBJECT:
  183|  1.12M|{
  184|  1.12M|    char buf[80], *p = buf;
  185|  1.12M|    int i;
  186|       |
  187|  1.12M|    if ((a == NULL) || (a->data == NULL))
  ------------------
  |  Branch (187:9): [True: 0, False: 1.12M]
  |  Branch (187:24): [True: 0, False: 1.12M]
  ------------------
  188|      0|        return BIO_write(bp, "NULL", 4);
  189|  1.12M|    i = i2t_ASN1_OBJECT(buf, sizeof(buf), a);
  190|  1.12M|    if (i > (int)(sizeof(buf) - 1)) {
  ------------------
  |  Branch (190:9): [True: 1.28k, False: 1.12M]
  ------------------
  191|  1.28k|        if (i > INT_MAX - 1) {  /* catch an integer overflow */
  ------------------
  |  Branch (191:13): [True: 0, False: 1.28k]
  ------------------
  192|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_LENGTH_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  193|      0|            return -1;
  194|      0|        }
  195|  1.28k|        if ((p = OPENSSL_malloc(i + 1)) == NULL)
  ------------------
  |  |   97|  1.28k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.28k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.28k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (195:13): [True: 0, False: 1.28k]
  ------------------
  196|      0|            return -1;
  197|  1.28k|        i2t_ASN1_OBJECT(p, i + 1, a);
  198|  1.28k|    }
  199|  1.12M|    if (i <= 0) {
  ------------------
  |  Branch (199:9): [True: 75, False: 1.12M]
  ------------------
  200|     75|        i = BIO_write(bp, "<INVALID>", 9);
  201|     75|        i += BIO_dump(bp, (const char *)a->data, a->length);
  202|     75|        return i;
  203|     75|    }
  204|  1.12M|    BIO_write(bp, p, i);
  205|  1.12M|    if (p != buf)
  ------------------
  |  Branch (205:9): [True: 1.28k, False: 1.12M]
  ------------------
  206|  1.28k|        OPENSSL_free(p);
  ------------------
  |  |  107|  1.28k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.28k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.28k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  207|  1.12M|    return i;
  208|  1.12M|}
d2i_ASN1_OBJECT:
  212|  1.11M|{
  213|  1.11M|    const unsigned char *p;
  214|  1.11M|    long len;
  215|  1.11M|    int tag, xclass;
  216|  1.11M|    int inf, i;
  217|  1.11M|    ASN1_OBJECT *ret = NULL;
  218|  1.11M|    p = *pp;
  219|  1.11M|    inf = ASN1_get_object(&p, &len, &tag, &xclass, length);
  220|  1.11M|    if (inf & 0x80) {
  ------------------
  |  Branch (220:9): [True: 95, False: 1.11M]
  ------------------
  221|     95|        i = ASN1_R_BAD_OBJECT_HEADER;
  ------------------
  |  |   28|     95|# define ASN1_R_BAD_OBJECT_HEADER                         102
  ------------------
  222|     95|        goto err;
  223|     95|    }
  224|       |
  225|  1.11M|    if (tag != V_ASN1_OBJECT) {
  ------------------
  |  |   68|  1.11M|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (225:9): [True: 0, False: 1.11M]
  ------------------
  226|      0|        i = ASN1_R_EXPECTING_AN_OBJECT;
  ------------------
  |  |   45|      0|# define ASN1_R_EXPECTING_AN_OBJECT                       116
  ------------------
  227|      0|        goto err;
  228|      0|    }
  229|  1.11M|    ret = ossl_c2i_ASN1_OBJECT(a, &p, len);
  230|  1.11M|    if (ret)
  ------------------
  |  Branch (230:9): [True: 1.10M, False: 5.81k]
  ------------------
  231|  1.10M|        *pp = p;
  232|  1.11M|    return ret;
  233|     95| err:
  234|     95|    ERR_raise(ERR_LIB_ASN1, i);
  ------------------
  |  |  401|     95|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     95|    (ERR_new(),                                                 \
  |  |  |  |  404|     95|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     95|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     95|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     95|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     95|     ERR_set_error)
  |  |  ------------------
  ------------------
  235|     95|    return NULL;
  236|  1.11M|}
ossl_c2i_ASN1_OBJECT:
  240|  1.81M|{
  241|  1.81M|    ASN1_OBJECT *ret = NULL, tobj;
  242|  1.81M|    const unsigned char *p;
  243|  1.81M|    unsigned char *data;
  244|  1.81M|    int i, length;
  245|       |
  246|       |    /*
  247|       |     * Sanity check OID encoding. Need at least one content octet. MSB must
  248|       |     * be clear in the last octet. can't have leading 0x80 in subidentifiers,
  249|       |     * see: X.690 8.19.2
  250|       |     */
  251|  1.81M|    if (len <= 0 || len > INT_MAX || pp == NULL || (p = *pp) == NULL ||
  ------------------
  |  Branch (251:9): [True: 1.12k, False: 1.80M]
  |  Branch (251:21): [True: 0, False: 1.80M]
  |  Branch (251:38): [True: 0, False: 1.80M]
  |  Branch (251:52): [True: 0, False: 1.80M]
  ------------------
  252|  1.81M|        p[len - 1] & 0x80) {
  ------------------
  |  Branch (252:9): [True: 4.42k, False: 1.80M]
  ------------------
  253|  5.54k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_OBJECT_ENCODING);
  ------------------
  |  |  401|  5.54k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  5.54k|    (ERR_new(),                                                 \
  |  |  |  |  404|  5.54k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  5.54k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  5.54k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  5.54k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  5.54k|     ERR_set_error)
  |  |  ------------------
  ------------------
  254|  5.54k|        return NULL;
  255|  5.54k|    }
  256|       |    /* Now 0 < len <= INT_MAX, so the cast is safe. */
  257|  1.80M|    length = (int)len;
  258|       |    /*
  259|       |     * Try to lookup OID in table: these are all valid encodings so if we get
  260|       |     * a match we know the OID is valid.
  261|       |     */
  262|  1.80M|    tobj.nid = NID_undef;
  ------------------
  |  |   18|  1.80M|#define NID_undef                       0
  ------------------
  263|  1.80M|    tobj.data = p;
  264|  1.80M|    tobj.length = length;
  265|  1.80M|    tobj.flags = 0;
  266|  1.80M|    i = OBJ_obj2nid(&tobj);
  267|  1.80M|    if (i != NID_undef) {
  ------------------
  |  |   18|  1.80M|#define NID_undef                       0
  ------------------
  |  Branch (267:9): [True: 518k, False: 1.28M]
  ------------------
  268|       |        /*
  269|       |         * Return shared registered OID object: this improves efficiency
  270|       |         * because we don't have to return a dynamically allocated OID
  271|       |         * and NID lookups can use the cached value.
  272|       |         */
  273|   518k|        ret = OBJ_nid2obj(i);
  274|   518k|        if (a) {
  ------------------
  |  Branch (274:13): [True: 518k, False: 0]
  ------------------
  275|   518k|            ASN1_OBJECT_free(*a);
  276|   518k|            *a = ret;
  277|   518k|        }
  278|   518k|        *pp += len;
  279|   518k|        return ret;
  280|   518k|    }
  281|  14.4M|    for (i = 0; i < length; i++, p++) {
  ------------------
  |  Branch (281:17): [True: 13.2M, False: 1.28M]
  ------------------
  282|  13.2M|        if (*p == 0x80 && (!i || !(p[-1] & 0x80))) {
  ------------------
  |  Branch (282:13): [True: 14.3k, False: 13.1M]
  |  Branch (282:28): [True: 89, False: 14.2k]
  |  Branch (282:34): [True: 782, False: 13.4k]
  ------------------
  283|    871|            ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_OBJECT_ENCODING);
  ------------------
  |  |  401|    871|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    871|    (ERR_new(),                                                 \
  |  |  |  |  404|    871|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    871|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    871|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    871|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    871|     ERR_set_error)
  |  |  ------------------
  ------------------
  284|    871|            return NULL;
  285|    871|        }
  286|  13.2M|    }
  287|       |
  288|  1.28M|    if ((a == NULL) || ((*a) == NULL) ||
  ------------------
  |  Branch (288:9): [True: 0, False: 1.28M]
  |  Branch (288:24): [True: 948k, False: 336k]
  ------------------
  289|  1.28M|        !((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) {
  ------------------
  |  |  110|   336k|# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
  ------------------
  |  Branch (289:9): [True: 333k, False: 3.41k]
  ------------------
  290|  1.28M|        if ((ret = ASN1_OBJECT_new()) == NULL)
  ------------------
  |  Branch (290:13): [True: 0, False: 1.28M]
  ------------------
  291|      0|            return NULL;
  292|  1.28M|    } else {
  293|  3.41k|        ret = (*a);
  294|  3.41k|    }
  295|       |
  296|  1.28M|    p = *pp;
  297|       |    /* detach data from object */
  298|  1.28M|    data = (unsigned char *)ret->data;
  299|  1.28M|    ret->data = NULL;
  300|       |    /* once detached we can change it */
  301|  1.28M|    if ((data == NULL) || (ret->length < length)) {
  ------------------
  |  Branch (301:9): [True: 1.28M, False: 3.41k]
  |  Branch (301:27): [True: 691, False: 2.72k]
  ------------------
  302|  1.28M|        ret->length = 0;
  303|  1.28M|        OPENSSL_free(data);
  ------------------
  |  |  107|  1.28M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.28M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.28M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  304|  1.28M|        data = OPENSSL_malloc(length);
  ------------------
  |  |   97|  1.28M|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.28M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.28M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  305|  1.28M|        if (data == NULL)
  ------------------
  |  Branch (305:13): [True: 0, False: 1.28M]
  ------------------
  306|      0|            goto err;
  307|  1.28M|        ret->flags |= ASN1_OBJECT_FLAG_DYNAMIC_DATA;
  ------------------
  |  |  113|  1.28M|# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
  ------------------
  308|  1.28M|    }
  309|  1.28M|    memcpy(data, p, length);
  310|       |    /* If there are dynamic strings, free them here, and clear the flag */
  311|  1.28M|    if ((ret->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) != 0) {
  ------------------
  |  |  112|  1.28M|# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
  ------------------
  |  Branch (311:9): [True: 0, False: 1.28M]
  ------------------
  312|      0|        OPENSSL_free((char *)ret->sn);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  313|      0|        OPENSSL_free((char *)ret->ln);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  314|      0|        ret->flags &= ~ASN1_OBJECT_FLAG_DYNAMIC_STRINGS;
  ------------------
  |  |  112|      0|# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
  ------------------
  315|      0|    }
  316|       |    /* reattach data to object, after which it remains const */
  317|  1.28M|    ret->data = data;
  318|  1.28M|    ret->length = length;
  319|  1.28M|    ret->sn = NULL;
  320|  1.28M|    ret->ln = NULL;
  321|       |    /* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */
  322|  1.28M|    p += length;
  323|       |
  324|  1.28M|    if (a != NULL)
  ------------------
  |  Branch (324:9): [True: 1.28M, False: 0]
  ------------------
  325|  1.28M|        (*a) = ret;
  326|  1.28M|    *pp = p;
  327|  1.28M|    return ret;
  328|      0| err:
  329|      0|    ERR_raise(ERR_LIB_ASN1, i);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  330|      0|    if ((a == NULL) || (*a != ret))
  ------------------
  |  Branch (330:9): [True: 0, False: 0]
  |  Branch (330:24): [True: 0, False: 0]
  ------------------
  331|      0|        ASN1_OBJECT_free(ret);
  332|      0|    return NULL;
  333|  1.28M|}
ASN1_OBJECT_new:
  336|  1.49M|{
  337|  1.49M|    ASN1_OBJECT *ret;
  338|       |
  339|  1.49M|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  1.49M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.49M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.49M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  340|  1.49M|    if (ret == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 1.49M]
  ------------------
  341|      0|        return NULL;
  342|  1.49M|    ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
  ------------------
  |  |  110|  1.49M|# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
  ------------------
  343|  1.49M|    return ret;
  344|  1.49M|}
ASN1_OBJECT_free:
  347|  4.70M|{
  348|  4.70M|    if (a == NULL)
  ------------------
  |  Branch (348:9): [True: 1.66M, False: 3.04M]
  ------------------
  349|  1.66M|        return;
  350|  3.04M|    if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) {
  ------------------
  |  |  112|  3.04M|# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
  ------------------
  |  Branch (350:9): [True: 215k, False: 2.83M]
  ------------------
  351|   215k|#ifndef CONST_STRICT
  352|       |        /*
  353|       |         * Disable purely for compile-time strict const checking.  Doing this
  354|       |         * on a "real" compile will cause memory leaks
  355|       |         */
  356|   215k|        OPENSSL_free((void*)a->sn);
  ------------------
  |  |  107|   215k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   215k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   215k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  357|   215k|        OPENSSL_free((void*)a->ln);
  ------------------
  |  |  107|   215k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   215k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   215k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  358|   215k|#endif
  359|   215k|        a->sn = a->ln = NULL;
  360|   215k|    }
  361|  3.04M|    if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) {
  ------------------
  |  |  113|  3.04M|# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
  ------------------
  |  Branch (361:9): [True: 1.49M, False: 1.54M]
  ------------------
  362|  1.49M|        OPENSSL_free((void*)a->data);
  ------------------
  |  |  107|  1.49M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.49M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.49M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  363|  1.49M|        a->data = NULL;
  364|  1.49M|        a->length = 0;
  365|  1.49M|    }
  366|  3.04M|    if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
  ------------------
  |  |  110|  3.04M|# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
  ------------------
  |  Branch (366:9): [True: 1.49M, False: 1.54M]
  ------------------
  367|  1.49M|        OPENSSL_free(a);
  ------------------
  |  |  107|  1.49M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.49M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.49M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  368|  3.04M|}

ASN1_OCTET_STRING_set:
   27|    450|{
   28|    450|    return ASN1_STRING_set(x, d, len);
   29|    450|}

ASN1_STRING_print:
   70|  8.34k|{
   71|  8.34k|    int i, n;
   72|  8.34k|    char buf[80];
   73|  8.34k|    const char *p;
   74|       |
   75|  8.34k|    if (v == NULL)
  ------------------
  |  Branch (75:9): [True: 0, False: 8.34k]
  ------------------
   76|      0|        return 0;
   77|  8.34k|    n = 0;
   78|  8.34k|    p = (const char *)v->data;
   79|   148k|    for (i = 0; i < v->length; i++) {
  ------------------
  |  Branch (79:17): [True: 139k, False: 8.34k]
  ------------------
   80|   139k|        if ((p[i] > '~') || ((p[i] < ' ') &&
  ------------------
  |  Branch (80:13): [True: 228, False: 139k]
  |  Branch (80:30): [True: 97.2k, False: 42.3k]
  ------------------
   81|   139k|                             (p[i] != '\n') && (p[i] != '\r')))
  ------------------
  |  Branch (81:30): [True: 97.0k, False: 220]
  |  Branch (81:48): [True: 96.4k, False: 548]
  ------------------
   82|  96.7k|            buf[n] = '.';
   83|  43.0k|        else
   84|  43.0k|            buf[n] = p[i];
   85|   139k|        n++;
   86|   139k|        if (n >= 80) {
  ------------------
  |  Branch (86:13): [True: 184, False: 139k]
  ------------------
   87|    184|            if (BIO_write(bp, buf, n) <= 0)
  ------------------
  |  Branch (87:17): [True: 0, False: 184]
  ------------------
   88|      0|                return 0;
   89|    184|            n = 0;
   90|    184|        }
   91|   139k|    }
   92|  8.34k|    if (n > 0)
  ------------------
  |  Branch (92:9): [True: 7.90k, False: 440]
  ------------------
   93|  7.90k|        if (BIO_write(bp, buf, n) <= 0)
  ------------------
  |  Branch (93:13): [True: 0, False: 7.90k]
  ------------------
   94|      0|            return 0;
   95|  8.34k|    return 1;
   96|  8.34k|}

X509_NAME_print_ex:
  562|  7.72k|{
  563|  7.72k|    if (flags == XN_FLAG_COMPAT)
  ------------------
  |  |  311|  7.72k|# define XN_FLAG_COMPAT          0/* Traditional; use old X509_NAME_print */
  ------------------
  |  Branch (563:9): [True: 2.56k, False: 5.15k]
  ------------------
  564|  2.56k|        return X509_NAME_print(out, nm, indent);
  565|  5.15k|    return do_name_ex(send_bio_chars, out, nm, indent, flags);
  566|  7.72k|}
ASN1_STRING_print_ex:
  587|  6.20k|{
  588|  6.20k|    return do_print_ex(send_bio_chars, out, flags, str);
  589|  6.20k|}
ASN1_STRING_to_UTF8:
  604|   215k|{
  605|   215k|    ASN1_STRING stmp, *str = &stmp;
  606|   215k|    int mbflag, type, ret;
  607|   215k|    if (!in)
  ------------------
  |  Branch (607:9): [True: 0, False: 215k]
  ------------------
  608|      0|        return -1;
  609|   215k|    type = in->type;
  610|   215k|    if ((type < 0) || (type > 30))
  ------------------
  |  Branch (610:9): [True: 0, False: 215k]
  |  Branch (610:23): [True: 0, False: 215k]
  ------------------
  611|      0|        return -1;
  612|   215k|    mbflag = tag2nbyte[type];
  613|   215k|    if (mbflag == -1)
  ------------------
  |  Branch (613:9): [True: 0, False: 215k]
  ------------------
  614|      0|        return -1;
  615|   215k|    mbflag |= MBSTRING_FLAG;
  ------------------
  |  |  122|   215k|# define MBSTRING_FLAG           0x1000
  ------------------
  616|   215k|    stmp.data = NULL;
  617|   215k|    stmp.length = 0;
  618|   215k|    stmp.flags = 0;
  619|   215k|    ret =
  620|   215k|        ASN1_mbstring_copy(&str, in->data, in->length, mbflag,
  621|   215k|                           B_ASN1_UTF8STRING);
  ------------------
  |  |  117|   215k|# define B_ASN1_UTF8STRING       0x2000
  ------------------
  622|   215k|    if (ret < 0)
  ------------------
  |  Branch (622:9): [True: 665, False: 214k]
  ------------------
  623|    665|        return ret;
  624|   214k|    *out = stmp.data;
  625|   214k|    return stmp.length;
  626|   215k|}
a_strex.c:do_name_ex:
  424|  5.15k|{
  425|  5.15k|    int i, prev = -1, orflags, cnt;
  426|  5.15k|    int fn_opt, fn_nid;
  427|  5.15k|    ASN1_OBJECT *fn;
  428|  5.15k|    const ASN1_STRING *val;
  429|  5.15k|    const X509_NAME_ENTRY *ent;
  430|  5.15k|    char objtmp[80];
  431|  5.15k|    const char *objbuf;
  432|  5.15k|    int outlen, len;
  433|  5.15k|    char *sep_dn, *sep_mv, *sep_eq;
  434|  5.15k|    int sep_dn_len, sep_mv_len, sep_eq_len;
  435|  5.15k|    if (indent < 0)
  ------------------
  |  Branch (435:9): [True: 0, False: 5.15k]
  ------------------
  436|      0|        indent = 0;
  437|  5.15k|    outlen = indent;
  438|  5.15k|    if (!do_indent(io_ch, arg, indent))
  ------------------
  |  Branch (438:9): [True: 0, False: 5.15k]
  ------------------
  439|      0|        return -1;
  440|  5.15k|    switch (flags & XN_FLAG_SEP_MASK) {
  ------------------
  |  |  309|  5.15k|# define XN_FLAG_SEP_MASK        (0xf << 16)
  ------------------
  441|      0|    case XN_FLAG_SEP_MULTILINE:
  ------------------
  |  |  315|      0|# define XN_FLAG_SEP_MULTILINE   (4 << 16)/* One line per field */
  ------------------
  |  Branch (441:5): [True: 0, False: 5.15k]
  ------------------
  442|      0|        sep_dn = "\n";
  443|      0|        sep_dn_len = 1;
  444|      0|        sep_mv = " + ";
  445|      0|        sep_mv_len = 3;
  446|      0|        break;
  447|       |
  448|      0|    case XN_FLAG_SEP_COMMA_PLUS:
  ------------------
  |  |  312|      0|# define XN_FLAG_SEP_COMMA_PLUS  (1 << 16)/* RFC2253 ,+ */
  ------------------
  |  Branch (448:5): [True: 0, False: 5.15k]
  ------------------
  449|      0|        sep_dn = ",";
  450|      0|        sep_dn_len = 1;
  451|      0|        sep_mv = "+";
  452|      0|        sep_mv_len = 1;
  453|      0|        indent = 0;
  454|      0|        break;
  455|       |
  456|  5.15k|    case XN_FLAG_SEP_CPLUS_SPC:
  ------------------
  |  |  313|  5.15k|# define XN_FLAG_SEP_CPLUS_SPC   (2 << 16)/* ,+ spaced: more readable */
  ------------------
  |  Branch (456:5): [True: 5.15k, False: 0]
  ------------------
  457|  5.15k|        sep_dn = ", ";
  458|  5.15k|        sep_dn_len = 2;
  459|  5.15k|        sep_mv = " + ";
  460|  5.15k|        sep_mv_len = 3;
  461|  5.15k|        indent = 0;
  462|  5.15k|        break;
  463|       |
  464|      0|    case XN_FLAG_SEP_SPLUS_SPC:
  ------------------
  |  |  314|      0|# define XN_FLAG_SEP_SPLUS_SPC   (3 << 16)/* ;+ spaced */
  ------------------
  |  Branch (464:5): [True: 0, False: 5.15k]
  ------------------
  465|      0|        sep_dn = "; ";
  466|      0|        sep_dn_len = 2;
  467|      0|        sep_mv = " + ";
  468|      0|        sep_mv_len = 3;
  469|      0|        indent = 0;
  470|      0|        break;
  471|       |
  472|      0|    default:
  ------------------
  |  Branch (472:5): [True: 0, False: 5.15k]
  ------------------
  473|      0|        return -1;
  474|  5.15k|    }
  475|       |
  476|  5.15k|    if (flags & XN_FLAG_SPC_EQ) {
  ------------------
  |  |  328|  5.15k|# define XN_FLAG_SPC_EQ          (1 << 23)/* Put spaces round '=' */
  ------------------
  |  Branch (476:9): [True: 5.15k, False: 0]
  ------------------
  477|  5.15k|        sep_eq = " = ";
  478|  5.15k|        sep_eq_len = 3;
  479|  5.15k|    } else {
  480|      0|        sep_eq = "=";
  481|      0|        sep_eq_len = 1;
  482|      0|    }
  483|       |
  484|  5.15k|    fn_opt = flags & XN_FLAG_FN_MASK;
  ------------------
  |  |  321|  5.15k|# define XN_FLAG_FN_MASK         (0x3 << 21)
  ------------------
  485|       |
  486|  5.15k|    cnt = X509_NAME_entry_count(n);
  487|  10.9k|    for (i = 0; i < cnt; i++) {
  ------------------
  |  Branch (487:17): [True: 5.78k, False: 5.15k]
  ------------------
  488|  5.78k|        if (flags & XN_FLAG_DN_REV)
  ------------------
  |  |  317|  5.78k|# define XN_FLAG_DN_REV          (1 << 20)/* Reverse DN order */
  ------------------
  |  Branch (488:13): [True: 0, False: 5.78k]
  ------------------
  489|      0|            ent = X509_NAME_get_entry(n, cnt - i - 1);
  490|  5.78k|        else
  491|  5.78k|            ent = X509_NAME_get_entry(n, i);
  492|  5.78k|        if (prev != -1) {
  ------------------
  |  Branch (492:13): [True: 1.05k, False: 4.73k]
  ------------------
  493|  1.05k|            if (prev == X509_NAME_ENTRY_set(ent)) {
  ------------------
  |  Branch (493:17): [True: 1.05k, False: 0]
  ------------------
  494|  1.05k|                if (!io_ch(arg, sep_mv, sep_mv_len))
  ------------------
  |  Branch (494:21): [True: 0, False: 1.05k]
  ------------------
  495|      0|                    return -1;
  496|  1.05k|                outlen += sep_mv_len;
  497|  1.05k|            } else {
  498|      0|                if (!io_ch(arg, sep_dn, sep_dn_len))
  ------------------
  |  Branch (498:21): [True: 0, False: 0]
  ------------------
  499|      0|                    return -1;
  500|      0|                outlen += sep_dn_len;
  501|      0|                if (!do_indent(io_ch, arg, indent))
  ------------------
  |  Branch (501:21): [True: 0, False: 0]
  ------------------
  502|      0|                    return -1;
  503|      0|                outlen += indent;
  504|      0|            }
  505|  1.05k|        }
  506|  5.78k|        prev = X509_NAME_ENTRY_set(ent);
  507|  5.78k|        fn = X509_NAME_ENTRY_get_object(ent);
  508|  5.78k|        val = X509_NAME_ENTRY_get_data(ent);
  509|  5.78k|        fn_nid = OBJ_obj2nid(fn);
  510|  5.78k|        if (fn_opt != XN_FLAG_FN_NONE) {
  ------------------
  |  |  326|  5.78k|# define XN_FLAG_FN_NONE         (3 << 21)/* No field names */
  ------------------
  |  Branch (510:13): [True: 5.78k, False: 0]
  ------------------
  511|  5.78k|            int objlen, fld_len;
  512|  5.78k|            if ((fn_opt == XN_FLAG_FN_OID) || (fn_nid == NID_undef)) {
  ------------------
  |  |  325|  5.78k|# define XN_FLAG_FN_OID          (2 << 21)/* Always use OIDs */
  ------------------
                          if ((fn_opt == XN_FLAG_FN_OID) || (fn_nid == NID_undef)) {
  ------------------
  |  |   18|  5.78k|#define NID_undef                       0
  ------------------
  |  Branch (512:17): [True: 0, False: 5.78k]
  |  Branch (512:47): [True: 5.65k, False: 129]
  ------------------
  513|  5.65k|                OBJ_obj2txt(objtmp, sizeof(objtmp), fn, 1);
  514|  5.65k|                fld_len = 0;    /* XXX: what should this be? */
  515|  5.65k|                objbuf = objtmp;
  516|  5.65k|            } else {
  517|    129|                if (fn_opt == XN_FLAG_FN_SN) {
  ------------------
  |  |  323|    129|# define XN_FLAG_FN_SN           0/* Object short name */
  ------------------
  |  Branch (517:21): [True: 129, False: 0]
  ------------------
  518|    129|                    fld_len = FN_WIDTH_SN;
  ------------------
  |  |  420|    129|#define FN_WIDTH_SN     10
  ------------------
  519|    129|                    objbuf = OBJ_nid2sn(fn_nid);
  520|    129|                } else if (fn_opt == XN_FLAG_FN_LN) {
  ------------------
  |  |  324|      0|# define XN_FLAG_FN_LN           (1 << 21)/* Object long name */
  ------------------
  |  Branch (520:28): [True: 0, False: 0]
  ------------------
  521|      0|                    fld_len = FN_WIDTH_LN;
  ------------------
  |  |  419|      0|#define FN_WIDTH_LN     25
  ------------------
  522|      0|                    objbuf = OBJ_nid2ln(fn_nid);
  523|      0|                } else {
  524|      0|                    fld_len = 0; /* XXX: what should this be? */
  525|      0|                    objbuf = "";
  526|      0|                }
  527|    129|            }
  528|  5.78k|            objlen = strlen(objbuf);
  529|  5.78k|            if (!io_ch(arg, objbuf, objlen))
  ------------------
  |  Branch (529:17): [True: 0, False: 5.78k]
  ------------------
  530|      0|                return -1;
  531|  5.78k|            if ((objlen < fld_len) && (flags & XN_FLAG_FN_ALIGN)) {
  ------------------
  |  |  337|    124|# define XN_FLAG_FN_ALIGN        (1 << 25)/* Align field names to 20
  ------------------
  |  Branch (531:17): [True: 124, False: 5.66k]
  |  Branch (531:39): [True: 0, False: 124]
  ------------------
  532|      0|                if (!do_indent(io_ch, arg, fld_len - objlen))
  ------------------
  |  Branch (532:21): [True: 0, False: 0]
  ------------------
  533|      0|                    return -1;
  534|      0|                outlen += fld_len - objlen;
  535|      0|            }
  536|  5.78k|            if (!io_ch(arg, sep_eq, sep_eq_len))
  ------------------
  |  Branch (536:17): [True: 0, False: 5.78k]
  ------------------
  537|      0|                return -1;
  538|  5.78k|            outlen += objlen + sep_eq_len;
  539|  5.78k|        }
  540|       |        /*
  541|       |         * If the field name is unknown then fix up the DER dump flag. We
  542|       |         * might want to limit this further so it will DER dump on anything
  543|       |         * other than a few 'standard' fields.
  544|       |         */
  545|  5.78k|        if ((fn_nid == NID_undef) && (flags & XN_FLAG_DUMP_UNKNOWN_FIELDS))
  ------------------
  |  |   18|  5.78k|#define NID_undef                       0
  ------------------
                      if ((fn_nid == NID_undef) && (flags & XN_FLAG_DUMP_UNKNOWN_FIELDS))
  ------------------
  |  |  335|  5.65k|# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
  ------------------
  |  Branch (545:13): [True: 5.65k, False: 129]
  |  Branch (545:38): [True: 0, False: 5.65k]
  ------------------
  546|      0|            orflags = ASN1_STRFLGS_DUMP_ALL;
  ------------------
  |  |  495|      0|# define ASN1_STRFLGS_DUMP_ALL           0x80
  ------------------
  547|  5.78k|        else
  548|  5.78k|            orflags = 0;
  549|       |
  550|  5.78k|        len = do_print_ex(io_ch, arg, flags | orflags, val);
  551|  5.78k|        if (len < 0)
  ------------------
  |  Branch (551:13): [True: 0, False: 5.78k]
  ------------------
  552|      0|            return -1;
  553|  5.78k|        outlen += len;
  554|  5.78k|    }
  555|  5.15k|    return outlen;
  556|  5.15k|}
a_strex.c:do_indent:
  411|  5.15k|{
  412|  5.15k|    int i;
  413|  5.15k|    for (i = 0; i < indent; i++)
  ------------------
  |  Branch (413:17): [True: 0, False: 5.15k]
  ------------------
  414|      0|        if (!io_ch(arg, " ", 1))
  ------------------
  |  Branch (414:13): [True: 0, False: 0]
  ------------------
  415|      0|            return 0;
  416|  5.15k|    return 1;
  417|  5.15k|}
a_strex.c:send_bio_chars:
   39|  3.27M|{
   40|  3.27M|    if (!arg)
  ------------------
  |  Branch (40:9): [True: 110k, False: 3.16M]
  ------------------
   41|   110k|        return 1;
   42|  3.16M|    if (BIO_write(arg, buf, len) != len)
  ------------------
  |  Branch (42:9): [True: 0, False: 3.16M]
  ------------------
   43|      0|        return 0;
   44|  3.16M|    return 1;
   45|  3.16M|}
a_strex.c:do_print_ex:
  331|  11.9k|{
  332|  11.9k|    int outlen, len;
  333|  11.9k|    int type;
  334|  11.9k|    char quotes;
  335|  11.9k|    unsigned short flags;
  336|  11.9k|    quotes = 0;
  337|       |    /* Keep a copy of escape flags */
  338|  11.9k|    flags = (unsigned short)(lflags & ESC_FLAGS);
  ------------------
  |  |   28|  11.9k|#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
  |  |  ------------------
  |  |  |  |  440|  11.9k|# define ASN1_STRFLGS_ESC_2253           1
  |  |  ------------------
  |  |   29|  11.9k|                  ASN1_STRFLGS_ESC_2254 | \
  |  |  ------------------
  |  |  |  |  508|  11.9k|#define ASN1_STRFLGS_ESC_2254           0x400
  |  |  ------------------
  |  |   30|  11.9k|                  ASN1_STRFLGS_ESC_QUOTE | \
  |  |  ------------------
  |  |  |  |  454|  11.9k|# define ASN1_STRFLGS_ESC_QUOTE          8
  |  |  ------------------
  |  |   31|  11.9k|                  ASN1_STRFLGS_ESC_CTRL | \
  |  |  ------------------
  |  |  |  |  441|  11.9k|# define ASN1_STRFLGS_ESC_CTRL           2
  |  |  ------------------
  |  |   32|  11.9k|                  ASN1_STRFLGS_ESC_MSB)
  |  |  ------------------
  |  |  |  |  442|  11.9k|# define ASN1_STRFLGS_ESC_MSB            4
  |  |  ------------------
  ------------------
  339|       |
  340|  11.9k|    type = str->type;
  341|       |
  342|  11.9k|    outlen = 0;
  343|       |
  344|  11.9k|    if (lflags & ASN1_STRFLGS_SHOW_TYPE) {
  ------------------
  |  |  485|  11.9k|# define ASN1_STRFLGS_SHOW_TYPE          0x40
  ------------------
  |  Branch (344:9): [True: 3.74k, False: 8.23k]
  ------------------
  345|  3.74k|        const char *tagname;
  346|  3.74k|        tagname = ASN1_tag2str(type);
  347|  3.74k|        outlen += strlen(tagname);
  348|  3.74k|        if (!io_ch(arg, tagname, outlen) || !io_ch(arg, ":", 1))
  ------------------
  |  Branch (348:13): [True: 0, False: 3.74k]
  |  Branch (348:45): [True: 0, False: 3.74k]
  ------------------
  349|      0|            return -1;
  350|  3.74k|        outlen++;
  351|  3.74k|    }
  352|       |
  353|       |    /* Decide what to do with type, either dump content or display it */
  354|       |
  355|       |    /* Dump everything */
  356|  11.9k|    if (lflags & ASN1_STRFLGS_DUMP_ALL)
  ------------------
  |  |  495|  11.9k|# define ASN1_STRFLGS_DUMP_ALL           0x80
  ------------------
  |  Branch (356:9): [True: 3.74k, False: 8.23k]
  ------------------
  357|  3.74k|        type = -1;
  358|       |    /* Ignore the string type */
  359|  8.23k|    else if (lflags & ASN1_STRFLGS_IGNORE_TYPE)
  ------------------
  |  |  482|  8.23k|# define ASN1_STRFLGS_IGNORE_TYPE        0x20
  ------------------
  |  Branch (359:14): [True: 0, False: 8.23k]
  ------------------
  360|      0|        type = 1;
  361|  8.23k|    else {
  362|       |        /* Else determine width based on type */
  363|  8.23k|        if ((type > 0) && (type < 31))
  ------------------
  |  Branch (363:13): [True: 8.23k, False: 0]
  |  Branch (363:27): [True: 8.23k, False: 0]
  ------------------
  364|  8.23k|            type = tag2nbyte[type];
  365|      0|        else
  366|      0|            type = -1;
  367|  8.23k|        if ((type == -1) && !(lflags & ASN1_STRFLGS_DUMP_UNKNOWN))
  ------------------
  |  |  496|    430|# define ASN1_STRFLGS_DUMP_UNKNOWN       0x100
  ------------------
  |  Branch (367:13): [True: 430, False: 7.80k]
  |  Branch (367:29): [True: 0, False: 430]
  ------------------
  368|      0|            type = 1;
  369|  8.23k|    }
  370|       |
  371|  11.9k|    if (type == -1) {
  ------------------
  |  Branch (371:9): [True: 4.17k, False: 7.80k]
  ------------------
  372|  4.17k|        len = do_dump(lflags, io_ch, arg, str);
  373|  4.17k|        if (len < 0)
  ------------------
  |  Branch (373:13): [True: 0, False: 4.17k]
  ------------------
  374|      0|            return -1;
  375|  4.17k|        outlen += len;
  376|  4.17k|        return outlen;
  377|  4.17k|    }
  378|       |
  379|  7.80k|    if (lflags & ASN1_STRFLGS_UTF8_CONVERT) {
  ------------------
  |  |  474|  7.80k|# define ASN1_STRFLGS_UTF8_CONVERT       0x10
  ------------------
  |  Branch (379:9): [True: 5.35k, False: 2.45k]
  ------------------
  380|       |        /*
  381|       |         * Note: if string is UTF8 and we want to convert to UTF8 then we
  382|       |         * just interpret it as 1 byte per character to avoid converting
  383|       |         * twice.
  384|       |         */
  385|  5.35k|        if (!type)
  ------------------
  |  Branch (385:13): [True: 120, False: 5.23k]
  ------------------
  386|    120|            type = 1;
  387|  5.23k|        else
  388|  5.23k|            type |= BUF_TYPE_CONVUTF8;
  ------------------
  |  |  130|  5.23k|#define BUF_TYPE_CONVUTF8       0x8
  ------------------
  389|  5.35k|    }
  390|       |
  391|  7.80k|    len = do_buf(str->data, str->length, type, flags, &quotes, io_ch, NULL);
  392|  7.80k|    if (len < 0)
  ------------------
  |  Branch (392:9): [True: 1.40k, False: 6.40k]
  ------------------
  393|  1.40k|        return -1;
  394|  6.40k|    outlen += len;
  395|  6.40k|    if (quotes)
  ------------------
  |  Branch (395:9): [True: 715, False: 5.68k]
  ------------------
  396|    715|        outlen += 2;
  397|  6.40k|    if (!arg)
  ------------------
  |  Branch (397:9): [True: 0, False: 6.40k]
  ------------------
  398|      0|        return outlen;
  399|  6.40k|    if (quotes && !io_ch(arg, "\"", 1))
  ------------------
  |  Branch (399:9): [True: 715, False: 5.68k]
  |  Branch (399:19): [True: 0, False: 715]
  ------------------
  400|      0|        return -1;
  401|  6.40k|    if (do_buf(str->data, str->length, type, flags, NULL, io_ch, arg) < 0)
  ------------------
  |  Branch (401:9): [True: 0, False: 6.40k]
  ------------------
  402|      0|        return -1;
  403|  6.40k|    if (quotes && !io_ch(arg, "\"", 1))
  ------------------
  |  Branch (403:9): [True: 715, False: 5.68k]
  |  Branch (403:19): [True: 0, False: 715]
  ------------------
  404|      0|        return -1;
  405|  6.40k|    return outlen;
  406|  6.40k|}
a_strex.c:do_dump:
  262|  4.17k|{
  263|       |    /*
  264|       |     * Placing the ASN1_STRING in a temp ASN1_TYPE allows the DER encoding to
  265|       |     * readily obtained
  266|       |     */
  267|  4.17k|    ASN1_TYPE t;
  268|  4.17k|    unsigned char *der_buf, *p;
  269|  4.17k|    int outlen, der_len;
  270|       |
  271|  4.17k|    if (!io_ch(arg, "#", 1))
  ------------------
  |  Branch (271:9): [True: 0, False: 4.17k]
  ------------------
  272|      0|        return -1;
  273|       |    /* If we don't dump DER encoding just dump content octets */
  274|  4.17k|    if (!(lflags & ASN1_STRFLGS_DUMP_DER)) {
  ------------------
  |  |  503|  4.17k|# define ASN1_STRFLGS_DUMP_DER           0x200
  ------------------
  |  Branch (274:9): [True: 3.74k, False: 430]
  ------------------
  275|  3.74k|        outlen = do_hex_dump(io_ch, arg, str->data, str->length);
  276|  3.74k|        if (outlen < 0)
  ------------------
  |  Branch (276:13): [True: 0, False: 3.74k]
  ------------------
  277|      0|            return -1;
  278|  3.74k|        return outlen + 1;
  279|  3.74k|    }
  280|    430|    t.type = str->type;
  281|    430|    t.value.ptr = (char *)str;
  282|    430|    der_len = i2d_ASN1_TYPE(&t, NULL);
  283|    430|    if (der_len <= 0)
  ------------------
  |  Branch (283:9): [True: 0, False: 430]
  ------------------
  284|      0|        return -1;
  285|    430|    if ((der_buf = OPENSSL_malloc(der_len)) == NULL)
  ------------------
  |  |   97|    430|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    430|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    430|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (285:9): [True: 0, False: 430]
  ------------------
  286|      0|        return -1;
  287|    430|    p = der_buf;
  288|    430|    i2d_ASN1_TYPE(&t, &p);
  289|    430|    outlen = do_hex_dump(io_ch, arg, der_buf, der_len);
  290|    430|    OPENSSL_free(der_buf);
  ------------------
  |  |  107|    430|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    430|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    430|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  291|    430|    if (outlen < 0)
  ------------------
  |  Branch (291:9): [True: 0, False: 430]
  ------------------
  292|      0|        return -1;
  293|    430|    return outlen + 1;
  294|    430|}
a_strex.c:do_hex_dump:
  236|  4.17k|{
  237|  4.17k|    static const char hexdig[] = "0123456789ABCDEF";
  238|  4.17k|    unsigned char *p, *q;
  239|  4.17k|    char hextmp[2];
  240|  4.17k|    if (arg) {
  ------------------
  |  Branch (240:9): [True: 4.17k, False: 0]
  ------------------
  241|  4.17k|        p = buf;
  242|  4.17k|        q = buf + buflen;
  243|  3.02M|        while (p != q) {
  ------------------
  |  Branch (243:16): [True: 3.02M, False: 4.17k]
  ------------------
  244|  3.02M|            hextmp[0] = hexdig[*p >> 4];
  245|  3.02M|            hextmp[1] = hexdig[*p & 0xf];
  246|  3.02M|            if (!io_ch(arg, hextmp, 2))
  ------------------
  |  Branch (246:17): [True: 0, False: 3.02M]
  ------------------
  247|      0|                return -1;
  248|  3.02M|            p++;
  249|  3.02M|        }
  250|  4.17k|    }
  251|  4.17k|    return buflen << 1;
  252|  4.17k|}
a_strex.c:do_buf:
  141|  14.2k|{
  142|  14.2k|    int i, outlen, len, charwidth;
  143|  14.2k|    unsigned short orflags;
  144|  14.2k|    unsigned char *p, *q;
  145|  14.2k|    unsigned long c;
  146|       |
  147|  14.2k|    p = buf;
  148|  14.2k|    q = buf + buflen;
  149|  14.2k|    outlen = 0;
  150|  14.2k|    charwidth = type & BUF_TYPE_WIDTH_MASK;
  ------------------
  |  |  129|  14.2k|#define BUF_TYPE_WIDTH_MASK     0x7
  ------------------
  151|       |
  152|  14.2k|    switch (charwidth) {
  153|    920|    case 4:
  ------------------
  |  Branch (153:5): [True: 920, False: 13.2k]
  ------------------
  154|    920|        if (buflen & 3) {
  ------------------
  |  Branch (154:13): [True: 0, False: 920]
  ------------------
  155|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  156|      0|            return -1;
  157|      0|        }
  158|    920|        break;
  159|  9.53k|    case 2:
  ------------------
  |  Branch (159:5): [True: 9.53k, False: 4.67k]
  ------------------
  160|  9.53k|        if (buflen & 1) {
  ------------------
  |  Branch (160:13): [True: 0, False: 9.53k]
  ------------------
  161|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_BMPSTRING_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  162|      0|            return -1;
  163|      0|        }
  164|  9.53k|        break;
  165|  9.53k|    default:
  ------------------
  |  Branch (165:5): [True: 3.75k, False: 10.4k]
  ------------------
  166|  3.75k|        break;
  167|  14.2k|    }
  168|       |
  169|  93.0k|    while (p != q) {
  ------------------
  |  Branch (169:12): [True: 80.2k, False: 12.8k]
  ------------------
  170|  80.2k|        if (p == buf && flags & ASN1_STRFLGS_ESC_2253)
  ------------------
  |  |  440|  11.3k|# define ASN1_STRFLGS_ESC_2253           1
  ------------------
  |  Branch (170:13): [True: 11.3k, False: 68.8k]
  |  Branch (170:25): [True: 9.25k, False: 2.12k]
  ------------------
  171|  9.25k|            orflags = CHARTYPE_FIRST_ESC_2253;
  ------------------
  |  |  461|  9.25k|# define CHARTYPE_FIRST_ESC_2253         0x20
  ------------------
  172|  70.9k|        else
  173|  70.9k|            orflags = 0;
  174|       |
  175|  80.2k|        switch (charwidth) {
  176|    314|        case 4:
  ------------------
  |  Branch (176:9): [True: 314, False: 79.8k]
  ------------------
  177|    314|            c = ((unsigned long)*p++) << 24;
  178|    314|            c |= ((unsigned long)*p++) << 16;
  179|    314|            c |= ((unsigned long)*p++) << 8;
  180|    314|            c |= *p++;
  181|    314|            break;
  182|       |
  183|  72.7k|        case 2:
  ------------------
  |  Branch (183:9): [True: 72.7k, False: 7.48k]
  ------------------
  184|  72.7k|            c = ((unsigned long)*p++) << 8;
  185|  72.7k|            c |= *p++;
  186|  72.7k|            break;
  187|       |
  188|  3.22k|        case 1:
  ------------------
  |  Branch (188:9): [True: 3.22k, False: 76.9k]
  ------------------
  189|  3.22k|            c = *p++;
  190|  3.22k|            break;
  191|       |
  192|  3.94k|        case 0:
  ------------------
  |  Branch (192:9): [True: 3.94k, False: 76.2k]
  ------------------
  193|  3.94k|            i = UTF8_getc(p, buflen, &c);
  194|  3.94k|            if (i < 0)
  ------------------
  |  Branch (194:17): [True: 1.40k, False: 2.54k]
  ------------------
  195|  1.40k|                return -1;      /* Invalid UTF8String */
  196|  2.54k|            buflen -= i;
  197|  2.54k|            p += i;
  198|  2.54k|            break;
  199|      0|        default:
  ------------------
  |  Branch (199:9): [True: 0, False: 80.2k]
  ------------------
  200|      0|            return -1;          /* invalid width */
  201|  80.2k|        }
  202|  78.7k|        if (p == q && flags & ASN1_STRFLGS_ESC_2253)
  ------------------
  |  |  440|  9.98k|# define ASN1_STRFLGS_ESC_2253           1
  ------------------
  |  Branch (202:13): [True: 9.98k, False: 68.8k]
  |  Branch (202:23): [True: 9.25k, False: 722]
  ------------------
  203|  9.25k|            orflags = CHARTYPE_LAST_ESC_2253;
  ------------------
  |  |  463|  9.25k|# define CHARTYPE_LAST_ESC_2253          0x40
  ------------------
  204|  78.7k|        if (type & BUF_TYPE_CONVUTF8) {
  ------------------
  |  |  130|  78.7k|#define BUF_TYPE_CONVUTF8       0x8
  ------------------
  |  Branch (204:13): [True: 73.9k, False: 4.79k]
  ------------------
  205|  73.9k|            unsigned char utfbuf[6];
  206|  73.9k|            int utflen;
  207|  73.9k|            utflen = UTF8_putc(utfbuf, sizeof(utfbuf), c);
  208|   289k|            for (i = 0; i < utflen; i++) {
  ------------------
  |  Branch (208:25): [True: 215k, False: 73.9k]
  ------------------
  209|       |                /*
  210|       |                 * We don't need to worry about setting orflags correctly
  211|       |                 * because if utflen==1 its value will be correct anyway
  212|       |                 * otherwise each character will be > 0x7f and so the
  213|       |                 * character will never be escaped on first and last.
  214|       |                 */
  215|   215k|                len = do_esc_char(utfbuf[i], flags | orflags, quotes,
  216|   215k|                                  io_ch, arg);
  217|   215k|                if (len < 0)
  ------------------
  |  Branch (217:21): [True: 0, False: 215k]
  ------------------
  218|      0|                    return -1;
  219|   215k|                outlen += len;
  220|   215k|            }
  221|  73.9k|        } else {
  222|  4.79k|            len = do_esc_char(c, flags | orflags, quotes,
  223|  4.79k|                              io_ch, arg);
  224|  4.79k|            if (len < 0)
  ------------------
  |  Branch (224:17): [True: 0, False: 4.79k]
  ------------------
  225|      0|                return -1;
  226|  4.79k|            outlen += len;
  227|  4.79k|        }
  228|  78.7k|    }
  229|  12.8k|    return outlen;
  230|  14.2k|}
a_strex.c:do_esc_char:
   68|   220k|{
   69|   220k|    unsigned short chflgs;
   70|   220k|    unsigned char chtmp;
   71|   220k|    char tmphex[HEX_SIZE(long) + 3];
   72|       |
   73|   220k|    if (c > 0xffffffffL)
  ------------------
  |  Branch (73:9): [True: 0, False: 220k]
  ------------------
   74|      0|        return -1;
   75|   220k|    if (c > 0xffff) {
  ------------------
  |  Branch (75:9): [True: 25, False: 220k]
  ------------------
   76|     25|        BIO_snprintf(tmphex, sizeof(tmphex), "\\W%08lX", c);
   77|     25|        if (!io_ch(arg, tmphex, 10))
  ------------------
  |  Branch (77:13): [True: 0, False: 25]
  ------------------
   78|      0|            return -1;
   79|     25|        return 10;
   80|     25|    }
   81|   220k|    if (c > 0xff) {
  ------------------
  |  Branch (81:9): [True: 365, False: 219k]
  ------------------
   82|    365|        BIO_snprintf(tmphex, sizeof(tmphex), "\\U%04lX", c);
   83|    365|        if (!io_ch(arg, tmphex, 6))
  ------------------
  |  Branch (83:13): [True: 0, False: 365]
  ------------------
   84|      0|            return -1;
   85|    365|        return 6;
   86|    365|    }
   87|   219k|    chtmp = (unsigned char)c;
   88|   219k|    if (chtmp > 0x7f)
  ------------------
  |  Branch (88:9): [True: 213k, False: 6.14k]
  ------------------
   89|   213k|        chflgs = flags & ASN1_STRFLGS_ESC_MSB;
  ------------------
  |  |  442|   213k|# define ASN1_STRFLGS_ESC_MSB            4
  ------------------
   90|  6.14k|    else
   91|  6.14k|        chflgs = char_type[chtmp] & flags;
   92|   219k|    if (chflgs & CHARTYPE_BS_ESC) {
  ------------------
  |  |   26|   219k|#define CHARTYPE_BS_ESC         (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
  |  |  ------------------
  |  |  |  |  440|   219k|# define ASN1_STRFLGS_ESC_2253           1
  |  |  ------------------
  |  |               #define CHARTYPE_BS_ESC         (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
  |  |  ------------------
  |  |  |  |  461|   219k|# define CHARTYPE_FIRST_ESC_2253         0x20
  |  |  ------------------
  |  |               #define CHARTYPE_BS_ESC         (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
  |  |  ------------------
  |  |  |  |  463|   219k|# define CHARTYPE_LAST_ESC_2253          0x40
  |  |  ------------------
  ------------------
  |  Branch (92:9): [True: 1.62k, False: 218k]
  ------------------
   93|       |        /* If we don't escape with quotes, signal we need quotes */
   94|  1.62k|        if (chflgs & ASN1_STRFLGS_ESC_QUOTE) {
  ------------------
  |  |  454|  1.62k|# define ASN1_STRFLGS_ESC_QUOTE          8
  ------------------
  |  Branch (94:13): [True: 1.51k, False: 108]
  ------------------
   95|  1.51k|            if (do_quotes)
  ------------------
  |  Branch (95:17): [True: 757, False: 757]
  ------------------
   96|    757|                *do_quotes = 1;
   97|  1.51k|            if (!io_ch(arg, &chtmp, 1))
  ------------------
  |  Branch (97:17): [True: 0, False: 1.51k]
  ------------------
   98|      0|                return -1;
   99|  1.51k|            return 1;
  100|  1.51k|        }
  101|    108|        if (!io_ch(arg, "\\", 1))
  ------------------
  |  Branch (101:13): [True: 0, False: 108]
  ------------------
  102|      0|            return -1;
  103|    108|        if (!io_ch(arg, &chtmp, 1))
  ------------------
  |  Branch (103:13): [True: 0, False: 108]
  ------------------
  104|      0|            return -1;
  105|    108|        return 2;
  106|    108|    }
  107|   218k|    if (chflgs & (ASN1_STRFLGS_ESC_CTRL
  ------------------
  |  |  441|   218k|# define ASN1_STRFLGS_ESC_CTRL           2
  ------------------
  |  Branch (107:9): [True: 215k, False: 2.41k]
  ------------------
  108|   218k|                  | ASN1_STRFLGS_ESC_MSB
  ------------------
  |  |  442|   218k|# define ASN1_STRFLGS_ESC_MSB            4
  ------------------
  109|   218k|                  | ASN1_STRFLGS_ESC_2254)) {
  ------------------
  |  |  508|   218k|#define ASN1_STRFLGS_ESC_2254           0x400
  ------------------
  110|   215k|        BIO_snprintf(tmphex, 11, "\\%02X", chtmp);
  111|   215k|        if (!io_ch(arg, tmphex, 3))
  ------------------
  |  Branch (111:13): [True: 0, False: 215k]
  ------------------
  112|      0|            return -1;
  113|   215k|        return 3;
  114|   215k|    }
  115|       |    /*
  116|       |     * If we get this far and do any escaping at all must escape the escape
  117|       |     * character itself: backslash.
  118|       |     */
  119|  2.41k|    if (chtmp == '\\' && (flags & ESC_FLAGS)) {
  ------------------
  |  |   28|    206|#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
  |  |  ------------------
  |  |  |  |  440|    206|# define ASN1_STRFLGS_ESC_2253           1
  |  |  ------------------
  |  |   29|    206|                  ASN1_STRFLGS_ESC_2254 | \
  |  |  ------------------
  |  |  |  |  508|    206|#define ASN1_STRFLGS_ESC_2254           0x400
  |  |  ------------------
  |  |   30|    206|                  ASN1_STRFLGS_ESC_QUOTE | \
  |  |  ------------------
  |  |  |  |  454|    206|# define ASN1_STRFLGS_ESC_QUOTE          8
  |  |  ------------------
  |  |   31|    206|                  ASN1_STRFLGS_ESC_CTRL | \
  |  |  ------------------
  |  |  |  |  441|    206|# define ASN1_STRFLGS_ESC_CTRL           2
  |  |  ------------------
  |  |   32|    206|                  ASN1_STRFLGS_ESC_MSB)
  |  |  ------------------
  |  |  |  |  442|    206|# define ASN1_STRFLGS_ESC_MSB            4
  |  |  ------------------
  ------------------
  |  Branch (119:9): [True: 206, False: 2.20k]
  |  Branch (119:26): [True: 0, False: 206]
  ------------------
  120|      0|        if (!io_ch(arg, "\\\\", 2))
  ------------------
  |  Branch (120:13): [True: 0, False: 0]
  ------------------
  121|      0|            return -1;
  122|      0|        return 2;
  123|      0|    }
  124|  2.41k|    if (!io_ch(arg, &chtmp, 1))
  ------------------
  |  Branch (124:9): [True: 0, False: 2.41k]
  ------------------
  125|      0|        return -1;
  126|  2.41k|    return 1;
  127|  2.41k|}

ossl_asn1_time_to_tm:
   77|  3.79k|{
   78|  3.79k|    static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 };
   79|  3.79k|    static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 };
   80|  3.79k|    static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
   81|  3.79k|    char *a;
   82|  3.79k|    int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md;
   83|  3.79k|    struct tm tmp;
   84|       |#if defined(CHARSET_EBCDIC)
   85|       |    const char upper_z = 0x5A, num_zero = 0x30, period = 0x2E, minus = 0x2D, plus = 0x2B;
   86|       |#else
   87|  3.79k|    const char upper_z = 'Z', num_zero = '0', period = '.', minus = '-', plus = '+';
   88|  3.79k|#endif
   89|       |    /*
   90|       |     * ASN1_STRING_FLAG_X509_TIME is used to enforce RFC 5280
   91|       |     * time string format, in which:
   92|       |     *
   93|       |     * 1. "seconds" is a 'MUST'
   94|       |     * 2. "Zulu" timezone is a 'MUST'
   95|       |     * 3. "+|-" is not allowed to indicate a timezone
   96|       |     */
   97|  3.79k|    if (d->type == V_ASN1_UTCTIME) {
  ------------------
  |  |   82|  3.79k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (97:9): [True: 623, False: 3.17k]
  ------------------
   98|    623|        if (d->flags & ASN1_STRING_FLAG_X509_TIME) {
  ------------------
  |  |  184|    623|# define ASN1_STRING_FLAG_X509_TIME 0x100
  ------------------
  |  Branch (98:13): [True: 0, False: 623]
  ------------------
   99|      0|            min_l = 13;
  100|      0|            strict = 1;
  101|      0|        }
  102|  3.17k|    } else if (d->type == V_ASN1_GENERALIZEDTIME) {
  ------------------
  |  |   83|  3.17k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (102:16): [True: 3.17k, False: 0]
  ------------------
  103|  3.17k|        end = 7;
  104|  3.17k|        btz = 6;
  105|  3.17k|        if (d->flags & ASN1_STRING_FLAG_X509_TIME) {
  ------------------
  |  |  184|  3.17k|# define ASN1_STRING_FLAG_X509_TIME 0x100
  ------------------
  |  Branch (105:13): [True: 0, False: 3.17k]
  ------------------
  106|      0|            min_l = 15;
  107|      0|            strict = 1;
  108|  3.17k|        } else {
  109|  3.17k|            min_l = 13;
  110|  3.17k|        }
  111|  3.17k|    } else {
  112|      0|        return 0;
  113|      0|    }
  114|       |
  115|  3.79k|    l = d->length;
  116|  3.79k|    a = (char *)d->data;
  117|  3.79k|    o = 0;
  118|  3.79k|    memset(&tmp, 0, sizeof(tmp));
  119|       |
  120|       |    /*
  121|       |     * GENERALIZEDTIME is similar to UTCTIME except the year is represented
  122|       |     * as YYYY. This stuff treats everything as a two digit field so make
  123|       |     * first two fields 00 to 99
  124|       |     */
  125|       |
  126|  3.79k|    if (l < min_l)
  ------------------
  |  Branch (126:9): [True: 711, False: 3.08k]
  ------------------
  127|    711|        goto err;
  128|  16.0k|    for (i = 0; i < end; i++) {
  ------------------
  |  Branch (128:17): [True: 15.4k, False: 667]
  ------------------
  129|  15.4k|        if (!strict && (i == btz) && ((a[o] == upper_z) || (a[o] == plus) || (a[o] == minus))) {
  ------------------
  |  Branch (129:13): [True: 15.4k, False: 0]
  |  Branch (129:24): [True: 1.59k, False: 13.8k]
  |  Branch (129:39): [True: 15, False: 1.58k]
  |  Branch (129:60): [True: 110, False: 1.47k]
  |  Branch (129:78): [True: 653, False: 819]
  ------------------
  130|    778|            i++;
  131|    778|            break;
  132|    778|        }
  133|  14.6k|        if (!ossl_ascii_isdigit(a[o]))
  ------------------
  |  Branch (133:13): [True: 394, False: 14.2k]
  ------------------
  134|    394|            goto err;
  135|  14.2k|        n = a[o] - num_zero;
  136|       |        /* incomplete 2-digital number */
  137|  14.2k|        if (++o == l)
  ------------------
  |  Branch (137:13): [True: 11, False: 14.2k]
  ------------------
  138|     11|            goto err;
  139|       |
  140|  14.2k|        if (!ossl_ascii_isdigit(a[o]))
  ------------------
  |  Branch (140:13): [True: 968, False: 13.2k]
  ------------------
  141|    968|            goto err;
  142|  13.2k|        n = (n * 10) + a[o] - num_zero;
  143|       |        /* no more bytes to read, but we haven't seen time-zone yet */
  144|  13.2k|        if (++o == l)
  ------------------
  |  Branch (144:13): [True: 11, False: 13.2k]
  ------------------
  145|     11|            goto err;
  146|       |
  147|  13.2k|        i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
  ------------------
  |  |   82|  13.2k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (147:14): [True: 1.52k, False: 11.7k]
  ------------------
  148|       |
  149|  13.2k|        if ((n < min[i2]) || (n > max[i2]))
  ------------------
  |  Branch (149:13): [True: 25, False: 13.2k]
  |  Branch (149:30): [True: 215, False: 13.0k]
  ------------------
  150|    240|            goto err;
  151|  13.0k|        switch (i2) {
  ------------------
  |  Branch (151:17): [True: 0, False: 13.0k]
  ------------------
  152|  2.52k|        case 0:
  ------------------
  |  Branch (152:9): [True: 2.52k, False: 10.4k]
  ------------------
  153|       |            /* UTC will never be here */
  154|  2.52k|            tmp.tm_year = n * 100 - 1900;
  155|  2.52k|            break;
  156|  2.67k|        case 1:
  ------------------
  |  Branch (156:9): [True: 2.67k, False: 10.3k]
  ------------------
  157|  2.67k|            if (d->type == V_ASN1_UTCTIME)
  ------------------
  |  |   82|  2.67k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (157:17): [True: 343, False: 2.32k]
  ------------------
  158|    343|                tmp.tm_year = n < 50 ? n + 100 : n;
  ------------------
  |  Branch (158:31): [True: 263, False: 80]
  ------------------
  159|  2.32k|            else
  160|  2.32k|                tmp.tm_year += n;
  161|  2.67k|            break;
  162|  2.13k|        case 2:
  ------------------
  |  Branch (162:9): [True: 2.13k, False: 10.8k]
  ------------------
  163|  2.13k|            tmp.tm_mon = n - 1;
  164|  2.13k|            break;
  165|  1.80k|        case 3:
  ------------------
  |  Branch (165:9): [True: 1.80k, False: 11.2k]
  ------------------
  166|       |            /* check if tm_mday is valid in tm_mon */
  167|  1.80k|            if (tmp.tm_mon == 1) {
  ------------------
  |  Branch (167:17): [True: 398, False: 1.40k]
  ------------------
  168|       |                /* it's February */
  169|    398|                md = mdays[1] + leap_year(tmp.tm_year + 1900);
  170|  1.40k|            } else {
  171|  1.40k|                md = mdays[tmp.tm_mon];
  172|  1.40k|            }
  173|  1.80k|            if (n > md)
  ------------------
  |  Branch (173:17): [True: 19, False: 1.78k]
  ------------------
  174|     19|                goto err;
  175|  1.78k|            tmp.tm_mday = n;
  176|  1.78k|            determine_days(&tmp);
  177|  1.78k|            break;
  178|  1.60k|        case 4:
  ------------------
  |  Branch (178:9): [True: 1.60k, False: 11.3k]
  ------------------
  179|  1.60k|            tmp.tm_hour = n;
  180|  1.60k|            break;
  181|  1.59k|        case 5:
  ------------------
  |  Branch (181:9): [True: 1.59k, False: 11.4k]
  ------------------
  182|  1.59k|            tmp.tm_min = n;
  183|  1.59k|            break;
  184|    667|        case 6:
  ------------------
  |  Branch (184:9): [True: 667, False: 12.3k]
  ------------------
  185|    667|            tmp.tm_sec = n;
  186|    667|            break;
  187|  13.0k|        }
  188|  13.0k|    }
  189|       |
  190|       |    /*
  191|       |     * Optional fractional seconds: decimal point followed by one or more
  192|       |     * digits.
  193|       |     */
  194|  1.44k|    if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == period) {
  ------------------
  |  |   83|  2.89k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (194:9): [True: 1.24k, False: 200]
  |  Branch (194:46): [True: 547, False: 698]
  ------------------
  195|    547|        if (strict)
  ------------------
  |  Branch (195:13): [True: 0, False: 547]
  ------------------
  196|       |            /* RFC 5280 forbids fractional seconds */
  197|      0|            goto err;
  198|    547|        if (++o == l)
  ------------------
  |  Branch (198:13): [True: 6, False: 541]
  ------------------
  199|      6|            goto err;
  200|    541|        i = o;
  201|  5.63k|        while ((o < l) && ossl_ascii_isdigit(a[o]))
  ------------------
  |  Branch (201:16): [True: 5.61k, False: 14]
  |  Branch (201:27): [True: 5.09k, False: 527]
  ------------------
  202|  5.09k|            o++;
  203|       |        /* Must have at least one digit after decimal point */
  204|    541|        if (i == o)
  ------------------
  |  Branch (204:13): [True: 20, False: 521]
  ------------------
  205|     20|            goto err;
  206|       |        /* no more bytes to read, but we haven't seen time-zone yet */
  207|    521|        if (o == l)
  ------------------
  |  Branch (207:13): [True: 14, False: 507]
  ------------------
  208|     14|            goto err;
  209|    521|    }
  210|       |
  211|       |    /*
  212|       |     * 'o' will never point to '\0' at this point, the only chance
  213|       |     * 'o' can point to '\0' is either the subsequent if or the first
  214|       |     * else if is true.
  215|       |     */
  216|  1.40k|    if (a[o] == upper_z) {
  ------------------
  |  Branch (216:9): [True: 128, False: 1.27k]
  ------------------
  217|    128|        o++;
  218|  1.27k|    } else if (!strict && ((a[o] == plus) || (a[o] == minus))) {
  ------------------
  |  Branch (218:16): [True: 1.27k, False: 0]
  |  Branch (218:28): [True: 467, False: 810]
  |  Branch (218:46): [True: 653, False: 157]
  ------------------
  219|  1.12k|        int offsign = a[o] == minus ? 1 : -1;
  ------------------
  |  Branch (219:23): [True: 653, False: 467]
  ------------------
  220|  1.12k|        int offset = 0;
  221|       |
  222|  1.12k|        o++;
  223|       |        /*
  224|       |         * if not equal, no need to do subsequent checks
  225|       |         * since the following for-loop will add 'o' by 4
  226|       |         * and the final return statement will check if 'l'
  227|       |         * and 'o' are equal.
  228|       |         */
  229|  1.12k|        if (o + 4 != l)
  ------------------
  |  Branch (229:13): [True: 32, False: 1.08k]
  ------------------
  230|     32|            goto err;
  231|  2.72k|        for (i = end; i < end + 2; i++) {
  ------------------
  |  Branch (231:23): [True: 1.97k, False: 749]
  ------------------
  232|  1.97k|            if (!ossl_ascii_isdigit(a[o]))
  ------------------
  |  Branch (232:17): [True: 126, False: 1.84k]
  ------------------
  233|    126|                goto err;
  234|  1.84k|            n = a[o] - num_zero;
  235|  1.84k|            o++;
  236|  1.84k|            if (!ossl_ascii_isdigit(a[o]))
  ------------------
  |  Branch (236:17): [True: 170, False: 1.67k]
  ------------------
  237|    170|                goto err;
  238|  1.67k|            n = (n * 10) + a[o] - num_zero;
  239|  1.67k|            i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i;
  ------------------
  |  |   82|  1.67k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (239:18): [True: 315, False: 1.36k]
  ------------------
  240|  1.67k|            if ((n < min[i2]) || (n > max[i2]))
  ------------------
  |  Branch (240:17): [True: 0, False: 1.67k]
  |  Branch (240:34): [True: 43, False: 1.63k]
  ------------------
  241|     43|                goto err;
  242|       |            /* if tm is NULL, no need to adjust */
  243|  1.63k|            if (tm != NULL) {
  ------------------
  |  Branch (243:17): [True: 1.63k, False: 0]
  ------------------
  244|  1.63k|                if (i == end)
  ------------------
  |  Branch (244:21): [True: 883, False: 749]
  ------------------
  245|    883|                    offset = n * 3600;
  246|    749|                else if (i == end + 1)
  ------------------
  |  Branch (246:26): [True: 749, False: 0]
  ------------------
  247|    749|                    offset += n * 60;
  248|  1.63k|            }
  249|  1.63k|            o++;
  250|  1.63k|        }
  251|    749|        if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign))
  ------------------
  |  Branch (251:13): [True: 720, False: 29]
  |  Branch (251:23): [True: 58, False: 662]
  ------------------
  252|     58|            goto err;
  253|    749|    } else {
  254|       |        /* not Z, or not +/- in non-strict mode */
  255|    157|        goto err;
  256|    157|    }
  257|    819|    if (o == l) {
  ------------------
  |  Branch (257:9): [True: 779, False: 40]
  ------------------
  258|       |        /* success, check if tm should be filled */
  259|    779|        if (tm != NULL)
  ------------------
  |  Branch (259:13): [True: 779, False: 0]
  ------------------
  260|    779|            *tm = tmp;
  261|    779|        return 1;
  262|    779|    }
  263|  3.02k| err:
  264|  3.02k|    return 0;
  265|    819|}
ASN1_TIME_print:
  473|  3.79k|{
  474|  3.79k|    return ASN1_TIME_print_ex(bp, tm, ASN1_DTFLGS_RFC822);
  ------------------
  |  |  446|  3.79k|# define ASN1_DTFLGS_RFC822       0x00UL
  ------------------
  475|  3.79k|}
ASN1_TIME_print_ex:
  479|  3.79k|{
  480|  3.79k|    return ossl_asn1_time_print_ex(bp, tm, flags) > 0;
  481|  3.79k|}
ossl_asn1_time_print_ex:
  487|  3.79k|{
  488|  3.79k|    char *v;
  489|  3.79k|    int gmt = 0, l;
  490|  3.79k|    struct tm stm;
  491|  3.79k|    const char upper_z = 0x5A, period = 0x2E;
  492|       |
  493|       |    /* ossl_asn1_time_to_tm will check the time type */
  494|  3.79k|    if (!ossl_asn1_time_to_tm(&stm, tm))
  ------------------
  |  Branch (494:9): [True: 3.02k, False: 779]
  ------------------
  495|  3.02k|        return BIO_write(bp, "Bad time value", 14) ? -1 : 0;
  ------------------
  |  Branch (495:16): [True: 3.02k, False: 0]
  ------------------
  496|       |
  497|    779|    l = tm->length;
  498|    779|    v = (char *)tm->data;
  499|    779|    if (v[l - 1] == upper_z)
  ------------------
  |  Branch (499:9): [True: 88, False: 691]
  ------------------
  500|     88|        gmt = 1;
  501|       |
  502|    779|    if (tm->type == V_ASN1_GENERALIZEDTIME) {
  ------------------
  |  |   83|    779|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (502:9): [True: 624, False: 155]
  ------------------
  503|    624|        char *f = NULL;
  504|    624|        int f_len = 0;
  505|       |
  506|       |        /*
  507|       |         * Try to parse fractional seconds. '14' is the place of
  508|       |         * 'fraction point' in a GeneralizedTime string.
  509|       |         */
  510|    624|        if (tm->length > 15 && v[14] == period) {
  ------------------
  |  Branch (510:13): [True: 613, False: 11]
  |  Branch (510:32): [True: 409, False: 204]
  ------------------
  511|    409|            f = &v[14];
  512|    409|            f_len = 1;
  513|  4.47k|            while (14 + f_len < l && ossl_ascii_isdigit(f[f_len]))
  ------------------
  |  Branch (513:20): [True: 4.47k, False: 0]
  |  Branch (513:38): [True: 4.07k, False: 409]
  ------------------
  514|  4.07k|                ++f_len;
  515|    409|        }
  516|       |
  517|    624|        if ((flags & ASN1_DTFLGS_TYPE_MASK) == ASN1_DTFLGS_ISO8601) {
  ------------------
  |  |  445|    624|# define ASN1_DTFLGS_TYPE_MASK    0x0FUL
  ------------------
                      if ((flags & ASN1_DTFLGS_TYPE_MASK) == ASN1_DTFLGS_ISO8601) {
  ------------------
  |  |  447|    624|# define ASN1_DTFLGS_ISO8601      0x01UL
  ------------------
  |  Branch (517:13): [True: 0, False: 624]
  ------------------
  518|      0|            return BIO_printf(bp, "%4d-%02d-%02d %02d:%02d:%02d%.*s%s",
  519|      0|                          stm.tm_year + 1900, stm.tm_mon + 1,
  520|      0|                          stm.tm_mday, stm.tm_hour,
  521|      0|                          stm.tm_min, stm.tm_sec, f_len, f,
  522|      0|                          (gmt ? "Z" : "")) > 0;
  ------------------
  |  Branch (522:28): [True: 0, False: 0]
  ------------------
  523|      0|        }
  524|    624|        else {
  525|    624|            return BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
  526|    624|                          _asn1_mon[stm.tm_mon], stm.tm_mday, stm.tm_hour,
  527|    624|                          stm.tm_min, stm.tm_sec, f_len, f, stm.tm_year + 1900,
  528|    624|                          (gmt ? " GMT" : "")) > 0;
  ------------------
  |  Branch (528:28): [True: 87, False: 537]
  ------------------
  529|    624|        }
  530|    624|    } else {
  531|    155|        if ((flags & ASN1_DTFLGS_TYPE_MASK) == ASN1_DTFLGS_ISO8601) {
  ------------------
  |  |  445|    155|# define ASN1_DTFLGS_TYPE_MASK    0x0FUL
  ------------------
                      if ((flags & ASN1_DTFLGS_TYPE_MASK) == ASN1_DTFLGS_ISO8601) {
  ------------------
  |  |  447|    155|# define ASN1_DTFLGS_ISO8601      0x01UL
  ------------------
  |  Branch (531:13): [True: 0, False: 155]
  ------------------
  532|      0|            return BIO_printf(bp, "%4d-%02d-%02d %02d:%02d:%02d%s",
  533|      0|                          stm.tm_year + 1900, stm.tm_mon + 1,
  534|      0|                          stm.tm_mday, stm.tm_hour,
  535|      0|                          stm.tm_min, stm.tm_sec,
  536|      0|                          (gmt ? "Z" : "")) > 0;
  ------------------
  |  Branch (536:28): [True: 0, False: 0]
  ------------------
  537|      0|        }
  538|    155|        else {
  539|    155|            return BIO_printf(bp, "%s %2d %02d:%02d:%02d %d%s",
  540|    155|                          _asn1_mon[stm.tm_mon], stm.tm_mday, stm.tm_hour,
  541|    155|                          stm.tm_min, stm.tm_sec, stm.tm_year + 1900,
  542|    155|                          (gmt ? " GMT" : "")) > 0;
  ------------------
  |  Branch (542:28): [True: 1, False: 154]
  ------------------
  543|    155|        }
  544|    155|    }
  545|    779|}
a_time.c:leap_year:
   38|  1.69k|{
   39|  1.69k|    if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
  ------------------
  |  Branch (39:9): [True: 217, False: 1.48k]
  |  Branch (39:29): [True: 1.25k, False: 230]
  |  Branch (39:48): [True: 131, False: 1.11k]
  ------------------
   40|    348|        return 1;
   41|  1.34k|    return 0;
   42|  1.69k|}
a_time.c:determine_days:
   51|  1.78k|{
   52|  1.78k|    static const int ydays[12] = {
   53|  1.78k|        0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
   54|  1.78k|    };
   55|  1.78k|    int y = tm->tm_year + 1900;
   56|  1.78k|    int m = tm->tm_mon;
   57|  1.78k|    int d = tm->tm_mday;
   58|  1.78k|    int c;
   59|       |
   60|  1.78k|    tm->tm_yday = ydays[m] + d - 1;
   61|  1.78k|    if (m >= 2) {
  ------------------
  |  Branch (61:9): [True: 1.29k, False: 484]
  ------------------
   62|       |        /* March and onwards can be one day further into the year */
   63|  1.29k|        tm->tm_yday += leap_year(y);
   64|  1.29k|        m += 2;
   65|  1.29k|    } else {
   66|       |        /* Treat January and February as part of the previous year */
   67|    484|        m += 14;
   68|    484|        y--;
   69|    484|    }
   70|  1.78k|    c = y / 100;
   71|  1.78k|    y %= 100;
   72|       |    /* Zeller's congruence */
   73|  1.78k|    tm->tm_wday = (d + (13 * m) / 5 + y + y / 4 + c / 4 + 5 * c + 6) % 7;
   74|  1.78k|}

ASN1_TYPE_set:
   27|  2.64M|{
   28|  2.64M|    if (a->type != V_ASN1_BOOLEAN
  ------------------
  |  |   63|  5.29M|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (28:9): [True: 2.64M, False: 0]
  ------------------
   29|  2.64M|            && a->type != V_ASN1_NULL
  ------------------
  |  |   67|  5.29M|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (29:16): [True: 2.64M, False: 0]
  ------------------
   30|  2.64M|            && a->value.ptr != NULL) {
  ------------------
  |  Branch (30:16): [True: 0, False: 2.64M]
  ------------------
   31|      0|        ASN1_TYPE **tmp_a = &a;
   32|      0|        ossl_asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL, 0);
   33|      0|    }
   34|  2.64M|    a->type = type;
   35|  2.64M|    if (type == V_ASN1_BOOLEAN)
  ------------------
  |  |   63|  2.64M|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (35:9): [True: 985, False: 2.64M]
  ------------------
   36|    985|        a->value.boolean = value ? 0xff : 0;
  ------------------
  |  Branch (36:28): [True: 0, False: 985]
  ------------------
   37|  2.64M|    else
   38|  2.64M|        a->value.ptr = value;
   39|  2.64M|}
ASN1_TYPE_unpack_sequence:
  134|  3.47k|{
  135|  3.47k|    if (t == NULL || t->type != V_ASN1_SEQUENCE || t->value.sequence == NULL)
  ------------------
  |  |   74|  6.94k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (135:9): [True: 0, False: 3.47k]
  |  Branch (135:22): [True: 0, False: 3.47k]
  |  Branch (135:52): [True: 0, False: 3.47k]
  ------------------
  136|      0|        return NULL;
  137|  3.47k|    return ASN1_item_unpack(t->value.sequence, it);
  138|  3.47k|}

ASN1_UTCTIME_print:
   97|    623|{
   98|    623|    if (tm->type != V_ASN1_UTCTIME)
  ------------------
  |  |   82|    623|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (98:9): [True: 0, False: 623]
  ------------------
   99|      0|        return 0;
  100|    623|    return ASN1_TIME_print(bp, tm);
  101|    623|}

UTF8_getc:
   29|  8.97k|{
   30|  8.97k|    const unsigned char *p;
   31|  8.97k|    unsigned long value;
   32|  8.97k|    int ret;
   33|  8.97k|    if (len <= 0)
  ------------------
  |  Branch (33:9): [True: 0, False: 8.97k]
  ------------------
   34|      0|        return 0;
   35|  8.97k|    p = str;
   36|       |
   37|       |    /* Check syntax and work out the encoded value (if correct) */
   38|  8.97k|    if ((*p & 0x80) == 0) {
  ------------------
  |  Branch (38:9): [True: 6.12k, False: 2.85k]
  ------------------
   39|  6.12k|        value = *p++ & 0x7f;
   40|  6.12k|        ret = 1;
   41|  6.12k|    } else if ((*p & 0xe0) == 0xc0) {
  ------------------
  |  Branch (41:16): [True: 1.05k, False: 1.80k]
  ------------------
   42|  1.05k|        if (len < 2)
  ------------------
  |  Branch (42:13): [True: 132, False: 918]
  ------------------
   43|    132|            return -1;
   44|    918|        if ((p[1] & 0xc0) != 0x80)
  ------------------
  |  Branch (44:13): [True: 541, False: 377]
  ------------------
   45|    541|            return -3;
   46|    377|        value = (*p++ & 0x1f) << 6;
   47|    377|        value |= *p++ & 0x3f;
   48|    377|        if (value < 0x80)
  ------------------
  |  Branch (48:13): [True: 196, False: 181]
  ------------------
   49|    196|            return -4;
   50|    181|        ret = 2;
   51|  1.80k|    } else if ((*p & 0xf0) == 0xe0) {
  ------------------
  |  Branch (51:16): [True: 630, False: 1.17k]
  ------------------
   52|    630|        if (len < 3)
  ------------------
  |  Branch (52:13): [True: 39, False: 591]
  ------------------
   53|     39|            return -1;
   54|    591|        if (((p[1] & 0xc0) != 0x80)
  ------------------
  |  Branch (54:13): [True: 20, False: 571]
  ------------------
   55|    591|            || ((p[2] & 0xc0) != 0x80))
  ------------------
  |  Branch (55:16): [True: 70, False: 501]
  ------------------
   56|     90|            return -3;
   57|    501|        value = (*p++ & 0xf) << 12;
   58|    501|        value |= (*p++ & 0x3f) << 6;
   59|    501|        value |= *p++ & 0x3f;
   60|    501|        if (value < 0x800)
  ------------------
  |  Branch (60:13): [True: 67, False: 434]
  ------------------
   61|     67|            return -4;
   62|    434|        if (is_unicode_surrogate(value))
  ------------------
  |  Branch (62:13): [True: 8, False: 426]
  ------------------
   63|      8|            return -2;
   64|    426|        ret = 3;
   65|  1.17k|    } else if ((*p & 0xf8) == 0xf0) {
  ------------------
  |  Branch (65:16): [True: 858, False: 314]
  ------------------
   66|    858|        if (len < 4)
  ------------------
  |  Branch (66:13): [True: 74, False: 784]
  ------------------
   67|     74|            return -1;
   68|    784|        if (((p[1] & 0xc0) != 0x80)
  ------------------
  |  Branch (68:13): [True: 73, False: 711]
  ------------------
   69|    784|            || ((p[2] & 0xc0) != 0x80)
  ------------------
  |  Branch (69:16): [True: 58, False: 653]
  ------------------
   70|    784|            || ((p[3] & 0xc0) != 0x80))
  ------------------
  |  Branch (70:16): [True: 195, False: 458]
  ------------------
   71|    326|            return -3;
   72|    458|        value = ((unsigned long)(*p++ & 0x7)) << 18;
   73|    458|        value |= (*p++ & 0x3f) << 12;
   74|    458|        value |= (*p++ & 0x3f) << 6;
   75|    458|        value |= *p++ & 0x3f;
   76|    458|        if (value < 0x10000)
  ------------------
  |  Branch (76:13): [True: 225, False: 233]
  ------------------
   77|    225|            return -4;
   78|    233|        ret = 4;
   79|    233|    } else
   80|    314|        return -2;
   81|  6.96k|    *val = value;
   82|  6.96k|    return ret;
   83|  8.97k|}
UTF8_putc:
   94|  6.76M|{
   95|  6.76M|    if (!str)
  ------------------
  |  Branch (95:9): [True: 3.34M, False: 3.42M]
  ------------------
   96|  3.34M|        len = 4;                /* Maximum we will need */
   97|  3.42M|    else if (len <= 0)
  ------------------
  |  Branch (97:14): [True: 0, False: 3.42M]
  ------------------
   98|      0|        return -1;
   99|  6.76M|    if (value < 0x80) {
  ------------------
  |  Branch (99:9): [True: 448k, False: 6.32M]
  ------------------
  100|   448k|        if (str)
  ------------------
  |  Branch (100:13): [True: 225k, False: 223k]
  ------------------
  101|   225k|            *str = (unsigned char)value;
  102|   448k|        return 1;
  103|   448k|    }
  104|  6.32M|    if (value < 0x800) {
  ------------------
  |  Branch (104:9): [True: 6.24M, False: 74.0k]
  ------------------
  105|  6.24M|        if (len < 2)
  ------------------
  |  Branch (105:13): [True: 0, False: 6.24M]
  ------------------
  106|      0|            return -1;
  107|  6.24M|        if (str) {
  ------------------
  |  Branch (107:13): [True: 3.12M, False: 3.12M]
  ------------------
  108|  3.12M|            *str++ = (unsigned char)(((value >> 6) & 0x1f) | 0xc0);
  109|  3.12M|            *str = (unsigned char)((value & 0x3f) | 0x80);
  110|  3.12M|        }
  111|  6.24M|        return 2;
  112|  6.24M|    }
  113|  74.0k|    if (value < 0x10000) {
  ------------------
  |  Branch (113:9): [True: 73.5k, False: 416]
  ------------------
  114|  73.5k|        if (is_unicode_surrogate(value))
  ------------------
  |  Branch (114:13): [True: 38, False: 73.5k]
  ------------------
  115|     38|            return -2;
  116|  73.5k|        if (len < 3)
  ------------------
  |  Branch (116:13): [True: 0, False: 73.5k]
  ------------------
  117|      0|            return -1;
  118|  73.5k|        if (str) {
  ------------------
  |  Branch (118:13): [True: 72.1k, False: 1.41k]
  ------------------
  119|  72.1k|            *str++ = (unsigned char)(((value >> 12) & 0xf) | 0xe0);
  120|  72.1k|            *str++ = (unsigned char)(((value >> 6) & 0x3f) | 0x80);
  121|  72.1k|            *str = (unsigned char)((value & 0x3f) | 0x80);
  122|  72.1k|        }
  123|  73.5k|        return 3;
  124|  73.5k|    }
  125|    416|    if (value < UNICODE_LIMIT) {
  ------------------
  |  Branch (125:9): [True: 122, False: 294]
  ------------------
  126|    122|        if (len < 4)
  ------------------
  |  Branch (126:13): [True: 0, False: 122]
  ------------------
  127|      0|            return -1;
  128|    122|        if (str) {
  ------------------
  |  Branch (128:13): [True: 63, False: 59]
  ------------------
  129|     63|            *str++ = (unsigned char)(((value >> 18) & 0x7) | 0xf0);
  130|     63|            *str++ = (unsigned char)(((value >> 12) & 0x3f) | 0x80);
  131|     63|            *str++ = (unsigned char)(((value >> 6) & 0x3f) | 0x80);
  132|     63|            *str = (unsigned char)((value & 0x3f) | 0x80);
  133|     63|        }
  134|    122|        return 4;
  135|    122|    }
  136|    294|    return -2;
  137|    416|}

EVP_PKEY_asn1_get_count:
   39|  70.0k|{
   40|  70.0k|    int num = OSSL_NELEM(standard_methods);
  ------------------
  |  |   14|  70.0k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   41|  70.0k|    if (app_methods)
  ------------------
  |  Branch (41:9): [True: 0, False: 70.0k]
  ------------------
   42|      0|        num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
   43|  70.0k|    return num;
   44|  70.0k|}
EVP_PKEY_asn1_get0:
   47|   883k|{
   48|   883k|    int num = OSSL_NELEM(standard_methods);
  ------------------
  |  |   14|   883k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   49|   883k|    if (idx < 0)
  ------------------
  |  Branch (49:9): [True: 0, False: 883k]
  ------------------
   50|      0|        return NULL;
   51|   883k|    if (idx < num)
  ------------------
  |  Branch (51:9): [True: 883k, False: 0]
  ------------------
   52|   883k|        return standard_methods[idx];
   53|      0|    idx -= num;
   54|      0|    return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
   55|   883k|}
EVP_PKEY_asn1_find:
   82|  63.5k|{
   83|  63.5k|    const EVP_PKEY_ASN1_METHOD *t;
   84|       |
   85|  65.7k|    for (;;) {
   86|  65.7k|        t = pkey_asn1_find(type);
   87|  65.7k|        if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))
  ------------------
  |  | 1549|  65.7k|# define ASN1_PKEY_ALIAS         0x1
  ------------------
  |  Branch (87:13): [True: 16, False: 65.7k]
  |  Branch (87:19): [True: 63.4k, False: 2.28k]
  ------------------
   88|  63.5k|            break;
   89|  2.28k|        type = t->pkey_base_id;
   90|  2.28k|    }
   91|  63.5k|    if (pe) {
  ------------------
  |  Branch (91:9): [True: 63.5k, False: 0]
  ------------------
   92|  63.5k|#ifndef OPENSSL_NO_ENGINE
   93|  63.5k|        ENGINE *e;
   94|       |        /* type will contain the final unaliased type */
   95|  63.5k|        e = ENGINE_get_pkey_asn1_meth_engine(type);
   96|  63.5k|        if (e) {
  ------------------
  |  Branch (96:13): [True: 0, False: 63.5k]
  ------------------
   97|      0|            *pe = e;
   98|      0|            return ENGINE_get_pkey_asn1_meth(e, type);
   99|      0|        }
  100|  63.5k|#endif
  101|  63.5k|        *pe = NULL;
  102|  63.5k|    }
  103|  63.5k|    return t;
  104|  63.5k|}
EVP_PKEY_asn1_find_str:
  108|  70.0k|{
  109|  70.0k|    int i;
  110|  70.0k|    const EVP_PKEY_ASN1_METHOD *ameth = NULL;
  111|       |
  112|  70.0k|    if (len == -1)
  ------------------
  |  Branch (112:9): [True: 0, False: 70.0k]
  ------------------
  113|      0|        len = strlen(str);
  114|  70.0k|    if (pe) {
  ------------------
  |  Branch (114:9): [True: 70.0k, False: 0]
  ------------------
  115|  70.0k|#ifndef OPENSSL_NO_ENGINE
  116|  70.0k|        ENGINE *e;
  117|  70.0k|        ameth = ENGINE_pkey_asn1_find_str(&e, str, len);
  118|  70.0k|        if (ameth) {
  ------------------
  |  Branch (118:13): [True: 0, False: 70.0k]
  ------------------
  119|       |            /*
  120|       |             * Convert structural into functional reference
  121|       |             */
  122|      0|            if (!ENGINE_init(e))
  ------------------
  |  Branch (122:17): [True: 0, False: 0]
  ------------------
  123|      0|                ameth = NULL;
  124|      0|            ENGINE_free(e);
  125|      0|            *pe = e;
  126|      0|            return ameth;
  127|      0|        }
  128|  70.0k|#endif
  129|  70.0k|        *pe = NULL;
  130|  70.0k|    }
  131|   923k|    for (i = EVP_PKEY_asn1_get_count(); i-- > 0; ) {
  ------------------
  |  Branch (131:41): [True: 883k, False: 40.0k]
  ------------------
  132|   883k|        ameth = EVP_PKEY_asn1_get0(i);
  133|   883k|        if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
  ------------------
  |  | 1549|   883k|# define ASN1_PKEY_ALIAS         0x1
  ------------------
  |  Branch (133:13): [True: 275k, False: 607k]
  ------------------
  134|   275k|            continue;
  135|   607k|        if ((int)strlen(ameth->pem_str) == len
  ------------------
  |  Branch (135:13): [True: 40.6k, False: 567k]
  ------------------
  136|   607k|            && OPENSSL_strncasecmp(ameth->pem_str, str, len) == 0)
  ------------------
  |  Branch (136:16): [True: 29.9k, False: 10.6k]
  ------------------
  137|  29.9k|            return ameth;
  138|   607k|    }
  139|  40.0k|    return NULL;
  140|  70.0k|}
EVP_PKEY_asn1_get0_info:
  199|     16|{
  200|     16|    if (!ameth)
  ------------------
  |  Branch (200:9): [True: 0, False: 16]
  ------------------
  201|      0|        return 0;
  202|     16|    if (ppkey_id)
  ------------------
  |  Branch (202:9): [True: 16, False: 0]
  ------------------
  203|     16|        *ppkey_id = ameth->pkey_id;
  204|     16|    if (ppkey_base_id)
  ------------------
  |  Branch (204:9): [True: 16, False: 0]
  ------------------
  205|     16|        *ppkey_base_id = ameth->pkey_base_id;
  206|     16|    if (ppkey_flags)
  ------------------
  |  Branch (206:9): [True: 16, False: 0]
  ------------------
  207|     16|        *ppkey_flags = ameth->pkey_flags;
  208|     16|    if (pinfo)
  ------------------
  |  Branch (208:9): [True: 0, False: 16]
  ------------------
  209|      0|        *pinfo = ameth->info;
  210|     16|    if (ppem_str)
  ------------------
  |  Branch (210:9): [True: 16, False: 0]
  ------------------
  211|     16|        *ppem_str = ameth->pem_str;
  212|     16|    return 1;
  213|     16|}
ameth_lib.c:pkey_asn1_find:
   58|  65.7k|{
   59|  65.7k|    EVP_PKEY_ASN1_METHOD tmp;
   60|  65.7k|    const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;
   61|       |
   62|  65.7k|    tmp.pkey_id = type;
   63|  65.7k|    if (app_methods) {
  ------------------
  |  Branch (63:9): [True: 0, False: 65.7k]
  ------------------
   64|      0|        int idx;
   65|      0|        idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
   66|      0|        if (idx >= 0)
  ------------------
  |  Branch (66:13): [True: 0, False: 0]
  ------------------
   67|      0|            return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
   68|      0|    }
   69|  65.7k|    ret = OBJ_bsearch_ameth(&t, standard_methods, OSSL_NELEM(standard_methods));
  ------------------
  |  |   14|  65.7k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   70|  65.7k|    if (ret == NULL || *ret == NULL)
  ------------------
  |  Branch (70:9): [True: 16, False: 65.7k]
  |  Branch (70:24): [True: 0, False: 65.7k]
  ------------------
   71|     16|        return NULL;
   72|  65.7k|    return *ret;
   73|  65.7k|}
ameth_lib.c:ameth_cmp:
   31|   160k|{
   32|   160k|    return ((*a)->pkey_id - (*b)->pkey_id);
   33|   160k|}

ossl_err_load_ASN1_strings:
  206|      2|{
  207|      2|#ifndef OPENSSL_NO_ERR
  208|      2|    if (ERR_reason_error_string(ASN1_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (208:9): [True: 2, False: 0]
  ------------------
  209|      2|        ERR_load_strings_const(ASN1_str_reasons);
  210|      2|#endif
  211|      2|    return 1;
  212|      2|}

ASN1_get_object:
   48|   172M|{
   49|   172M|    int i, ret;
   50|   172M|    long len;
   51|   172M|    const unsigned char *p = *pp;
   52|   172M|    int tag, xclass, inf;
   53|   172M|    long max = omax;
   54|       |
   55|   172M|    if (omax <= 0) {
  ------------------
  |  Branch (55:9): [True: 0, False: 172M]
  ------------------
   56|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   57|      0|        return 0x80;
   58|      0|    }
   59|   172M|    ret = (*p & V_ASN1_CONSTRUCTED);
  ------------------
  |  |   52|   172M|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
   60|   172M|    xclass = (*p & V_ASN1_PRIVATE);
  ------------------
  |  |   50|   172M|# define V_ASN1_PRIVATE                  0xc0
  ------------------
   61|   172M|    i = *p & V_ASN1_PRIMITIVE_TAG;
  ------------------
  |  |   53|   172M|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
   62|   172M|    if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */
  ------------------
  |  |   53|   172M|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
  |  Branch (62:9): [True: 345k, False: 171M]
  ------------------
   63|   345k|        p++;
   64|   345k|        if (--max == 0)
  ------------------
  |  Branch (64:13): [True: 1.35k, False: 344k]
  ------------------
   65|  1.35k|            goto err;
   66|   344k|        len = 0;
   67|   787k|        while (*p & 0x80) {
  ------------------
  |  Branch (67:16): [True: 446k, False: 340k]
  ------------------
   68|   446k|            len <<= 7L;
   69|   446k|            len |= *(p++) & 0x7f;
   70|   446k|            if (--max == 0)
  ------------------
  |  Branch (70:17): [True: 1.94k, False: 444k]
  ------------------
   71|  1.94k|                goto err;
   72|   444k|            if (len > (INT_MAX >> 7L))
  ------------------
  |  Branch (72:17): [True: 1.20k, False: 443k]
  ------------------
   73|  1.20k|                goto err;
   74|   444k|        }
   75|   340k|        len <<= 7L;
   76|   340k|        len |= *(p++) & 0x7f;
   77|   340k|        tag = (int)len;
   78|   340k|        if (--max == 0)
  ------------------
  |  Branch (78:13): [True: 1.39k, False: 339k]
  ------------------
   79|  1.39k|            goto err;
   80|   171M|    } else {
   81|   171M|        tag = i;
   82|   171M|        p++;
   83|   171M|        if (--max == 0)
  ------------------
  |  Branch (83:13): [True: 17.5k, False: 171M]
  ------------------
   84|  17.5k|            goto err;
   85|   171M|    }
   86|   172M|    *ptag = tag;
   87|   172M|    *pclass = xclass;
   88|   172M|    if (!asn1_get_length(&p, &inf, plength, max))
  ------------------
  |  Branch (88:9): [True: 34.1k, False: 172M]
  ------------------
   89|  34.1k|        goto err;
   90|       |
   91|   172M|    if (inf && !(ret & V_ASN1_CONSTRUCTED))
  ------------------
  |  |   52|  33.5M|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (91:9): [True: 33.5M, False: 138M]
  |  Branch (91:16): [True: 1.70k, False: 33.5M]
  ------------------
   92|  1.70k|        goto err;
   93|       |
   94|   172M|    if (*plength > (omax - (p - *pp))) {
  ------------------
  |  Branch (94:9): [True: 4.10M, False: 168M]
  ------------------
   95|  4.10M|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  401|  4.10M|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  4.10M|    (ERR_new(),                                                 \
  |  |  |  |  404|  4.10M|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  4.10M|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  4.10M|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  4.10M|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  4.10M|     ERR_set_error)
  |  |  ------------------
  ------------------
   96|       |        /*
   97|       |         * Set this so that even if things are not long enough the values are
   98|       |         * set correctly
   99|       |         */
  100|  4.10M|        ret |= 0x80;
  101|  4.10M|    }
  102|   172M|    *pp = p;
  103|   172M|    return ret | inf;
  104|  59.2k| err:
  105|  59.2k|    ERR_raise(ERR_LIB_ASN1, ASN1_R_HEADER_TOO_LONG);
  ------------------
  |  |  401|  59.2k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  59.2k|    (ERR_new(),                                                 \
  |  |  |  |  404|  59.2k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  59.2k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  59.2k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  59.2k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  59.2k|     ERR_set_error)
  |  |  ------------------
  ------------------
  106|  59.2k|    return 0x80;
  107|   172M|}
ASN1_put_object:
  162|  1.69M|{
  163|  1.69M|    unsigned char *p = *pp;
  164|  1.69M|    int i, ttag;
  165|       |
  166|  1.69M|    i = (constructed) ? V_ASN1_CONSTRUCTED : 0;
  ------------------
  |  |   52|   604k|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (166:9): [True: 604k, False: 1.09M]
  ------------------
  167|  1.69M|    i |= (xclass & V_ASN1_PRIVATE);
  ------------------
  |  |   50|  1.69M|# define V_ASN1_PRIVATE                  0xc0
  ------------------
  168|  1.69M|    if (tag < 31) {
  ------------------
  |  Branch (168:9): [True: 1.69M, False: 961]
  ------------------
  169|  1.69M|        *(p++) = i | (tag & V_ASN1_PRIMITIVE_TAG);
  ------------------
  |  |   53|  1.69M|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
  170|  1.69M|    } else {
  171|    961|        *(p++) = i | V_ASN1_PRIMITIVE_TAG;
  ------------------
  |  |   53|    961|# define V_ASN1_PRIMITIVE_TAG            0x1f
  ------------------
  172|  3.77k|        for (i = 0, ttag = tag; ttag > 0; i++)
  ------------------
  |  Branch (172:33): [True: 2.81k, False: 961]
  ------------------
  173|  2.81k|            ttag >>= 7;
  174|    961|        ttag = i;
  175|  3.77k|        while (i-- > 0) {
  ------------------
  |  Branch (175:16): [True: 2.81k, False: 961]
  ------------------
  176|  2.81k|            p[i] = tag & 0x7f;
  177|  2.81k|            if (i != (ttag - 1))
  ------------------
  |  Branch (177:17): [True: 1.85k, False: 961]
  ------------------
  178|  1.85k|                p[i] |= 0x80;
  179|  2.81k|            tag >>= 7;
  180|  2.81k|        }
  181|    961|        p += ttag;
  182|    961|    }
  183|  1.69M|    if (constructed == 2)
  ------------------
  |  Branch (183:9): [True: 0, False: 1.69M]
  ------------------
  184|      0|        *(p++) = 0x80;
  185|  1.69M|    else
  186|  1.69M|        asn1_put_length(&p, length);
  187|  1.69M|    *pp = p;
  188|  1.69M|}
ASN1_object_size:
  223|  6.70M|{
  224|  6.70M|    int ret = 1;
  225|       |
  226|  6.70M|    if (length < 0)
  ------------------
  |  Branch (226:9): [True: 0, False: 6.70M]
  ------------------
  227|      0|        return -1;
  228|  6.70M|    if (tag >= 31) {
  ------------------
  |  Branch (228:9): [True: 3.67k, False: 6.69M]
  ------------------
  229|  14.4k|        while (tag > 0) {
  ------------------
  |  Branch (229:16): [True: 10.7k, False: 3.67k]
  ------------------
  230|  10.7k|            tag >>= 7;
  231|  10.7k|            ret++;
  232|  10.7k|        }
  233|  3.67k|    }
  234|  6.70M|    if (constructed == 2) {
  ------------------
  |  Branch (234:9): [True: 0, False: 6.70M]
  ------------------
  235|      0|        ret += 3;
  236|  6.70M|    } else {
  237|  6.70M|        ret++;
  238|  6.70M|        if (length > 127) {
  ------------------
  |  Branch (238:13): [True: 179k, False: 6.52M]
  ------------------
  239|   179k|            int tmplen = length;
  240|   452k|            while (tmplen > 0) {
  ------------------
  |  Branch (240:20): [True: 272k, False: 179k]
  ------------------
  241|   272k|                tmplen >>= 8;
  242|   272k|                ret++;
  243|   272k|            }
  244|   179k|        }
  245|  6.70M|    }
  246|  6.70M|    if (ret >= INT_MAX - length)
  ------------------
  |  Branch (246:9): [True: 0, False: 6.70M]
  ------------------
  247|      0|        return -1;
  248|  6.70M|    return ret + length;
  249|  6.70M|}
ossl_asn1_string_set_bits_left:
  252|   150k|{
  253|   150k|    str->flags &= ~0x07;
  254|   150k|    str->flags |= ASN1_STRING_FLAG_BITS_LEFT | (num & 0x07);
  ------------------
  |  |  161|   150k|# define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
  ------------------
  255|   150k|}
ASN1_STRING_copy:
  258|   141k|{
  259|   141k|    if (str == NULL)
  ------------------
  |  Branch (259:9): [True: 0, False: 141k]
  ------------------
  260|      0|        return 0;
  261|   141k|    dst->type = str->type;
  262|   141k|    if (!ASN1_STRING_set(dst, str->data, str->length))
  ------------------
  |  Branch (262:9): [True: 0, False: 141k]
  ------------------
  263|      0|        return 0;
  264|       |    /* Copy flags but preserve embed value */
  265|   141k|    dst->flags &= ASN1_STRING_FLAG_EMBED;
  ------------------
  |  |  182|   141k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  266|   141k|    dst->flags |= str->flags & ~ASN1_STRING_FLAG_EMBED;
  ------------------
  |  |  182|   141k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  267|   141k|    return 1;
  268|   141k|}
ASN1_STRING_set:
  287|  3.82M|{
  288|  3.82M|    unsigned char *c;
  289|  3.82M|    const char *data = _data;
  290|  3.82M|    size_t len;
  291|       |
  292|  3.82M|    if (len_in < 0) {
  ------------------
  |  Branch (292:9): [True: 0, False: 3.82M]
  ------------------
  293|      0|        if (data == NULL)
  ------------------
  |  Branch (293:13): [True: 0, False: 0]
  ------------------
  294|      0|            return 0;
  295|      0|        len = strlen(data);
  296|  3.82M|    } else {
  297|  3.82M|        len = (size_t)len_in;
  298|  3.82M|    }
  299|       |    /*
  300|       |     * Verify that the length fits within an integer for assignment to
  301|       |     * str->length below.  The additional 1 is subtracted to allow for the
  302|       |     * '\0' terminator even though this isn't strictly necessary.
  303|       |     */
  304|  3.82M|    if (len > INT_MAX - 1) {
  ------------------
  |  Branch (304:9): [True: 0, False: 3.82M]
  ------------------
  305|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LARGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  306|      0|        return 0;
  307|      0|    }
  308|  3.82M|    if ((size_t)str->length <= len || str->data == NULL) {
  ------------------
  |  Branch (308:9): [True: 3.82M, False: 0]
  |  Branch (308:39): [True: 0, False: 0]
  ------------------
  309|  3.82M|        c = str->data;
  310|  3.82M|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  311|       |        /* No NUL terminator in fuzzing builds */
  312|  3.82M|        str->data = OPENSSL_realloc(c, len != 0 ? len : 1);
  ------------------
  |  |  101|  7.64M|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.82M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.82M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (101:30): [True: 3.36M, False: 461k]
  |  |  ------------------
  ------------------
  313|       |#else
  314|       |        str->data = OPENSSL_realloc(c, len + 1);
  315|       |#endif
  316|  3.82M|        if (str->data == NULL) {
  ------------------
  |  Branch (316:13): [True: 0, False: 3.82M]
  ------------------
  317|      0|            str->data = c;
  318|      0|            return 0;
  319|      0|        }
  320|  3.82M|    }
  321|  3.82M|    str->length = len;
  322|  3.82M|    if (data != NULL) {
  ------------------
  |  Branch (322:9): [True: 3.34M, False: 479k]
  ------------------
  323|  3.34M|        memcpy(str->data, data, len);
  324|  3.34M|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  325|       |        /* Set the unused byte to something non NUL and printable. */
  326|  3.34M|        if (len == 0)
  ------------------
  |  Branch (326:13): [True: 460k, False: 2.88M]
  ------------------
  327|   460k|            str->data[len] = '~';
  328|       |#else
  329|       |        /*
  330|       |         * Add a NUL terminator. This should not be necessary - but we add it as
  331|       |         * a safety precaution
  332|       |         */
  333|       |        str->data[len] = '\0';
  334|       |#endif
  335|  3.34M|    }
  336|  3.82M|    return 1;
  337|  3.82M|}
ASN1_STRING_set0:
  340|   389k|{
  341|   389k|    OPENSSL_free(str->data);
  ------------------
  |  |  107|   389k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   389k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   389k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  342|   389k|    str->data = data;
  343|   389k|    str->length = len;
  344|   389k|}
ASN1_STRING_new:
  347|     79|{
  348|     79|    return ASN1_STRING_type_new(V_ASN1_OCTET_STRING);
  ------------------
  |  |   66|     79|# define V_ASN1_OCTET_STRING             4
  ------------------
  349|     79|}
ASN1_STRING_type_new:
  352|  5.04M|{
  353|  5.04M|    ASN1_STRING *ret;
  354|       |
  355|  5.04M|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  5.04M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  5.04M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  5.04M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  356|  5.04M|    if (ret == NULL)
  ------------------
  |  Branch (356:9): [True: 0, False: 5.04M]
  ------------------
  357|      0|        return NULL;
  358|  5.04M|    ret->type = type;
  359|  5.04M|    return ret;
  360|  5.04M|}
ossl_asn1_string_embed_free:
  363|  5.29M|{
  364|  5.29M|    if (a == NULL)
  ------------------
  |  Branch (364:9): [True: 0, False: 5.29M]
  ------------------
  365|      0|        return;
  366|  5.29M|    if (!(a->flags & ASN1_STRING_FLAG_NDEF))
  ------------------
  |  |  167|  5.29M|# define ASN1_STRING_FLAG_NDEF 0x010
  ------------------
  |  Branch (366:9): [True: 5.29M, False: 0]
  ------------------
  367|  5.29M|        OPENSSL_free(a->data);
  ------------------
  |  |  107|  5.29M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  5.29M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  5.29M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  368|  5.29M|    if (embed == 0)
  ------------------
  |  Branch (368:9): [True: 5.04M, False: 248k]
  ------------------
  369|  5.04M|        OPENSSL_free(a);
  ------------------
  |  |  107|  5.04M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  5.04M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  5.04M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  370|  5.29M|}
ASN1_STRING_free:
  373|  8.38M|{
  374|  8.38M|    if (a == NULL)
  ------------------
  |  Branch (374:9): [True: 7.89M, False: 496k]
  ------------------
  375|  7.89M|        return;
  376|   496k|    ossl_asn1_string_embed_free(a, a->flags & ASN1_STRING_FLAG_EMBED);
  ------------------
  |  |  182|   496k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  377|   496k|}
ASN1_STRING_clear_free:
  380|    613|{
  381|    613|    if (a == NULL)
  ------------------
  |  Branch (381:9): [True: 18, False: 595]
  ------------------
  382|     18|        return;
  383|    595|    if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
  ------------------
  |  |  167|    595|# define ASN1_STRING_FLAG_NDEF 0x010
  ------------------
  |  Branch (383:9): [True: 595, False: 0]
  |  Branch (383:20): [True: 595, False: 0]
  ------------------
  384|    595|        OPENSSL_cleanse(a->data, a->length);
  385|    595|    ASN1_STRING_free(a);
  386|    595|}
ASN1_STRING_length:
  406|  29.1k|{
  407|  29.1k|    return x->length;
  408|  29.1k|}
ASN1_STRING_get0_data:
  423|  29.1k|{
  424|  29.1k|    return x->data;
  425|  29.1k|}
asn1_lib.c:asn1_get_length:
  118|   172M|{
  119|   172M|    const unsigned char *p = *pp;
  120|   172M|    unsigned long ret = 0;
  121|   172M|    int i;
  122|       |
  123|   172M|    if (max-- < 1)
  ------------------
  |  Branch (123:9): [True: 0, False: 172M]
  ------------------
  124|      0|        return 0;
  125|   172M|    if (*p == 0x80) {
  ------------------
  |  Branch (125:9): [True: 33.5M, False: 138M]
  ------------------
  126|  33.5M|        *inf = 1;
  127|  33.5M|        p++;
  128|   138M|    } else {
  129|   138M|        *inf = 0;
  130|   138M|        i = *p & 0x7f;
  131|   138M|        if (*p++ & 0x80) {
  ------------------
  |  Branch (131:13): [True: 1.89M, False: 136M]
  ------------------
  132|  1.89M|            if (max < i + 1)
  ------------------
  |  Branch (132:17): [True: 24.0k, False: 1.87M]
  ------------------
  133|  24.0k|                return 0;
  134|       |            /* Skip leading zeroes */
  135|  2.02M|            while (i > 0 && *p == 0) {
  ------------------
  |  Branch (135:20): [True: 1.91M, False: 108k]
  |  Branch (135:29): [True: 146k, False: 1.76M]
  ------------------
  136|   146k|                p++;
  137|   146k|                i--;
  138|   146k|            }
  139|  1.87M|            if (i > (int)sizeof(long))
  ------------------
  |  Branch (139:17): [True: 1.77k, False: 1.87M]
  ------------------
  140|  1.77k|                return 0;
  141|  4.06M|            while (i > 0) {
  ------------------
  |  Branch (141:20): [True: 2.19M, False: 1.87M]
  ------------------
  142|  2.19M|                ret <<= 8;
  143|  2.19M|                ret |= *p++;
  144|  2.19M|                i--;
  145|  2.19M|            }
  146|  1.87M|            if (ret > LONG_MAX)
  ------------------
  |  Branch (146:17): [True: 8.23k, False: 1.86M]
  ------------------
  147|  8.23k|                return 0;
  148|   136M|        } else {
  149|   136M|            ret = i;
  150|   136M|        }
  151|   138M|    }
  152|   172M|    *pp = p;
  153|   172M|    *rl = (long)ret;
  154|   172M|    return 1;
  155|   172M|}
asn1_lib.c:asn1_put_length:
  201|  1.69M|{
  202|  1.69M|    unsigned char *p = *pp;
  203|  1.69M|    int i, len;
  204|       |
  205|  1.69M|    if (length <= 127) {
  ------------------
  |  Branch (205:9): [True: 1.64M, False: 51.5k]
  ------------------
  206|  1.64M|        *(p++) = (unsigned char)length;
  207|  1.64M|    } else {
  208|  51.5k|        len = length;
  209|   129k|        for (i = 0; len > 0; i++)
  ------------------
  |  Branch (209:21): [True: 78.3k, False: 51.5k]
  ------------------
  210|  78.3k|            len >>= 8;
  211|  51.5k|        *(p++) = i | 0x80;
  212|  51.5k|        len = i;
  213|   129k|        while (i-- > 0) {
  ------------------
  |  Branch (213:16): [True: 78.3k, False: 51.5k]
  ------------------
  214|  78.3k|            p[i] = length & 0xff;
  215|  78.3k|            length >>= 8;
  216|  78.3k|        }
  217|  51.5k|        p += len;
  218|  51.5k|    }
  219|  1.69M|    *pp = p;
  220|  1.69M|}

ASN1_parse_dump:
   90|   309k|{
   91|   309k|    return asn1_parse2(bp, &pp, len, 0, 0, indent, dump);
   92|   309k|}
ASN1_tag2str:
  361|  8.65M|{
  362|  8.65M|    static const char *const tag2str[] = {
  363|       |        /* 0-4 */
  364|  8.65M|        "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING",
  365|       |        /* 5-9 */
  366|  8.65M|        "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL",
  367|       |        /* 10-13 */
  368|  8.65M|        "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>",
  369|       |        /* 15-17 */
  370|  8.65M|        "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET",
  371|       |        /* 18-20 */
  372|  8.65M|        "NUMERICSTRING", "PRINTABLESTRING", "T61STRING",
  373|       |        /* 21-24 */
  374|  8.65M|        "VIDEOTEXSTRING", "IA5STRING", "UTCTIME", "GENERALIZEDTIME",
  375|       |        /* 25-27 */
  376|  8.65M|        "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING",
  377|       |        /* 28-30 */
  378|  8.65M|        "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING"
  379|  8.65M|    };
  380|       |
  381|  8.65M|    if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
  ------------------
  |  |   98|  8.65M|# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   97|  8.65M|# define V_ASN1_NEG                      0x100
  |  |  ------------------
  ------------------
                  if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
  ------------------
  |  |   99|  8.65M|# define V_ASN1_NEG_ENUMERATED           (10 | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   97|  8.65M|# define V_ASN1_NEG                      0x100
  |  |  ------------------
  ------------------
  |  Branch (381:9): [True: 190, False: 8.65M]
  |  Branch (381:40): [True: 62, False: 8.65M]
  ------------------
  382|    252|        tag &= ~0x100;
  383|       |
  384|  8.65M|    if (tag < 0 || tag > 30)
  ------------------
  |  Branch (384:9): [True: 5.69k, False: 8.64M]
  |  Branch (384:20): [True: 1.30k, False: 8.64M]
  ------------------
  385|  6.99k|        return "(unknown)";
  386|  8.64M|    return tag2str[tag];
  387|  8.65M|}
asn1_parse.c:asn1_parse2:
   96|  2.52M|{
   97|  2.52M|    const unsigned char *p, *ep, *tot, *op, *opp;
   98|  2.52M|    long len;
   99|  2.52M|    int tag, xclass, ret = 0;
  100|  2.52M|    int nl, hl, j, r;
  101|  2.52M|    ASN1_OBJECT *o = NULL;
  102|  2.52M|    ASN1_OCTET_STRING *os = NULL;
  103|  2.52M|    ASN1_INTEGER *ai = NULL;
  104|  2.52M|    ASN1_ENUMERATED *ae = NULL;
  105|       |    /* ASN1_BMPSTRING *bmp=NULL; */
  106|  2.52M|    int dump_indent, dump_cont = 0;
  107|       |
  108|  2.52M|    if (depth > ASN1_PARSE_MAXDEPTH) {
  ------------------
  |  |   17|  2.52M|#define ASN1_PARSE_MAXDEPTH 128
  ------------------
  |  Branch (108:9): [True: 20, False: 2.52M]
  ------------------
  109|     20|        BIO_puts(bp, "BAD RECURSION DEPTH\n");
  110|     20|        return 0;
  111|     20|    }
  112|       |
  113|  2.52M|    dump_indent = 6;            /* Because we know BIO_dump_indent() */
  114|  2.52M|    p = *pp;
  115|  2.52M|    tot = p + length;
  116|  9.71M|    while (length > 0) {
  ------------------
  |  Branch (116:12): [True: 8.43M, False: 1.28M]
  ------------------
  117|  8.43M|        op = p;
  118|  8.43M|        j = ASN1_get_object(&p, &len, &tag, &xclass, length);
  119|  8.43M|        if (j & 0x80) {
  ------------------
  |  Branch (119:13): [True: 2.67k, False: 8.43M]
  ------------------
  120|  2.67k|            BIO_puts(bp, "Error in encoding\n");
  121|  2.67k|            goto end;
  122|  2.67k|        }
  123|  8.43M|        hl = (p - op);
  124|  8.43M|        length -= hl;
  125|       |        /*
  126|       |         * if j == 0x21 it is a constructed indefinite length object
  127|       |         */
  128|  8.43M|        if (!asn1_print_info(bp, (long)offset + (long)(op - *pp), depth,
  ------------------
  |  Branch (128:13): [True: 0, False: 8.43M]
  ------------------
  129|  8.43M|                             hl, len, tag, xclass, j, (indent) ? depth : 0))
  ------------------
  |  Branch (129:55): [True: 8.43M, False: 0]
  ------------------
  130|      0|            goto end;
  131|  8.43M|        if (j & V_ASN1_CONSTRUCTED) {
  ------------------
  |  |   52|  8.43M|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (131:13): [True: 4.36M, False: 4.06M]
  ------------------
  132|  4.36M|            const unsigned char *sp = p;
  133|       |
  134|  4.36M|            ep = p + len;
  135|  4.36M|            if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (135:17): [True: 0, False: 4.36M]
  ------------------
  136|      0|                goto end;
  137|  4.36M|            if (len > length) {
  ------------------
  |  Branch (137:17): [True: 0, False: 4.36M]
  ------------------
  138|      0|                BIO_printf(bp, "length is greater than %ld\n", length);
  139|      0|                goto end;
  140|      0|            }
  141|  4.36M|            if ((j == 0x21) && (len == 0)) {
  ------------------
  |  Branch (141:17): [True: 1.23M, False: 3.12M]
  |  Branch (141:32): [True: 1.23M, False: 0]
  ------------------
  142|  1.23M|                for (;;) {
  143|  1.23M|                    r = asn1_parse2(bp, &p, (long)(tot - p),
  144|  1.23M|                                    offset + (p - *pp), depth + 1,
  145|  1.23M|                                    indent, dump);
  146|  1.23M|                    if (r == 0)
  ------------------
  |  Branch (146:25): [True: 15.0k, False: 1.22M]
  ------------------
  147|  15.0k|                        goto end;
  148|  1.22M|                    if ((r == 2) || (p >= tot)) {
  ------------------
  |  Branch (148:25): [True: 1.22M, False: 1.91k]
  |  Branch (148:37): [True: 1.91k, False: 0]
  ------------------
  149|  1.22M|                        len = p - sp;
  150|  1.22M|                        break;
  151|  1.22M|                    }
  152|  1.22M|                }
  153|  3.12M|            } else {
  154|  3.12M|                long tmp = len;
  155|       |
  156|  4.10M|                while (p < ep) {
  ------------------
  |  Branch (156:24): [True: 980k, False: 3.12M]
  ------------------
  157|   980k|                    sp = p;
  158|   980k|                    r = asn1_parse2(bp, &p, tmp,
  159|   980k|                                    offset + (p - *pp), depth + 1,
  160|   980k|                                    indent, dump);
  161|   980k|                    if (r == 0)
  ------------------
  |  Branch (161:25): [True: 3.48k, False: 976k]
  ------------------
  162|  3.48k|                        goto end;
  163|   976k|                    tmp -= p - sp;
  164|   976k|                }
  165|  3.12M|            }
  166|  4.36M|        } else if (xclass != 0) {
  ------------------
  |  Branch (166:20): [True: 93.6k, False: 3.97M]
  ------------------
  167|  93.6k|            p += len;
  168|  93.6k|            if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (168:17): [True: 0, False: 93.6k]
  ------------------
  169|      0|                goto end;
  170|  3.97M|        } else {
  171|  3.97M|            nl = 0;
  172|  3.97M|            if ((tag == V_ASN1_PRINTABLESTRING) ||
  ------------------
  |  |   77|  3.97M|# define V_ASN1_PRINTABLESTRING          19
  ------------------
  |  Branch (172:17): [True: 768, False: 3.97M]
  ------------------
  173|  3.97M|                (tag == V_ASN1_T61STRING) ||
  ------------------
  |  |   78|  3.97M|# define V_ASN1_T61STRING                20
  ------------------
  |  Branch (173:17): [True: 562, False: 3.97M]
  ------------------
  174|  3.97M|                (tag == V_ASN1_IA5STRING) ||
  ------------------
  |  |   81|  3.97M|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (174:17): [True: 855, False: 3.96M]
  ------------------
  175|  3.97M|                (tag == V_ASN1_VISIBLESTRING) ||
  ------------------
  |  |   86|  3.96M|# define V_ASN1_VISIBLESTRING            26/* alias */
  ------------------
  |  Branch (175:17): [True: 253, False: 3.96M]
  ------------------
  176|  3.97M|                (tag == V_ASN1_NUMERICSTRING) ||
  ------------------
  |  |   76|  3.96M|# define V_ASN1_NUMERICSTRING            18 /**/
  ------------------
  |  Branch (176:17): [True: 563, False: 3.96M]
  ------------------
  177|  3.97M|                (tag == V_ASN1_UTF8STRING) ||
  ------------------
  |  |   73|  3.96M|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (177:17): [True: 5.08k, False: 3.96M]
  ------------------
  178|  3.97M|                (tag == V_ASN1_UTCTIME) || (tag == V_ASN1_GENERALIZEDTIME)) {
  ------------------
  |  |   82|  3.96M|# define V_ASN1_UTCTIME                  23
  ------------------
                              (tag == V_ASN1_UTCTIME) || (tag == V_ASN1_GENERALIZEDTIME)) {
  ------------------
  |  |   83|  3.94M|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (178:17): [True: 13.7k, False: 3.94M]
  |  Branch (178:44): [True: 32.1k, False: 3.91M]
  ------------------
  179|  54.0k|                if (BIO_write(bp, ":", 1) <= 0)
  ------------------
  |  Branch (179:21): [True: 0, False: 54.0k]
  ------------------
  180|      0|                    goto end;
  181|  54.0k|                if ((len > 0) && BIO_write(bp, (const char *)p, (int)len)
  ------------------
  |  Branch (181:21): [True: 40.0k, False: 13.9k]
  |  Branch (181:34): [True: 0, False: 40.0k]
  ------------------
  182|  40.0k|                    != (int)len)
  183|      0|                    goto end;
  184|  3.91M|            } else if (tag == V_ASN1_OBJECT) {
  ------------------
  |  |   68|  3.91M|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (184:24): [True: 1.11M, False: 2.80M]
  ------------------
  185|  1.11M|                opp = op;
  186|  1.11M|                if (d2i_ASN1_OBJECT(&o, &opp, len + hl) != NULL) {
  ------------------
  |  Branch (186:21): [True: 1.10M, False: 5.91k]
  ------------------
  187|  1.10M|                    if (BIO_write(bp, ":", 1) <= 0)
  ------------------
  |  Branch (187:25): [True: 0, False: 1.10M]
  ------------------
  188|      0|                        goto end;
  189|  1.10M|                    i2a_ASN1_OBJECT(bp, o);
  190|  1.10M|                } else {
  191|  5.91k|                    if (BIO_puts(bp, ":BAD OBJECT") <= 0)
  ------------------
  |  Branch (191:25): [True: 0, False: 5.91k]
  ------------------
  192|      0|                        goto end;
  193|  5.91k|                    dump_cont = 1;
  194|  5.91k|                }
  195|  2.80M|            } else if (tag == V_ASN1_BOOLEAN) {
  ------------------
  |  |   63|  2.80M|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (195:24): [True: 8.06k, False: 2.79M]
  ------------------
  196|  8.06k|                if (len != 1) {
  ------------------
  |  Branch (196:21): [True: 2.18k, False: 5.88k]
  ------------------
  197|  2.18k|                    if (BIO_puts(bp, ":BAD BOOLEAN") <= 0)
  ------------------
  |  Branch (197:25): [True: 0, False: 2.18k]
  ------------------
  198|      0|                        goto end;
  199|  2.18k|                    dump_cont = 1;
  200|  2.18k|                }
  201|  8.06k|                if (len > 0)
  ------------------
  |  Branch (201:21): [True: 7.47k, False: 592]
  ------------------
  202|  7.47k|                    BIO_printf(bp, ":%u", p[0]);
  203|  2.79M|            } else if (tag == V_ASN1_BMPSTRING) {
  ------------------
  |  |   89|  2.79M|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (203:24): [True: 2.17k, False: 2.79M]
  ------------------
  204|       |                /* do the BMP thang */
  205|  2.79M|            } else if (tag == V_ASN1_OCTET_STRING) {
  ------------------
  |  |   66|  2.79M|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (205:24): [True: 110k, False: 2.68M]
  ------------------
  206|   110k|                int i, printable = 1;
  207|       |
  208|   110k|                opp = op;
  209|   110k|                os = d2i_ASN1_OCTET_STRING(NULL, &opp, len + hl);
  210|   110k|                if (os != NULL && os->length > 0) {
  ------------------
  |  Branch (210:21): [True: 108k, False: 2.83k]
  |  Branch (210:35): [True: 99.1k, False: 8.89k]
  ------------------
  211|  99.1k|                    opp = os->data;
  212|       |                    /*
  213|       |                     * testing whether the octet string is printable
  214|       |                     */
  215|   191k|                    for (i = 0; i < os->length; i++) {
  ------------------
  |  Branch (215:33): [True: 183k, False: 7.44k]
  ------------------
  216|   183k|                        if (((opp[i] < ' ') &&
  ------------------
  |  Branch (216:30): [True: 40.0k, False: 143k]
  ------------------
  217|   183k|                             (opp[i] != '\n') &&
  ------------------
  |  Branch (217:30): [True: 37.4k, False: 2.64k]
  ------------------
  218|   183k|                             (opp[i] != '\r') &&
  ------------------
  |  Branch (218:30): [True: 37.1k, False: 243]
  ------------------
  219|   183k|                             (opp[i] != '\t')) || (opp[i] > '~')) {
  ------------------
  |  Branch (219:30): [True: 37.0k, False: 133]
  |  Branch (219:51): [True: 54.6k, False: 92.2k]
  ------------------
  220|  91.7k|                            printable = 0;
  221|  91.7k|                            break;
  222|  91.7k|                        }
  223|   183k|                    }
  224|  99.1k|                    if (printable)
  ------------------
  |  Branch (224:25): [True: 7.44k, False: 91.7k]
  ------------------
  225|       |                        /* printable string */
  226|  7.44k|                    {
  227|  7.44k|                        if (BIO_write(bp, ":", 1) <= 0)
  ------------------
  |  Branch (227:29): [True: 0, False: 7.44k]
  ------------------
  228|      0|                            goto end;
  229|  7.44k|                        if (BIO_write(bp, (const char *)opp, os->length) <= 0)
  ------------------
  |  Branch (229:29): [True: 0, False: 7.44k]
  ------------------
  230|      0|                            goto end;
  231|  91.7k|                    } else if (!dump)
  ------------------
  |  Branch (231:32): [True: 91.7k, False: 0]
  ------------------
  232|       |                        /*
  233|       |                         * not printable => print octet string as hex dump
  234|       |                         */
  235|  91.7k|                    {
  236|  91.7k|                        if (BIO_write(bp, "[HEX DUMP]:", 11) <= 0)
  ------------------
  |  Branch (236:29): [True: 0, False: 91.7k]
  ------------------
  237|      0|                            goto end;
  238|  2.10M|                        for (i = 0; i < os->length; i++) {
  ------------------
  |  Branch (238:37): [True: 2.01M, False: 91.7k]
  ------------------
  239|  2.01M|                            if (BIO_printf(bp, "%02X", opp[i]) <= 0)
  ------------------
  |  Branch (239:33): [True: 0, False: 2.01M]
  ------------------
  240|      0|                                goto end;
  241|  2.01M|                        }
  242|  91.7k|                    } else
  243|       |                        /* print the normal dump */
  244|      0|                    {
  245|      0|                        if (!nl) {
  ------------------
  |  Branch (245:29): [True: 0, False: 0]
  ------------------
  246|      0|                            if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (246:33): [True: 0, False: 0]
  ------------------
  247|      0|                                goto end;
  248|      0|                        }
  249|      0|                        if (BIO_dump_indent(bp,
  ------------------
  |  Branch (249:29): [True: 0, False: 0]
  ------------------
  250|      0|                                            (const char *)opp,
  251|      0|                                            ((dump == -1 || dump >
  ------------------
  |  Branch (251:47): [True: 0, False: 0]
  |  Branch (251:61): [True: 0, False: 0]
  ------------------
  252|      0|                                              os->
  253|      0|                                              length) ? os->length : dump),
  254|      0|                                            dump_indent) <= 0)
  255|      0|                            goto end;
  256|      0|                        nl = 1;
  257|      0|                    }
  258|  99.1k|                }
  259|   110k|                ASN1_OCTET_STRING_free(os);
  260|   110k|                os = NULL;
  261|  2.68M|            } else if (tag == V_ASN1_INTEGER) {
  ------------------
  |  |   64|  2.68M|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (261:24): [True: 307k, False: 2.37M]
  ------------------
  262|   307k|                int i;
  263|       |
  264|   307k|                opp = op;
  265|   307k|                ai = d2i_ASN1_INTEGER(NULL, &opp, len + hl);
  266|   307k|                if (ai != NULL) {
  ------------------
  |  Branch (266:21): [True: 271k, False: 36.3k]
  ------------------
  267|   271k|                    if (BIO_write(bp, ":", 1) <= 0)
  ------------------
  |  Branch (267:25): [True: 0, False: 271k]
  ------------------
  268|      0|                        goto end;
  269|   271k|                    if (ai->type == V_ASN1_NEG_INTEGER)
  ------------------
  |  |   98|   271k|# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   97|   271k|# define V_ASN1_NEG                      0x100
  |  |  ------------------
  ------------------
  |  Branch (269:25): [True: 64.7k, False: 206k]
  ------------------
  270|  64.7k|                        if (BIO_write(bp, "-", 1) <= 0)
  ------------------
  |  Branch (270:29): [True: 0, False: 64.7k]
  ------------------
  271|      0|                            goto end;
  272|  5.44M|                    for (i = 0; i < ai->length; i++) {
  ------------------
  |  Branch (272:33): [True: 5.17M, False: 271k]
  ------------------
  273|  5.17M|                        if (BIO_printf(bp, "%02X", ai->data[i]) <= 0)
  ------------------
  |  Branch (273:29): [True: 0, False: 5.17M]
  ------------------
  274|      0|                            goto end;
  275|  5.17M|                    }
  276|   271k|                    if (ai->length == 0) {
  ------------------
  |  Branch (276:25): [True: 0, False: 271k]
  ------------------
  277|      0|                        if (BIO_write(bp, "00", 2) <= 0)
  ------------------
  |  Branch (277:29): [True: 0, False: 0]
  ------------------
  278|      0|                            goto end;
  279|      0|                    }
  280|   271k|                } else {
  281|  36.3k|                    if (BIO_puts(bp, ":BAD INTEGER") <= 0)
  ------------------
  |  Branch (281:25): [True: 0, False: 36.3k]
  ------------------
  282|      0|                        goto end;
  283|  36.3k|                    dump_cont = 1;
  284|  36.3k|                }
  285|   307k|                ASN1_INTEGER_free(ai);
  286|   307k|                ai = NULL;
  287|  2.37M|            } else if (tag == V_ASN1_ENUMERATED) {
  ------------------
  |  |   72|  2.37M|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (287:24): [True: 8.09k, False: 2.36M]
  ------------------
  288|  8.09k|                int i;
  289|       |
  290|  8.09k|                opp = op;
  291|  8.09k|                ae = d2i_ASN1_ENUMERATED(NULL, &opp, len + hl);
  292|  8.09k|                if (ae != NULL) {
  ------------------
  |  Branch (292:21): [True: 6.49k, False: 1.59k]
  ------------------
  293|  6.49k|                    if (BIO_write(bp, ":", 1) <= 0)
  ------------------
  |  Branch (293:25): [True: 0, False: 6.49k]
  ------------------
  294|      0|                        goto end;
  295|  6.49k|                    if (ae->type == V_ASN1_NEG_ENUMERATED)
  ------------------
  |  |   99|  6.49k|# define V_ASN1_NEG_ENUMERATED           (10 | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   97|  6.49k|# define V_ASN1_NEG                      0x100
  |  |  ------------------
  ------------------
  |  Branch (295:25): [True: 2.81k, False: 3.68k]
  ------------------
  296|  2.81k|                        if (BIO_write(bp, "-", 1) <= 0)
  ------------------
  |  Branch (296:29): [True: 0, False: 2.81k]
  ------------------
  297|      0|                            goto end;
  298|  4.92M|                    for (i = 0; i < ae->length; i++) {
  ------------------
  |  Branch (298:33): [True: 4.92M, False: 6.49k]
  ------------------
  299|  4.92M|                        if (BIO_printf(bp, "%02X", ae->data[i]) <= 0)
  ------------------
  |  Branch (299:29): [True: 0, False: 4.92M]
  ------------------
  300|      0|                            goto end;
  301|  4.92M|                    }
  302|  6.49k|                    if (ae->length == 0) {
  ------------------
  |  Branch (302:25): [True: 0, False: 6.49k]
  ------------------
  303|      0|                        if (BIO_write(bp, "00", 2) <= 0)
  ------------------
  |  Branch (303:29): [True: 0, False: 0]
  ------------------
  304|      0|                            goto end;
  305|      0|                    }
  306|  6.49k|                } else {
  307|  1.59k|                    if (BIO_puts(bp, ":BAD ENUMERATED") <= 0)
  ------------------
  |  Branch (307:25): [True: 0, False: 1.59k]
  ------------------
  308|      0|                        goto end;
  309|  1.59k|                    dump_cont = 1;
  310|  1.59k|                }
  311|  8.09k|                ASN1_ENUMERATED_free(ae);
  312|  8.09k|                ae = NULL;
  313|  2.36M|            } else if (len > 0 && dump) {
  ------------------
  |  Branch (313:24): [True: 100k, False: 2.26M]
  |  Branch (313:35): [True: 0, False: 100k]
  ------------------
  314|      0|                if (!nl) {
  ------------------
  |  Branch (314:21): [True: 0, False: 0]
  ------------------
  315|      0|                    if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (315:25): [True: 0, False: 0]
  ------------------
  316|      0|                        goto end;
  317|      0|                }
  318|      0|                if (BIO_dump_indent(bp, (const char *)p,
  ------------------
  |  Branch (318:21): [True: 0, False: 0]
  ------------------
  319|      0|                                    ((dump == -1 || dump > len) ? len : dump),
  ------------------
  |  Branch (319:39): [True: 0, False: 0]
  |  Branch (319:53): [True: 0, False: 0]
  ------------------
  320|      0|                                    dump_indent) <= 0)
  321|      0|                    goto end;
  322|      0|                nl = 1;
  323|      0|            }
  324|  3.97M|            if (dump_cont) {
  ------------------
  |  Branch (324:17): [True: 46.0k, False: 3.92M]
  ------------------
  325|  46.0k|                int i;
  326|  46.0k|                const unsigned char *tmp = op + hl;
  327|  46.0k|                if (BIO_puts(bp, ":[") <= 0)
  ------------------
  |  Branch (327:21): [True: 0, False: 46.0k]
  ------------------
  328|      0|                    goto end;
  329|  6.73M|                for (i = 0; i < len; i++) {
  ------------------
  |  Branch (329:29): [True: 6.68M, False: 46.0k]
  ------------------
  330|  6.68M|                    if (BIO_printf(bp, "%02X", tmp[i]) <= 0)
  ------------------
  |  Branch (330:25): [True: 0, False: 6.68M]
  ------------------
  331|      0|                        goto end;
  332|  6.68M|                }
  333|  46.0k|                if (BIO_puts(bp, "]") <= 0)
  ------------------
  |  Branch (333:21): [True: 0, False: 46.0k]
  ------------------
  334|      0|                    goto end;
  335|  46.0k|                dump_cont = 0;
  336|  46.0k|            }
  337|       |
  338|  3.97M|            if (!nl) {
  ------------------
  |  Branch (338:17): [True: 3.97M, False: 0]
  ------------------
  339|  3.97M|                if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (339:21): [True: 0, False: 3.97M]
  ------------------
  340|      0|                    goto end;
  341|  3.97M|            }
  342|  3.97M|            p += len;
  343|  3.97M|            if ((tag == V_ASN1_EOC) && (xclass == 0)) {
  ------------------
  |  |   62|  3.97M|# define V_ASN1_EOC                      0
  ------------------
  |  Branch (343:17): [True: 1.22M, False: 2.74M]
  |  Branch (343:40): [True: 1.22M, False: 0]
  ------------------
  344|  1.22M|                ret = 2;        /* End of sequence */
  345|  1.22M|                goto end;
  346|  1.22M|            }
  347|  3.97M|        }
  348|  7.18M|        length -= len;
  349|  7.18M|    }
  350|  1.28M|    ret = 1;
  351|  2.52M| end:
  352|  2.52M|    ASN1_OBJECT_free(o);
  353|  2.52M|    ASN1_OCTET_STRING_free(os);
  354|  2.52M|    ASN1_INTEGER_free(ai);
  355|  2.52M|    ASN1_ENUMERATED_free(ae);
  356|  2.52M|    *pp = p;
  357|  2.52M|    return ret;
  358|  1.28M|}
asn1_parse.c:asn1_print_info:
   24|  8.43M|{
   25|  8.43M|    char str[128];
   26|  8.43M|    const char *p;
   27|  8.43M|    int pop_f_prefix = 0;
   28|  8.43M|    long saved_indent = -1;
   29|  8.43M|    int i = 0;
   30|  8.43M|    BIO *bio = NULL;
   31|       |
   32|  8.43M|    if (constructed & V_ASN1_CONSTRUCTED)
  ------------------
  |  |   52|  8.43M|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (32:9): [True: 4.36M, False: 4.06M]
  ------------------
   33|  4.36M|        p = "cons: ";
   34|  4.06M|    else
   35|  4.06M|        p = "prim: ";
   36|  8.43M|    if (constructed != (V_ASN1_CONSTRUCTED | 1)) {
  ------------------
  |  |   52|  8.43M|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
  |  Branch (36:9): [True: 7.19M, False: 1.23M]
  ------------------
   37|  7.19M|        if (BIO_snprintf(str, sizeof(str), "%5ld:d=%-2d hl=%ld l=%4ld %s",
  ------------------
  |  Branch (37:13): [True: 0, False: 7.19M]
  ------------------
   38|  7.19M|                         offset, depth, (long)hl, len, p) <= 0)
   39|      0|            goto err;
   40|  7.19M|    } else {
   41|  1.23M|        if (BIO_snprintf(str, sizeof(str), "%5ld:d=%-2d hl=%ld l=inf  %s",
  ------------------
  |  Branch (41:13): [True: 0, False: 1.23M]
  ------------------
   42|  1.23M|                         offset, depth, (long)hl, p) <= 0)
   43|      0|            goto err;
   44|  1.23M|    }
   45|  8.43M|    if (bp != NULL) {
  ------------------
  |  Branch (45:9): [True: 8.43M, False: 0]
  ------------------
   46|  8.43M|        if (BIO_set_prefix(bp, str) <= 0) {
  ------------------
  |  |  693|  8.43M|# define BIO_set_prefix(b,p) BIO_ctrl((b), BIO_CTRL_SET_PREFIX, 0, (void *)(p))
  |  |  ------------------
  |  |  |  |  172|  8.43M|# define BIO_CTRL_SET_PREFIX                    79
  |  |  ------------------
  ------------------
  |  Branch (46:13): [True: 8.43M, False: 0]
  ------------------
   47|  8.43M|            if ((bio = BIO_new(BIO_f_prefix())) == NULL
  ------------------
  |  Branch (47:17): [True: 0, False: 8.43M]
  ------------------
   48|  8.43M|                    || (bp = BIO_push(bio, bp)) == NULL)
  ------------------
  |  Branch (48:24): [True: 0, False: 8.43M]
  ------------------
   49|      0|                goto err;
   50|  8.43M|            pop_f_prefix = 1;
   51|  8.43M|        }
   52|  8.43M|        saved_indent = BIO_get_indent(bp);
  ------------------
  |  |  695|  8.43M|# define BIO_get_indent(b) BIO_ctrl((b), BIO_CTRL_GET_INDENT, 0, NULL)
  |  |  ------------------
  |  |  |  |  174|  8.43M|# define BIO_CTRL_GET_INDENT                    81
  |  |  ------------------
  ------------------
   53|  8.43M|        if (BIO_set_prefix(bp, str) <= 0 || BIO_set_indent(bp, indent) <= 0)
  ------------------
  |  |  693|  8.43M|# define BIO_set_prefix(b,p) BIO_ctrl((b), BIO_CTRL_SET_PREFIX, 0, (void *)(p))
  |  |  ------------------
  |  |  |  |  172|  8.43M|# define BIO_CTRL_SET_PREFIX                    79
  |  |  ------------------
  ------------------
                      if (BIO_set_prefix(bp, str) <= 0 || BIO_set_indent(bp, indent) <= 0)
  ------------------
  |  |  694|  8.43M|# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL)
  |  |  ------------------
  |  |  |  |  173|  8.43M|# define BIO_CTRL_SET_INDENT                    80
  |  |  ------------------
  ------------------
  |  Branch (53:13): [True: 0, False: 8.43M]
  |  Branch (53:45): [True: 0, False: 8.43M]
  ------------------
   54|      0|            goto err;
   55|  8.43M|    }
   56|       |
   57|       |    /*
   58|       |     * BIO_set_prefix made a copy of |str|, so we can safely use it for
   59|       |     * something else, ASN.1 tag printout.
   60|       |     */
   61|  8.43M|    p = str;
   62|  8.43M|    if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
  ------------------
  |  |   50|  8.43M|# define V_ASN1_PRIVATE                  0xc0
  ------------------
                  if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
  ------------------
  |  |   50|  8.43M|# define V_ASN1_PRIVATE                  0xc0
  ------------------
  |  Branch (62:9): [True: 1.85k, False: 8.42M]
  ------------------
   63|  1.85k|        BIO_snprintf(str, sizeof(str), "priv [ %d ] ", tag);
   64|  8.42M|    else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
  ------------------
  |  |   49|  8.42M|# define V_ASN1_CONTEXT_SPECIFIC         0x80
  ------------------
                  else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
  ------------------
  |  |   49|  8.42M|# define V_ASN1_CONTEXT_SPECIFIC         0x80
  ------------------
  |  Branch (64:14): [True: 113k, False: 8.31M]
  ------------------
   65|   113k|        BIO_snprintf(str, sizeof(str), "cont [ %d ]", tag);
   66|  8.31M|    else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
  ------------------
  |  |   48|  8.31M|# define V_ASN1_APPLICATION              0x40
  ------------------
                  else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
  ------------------
  |  |   48|  8.31M|# define V_ASN1_APPLICATION              0x40
  ------------------
  |  Branch (66:14): [True: 29.7k, False: 8.28M]
  ------------------
   67|  29.7k|        BIO_snprintf(str, sizeof(str), "appl [ %d ]", tag);
   68|  8.28M|    else if (tag > 30)
  ------------------
  |  Branch (68:14): [True: 2.01k, False: 8.28M]
  ------------------
   69|  2.01k|        BIO_snprintf(str, sizeof(str), "<ASN1 %d>", tag);
   70|  8.28M|    else
   71|  8.28M|        p = ASN1_tag2str(tag);
   72|       |
   73|  8.43M|    i = (BIO_printf(bp, "%-18s", p) > 0);
   74|  8.43M| err:
   75|  8.43M|    if (saved_indent >= 0)
  ------------------
  |  Branch (75:9): [True: 8.43M, False: 0]
  ------------------
   76|  8.43M|        BIO_set_indent(bp, saved_indent);
  ------------------
  |  |  694|  8.43M|# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL)
  |  |  ------------------
  |  |  |  |  173|  8.43M|# define BIO_CTRL_SET_INDENT                    80
  |  |  ------------------
  ------------------
   77|  8.43M|    if (pop_f_prefix)
  ------------------
  |  Branch (77:9): [True: 8.43M, False: 0]
  ------------------
   78|  8.43M|        BIO_pop(bp);
   79|  8.43M|    BIO_free(bio);
   80|  8.43M|    return i;
   81|  8.43M|}

ASN1_item_unpack:
   53|  3.47k|{
   54|  3.47k|    const unsigned char *p;
   55|  3.47k|    void *ret;
   56|       |
   57|  3.47k|    p = oct->data;
   58|  3.47k|    if ((ret = ASN1_item_d2i(NULL, &p, oct->length, it)) == NULL)
  ------------------
  |  Branch (58:9): [True: 3, False: 3.47k]
  ------------------
   59|  3.47k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_DECODE_ERROR);
  ------------------
  |  |  401|      3|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      3|    (ERR_new(),                                                 \
  |  |  |  |  404|      3|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      3|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      3|     ERR_set_error)
  |  |  ------------------
  ------------------
   60|  3.47k|    return ret;
   61|  3.47k|}

ossl_d2i_PrivateKey_legacy:
   93|  9.29k|{
   94|  9.29k|    EVP_PKEY *ret;
   95|  9.29k|    const unsigned char *p = *pp;
   96|       |
   97|  9.29k|    if (a == NULL || *a == NULL) {
  ------------------
  |  Branch (97:9): [True: 9.29k, False: 0]
  |  Branch (97:22): [True: 0, False: 0]
  ------------------
   98|  9.29k|        if ((ret = EVP_PKEY_new()) == NULL) {
  ------------------
  |  Branch (98:13): [True: 0, False: 9.29k]
  ------------------
   99|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  100|      0|            return NULL;
  101|      0|        }
  102|  9.29k|    } else {
  103|      0|        ret = *a;
  104|      0|#ifndef OPENSSL_NO_ENGINE
  105|      0|        ENGINE_finish(ret->engine);
  106|      0|        ret->engine = NULL;
  107|      0|#endif
  108|      0|    }
  109|       |
  110|  9.29k|    if (!EVP_PKEY_set_type(ret, keytype)) {
  ------------------
  |  Branch (110:9): [True: 0, False: 9.29k]
  ------------------
  111|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  112|      0|        goto err;
  113|      0|    }
  114|       |
  115|  9.29k|    ERR_set_mark();
  116|  9.29k|    if (!ret->ameth->old_priv_decode ||
  ------------------
  |  Branch (116:9): [True: 0, False: 9.29k]
  ------------------
  117|  9.29k|        !ret->ameth->old_priv_decode(ret, &p, length)) {
  ------------------
  |  Branch (117:9): [True: 9.26k, False: 30]
  ------------------
  118|  9.26k|        if (ret->ameth->priv_decode != NULL
  ------------------
  |  Branch (118:13): [True: 8.88k, False: 384]
  ------------------
  119|  9.26k|                || ret->ameth->priv_decode_ex != NULL) {
  ------------------
  |  Branch (119:20): [True: 384, False: 0]
  ------------------
  120|  9.26k|            EVP_PKEY *tmp;
  121|  9.26k|            PKCS8_PRIV_KEY_INFO *p8 = NULL;
  122|  9.26k|            p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
  123|  9.26k|            if (p8 == NULL) {
  ------------------
  |  Branch (123:17): [True: 9.25k, False: 7]
  ------------------
  124|  9.25k|                ERR_clear_last_mark();
  125|  9.25k|                goto err;
  126|  9.25k|            }
  127|      7|            tmp = evp_pkcs82pkey_legacy(p8, libctx, propq);
  128|      7|            PKCS8_PRIV_KEY_INFO_free(p8);
  129|      7|            if (tmp == NULL) {
  ------------------
  |  Branch (129:17): [True: 5, False: 2]
  ------------------
  130|      5|                ERR_clear_last_mark();
  131|      5|                goto err;
  132|      5|            }
  133|      2|            EVP_PKEY_free(ret);
  134|      2|            ret = tmp;
  135|      2|            ERR_pop_to_mark();
  136|      2|            if (EVP_PKEY_type(keytype) != EVP_PKEY_get_base_id(ret))
  ------------------
  |  Branch (136:17): [True: 1, False: 1]
  ------------------
  137|      1|                goto err;
  138|      2|        } else {
  139|      0|            ERR_clear_last_mark();
  140|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  141|      0|            goto err;
  142|      0|        }
  143|  9.26k|    } else {
  144|     30|      ERR_clear_last_mark();
  145|     30|    }
  146|     31|    *pp = p;
  147|     31|    if (a != NULL)
  ------------------
  |  Branch (147:9): [True: 0, False: 31]
  ------------------
  148|      0|        *a = ret;
  149|     31|    return ret;
  150|  9.26k| err:
  151|  9.26k|    if (a == NULL || *a != ret)
  ------------------
  |  Branch (151:9): [True: 9.26k, False: 0]
  |  Branch (151:22): [True: 0, False: 0]
  ------------------
  152|  9.26k|        EVP_PKEY_free(ret);
  153|  9.26k|    return NULL;
  154|  9.29k|}
d2i_AutoPrivateKey_ex:
  234|  11.7k|{
  235|  11.7k|    EVP_PKEY *ret;
  236|       |
  237|  11.7k|    ret = d2i_PrivateKey_decoder(EVP_PKEY_NONE, a, pp, length, libctx, propq);
  ------------------
  |  |   58|  11.7k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  11.7k|#define NID_undef                       0
  |  |  ------------------
  ------------------
  238|       |    /* try the legacy path if the decoder failed */
  239|  11.7k|    if (ret == NULL)
  ------------------
  |  Branch (239:9): [True: 10.2k, False: 1.45k]
  ------------------
  240|  10.2k|        ret = d2i_AutoPrivateKey_legacy(a, pp, length, libctx, propq);
  241|  11.7k|    return ret;
  242|  11.7k|}
d2i_AutoPrivateKey:
  246|  11.7k|{
  247|  11.7k|    return d2i_AutoPrivateKey_ex(a, pp, length, NULL, NULL);
  248|  11.7k|}
d2i_pr.c:d2i_PrivateKey_decoder:
   30|  11.7k|{
   31|  11.7k|    OSSL_DECODER_CTX *dctx = NULL;
   32|  11.7k|    size_t len = length;
   33|  11.7k|    EVP_PKEY *pkey = NULL, *bak_a = NULL;
   34|  11.7k|    EVP_PKEY **ppkey = &pkey;
   35|  11.7k|    const char *key_name = NULL;
   36|  11.7k|    char keytypebuf[OSSL_MAX_NAME_SIZE];
   37|  11.7k|    int ret;
   38|  11.7k|    const unsigned char *p = *pp;
   39|  11.7k|    const char *structure;
   40|  11.7k|    PKCS8_PRIV_KEY_INFO *p8info;
   41|  11.7k|    const ASN1_OBJECT *algoid;
   42|       |
   43|  11.7k|    if (keytype != EVP_PKEY_NONE) {
  ------------------
  |  |   58|  11.7k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  11.7k|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (43:9): [True: 0, False: 11.7k]
  ------------------
   44|      0|        key_name = evp_pkey_type2name(keytype);
   45|      0|        if (key_name == NULL)
  ------------------
  |  Branch (45:13): [True: 0, False: 0]
  ------------------
   46|      0|            return NULL;
   47|      0|    }
   48|       |
   49|       |    /* This is just a probe. It might fail, so we ignore errors */
   50|  11.7k|    ERR_set_mark();
   51|  11.7k|    p8info = d2i_PKCS8_PRIV_KEY_INFO(NULL, pp, len);
   52|  11.7k|    ERR_pop_to_mark();
   53|  11.7k|    if (p8info != NULL) {
  ------------------
  |  Branch (53:9): [True: 668, False: 11.0k]
  ------------------
   54|    668|        if (key_name == NULL
  ------------------
  |  Branch (54:13): [True: 668, False: 0]
  ------------------
   55|    668|                && PKCS8_pkey_get0(&algoid, NULL, NULL, NULL, p8info)
  ------------------
  |  Branch (55:20): [True: 668, False: 0]
  ------------------
   56|    668|                && OBJ_obj2txt(keytypebuf, sizeof(keytypebuf), algoid, 0))
  ------------------
  |  Branch (56:20): [True: 668, False: 0]
  ------------------
   57|    668|            key_name = keytypebuf;
   58|    668|        structure = "PrivateKeyInfo";
   59|    668|        PKCS8_PRIV_KEY_INFO_free(p8info);
   60|  11.0k|    } else {
   61|  11.0k|        structure = "type-specific";
   62|  11.0k|    }
   63|  11.7k|    *pp = p;
   64|       |
   65|  11.7k|    if (a != NULL && (bak_a = *a) != NULL)
  ------------------
  |  Branch (65:9): [True: 0, False: 11.7k]
  |  Branch (65:22): [True: 0, False: 0]
  ------------------
   66|      0|        ppkey = a;
   67|  11.7k|    dctx = OSSL_DECODER_CTX_new_for_pkey(ppkey, "DER", structure, key_name,
   68|  11.7k|                                         EVP_PKEY_KEYPAIR, libctx, propq);
  ------------------
  |  |   91|  11.7k|    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |   89|  11.7k|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  11.7k|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  549|  11.7k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  544|  11.7k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  550|  11.7k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  545|  11.7k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  11.7k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  542|  11.7k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  ------------------
   69|  11.7k|    if (a != NULL)
  ------------------
  |  Branch (69:9): [True: 0, False: 11.7k]
  ------------------
   70|      0|        *a = bak_a;
   71|  11.7k|    if (dctx == NULL)
  ------------------
  |  Branch (71:9): [True: 0, False: 11.7k]
  ------------------
   72|      0|        goto err;
   73|       |
   74|  11.7k|    ret = OSSL_DECODER_from_data(dctx, pp, &len);
   75|  11.7k|    OSSL_DECODER_CTX_free(dctx);
   76|  11.7k|    if (ret
  ------------------
  |  Branch (76:9): [True: 1.45k, False: 10.2k]
  ------------------
   77|  11.7k|        && *ppkey != NULL
  ------------------
  |  Branch (77:12): [True: 1.45k, False: 0]
  ------------------
   78|  11.7k|        && evp_keymgmt_util_has(*ppkey, OSSL_KEYMGMT_SELECT_PRIVATE_KEY)) {
  ------------------
  |  |  542|  1.45k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (78:12): [True: 1.45k, False: 0]
  ------------------
   79|  1.45k|        if (a != NULL)
  ------------------
  |  Branch (79:13): [True: 0, False: 1.45k]
  ------------------
   80|      0|            *a = *ppkey;
   81|  1.45k|        return *ppkey;
   82|  1.45k|    }
   83|       |
   84|  10.2k| err:
   85|  10.2k|    if (ppkey != a)
  ------------------
  |  Branch (85:9): [True: 10.2k, False: 0]
  ------------------
   86|  10.2k|        EVP_PKEY_free(*ppkey);
   87|  10.2k|    return NULL;
   88|  11.7k|}
d2i_pr.c:d2i_AutoPrivateKey_legacy:
  180|  10.2k|{
  181|  10.2k|    STACK_OF(ASN1_TYPE) *inkey;
  ------------------
  |  |   31|  10.2k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  182|  10.2k|    const unsigned char *p;
  183|  10.2k|    int keytype;
  184|       |
  185|  10.2k|    p = *pp;
  186|       |    /*
  187|       |     * Dirty trick: read in the ASN1 data into a STACK_OF(ASN1_TYPE): by
  188|       |     * analyzing it we can determine the passed structure: this assumes the
  189|       |     * input is surrounded by an ASN1 SEQUENCE.
  190|       |     */
  191|  10.2k|    inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
  192|  10.2k|    p = *pp;
  193|       |    /*
  194|       |     * Since we only need to discern "traditional format" RSA and DSA keys we
  195|       |     * can just count the elements.
  196|       |     */
  197|  10.2k|    if (sk_ASN1_TYPE_num(inkey) == 6) {
  ------------------
  |  |  555|  10.2k|#define sk_ASN1_TYPE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_TYPE_sk_type(sk))
  ------------------
  |  Branch (197:9): [True: 214, False: 10.0k]
  ------------------
  198|    214|        keytype = EVP_PKEY_DSA;
  ------------------
  |  |   62|    214|# define EVP_PKEY_DSA    NID_dsa
  |  |  ------------------
  |  |  |  |  136|    214|#define NID_dsa         116
  |  |  ------------------
  ------------------
  199|  10.0k|    } else if (sk_ASN1_TYPE_num(inkey) == 4) {
  ------------------
  |  |  555|  10.0k|#define sk_ASN1_TYPE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_TYPE_sk_type(sk))
  ------------------
  |  Branch (199:16): [True: 385, False: 9.66k]
  ------------------
  200|    385|        keytype = EVP_PKEY_EC;
  ------------------
  |  |   69|    385|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|    385|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
  201|  9.66k|    } else if (sk_ASN1_TYPE_num(inkey) == 3) { /* This seems to be PKCS8, not
  ------------------
  |  |  555|  9.66k|#define sk_ASN1_TYPE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_TYPE_sk_type(sk))
  ------------------
  |  Branch (201:16): [True: 973, False: 8.69k]
  ------------------
  202|       |                                              * traditional format */
  203|    973|        PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
  204|    973|        EVP_PKEY *ret;
  205|       |
  206|    973|        sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
  ------------------
  |  |  569|    973|#define sk_ASN1_TYPE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_TYPE_sk_type(sk),ossl_check_ASN1_TYPE_freefunc_type(freefunc))
  ------------------
  207|    973|        if (p8 == NULL) {
  ------------------
  |  Branch (207:13): [True: 823, False: 150]
  ------------------
  208|    823|            ERR_raise(ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
  ------------------
  |  |  401|    823|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    823|    (ERR_new(),                                                 \
  |  |  |  |  404|    823|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    823|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    823|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    823|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    823|     ERR_set_error)
  |  |  ------------------
  ------------------
  209|    823|            return NULL;
  210|    823|        }
  211|    150|        ret = evp_pkcs82pkey_legacy(p8, libctx, propq);
  212|    150|        PKCS8_PRIV_KEY_INFO_free(p8);
  213|    150|        if (ret == NULL)
  ------------------
  |  Branch (213:13): [True: 78, False: 72]
  ------------------
  214|     78|            return NULL;
  215|     72|        *pp = p;
  216|     72|        if (a != NULL) {
  ------------------
  |  Branch (216:13): [True: 0, False: 72]
  ------------------
  217|      0|            *a = ret;
  218|      0|        }
  219|     72|        return ret;
  220|  8.69k|    } else {
  221|  8.69k|        keytype = EVP_PKEY_RSA;
  ------------------
  |  |   59|  8.69k|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|  8.69k|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
  222|  8.69k|    }
  223|  9.29k|    sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
  ------------------
  |  |  569|  9.29k|#define sk_ASN1_TYPE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_TYPE_sk_type(sk),ossl_check_ASN1_TYPE_freefunc_type(freefunc))
  ------------------
  224|  9.29k|    return ossl_d2i_PrivateKey_legacy(keytype, a, pp, length, libctx, propq);
  225|  10.2k|}

i2d_PrivateKey:
   95|  1.55k|{
   96|  1.55k|    if (evp_pkey_is_provided(a)) {
  ------------------
  |  |  642|  1.55k|    ((pk)->keymgmt != NULL)
  |  |  ------------------
  |  |  |  Branch (642:5): [True: 1.45k, False: 103]
  |  |  ------------------
  ------------------
   97|  1.45k|        static const struct type_and_structure_st output_info[] = {
   98|  1.45k|            { "DER", "type-specific" },
   99|  1.45k|            { "DER", "PrivateKeyInfo" },
  100|  1.45k|            { NULL, }
  101|  1.45k|        };
  102|       |
  103|  1.45k|        return i2d_provided(a, EVP_PKEY_KEYPAIR, output_info, pp);
  ------------------
  |  |   91|  1.45k|    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |   89|  1.45k|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  1.45k|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  549|  1.45k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  544|  1.45k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  550|  1.45k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  545|  1.45k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  1.45k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  542|  1.45k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  ------------------
  104|  1.45k|    }
  105|    103|    if (a->ameth != NULL && a->ameth->old_priv_encode != NULL) {
  ------------------
  |  Branch (105:9): [True: 103, False: 0]
  |  Branch (105:29): [True: 99, False: 4]
  ------------------
  106|     99|        return a->ameth->old_priv_encode(a, pp);
  107|     99|    }
  108|      4|    if (a->ameth != NULL && a->ameth->priv_encode != NULL) {
  ------------------
  |  Branch (108:9): [True: 4, False: 0]
  |  Branch (108:29): [True: 4, False: 0]
  ------------------
  109|      4|        PKCS8_PRIV_KEY_INFO *p8 = EVP_PKEY2PKCS8(a);
  110|      4|        int ret = 0;
  111|       |
  112|      4|        if (p8 != NULL) {
  ------------------
  |  Branch (112:13): [True: 4, False: 0]
  ------------------
  113|      4|            ret = i2d_PKCS8_PRIV_KEY_INFO(p8, pp);
  114|      4|            PKCS8_PRIV_KEY_INFO_free(p8);
  115|      4|        }
  116|      4|        return ret;
  117|      4|    }
  118|      4|    ERR_raise(ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  119|      0|    return -1;
  120|      4|}
i2d_evp.c:i2d_provided:
   36|  1.45k|{
   37|  1.45k|    int ret;
   38|       |
   39|  1.45k|    for (ret = -1;
   40|  3.08k|         ret == -1 && output_info->output_type != NULL;
  ------------------
  |  Branch (40:10): [True: 1.78k, False: 1.30k]
  |  Branch (40:23): [True: 1.63k, False: 150]
  ------------------
   41|  1.63k|         output_info++) {
   42|       |        /*
   43|       |         * The i2d_ calls don't take a boundary length for *pp.  However,
   44|       |         * OSSL_ENCODER_to_data() needs one, so we make one up.  Because
   45|       |         * OSSL_ENCODER_to_data() decrements this number by the amount of
   46|       |         * bytes written, we need to calculate the length written further
   47|       |         * down, when pp != NULL.
   48|       |         */
   49|  1.63k|        size_t len = INT_MAX;
   50|  1.63k|        int pp_was_NULL = (pp == NULL || *pp == NULL);
  ------------------
  |  Branch (50:28): [True: 0, False: 1.63k]
  |  Branch (50:42): [True: 1.63k, False: 0]
  ------------------
   51|  1.63k|        OSSL_ENCODER_CTX *ctx;
   52|       |
   53|  1.63k|        ctx = OSSL_ENCODER_CTX_new_for_pkey(a, selection,
   54|  1.63k|                                            output_info->output_type,
   55|  1.63k|                                            output_info->output_structure,
   56|  1.63k|                                            NULL);
   57|  1.63k|        if (ctx == NULL)
  ------------------
  |  Branch (57:13): [True: 0, False: 1.63k]
  ------------------
   58|      0|            return -1;
   59|  1.63k|        if (OSSL_ENCODER_to_data(ctx, pp, &len)) {
  ------------------
  |  Branch (59:13): [True: 1.30k, False: 335]
  ------------------
   60|  1.30k|            if (pp_was_NULL)
  ------------------
  |  Branch (60:17): [True: 1.30k, False: 0]
  ------------------
   61|  1.30k|                ret = (int)len;
   62|      0|            else
   63|      0|                ret = INT_MAX - (int)len;
   64|  1.30k|        }
   65|  1.63k|        OSSL_ENCODER_CTX_free(ctx);
   66|  1.63k|    }
   67|       |
   68|  1.45k|    if (ret == -1)
  ------------------
  |  Branch (68:9): [True: 150, False: 1.30k]
  ------------------
   69|  1.45k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_TYPE);
  ------------------
  |  |  401|    150|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    150|    (ERR_new(),                                                 \
  |  |  |  |  404|    150|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    150|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    150|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    150|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    150|     ERR_set_error)
  |  |  ------------------
  ------------------
   70|  1.45k|    return ret;
   71|  1.45k|}

nsseq.c:nsseq_cb:
   18|  46.4k|{
   19|  46.4k|    if (operation == ASN1_OP_NEW_POST) {
  ------------------
  |  |  743|  46.4k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (19:9): [True: 9.23k, False: 37.2k]
  ------------------
   20|  9.23k|        NETSCAPE_CERT_SEQUENCE *nsseq;
   21|  9.23k|        nsseq = (NETSCAPE_CERT_SEQUENCE *)*pval;
   22|  9.23k|        nsseq->type = OBJ_nid2obj(NID_netscape_cert_sequence);
  ------------------
  |  | 2949|  9.23k|#define NID_netscape_cert_sequence              79
  ------------------
   23|  9.23k|    }
   24|  46.4k|    return 1;
   25|  46.4k|}

PKCS8_pkey_set0:
   41|     39|{
   42|     39|    if (version >= 0) {
  ------------------
  |  Branch (42:9): [True: 39, False: 0]
  ------------------
   43|     39|        if (!ASN1_INTEGER_set(priv->version, version))
  ------------------
  |  Branch (43:13): [True: 0, False: 39]
  ------------------
   44|      0|            return 0;
   45|     39|    }
   46|     39|    if (!X509_ALGOR_set0(priv->pkeyalg, aobj, ptype, pval))
  ------------------
  |  Branch (46:9): [True: 0, False: 39]
  ------------------
   47|      0|        return 0;
   48|     39|    if (penc)
  ------------------
  |  Branch (48:9): [True: 39, False: 0]
  ------------------
   49|     39|        ASN1_STRING_set0(priv->pkey, penc, penclen);
   50|     39|    return 1;
   51|     39|}
PKCS8_pkey_get0:
   56|  2.33k|{
   57|  2.33k|    if (ppkalg)
  ------------------
  |  Branch (57:9): [True: 825, False: 1.50k]
  ------------------
   58|    825|        *ppkalg = p8->pkeyalg->algorithm;
   59|  2.33k|    if (pk) {
  ------------------
  |  Branch (59:9): [True: 705, False: 1.62k]
  ------------------
   60|    705|        *pk = ASN1_STRING_get0_data(p8->pkey);
   61|    705|        *ppklen = ASN1_STRING_length(p8->pkey);
   62|    705|    }
   63|  2.33k|    if (pa)
  ------------------
  |  Branch (63:9): [True: 1.50k, False: 825]
  ------------------
   64|  1.50k|        *pa = p8->pkeyalg;
   65|  2.33k|    return 1;
   66|  2.33k|}
p8_pkey.c:pkey_cb:
   19|   433k|{
   20|       |    /* Since the structure must still be valid use ASN1_OP_FREE_PRE */
   21|   433k|    if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|   433k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (21:9): [True: 85.5k, False: 347k]
  ------------------
   22|  85.5k|        PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval;
   23|  85.5k|        if (key->pkey)
  ------------------
  |  Branch (23:13): [True: 85.5k, False: 0]
  ------------------
   24|  85.5k|            OPENSSL_cleanse(key->pkey->data, key->pkey->length);
   25|  85.5k|    }
   26|   433k|    return 1;
   27|   433k|}

ASN1_buf_print:
   22|  1.44k|{
   23|  1.44k|    size_t i;
   24|       |
   25|  57.1k|    for (i = 0; i < buflen; i++) {
  ------------------
  |  Branch (25:17): [True: 55.6k, False: 1.44k]
  ------------------
   26|  55.6k|        if ((i % ASN1_BUF_PRINT_WIDTH) == 0) {
  ------------------
  |  |   17|  55.6k|#define ASN1_BUF_PRINT_WIDTH    15
  ------------------
  |  Branch (26:13): [True: 4.20k, False: 51.4k]
  ------------------
   27|  4.20k|            if (i > 0 && BIO_puts(bp, "\n") <= 0)
  ------------------
  |  Branch (27:17): [True: 2.76k, False: 1.44k]
  |  Branch (27:26): [True: 0, False: 2.76k]
  ------------------
   28|      0|                return 0;
   29|  4.20k|            if (!BIO_indent(bp, indent, ASN1_PRINT_MAX_INDENT))
  ------------------
  |  |   19|  4.20k|#define ASN1_PRINT_MAX_INDENT 128
  ------------------
  |  Branch (29:17): [True: 0, False: 4.20k]
  ------------------
   30|      0|                return 0;
   31|  4.20k|        }
   32|       |        /*
   33|       |         * Use colon separators for each octet for compatibility as
   34|       |         * this function is used to print out key components.
   35|       |         */
   36|  55.6k|        if (BIO_printf(bp, "%02x%s", buf[i],
  ------------------
  |  Branch (36:13): [True: 0, False: 55.6k]
  ------------------
   37|  55.6k|                       (i == buflen - 1) ? "" : ":") <= 0)
  ------------------
  |  Branch (37:24): [True: 1.44k, False: 54.2k]
  ------------------
   38|      0|                return 0;
   39|  55.6k|    }
   40|  1.44k|    if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (40:9): [True: 0, False: 1.44k]
  ------------------
   41|      0|        return 0;
   42|  1.44k|    return 1;
   43|  1.44k|}
ASN1_bn_print:
   47|  4.03k|{
   48|  4.03k|    int n, rv = 0;
   49|  4.03k|    const char *neg;
   50|  4.03k|    unsigned char *buf = NULL, *tmp = NULL;
   51|  4.03k|    int buflen;
   52|       |
   53|  4.03k|    if (num == NULL)
  ------------------
  |  Branch (53:9): [True: 0, False: 4.03k]
  ------------------
   54|      0|        return 1;
   55|  4.03k|    neg = BN_is_negative(num) ? "-" : "";
  ------------------
  |  Branch (55:11): [True: 0, False: 4.03k]
  ------------------
   56|  4.03k|    if (!BIO_indent(bp, indent, ASN1_PRINT_MAX_INDENT))
  ------------------
  |  |   19|  4.03k|#define ASN1_PRINT_MAX_INDENT 128
  ------------------
  |  Branch (56:9): [True: 0, False: 4.03k]
  ------------------
   57|      0|        return 0;
   58|  4.03k|    if (BN_is_zero(num)) {
  ------------------
  |  Branch (58:9): [True: 1.94k, False: 2.09k]
  ------------------
   59|  1.94k|        if (BIO_printf(bp, "%s 0\n", number) <= 0)
  ------------------
  |  Branch (59:13): [True: 0, False: 1.94k]
  ------------------
   60|      0|            return 0;
   61|  1.94k|        return 1;
   62|  1.94k|    }
   63|       |
   64|  2.09k|    if (BN_num_bytes(num) <= BN_BYTES) {
  ------------------
  |  |  189|  2.09k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
                  if (BN_num_bytes(num) <= BN_BYTES) {
  ------------------
  |  |   38|  2.09k|#  define BN_BYTES        8
  ------------------
  |  Branch (64:9): [True: 1.53k, False: 553]
  ------------------
   65|  1.53k|        if (BIO_printf(bp, "%s %s%lu (%s0x%lx)\n", number, neg,
  ------------------
  |  Branch (65:13): [True: 0, False: 1.53k]
  ------------------
   66|  1.53k|                       (unsigned long)bn_get_words(num)[0], neg,
   67|  1.53k|                       (unsigned long)bn_get_words(num)[0]) <= 0)
   68|      0|            return 0;
   69|  1.53k|        return 1;
   70|  1.53k|    }
   71|       |
   72|    553|    buflen = BN_num_bytes(num) + 1;
  ------------------
  |  |  189|    553|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
   73|    553|    buf = tmp = OPENSSL_malloc(buflen);
  ------------------
  |  |   97|    553|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    553|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    553|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   74|    553|    if (buf == NULL)
  ------------------
  |  Branch (74:9): [True: 0, False: 553]
  ------------------
   75|      0|        goto err;
   76|    553|    buf[0] = 0;
   77|    553|    if (BIO_printf(bp, "%s%s\n", number,
  ------------------
  |  Branch (77:9): [True: 0, False: 553]
  ------------------
   78|    553|                   (neg[0] == '-') ? " (Negative)" : "") <= 0)
  ------------------
  |  Branch (78:20): [True: 0, False: 553]
  ------------------
   79|      0|        goto err;
   80|    553|    n = BN_bn2bin(num, buf + 1);
   81|       |
   82|    553|    if (buf[1] & 0x80)
  ------------------
  |  Branch (82:9): [True: 243, False: 310]
  ------------------
   83|    243|        n++;
   84|    310|    else
   85|    310|        tmp++;
   86|       |
   87|    553|    if (ASN1_buf_print(bp, tmp, n, indent + 4) == 0)
  ------------------
  |  Branch (87:9): [True: 0, False: 553]
  ------------------
   88|      0|        goto err;
   89|    553|    rv = 1;
   90|    553|    err:
   91|    553|    OPENSSL_clear_free(buf, buflen);
  ------------------
  |  |  105|    553|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    553|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    553|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|    553|    return rv;
   93|    553|}

ASN1_tag2bit:
   88|   833k|{
   89|   833k|    if ((tag < 0) || (tag > 30))
  ------------------
  |  Branch (89:9): [True: 0, False: 833k]
  |  Branch (89:22): [True: 467, False: 832k]
  ------------------
   90|    467|        return 0;
   91|   832k|    return tag2bit[tag];
   92|   833k|}
ASN1_item_ex_d2i:
  128|   210k|{
  129|   210k|    return asn1_item_ex_d2i_intern(pval, in, len, it, tag, aclass, opt, ctx,
  130|   210k|                                   NULL, NULL);
  131|   210k|}
ASN1_item_d2i_ex:
  137|  2.64M|{
  138|  2.64M|    ASN1_TLC c;
  139|  2.64M|    ASN1_VALUE *ptmpval = NULL;
  140|       |
  141|  2.64M|    if (pval == NULL)
  ------------------
  |  Branch (141:9): [True: 2.57M, False: 73.7k]
  ------------------
  142|  2.57M|        pval = &ptmpval;
  143|  2.64M|    asn1_tlc_clear_nc(&c);
  ------------------
  |  |   98|  2.64M|#define asn1_tlc_clear_nc(c)    do {(c)->valid = 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (98:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  144|  2.64M|    if (asn1_item_ex_d2i_intern(pval, in, len, it, -1, 0, 0, &c, libctx,
  ------------------
  |  Branch (144:9): [True: 533k, False: 2.11M]
  ------------------
  145|  2.64M|                                propq) > 0)
  146|   533k|        return *pval;
  147|  2.11M|    return NULL;
  148|  2.64M|}
ASN1_item_d2i:
  153|  2.60M|{
  154|  2.60M|    return ASN1_item_d2i_ex(pval, in, len, it, NULL, NULL);
  155|  2.60M|}
tasn_dec.c:asn1_item_ex_d2i_intern:
  111|  2.85M|{
  112|  2.85M|    int rv;
  113|       |
  114|  2.85M|    if (pval == NULL || it == NULL) {
  ------------------
  |  Branch (114:9): [True: 0, False: 2.85M]
  |  Branch (114:25): [True: 0, False: 2.85M]
  ------------------
  115|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  116|      0|        return 0;
  117|      0|    }
  118|  2.85M|    rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0,
  119|  2.85M|                             libctx, propq);
  120|  2.85M|    if (rv <= 0)
  ------------------
  |  Branch (120:9): [True: 2.17M, False: 680k]
  ------------------
  121|  2.17M|        ASN1_item_ex_free(pval, it);
  122|  2.85M|    return rv;
  123|  2.85M|}
tasn_dec.c:asn1_item_embed_d2i:
  167|  12.2M|{
  168|  12.2M|    const ASN1_TEMPLATE *tt, *errtt = NULL;
  169|  12.2M|    const ASN1_EXTERN_FUNCS *ef;
  170|  12.2M|    const ASN1_AUX *aux;
  171|  12.2M|    ASN1_aux_cb *asn1_cb;
  172|  12.2M|    const unsigned char *p = NULL, *q;
  173|  12.2M|    unsigned char oclass;
  174|  12.2M|    char seq_eoc, seq_nolen, cst, isopt;
  175|  12.2M|    long tmplen;
  176|  12.2M|    int i;
  177|  12.2M|    int otag;
  178|  12.2M|    int ret = 0;
  179|  12.2M|    ASN1_VALUE **pchptr;
  180|       |
  181|  12.2M|    if (pval == NULL || it == NULL) {
  ------------------
  |  Branch (181:9): [True: 0, False: 12.2M]
  |  Branch (181:25): [True: 0, False: 12.2M]
  ------------------
  182|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  183|      0|        return 0;
  184|      0|    }
  185|  12.2M|    if (len <= 0) {
  ------------------
  |  Branch (185:9): [True: 1.62k, False: 12.2M]
  ------------------
  186|  1.62k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
  ------------------
  |  |  401|  1.62k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.62k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.62k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.62k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.62k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.62k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.62k|     ERR_set_error)
  |  |  ------------------
  ------------------
  187|  1.62k|        return 0;
  188|  1.62k|    }
  189|  12.2M|    aux = it->funcs;
  190|  12.2M|    if (aux && aux->asn1_cb)
  ------------------
  |  Branch (190:9): [True: 1.33M, False: 10.8M]
  |  Branch (190:16): [True: 1.07M, False: 264k]
  ------------------
  191|  1.07M|        asn1_cb = aux->asn1_cb;
  192|  11.1M|    else
  193|  11.1M|        asn1_cb = 0;
  194|       |
  195|  12.2M|    if (++depth > ASN1_MAX_CONSTRUCTED_NEST) {
  ------------------
  |  |   26|  12.2M|#define ASN1_MAX_CONSTRUCTED_NEST 30
  ------------------
  |  Branch (195:9): [True: 1, False: 12.2M]
  ------------------
  196|      1|        ERR_raise(ERR_LIB_ASN1, ASN1_R_NESTED_TOO_DEEP);
  ------------------
  |  |  401|      1|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
  197|      1|        goto err;
  198|      1|    }
  199|       |
  200|  12.2M|    switch (it->itype) {
  201|  8.47M|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |   80|  8.47M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (201:5): [True: 8.47M, False: 3.74M]
  ------------------
  202|  8.47M|        if (it->templates) {
  ------------------
  |  Branch (202:13): [True: 2.49M, False: 5.97M]
  ------------------
  203|       |            /*
  204|       |             * tagging or OPTIONAL is currently illegal on an item template
  205|       |             * because the flags can't get passed down. In practice this
  206|       |             * isn't a problem: we include the relevant flags from the item
  207|       |             * template in the template itself.
  208|       |             */
  209|  2.49M|            if ((tag != -1) || opt) {
  ------------------
  |  Branch (209:17): [True: 0, False: 2.49M]
  |  Branch (209:32): [True: 0, False: 2.49M]
  ------------------
  210|      0|                ERR_raise(ERR_LIB_ASN1,
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  211|      0|                          ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
  212|      0|                goto err;
  213|      0|            }
  214|  2.49M|            return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx,
  215|  2.49M|                                        depth, libctx, propq);
  216|  2.49M|        }
  217|  5.97M|        return asn1_d2i_ex_primitive(pval, in, len, it,
  218|  5.97M|                                     tag, aclass, opt, ctx);
  219|       |
  220|   487k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |   85|   487k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (220:5): [True: 487k, False: 11.7M]
  ------------------
  221|       |        /*
  222|       |         * It never makes sense for multi-strings to have implicit tagging, so
  223|       |         * if tag != -1, then this looks like an error in the template.
  224|       |         */
  225|   487k|        if (tag != -1) {
  ------------------
  |  Branch (225:13): [True: 0, False: 487k]
  ------------------
  226|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  227|      0|            goto err;
  228|      0|        }
  229|       |
  230|   487k|        p = *in;
  231|       |        /* Just read in tag and class */
  232|   487k|        ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
  233|   487k|                              &p, len, -1, 0, 1, ctx);
  234|   487k|        if (!ret) {
  ------------------
  |  Branch (234:13): [True: 1.47k, False: 486k]
  ------------------
  235|  1.47k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  1.47k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.47k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.47k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.47k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.47k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.47k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.47k|     ERR_set_error)
  |  |  ------------------
  ------------------
  236|  1.47k|            goto err;
  237|  1.47k|        }
  238|       |
  239|       |        /* Must be UNIVERSAL class */
  240|   486k|        if (oclass != V_ASN1_UNIVERSAL) {
  ------------------
  |  |   47|   486k|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (240:13): [True: 9.46k, False: 476k]
  ------------------
  241|       |            /* If OPTIONAL, assume this is OK */
  242|  9.46k|            if (opt)
  ------------------
  |  Branch (242:17): [True: 4.39k, False: 5.07k]
  ------------------
  243|  4.39k|                return -1;
  244|  9.46k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_MSTRING_NOT_UNIVERSAL);
  ------------------
  |  |  401|  5.07k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  5.07k|    (ERR_new(),                                                 \
  |  |  |  |  404|  5.07k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  5.07k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  5.07k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  5.07k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  5.07k|     ERR_set_error)
  |  |  ------------------
  ------------------
  245|  5.07k|            goto err;
  246|  9.46k|        }
  247|       |
  248|       |        /* Check tag matches bit map */
  249|   476k|        if (!(ASN1_tag2bit(otag) & it->utype)) {
  ------------------
  |  Branch (249:13): [True: 65.2k, False: 411k]
  ------------------
  250|       |            /* If OPTIONAL, assume this is OK */
  251|  65.2k|            if (opt)
  ------------------
  |  Branch (251:17): [True: 1.84k, False: 63.3k]
  ------------------
  252|  1.84k|                return -1;
  253|  65.2k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_MSTRING_WRONG_TAG);
  ------------------
  |  |  401|  63.3k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  63.3k|    (ERR_new(),                                                 \
  |  |  |  |  404|  63.3k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  63.3k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  63.3k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  63.3k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  63.3k|     ERR_set_error)
  |  |  ------------------
  ------------------
  254|  63.3k|            goto err;
  255|  65.2k|        }
  256|   411k|        return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);
  257|       |
  258|   210k|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |   84|   210k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (258:5): [True: 210k, False: 12.0M]
  ------------------
  259|       |        /* Use new style d2i */
  260|   210k|        ef = it->funcs;
  261|   210k|        if (ef->asn1_ex_d2i_ex != NULL)
  ------------------
  |  Branch (261:13): [True: 88.5k, False: 121k]
  ------------------
  262|  88.5k|            return ef->asn1_ex_d2i_ex(pval, in, len, it, tag, aclass, opt, ctx,
  263|  88.5k|                                      libctx, propq);
  264|   121k|        return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
  265|       |
  266|   246k|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |   82|   246k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (266:5): [True: 246k, False: 11.9M]
  ------------------
  267|       |        /*
  268|       |         * It never makes sense for CHOICE types to have implicit tagging, so
  269|       |         * if tag != -1, then this looks like an error in the template.
  270|       |         */
  271|   246k|        if (tag != -1) {
  ------------------
  |  Branch (271:13): [True: 0, False: 246k]
  ------------------
  272|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  273|      0|            goto err;
  274|      0|        }
  275|       |
  276|   246k|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
  ------------------
  |  |  746|  24.8k|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (276:13): [True: 24.8k, False: 221k]
  |  Branch (276:24): [True: 0, False: 24.8k]
  ------------------
  277|      0|            goto auxerr;
  278|   246k|        if (*pval) {
  ------------------
  |  Branch (278:13): [True: 26.9k, False: 219k]
  ------------------
  279|       |            /* Free up and zero CHOICE value if initialised */
  280|  26.9k|            i = ossl_asn1_get_choice_selector(pval, it);
  281|  26.9k|            if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (281:17): [True: 0, False: 26.9k]
  |  Branch (281:29): [True: 0, False: 0]
  ------------------
  282|      0|                tt = it->templates + i;
  283|      0|                pchptr = ossl_asn1_get_field_ptr(pval, tt);
  284|      0|                ossl_asn1_template_free(pchptr, tt);
  285|      0|                ossl_asn1_set_choice_selector(pval, -1, it);
  286|      0|            }
  287|   219k|        } else if (!ossl_asn1_item_ex_new_intern(pval, it, libctx, propq)) {
  ------------------
  |  Branch (287:20): [True: 0, False: 219k]
  ------------------
  288|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  289|      0|            goto err;
  290|      0|        }
  291|       |        /* CHOICE type, try each possibility in turn */
  292|   246k|        p = *in;
  293|   874k|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (293:41): [True: 774k, False: 100k]
  ------------------
  294|   774k|            pchptr = ossl_asn1_get_field_ptr(pval, tt);
  295|       |            /*
  296|       |             * We mark field as OPTIONAL so its absence can be recognised.
  297|       |             */
  298|   774k|            ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx, depth,
  299|   774k|                                       libctx, propq);
  300|       |            /* If field not present, try the next one */
  301|   774k|            if (ret == -1)
  ------------------
  |  Branch (301:17): [True: 628k, False: 145k]
  ------------------
  302|   628k|                continue;
  303|       |            /* If positive return, read OK, break loop */
  304|   145k|            if (ret > 0)
  ------------------
  |  Branch (304:17): [True: 61.6k, False: 84.0k]
  ------------------
  305|  61.6k|                break;
  306|       |            /*
  307|       |             * Must be an ASN1 parsing error.
  308|       |             * Free up any partial choice value
  309|       |             */
  310|  84.0k|            ossl_asn1_template_free(pchptr, tt);
  311|  84.0k|            errtt = tt;
  312|  84.0k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  84.0k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  84.0k|    (ERR_new(),                                                 \
  |  |  |  |  404|  84.0k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  84.0k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  84.0k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  84.0k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  84.0k|     ERR_set_error)
  |  |  ------------------
  ------------------
  313|  84.0k|            goto err;
  314|   145k|        }
  315|       |
  316|       |        /* Did we fall off the end without reading anything? */
  317|   162k|        if (i == it->tcount) {
  ------------------
  |  Branch (317:13): [True: 100k, False: 61.6k]
  ------------------
  318|       |            /* If OPTIONAL, this is OK */
  319|   100k|            if (opt) {
  ------------------
  |  Branch (319:17): [True: 6, False: 100k]
  ------------------
  320|       |                /* Free and zero it */
  321|      6|                ASN1_item_ex_free(pval, it);
  322|      6|                return -1;
  323|      6|            }
  324|   100k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_NO_MATCHING_CHOICE_TYPE);
  ------------------
  |  |  401|   100k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|   100k|    (ERR_new(),                                                 \
  |  |  |  |  404|   100k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|   100k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|   100k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|   100k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|   100k|     ERR_set_error)
  |  |  ------------------
  ------------------
  325|   100k|            goto err;
  326|   100k|        }
  327|       |
  328|  61.6k|        ossl_asn1_set_choice_selector(pval, i, it);
  329|       |
  330|  61.6k|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
  ------------------
  |  |  747|  12.2k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (330:13): [True: 12.2k, False: 49.4k]
  |  Branch (330:24): [True: 0, False: 12.2k]
  ------------------
  331|      0|            goto auxerr;
  332|  61.6k|        *in = p;
  333|  61.6k|        return 1;
  334|       |
  335|   121k|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |   86|   121k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (335:5): [True: 121k, False: 12.1M]
  ------------------
  336|  2.80M|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |   81|  2.80M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (336:5): [True: 2.68M, False: 9.53M]
  ------------------
  337|  2.80M|        p = *in;
  338|  2.80M|        tmplen = len;
  339|       |
  340|       |        /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
  341|  2.80M|        if (tag == -1) {
  ------------------
  |  Branch (341:13): [True: 2.68M, False: 123k]
  ------------------
  342|  2.68M|            tag = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|  2.68M|# define V_ASN1_SEQUENCE                 16
  ------------------
  343|  2.68M|            aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   47|  2.68M|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  344|  2.68M|        }
  345|       |        /* Get SEQUENCE length and update len, p */
  346|  2.80M|        ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst,
  347|  2.80M|                              &p, len, tag, aclass, opt, ctx);
  348|  2.80M|        if (!ret) {
  ------------------
  |  Branch (348:13): [True: 536k, False: 2.26M]
  ------------------
  349|   536k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|   536k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|   536k|    (ERR_new(),                                                 \
  |  |  |  |  404|   536k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|   536k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|   536k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|   536k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|   536k|     ERR_set_error)
  |  |  ------------------
  ------------------
  350|   536k|            goto err;
  351|  2.26M|        } else if (ret == -1)
  ------------------
  |  Branch (351:20): [True: 157k, False: 2.11M]
  ------------------
  352|   157k|            return -1;
  353|  2.11M|        if (aux && (aux->flags & ASN1_AFLG_BROKEN)) {
  ------------------
  |  |  736|   441k|# define ASN1_AFLG_BROKEN        4
  ------------------
  |  Branch (353:13): [True: 441k, False: 1.66M]
  |  Branch (353:20): [True: 0, False: 441k]
  ------------------
  354|      0|            len = tmplen - (p - *in);
  355|      0|            seq_nolen = 1;
  356|      0|        }
  357|       |        /* If indefinite we don't do a length check */
  358|  2.11M|        else
  359|  2.11M|            seq_nolen = seq_eoc;
  360|  2.11M|        if (!cst) {
  ------------------
  |  Branch (360:13): [True: 20.6k, False: 2.09M]
  ------------------
  361|  20.6k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
  ------------------
  |  |  401|  20.6k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  20.6k|    (ERR_new(),                                                 \
  |  |  |  |  404|  20.6k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  20.6k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  20.6k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  20.6k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  20.6k|     ERR_set_error)
  |  |  ------------------
  ------------------
  362|  20.6k|            goto err;
  363|  20.6k|        }
  364|       |
  365|  2.09M|        if (*pval == NULL
  ------------------
  |  Branch (365:13): [True: 1.65M, False: 435k]
  ------------------
  366|  2.09M|                && !ossl_asn1_item_ex_new_intern(pval, it, libctx, propq)) {
  ------------------
  |  Branch (366:20): [True: 0, False: 1.65M]
  ------------------
  367|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  368|      0|            goto err;
  369|      0|        }
  370|       |
  371|  2.09M|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
  ------------------
  |  |  746|   390k|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (371:13): [True: 390k, False: 1.70M]
  |  Branch (371:24): [True: 0, False: 390k]
  ------------------
  372|      0|            goto auxerr;
  373|       |
  374|       |        /* Free up and zero any ADB found */
  375|  8.63M|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (375:41): [True: 6.54M, False: 2.09M]
  ------------------
  376|  6.54M|            if (tt->flags & ASN1_TFLG_ADB_MASK) {
  ------------------
  |  |  583|  6.54M|# define ASN1_TFLG_ADB_MASK      (0x3<<8)
  ------------------
  |  Branch (376:17): [True: 70.7k, False: 6.47M]
  ------------------
  377|  70.7k|                const ASN1_TEMPLATE *seqtt;
  378|  70.7k|                ASN1_VALUE **pseqval;
  379|  70.7k|                seqtt = ossl_asn1_do_adb(*pval, tt, 0);
  380|  70.7k|                if (seqtt == NULL)
  ------------------
  |  Branch (380:21): [True: 50.1k, False: 20.6k]
  ------------------
  381|  50.1k|                    continue;
  382|  20.6k|                pseqval = ossl_asn1_get_field_ptr(pval, seqtt);
  383|  20.6k|                ossl_asn1_template_free(pseqval, seqtt);
  384|  20.6k|            }
  385|  6.54M|        }
  386|       |
  387|       |        /* Get each field entry */
  388|  4.72M|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (388:41): [True: 3.99M, False: 731k]
  ------------------
  389|  3.99M|            const ASN1_TEMPLATE *seqtt;
  390|  3.99M|            ASN1_VALUE **pseqval;
  391|  3.99M|            seqtt = ossl_asn1_do_adb(*pval, tt, 1);
  392|  3.99M|            if (seqtt == NULL)
  ------------------
  |  Branch (392:17): [True: 0, False: 3.99M]
  ------------------
  393|      0|                goto err;
  394|  3.99M|            pseqval = ossl_asn1_get_field_ptr(pval, seqtt);
  395|       |            /* Have we ran out of data? */
  396|  3.99M|            if (!len)
  ------------------
  |  Branch (396:17): [True: 72.7k, False: 3.92M]
  ------------------
  397|  72.7k|                break;
  398|  3.92M|            q = p;
  399|  3.92M|            if (asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (399:17): [True: 131k, False: 3.79M]
  ------------------
  400|   131k|                if (!seq_eoc) {
  ------------------
  |  Branch (400:21): [True: 1.18k, False: 130k]
  ------------------
  401|  1.18k|                    ERR_raise(ERR_LIB_ASN1, ASN1_R_UNEXPECTED_EOC);
  ------------------
  |  |  401|  1.18k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.18k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.18k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.18k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.18k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.18k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.18k|     ERR_set_error)
  |  |  ------------------
  ------------------
  402|  1.18k|                    goto err;
  403|  1.18k|                }
  404|   130k|                len -= p - q;
  405|   130k|                seq_eoc = 0;
  406|   130k|                break;
  407|   131k|            }
  408|       |            /*
  409|       |             * This determines the OPTIONAL flag value. The field cannot be
  410|       |             * omitted if it is the last of a SEQUENCE and there is still
  411|       |             * data to be read. This isn't strictly necessary but it
  412|       |             * increases efficiency in some cases.
  413|       |             */
  414|  3.79M|            if (i == (it->tcount - 1))
  ------------------
  |  Branch (414:17): [True: 931k, False: 2.86M]
  ------------------
  415|   931k|                isopt = 0;
  416|  2.86M|            else
  417|  2.86M|                isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
  ------------------
  |  |  523|  2.86M|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  418|       |            /*
  419|       |             * attempt to read in field, allowing each to be OPTIONAL
  420|       |             */
  421|       |
  422|  3.79M|            ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx,
  423|  3.79M|                                       depth, libctx, propq);
  424|  3.79M|            if (!ret) {
  ------------------
  |  Branch (424:17): [True: 1.15M, False: 2.63M]
  ------------------
  425|  1.15M|                errtt = seqtt;
  426|  1.15M|                goto err;
  427|  2.63M|            } else if (ret == -1) {
  ------------------
  |  Branch (427:24): [True: 417k, False: 2.22M]
  ------------------
  428|       |                /*
  429|       |                 * OPTIONAL component absent. Free and zero the field.
  430|       |                 */
  431|   417k|                ossl_asn1_template_free(pseqval, seqtt);
  432|   417k|                continue;
  433|   417k|            }
  434|       |            /* Update length */
  435|  2.22M|            len -= p - q;
  436|  2.22M|        }
  437|       |
  438|       |        /* Check for EOC if expecting one */
  439|   934k|        if (seq_eoc && !asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (439:13): [True: 282k, False: 652k]
  |  Branch (439:24): [True: 17.2k, False: 265k]
  ------------------
  440|  17.2k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_MISSING_EOC);
  ------------------
  |  |  401|  17.2k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  17.2k|    (ERR_new(),                                                 \
  |  |  |  |  404|  17.2k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  17.2k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  17.2k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  17.2k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  17.2k|     ERR_set_error)
  |  |  ------------------
  ------------------
  441|  17.2k|            goto err;
  442|  17.2k|        }
  443|       |        /* Check all data read */
  444|   917k|        if (!seq_nolen && len) {
  ------------------
  |  Branch (444:13): [True: 522k, False: 395k]
  |  Branch (444:27): [True: 2.51k, False: 519k]
  ------------------
  445|  2.51k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_SEQUENCE_LENGTH_MISMATCH);
  ------------------
  |  |  401|  2.51k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  2.51k|    (ERR_new(),                                                 \
  |  |  |  |  404|  2.51k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  2.51k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  2.51k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  2.51k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  2.51k|     ERR_set_error)
  |  |  ------------------
  ------------------
  446|  2.51k|            goto err;
  447|  2.51k|        }
  448|       |
  449|       |        /*
  450|       |         * If we get here we've got no more data in the SEQUENCE, however we
  451|       |         * may not have read all fields so check all remaining are OPTIONAL
  452|       |         * and clear any that are.
  453|       |         */
  454|  1.22M|        for (; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (454:16): [True: 327k, False: 893k]
  ------------------
  455|   327k|            const ASN1_TEMPLATE *seqtt;
  456|   327k|            seqtt = ossl_asn1_do_adb(*pval, tt, 1);
  457|   327k|            if (seqtt == NULL)
  ------------------
  |  Branch (457:17): [True: 0, False: 327k]
  ------------------
  458|      0|                goto err;
  459|   327k|            if (seqtt->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  523|   327k|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  |  Branch (459:17): [True: 305k, False: 21.4k]
  ------------------
  460|   305k|                ASN1_VALUE **pseqval;
  461|   305k|                pseqval = ossl_asn1_get_field_ptr(pval, seqtt);
  462|   305k|                ossl_asn1_template_free(pseqval, seqtt);
  463|   305k|            } else {
  464|  21.4k|                errtt = seqtt;
  465|  21.4k|                ERR_raise(ERR_LIB_ASN1, ASN1_R_FIELD_MISSING);
  ------------------
  |  |  401|  21.4k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  21.4k|    (ERR_new(),                                                 \
  |  |  |  |  404|  21.4k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  21.4k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  21.4k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  21.4k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  21.4k|     ERR_set_error)
  |  |  ------------------
  ------------------
  466|  21.4k|                goto err;
  467|  21.4k|            }
  468|   327k|        }
  469|       |        /* Save encoding */
  470|   893k|        if (!ossl_asn1_enc_save(pval, *in, p - *in, it))
  ------------------
  |  Branch (470:13): [True: 0, False: 893k]
  ------------------
  471|      0|            goto auxerr;
  472|   893k|        if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
  ------------------
  |  |  747|  71.5k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (472:13): [True: 71.5k, False: 822k]
  |  Branch (472:24): [True: 91, False: 71.4k]
  ------------------
  473|     91|            goto auxerr;
  474|   893k|        *in = p;
  475|   893k|        return 1;
  476|       |
  477|      0|    default:
  ------------------
  |  Branch (477:5): [True: 0, False: 12.2M]
  ------------------
  478|      0|        return 0;
  479|  12.2M|    }
  480|     91| auxerr:
  481|     91|    ERR_raise(ERR_LIB_ASN1, ASN1_R_AUX_ERROR);
  ------------------
  |  |  401|     91|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     91|    (ERR_new(),                                                 \
  |  |  |  |  404|     91|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     91|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     91|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     91|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     91|     ERR_set_error)
  |  |  ------------------
  ------------------
  482|  2.00M| err:
  483|  2.00M|    if (errtt)
  ------------------
  |  Branch (483:9): [True: 1.26M, False: 748k]
  ------------------
  484|  1.26M|        ERR_add_error_data(4, "Field=", errtt->field_name,
  485|  1.26M|                           ", Type=", it->sname);
  486|   748k|    else
  487|   748k|        ERR_add_error_data(2, "Type=", it->sname);
  488|  2.00M|    return 0;
  489|     91|}
tasn_dec.c:asn1_template_ex_d2i:
  501|  7.05M|{
  502|  7.05M|    int flags, aclass;
  503|  7.05M|    int ret;
  504|  7.05M|    long len;
  505|  7.05M|    const unsigned char *p, *q;
  506|  7.05M|    char exp_eoc;
  507|  7.05M|    if (!val)
  ------------------
  |  Branch (507:9): [True: 0, False: 7.05M]
  ------------------
  508|      0|        return 0;
  509|  7.05M|    flags = tt->flags;
  510|  7.05M|    aclass = flags & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  575|  7.05M|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  511|       |
  512|  7.05M|    p = *in;
  513|       |
  514|       |    /* Check if EXPLICIT tag expected */
  515|  7.05M|    if (flags & ASN1_TFLG_EXPTAG) {
  ------------------
  |  |  550|  7.05M|# define ASN1_TFLG_EXPTAG        (0x2 << 3)
  ------------------
  |  Branch (515:9): [True: 351k, False: 6.70M]
  ------------------
  516|   351k|        char cst;
  517|       |        /*
  518|       |         * Need to work out amount of data available to the inner content and
  519|       |         * where it starts: so read in EXPLICIT header to get the info.
  520|       |         */
  521|   351k|        ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst,
  522|   351k|                              &p, inlen, tt->tag, aclass, opt, ctx);
  523|   351k|        q = p;
  524|   351k|        if (!ret) {
  ------------------
  |  Branch (524:13): [True: 48.6k, False: 303k]
  ------------------
  525|  48.6k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  48.6k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  48.6k|    (ERR_new(),                                                 \
  |  |  |  |  404|  48.6k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  48.6k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  48.6k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  48.6k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  48.6k|     ERR_set_error)
  |  |  ------------------
  ------------------
  526|  48.6k|            return 0;
  527|   303k|        } else if (ret == -1)
  ------------------
  |  Branch (527:20): [True: 267k, False: 35.6k]
  ------------------
  528|   267k|            return -1;
  529|  35.6k|        if (!cst) {
  ------------------
  |  Branch (529:13): [True: 556, False: 35.1k]
  ------------------
  530|    556|            ERR_raise(ERR_LIB_ASN1, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
  ------------------
  |  |  401|    556|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    556|    (ERR_new(),                                                 \
  |  |  |  |  404|    556|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    556|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    556|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    556|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    556|     ERR_set_error)
  |  |  ------------------
  ------------------
  531|    556|            return 0;
  532|    556|        }
  533|       |        /* We've found the field so it can't be OPTIONAL now */
  534|  35.1k|        ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx, depth, libctx,
  535|  35.1k|                                      propq);
  536|  35.1k|        if (!ret) {
  ------------------
  |  Branch (536:13): [True: 12.0k, False: 23.0k]
  ------------------
  537|  12.0k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  12.0k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  12.0k|    (ERR_new(),                                                 \
  |  |  |  |  404|  12.0k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  12.0k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  12.0k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  12.0k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  12.0k|     ERR_set_error)
  |  |  ------------------
  ------------------
  538|  12.0k|            return 0;
  539|  12.0k|        }
  540|       |        /* We read the field in OK so update length */
  541|  23.0k|        len -= p - q;
  542|  23.0k|        if (exp_eoc) {
  ------------------
  |  Branch (542:13): [True: 14.9k, False: 8.13k]
  ------------------
  543|       |            /* If NDEF we must have an EOC here */
  544|  14.9k|            if (!asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (544:17): [True: 512, False: 14.4k]
  ------------------
  545|    512|                ERR_raise(ERR_LIB_ASN1, ASN1_R_MISSING_EOC);
  ------------------
  |  |  401|    512|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    512|    (ERR_new(),                                                 \
  |  |  |  |  404|    512|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    512|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    512|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    512|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    512|     ERR_set_error)
  |  |  ------------------
  ------------------
  546|    512|                goto err;
  547|    512|            }
  548|  14.9k|        } else {
  549|       |            /*
  550|       |             * Otherwise we must hit the EXPLICIT tag end or its an error
  551|       |             */
  552|  8.13k|            if (len) {
  ------------------
  |  Branch (552:17): [True: 37, False: 8.09k]
  ------------------
  553|     37|                ERR_raise(ERR_LIB_ASN1, ASN1_R_EXPLICIT_LENGTH_MISMATCH);
  ------------------
  |  |  401|     37|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     37|    (ERR_new(),                                                 \
  |  |  |  |  404|     37|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     37|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     37|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     37|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     37|     ERR_set_error)
  |  |  ------------------
  ------------------
  554|     37|                goto err;
  555|     37|            }
  556|  8.13k|        }
  557|  23.0k|    } else
  558|  6.70M|        return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth,
  559|  6.70M|                                       libctx, propq);
  560|       |
  561|  22.5k|    *in = p;
  562|  22.5k|    return 1;
  563|       |
  564|    549| err:
  565|    549|    return 0;
  566|  7.05M|}
tasn_dec.c:asn1_template_noexp_d2i:
  573|  6.74M|{
  574|  6.74M|    int flags, aclass;
  575|  6.74M|    int ret;
  576|  6.74M|    ASN1_VALUE *tval;
  577|  6.74M|    const unsigned char *p, *q;
  578|  6.74M|    if (!val)
  ------------------
  |  Branch (578:9): [True: 0, False: 6.74M]
  ------------------
  579|      0|        return 0;
  580|  6.74M|    flags = tt->flags;
  581|  6.74M|    aclass = flags & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  575|  6.74M|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  582|       |
  583|  6.74M|    p = *in;
  584|       |
  585|       |    /*
  586|       |     * If field is embedded then val needs fixing so it is a pointer to
  587|       |     * a pointer to a field.
  588|       |     */
  589|  6.74M|    if (tt->flags & ASN1_TFLG_EMBED) {
  ------------------
  |  |  597|  6.74M|# define ASN1_TFLG_EMBED         (0x1 << 12)
  ------------------
  |  Branch (589:9): [True: 509k, False: 6.23M]
  ------------------
  590|   509k|        tval = (ASN1_VALUE *)val;
  591|   509k|        val = &tval;
  592|   509k|    }
  593|       |
  594|  6.74M|    if (flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  539|  6.74M|# define ASN1_TFLG_SK_MASK       (0x3 << 1)
  ------------------
  |  Branch (594:9): [True: 2.70M, False: 4.03M]
  ------------------
  595|       |        /* SET OF, SEQUENCE OF */
  596|  2.70M|        int sktag, skaclass;
  597|  2.70M|        char sk_eoc;
  598|       |        /* First work out expected inner tag value */
  599|  2.70M|        if (flags & ASN1_TFLG_IMPTAG) {
  ------------------
  |  |  547|  2.70M|# define ASN1_TFLG_IMPTAG        (0x1 << 3)
  ------------------
  |  Branch (599:13): [True: 110k, False: 2.59M]
  ------------------
  600|   110k|            sktag = tt->tag;
  601|   110k|            skaclass = aclass;
  602|  2.59M|        } else {
  603|  2.59M|            skaclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   47|  2.59M|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  604|  2.59M|            if (flags & ASN1_TFLG_SET_OF)
  ------------------
  |  |  526|  2.59M|# define ASN1_TFLG_SET_OF        (0x1 << 1)
  ------------------
  |  Branch (604:17): [True: 2.22M, False: 365k]
  ------------------
  605|  2.22M|                sktag = V_ASN1_SET;
  ------------------
  |  |   75|  2.22M|# define V_ASN1_SET                      17
  ------------------
  606|   365k|            else
  607|   365k|                sktag = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|   365k|# define V_ASN1_SEQUENCE                 16
  ------------------
  608|  2.59M|        }
  609|       |        /* Get the tag */
  610|  2.70M|        ret = asn1_check_tlen(&len, NULL, NULL, &sk_eoc, NULL,
  611|  2.70M|                              &p, len, sktag, skaclass, opt, ctx);
  612|  2.70M|        if (!ret) {
  ------------------
  |  Branch (612:13): [True: 175k, False: 2.52M]
  ------------------
  613|   175k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|   175k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|   175k|    (ERR_new(),                                                 \
  |  |  |  |  404|   175k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|   175k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|   175k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|   175k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|   175k|     ERR_set_error)
  |  |  ------------------
  ------------------
  614|   175k|            return 0;
  615|  2.52M|        } else if (ret == -1)
  ------------------
  |  Branch (615:20): [True: 74.9k, False: 2.45M]
  ------------------
  616|  74.9k|            return -1;
  617|  2.45M|        if (*val == NULL)
  ------------------
  |  Branch (617:13): [True: 2.43M, False: 14.6k]
  ------------------
  618|  2.43M|            *val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();
  ------------------
  |  |  901|  2.43M|#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_null())
  ------------------
  619|  14.6k|        else {
  620|       |            /*
  621|       |             * We've got a valid STACK: free up any items present
  622|       |             */
  623|  14.6k|            STACK_OF(ASN1_VALUE) *sktmp = (STACK_OF(ASN1_VALUE) *)*val;
  ------------------
  |  |   31|  14.6k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  624|  14.6k|            ASN1_VALUE *vtmp;
  625|  14.6k|            while (sk_ASN1_VALUE_num(sktmp) > 0) {
  ------------------
  |  |  898|  14.6k|#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk))
  ------------------
  |  Branch (625:20): [True: 0, False: 14.6k]
  ------------------
  626|      0|                vtmp = sk_ASN1_VALUE_pop(sktmp);
  ------------------
  |  |  910|      0|#define sk_ASN1_VALUE_pop(sk) ((ASN1_VALUE *)OPENSSL_sk_pop(ossl_check_ASN1_VALUE_sk_type(sk)))
  ------------------
  627|      0|                ASN1_item_ex_free(&vtmp, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  421|      0|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  628|      0|            }
  629|  14.6k|        }
  630|       |
  631|  2.45M|        if (*val == NULL) {
  ------------------
  |  Branch (631:13): [True: 0, False: 2.45M]
  ------------------
  632|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  633|      0|            goto err;
  634|      0|        }
  635|       |
  636|       |        /* Read as many items as we can */
  637|  7.62M|        while (len > 0) {
  ------------------
  |  Branch (637:16): [True: 5.42M, False: 2.19M]
  ------------------
  638|  5.42M|            ASN1_VALUE *skfield;
  639|  5.42M|            q = p;
  640|       |            /* See if EOC found */
  641|  5.42M|            if (asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (641:17): [True: 100k, False: 5.32M]
  ------------------
  642|   100k|                if (!sk_eoc) {
  ------------------
  |  Branch (642:21): [True: 277, False: 100k]
  ------------------
  643|    277|                    ERR_raise(ERR_LIB_ASN1, ASN1_R_UNEXPECTED_EOC);
  ------------------
  |  |  401|    277|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    277|    (ERR_new(),                                                 \
  |  |  |  |  404|    277|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    277|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    277|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    277|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    277|     ERR_set_error)
  |  |  ------------------
  ------------------
  644|    277|                    goto err;
  645|    277|                }
  646|   100k|                len -= p - q;
  647|   100k|                sk_eoc = 0;
  648|   100k|                break;
  649|   100k|            }
  650|  5.32M|            skfield = NULL;
  651|  5.32M|            if (asn1_item_embed_d2i(&skfield, &p, len,
  ------------------
  |  Branch (651:17): [True: 155k, False: 5.17M]
  ------------------
  652|  5.32M|                                     ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx,
  ------------------
  |  |  421|  5.32M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  653|  5.32M|                                     depth, libctx, propq) <= 0) {
  654|   155k|                ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|   155k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|   155k|    (ERR_new(),                                                 \
  |  |  |  |  404|   155k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|   155k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|   155k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|   155k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|   155k|     ERR_set_error)
  |  |  ------------------
  ------------------
  655|       |                /* |skfield| may be partially allocated despite failure. */
  656|   155k|                ASN1_item_free(skfield, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  421|   155k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  657|   155k|                goto err;
  658|   155k|            }
  659|  5.17M|            len -= p - q;
  660|  5.17M|            if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) {
  ------------------
  |  |  908|  5.17M|#define sk_ASN1_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
  ------------------
  |  Branch (660:17): [True: 0, False: 5.17M]
  ------------------
  661|      0|                ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  662|      0|                ASN1_item_free(skfield, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  421|      0|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  663|      0|                goto err;
  664|      0|            }
  665|  5.17M|        }
  666|  2.29M|        if (sk_eoc) {
  ------------------
  |  Branch (666:13): [True: 878, False: 2.29M]
  ------------------
  667|    878|            ERR_raise(ERR_LIB_ASN1, ASN1_R_MISSING_EOC);
  ------------------
  |  |  401|    878|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    878|    (ERR_new(),                                                 \
  |  |  |  |  404|    878|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    878|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    878|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    878|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    878|     ERR_set_error)
  |  |  ------------------
  ------------------
  668|    878|            goto err;
  669|    878|        }
  670|  4.03M|    } else if (flags & ASN1_TFLG_IMPTAG) {
  ------------------
  |  |  547|  4.03M|# define ASN1_TFLG_IMPTAG        (0x1 << 3)
  ------------------
  |  Branch (670:16): [True: 543k, False: 3.49M]
  ------------------
  671|       |        /* IMPLICIT tagging */
  672|   543k|        ret = asn1_item_embed_d2i(val, &p, len,
  673|   543k|                                  ASN1_ITEM_ptr(tt->item), tt->tag, aclass, opt,
  ------------------
  |  |  421|   543k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  674|   543k|                                  ctx, depth, libctx, propq);
  675|   543k|        if (!ret) {
  ------------------
  |  Branch (675:13): [True: 50.5k, False: 492k]
  ------------------
  676|  50.5k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  50.5k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  50.5k|    (ERR_new(),                                                 \
  |  |  |  |  404|  50.5k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  50.5k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  50.5k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  50.5k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  50.5k|     ERR_set_error)
  |  |  ------------------
  ------------------
  677|  50.5k|            goto err;
  678|   492k|        } else if (ret == -1)
  ------------------
  |  Branch (678:20): [True: 469k, False: 23.1k]
  ------------------
  679|   469k|            return -1;
  680|  3.49M|    } else {
  681|       |        /* Nothing special */
  682|  3.49M|        ret = asn1_item_embed_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item),
  ------------------
  |  |  421|  3.49M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  683|  3.49M|                                  -1, 0, opt, ctx, depth, libctx, propq);
  684|  3.49M|        if (!ret) {
  ------------------
  |  Branch (684:13): [True: 1.02M, False: 2.46M]
  ------------------
  685|  1.02M|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  1.02M|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.02M|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.02M|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.02M|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.02M|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.02M|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.02M|     ERR_set_error)
  |  |  ------------------
  ------------------
  686|  1.02M|            goto err;
  687|  2.46M|        } else if (ret == -1)
  ------------------
  |  Branch (687:20): [True: 233k, False: 2.23M]
  ------------------
  688|   233k|            return -1;
  689|  3.49M|    }
  690|       |
  691|  4.55M|    *in = p;
  692|  4.55M|    return 1;
  693|       |
  694|  1.23M| err:
  695|  1.23M|    return 0;
  696|  6.74M|}
tasn_dec.c:asn1_d2i_ex_primitive:
  702|  6.39M|{
  703|  6.39M|    int ret = 0, utype;
  704|  6.39M|    long plen;
  705|  6.39M|    char cst, inf, free_cont = 0;
  706|  6.39M|    const unsigned char *p;
  707|  6.39M|    BUF_MEM buf = { 0, NULL, 0, 0 };
  708|  6.39M|    const unsigned char *cont = NULL;
  709|  6.39M|    long len;
  710|       |
  711|  6.39M|    if (pval == NULL) {
  ------------------
  |  Branch (711:9): [True: 0, False: 6.39M]
  ------------------
  712|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  713|      0|        return 0;               /* Should never happen */
  714|      0|    }
  715|       |
  716|  6.39M|    if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |   85|  6.39M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (716:9): [True: 411k, False: 5.97M]
  ------------------
  717|   411k|        utype = tag;
  718|   411k|        tag = -1;
  719|   411k|    } else
  720|  5.97M|        utype = it->utype;
  721|       |
  722|  6.39M|    if (utype == V_ASN1_ANY) {
  ------------------
  |  |   58|  6.39M|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (722:9): [True: 2.66M, False: 3.72M]
  ------------------
  723|       |        /* If type is ANY need to figure out type from tag */
  724|  2.66M|        unsigned char oclass;
  725|  2.66M|        if (tag >= 0) {
  ------------------
  |  Branch (725:13): [True: 0, False: 2.66M]
  ------------------
  726|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_TAGGED_ANY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  727|      0|            return 0;
  728|      0|        }
  729|  2.66M|        if (opt) {
  ------------------
  |  Branch (729:13): [True: 0, False: 2.66M]
  ------------------
  730|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONAL_ANY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  731|      0|            return 0;
  732|      0|        }
  733|  2.66M|        p = *in;
  734|  2.66M|        ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL,
  735|  2.66M|                              &p, inlen, -1, 0, 0, ctx);
  736|  2.66M|        if (!ret) {
  ------------------
  |  Branch (736:13): [True: 1.10k, False: 2.66M]
  ------------------
  737|  1.10k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  1.10k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.10k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.10k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.10k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.10k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.10k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.10k|     ERR_set_error)
  |  |  ------------------
  ------------------
  738|  1.10k|            return 0;
  739|  1.10k|        }
  740|  2.66M|        if (oclass != V_ASN1_UNIVERSAL)
  ------------------
  |  |   47|  2.66M|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (740:13): [True: 36.7k, False: 2.62M]
  ------------------
  741|  36.7k|            utype = V_ASN1_OTHER;
  ------------------
  |  |   57|  36.7k|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  742|  2.66M|    }
  743|  6.38M|    if (tag == -1) {
  ------------------
  |  Branch (743:9): [True: 5.97M, False: 419k]
  ------------------
  744|  5.97M|        tag = utype;
  745|  5.97M|        aclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   47|  5.97M|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  746|  5.97M|    }
  747|  6.38M|    p = *in;
  748|       |    /* Check header */
  749|  6.38M|    ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst,
  750|  6.38M|                          &p, inlen, tag, aclass, opt, ctx);
  751|  6.38M|    if (!ret) {
  ------------------
  |  Branch (751:9): [True: 1.01M, False: 5.37M]
  ------------------
  752|  1.01M|        ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  1.01M|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.01M|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.01M|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.01M|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.01M|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.01M|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.01M|     ERR_set_error)
  |  |  ------------------
  ------------------
  753|  1.01M|        return 0;
  754|  5.37M|    } else if (ret == -1)
  ------------------
  |  Branch (754:16): [True: 539k, False: 4.83M]
  ------------------
  755|   539k|        return -1;
  756|  4.83M|    ret = 0;
  757|       |    /* SEQUENCE, SET and "OTHER" are left in encoded form */
  758|  4.83M|    if ((utype == V_ASN1_SEQUENCE)
  ------------------
  |  |   74|  4.83M|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (758:9): [True: 173k, False: 4.65M]
  ------------------
  759|  4.83M|        || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
  ------------------
  |  |   75|  4.65M|# define V_ASN1_SET                      17
  ------------------
                      || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
  ------------------
  |  |   57|  2.24M|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (759:12): [True: 2.40M, False: 2.24M]
  |  Branch (759:37): [True: 36.7k, False: 2.21M]
  ------------------
  760|       |        /*
  761|       |         * Clear context cache for type OTHER because the auto clear when we
  762|       |         * have a exact match won't work
  763|       |         */
  764|  2.61M|        if (utype == V_ASN1_OTHER) {
  ------------------
  |  |   57|  2.61M|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (764:13): [True: 36.7k, False: 2.58M]
  ------------------
  765|  36.7k|            asn1_tlc_clear(ctx);
  ------------------
  |  |   96|  36.7k|#define asn1_tlc_clear(c)       do { if ((c) != NULL) (c)->valid = 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (96:42): [True: 36.7k, False: 0]
  |  |  |  Branch (96:80): [Folded - Ignored]
  |  |  ------------------
  ------------------
  766|  36.7k|        }
  767|       |        /* SEQUENCE and SET must be constructed */
  768|  2.58M|        else if (!cst) {
  ------------------
  |  Branch (768:18): [True: 840, False: 2.58M]
  ------------------
  769|    840|            ERR_raise(ERR_LIB_ASN1, ASN1_R_TYPE_NOT_CONSTRUCTED);
  ------------------
  |  |  401|    840|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    840|    (ERR_new(),                                                 \
  |  |  |  |  404|    840|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    840|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    840|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    840|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    840|     ERR_set_error)
  |  |  ------------------
  ------------------
  770|    840|            return 0;
  771|    840|        }
  772|       |
  773|  2.61M|        cont = *in;
  774|       |        /* If indefinite length constructed find the real end */
  775|  2.61M|        if (inf) {
  ------------------
  |  Branch (775:13): [True: 97.5k, False: 2.52M]
  ------------------
  776|  97.5k|            if (!asn1_find_end(&p, plen, inf))
  ------------------
  |  Branch (776:17): [True: 19.9k, False: 77.6k]
  ------------------
  777|  19.9k|                goto err;
  778|  77.6k|            len = p - cont;
  779|  2.52M|        } else {
  780|  2.52M|            len = p - cont + plen;
  781|  2.52M|            p += plen;
  782|  2.52M|        }
  783|  2.61M|    } else if (cst) {
  ------------------
  |  Branch (783:16): [True: 25.6k, False: 2.18M]
  ------------------
  784|  25.6k|        if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN
  ------------------
  |  |   67|  51.3k|# define V_ASN1_NULL                     5
  ------------------
                      if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN
  ------------------
  |  |   63|  51.2k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (784:13): [True: 95, False: 25.5k]
  |  Branch (784:37): [True: 187, False: 25.4k]
  ------------------
  785|  25.6k|            || utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER
  ------------------
  |  |   68|  51.0k|# define V_ASN1_OBJECT                   6
  ------------------
                          || utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER
  ------------------
  |  |   64|  51.0k|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (785:16): [True: 59, False: 25.3k]
  |  Branch (785:42): [True: 621, False: 24.7k]
  ------------------
  786|  25.6k|            || utype == V_ASN1_ENUMERATED) {
  ------------------
  |  |   72|  24.7k|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (786:16): [True: 99, False: 24.6k]
  ------------------
  787|  1.06k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_TYPE_NOT_PRIMITIVE);
  ------------------
  |  |  401|  1.06k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.06k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.06k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.06k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.06k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.06k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.06k|     ERR_set_error)
  |  |  ------------------
  ------------------
  788|  1.06k|            return 0;
  789|  1.06k|        }
  790|       |
  791|       |        /* Free any returned 'buf' content */
  792|  24.6k|        free_cont = 1;
  793|       |        /*
  794|       |         * Should really check the internal tags are correct but some things
  795|       |         * may get this wrong. The relevant specs say that constructed string
  796|       |         * types should be OCTET STRINGs internally irrespective of the type.
  797|       |         * So instead just check for UNIVERSAL class and ignore the tag.
  798|       |         */
  799|  24.6k|        if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
  ------------------
  |  |   47|  24.6k|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (799:13): [True: 1.44k, False: 23.1k]
  ------------------
  800|  1.44k|            goto err;
  801|  1.44k|        }
  802|  23.1k|        len = buf.length;
  803|       |        /* Append a final null to string */
  804|  23.1k|        if (!BUF_MEM_grow_clean(&buf, len + 1)) {
  ------------------
  |  Branch (804:13): [True: 0, False: 23.1k]
  ------------------
  805|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  806|      0|            goto err;
  807|      0|        }
  808|  23.1k|        buf.data[len] = 0;
  809|  23.1k|        cont = (const unsigned char *)buf.data;
  810|  2.18M|    } else {
  811|  2.18M|        cont = p;
  812|  2.18M|        len = plen;
  813|  2.18M|        p += plen;
  814|  2.18M|    }
  815|       |
  816|       |    /* We now have content length and type: translate into a structure */
  817|       |    /* asn1_ex_c2i may reuse allocated buffer, and so sets free_cont to 0 */
  818|  4.80M|    if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it))
  ------------------
  |  Branch (818:9): [True: 73.8k, False: 4.73M]
  ------------------
  819|  73.8k|        goto err;
  820|       |
  821|  4.73M|    *in = p;
  822|  4.73M|    ret = 1;
  823|  4.82M| err:
  824|  4.82M|    if (free_cont)
  ------------------
  |  Branch (824:9): [True: 1.69k, False: 4.82M]
  ------------------
  825|  1.69k|        OPENSSL_free(buf.data);
  ------------------
  |  |  107|  1.69k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.69k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.69k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  826|  4.82M|    return ret;
  827|  4.73M|}
tasn_dec.c:asn1_find_end:
  972|  97.5k|{
  973|  97.5k|    uint32_t expected_eoc;
  974|  97.5k|    long plen;
  975|  97.5k|    const unsigned char *p = *in, *q;
  976|       |    /* If not indefinite length constructed just add length */
  977|  97.5k|    if (inf == 0) {
  ------------------
  |  Branch (977:9): [True: 0, False: 97.5k]
  ------------------
  978|      0|        *in += len;
  979|      0|        return 1;
  980|      0|    }
  981|  97.5k|    expected_eoc = 1;
  982|       |    /*
  983|       |     * Indefinite length constructed form. Find the end when enough EOCs are
  984|       |     * found. If more indefinite length constructed headers are encountered
  985|       |     * increment the expected eoc count otherwise just skip to the end of the
  986|       |     * data.
  987|       |     */
  988|  38.1M|    while (len > 0) {
  ------------------
  |  Branch (988:12): [True: 38.1M, False: 6.63k]
  ------------------
  989|  38.1M|        if (asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (989:13): [True: 3.44M, False: 34.7M]
  ------------------
  990|  3.44M|            expected_eoc--;
  991|  3.44M|            if (expected_eoc == 0)
  ------------------
  |  Branch (991:17): [True: 77.6k, False: 3.36M]
  ------------------
  992|  77.6k|                break;
  993|  3.36M|            len -= 2;
  994|  3.36M|            continue;
  995|  3.44M|        }
  996|  34.7M|        q = p;
  997|       |        /* Just read in a header: only care about the length */
  998|  34.7M|        if (!asn1_check_tlen(&plen, NULL, NULL, &inf, NULL, &p, len,
  ------------------
  |  Branch (998:13): [True: 13.3k, False: 34.7M]
  ------------------
  999|  34.7M|                             -1, 0, 0, NULL)) {
 1000|  13.3k|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|  13.3k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  13.3k|    (ERR_new(),                                                 \
  |  |  |  |  404|  13.3k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  13.3k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  13.3k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  13.3k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  13.3k|     ERR_set_error)
  |  |  ------------------
  ------------------
 1001|  13.3k|            return 0;
 1002|  13.3k|        }
 1003|  34.7M|        if (inf) {
  ------------------
  |  Branch (1003:13): [True: 10.6M, False: 24.0M]
  ------------------
 1004|  10.6M|            if (expected_eoc == UINT32_MAX) {
  ------------------
  |  Branch (1004:17): [True: 0, False: 10.6M]
  ------------------
 1005|      0|                ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1006|      0|                return 0;
 1007|      0|            }
 1008|  10.6M|            expected_eoc++;
 1009|  24.0M|        } else {
 1010|  24.0M|            p += plen;
 1011|  24.0M|        }
 1012|  34.7M|        len -= p - q;
 1013|  34.7M|    }
 1014|  84.2k|    if (expected_eoc) {
  ------------------
  |  Branch (1014:9): [True: 6.63k, False: 77.6k]
  ------------------
 1015|  6.63k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_MISSING_EOC);
  ------------------
  |  |  401|  6.63k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  6.63k|    (ERR_new(),                                                 \
  |  |  |  |  404|  6.63k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  6.63k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  6.63k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  6.63k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  6.63k|     ERR_set_error)
  |  |  ------------------
  ------------------
 1016|  6.63k|        return 0;
 1017|  6.63k|    }
 1018|  77.6k|    *in = p;
 1019|  77.6k|    return 1;
 1020|  84.2k|}
tasn_dec.c:asn1_collect:
 1040|   130k|{
 1041|   130k|    const unsigned char *p, *q;
 1042|   130k|    long plen;
 1043|   130k|    char cst, ininf;
 1044|   130k|    p = *in;
 1045|   130k|    inf &= 1;
 1046|       |    /*
 1047|       |     * If no buffer and not indefinite length constructed just pass over the
 1048|       |     * encoded data
 1049|       |     */
 1050|   130k|    if (!buf && !inf) {
  ------------------
  |  Branch (1050:9): [True: 0, False: 130k]
  |  Branch (1050:17): [True: 0, False: 0]
  ------------------
 1051|      0|        *in += len;
 1052|      0|        return 1;
 1053|      0|    }
 1054|   316k|    while (len > 0) {
  ------------------
  |  Branch (1054:12): [True: 201k, False: 115k]
  ------------------
 1055|   201k|        q = p;
 1056|       |        /* Check for EOC */
 1057|   201k|        if (asn1_check_eoc(&p, len)) {
  ------------------
  |  Branch (1057:13): [True: 13.4k, False: 188k]
  ------------------
 1058|       |            /*
 1059|       |             * EOC is illegal outside indefinite length constructed form
 1060|       |             */
 1061|  13.4k|            if (!inf) {
  ------------------
  |  Branch (1061:17): [True: 75, False: 13.3k]
  ------------------
 1062|     75|                ERR_raise(ERR_LIB_ASN1, ASN1_R_UNEXPECTED_EOC);
  ------------------
  |  |  401|     75|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     75|    (ERR_new(),                                                 \
  |  |  |  |  404|     75|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     75|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     75|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     75|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     75|     ERR_set_error)
  |  |  ------------------
  ------------------
 1063|     75|                return 0;
 1064|     75|            }
 1065|  13.3k|            inf = 0;
 1066|  13.3k|            break;
 1067|  13.4k|        }
 1068|       |
 1069|   188k|        if (!asn1_check_tlen(&plen, NULL, NULL, &ininf, &cst, &p,
  ------------------
  |  Branch (1069:13): [True: 619, False: 187k]
  ------------------
 1070|   188k|                             len, tag, aclass, 0, NULL)) {
 1071|    619|            ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|    619|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    619|    (ERR_new(),                                                 \
  |  |  |  |  404|    619|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    619|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    619|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    619|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    619|     ERR_set_error)
  |  |  ------------------
  ------------------
 1072|    619|            return 0;
 1073|    619|        }
 1074|       |
 1075|       |        /* If indefinite length constructed update max length */
 1076|   187k|        if (cst) {
  ------------------
  |  Branch (1076:13): [True: 106k, False: 81.2k]
  ------------------
 1077|   106k|            if (depth >= ASN1_MAX_STRING_NEST) {
  ------------------
  |  | 1035|   106k|# define ASN1_MAX_STRING_NEST 5
  ------------------
  |  Branch (1077:17): [True: 112, False: 106k]
  ------------------
 1078|    112|                ERR_raise(ERR_LIB_ASN1, ASN1_R_NESTED_ASN1_STRING);
  ------------------
  |  |  401|    112|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    112|    (ERR_new(),                                                 \
  |  |  |  |  404|    112|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    112|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    112|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    112|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    112|     ERR_set_error)
  |  |  ------------------
  ------------------
 1079|    112|                return 0;
 1080|    112|            }
 1081|   106k|            if (!asn1_collect(buf, &p, plen, ininf, tag, aclass, depth + 1))
  ------------------
  |  Branch (1081:17): [True: 1.39k, False: 104k]
  ------------------
 1082|  1.39k|                return 0;
 1083|   106k|        } else if (plen && !collect_data(buf, &p, plen))
  ------------------
  |  Branch (1083:20): [True: 71.7k, False: 9.54k]
  |  Branch (1083:28): [True: 0, False: 71.7k]
  ------------------
 1084|      0|            return 0;
 1085|   186k|        len -= p - q;
 1086|   186k|    }
 1087|   128k|    if (inf) {
  ------------------
  |  Branch (1087:9): [True: 640, False: 127k]
  ------------------
 1088|    640|        ERR_raise(ERR_LIB_ASN1, ASN1_R_MISSING_EOC);
  ------------------
  |  |  401|    640|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    640|    (ERR_new(),                                                 \
  |  |  |  |  404|    640|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    640|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    640|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    640|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    640|     ERR_set_error)
  |  |  ------------------
  ------------------
 1089|    640|        return 0;
 1090|    640|    }
 1091|   127k|    *in = p;
 1092|   127k|    return 1;
 1093|   128k|}
tasn_dec.c:collect_data:
 1096|  71.7k|{
 1097|  71.7k|    int len;
 1098|  71.7k|    if (buf) {
  ------------------
  |  Branch (1098:9): [True: 71.7k, False: 0]
  ------------------
 1099|  71.7k|        len = buf->length;
 1100|  71.7k|        if (!BUF_MEM_grow_clean(buf, len + plen)) {
  ------------------
  |  Branch (1100:13): [True: 0, False: 71.7k]
  ------------------
 1101|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1102|      0|            return 0;
 1103|      0|        }
 1104|  71.7k|        memcpy(buf->data + len, *p, plen);
 1105|  71.7k|    }
 1106|  71.7k|    *p += plen;
 1107|  71.7k|    return 1;
 1108|  71.7k|}
tasn_dec.c:asn1_ex_c2i:
  833|  4.80M|{
  834|  4.80M|    ASN1_VALUE **opval = NULL;
  835|  4.80M|    ASN1_STRING *stmp;
  836|  4.80M|    ASN1_TYPE *typ = NULL;
  837|  4.80M|    int ret = 0;
  838|  4.80M|    const ASN1_PRIMITIVE_FUNCS *pf;
  839|  4.80M|    ASN1_INTEGER **tint;
  840|  4.80M|    pf = it->funcs;
  841|       |
  842|  4.80M|    if (pf && pf->prim_c2i)
  ------------------
  |  Branch (842:9): [True: 254k, False: 4.55M]
  |  Branch (842:15): [True: 254k, False: 0]
  ------------------
  843|   254k|        return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
  844|       |    /* If ANY type clear type and set pointer to internal value */
  845|  4.55M|    if (it->utype == V_ASN1_ANY) {
  ------------------
  |  |   58|  4.55M|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (845:9): [True: 2.64M, False: 1.90M]
  ------------------
  846|  2.64M|        if (*pval == NULL) {
  ------------------
  |  Branch (846:13): [True: 2.63M, False: 9.25k]
  ------------------
  847|  2.63M|            typ = ASN1_TYPE_new();
  848|  2.63M|            if (typ == NULL)
  ------------------
  |  Branch (848:17): [True: 0, False: 2.63M]
  ------------------
  849|      0|                goto err;
  850|  2.63M|            *pval = (ASN1_VALUE *)typ;
  851|  2.63M|        } else
  852|  9.25k|            typ = (ASN1_TYPE *)*pval;
  853|       |
  854|  2.64M|        if (utype != typ->type)
  ------------------
  |  Branch (854:13): [True: 2.64M, False: 0]
  ------------------
  855|  2.64M|            ASN1_TYPE_set(typ, utype, NULL);
  856|  2.64M|        opval = pval;
  857|  2.64M|        pval = &typ->value.asn1_value;
  858|  2.64M|    }
  859|  4.55M|    switch (utype) {
  860|   697k|    case V_ASN1_OBJECT:
  ------------------
  |  |   68|   697k|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (860:5): [True: 697k, False: 3.85M]
  ------------------
  861|   697k|        if (!ossl_c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len))
  ------------------
  |  Branch (861:13): [True: 602, False: 697k]
  ------------------
  862|    602|            goto err;
  863|   697k|        break;
  864|       |
  865|   697k|    case V_ASN1_NULL:
  ------------------
  |  |   67|  3.19k|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (865:5): [True: 3.19k, False: 4.55M]
  ------------------
  866|  3.19k|        if (len) {
  ------------------
  |  Branch (866:13): [True: 58, False: 3.13k]
  ------------------
  867|     58|            ERR_raise(ERR_LIB_ASN1, ASN1_R_NULL_IS_WRONG_LENGTH);
  ------------------
  |  |  401|     58|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     58|    (ERR_new(),                                                 \
  |  |  |  |  404|     58|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     58|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     58|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     58|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     58|     ERR_set_error)
  |  |  ------------------
  ------------------
  868|     58|            goto err;
  869|     58|        }
  870|  3.13k|        *pval = (ASN1_VALUE *)1;
  871|  3.13k|        break;
  872|       |
  873|  4.62k|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   63|  4.62k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (873:5): [True: 4.62k, False: 4.54M]
  ------------------
  874|  4.62k|        if (len != 1) {
  ------------------
  |  Branch (874:13): [True: 117, False: 4.51k]
  ------------------
  875|    117|            ERR_raise(ERR_LIB_ASN1, ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
  ------------------
  |  |  401|    117|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    117|    (ERR_new(),                                                 \
  |  |  |  |  404|    117|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    117|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    117|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    117|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    117|     ERR_set_error)
  |  |  ------------------
  ------------------
  876|    117|            goto err;
  877|  4.51k|        } else {
  878|  4.51k|            ASN1_BOOLEAN *tbool;
  879|  4.51k|            tbool = (ASN1_BOOLEAN *)pval;
  880|  4.51k|            *tbool = *cont;
  881|  4.51k|        }
  882|  4.51k|        break;
  883|       |
  884|   150k|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   65|   150k|# define V_ASN1_BIT_STRING               3
  ------------------
  |  Branch (884:5): [True: 150k, False: 4.40M]
  ------------------
  885|   150k|        if (!ossl_c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len))
  ------------------
  |  Branch (885:13): [True: 255, False: 150k]
  ------------------
  886|    255|            goto err;
  887|   150k|        break;
  888|       |
  889|   532k|    case V_ASN1_INTEGER:
  ------------------
  |  |   64|   532k|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (889:5): [True: 532k, False: 4.02M]
  ------------------
  890|   542k|    case V_ASN1_ENUMERATED:
  ------------------
  |  |   72|   542k|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (890:5): [True: 10.3k, False: 4.54M]
  ------------------
  891|   542k|        tint = (ASN1_INTEGER **)pval;
  892|   542k|        if (!ossl_c2i_ASN1_INTEGER(tint, &cont, len))
  ------------------
  |  Branch (892:13): [True: 63.7k, False: 479k]
  ------------------
  893|  63.7k|            goto err;
  894|       |        /* Fixup type to match the expected form */
  895|   479k|        (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
  ------------------
  |  |   97|   479k|# define V_ASN1_NEG                      0x100
  ------------------
  896|   479k|        break;
  897|       |
  898|   176k|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   66|   176k|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (898:5): [True: 176k, False: 4.37M]
  ------------------
  899|   177k|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   76|   177k|# define V_ASN1_NUMERICSTRING            18 /**/
  ------------------
  |  Branch (899:5): [True: 313, False: 4.55M]
  ------------------
  900|   178k|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |   77|   178k|# define V_ASN1_PRINTABLESTRING          19
  ------------------
  |  Branch (900:5): [True: 1.03k, False: 4.55M]
  ------------------
  901|   181k|    case V_ASN1_T61STRING:
  ------------------
  |  |   78|   181k|# define V_ASN1_T61STRING                20
  ------------------
  |  Branch (901:5): [True: 3.53k, False: 4.54M]
  ------------------
  902|   182k|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |   80|   182k|# define V_ASN1_VIDEOTEXSTRING           21 /**/
  ------------------
  |  Branch (902:5): [True: 880, False: 4.55M]
  ------------------
  903|   189k|    case V_ASN1_IA5STRING:
  ------------------
  |  |   81|   189k|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (903:5): [True: 7.48k, False: 4.54M]
  ------------------
  904|   230k|    case V_ASN1_UTCTIME:
  ------------------
  |  |   82|   230k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (904:5): [True: 40.2k, False: 4.51M]
  ------------------
  905|   271k|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |   83|   271k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (905:5): [True: 41.5k, False: 4.51M]
  ------------------
  906|   271k|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |   84|   271k|# define V_ASN1_GRAPHICSTRING            25 /**/
  ------------------
  |  Branch (906:5): [True: 43, False: 4.55M]
  ------------------
  907|   272k|    case V_ASN1_VISIBLESTRING:
  ------------------
  |  |   86|   272k|# define V_ASN1_VISIBLESTRING            26/* alias */
  ------------------
  |  Branch (907:5): [True: 352, False: 4.55M]
  ------------------
  908|   272k|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |   87|   272k|# define V_ASN1_GENERALSTRING            27 /**/
  ------------------
  |  Branch (908:5): [True: 144, False: 4.55M]
  ------------------
  909|   275k|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |   88|   275k|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  |  Branch (909:5): [True: 3.06k, False: 4.55M]
  ------------------
  910|   376k|    case V_ASN1_BMPSTRING:
  ------------------
  |  |   89|   376k|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (910:5): [True: 101k, False: 4.45M]
  ------------------
  911|   428k|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   73|   428k|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (911:5): [True: 51.9k, False: 4.50M]
  ------------------
  912|   458k|    case V_ASN1_OTHER:
  ------------------
  |  |   57|   458k|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (912:5): [True: 30.4k, False: 4.52M]
  ------------------
  913|  2.86M|    case V_ASN1_SET:
  ------------------
  |  |   75|  2.86M|# define V_ASN1_SET                      17
  ------------------
  |  Branch (913:5): [True: 2.40M, False: 2.14M]
  ------------------
  914|  3.02M|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   74|  3.02M|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (914:5): [True: 159k, False: 4.39M]
  ------------------
  915|  3.15M|    default:
  ------------------
  |  Branch (915:5): [True: 127k, False: 4.42M]
  ------------------
  916|  3.15M|        if (utype == V_ASN1_BMPSTRING && (len & 1)) {
  ------------------
  |  |   89|  6.30M|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (916:13): [True: 101k, False: 3.05M]
  |  Branch (916:42): [True: 42, False: 101k]
  ------------------
  917|     42|            ERR_raise(ERR_LIB_ASN1, ASN1_R_BMPSTRING_IS_WRONG_LENGTH);
  ------------------
  |  |  401|     42|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     42|    (ERR_new(),                                                 \
  |  |  |  |  404|     42|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     42|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     42|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     42|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     42|     ERR_set_error)
  |  |  ------------------
  ------------------
  918|     42|            goto err;
  919|     42|        }
  920|  3.15M|        if (utype == V_ASN1_UNIVERSALSTRING && (len & 3)) {
  ------------------
  |  |   88|  6.30M|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  |  Branch (920:13): [True: 3.06k, False: 3.15M]
  |  Branch (920:48): [True: 41, False: 3.02k]
  ------------------
  921|     41|            ERR_raise(ERR_LIB_ASN1, ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH);
  ------------------
  |  |  401|     41|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     41|    (ERR_new(),                                                 \
  |  |  |  |  404|     41|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     41|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     41|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     41|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     41|     ERR_set_error)
  |  |  ------------------
  ------------------
  922|     41|            goto err;
  923|     41|        }
  924|       |        /* All based on ASN1_STRING and handled the same */
  925|  3.15M|        if (*pval == NULL) {
  ------------------
  |  Branch (925:13): [True: 2.69M, False: 457k]
  ------------------
  926|  2.69M|            stmp = ASN1_STRING_type_new(utype);
  927|  2.69M|            if (stmp == NULL) {
  ------------------
  |  Branch (927:17): [True: 0, False: 2.69M]
  ------------------
  928|      0|                ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  929|      0|                goto err;
  930|      0|            }
  931|  2.69M|            *pval = (ASN1_VALUE *)stmp;
  932|  2.69M|        } else {
  933|   457k|            stmp = (ASN1_STRING *)*pval;
  934|   457k|            stmp->type = utype;
  935|   457k|        }
  936|       |        /* If we've already allocated a buffer use it */
  937|  3.15M|        if (*free_cont) {
  ------------------
  |  Branch (937:13): [True: 22.9k, False: 3.13M]
  ------------------
  938|  22.9k|            ASN1_STRING_set0(stmp, (unsigned char *)cont /* UGLY CAST! */, len);
  939|  22.9k|            *free_cont = 0;
  940|  3.13M|        } else {
  941|  3.13M|            if (!ASN1_STRING_set(stmp, cont, len)) {
  ------------------
  |  Branch (941:17): [True: 0, False: 3.13M]
  ------------------
  942|      0|                ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  943|      0|                ASN1_STRING_free(stmp);
  944|      0|                *pval = NULL;
  945|      0|                goto err;
  946|      0|            }
  947|  3.13M|        }
  948|  3.15M|        break;
  949|  4.55M|    }
  950|       |    /* If ASN1_ANY and NULL type fix up value */
  951|  4.48M|    if (typ && (utype == V_ASN1_NULL))
  ------------------
  |  |   67|  2.64M|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (951:9): [True: 2.64M, False: 1.84M]
  |  Branch (951:16): [True: 3.11k, False: 2.63M]
  ------------------
  952|  3.11k|        typ->value.ptr = NULL;
  953|       |
  954|  4.48M|    ret = 1;
  955|  4.55M| err:
  956|  4.55M|    if (!ret) {
  ------------------
  |  Branch (956:9): [True: 64.8k, False: 4.48M]
  ------------------
  957|  64.8k|        ASN1_TYPE_free(typ);
  958|  64.8k|        if (opval)
  ------------------
  |  Branch (958:13): [True: 2.53k, False: 62.2k]
  ------------------
  959|  2.53k|            *opval = NULL;
  960|  64.8k|    }
  961|  4.55M|    return ret;
  962|  4.48M|}
tasn_dec.c:asn1_check_tlen:
 1137|  50.3M|{
 1138|  50.3M|    int i;
 1139|  50.3M|    int ptag, pclass;
 1140|  50.3M|    long plen;
 1141|  50.3M|    const unsigned char *p, *q;
 1142|  50.3M|    p = *in;
 1143|  50.3M|    q = p;
 1144|       |
 1145|  50.3M|    if (len <= 0) {
  ------------------
  |  Branch (1145:9): [True: 19, False: 50.3M]
  ------------------
 1146|     19|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
  ------------------
  |  |  401|     19|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     19|    (ERR_new(),                                                 \
  |  |  |  |  404|     19|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     19|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     19|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     19|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     19|     ERR_set_error)
  |  |  ------------------
  ------------------
 1147|     19|        goto err;
 1148|     19|    }
 1149|  50.3M|    if (ctx != NULL && ctx->valid) {
  ------------------
  |  Branch (1149:9): [True: 15.4M, False: 34.9M]
  |  Branch (1149:24): [True: 4.01M, False: 11.3M]
  ------------------
 1150|  4.01M|        i = ctx->ret;
 1151|  4.01M|        plen = ctx->plen;
 1152|  4.01M|        pclass = ctx->pclass;
 1153|  4.01M|        ptag = ctx->ptag;
 1154|  4.01M|        p += ctx->hdrlen;
 1155|  46.2M|    } else {
 1156|  46.2M|        i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
 1157|  46.2M|        if (ctx != NULL) {
  ------------------
  |  Branch (1157:13): [True: 11.3M, False: 34.9M]
  ------------------
 1158|  11.3M|            ctx->ret = i;
 1159|  11.3M|            ctx->plen = plen;
 1160|  11.3M|            ctx->pclass = pclass;
 1161|  11.3M|            ctx->ptag = ptag;
 1162|  11.3M|            ctx->hdrlen = p - q;
 1163|  11.3M|            ctx->valid = 1;
 1164|       |            /*
 1165|       |             * If definite length, and no error, length + header can't exceed
 1166|       |             * total amount of data available.
 1167|       |             */
 1168|  11.3M|            if ((i & 0x81) == 0 && (plen + ctx->hdrlen) > len) {
  ------------------
  |  Branch (1168:17): [True: 9.13M, False: 2.25M]
  |  Branch (1168:36): [True: 0, False: 9.13M]
  ------------------
 1169|      0|                ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1170|      0|                goto err;
 1171|      0|            }
 1172|  11.3M|        }
 1173|  46.2M|    }
 1174|       |
 1175|  50.3M|    if ((i & 0x80) != 0) {
  ------------------
  |  Branch (1175:9): [True: 93.0k, False: 50.2M]
  ------------------
 1176|  93.0k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_OBJECT_HEADER);
  ------------------
  |  |  401|  93.0k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  93.0k|    (ERR_new(),                                                 \
  |  |  |  |  404|  93.0k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  93.0k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  93.0k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  93.0k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  93.0k|     ERR_set_error)
  |  |  ------------------
  ------------------
 1177|  93.0k|        goto err;
 1178|  93.0k|    }
 1179|  50.2M|    if (exptag >= 0) {
  ------------------
  |  Branch (1179:9): [True: 12.1M, False: 38.0M]
  ------------------
 1180|  12.1M|        if (exptag != ptag || expclass != pclass) {
  ------------------
  |  Branch (1180:13): [True: 2.69M, False: 9.44M]
  |  Branch (1180:31): [True: 51.4k, False: 9.39M]
  ------------------
 1181|       |            /*
 1182|       |             * If type is OPTIONAL, not an error: indicate missing type.
 1183|       |             */
 1184|  2.74M|            if (opt != 0)
  ------------------
  |  Branch (1184:17): [True: 1.03M, False: 1.70M]
  ------------------
 1185|  1.03M|                return -1;
 1186|  2.74M|            ERR_raise(ERR_LIB_ASN1, ASN1_R_WRONG_TAG);
  ------------------
  |  |  401|  1.70M|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.70M|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.70M|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.70M|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.70M|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.70M|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.70M|     ERR_set_error)
  |  |  ------------------
  ------------------
 1187|  1.70M|            goto err;
 1188|  2.74M|        }
 1189|       |        /*
 1190|       |         * We have a tag and class match: assume we are going to do something
 1191|       |         * with it
 1192|       |         */
 1193|  9.39M|        asn1_tlc_clear(ctx);
  ------------------
  |  |   96|  9.39M|#define asn1_tlc_clear(c)       do { if ((c) != NULL) (c)->valid = 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (96:42): [True: 9.39M, False: 0]
  |  |  |  Branch (96:80): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1194|  9.39M|    }
 1195|       |
 1196|  47.4M|    if ((i & 1) != 0)
  ------------------
  |  Branch (1196:9): [True: 12.3M, False: 35.1M]
  ------------------
 1197|  12.3M|        plen = len - (p - q);
 1198|       |
 1199|  47.4M|    if (inf != NULL)
  ------------------
  |  Branch (1199:9): [True: 44.3M, False: 3.14M]
  ------------------
 1200|  44.3M|        *inf = i & 1;
 1201|       |
 1202|  47.4M|    if (cst != NULL)
  ------------------
  |  Branch (1202:9): [True: 7.16M, False: 40.3M]
  ------------------
 1203|  7.16M|        *cst = i & V_ASN1_CONSTRUCTED;
  ------------------
  |  |   52|  7.16M|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
 1204|       |
 1205|  47.4M|    if (olen != NULL)
  ------------------
  |  Branch (1205:9): [True: 44.3M, False: 3.14M]
  ------------------
 1206|  44.3M|        *olen = plen;
 1207|       |
 1208|  47.4M|    if (oclass != NULL)
  ------------------
  |  Branch (1208:9): [True: 3.14M, False: 44.3M]
  ------------------
 1209|  3.14M|        *oclass = pclass;
 1210|       |
 1211|  47.4M|    if (otag != NULL)
  ------------------
  |  Branch (1211:9): [True: 3.14M, False: 44.3M]
  ------------------
 1212|  3.14M|        *otag = ptag;
 1213|       |
 1214|  47.4M|    *in = p;
 1215|  47.4M|    return 1;
 1216|       |
 1217|  1.79M| err:
 1218|  1.79M|    asn1_tlc_clear(ctx);
  ------------------
  |  |   96|  1.79M|#define asn1_tlc_clear(c)       do { if ((c) != NULL) (c)->valid = 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (96:42): [True: 1.78M, False: 13.9k]
  |  |  |  Branch (96:80): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1219|  1.79M|    return 0;
 1220|  50.2M|}
tasn_dec.c:asn1_check_eoc:
 1113|  48.0M|{
 1114|  48.0M|    const unsigned char *p;
 1115|       |
 1116|  48.0M|    if (len < 2)
  ------------------
  |  Branch (1116:9): [True: 12.1k, False: 47.9M]
  ------------------
 1117|  12.1k|        return 0;
 1118|  47.9M|    p = *in;
 1119|  47.9M|    if (p[0] == '\0' && p[1] == '\0') {
  ------------------
  |  Branch (1119:9): [True: 4.04M, False: 43.9M]
  |  Branch (1119:25): [True: 3.96M, False: 78.6k]
  ------------------
 1120|  3.96M|        *in += 2;
 1121|  3.96M|        return 1;
 1122|  3.96M|    }
 1123|  44.0M|    return 0;
 1124|  47.9M|}

ASN1_item_i2d:
   44|  58.8k|{
   45|  58.8k|    return asn1_item_flags_i2d(val, out, it, 0);
   46|  58.8k|}
ASN1_item_ex_i2d:
   83|  11.6M|{
   84|  11.6M|    const ASN1_TEMPLATE *tt = NULL;
   85|  11.6M|    int i, seqcontlen, seqlen, ndef = 1;
   86|  11.6M|    const ASN1_EXTERN_FUNCS *ef;
   87|  11.6M|    const ASN1_AUX *aux = it->funcs;
   88|  11.6M|    ASN1_aux_const_cb *asn1_cb = NULL;
   89|       |
   90|  11.6M|    if ((it->itype != ASN1_ITYPE_PRIMITIVE) && *pval == NULL)
  ------------------
  |  |   80|  11.6M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (90:9): [True: 4.03M, False: 7.64M]
  |  Branch (90:48): [True: 17.3k, False: 4.02M]
  ------------------
   91|  17.3k|        return 0;
   92|       |
   93|  11.6M|    if (aux != NULL) {
  ------------------
  |  Branch (93:9): [True: 615k, False: 11.0M]
  ------------------
   94|   615k|        asn1_cb = ((aux->flags & ASN1_AFLG_CONST_CB) != 0) ? aux->asn1_const_cb
  ------------------
  |  |  738|   615k|# define ASN1_AFLG_CONST_CB      8
  ------------------
  |  Branch (94:19): [True: 0, False: 615k]
  ------------------
   95|   615k|            : (ASN1_aux_const_cb *)aux->asn1_cb; /* backward compatibility */
   96|   615k|    }
   97|       |
   98|  11.6M|    switch (it->itype) {
   99|       |
  100|  7.64M|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |   80|  7.64M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (100:5): [True: 7.64M, False: 4.02M]
  ------------------
  101|  7.64M|        if (it->templates)
  ------------------
  |  Branch (101:13): [True: 36.3k, False: 7.60M]
  ------------------
  102|  36.3k|            return asn1_template_ex_i2d(pval, out, it->templates,
  103|  36.3k|                                        tag, aclass);
  104|  7.60M|        return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
  105|       |
  106|  2.03M|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |   85|  2.03M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (106:5): [True: 2.03M, False: 9.63M]
  ------------------
  107|       |        /*
  108|       |         * It never makes sense for multi-strings to have implicit tagging, so
  109|       |         * if tag != -1, then this looks like an error in the template.
  110|       |         */
  111|  2.03M|        if (tag != -1) {
  ------------------
  |  Branch (111:13): [True: 0, False: 2.03M]
  ------------------
  112|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  113|      0|            return -1;
  114|      0|        }
  115|  2.03M|        return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
  116|       |
  117|  46.1k|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |   82|  46.1k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (117:5): [True: 46.1k, False: 11.6M]
  ------------------
  118|       |        /*
  119|       |         * It never makes sense for CHOICE types to have implicit tagging, so
  120|       |         * if tag != -1, then this looks like an error in the template.
  121|       |         */
  122|  46.1k|        if (tag != -1) {
  ------------------
  |  Branch (122:13): [True: 0, False: 46.1k]
  ------------------
  123|      0|            ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_TEMPLATE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  124|      0|            return -1;
  125|      0|        }
  126|  46.1k|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
  ------------------
  |  |  748|  8.04k|# define ASN1_OP_I2D_PRE         6
  ------------------
  |  Branch (126:13): [True: 8.04k, False: 38.1k]
  |  Branch (126:24): [True: 0, False: 8.04k]
  ------------------
  127|      0|            return 0;
  128|  46.1k|        i = ossl_asn1_get_choice_selector_const(pval, it);
  129|  46.1k|        if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (129:13): [True: 46.1k, False: 0]
  |  Branch (129:25): [True: 46.1k, False: 0]
  ------------------
  130|  46.1k|            const ASN1_VALUE **pchval;
  131|  46.1k|            const ASN1_TEMPLATE *chtt;
  132|  46.1k|            chtt = it->templates + i;
  133|  46.1k|            pchval = ossl_asn1_get_const_field_ptr(pval, chtt);
  134|  46.1k|            return asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);
  135|  46.1k|        }
  136|       |        /* Fixme: error condition if selector out of range */
  137|      0|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
  ------------------
  |  |  749|      0|# define ASN1_OP_I2D_POST        7
  ------------------
  |  Branch (137:13): [True: 0, False: 0]
  |  Branch (137:24): [True: 0, False: 0]
  ------------------
  138|      0|            return 0;
  139|      0|        break;
  140|       |
  141|  17.2k|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |   84|  17.2k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (141:5): [True: 17.2k, False: 11.6M]
  ------------------
  142|       |        /* If new style i2d it does all the work */
  143|  17.2k|        ef = it->funcs;
  144|  17.2k|        return ef->asn1_ex_i2d(pval, out, it, tag, aclass);
  145|       |
  146|  10.1k|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |   86|  10.1k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (146:5): [True: 10.1k, False: 11.6M]
  ------------------
  147|       |        /* Use indefinite length constructed if requested */
  148|  10.1k|        if (aclass & ASN1_TFLG_NDEF)
  ------------------
  |  |  594|  10.1k|# define ASN1_TFLG_NDEF          (0x1<<11)
  ------------------
  |  Branch (148:13): [True: 0, False: 10.1k]
  ------------------
  149|      0|            ndef = 2;
  150|       |        /* fall through */
  151|       |
  152|  1.92M|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |   81|  1.92M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (152:5): [True: 1.91M, False: 9.74M]
  ------------------
  153|  1.92M|        i = ossl_asn1_enc_restore(&seqcontlen, out, pval, it);
  154|       |        /* An error occurred */
  155|  1.92M|        if (i < 0)
  ------------------
  |  Branch (155:13): [True: 0, False: 1.92M]
  ------------------
  156|      0|            return 0;
  157|       |        /* We have a valid cached encoding... */
  158|  1.92M|        if (i > 0)
  ------------------
  |  Branch (158:13): [True: 23.2k, False: 1.90M]
  ------------------
  159|  23.2k|            return seqcontlen;
  160|       |        /* Otherwise carry on */
  161|  1.90M|        seqcontlen = 0;
  162|       |        /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
  163|  1.90M|        if (tag == -1) {
  ------------------
  |  Branch (163:13): [True: 1.89M, False: 5.18k]
  ------------------
  164|  1.89M|            tag = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|  1.89M|# define V_ASN1_SEQUENCE                 16
  ------------------
  165|       |            /* Retain any other flags in aclass */
  166|  1.89M|            aclass = (aclass & ~ASN1_TFLG_TAG_CLASS)
  ------------------
  |  |  575|  1.89M|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  167|  1.89M|                | V_ASN1_UNIVERSAL;
  ------------------
  |  |   47|  1.89M|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  168|  1.89M|        }
  169|  1.90M|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
  ------------------
  |  |  748|  38.4k|# define ASN1_OP_I2D_PRE         6
  ------------------
  |  Branch (169:13): [True: 38.4k, False: 1.86M]
  |  Branch (169:24): [True: 0, False: 38.4k]
  ------------------
  170|      0|            return 0;
  171|       |        /* First work out sequence content length */
  172|  6.04M|        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (172:41): [True: 4.14M, False: 1.90M]
  ------------------
  173|  4.14M|            const ASN1_TEMPLATE *seqtt;
  174|  4.14M|            const ASN1_VALUE **pseqval;
  175|  4.14M|            int tmplen;
  176|  4.14M|            seqtt = ossl_asn1_do_adb(*pval, tt, 1);
  177|  4.14M|            if (!seqtt)
  ------------------
  |  Branch (177:17): [True: 0, False: 4.14M]
  ------------------
  178|      0|                return 0;
  179|  4.14M|            pseqval = ossl_asn1_get_const_field_ptr(pval, seqtt);
  180|  4.14M|            tmplen = asn1_template_ex_i2d(pseqval, NULL, seqtt, -1, aclass);
  181|  4.14M|            if (tmplen == -1 || (tmplen > INT_MAX - seqcontlen))
  ------------------
  |  Branch (181:17): [True: 0, False: 4.14M]
  |  Branch (181:33): [True: 0, False: 4.14M]
  ------------------
  182|      0|                return -1;
  183|  4.14M|            seqcontlen += tmplen;
  184|  4.14M|        }
  185|       |
  186|  1.90M|        seqlen = ASN1_object_size(ndef, seqcontlen, tag);
  187|  1.90M|        if (!out || seqlen == -1)
  ------------------
  |  Branch (187:13): [True: 1.32M, False: 575k]
  |  Branch (187:21): [True: 0, False: 575k]
  ------------------
  188|  1.32M|            return seqlen;
  189|       |        /* Output SEQUENCE header */
  190|   575k|        ASN1_put_object(out, ndef, seqcontlen, tag, aclass);
  191|  1.82M|        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (191:41): [True: 1.24M, False: 575k]
  ------------------
  192|  1.24M|            const ASN1_TEMPLATE *seqtt;
  193|  1.24M|            const ASN1_VALUE **pseqval;
  194|  1.24M|            seqtt = ossl_asn1_do_adb(*pval, tt, 1);
  195|  1.24M|            if (!seqtt)
  ------------------
  |  Branch (195:17): [True: 0, False: 1.24M]
  ------------------
  196|      0|                return 0;
  197|  1.24M|            pseqval = ossl_asn1_get_const_field_ptr(pval, seqtt);
  198|       |            /* FIXME: check for errors in enhanced version */
  199|  1.24M|            asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass);
  200|  1.24M|        }
  201|   575k|        if (ndef == 2)
  ------------------
  |  Branch (201:13): [True: 0, False: 575k]
  ------------------
  202|      0|            ASN1_put_eoc(out);
  203|   575k|        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
  ------------------
  |  |  749|  14.9k|# define ASN1_OP_I2D_POST        7
  ------------------
  |  Branch (203:13): [True: 14.9k, False: 560k]
  |  Branch (203:24): [True: 0, False: 14.9k]
  ------------------
  204|      0|            return 0;
  205|   575k|        return seqlen;
  206|       |
  207|      0|    default:
  ------------------
  |  Branch (207:5): [True: 0, False: 11.6M]
  ------------------
  208|      0|        return 0;
  209|       |
  210|  11.6M|    }
  211|      0|    return 0;
  212|  11.6M|}
tasn_enc.c:asn1_item_flags_i2d:
   57|  58.8k|{
   58|  58.8k|    if (out != NULL && *out == NULL) {
  ------------------
  |  Branch (58:9): [True: 57.9k, False: 819]
  |  Branch (58:24): [True: 57.5k, False: 465]
  ------------------
   59|  57.5k|        unsigned char *p, *buf;
   60|  57.5k|        int len;
   61|       |
   62|  57.5k|        len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);
   63|  57.5k|        if (len <= 0)
  ------------------
  |  Branch (63:13): [True: 16, False: 57.5k]
  ------------------
   64|     16|            return len;
   65|  57.5k|        if ((buf = OPENSSL_malloc(len)) == NULL)
  ------------------
  |  |   97|  57.5k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  57.5k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  57.5k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (65:13): [True: 0, False: 57.5k]
  ------------------
   66|      0|            return -1;
   67|  57.5k|        p = buf;
   68|  57.5k|        ASN1_item_ex_i2d(&val, &p, it, -1, flags);
   69|  57.5k|        *out = buf;
   70|  57.5k|        return len;
   71|  57.5k|    }
   72|       |
   73|  1.28k|    return ASN1_item_ex_i2d(&val, out, it, -1, flags);
   74|  58.8k|}
tasn_enc.c:asn1_template_ex_i2d:
  216|  5.47M|{
  217|  5.47M|    const int flags = tt->flags;
  218|  5.47M|    int i, ret, ttag, tclass, ndef, len;
  219|  5.47M|    const ASN1_VALUE *tval;
  220|       |
  221|       |    /*
  222|       |     * If field is embedded then val needs fixing so it is a pointer to
  223|       |     * a pointer to a field.
  224|       |     */
  225|  5.47M|    if (flags & ASN1_TFLG_EMBED) {
  ------------------
  |  |  597|  5.47M|# define ASN1_TFLG_EMBED         (0x1 << 12)
  ------------------
  |  Branch (225:9): [True: 198k, False: 5.27M]
  ------------------
  226|   198k|        tval = (ASN1_VALUE *)pval;
  227|   198k|        pval = &tval;
  228|   198k|    }
  229|       |    /*
  230|       |     * Work out tag and class to use: tagging may come either from the
  231|       |     * template or the arguments, not both because this would create
  232|       |     * ambiguity. Additionally the iclass argument may contain some
  233|       |     * additional flags which should be noted and passed down to other
  234|       |     * levels.
  235|       |     */
  236|  5.47M|    if (flags & ASN1_TFLG_TAG_MASK) {
  ------------------
  |  |  552|  5.47M|# define ASN1_TFLG_TAG_MASK      (0x3 << 3)
  ------------------
  |  Branch (236:9): [True: 164k, False: 5.31M]
  ------------------
  237|       |        /* Error if argument and template tagging */
  238|   164k|        if (tag != -1)
  ------------------
  |  Branch (238:13): [True: 0, False: 164k]
  ------------------
  239|       |            /* FIXME: error code here */
  240|      0|            return -1;
  241|       |        /* Get tagging from template */
  242|   164k|        ttag = tt->tag;
  243|   164k|        tclass = flags & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  575|   164k|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  244|  5.31M|    } else if (tag != -1) {
  ------------------
  |  Branch (244:16): [True: 0, False: 5.31M]
  ------------------
  245|       |        /* No template tagging, get from arguments */
  246|      0|        ttag = tag;
  247|      0|        tclass = iclass & ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  575|      0|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  248|  5.31M|    } else {
  249|  5.31M|        ttag = -1;
  250|  5.31M|        tclass = 0;
  251|  5.31M|    }
  252|       |    /*
  253|       |     * Remove any class mask from iflag.
  254|       |     */
  255|  5.47M|    iclass &= ~ASN1_TFLG_TAG_CLASS;
  ------------------
  |  |  575|  5.47M|# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
  ------------------
  256|       |
  257|       |    /*
  258|       |     * At this point 'ttag' contains the outer tag to use, 'tclass' is the
  259|       |     * class and iclass is any flags passed to this function.
  260|       |     */
  261|       |
  262|       |    /* if template and arguments require ndef, use it */
  263|  5.47M|    if ((flags & ASN1_TFLG_NDEF) && (iclass & ASN1_TFLG_NDEF))
  ------------------
  |  |  594|  5.47M|# define ASN1_TFLG_NDEF          (0x1<<11)
  ------------------
                  if ((flags & ASN1_TFLG_NDEF) && (iclass & ASN1_TFLG_NDEF))
  ------------------
  |  |  594|  1.13k|# define ASN1_TFLG_NDEF          (0x1<<11)
  ------------------
  |  Branch (263:9): [True: 1.13k, False: 5.47M]
  |  Branch (263:37): [True: 0, False: 1.13k]
  ------------------
  264|      0|        ndef = 2;
  265|  5.47M|    else
  266|  5.47M|        ndef = 1;
  267|       |
  268|  5.47M|    if (flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  539|  5.47M|# define ASN1_TFLG_SK_MASK       (0x3 << 1)
  ------------------
  |  Branch (268:9): [True: 117k, False: 5.36M]
  ------------------
  269|       |        /* SET OF, SEQUENCE OF */
  270|   117k|        STACK_OF(const_ASN1_VALUE) *sk = (STACK_OF(const_ASN1_VALUE) *)*pval;
  ------------------
  |  |   31|   117k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  271|   117k|        int isset, sktag, skaclass;
  272|   117k|        int skcontlen, sklen;
  273|   117k|        const ASN1_VALUE *skitem;
  274|       |
  275|   117k|        if (*pval == NULL)
  ------------------
  |  Branch (275:13): [True: 55.8k, False: 61.6k]
  ------------------
  276|  55.8k|            return 0;
  277|       |
  278|  61.6k|        if (flags & ASN1_TFLG_SET_OF) {
  ------------------
  |  |  526|  61.6k|# define ASN1_TFLG_SET_OF        (0x1 << 1)
  ------------------
  |  Branch (278:13): [True: 24.5k, False: 37.1k]
  ------------------
  279|  24.5k|            isset = 1;
  280|       |            /* 2 means we reorder */
  281|  24.5k|            if (flags & ASN1_TFLG_SEQUENCE_OF)
  ------------------
  |  |  529|  24.5k|# define ASN1_TFLG_SEQUENCE_OF   (0x2 << 1)
  ------------------
  |  Branch (281:17): [True: 174, False: 24.4k]
  ------------------
  282|    174|                isset = 2;
  283|  24.5k|        } else
  284|  37.1k|            isset = 0;
  285|       |
  286|       |        /*
  287|       |         * Work out inner tag value: if EXPLICIT or no tagging use underlying
  288|       |         * type.
  289|       |         */
  290|  61.6k|        if ((ttag != -1) && !(flags & ASN1_TFLG_EXPTAG)) {
  ------------------
  |  |  550|  15.6k|# define ASN1_TFLG_EXPTAG        (0x2 << 3)
  ------------------
  |  Branch (290:13): [True: 15.6k, False: 46.0k]
  |  Branch (290:29): [True: 6.02k, False: 9.59k]
  ------------------
  291|  6.02k|            sktag = ttag;
  292|  6.02k|            skaclass = tclass;
  293|  55.6k|        } else {
  294|  55.6k|            skaclass = V_ASN1_UNIVERSAL;
  ------------------
  |  |   47|  55.6k|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  295|  55.6k|            if (isset)
  ------------------
  |  Branch (295:17): [True: 24.3k, False: 31.3k]
  ------------------
  296|  24.3k|                sktag = V_ASN1_SET;
  ------------------
  |  |   75|  24.3k|# define V_ASN1_SET                      17
  ------------------
  297|  31.3k|            else
  298|  31.3k|                sktag = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|  31.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  299|  55.6k|        }
  300|       |
  301|       |        /* Determine total length of items */
  302|  61.6k|        skcontlen = 0;
  303|  4.25M|        for (i = 0; i < sk_const_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  Branch (303:21): [True: 4.19M, False: 61.6k]
  ------------------
  304|  4.19M|            skitem = sk_const_ASN1_VALUE_value(sk, i);
  305|  4.19M|            len = ASN1_item_ex_i2d(&skitem, NULL, ASN1_ITEM_ptr(tt->item),
  ------------------
  |  |  421|  4.19M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  306|  4.19M|                                   -1, iclass);
  307|  4.19M|            if (len == -1 || (skcontlen > INT_MAX - len))
  ------------------
  |  Branch (307:17): [True: 0, False: 4.19M]
  |  Branch (307:30): [True: 0, False: 4.19M]
  ------------------
  308|      0|                return -1;
  309|  4.19M|            if (len == 0 && (tt->flags & ASN1_TFLG_OPTIONAL) == 0) {
  ------------------
  |  |  523|      0|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  |  Branch (309:17): [True: 0, False: 4.19M]
  |  Branch (309:29): [True: 0, False: 0]
  ------------------
  310|      0|                ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  311|      0|                return -1;
  312|      0|            }
  313|  4.19M|            skcontlen += len;
  314|  4.19M|        }
  315|  61.6k|        sklen = ASN1_object_size(ndef, skcontlen, sktag);
  316|  61.6k|        if (sklen == -1)
  ------------------
  |  Branch (316:13): [True: 0, False: 61.6k]
  ------------------
  317|      0|            return -1;
  318|       |        /* If EXPLICIT need length of surrounding tag */
  319|  61.6k|        if (flags & ASN1_TFLG_EXPTAG)
  ------------------
  |  |  550|  61.6k|# define ASN1_TFLG_EXPTAG        (0x2 << 3)
  ------------------
  |  Branch (319:13): [True: 9.59k, False: 52.0k]
  ------------------
  320|  9.59k|            ret = ASN1_object_size(ndef, sklen, ttag);
  321|  52.0k|        else
  322|  52.0k|            ret = sklen;
  323|       |
  324|  61.6k|        if (!out || ret == -1)
  ------------------
  |  Branch (324:13): [True: 40.6k, False: 21.0k]
  |  Branch (324:21): [True: 0, False: 21.0k]
  ------------------
  325|  40.6k|            return ret;
  326|       |
  327|       |        /* Now encode this lot... */
  328|       |        /* EXPLICIT tag */
  329|  21.0k|        if (flags & ASN1_TFLG_EXPTAG)
  ------------------
  |  |  550|  21.0k|# define ASN1_TFLG_EXPTAG        (0x2 << 3)
  ------------------
  |  Branch (329:13): [True: 568, False: 20.4k]
  ------------------
  330|    568|            ASN1_put_object(out, ndef, sklen, ttag, tclass);
  331|       |        /* SET or SEQUENCE and IMPLICIT tag */
  332|  21.0k|        ASN1_put_object(out, ndef, skcontlen, sktag, skaclass);
  333|       |        /* And the stuff itself */
  334|  21.0k|        asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item),
  ------------------
  |  |  421|  21.0k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  335|  21.0k|                         isset, iclass);
  336|  21.0k|        if (ndef == 2) {
  ------------------
  |  Branch (336:13): [True: 0, False: 21.0k]
  ------------------
  337|      0|            ASN1_put_eoc(out);
  338|      0|            if (flags & ASN1_TFLG_EXPTAG)
  ------------------
  |  |  550|      0|# define ASN1_TFLG_EXPTAG        (0x2 << 3)
  ------------------
  |  Branch (338:17): [True: 0, False: 0]
  ------------------
  339|      0|                ASN1_put_eoc(out);
  340|      0|        }
  341|       |
  342|  21.0k|        return ret;
  343|  61.6k|    }
  344|       |
  345|  5.36M|    if (flags & ASN1_TFLG_EXPTAG) {
  ------------------
  |  |  550|  5.36M|# define ASN1_TFLG_EXPTAG        (0x2 << 3)
  ------------------
  |  Branch (345:9): [True: 71.1k, False: 5.28M]
  ------------------
  346|       |        /* EXPLICIT tagging */
  347|       |        /* Find length of tagged item */
  348|  71.1k|        i = ASN1_item_ex_i2d(pval, NULL, ASN1_ITEM_ptr(tt->item), -1, iclass);
  ------------------
  |  |  421|  71.1k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  349|  71.1k|        if (i == 0) {
  ------------------
  |  Branch (349:13): [True: 43.8k, False: 27.2k]
  ------------------
  350|  43.8k|            if ((tt->flags & ASN1_TFLG_OPTIONAL) == 0) {
  ------------------
  |  |  523|  43.8k|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  |  Branch (350:17): [True: 0, False: 43.8k]
  ------------------
  351|      0|                ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  352|      0|                return -1;
  353|      0|            }
  354|  43.8k|            return 0;
  355|  43.8k|        }
  356|       |        /* Find length of EXPLICIT tag */
  357|  27.2k|        ret = ASN1_object_size(ndef, i, ttag);
  358|  27.2k|        if (out && ret != -1) {
  ------------------
  |  Branch (358:13): [True: 6.98k, False: 20.3k]
  |  Branch (358:20): [True: 6.98k, False: 0]
  ------------------
  359|       |            /* Output tag and item */
  360|  6.98k|            ASN1_put_object(out, ndef, i, ttag, tclass);
  361|  6.98k|            ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, iclass);
  ------------------
  |  |  421|  6.98k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  362|  6.98k|            if (ndef == 2)
  ------------------
  |  Branch (362:17): [True: 0, False: 6.98k]
  ------------------
  363|      0|                ASN1_put_eoc(out);
  364|  6.98k|        }
  365|  27.2k|        return ret;
  366|  71.1k|    }
  367|       |
  368|       |    /* Either normal or IMPLICIT tagging: combine class and flags */
  369|  5.28M|    len = ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item),
  ------------------
  |  |  421|  5.28M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  370|  5.28M|                              ttag, tclass | iclass);
  371|  5.28M|    if (len == 0 && (tt->flags & ASN1_TFLG_OPTIONAL) == 0) {
  ------------------
  |  |  523|   173k|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  |  Branch (371:9): [True: 173k, False: 5.11M]
  |  Branch (371:21): [True: 0, False: 173k]
  ------------------
  372|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  373|      0|        return -1;
  374|      0|    }
  375|  5.28M|    return len;
  376|  5.28M|}
tasn_enc.c:asn1_set_seq_out:
  403|  21.0k|{
  404|  21.0k|    int i, ret = 0;
  405|  21.0k|    const ASN1_VALUE *skitem;
  406|  21.0k|    unsigned char *tmpdat = NULL, *p = NULL;
  407|  21.0k|    DER_ENC *derlst = NULL, *tder;
  408|       |
  409|  21.0k|    if (do_sort) {
  ------------------
  |  Branch (409:9): [True: 10.0k, False: 10.9k]
  ------------------
  410|       |        /* Don't need to sort less than 2 items */
  411|  10.0k|        if (sk_const_ASN1_VALUE_num(sk) < 2)
  ------------------
  |  Branch (411:13): [True: 8.97k, False: 1.10k]
  ------------------
  412|  8.97k|            do_sort = 0;
  413|  1.10k|        else {
  414|  1.10k|            derlst = OPENSSL_malloc(sk_const_ASN1_VALUE_num(sk)
  ------------------
  |  |   97|  1.10k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.10k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.10k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  415|  1.10k|                                    * sizeof(*derlst));
  416|  1.10k|            if (derlst == NULL)
  ------------------
  |  Branch (416:17): [True: 0, False: 1.10k]
  ------------------
  417|      0|                return 0;
  418|  1.10k|            tmpdat = OPENSSL_malloc(skcontlen);
  ------------------
  |  |   97|  1.10k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.10k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.10k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  419|  1.10k|            if (tmpdat == NULL)
  ------------------
  |  Branch (419:17): [True: 0, False: 1.10k]
  ------------------
  420|      0|                goto err;
  421|  1.10k|        }
  422|  10.0k|    }
  423|       |    /* If not sorting just output each item */
  424|  21.0k|    if (!do_sort) {
  ------------------
  |  Branch (424:9): [True: 19.9k, False: 1.10k]
  ------------------
  425|   999k|        for (i = 0; i < sk_const_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  Branch (425:21): [True: 979k, False: 19.9k]
  ------------------
  426|   979k|            skitem = sk_const_ASN1_VALUE_value(sk, i);
  427|   979k|            ASN1_item_ex_i2d(&skitem, out, item, -1, iclass);
  428|   979k|        }
  429|  19.9k|        return 1;
  430|  19.9k|    }
  431|  1.10k|    p = tmpdat;
  432|       |
  433|       |    /* Doing sort: build up a list of each member's DER encoding */
  434|  1.00M|    for (i = 0, tder = derlst; i < sk_const_ASN1_VALUE_num(sk); i++, tder++) {
  ------------------
  |  Branch (434:32): [True: 1.00M, False: 1.10k]
  ------------------
  435|  1.00M|        skitem = sk_const_ASN1_VALUE_value(sk, i);
  436|  1.00M|        tder->data = p;
  437|  1.00M|        tder->length = ASN1_item_ex_i2d(&skitem, &p, item, -1, iclass);
  438|  1.00M|        tder->field = skitem;
  439|  1.00M|    }
  440|       |
  441|       |    /* Now sort them */
  442|  1.10k|    qsort(derlst, sk_const_ASN1_VALUE_num(sk), sizeof(*derlst), der_cmp);
  443|       |    /* Output sorted DER encoding */
  444|  1.10k|    p = *out;
  445|  1.00M|    for (i = 0, tder = derlst; i < sk_const_ASN1_VALUE_num(sk); i++, tder++) {
  ------------------
  |  Branch (445:32): [True: 1.00M, False: 1.10k]
  ------------------
  446|  1.00M|        memcpy(p, tder->data, tder->length);
  447|  1.00M|        p += tder->length;
  448|  1.00M|    }
  449|  1.10k|    *out = p;
  450|       |    /* If do_sort is 2 then reorder the STACK */
  451|  1.10k|    if (do_sort == 2) {
  ------------------
  |  Branch (451:9): [True: 20, False: 1.08k]
  ------------------
  452|    203|        for (i = 0, tder = derlst; i < sk_const_ASN1_VALUE_num(sk); i++, tder++)
  ------------------
  |  Branch (452:36): [True: 183, False: 20]
  ------------------
  453|    183|            (void)sk_const_ASN1_VALUE_set(sk, i, tder->field);
  454|     20|    }
  455|  1.10k|    ret = 1;
  456|  1.10k|err:
  457|  1.10k|    OPENSSL_free(derlst);
  ------------------
  |  |  107|  1.10k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.10k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.10k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  458|  1.10k|    OPENSSL_free(tmpdat);
  ------------------
  |  |  107|  1.10k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.10k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.10k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  459|  1.10k|    return ret;
  460|  1.10k|}
tasn_enc.c:der_cmp:
  387|  10.9M|{
  388|  10.9M|    const DER_ENC *d1 = a, *d2 = b;
  389|  10.9M|    int cmplen, i;
  390|  10.9M|    cmplen = (d1->length < d2->length) ? d1->length : d2->length;
  ------------------
  |  Branch (390:14): [True: 270k, False: 10.6M]
  ------------------
  391|  10.9M|    i = memcmp(d1->data, d2->data, cmplen);
  392|  10.9M|    if (i)
  ------------------
  |  Branch (392:9): [True: 4.38M, False: 6.58M]
  ------------------
  393|  4.38M|        return i;
  394|  6.58M|    return d1->length - d2->length;
  395|  10.9M|}
tasn_enc.c:asn1_i2d_ex_primitive:
  464|  9.63M|{
  465|  9.63M|    int len;
  466|  9.63M|    int utype;
  467|  9.63M|    int usetag;
  468|  9.63M|    int ndef = 0;
  469|       |
  470|  9.63M|    utype = it->utype;
  471|       |
  472|       |    /*
  473|       |     * Get length of content octets and maybe find out the underlying type.
  474|       |     */
  475|       |
  476|  9.63M|    len = asn1_ex_i2c(pval, NULL, &utype, it);
  477|       |
  478|       |    /*
  479|       |     * If SEQUENCE, SET or OTHER then header is included in pseudo content
  480|       |     * octets so don't include tag+length. We need to check here because the
  481|       |     * call to asn1_ex_i2c() could change utype.
  482|       |     */
  483|  9.63M|    if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
  ------------------
  |  |   74|  9.63M|# define V_ASN1_SEQUENCE                 16
  ------------------
                  if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
  ------------------
  |  |   75|  9.10M|# define V_ASN1_SET                      17
  ------------------
  |  Branch (483:9): [True: 531k, False: 9.10M]
  |  Branch (483:39): [True: 4.18M, False: 4.92M]
  ------------------
  484|  9.63M|        (utype == V_ASN1_OTHER))
  ------------------
  |  |   57|  4.92M|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (484:9): [True: 23.5k, False: 4.89M]
  ------------------
  485|  4.73M|        usetag = 0;
  486|  4.89M|    else
  487|  4.89M|        usetag = 1;
  488|       |
  489|       |    /* -1 means omit type */
  490|       |
  491|  9.63M|    if (len == -1)
  ------------------
  |  Branch (491:9): [True: 200k, False: 9.43M]
  ------------------
  492|   200k|        return 0;
  493|       |
  494|       |    /* -2 return is special meaning use ndef */
  495|  9.43M|    if (len == -2) {
  ------------------
  |  Branch (495:9): [True: 0, False: 9.43M]
  ------------------
  496|      0|        ndef = 2;
  497|      0|        len = 0;
  498|      0|    }
  499|       |
  500|       |    /* If not implicitly tagged get tag from underlying type */
  501|  9.43M|    if (tag == -1)
  ------------------
  |  Branch (501:9): [True: 9.41M, False: 18.5k]
  ------------------
  502|  9.41M|        tag = utype;
  503|       |
  504|       |    /* Output tag+length followed by content octets */
  505|  9.43M|    if (out) {
  ------------------
  |  Branch (505:9): [True: 2.63M, False: 6.80M]
  ------------------
  506|  2.63M|        if (usetag)
  ------------------
  |  Branch (506:13): [True: 1.09M, False: 1.53M]
  ------------------
  507|  1.09M|            ASN1_put_object(out, ndef, len, tag, aclass);
  508|  2.63M|        asn1_ex_i2c(pval, *out, &utype, it);
  509|  2.63M|        if (ndef)
  ------------------
  |  Branch (509:13): [True: 0, False: 2.63M]
  ------------------
  510|      0|            ASN1_put_eoc(out);
  511|  2.63M|        else
  512|  2.63M|            *out += len;
  513|  2.63M|    }
  514|       |
  515|  9.43M|    if (usetag)
  ------------------
  |  Branch (515:9): [True: 4.69M, False: 4.73M]
  ------------------
  516|  4.69M|        return ASN1_object_size(ndef, len, tag);
  517|  4.73M|    return len;
  518|  9.43M|}
tasn_enc.c:asn1_ex_i2c:
  524|  12.2M|{
  525|  12.2M|    ASN1_BOOLEAN *tbool = NULL;
  526|  12.2M|    ASN1_STRING *strtmp;
  527|  12.2M|    ASN1_OBJECT *otmp;
  528|  12.2M|    int utype;
  529|  12.2M|    const unsigned char *cont;
  530|  12.2M|    unsigned char c;
  531|  12.2M|    int len;
  532|  12.2M|    const ASN1_PRIMITIVE_FUNCS *pf;
  533|  12.2M|    pf = it->funcs;
  534|  12.2M|    if (pf && pf->prim_i2c)
  ------------------
  |  Branch (534:9): [True: 640k, False: 11.6M]
  |  Branch (534:15): [True: 640k, False: 0]
  ------------------
  535|   640k|        return pf->prim_i2c(pval, cout, putype, it);
  536|       |
  537|       |    /* Should type be omitted? */
  538|  11.6M|    if ((it->itype != ASN1_ITYPE_PRIMITIVE)
  ------------------
  |  |   80|  11.6M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (538:9): [True: 2.51M, False: 9.11M]
  ------------------
  539|  11.6M|        || (it->utype != V_ASN1_BOOLEAN)) {
  ------------------
  |  |   63|  9.11M|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (539:12): [True: 9.01M, False: 102k]
  ------------------
  540|  11.5M|        if (*pval == NULL)
  ------------------
  |  Branch (540:13): [True: 95.7k, False: 11.4M]
  ------------------
  541|  95.7k|            return -1;
  542|  11.5M|    }
  543|       |
  544|  11.5M|    if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |   85|  11.5M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (544:9): [True: 2.51M, False: 9.02M]
  ------------------
  545|       |        /* If MSTRING type set the underlying type */
  546|  2.51M|        strtmp = (ASN1_STRING *)*pval;
  547|  2.51M|        utype = strtmp->type;
  548|  2.51M|        *putype = utype;
  549|  9.02M|    } else if (it->utype == V_ASN1_ANY) {
  ------------------
  |  |   58|  9.02M|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (549:16): [True: 5.86M, False: 3.15M]
  ------------------
  550|       |        /* If ANY set type and pointer to value */
  551|  5.86M|        ASN1_TYPE *typ;
  552|  5.86M|        typ = (ASN1_TYPE *)*pval;
  553|  5.86M|        utype = typ->type;
  554|  5.86M|        *putype = utype;
  555|  5.86M|        pval = (const ASN1_VALUE **)&typ->value.asn1_value; /* actually is const */
  556|  5.86M|    } else
  557|  3.15M|        utype = *putype;
  558|       |
  559|  11.5M|    switch (utype) {
  560|  2.77M|    case V_ASN1_OBJECT:
  ------------------
  |  |   68|  2.77M|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (560:5): [True: 2.77M, False: 8.75M]
  ------------------
  561|  2.77M|        otmp = (ASN1_OBJECT *)*pval;
  562|  2.77M|        cont = otmp->data;
  563|  2.77M|        len = otmp->length;
  564|  2.77M|        if (cont == NULL || len == 0)
  ------------------
  |  Branch (564:13): [True: 0, False: 2.77M]
  |  Branch (564:29): [True: 0, False: 2.77M]
  ------------------
  565|      0|            return -1;
  566|  2.77M|        break;
  567|       |
  568|  2.77M|    case V_ASN1_NULL:
  ------------------
  |  |   67|  8.41k|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (568:5): [True: 8.41k, False: 11.5M]
  ------------------
  569|  8.41k|        cont = NULL;
  570|  8.41k|        len = 0;
  571|  8.41k|        break;
  572|       |
  573|   103k|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   63|   103k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (573:5): [True: 103k, False: 11.4M]
  ------------------
  574|   103k|        tbool = (ASN1_BOOLEAN *)pval;
  575|   103k|        if (*tbool == -1)
  ------------------
  |  Branch (575:13): [True: 93.9k, False: 9.73k]
  ------------------
  576|  93.9k|            return -1;
  577|  9.73k|        if (it->utype != V_ASN1_ANY) {
  ------------------
  |  |   58|  9.73k|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (577:13): [True: 8.41k, False: 1.31k]
  ------------------
  578|       |            /*
  579|       |             * Default handling if value == size field then omit
  580|       |             */
  581|  8.41k|            if (*tbool && (it->size > 0))
  ------------------
  |  Branch (581:17): [True: 2.38k, False: 6.03k]
  |  Branch (581:27): [True: 8, False: 2.38k]
  ------------------
  582|      8|                return -1;
  583|  8.41k|            if (!*tbool && !it->size)
  ------------------
  |  Branch (583:17): [True: 6.03k, False: 2.38k]
  |  Branch (583:28): [True: 3.90k, False: 2.12k]
  ------------------
  584|  3.90k|                return -1;
  585|  8.41k|        }
  586|  5.81k|        c = (unsigned char)*tbool;
  587|  5.81k|        cont = &c;
  588|  5.81k|        len = 1;
  589|  5.81k|        break;
  590|       |
  591|  51.0k|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   65|  51.0k|# define V_ASN1_BIT_STRING               3
  ------------------
  |  Branch (591:5): [True: 51.0k, False: 11.4M]
  ------------------
  592|  51.0k|        return ossl_i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval,
  593|  51.0k|                                        cout ? &cout : NULL);
  ------------------
  |  Branch (593:41): [True: 12.3k, False: 38.7k]
  ------------------
  594|       |
  595|  76.6k|    case V_ASN1_INTEGER:
  ------------------
  |  |   64|  76.6k|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (595:5): [True: 76.6k, False: 11.4M]
  ------------------
  596|  80.4k|    case V_ASN1_ENUMERATED:
  ------------------
  |  |   72|  80.4k|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (596:5): [True: 3.88k, False: 11.5M]
  ------------------
  597|       |        /*
  598|       |         * These are all have the same content format as ASN1_INTEGER
  599|       |         */
  600|  80.4k|        return ossl_i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
  ------------------
  |  Branch (600:61): [True: 17.1k, False: 63.3k]
  ------------------
  601|       |
  602|   175k|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   66|   175k|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (602:5): [True: 175k, False: 11.3M]
  ------------------
  603|   176k|    case V_ASN1_NUMERICSTRING:
  ------------------
  |  |   76|   176k|# define V_ASN1_NUMERICSTRING            18 /**/
  ------------------
  |  Branch (603:5): [True: 1.16k, False: 11.5M]
  ------------------
  604|   176k|    case V_ASN1_PRINTABLESTRING:
  ------------------
  |  |   77|   176k|# define V_ASN1_PRINTABLESTRING          19
  ------------------
  |  Branch (604:5): [True: 213, False: 11.5M]
  ------------------
  605|   193k|    case V_ASN1_T61STRING:
  ------------------
  |  |   78|   193k|# define V_ASN1_T61STRING                20
  ------------------
  |  Branch (605:5): [True: 17.3k, False: 11.5M]
  ------------------
  606|   194k|    case V_ASN1_VIDEOTEXSTRING:
  ------------------
  |  |   80|   194k|# define V_ASN1_VIDEOTEXSTRING           21 /**/
  ------------------
  |  Branch (606:5): [True: 87, False: 11.5M]
  ------------------
  607|   206k|    case V_ASN1_IA5STRING:
  ------------------
  |  |   81|   206k|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (607:5): [True: 12.0k, False: 11.5M]
  ------------------
  608|   208k|    case V_ASN1_UTCTIME:
  ------------------
  |  |   82|   208k|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (608:5): [True: 2.25k, False: 11.5M]
  ------------------
  609|   213k|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |   83|   213k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (609:5): [True: 5.22k, False: 11.5M]
  ------------------
  610|   213k|    case V_ASN1_GRAPHICSTRING:
  ------------------
  |  |   84|   213k|# define V_ASN1_GRAPHICSTRING            25 /**/
  ------------------
  |  Branch (610:5): [True: 67, False: 11.5M]
  ------------------
  611|   213k|    case V_ASN1_VISIBLESTRING:
  ------------------
  |  |   86|   213k|# define V_ASN1_VISIBLESTRING            26/* alias */
  ------------------
  |  Branch (611:5): [True: 74, False: 11.5M]
  ------------------
  612|   213k|    case V_ASN1_GENERALSTRING:
  ------------------
  |  |   87|   213k|# define V_ASN1_GENERALSTRING            27 /**/
  ------------------
  |  Branch (612:5): [True: 82, False: 11.5M]
  ------------------
  613|   220k|    case V_ASN1_UNIVERSALSTRING:
  ------------------
  |  |   88|   220k|# define V_ASN1_UNIVERSALSTRING          28 /**/
  ------------------
  |  Branch (613:5): [True: 7.20k, False: 11.5M]
  ------------------
  614|   501k|    case V_ASN1_BMPSTRING:
  ------------------
  |  |   89|   501k|# define V_ASN1_BMPSTRING                30
  ------------------
  |  Branch (614:5): [True: 280k, False: 11.2M]
  ------------------
  615|  1.72M|    case V_ASN1_UTF8STRING:
  ------------------
  |  |   73|  1.72M|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (615:5): [True: 1.22M, False: 10.3M]
  ------------------
  616|  2.39M|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   74|  2.39M|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (616:5): [True: 669k, False: 10.8M]
  ------------------
  617|  7.97M|    case V_ASN1_SET:
  ------------------
  |  |   75|  7.97M|# define V_ASN1_SET                      17
  ------------------
  |  Branch (617:5): [True: 5.57M, False: 5.95M]
  ------------------
  618|  8.51M|    default:
  ------------------
  |  Branch (618:5): [True: 543k, False: 10.9M]
  ------------------
  619|       |        /* All based on ASN1_STRING and handled the same */
  620|  8.51M|        strtmp = (ASN1_STRING *)*pval;
  621|       |        /* Special handling for NDEF */
  622|  8.51M|        if ((it->size == ASN1_TFLG_NDEF)
  ------------------
  |  |  594|  8.51M|# define ASN1_TFLG_NDEF          (0x1<<11)
  ------------------
  |  Branch (622:13): [True: 65, False: 8.51M]
  ------------------
  623|  8.51M|            && (strtmp->flags & ASN1_STRING_FLAG_NDEF)) {
  ------------------
  |  |  167|     65|# define ASN1_STRING_FLAG_NDEF 0x010
  ------------------
  |  Branch (623:16): [True: 0, False: 65]
  ------------------
  624|      0|            if (cout) {
  ------------------
  |  Branch (624:17): [True: 0, False: 0]
  ------------------
  625|      0|                strtmp->data = cout;
  626|      0|                strtmp->length = 0;
  627|      0|            }
  628|       |            /* Special return code */
  629|      0|            return -2;
  630|      0|        }
  631|  8.51M|        cont = strtmp->data;
  632|  8.51M|        len = strtmp->length;
  633|       |
  634|  8.51M|        break;
  635|       |
  636|  11.5M|    }
  637|  11.3M|    if (cout && len)
  ------------------
  |  Branch (637:9): [True: 2.49M, False: 8.81M]
  |  Branch (637:17): [True: 2.09M, False: 392k]
  ------------------
  638|  2.09M|        memcpy(cout, cont, len);
  639|  11.3M|    return len;
  640|  11.5M|}

ASN1_item_free:
   19|  2.83M|{
   20|  2.83M|    ossl_asn1_item_embed_free(&val, it, 0);
   21|  2.83M|}
ASN1_item_ex_free:
   24|  2.17M|{
   25|  2.17M|    ossl_asn1_item_embed_free(pval, it, 0);
   26|  2.17M|}
ossl_asn1_item_embed_free:
   29|  14.9M|{
   30|  14.9M|    const ASN1_TEMPLATE *tt = NULL, *seqtt;
   31|  14.9M|    const ASN1_EXTERN_FUNCS *ef;
   32|  14.9M|    const ASN1_AUX *aux = it->funcs;
   33|  14.9M|    ASN1_aux_cb *asn1_cb;
   34|  14.9M|    int i;
   35|       |
   36|  14.9M|    if (pval == NULL)
  ------------------
  |  Branch (36:9): [True: 0, False: 14.9M]
  ------------------
   37|      0|        return;
   38|  14.9M|    if ((it->itype != ASN1_ITYPE_PRIMITIVE) && *pval == NULL)
  ------------------
  |  |   80|  14.9M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (38:9): [True: 6.05M, False: 8.93M]
  |  Branch (38:48): [True: 1.60M, False: 4.45M]
  ------------------
   39|  1.60M|        return;
   40|  13.3M|    if (aux && aux->asn1_cb)
  ------------------
  |  Branch (40:9): [True: 1.17M, False: 12.2M]
  |  Branch (40:16): [True: 817k, False: 353k]
  ------------------
   41|   817k|        asn1_cb = aux->asn1_cb;
   42|  12.5M|    else
   43|  12.5M|        asn1_cb = 0;
   44|       |
   45|  13.3M|    switch (it->itype) {
  ------------------
  |  Branch (45:13): [True: 0, False: 13.3M]
  ------------------
   46|       |
   47|  8.93M|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |   80|  8.93M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (47:5): [True: 8.93M, False: 4.45M]
  ------------------
   48|  8.93M|        if (it->templates)
  ------------------
  |  Branch (48:13): [True: 558k, False: 8.37M]
  ------------------
   49|   558k|            ossl_asn1_template_free(pval, it->templates);
   50|  8.37M|        else
   51|  8.37M|            ossl_asn1_primitive_free(pval, it, embed);
   52|  8.93M|        break;
   53|       |
   54|   878k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |   85|   878k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (54:5): [True: 878k, False: 12.5M]
  ------------------
   55|   878k|        ossl_asn1_primitive_free(pval, it, embed);
   56|   878k|        break;
   57|       |
   58|   291k|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |   82|   291k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (58:5): [True: 291k, False: 13.1M]
  ------------------
   59|   291k|        if (asn1_cb) {
  ------------------
  |  Branch (59:13): [True: 24.8k, False: 266k]
  ------------------
   60|  24.8k|            i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
  ------------------
  |  |  744|  24.8k|# define ASN1_OP_FREE_PRE        2
  ------------------
   61|  24.8k|            if (i == 2)
  ------------------
  |  Branch (61:17): [True: 0, False: 24.8k]
  ------------------
   62|      0|                return;
   63|  24.8k|        }
   64|   291k|        i = ossl_asn1_get_choice_selector(pval, it);
   65|   291k|        if ((i >= 0) && (i < it->tcount)) {
  ------------------
  |  Branch (65:13): [True: 62.7k, False: 228k]
  |  Branch (65:25): [True: 62.7k, False: 0]
  ------------------
   66|  62.7k|            ASN1_VALUE **pchval;
   67|       |
   68|  62.7k|            tt = it->templates + i;
   69|  62.7k|            pchval = ossl_asn1_get_field_ptr(pval, tt);
   70|  62.7k|            ossl_asn1_template_free(pchval, tt);
   71|  62.7k|        }
   72|   291k|        if (asn1_cb)
  ------------------
  |  Branch (72:13): [True: 24.8k, False: 266k]
  ------------------
   73|  24.8k|            asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
  ------------------
  |  |  745|  24.8k|# define ASN1_OP_FREE_POST       3
  ------------------
   74|   291k|        if (embed == 0) {
  ------------------
  |  Branch (74:13): [True: 272k, False: 18.4k]
  ------------------
   75|   272k|            OPENSSL_free(*pval);
  ------------------
  |  |  107|   272k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   272k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   272k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   76|   272k|            *pval = NULL;
   77|   272k|        }
   78|   291k|        break;
   79|       |
   80|   301k|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |   84|   301k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (80:5): [True: 301k, False: 13.0M]
  ------------------
   81|   301k|        ef = it->funcs;
   82|   301k|        if (ef && ef->asn1_ex_free)
  ------------------
  |  Branch (82:13): [True: 301k, False: 0]
  |  Branch (82:19): [True: 301k, False: 0]
  ------------------
   83|   301k|            ef->asn1_ex_free(pval, it);
   84|   301k|        break;
   85|       |
   86|   142k|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |   86|   142k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (86:5): [True: 142k, False: 13.2M]
  ------------------
   87|  2.98M|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |   81|  2.98M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (87:5): [True: 2.84M, False: 10.5M]
  ------------------
   88|  2.98M|        if (ossl_asn1_do_lock(pval, -1, it) != 0) /* if error or ref-counter > 0 */
  ------------------
  |  Branch (88:13): [True: 0, False: 2.98M]
  ------------------
   89|      0|            return;
   90|  2.98M|        if (asn1_cb) {
  ------------------
  |  Branch (90:13): [True: 425k, False: 2.55M]
  ------------------
   91|   425k|            i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
  ------------------
  |  |  744|   425k|# define ASN1_OP_FREE_PRE        2
  ------------------
   92|   425k|            if (i == 2)
  ------------------
  |  Branch (92:17): [True: 108k, False: 317k]
  ------------------
   93|   108k|                return;
   94|   425k|        }
   95|  2.87M|        ossl_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|  2.87M|        tt = it->templates + it->tcount;
  102|  10.8M|        for (i = 0; i < it->tcount; i++) {
  ------------------
  |  Branch (102:21): [True: 7.99M, False: 2.87M]
  ------------------
  103|  7.99M|            ASN1_VALUE **pseqval;
  104|       |
  105|  7.99M|            tt--;
  106|  7.99M|            seqtt = ossl_asn1_do_adb(*pval, tt, 0);
  107|  7.99M|            if (!seqtt)
  ------------------
  |  Branch (107:17): [True: 64.8k, False: 7.92M]
  ------------------
  108|  64.8k|                continue;
  109|  7.92M|            pseqval = ossl_asn1_get_field_ptr(pval, seqtt);
  110|  7.92M|            ossl_asn1_template_free(pseqval, seqtt);
  111|  7.92M|        }
  112|  2.87M|        if (asn1_cb)
  ------------------
  |  Branch (112:13): [True: 317k, False: 2.55M]
  ------------------
  113|   317k|            asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
  ------------------
  |  |  745|   317k|# define ASN1_OP_FREE_POST       3
  ------------------
  114|  2.87M|        if (embed == 0) {
  ------------------
  |  Branch (114:13): [True: 2.53M, False: 341k]
  ------------------
  115|  2.53M|            OPENSSL_free(*pval);
  ------------------
  |  |  107|  2.53M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.53M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.53M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  116|  2.53M|            *pval = NULL;
  117|  2.53M|        }
  118|  2.87M|        break;
  119|  13.3M|    }
  120|  13.3M|}
ossl_asn1_template_free:
  123|  9.37M|{
  124|  9.37M|    int embed = tt->flags & ASN1_TFLG_EMBED;
  ------------------
  |  |  597|  9.37M|# define ASN1_TFLG_EMBED         (0x1 << 12)
  ------------------
  125|  9.37M|    ASN1_VALUE *tval;
  126|  9.37M|    if (embed) {
  ------------------
  |  Branch (126:9): [True: 788k, False: 8.58M]
  ------------------
  127|   788k|        tval = (ASN1_VALUE *)pval;
  128|   788k|        pval = &tval;
  129|   788k|    }
  130|  9.37M|    if (tt->flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  539|  9.37M|# define ASN1_TFLG_SK_MASK       (0x3 << 1)
  ------------------
  |  Branch (130:9): [True: 1.38M, False: 7.98M]
  ------------------
  131|  1.38M|        STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
  ------------------
  |  |   31|  1.38M|# define STACK_OF(type) struct stack_st_##type
  ------------------
  132|  1.38M|        int i;
  133|       |
  134|  3.37M|        for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
  ------------------
  |  |  898|  3.37M|#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk))
  ------------------
  |  Branch (134:21): [True: 1.98M, False: 1.38M]
  ------------------
  135|  1.98M|            ASN1_VALUE *vtmp = sk_ASN1_VALUE_value(sk, i);
  ------------------
  |  |  899|  1.98M|#define sk_ASN1_VALUE_value(sk, idx) ((ASN1_VALUE *)OPENSSL_sk_value(ossl_check_const_ASN1_VALUE_sk_type(sk), (idx)))
  ------------------
  136|       |
  137|  1.98M|            ossl_asn1_item_embed_free(&vtmp, ASN1_ITEM_ptr(tt->item), embed);
  ------------------
  |  |  421|  1.98M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  138|  1.98M|        }
  139|  1.38M|        sk_ASN1_VALUE_free(sk);
  ------------------
  |  |  904|  1.38M|#define sk_ASN1_VALUE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_VALUE_sk_type(sk))
  ------------------
  140|  1.38M|        *pval = NULL;
  141|  7.98M|    } else {
  142|  7.98M|        ossl_asn1_item_embed_free(pval, ASN1_ITEM_ptr(tt->item), embed);
  ------------------
  |  |  421|  7.98M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  143|  7.98M|    }
  144|  9.37M|}
ossl_asn1_primitive_free:
  147|  11.9M|{
  148|  11.9M|    int utype;
  149|       |
  150|       |    /* Special case: if 'it' is a primitive with a free_func, use that. */
  151|  11.9M|    if (it) {
  ------------------
  |  Branch (151:9): [True: 9.25M, False: 2.65M]
  ------------------
  152|  9.25M|        const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
  153|       |
  154|  9.25M|        if (embed) {
  ------------------
  |  Branch (154:13): [True: 429k, False: 8.82M]
  ------------------
  155|   429k|            if (pf && pf->prim_clear) {
  ------------------
  |  Branch (155:17): [True: 180k, False: 248k]
  |  Branch (155:23): [True: 180k, False: 0]
  ------------------
  156|   180k|                pf->prim_clear(pval, it);
  157|   180k|                return;
  158|   180k|            }
  159|  8.82M|        } else if (pf && pf->prim_free) {
  ------------------
  |  Branch (159:20): [True: 186k, False: 8.64M]
  |  Branch (159:26): [True: 186k, False: 0]
  ------------------
  160|   186k|            pf->prim_free(pval, it);
  161|   186k|            return;
  162|   186k|        }
  163|  9.25M|    }
  164|       |
  165|       |    /* Special case: if 'it' is NULL, free contents of ASN1_TYPE */
  166|  11.5M|    if (!it) {
  ------------------
  |  Branch (166:9): [True: 2.65M, False: 8.89M]
  ------------------
  167|  2.65M|        ASN1_TYPE *typ = (ASN1_TYPE *)*pval;
  168|       |
  169|  2.65M|        utype = typ->type;
  170|  2.65M|        pval = &typ->value.asn1_value;
  171|  2.65M|        if (*pval == NULL)
  ------------------
  |  Branch (171:13): [True: 17.2k, False: 2.63M]
  ------------------
  172|  17.2k|            return;
  173|  8.89M|    } else if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |   85|  8.89M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (173:16): [True: 878k, False: 8.01M]
  ------------------
  174|   878k|        utype = -1;
  175|   878k|        if (*pval == NULL)
  ------------------
  |  Branch (175:13): [True: 0, False: 878k]
  ------------------
  176|      0|            return;
  177|  8.01M|    } else {
  178|  8.01M|        utype = it->utype;
  179|  8.01M|        if ((utype != V_ASN1_BOOLEAN) && *pval == NULL)
  ------------------
  |  |   63|  8.01M|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (179:13): [True: 7.73M, False: 275k]
  |  Branch (179:42): [True: 2.16M, False: 5.57M]
  ------------------
  180|  2.16M|            return;
  181|  8.01M|    }
  182|       |
  183|  9.36M|    switch (utype) {
  184|  1.64M|    case V_ASN1_OBJECT:
  ------------------
  |  |   68|  1.64M|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (184:5): [True: 1.64M, False: 7.72M]
  ------------------
  185|  1.64M|        ASN1_OBJECT_free((ASN1_OBJECT *)*pval);
  186|  1.64M|        break;
  187|       |
  188|   276k|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   63|   276k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (188:5): [True: 276k, False: 9.09M]
  ------------------
  189|   276k|        if (it)
  ------------------
  |  Branch (189:13): [True: 275k, False: 819]
  ------------------
  190|   275k|            *(ASN1_BOOLEAN *)pval = it->size;
  191|    819|        else
  192|    819|            *(ASN1_BOOLEAN *)pval = -1;
  193|   276k|        return;
  194|       |
  195|     17|    case V_ASN1_NULL:
  ------------------
  |  |   67|     17|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (195:5): [True: 17, False: 9.36M]
  ------------------
  196|     17|        break;
  197|       |
  198|  2.65M|    case V_ASN1_ANY:
  ------------------
  |  |   58|  2.65M|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (198:5): [True: 2.65M, False: 6.71M]
  ------------------
  199|  2.65M|        ossl_asn1_primitive_free(pval, NULL, 0);
  200|  2.65M|        OPENSSL_free(*pval);
  ------------------
  |  |  107|  2.65M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.65M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.65M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  201|  2.65M|        break;
  202|       |
  203|  4.79M|    default:
  ------------------
  |  Branch (203:5): [True: 4.79M, False: 4.57M]
  ------------------
  204|  4.79M|        ossl_asn1_string_embed_free((ASN1_STRING *)*pval, embed);
  205|  4.79M|        break;
  206|  9.36M|    }
  207|  9.09M|    *pval = NULL;
  208|  9.09M|}

ASN1_item_new:
   30|  3.12M|{
   31|  3.12M|    ASN1_VALUE *ret = NULL;
   32|  3.12M|    if (ASN1_item_ex_new(&ret, it) > 0)
  ------------------
  |  Branch (32:9): [True: 3.12M, False: 0]
  ------------------
   33|  3.12M|        return ret;
   34|      0|    return NULL;
   35|  3.12M|}
ossl_asn1_item_ex_new_intern:
   51|  1.87M|{
   52|  1.87M|    return asn1_item_embed_new(pval, it, 0, libctx, propq);
   53|  1.87M|}
ASN1_item_ex_new:
   56|  3.12M|{
   57|  3.12M|    return asn1_item_embed_new(pval, it, 0, NULL, NULL);
   58|  3.12M|}
tasn_new.c:asn1_item_embed_new:
   62|  10.1M|{
   63|  10.1M|    const ASN1_TEMPLATE *tt = NULL;
   64|  10.1M|    const ASN1_EXTERN_FUNCS *ef;
   65|  10.1M|    const ASN1_AUX *aux = it->funcs;
   66|  10.1M|    ASN1_aux_cb *asn1_cb;
   67|  10.1M|    ASN1_VALUE **pseqval;
   68|  10.1M|    int i;
   69|  10.1M|    if (aux && aux->asn1_cb)
  ------------------
  |  Branch (69:9): [True: 1.01M, False: 9.12M]
  |  Branch (69:16): [True: 685k, False: 329k]
  ------------------
   70|   685k|        asn1_cb = aux->asn1_cb;
   71|  9.45M|    else
   72|  9.45M|        asn1_cb = 0;
   73|       |
   74|  10.1M|    switch (it->itype) {
  ------------------
  |  Branch (74:13): [True: 0, False: 10.1M]
  ------------------
   75|       |
   76|   277k|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |   84|   277k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (76:5): [True: 277k, False: 9.86M]
  ------------------
   77|   277k|        ef = it->funcs;
   78|   277k|        if (ef != NULL) {
  ------------------
  |  Branch (78:13): [True: 277k, False: 0]
  ------------------
   79|   277k|            if (ef->asn1_ex_new_ex != NULL) {
  ------------------
  |  Branch (79:17): [True: 88.8k, False: 188k]
  ------------------
   80|  88.8k|                if (!ef->asn1_ex_new_ex(pval, it, libctx, propq))
  ------------------
  |  Branch (80:21): [True: 0, False: 88.8k]
  ------------------
   81|      0|                    goto asn1err;
   82|   188k|            } else if (ef->asn1_ex_new != NULL) {
  ------------------
  |  Branch (82:24): [True: 188k, False: 0]
  ------------------
   83|   188k|                if (!ef->asn1_ex_new(pval, it))
  ------------------
  |  Branch (83:21): [True: 0, False: 188k]
  ------------------
   84|      0|                    goto asn1err;
   85|   188k|            }
   86|   277k|        }
   87|   277k|        break;
   88|       |
   89|  5.74M|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |   80|  5.74M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (89:5): [True: 5.74M, False: 4.39M]
  ------------------
   90|  5.74M|        if (it->templates) {
  ------------------
  |  Branch (90:13): [True: 0, False: 5.74M]
  ------------------
   91|      0|            if (!asn1_template_new(pval, it->templates, libctx, propq))
  ------------------
  |  Branch (91:17): [True: 0, False: 0]
  ------------------
   92|      0|                goto asn1err;
   93|  5.74M|        } else if (!asn1_primitive_new(pval, it, embed))
  ------------------
  |  Branch (93:20): [True: 0, False: 5.74M]
  ------------------
   94|      0|            goto asn1err;
   95|  5.74M|        break;
   96|       |
   97|  5.74M|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |   85|   871k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (97:5): [True: 871k, False: 9.26M]
  ------------------
   98|   871k|        if (!asn1_primitive_new(pval, it, embed))
  ------------------
  |  Branch (98:13): [True: 0, False: 871k]
  ------------------
   99|      0|            goto asn1err;
  100|   871k|        break;
  101|       |
  102|   871k|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |   82|   291k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (102:5): [True: 291k, False: 9.84M]
  ------------------
  103|   291k|        if (asn1_cb) {
  ------------------
  |  Branch (103:13): [True: 24.8k, False: 266k]
  ------------------
  104|  24.8k|            i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
  ------------------
  |  |  742|  24.8k|# define ASN1_OP_NEW_PRE         0
  ------------------
  105|  24.8k|            if (!i)
  ------------------
  |  Branch (105:17): [True: 0, False: 24.8k]
  ------------------
  106|      0|                goto auxerr;
  107|  24.8k|            if (i == 2) {
  ------------------
  |  Branch (107:17): [True: 0, False: 24.8k]
  ------------------
  108|      0|                return 1;
  109|      0|            }
  110|  24.8k|        }
  111|   291k|        if (embed) {
  ------------------
  |  Branch (111:13): [True: 18.4k, False: 272k]
  ------------------
  112|  18.4k|            memset(*pval, 0, it->size);
  113|   272k|        } else {
  114|   272k|            *pval = OPENSSL_zalloc(it->size);
  ------------------
  |  |   99|   272k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   272k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   272k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  115|   272k|            if (*pval == NULL)
  ------------------
  |  Branch (115:17): [True: 0, False: 272k]
  ------------------
  116|      0|                return 0;
  117|   272k|        }
  118|   291k|        ossl_asn1_set_choice_selector(pval, -1, it);
  119|   291k|        if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
  ------------------
  |  |  743|  24.8k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (119:13): [True: 24.8k, False: 266k]
  |  Branch (119:24): [True: 0, False: 24.8k]
  ------------------
  120|      0|            goto auxerr2;
  121|   291k|        break;
  122|       |
  123|   291k|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |   86|   142k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (123:5): [True: 142k, False: 9.99M]
  ------------------
  124|  2.95M|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |   81|  2.95M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (124:5): [True: 2.81M, False: 7.32M]
  ------------------
  125|  2.95M|        if (asn1_cb) {
  ------------------
  |  Branch (125:13): [True: 431k, False: 2.52M]
  ------------------
  126|   431k|            i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
  ------------------
  |  |  742|   431k|# define ASN1_OP_NEW_PRE         0
  ------------------
  127|   431k|            if (!i)
  ------------------
  |  Branch (127:17): [True: 0, False: 431k]
  ------------------
  128|      0|                goto auxerr;
  129|   431k|            if (i == 2) {
  ------------------
  |  Branch (129:17): [True: 113k, False: 317k]
  ------------------
  130|   113k|                return 1;
  131|   113k|            }
  132|   431k|        }
  133|  2.84M|        if (embed) {
  ------------------
  |  Branch (133:13): [True: 341k, False: 2.50M]
  ------------------
  134|   341k|            memset(*pval, 0, it->size);
  135|  2.50M|        } else {
  136|  2.50M|            *pval = OPENSSL_zalloc(it->size);
  ------------------
  |  |   99|  2.50M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.50M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.50M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  137|  2.50M|            if (*pval == NULL)
  ------------------
  |  Branch (137:17): [True: 0, False: 2.50M]
  ------------------
  138|      0|                return 0;
  139|  2.50M|        }
  140|       |        /* 0 : init. lock */
  141|  2.84M|        if (ossl_asn1_do_lock(pval, 0, it) < 0) {
  ------------------
  |  Branch (141:13): [True: 0, False: 2.84M]
  ------------------
  142|      0|            if (!embed) {
  ------------------
  |  Branch (142:17): [True: 0, False: 0]
  ------------------
  143|      0|                OPENSSL_free(*pval);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  144|      0|                *pval = NULL;
  145|      0|            }
  146|      0|            goto asn1err;
  147|      0|        }
  148|  2.84M|        ossl_asn1_enc_init(pval, it);
  149|  10.8M|        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
  ------------------
  |  Branch (149:41): [True: 7.96M, False: 2.84M]
  ------------------
  150|  7.96M|            pseqval = ossl_asn1_get_field_ptr(pval, tt);
  151|  7.96M|            if (!asn1_template_new(pseqval, tt, libctx, propq))
  ------------------
  |  Branch (151:17): [True: 0, False: 7.96M]
  ------------------
  152|      0|                goto asn1err2;
  153|  7.96M|        }
  154|  2.84M|        if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
  ------------------
  |  |  743|   317k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (154:13): [True: 317k, False: 2.52M]
  |  Branch (154:24): [True: 0, False: 317k]
  ------------------
  155|      0|            goto auxerr2;
  156|  2.84M|        break;
  157|  10.1M|    }
  158|  10.0M|    return 1;
  159|       |
  160|      0| asn1err2:
  161|      0|    ossl_asn1_item_embed_free(pval, it, embed);
  162|      0| asn1err:
  163|      0|    ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  164|      0|    return 0;
  165|       |
  166|      0| auxerr2:
  167|      0|    ossl_asn1_item_embed_free(pval, it, embed);
  168|      0| auxerr:
  169|      0|    ERR_raise(ERR_LIB_ASN1, ASN1_R_AUX_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  170|      0|    return 0;
  171|       |
  172|      0|}
tasn_new.c:asn1_template_new:
  209|  7.96M|{
  210|  7.96M|    const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
  ------------------
  |  |  421|  7.96M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  211|  7.96M|    int embed = tt->flags & ASN1_TFLG_EMBED;
  ------------------
  |  |  597|  7.96M|# define ASN1_TFLG_EMBED         (0x1 << 12)
  ------------------
  212|  7.96M|    ASN1_VALUE *tval;
  213|  7.96M|    int ret;
  214|  7.96M|    if (embed) {
  ------------------
  |  Branch (214:9): [True: 785k, False: 7.18M]
  ------------------
  215|   785k|        tval = (ASN1_VALUE *)pval;
  216|   785k|        pval = &tval;
  217|   785k|    }
  218|  7.96M|    if (tt->flags & ASN1_TFLG_OPTIONAL) {
  ------------------
  |  |  523|  7.96M|# define ASN1_TFLG_OPTIONAL      (0x1)
  ------------------
  |  Branch (218:9): [True: 2.53M, False: 5.42M]
  ------------------
  219|  2.53M|        asn1_template_clear(pval, tt);
  220|  2.53M|        return 1;
  221|  2.53M|    }
  222|       |    /* If ANY DEFINED BY nothing to do */
  223|       |
  224|  5.42M|    if (tt->flags & ASN1_TFLG_ADB_MASK) {
  ------------------
  |  |  583|  5.42M|# define ASN1_TFLG_ADB_MASK      (0x3<<8)
  ------------------
  |  Branch (224:9): [True: 127k, False: 5.30M]
  ------------------
  225|   127k|        *pval = NULL;
  226|   127k|        return 1;
  227|   127k|    }
  228|       |    /* If SET OF or SEQUENCE OF, its a STACK */
  229|  5.30M|    if (tt->flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  539|  5.30M|# define ASN1_TFLG_SK_MASK       (0x3 << 1)
  ------------------
  |  Branch (229:9): [True: 165k, False: 5.13M]
  ------------------
  230|   165k|        STACK_OF(ASN1_VALUE) *skval;
  ------------------
  |  |   31|   165k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  231|   165k|        skval = sk_ASN1_VALUE_new_null();
  ------------------
  |  |  901|   165k|#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_null())
  ------------------
  232|   165k|        if (!skval) {
  ------------------
  |  Branch (232:13): [True: 0, False: 165k]
  ------------------
  233|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  234|      0|            ret = 0;
  235|      0|            goto done;
  236|      0|        }
  237|   165k|        *pval = (ASN1_VALUE *)skval;
  238|   165k|        ret = 1;
  239|   165k|        goto done;
  240|   165k|    }
  241|       |    /* Otherwise pass it back to the item routine */
  242|  5.13M|    ret = asn1_item_embed_new(pval, it, embed, libctx, propq);
  243|  5.30M| done:
  244|  5.30M|    return ret;
  245|  5.13M|}
tasn_new.c:asn1_template_clear:
  248|  2.53M|{
  249|       |    /* If ADB or STACK just NULL the field */
  250|  2.53M|    if (tt->flags & (ASN1_TFLG_ADB_MASK | ASN1_TFLG_SK_MASK))
  ------------------
  |  |  583|  2.53M|# define ASN1_TFLG_ADB_MASK      (0x3<<8)
  ------------------
                  if (tt->flags & (ASN1_TFLG_ADB_MASK | ASN1_TFLG_SK_MASK))
  ------------------
  |  |  539|  2.53M|# define ASN1_TFLG_SK_MASK       (0x3 << 1)
  ------------------
  |  Branch (250:9): [True: 539k, False: 1.99M]
  ------------------
  251|   539k|        *pval = NULL;
  252|  1.99M|    else
  253|  1.99M|        asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item));
  ------------------
  |  |  421|  1.99M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  254|  2.53M|}
tasn_new.c:asn1_item_clear:
  175|  1.99M|{
  176|  1.99M|    const ASN1_EXTERN_FUNCS *ef;
  177|       |
  178|  1.99M|    switch (it->itype) {
  ------------------
  |  Branch (178:13): [True: 0, False: 1.99M]
  ------------------
  179|       |
  180|      0|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |   84|      0|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (180:5): [True: 0, False: 1.99M]
  ------------------
  181|      0|        ef = it->funcs;
  182|      0|        if (ef && ef->asn1_ex_clear)
  ------------------
  |  Branch (182:13): [True: 0, False: 0]
  |  Branch (182:19): [True: 0, False: 0]
  ------------------
  183|      0|            ef->asn1_ex_clear(pval, it);
  184|      0|        else
  185|      0|            *pval = NULL;
  186|      0|        break;
  187|       |
  188|  1.66M|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |   80|  1.66M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (188:5): [True: 1.66M, False: 328k]
  ------------------
  189|  1.66M|        if (it->templates)
  ------------------
  |  Branch (189:13): [True: 0, False: 1.66M]
  ------------------
  190|      0|            asn1_template_clear(pval, it->templates);
  191|  1.66M|        else
  192|  1.66M|            asn1_primitive_clear(pval, it);
  193|  1.66M|        break;
  194|       |
  195|  44.6k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |   85|  44.6k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (195:5): [True: 44.6k, False: 1.95M]
  ------------------
  196|  44.6k|        asn1_primitive_clear(pval, it);
  197|  44.6k|        break;
  198|       |
  199|   108k|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |   82|   108k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (199:5): [True: 108k, False: 1.88M]
  ------------------
  200|   274k|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |   81|   274k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (200:5): [True: 166k, False: 1.83M]
  ------------------
  201|   283k|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |   86|   283k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (201:5): [True: 9.23k, False: 1.98M]
  ------------------
  202|   283k|        *pval = NULL;
  203|   283k|        break;
  204|  1.99M|    }
  205|  1.99M|}
tasn_new.c:asn1_primitive_clear:
  328|  1.71M|{
  329|  1.71M|    int utype;
  330|  1.71M|    if (it && it->funcs) {
  ------------------
  |  Branch (330:9): [True: 1.71M, False: 0]
  |  Branch (330:15): [True: 95.1k, False: 1.61M]
  ------------------
  331|  95.1k|        const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
  332|  95.1k|        if (pf->prim_clear)
  ------------------
  |  Branch (332:13): [True: 83.0k, False: 12.0k]
  ------------------
  333|  83.0k|            pf->prim_clear(pval, it);
  334|  12.0k|        else
  335|  12.0k|            *pval = NULL;
  336|  95.1k|        return;
  337|  95.1k|    }
  338|  1.61M|    if (!it || (it->itype == ASN1_ITYPE_MSTRING))
  ------------------
  |  |   85|  1.61M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (338:9): [True: 0, False: 1.61M]
  |  Branch (338:16): [True: 44.6k, False: 1.57M]
  ------------------
  339|  44.6k|        utype = -1;
  340|  1.57M|    else
  341|  1.57M|        utype = it->utype;
  342|  1.61M|    if (utype == V_ASN1_BOOLEAN)
  ------------------
  |  |   63|  1.61M|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (342:9): [True: 142k, False: 1.47M]
  ------------------
  343|   142k|        *(ASN1_BOOLEAN *)pval = it->size;
  344|  1.47M|    else
  345|  1.47M|        *pval = NULL;
  346|  1.61M|}
tasn_new.c:asn1_primitive_new:
  263|  6.61M|{
  264|  6.61M|    ASN1_TYPE *typ;
  265|  6.61M|    ASN1_STRING *str;
  266|  6.61M|    int utype;
  267|       |
  268|  6.61M|    if (!it)
  ------------------
  |  Branch (268:9): [True: 0, False: 6.61M]
  ------------------
  269|      0|        return 0;
  270|       |
  271|  6.61M|    if (it->funcs) {
  ------------------
  |  Branch (271:9): [True: 229k, False: 6.38M]
  ------------------
  272|   229k|        const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
  273|   229k|        if (embed) {
  ------------------
  |  Branch (273:13): [True: 94.0k, False: 135k]
  ------------------
  274|  94.0k|            if (pf->prim_clear) {
  ------------------
  |  Branch (274:17): [True: 94.0k, False: 0]
  ------------------
  275|  94.0k|                pf->prim_clear(pval, it);
  276|  94.0k|                return 1;
  277|  94.0k|            }
  278|   135k|        } else if (pf->prim_new) {
  ------------------
  |  Branch (278:20): [True: 135k, False: 0]
  ------------------
  279|   135k|            return pf->prim_new(pval, it);
  280|   135k|        }
  281|   229k|    }
  282|       |
  283|  6.38M|    if (it->itype == ASN1_ITYPE_MSTRING)
  ------------------
  |  |   85|  6.38M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (283:9): [True: 871k, False: 5.51M]
  ------------------
  284|   871k|        utype = -1;
  285|  5.51M|    else
  286|  5.51M|        utype = it->utype;
  287|  6.38M|    switch (utype) {
  288|  1.64M|    case V_ASN1_OBJECT:
  ------------------
  |  |   68|  1.64M|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (288:5): [True: 1.64M, False: 4.74M]
  ------------------
  289|  1.64M|        *pval = (ASN1_VALUE *)OBJ_nid2obj(NID_undef);
  ------------------
  |  |   18|  1.64M|#define NID_undef                       0
  ------------------
  290|  1.64M|        return 1;
  291|       |
  292|      0|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   63|      0|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (292:5): [True: 0, False: 6.38M]
  ------------------
  293|      0|        *(ASN1_BOOLEAN *)pval = it->size;
  294|      0|        return 1;
  295|       |
  296|      0|    case V_ASN1_NULL:
  ------------------
  |  |   67|      0|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (296:5): [True: 0, False: 6.38M]
  ------------------
  297|      0|        *pval = (ASN1_VALUE *)1;
  298|      0|        return 1;
  299|       |
  300|  2.65M|    case V_ASN1_ANY:
  ------------------
  |  |   58|  2.65M|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (300:5): [True: 2.65M, False: 3.72M]
  ------------------
  301|  2.65M|        if ((typ = OPENSSL_malloc(sizeof(*typ))) == NULL)
  ------------------
  |  |   97|  2.65M|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.65M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.65M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (301:13): [True: 0, False: 2.65M]
  ------------------
  302|      0|            return 0;
  303|  2.65M|        typ->value.ptr = NULL;
  304|  2.65M|        typ->type = -1;
  305|  2.65M|        *pval = (ASN1_VALUE *)typ;
  306|  2.65M|        break;
  307|       |
  308|  2.08M|    default:
  ------------------
  |  Branch (308:5): [True: 2.08M, False: 4.29M]
  ------------------
  309|  2.08M|        if (embed) {
  ------------------
  |  Branch (309:13): [True: 248k, False: 1.83M]
  ------------------
  310|   248k|            str = *(ASN1_STRING **)pval;
  311|   248k|            memset(str, 0, sizeof(*str));
  312|   248k|            str->type = utype;
  313|   248k|            str->flags = ASN1_STRING_FLAG_EMBED;
  ------------------
  |  |  182|   248k|# define ASN1_STRING_FLAG_EMBED 0x080
  ------------------
  314|  1.83M|        } else {
  315|  1.83M|            str = ASN1_STRING_type_new(utype);
  316|  1.83M|            *pval = (ASN1_VALUE *)str;
  317|  1.83M|        }
  318|  2.08M|        if (it->itype == ASN1_ITYPE_MSTRING && str)
  ------------------
  |  |   85|  4.17M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (318:13): [True: 871k, False: 1.21M]
  |  Branch (318:48): [True: 871k, False: 0]
  ------------------
  319|   871k|            str->flags |= ASN1_STRING_FLAG_MSTRING;
  ------------------
  |  |  180|   871k|# define ASN1_STRING_FLAG_MSTRING 0x040
  ------------------
  320|  2.08M|        break;
  321|  6.38M|    }
  322|  4.74M|    if (*pval)
  ------------------
  |  Branch (322:9): [True: 4.74M, False: 0]
  ------------------
  323|  4.74M|        return 1;
  324|      0|    return 0;
  325|  4.74M|}

ASN1_PCTX_new:
   36|      2|{
   37|      2|    ASN1_PCTX *ret;
   38|       |
   39|      2|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      2|    if (ret == NULL)
  ------------------
  |  Branch (40:9): [True: 0, False: 2]
  ------------------
   41|      0|        return NULL;
   42|      2|    return ret;
   43|      2|}
ASN1_PCTX_set_flags:
   56|      2|{
   57|      2|    p->flags = flags;
   58|      2|}
ASN1_PCTX_set_str_flags:
   96|      2|{
   97|      2|    p->str_flags = flags;
   98|      2|}
ASN1_item_print:
  121|  43.5k|{
  122|  43.5k|    const char *sname;
  123|  43.5k|    if (pctx == NULL)
  ------------------
  |  Branch (123:9): [True: 0, False: 43.5k]
  ------------------
  124|      0|        pctx = &default_pctx;
  125|  43.5k|    if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME)
  ------------------
  |  | 1066|  43.5k|# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME          0x100
  ------------------
  |  Branch (125:9): [True: 0, False: 43.5k]
  ------------------
  126|      0|        sname = NULL;
  127|  43.5k|    else
  128|  43.5k|        sname = it->sname;
  129|  43.5k|    return asn1_item_print_ctx(out, &ifld, indent, it, NULL, sname, 0, pctx);
  130|  43.5k|}
tasn_prn.c:asn1_item_print_ctx:
  136|   497k|{
  137|   497k|    const ASN1_TEMPLATE *tt;
  138|   497k|    const ASN1_EXTERN_FUNCS *ef;
  139|   497k|    const ASN1_VALUE **tmpfld;
  140|   497k|    const ASN1_AUX *aux = it->funcs;
  141|   497k|    ASN1_aux_const_cb *asn1_cb = NULL;
  142|   497k|    ASN1_PRINT_ARG parg;
  143|   497k|    int i;
  144|   497k|    if (aux != NULL) {
  ------------------
  |  Branch (144:9): [True: 67.3k, False: 430k]
  ------------------
  145|  67.3k|        parg.out = out;
  146|  67.3k|        parg.indent = indent;
  147|  67.3k|        parg.pctx = pctx;
  148|  67.3k|        asn1_cb = ((aux->flags & ASN1_AFLG_CONST_CB) != 0) ? aux->asn1_const_cb
  ------------------
  |  |  738|  67.3k|# define ASN1_AFLG_CONST_CB      8
  ------------------
  |  Branch (148:19): [True: 0, False: 67.3k]
  ------------------
  149|  67.3k|            : (ASN1_aux_const_cb *)aux->asn1_cb; /* backward compatibility */
  150|  67.3k|    }
  151|       |
  152|   497k|   if (((it->itype != ASN1_ITYPE_PRIMITIVE)
  ------------------
  |  |   80|   497k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (152:9): [True: 66.4k, False: 431k]
  ------------------
  153|   497k|       || (it->utype != V_ASN1_BOOLEAN)) && *fld == NULL) {
  ------------------
  |  |   63|   431k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (153:11): [True: 429k, False: 1.75k]
  |  Branch (153:45): [True: 15.5k, False: 480k]
  ------------------
  154|  15.5k|        if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_ABSENT) {
  ------------------
  |  | 1050|  15.5k|# define ASN1_PCTX_FLAGS_SHOW_ABSENT             0x001
  ------------------
  |  Branch (154:13): [True: 15.5k, False: 0]
  ------------------
  155|  15.5k|            if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
  ------------------
  |  Branch (155:17): [True: 15.5k, False: 0]
  |  Branch (155:27): [True: 0, False: 15.5k]
  ------------------
  156|      0|                return 0;
  157|  15.5k|            if (BIO_puts(out, "<ABSENT>\n") <= 0)
  ------------------
  |  Branch (157:17): [True: 0, False: 15.5k]
  ------------------
  158|      0|                return 0;
  159|  15.5k|        }
  160|  15.5k|        return 1;
  161|  15.5k|    }
  162|       |
  163|   482k|    switch (it->itype) {
  164|   418k|    case ASN1_ITYPE_PRIMITIVE:
  ------------------
  |  |   80|   418k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  |  Branch (164:5): [True: 418k, False: 63.5k]
  ------------------
  165|   418k|        if (it->templates) {
  ------------------
  |  Branch (165:13): [True: 7.25k, False: 411k]
  ------------------
  166|  7.25k|            if (!asn1_template_print_ctx(out, fld, indent,
  ------------------
  |  Branch (166:17): [True: 627, False: 6.62k]
  ------------------
  167|  7.25k|                                         it->templates, pctx))
  168|    627|                return 0;
  169|  6.62k|            break;
  170|  7.25k|        }
  171|       |        /* fall through */
  172|   418k|    case ASN1_ITYPE_MSTRING:
  ------------------
  |  |   85|   418k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (172:5): [True: 7.46k, False: 474k]
  ------------------
  173|   418k|        if (!asn1_primitive_print(out, fld, it, indent, fname, sname, pctx))
  ------------------
  |  Branch (173:13): [True: 3.69k, False: 415k]
  ------------------
  174|  3.69k|            return 0;
  175|   415k|        break;
  176|       |
  177|   415k|    case ASN1_ITYPE_EXTERN:
  ------------------
  |  |   84|  3.19k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  |  Branch (177:5): [True: 3.19k, False: 478k]
  ------------------
  178|  3.19k|        if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
  ------------------
  |  Branch (178:13): [True: 3.19k, False: 0]
  |  Branch (178:23): [True: 0, False: 3.19k]
  ------------------
  179|      0|            return 0;
  180|       |        /* Use new style print routine if possible */
  181|  3.19k|        ef = it->funcs;
  182|  3.19k|        if (ef && ef->asn1_ex_print) {
  ------------------
  |  Branch (182:13): [True: 3.19k, False: 0]
  |  Branch (182:19): [True: 3.19k, False: 0]
  ------------------
  183|  3.19k|            i = ef->asn1_ex_print(out, fld, indent, "", pctx);
  184|  3.19k|            if (!i)
  ------------------
  |  Branch (184:17): [True: 51, False: 3.13k]
  ------------------
  185|     51|                return 0;
  186|  3.13k|            if ((i == 2) && (BIO_puts(out, "\n") <= 0))
  ------------------
  |  Branch (186:17): [True: 2.52k, False: 615]
  |  Branch (186:29): [True: 0, False: 2.52k]
  ------------------
  187|      0|                return 0;
  188|  3.13k|            return 1;
  189|  3.13k|        } else if (sname &&
  ------------------
  |  Branch (189:20): [True: 0, False: 0]
  ------------------
  190|      0|                   BIO_printf(out, ":EXTERNAL TYPE %s\n", sname) <= 0)
  ------------------
  |  Branch (190:20): [True: 0, False: 0]
  ------------------
  191|      0|            return 0;
  192|      0|        break;
  193|       |
  194|  9.21k|    case ASN1_ITYPE_CHOICE:
  ------------------
  |  |   82|  9.21k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  |  Branch (194:5): [True: 9.21k, False: 472k]
  ------------------
  195|       |        /* CHOICE type, get selector */
  196|  9.21k|        i = ossl_asn1_get_choice_selector_const(fld, it);
  197|       |        /* This should never happen... */
  198|  9.21k|        if ((i < 0) || (i >= it->tcount)) {
  ------------------
  |  Branch (198:13): [True: 0, False: 9.21k]
  |  Branch (198:24): [True: 0, False: 9.21k]
  ------------------
  199|      0|            if (BIO_printf(out, "ERROR: selector [%d] invalid\n", i) <= 0)
  ------------------
  |  Branch (199:17): [True: 0, False: 0]
  ------------------
  200|      0|                return 0;
  201|      0|            return 1;
  202|      0|        }
  203|  9.21k|        tt = it->templates + i;
  204|  9.21k|        tmpfld = ossl_asn1_get_const_field_ptr(fld, tt);
  205|  9.21k|        if (!asn1_template_print_ctx(out, tmpfld, indent, tt, pctx))
  ------------------
  |  Branch (205:13): [True: 63, False: 9.15k]
  ------------------
  206|     63|            return 0;
  207|  9.15k|        break;
  208|       |
  209|  40.2k|    case ASN1_ITYPE_SEQUENCE:
  ------------------
  |  |   81|  40.2k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (209:5): [True: 40.2k, False: 441k]
  ------------------
  210|  43.7k|    case ASN1_ITYPE_NDEF_SEQUENCE:
  ------------------
  |  |   86|  43.7k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (210:5): [True: 3.49k, False: 478k]
  ------------------
  211|  43.7k|        if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
  ------------------
  |  Branch (211:13): [True: 13.8k, False: 29.8k]
  |  Branch (211:23): [True: 0, False: 13.8k]
  ------------------
  212|      0|            return 0;
  213|  43.7k|        if (fname || sname) {
  ------------------
  |  Branch (213:13): [True: 6.69k, False: 37.0k]
  |  Branch (213:22): [True: 7.13k, False: 29.8k]
  ------------------
  214|  13.8k|            if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) {
  ------------------
  |  | 1052|  13.8k|# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE           0x002
  ------------------
  |  Branch (214:17): [True: 13.8k, False: 0]
  ------------------
  215|  13.8k|                if (BIO_puts(out, " {\n") <= 0)
  ------------------
  |  Branch (215:21): [True: 0, False: 13.8k]
  ------------------
  216|      0|                    return 0;
  217|  13.8k|            } else {
  218|      0|                if (BIO_puts(out, "\n") <= 0)
  ------------------
  |  Branch (218:21): [True: 0, False: 0]
  ------------------
  219|      0|                    return 0;
  220|      0|            }
  221|  13.8k|        }
  222|       |
  223|  43.7k|        if (asn1_cb) {
  ------------------
  |  Branch (223:13): [True: 6.27k, False: 37.4k]
  ------------------
  224|  6.27k|            i = asn1_cb(ASN1_OP_PRINT_PRE, fld, it, &parg);
  ------------------
  |  |  750|  6.27k|# define ASN1_OP_PRINT_PRE       8
  ------------------
  225|  6.27k|            if (i == 0)
  ------------------
  |  Branch (225:17): [True: 0, False: 6.27k]
  ------------------
  226|      0|                return 0;
  227|  6.27k|            if (i == 2)
  ------------------
  |  Branch (227:17): [True: 0, False: 6.27k]
  ------------------
  228|      0|                return 1;
  229|  6.27k|        }
  230|       |
  231|       |        /* Print each field entry */
  232|   162k|        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
  ------------------
  |  Branch (232:41): [True: 120k, False: 41.9k]
  ------------------
  233|   120k|            const ASN1_TEMPLATE *seqtt;
  234|   120k|            seqtt = ossl_asn1_do_adb(*fld, tt, 1);
  235|   120k|            if (!seqtt)
  ------------------
  |  Branch (235:17): [True: 0, False: 120k]
  ------------------
  236|      0|                return 0;
  237|   120k|            tmpfld = ossl_asn1_get_const_field_ptr(fld, seqtt);
  238|   120k|            if (!asn1_template_print_ctx(out, tmpfld,
  ------------------
  |  Branch (238:17): [True: 1.76k, False: 119k]
  ------------------
  239|   120k|                                         indent + 2, seqtt, pctx))
  240|  1.76k|                return 0;
  241|   120k|        }
  242|  41.9k|        if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) {
  ------------------
  |  | 1052|  41.9k|# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE           0x002
  ------------------
  |  Branch (242:13): [True: 41.9k, False: 0]
  ------------------
  243|  41.9k|            if (BIO_printf(out, "%*s}\n", indent, "") < 0)
  ------------------
  |  Branch (243:17): [True: 0, False: 41.9k]
  ------------------
  244|      0|                return 0;
  245|  41.9k|        }
  246|       |
  247|  41.9k|        if (asn1_cb) {
  ------------------
  |  Branch (247:13): [True: 5.48k, False: 36.4k]
  ------------------
  248|  5.48k|            i = asn1_cb(ASN1_OP_PRINT_POST, fld, it, &parg);
  ------------------
  |  |  751|  5.48k|# define ASN1_OP_PRINT_POST      9
  ------------------
  249|  5.48k|            if (i == 0)
  ------------------
  |  Branch (249:17): [True: 0, False: 5.48k]
  ------------------
  250|      0|                return 0;
  251|  5.48k|        }
  252|  41.9k|        break;
  253|       |
  254|  41.9k|    default:
  ------------------
  |  Branch (254:5): [True: 0, False: 482k]
  ------------------
  255|      0|        BIO_printf(out, "Unprocessed type %d\n", it->itype);
  256|      0|        return 0;
  257|   482k|    }
  258|       |
  259|   472k|    return 1;
  260|   482k|}
tasn_prn.c:asn1_print_fsname:
  332|   451k|{
  333|   451k|    static const char spaces[] = "                    ";
  334|   451k|    static const int nspaces = sizeof(spaces) - 1;
  335|       |
  336|   452k|    while (indent > nspaces) {
  ------------------
  |  Branch (336:12): [True: 934, False: 451k]
  ------------------
  337|    934|        if (BIO_write(out, spaces, nspaces) != nspaces)
  ------------------
  |  Branch (337:13): [True: 0, False: 934]
  ------------------
  338|      0|            return 0;
  339|    934|        indent -= nspaces;
  340|    934|    }
  341|   451k|    if (BIO_write(out, spaces, indent) != indent)
  ------------------
  |  Branch (341:9): [True: 0, False: 451k]
  ------------------
  342|      0|        return 0;
  343|   451k|    if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME)
  ------------------
  |  | 1066|   451k|# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME          0x100
  ------------------
  |  Branch (343:9): [True: 0, False: 451k]
  ------------------
  344|      0|        sname = NULL;
  345|   451k|    if (pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME)
  ------------------
  |  | 1062|   451k|# define ASN1_PCTX_FLAGS_NO_FIELD_NAME           0x040
  ------------------
  |  Branch (345:9): [True: 0, False: 451k]
  ------------------
  346|      0|        fname = NULL;
  347|   451k|    if (!sname && !fname)
  ------------------
  |  Branch (347:9): [True: 301k, False: 150k]
  |  Branch (347:19): [True: 301k, False: 0]
  ------------------
  348|   301k|        return 1;
  349|   150k|    if (fname) {
  ------------------
  |  Branch (349:9): [True: 115k, False: 34.9k]
  ------------------
  350|   115k|        if (BIO_puts(out, fname) <= 0)
  ------------------
  |  Branch (350:13): [True: 0, False: 115k]
  ------------------
  351|      0|            return 0;
  352|   115k|    }
  353|   150k|    if (sname) {
  ------------------
  |  Branch (353:9): [True: 150k, False: 0]
  ------------------
  354|   150k|        if (fname) {
  ------------------
  |  Branch (354:13): [True: 115k, False: 34.9k]
  ------------------
  355|   115k|            if (BIO_printf(out, " (%s)", sname) <= 0)
  ------------------
  |  Branch (355:17): [True: 0, False: 115k]
  ------------------
  356|      0|                return 0;
  357|   115k|        } else {
  358|  34.9k|            if (BIO_puts(out, sname) <= 0)
  ------------------
  |  Branch (358:17): [True: 0, False: 34.9k]
  ------------------
  359|      0|                return 0;
  360|  34.9k|        }
  361|   150k|    }
  362|   150k|    if (BIO_write(out, ": ", 2) != 2)
  ------------------
  |  Branch (362:9): [True: 0, False: 150k]
  ------------------
  363|      0|        return 0;
  364|   150k|    return 1;
  365|   150k|}
tasn_prn.c:asn1_template_print_ctx:
  264|   137k|{
  265|   137k|    int i, flags;
  266|   137k|    const char *sname, *fname;
  267|   137k|    const ASN1_VALUE *tfld;
  268|   137k|    flags = tt->flags;
  269|   137k|    if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME)
  ------------------
  |  | 1064|   137k|# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME  0x080
  ------------------
  |  Branch (269:9): [True: 137k, False: 0]
  ------------------
  270|   137k|        sname = ASN1_ITEM_ptr(tt->item)->sname;
  ------------------
  |  |  421|   137k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  271|      0|    else
  272|      0|        sname = NULL;
  273|   137k|    if (pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME)
  ------------------
  |  | 1062|   137k|# define ASN1_PCTX_FLAGS_NO_FIELD_NAME           0x040
  ------------------
  |  Branch (273:9): [True: 0, False: 137k]
  ------------------
  274|      0|        fname = NULL;
  275|   137k|    else
  276|   137k|        fname = tt->field_name;
  277|       |
  278|       |    /*
  279|       |     * If field is embedded then fld needs fixing so it is a pointer to
  280|       |     * a pointer to a field.
  281|       |     */
  282|   137k|    if (flags & ASN1_TFLG_EMBED) {
  ------------------
  |  |  597|   137k|# define ASN1_TFLG_EMBED         (0x1 << 12)
  ------------------
  |  Branch (282:9): [True: 3.84k, False: 133k]
  ------------------
  283|  3.84k|        tfld = (const ASN1_VALUE *)fld;
  284|  3.84k|        fld = &tfld;
  285|  3.84k|    }
  286|       |
  287|   137k|    if (flags & ASN1_TFLG_SK_MASK) {
  ------------------
  |  |  539|   137k|# define ASN1_TFLG_SK_MASK       (0x3 << 1)
  ------------------
  |  Branch (287:9): [True: 20.1k, False: 117k]
  ------------------
  288|  20.1k|        char *tname;
  289|  20.1k|        const ASN1_VALUE *skitem;
  290|  20.1k|        STACK_OF(const_ASN1_VALUE) *stack;
  ------------------
  |  |   31|  20.1k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  291|       |
  292|       |        /* SET OF, SEQUENCE OF */
  293|  20.1k|        if (fname) {
  ------------------
  |  Branch (293:13): [True: 20.1k, False: 0]
  ------------------
  294|  20.1k|            if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SSOF) {
  ------------------
  |  | 1054|  20.1k|# define ASN1_PCTX_FLAGS_SHOW_SSOF               0x004
  ------------------
  |  Branch (294:17): [True: 20.1k, False: 0]
  ------------------
  295|  20.1k|                if (flags & ASN1_TFLG_SET_OF)
  ------------------
  |  |  526|  20.1k|# define ASN1_TFLG_SET_OF        (0x1 << 1)
  ------------------
  |  Branch (295:21): [True: 3.74k, False: 16.4k]
  ------------------
  296|  3.74k|                    tname = "SET";
  297|  16.4k|                else
  298|  16.4k|                    tname = "SEQUENCE";
  299|  20.1k|                if (BIO_printf(out, "%*s%s OF %s {\n",
  ------------------
  |  Branch (299:21): [True: 0, False: 20.1k]
  ------------------
  300|  20.1k|                               indent, "", tname, tt->field_name) <= 0)
  301|      0|                    return 0;
  302|  20.1k|            } else if (BIO_printf(out, "%*s%s:\n", indent, "", fname) <= 0)
  ------------------
  |  Branch (302:24): [True: 0, False: 0]
  ------------------
  303|      0|                return 0;
  304|  20.1k|        }
  305|  20.1k|        stack = (STACK_OF(const_ASN1_VALUE) *)*fld;
  306|   356k|        for (i = 0; i < sk_const_ASN1_VALUE_num(stack); i++) {
  ------------------
  |  Branch (306:21): [True: 337k, False: 19.2k]
  ------------------
  307|   337k|            if ((i > 0) && (BIO_puts(out, "\n") <= 0))
  ------------------
  |  Branch (307:17): [True: 328k, False: 8.53k]
  |  Branch (307:28): [True: 0, False: 328k]
  ------------------
  308|      0|                return 0;
  309|       |
  310|   337k|            skitem = sk_const_ASN1_VALUE_value(stack, i);
  311|   337k|            if (!asn1_item_print_ctx(out, &skitem, indent + 2,
  ------------------
  |  Branch (311:17): [True: 887, False: 336k]
  ------------------
  312|   337k|                                     ASN1_ITEM_ptr(tt->item), NULL, NULL, 1,
  ------------------
  |  |  421|   337k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  313|   337k|                                     pctx))
  314|    887|                return 0;
  315|   337k|        }
  316|  19.2k|        if (i == 0 && BIO_printf(out, "%*s<%s>\n", indent + 2, "",
  ------------------
  |  Branch (316:13): [True: 11.6k, False: 7.64k]
  |  Branch (316:23): [True: 0, False: 11.6k]
  ------------------
  317|  11.6k|                                 stack == NULL ? "ABSENT" : "EMPTY") <= 0)
  ------------------
  |  Branch (317:34): [True: 9.94k, False: 1.69k]
  ------------------
  318|      0|            return 0;
  319|  19.2k|        if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) {
  ------------------
  |  | 1052|  19.2k|# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE           0x002
  ------------------
  |  Branch (319:13): [True: 19.2k, False: 0]
  ------------------
  320|  19.2k|            if (BIO_printf(out, "%*s}\n", indent, "") <= 0)
  ------------------
  |  Branch (320:17): [True: 0, False: 19.2k]
  ------------------
  321|      0|                return 0;
  322|  19.2k|        }
  323|  19.2k|        return 1;
  324|  19.2k|    }
  325|   117k|    return asn1_item_print_ctx(out, fld, indent, ASN1_ITEM_ptr(tt->item),
  ------------------
  |  |  421|   117k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  326|   117k|                               fname, sname, 0, pctx);
  327|   137k|}
tasn_prn.c:asn1_primitive_print:
  435|   418k|{
  436|   418k|    long utype;
  437|   418k|    ASN1_STRING *str;
  438|   418k|    int ret = 1, needlf = 1;
  439|   418k|    const char *pname;
  440|   418k|    const ASN1_PRIMITIVE_FUNCS *pf;
  441|   418k|    pf = it->funcs;
  442|   418k|    if (!asn1_print_fsname(out, indent, fname, sname, pctx))
  ------------------
  |  Branch (442:9): [True: 0, False: 418k]
  ------------------
  443|      0|        return 0;
  444|   418k|    if (pf && pf->prim_print)
  ------------------
  |  Branch (444:9): [True: 54.3k, False: 364k]
  |  Branch (444:15): [True: 54.3k, False: 0]
  ------------------
  445|  54.3k|        return pf->prim_print(out, fld, it, indent, pctx);
  446|   364k|    if (it->itype == ASN1_ITYPE_MSTRING) {
  ------------------
  |  |   85|   364k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  |  Branch (446:9): [True: 7.46k, False: 357k]
  ------------------
  447|  7.46k|        str = (ASN1_STRING *)*fld;
  448|  7.46k|        utype = str->type & ~V_ASN1_NEG;
  ------------------
  |  |   97|  7.46k|# define V_ASN1_NEG                      0x100
  ------------------
  449|   357k|    } else {
  450|   357k|        utype = it->utype;
  451|   357k|        if (utype == V_ASN1_BOOLEAN)
  ------------------
  |  |   63|   357k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (451:13): [True: 1.75k, False: 355k]
  ------------------
  452|  1.75k|            str = NULL;
  453|   355k|        else
  454|   355k|            str = (ASN1_STRING *)*fld;
  455|   357k|    }
  456|   364k|    if (utype == V_ASN1_ANY) {
  ------------------
  |  |   58|   364k|# define V_ASN1_ANY                      -4/* used in ASN1 template code */
  ------------------
  |  Branch (456:9): [True: 315k, False: 49.4k]
  ------------------
  457|   315k|        const ASN1_TYPE *atype = (const ASN1_TYPE *)*fld;
  458|   315k|        utype = atype->type;
  459|   315k|        fld = (const ASN1_VALUE **)&atype->value.asn1_value; /* actually is const */
  460|   315k|        str = (ASN1_STRING *)*fld;
  461|   315k|        if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE)
  ------------------
  |  | 1058|   315k|# define ASN1_PCTX_FLAGS_NO_ANY_TYPE             0x010
  ------------------
  |  Branch (461:13): [True: 0, False: 315k]
  ------------------
  462|      0|            pname = NULL;
  463|   315k|        else
  464|   315k|            pname = ASN1_tag2str(utype);
  465|   315k|    } else {
  466|  49.4k|        if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_TYPE)
  ------------------
  |  | 1056|  49.4k|# define ASN1_PCTX_FLAGS_SHOW_TYPE               0x008
  ------------------
  |  Branch (466:13): [True: 49.4k, False: 0]
  ------------------
  467|  49.4k|            pname = ASN1_tag2str(utype);
  468|      0|        else
  469|      0|            pname = NULL;
  470|  49.4k|    }
  471|       |
  472|   364k|    if (utype == V_ASN1_NULL) {
  ------------------
  |  |   67|   364k|# define V_ASN1_NULL                     5
  ------------------
  |  Branch (472:9): [True: 1.50k, False: 362k]
  ------------------
  473|  1.50k|        if (BIO_puts(out, "NULL\n") <= 0)
  ------------------
  |  Branch (473:13): [True: 0, False: 1.50k]
  ------------------
  474|      0|            return 0;
  475|  1.50k|        return 1;
  476|  1.50k|    }
  477|       |
  478|   362k|    if (pname) {
  ------------------
  |  Branch (478:9): [True: 362k, False: 0]
  ------------------
  479|   362k|        if (BIO_puts(out, pname) <= 0)
  ------------------
  |  Branch (479:13): [True: 0, False: 362k]
  ------------------
  480|      0|            return 0;
  481|   362k|        if (BIO_puts(out, ":") <= 0)
  ------------------
  |  Branch (481:13): [True: 0, False: 362k]
  ------------------
  482|      0|            return 0;
  483|   362k|    }
  484|       |
  485|   362k|    switch (utype) {
  486|  2.02k|    case V_ASN1_BOOLEAN:
  ------------------
  |  |   63|  2.02k|# define V_ASN1_BOOLEAN                  1 /**/
  ------------------
  |  Branch (486:5): [True: 2.02k, False: 360k]
  ------------------
  487|  2.02k|        {
  488|  2.02k|            int boolval = *(int *)fld;
  489|  2.02k|            if (boolval == -1)
  ------------------
  |  Branch (489:17): [True: 435, False: 1.59k]
  ------------------
  490|    435|                boolval = it->size;
  491|  2.02k|            ret = asn1_print_boolean(out, boolval);
  492|  2.02k|        }
  493|  2.02k|        break;
  494|       |
  495|  13.2k|    case V_ASN1_INTEGER:
  ------------------
  |  |   64|  13.2k|# define V_ASN1_INTEGER                  2
  ------------------
  |  Branch (495:5): [True: 13.2k, False: 349k]
  ------------------
  496|  13.3k|    case V_ASN1_ENUMERATED:
  ------------------
  |  |   72|  13.3k|# define V_ASN1_ENUMERATED               10
  ------------------
  |  Branch (496:5): [True: 73, False: 362k]
  ------------------
  497|  13.3k|        ret = asn1_print_integer(out, str);
  498|  13.3k|        break;
  499|       |
  500|    623|    case V_ASN1_UTCTIME:
  ------------------
  |  |   82|    623|# define V_ASN1_UTCTIME                  23
  ------------------
  |  Branch (500:5): [True: 623, False: 362k]
  ------------------
  501|    623|        ret = ASN1_UTCTIME_print(out, str);
  502|    623|        break;
  503|       |
  504|  1.05k|    case V_ASN1_GENERALIZEDTIME:
  ------------------
  |  |   83|  1.05k|# define V_ASN1_GENERALIZEDTIME          24 /**/
  ------------------
  |  Branch (504:5): [True: 1.05k, False: 361k]
  ------------------
  505|  1.05k|        ret = ASN1_GENERALIZEDTIME_print(out, str);
  506|  1.05k|        break;
  507|       |
  508|  20.8k|    case V_ASN1_OBJECT:
  ------------------
  |  |   68|  20.8k|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (508:5): [True: 20.8k, False: 342k]
  ------------------
  509|  20.8k|        ret = asn1_print_oid(out, (const ASN1_OBJECT *)*fld);
  510|  20.8k|        break;
  511|       |
  512|  7.65k|    case V_ASN1_OCTET_STRING:
  ------------------
  |  |   66|  7.65k|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (512:5): [True: 7.65k, False: 355k]
  ------------------
  513|  11.3k|    case V_ASN1_BIT_STRING:
  ------------------
  |  |   65|  11.3k|# define V_ASN1_BIT_STRING               3
  ------------------
  |  Branch (513:5): [True: 3.66k, False: 359k]
  ------------------
  514|  11.3k|        ret = asn1_print_obstring(out, str, indent);
  515|  11.3k|        needlf = 0;
  516|  11.3k|        break;
  517|       |
  518|  39.3k|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   74|  39.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (518:5): [True: 39.3k, False: 323k]
  ------------------
  519|   304k|    case V_ASN1_SET:
  ------------------
  |  |   75|   304k|# define V_ASN1_SET                      17
  ------------------
  |  Branch (519:5): [True: 264k, False: 98.0k]
  ------------------
  520|   309k|    case V_ASN1_OTHER:
  ------------------
  |  |   57|   309k|# define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
  ------------------
  |  Branch (520:5): [True: 5.69k, False: 357k]
  ------------------
  521|   309k|        if (BIO_puts(out, "\n") <= 0)
  ------------------
  |  Branch (521:13): [True: 0, False: 309k]
  ------------------
  522|      0|            return 0;
  523|   309k|        if (ASN1_parse_dump(out, str->data, str->length, indent, 0) <= 0)
  ------------------
  |  Branch (523:13): [True: 2.69k, False: 307k]
  ------------------
  524|  2.69k|            ret = 0;
  525|   309k|        needlf = 0;
  526|   309k|        break;
  527|       |
  528|  3.74k|    default:
  ------------------
  |  Branch (528:5): [True: 3.74k, False: 359k]
  ------------------
  529|  3.74k|        ret = ASN1_STRING_print_ex(out, str, pctx->str_flags);
  530|       |
  531|   362k|    }
  532|   362k|    if (!ret)
  ------------------
  |  Branch (532:9): [True: 3.69k, False: 359k]
  ------------------
  533|  3.69k|        return 0;
  534|   359k|    if (needlf && BIO_puts(out, "\n") <= 0)
  ------------------
  |  Branch (534:9): [True: 40.6k, False: 318k]
  |  Branch (534:19): [True: 0, False: 40.6k]
  ------------------
  535|      0|        return 0;
  536|   359k|    return 1;
  537|   359k|}
tasn_prn.c:asn1_print_boolean:
  368|  2.02k|{
  369|  2.02k|    const char *str;
  370|  2.02k|    switch (boolval) {
  371|    435|    case -1:
  ------------------
  |  Branch (371:5): [True: 435, False: 1.59k]
  ------------------
  372|    435|        str = "BOOL ABSENT";
  373|    435|        break;
  374|       |
  375|  1.01k|    case 0:
  ------------------
  |  Branch (375:5): [True: 1.01k, False: 1.01k]
  ------------------
  376|  1.01k|        str = "FALSE";
  377|  1.01k|        break;
  378|       |
  379|    578|    default:
  ------------------
  |  Branch (379:5): [True: 578, False: 1.44k]
  ------------------
  380|    578|        str = "TRUE";
  381|    578|        break;
  382|       |
  383|  2.02k|    }
  384|       |
  385|  2.02k|    if (BIO_puts(out, str) <= 0)
  ------------------
  |  Branch (385:9): [True: 0, False: 2.02k]
  ------------------
  386|      0|        return 0;
  387|  2.02k|    return 1;
  388|       |
  389|  2.02k|}
tasn_prn.c:asn1_print_integer:
  392|  13.3k|{
  393|  13.3k|    char *s;
  394|  13.3k|    int ret = 1;
  395|  13.3k|    s = i2s_ASN1_INTEGER(NULL, str);
  396|  13.3k|    if (s == NULL)
  ------------------
  |  Branch (396:9): [True: 73, False: 13.2k]
  ------------------
  397|     73|        return 0;
  398|  13.2k|    if (BIO_puts(out, s) <= 0)
  ------------------
  |  Branch (398:9): [True: 0, False: 13.2k]
  ------------------
  399|      0|        ret = 0;
  400|  13.2k|    OPENSSL_free(s);
  ------------------
  |  |  107|  13.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  13.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  13.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  401|  13.2k|    return ret;
  402|  13.3k|}
tasn_prn.c:asn1_print_oid:
  405|  20.8k|{
  406|  20.8k|    char objbuf[80];
  407|  20.8k|    const char *ln;
  408|  20.8k|    ln = OBJ_nid2ln(OBJ_obj2nid(oid));
  409|  20.8k|    if (!ln)
  ------------------
  |  Branch (409:9): [True: 0, False: 20.8k]
  ------------------
  410|      0|        ln = "";
  411|  20.8k|    OBJ_obj2txt(objbuf, sizeof(objbuf), oid, 1);
  412|  20.8k|    if (BIO_printf(out, "%s (%s)", ln, objbuf) <= 0)
  ------------------
  |  Branch (412:9): [True: 0, False: 20.8k]
  ------------------
  413|      0|        return 0;
  414|  20.8k|    return 1;
  415|  20.8k|}
tasn_prn.c:asn1_print_obstring:
  418|  11.3k|{
  419|  11.3k|    if (str->type == V_ASN1_BIT_STRING) {
  ------------------
  |  |   65|  11.3k|# define V_ASN1_BIT_STRING               3
  ------------------
  |  Branch (419:9): [True: 3.66k, False: 7.65k]
  ------------------
  420|  3.66k|        if (BIO_printf(out, " (%ld unused bits)\n", str->flags & 0x7) <= 0)
  ------------------
  |  Branch (420:13): [True: 0, False: 3.66k]
  ------------------
  421|      0|            return 0;
  422|  7.65k|    } else if (BIO_puts(out, "\n") <= 0)
  ------------------
  |  Branch (422:16): [True: 0, False: 7.65k]
  ------------------
  423|      0|        return 0;
  424|  11.3k|    if ((str->length > 0)
  ------------------
  |  Branch (424:9): [True: 7.43k, False: 3.88k]
  ------------------
  425|  11.3k|        && BIO_dump_indent(out, (const char *)str->data, str->length,
  ------------------
  |  Branch (425:12): [True: 0, False: 7.43k]
  ------------------
  426|  7.43k|                           indent + 2) <= 0)
  427|      0|        return 0;
  428|  11.3k|    return 1;
  429|  11.3k|}

ASN1_OCTET_STRING_free:
   23|  2.83M|void sname##_free(sname *x) \
   24|  2.83M|{ \
   25|  2.83M|    ASN1_STRING_free(x); \
   26|  2.83M|}
ASN1_INTEGER_new:
   19|   330k|sname *sname##_new(void) \
   20|   330k|{ \
   21|   330k|    return ASN1_STRING_type_new(V_##sname); \
   22|   330k|} \
ASN1_INTEGER_free:
   23|  2.90M|void sname##_free(sname *x) \
   24|  2.90M|{ \
   25|  2.90M|    ASN1_STRING_free(x); \
   26|  2.90M|}
ASN1_ENUMERATED_free:
   23|  2.53M|void sname##_free(sname *x) \
   24|  2.53M|{ \
   25|  2.53M|    ASN1_STRING_free(x); \
   26|  2.53M|}
ASN1_BIT_STRING_new:
   19|   176k|sname *sname##_new(void) \
   20|   176k|{ \
   21|   176k|    return ASN1_STRING_type_new(V_##sname); \
   22|   176k|} \
ASN1_BIT_STRING_free:
   23|   108k|void sname##_free(sname *x) \
   24|   108k|{ \
   25|   108k|    ASN1_STRING_free(x); \
   26|   108k|}

ossl_asn1_get_choice_selector:
   30|   318k|{
   31|   318k|    int *sel = offset2ptr(*pval, it->utype);
  ------------------
  |  |   23|   318k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
   32|       |
   33|   318k|    return *sel;
   34|   318k|}
ossl_asn1_get_choice_selector_const:
   38|  55.3k|{
   39|  55.3k|    int *sel = offset2ptr(*pval, it->utype);
  ------------------
  |  |   23|  55.3k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
   40|       |
   41|  55.3k|    return *sel;
   42|  55.3k|}
ossl_asn1_set_choice_selector:
   50|   352k|{
   51|   352k|    int *sel, ret;
   52|       |
   53|   352k|    sel = offset2ptr(*pval, it->utype);
  ------------------
  |  |   23|   352k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
   54|   352k|    ret = *sel;
   55|   352k|    *sel = value;
   56|   352k|    return ret;
   57|   352k|}
ossl_asn1_do_lock:
   69|  5.82M|{
   70|  5.82M|    const ASN1_AUX *aux;
   71|  5.82M|    CRYPTO_RWLOCK **lock;
   72|  5.82M|    CRYPTO_REF_COUNT *refcnt;
   73|  5.82M|    int ret = -1;
   74|       |
   75|  5.82M|    if ((it->itype != ASN1_ITYPE_SEQUENCE)
  ------------------
  |  |   81|  5.82M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  |  Branch (75:9): [True: 284k, False: 5.54M]
  ------------------
   76|  5.82M|        && (it->itype != ASN1_ITYPE_NDEF_SEQUENCE))
  ------------------
  |  |   86|   284k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  |  Branch (76:12): [True: 0, False: 284k]
  ------------------
   77|      0|        return 0;
   78|  5.82M|    aux = it->funcs;
   79|  5.82M|    if (aux == NULL || (aux->flags & ASN1_AFLG_REFCOUNT) == 0)
  ------------------
  |  |  732|   847k|# define ASN1_AFLG_REFCOUNT      1
  ------------------
  |  Branch (79:9): [True: 4.98M, False: 847k]
  |  Branch (79:24): [True: 710k, False: 137k]
  ------------------
   80|  5.69M|        return 0;
   81|   137k|    lock = offset2ptr(*pval, aux->ref_lock);
  ------------------
  |  |   23|   137k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
   82|   137k|    refcnt = offset2ptr(*pval, aux->ref_offset);
  ------------------
  |  |   23|   137k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
   83|       |
   84|   137k|    switch (op) {
  ------------------
  |  Branch (84:13): [True: 0, False: 137k]
  ------------------
   85|  68.5k|    case 0:
  ------------------
  |  Branch (85:5): [True: 68.5k, False: 68.5k]
  ------------------
   86|  68.5k|        if (!CRYPTO_NEW_REF(refcnt, 1))
  ------------------
  |  Branch (86:13): [True: 0, False: 68.5k]
  ------------------
   87|      0|            return -1;
   88|  68.5k|        *lock = CRYPTO_THREAD_lock_new();
   89|  68.5k|        if (*lock == NULL) {
  ------------------
  |  Branch (89:13): [True: 0, False: 68.5k]
  ------------------
   90|      0|            CRYPTO_FREE_REF(refcnt);
   91|      0|            ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   92|      0|            return -1;
   93|      0|        }
   94|  68.5k|        ret = 1;
   95|  68.5k|        break;
   96|      0|    case 1:
  ------------------
  |  Branch (96:5): [True: 0, False: 137k]
  ------------------
   97|      0|        if (!CRYPTO_UP_REF(refcnt, &ret))
  ------------------
  |  Branch (97:13): [True: 0, False: 0]
  ------------------
   98|      0|            return -1;
   99|      0|        break;
  100|  68.5k|    case -1:
  ------------------
  |  Branch (100:5): [True: 68.5k, False: 68.5k]
  ------------------
  101|  68.5k|        if (!CRYPTO_DOWN_REF(refcnt, &ret))
  ------------------
  |  Branch (101:13): [True: 0, False: 68.5k]
  ------------------
  102|      0|            return -1;  /* failed */
  103|  68.5k|        REF_PRINT_EX(it->sname, ret, (void *)it);
  ------------------
  |  |  287|  68.5k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  ------------------
  |  |  |  |  294|  68.5k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|  68.5k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  104|  68.5k|        REF_ASSERT_ISNT(ret < 0);
  ------------------
  |  |  281|  68.5k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 68.5k]
  |  |  ------------------
  ------------------
  105|  68.5k|        if (ret == 0) {
  ------------------
  |  Branch (105:13): [True: 68.5k, False: 0]
  ------------------
  106|  68.5k|            CRYPTO_THREAD_lock_free(*lock);
  107|  68.5k|            *lock = NULL;
  108|  68.5k|            CRYPTO_FREE_REF(refcnt);
  109|  68.5k|        }
  110|  68.5k|        break;
  111|   137k|    }
  112|       |
  113|   137k|    return ret;
  114|   137k|}
ossl_asn1_enc_init:
  142|  2.84M|{
  143|  2.84M|    ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
  144|       |
  145|  2.84M|    if (enc != NULL) {
  ------------------
  |  Branch (145:9): [True: 96.2k, False: 2.74M]
  ------------------
  146|  96.2k|        enc->enc = NULL;
  147|  96.2k|        enc->len = 0;
  148|  96.2k|        enc->modified = 1;
  149|  96.2k|    }
  150|  2.84M|}
ossl_asn1_enc_free:
  153|  2.87M|{
  154|  2.87M|    ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
  155|       |
  156|  2.87M|    if (enc != NULL) {
  ------------------
  |  Branch (156:9): [True: 96.2k, False: 2.77M]
  ------------------
  157|  96.2k|        OPENSSL_free(enc->enc);
  ------------------
  |  |  107|  96.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  96.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  96.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  158|  96.2k|        enc->enc = NULL;
  159|  96.2k|        enc->len = 0;
  160|  96.2k|        enc->modified = 1;
  161|  96.2k|    }
  162|  2.87M|}
ossl_asn1_enc_save:
  166|   893k|{
  167|   893k|    ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
  168|       |
  169|   893k|    if (enc == NULL)
  ------------------
  |  Branch (169:9): [True: 853k, False: 39.6k]
  ------------------
  170|   853k|        return 1;
  171|       |
  172|  39.6k|    OPENSSL_free(enc->enc);
  ------------------
  |  |  107|  39.6k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  39.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  39.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  173|  39.6k|    if (inlen <= 0)
  ------------------
  |  Branch (173:9): [True: 0, False: 39.6k]
  ------------------
  174|      0|        return 0;
  175|  39.6k|    if ((enc->enc = OPENSSL_malloc(inlen)) == NULL)
  ------------------
  |  |   97|  39.6k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  39.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  39.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (175:9): [True: 0, False: 39.6k]
  ------------------
  176|      0|        return 0;
  177|  39.6k|    memcpy(enc->enc, in, inlen);
  178|  39.6k|    enc->len = inlen;
  179|  39.6k|    enc->modified = 0;
  180|       |
  181|  39.6k|    return 1;
  182|  39.6k|}
ossl_asn1_enc_restore:
  186|  1.92M|{
  187|  1.92M|    const ASN1_ENCODING *enc = asn1_get_const_enc_ptr(pval, it);
  188|       |
  189|  1.92M|    if (enc == NULL || enc->modified)
  ------------------
  |  Branch (189:9): [True: 1.90M, False: 23.2k]
  |  Branch (189:24): [True: 0, False: 23.2k]
  ------------------
  190|  1.90M|        return 0;
  191|  23.2k|    if (out) {
  ------------------
  |  Branch (191:9): [True: 7.69k, False: 15.5k]
  ------------------
  192|  7.69k|        memcpy(*out, enc->enc, enc->len);
  193|  7.69k|        *out += enc->len;
  194|  7.69k|    }
  195|  23.2k|    if (len != NULL)
  ------------------
  |  Branch (195:9): [True: 23.2k, False: 0]
  ------------------
  196|  23.2k|        *len = enc->len;
  197|  23.2k|    return 1;
  198|  1.92M|}
ossl_asn1_get_field_ptr:
  202|  21.0M|{
  203|  21.0M|    ASN1_VALUE **pvaltmp = offset2ptr(*pval, tt->offset);
  ------------------
  |  |   23|  21.0M|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
  204|       |
  205|       |    /*
  206|       |     * NOTE for BOOLEAN types the field is just a plain int so we can't
  207|       |     * return int **, so settle for (int *).
  208|       |     */
  209|  21.0M|    return pvaltmp;
  210|  21.0M|}
ossl_asn1_get_const_field_ptr:
  215|  5.57M|{
  216|  5.57M|    return offset2ptr(*pval, tt->offset);
  ------------------
  |  |   23|  5.57M|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
  217|  5.57M|}
ossl_asn1_do_adb:
  227|  17.9M|{
  228|  17.9M|    const ASN1_ADB *adb;
  229|  17.9M|    const ASN1_ADB_TABLE *atbl;
  230|  17.9M|    long selector;
  231|  17.9M|    const ASN1_VALUE **sfld;
  232|  17.9M|    int i;
  233|       |
  234|  17.9M|    if ((tt->flags & ASN1_TFLG_ADB_MASK) == 0)
  ------------------
  |  |  583|  17.9M|# define ASN1_TFLG_ADB_MASK      (0x3<<8)
  ------------------
  |  Branch (234:9): [True: 17.6M, False: 270k]
  ------------------
  235|  17.6M|        return tt;
  236|       |
  237|       |    /* Else ANY DEFINED BY ... get the table */
  238|   270k|    adb = ASN1_ADB_ptr(tt->item);
  ------------------
  |  |   89|   270k|# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
  ------------------
  239|       |
  240|       |    /* Get the selector field */
  241|   270k|    sfld = offset2ptr(val, adb->offset);
  ------------------
  |  |   23|   270k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
  242|       |
  243|       |    /* Check if NULL */
  244|   270k|    if (*sfld == NULL) {
  ------------------
  |  Branch (244:9): [True: 114k, False: 155k]
  ------------------
  245|   114k|        if (adb->null_tt == NULL)
  ------------------
  |  Branch (245:13): [True: 114k, False: 0]
  ------------------
  246|   114k|            goto err;
  247|      0|        return adb->null_tt;
  248|   114k|    }
  249|       |
  250|       |    /*
  251|       |     * Convert type to a long: NB: don't check for NID_undef here because it
  252|       |     * might be a legitimate value in the table
  253|       |     */
  254|   155k|    if ((tt->flags & ASN1_TFLG_ADB_OID) != 0)
  ------------------
  |  |  585|   155k|# define ASN1_TFLG_ADB_OID       (0x1<<8)
  ------------------
  |  Branch (254:9): [True: 155k, False: 0]
  ------------------
  255|   155k|        selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld);
  256|      0|    else
  257|      0|        selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld);
  258|       |
  259|       |    /* Let application callback translate value */
  260|   155k|    if (adb->adb_cb != NULL && adb->adb_cb(&selector) == 0) {
  ------------------
  |  Branch (260:9): [True: 0, False: 155k]
  |  Branch (260:32): [True: 0, False: 0]
  ------------------
  261|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  262|      0|        return NULL;
  263|      0|    }
  264|       |
  265|       |    /*
  266|       |     * Try to find matching entry in table Maybe should check application
  267|       |     * types first to allow application override? Might also be useful to
  268|       |     * have a flag which indicates table is sorted and we can do a binary
  269|       |     * search. For now stick to a linear search.
  270|       |     */
  271|       |
  272|   894k|    for (atbl = adb->tbl, i = 0; i < adb->tblcount; i++, atbl++)
  ------------------
  |  Branch (272:34): [True: 766k, False: 128k]
  ------------------
  273|   766k|        if (atbl->value == selector)
  ------------------
  |  Branch (273:13): [True: 27.3k, False: 738k]
  ------------------
  274|  27.3k|            return &atbl->tt;
  275|       |
  276|       |    /* FIXME: need to search application table too */
  277|       |
  278|       |    /* No match, return default type */
  279|   128k|    if (!adb->default_tt)
  ------------------
  |  Branch (279:9): [True: 0, False: 128k]
  ------------------
  280|      0|        goto err;
  281|   128k|    return adb->default_tt;
  282|       |
  283|   114k| err:
  284|       |    /* FIXME: should log the value or OID of unsupported type */
  285|   114k|    if (nullerr)
  ------------------
  |  Branch (285:9): [True: 0, False: 114k]
  ------------------
  286|   114k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  287|   114k|    return NULL;
  288|   128k|}
tasn_utl.c:asn1_get_enc_ptr:
  117|  6.61M|{
  118|  6.61M|    const ASN1_AUX *aux;
  119|       |
  120|  6.61M|    if (pval == NULL || *pval == NULL)
  ------------------
  |  Branch (120:9): [True: 0, False: 6.61M]
  |  Branch (120:25): [True: 0, False: 6.61M]
  ------------------
  121|      0|        return NULL;
  122|  6.61M|    aux = it->funcs;
  123|  6.61M|    if (aux == NULL || (aux->flags & ASN1_AFLG_ENCODING) == 0)
  ------------------
  |  |  734|   843k|# define ASN1_AFLG_ENCODING      2
  ------------------
  |  Branch (123:9): [True: 5.77M, False: 843k]
  |  Branch (123:24): [True: 611k, False: 232k]
  ------------------
  124|  6.38M|        return NULL;
  125|   232k|    return offset2ptr(*pval, aux->enc_offset);
  ------------------
  |  |   23|   232k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
  126|  6.61M|}
tasn_utl.c:asn1_get_const_enc_ptr:
  130|  1.92M|{
  131|  1.92M|    const ASN1_AUX *aux;
  132|       |
  133|  1.92M|    if (pval == NULL || *pval == NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 1.92M]
  |  Branch (133:25): [True: 0, False: 1.92M]
  ------------------
  134|      0|        return NULL;
  135|  1.92M|    aux = it->funcs;
  136|  1.92M|    if (aux == NULL || (aux->flags & ASN1_AFLG_ENCODING) == 0)
  ------------------
  |  |  734|  61.7k|# define ASN1_AFLG_ENCODING      2
  ------------------
  |  Branch (136:9): [True: 1.86M, False: 61.7k]
  |  Branch (136:24): [True: 38.4k, False: 23.2k]
  ------------------
  137|  1.90M|        return NULL;
  138|  23.2k|    return offset2ptr(*pval, aux->enc_offset);
  ------------------
  |  |   23|  23.2k|#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
  ------------------
  139|  1.92M|}

X509_ALGOR_set0:
   32|     39|{
   33|     39|    if (alg == NULL)
  ------------------
  |  Branch (33:9): [True: 0, False: 39]
  ------------------
   34|      0|        return 0;
   35|       |
   36|     39|    if (ptype != V_ASN1_UNDEF && alg->parameter == NULL
  ------------------
  |  |   60|     78|# define V_ASN1_UNDEF                    -1
  ------------------
  |  Branch (36:9): [True: 26, False: 13]
  |  Branch (36:34): [True: 26, False: 0]
  ------------------
   37|     39|            && (alg->parameter = ASN1_TYPE_new()) == NULL)
  ------------------
  |  Branch (37:16): [True: 0, False: 26]
  ------------------
   38|      0|        return 0;
   39|       |
   40|     39|    ASN1_OBJECT_free(alg->algorithm);
   41|     39|    alg->algorithm = aobj;
   42|       |
   43|     39|    if (ptype == V_ASN1_EOC)
  ------------------
  |  |   62|     39|# define V_ASN1_EOC                      0
  ------------------
  |  Branch (43:9): [True: 0, False: 39]
  ------------------
   44|      0|        return 1;
   45|     39|    if (ptype == V_ASN1_UNDEF) {
  ------------------
  |  |   60|     39|# define V_ASN1_UNDEF                    -1
  ------------------
  |  Branch (45:9): [True: 13, False: 26]
  ------------------
   46|     13|        ASN1_TYPE_free(alg->parameter);
   47|     13|        alg->parameter = NULL;
   48|     13|    } else
   49|     26|        ASN1_TYPE_set(alg->parameter, ptype, pval);
   50|     39|    return 1;
   51|     39|}
X509_ALGOR_get0:
   74|  76.0k|{
   75|  76.0k|    if (paobj)
  ------------------
  |  Branch (75:9): [True: 35.2k, False: 40.7k]
  ------------------
   76|  35.2k|        *paobj = algor->algorithm;
   77|  76.0k|    if (pptype) {
  ------------------
  |  Branch (77:9): [True: 44.9k, False: 31.0k]
  ------------------
   78|  44.9k|        if (algor->parameter == NULL) {
  ------------------
  |  Branch (78:13): [True: 1.83k, False: 43.1k]
  ------------------
   79|  1.83k|            *pptype = V_ASN1_UNDEF;
  ------------------
  |  |   60|  1.83k|# define V_ASN1_UNDEF                    -1
  ------------------
   80|  1.83k|            return;
   81|  1.83k|        } else
   82|  43.1k|            *pptype = algor->parameter->type;
   83|  43.1k|        if (ppval)
  ------------------
  |  Branch (83:13): [True: 43.1k, False: 6]
  ------------------
   84|  43.1k|            *ppval = algor->parameter->value.ptr;
   85|  43.1k|    }
   86|  76.0k|}
ossl_x509_algor_get_md:
  158|  6.94k|{
  159|  6.94k|    const EVP_MD *md;
  160|       |
  161|  6.94k|    if (alg == NULL)
  ------------------
  |  Branch (161:9): [True: 6.94k, False: 0]
  ------------------
  162|  6.94k|        return EVP_sha1();
  163|      0|    md = EVP_get_digestbyobj(alg->algorithm);
  ------------------
  |  |  529|      0|# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
  |  |  ------------------
  |  |  |  |  528|      0|# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
  |  |  ------------------
  ------------------
  164|      0|    if (md == NULL)
  ------------------
  |  Branch (164:9): [True: 0, False: 0]
  ------------------
  165|      0|        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNKNOWN_DIGEST);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  166|      0|    return md;
  167|  6.94k|}

BIGNUM_it:
   57|   285k|ASN1_ITEM_start(BIGNUM)
  ------------------
  |  |   95|   285k|        { \
  |  |   96|   285k|                static const ASN1_ITEM local_it = {
  ------------------
   58|   285k|        ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &bignum_pf, 0, "BIGNUM"
  ------------------
  |  |   80|   285k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                      ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &bignum_pf, 0, "BIGNUM"
  ------------------
  |  |   64|   285k|# define V_ASN1_INTEGER                  2
  ------------------
   59|   285k|ASN1_ITEM_end(BIGNUM)
  ------------------
  |  |  102|   285k|                }; \
  |  |  103|   285k|        return &local_it; \
  |  |  104|   285k|        }
  ------------------
CBIGNUM_it:
   61|   792k|ASN1_ITEM_start(CBIGNUM)
  ------------------
  |  |   95|   792k|        { \
  |  |   96|   792k|                static const ASN1_ITEM local_it = {
  ------------------
   62|   792k|        ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &cbignum_pf, BN_SENSITIVE, "CBIGNUM"
  ------------------
  |  |   80|   792k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                      ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &cbignum_pf, BN_SENSITIVE, "CBIGNUM"
  ------------------
  |  |   64|   792k|# define V_ASN1_INTEGER                  2
  ------------------
                      ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &cbignum_pf, BN_SENSITIVE, "CBIGNUM"
  ------------------
  |  |   22|   792k|#define BN_SENSITIVE    1
  ------------------
   63|   792k|ASN1_ITEM_end(CBIGNUM)
  ------------------
  |  |  102|   792k|                }; \
  |  |  103|   792k|        return &local_it; \
  |  |  104|   792k|        }
  ------------------
x_bignum.c:bn_new:
   66|  98.4k|{
   67|  98.4k|    *pval = (ASN1_VALUE *)BN_new();
   68|  98.4k|    if (*pval != NULL)
  ------------------
  |  Branch (68:9): [True: 98.4k, False: 0]
  ------------------
   69|  98.4k|        return 1;
   70|      0|    else
   71|      0|        return 0;
   72|  98.4k|}
x_bignum.c:bn_free:
   84|  69.2k|{
   85|  69.2k|    if (*pval == NULL)
  ------------------
  |  Branch (85:9): [True: 34.4k, False: 34.8k]
  ------------------
   86|  34.4k|        return;
   87|  34.8k|    if (it->size & BN_SENSITIVE)
  ------------------
  |  |   22|  34.8k|#define BN_SENSITIVE    1
  ------------------
  |  Branch (87:9): [True: 905, False: 33.9k]
  ------------------
   88|    905|        BN_clear_free((BIGNUM *)*pval);
   89|  33.9k|    else
   90|  33.9k|        BN_free((BIGNUM *)*pval);
   91|  34.8k|    *pval = NULL;
   92|  34.8k|}
x_bignum.c:bn_c2i:
  117|   181k|{
  118|   181k|    BIGNUM *bn;
  119|       |
  120|   181k|    if (*pval == NULL && !bn_new(pval, it))
  ------------------
  |  Branch (120:9): [True: 62.2k, False: 119k]
  |  Branch (120:26): [True: 0, False: 62.2k]
  ------------------
  121|      0|        return 0;
  122|   181k|    bn = (BIGNUM *)*pval;
  123|   181k|    if (!BN_bin2bn(cont, len, bn)) {
  ------------------
  |  Branch (123:9): [True: 0, False: 181k]
  ------------------
  124|      0|        bn_free(pval, it);
  125|      0|        return 0;
  126|      0|    }
  127|   181k|    return 1;
  128|   181k|}
x_bignum.c:bn_i2c:
   96|   596k|{
   97|   596k|    BIGNUM *bn;
   98|   596k|    int pad;
   99|   596k|    if (*pval == NULL)
  ------------------
  |  Branch (99:9): [True: 174, False: 596k]
  ------------------
  100|    174|        return -1;
  101|   596k|    bn = (BIGNUM *)*pval;
  102|       |    /* If MSB set in an octet we need a padding byte */
  103|   596k|    if (BN_num_bits(bn) & 0x7)
  ------------------
  |  Branch (103:9): [True: 385k, False: 210k]
  ------------------
  104|   385k|        pad = 0;
  105|   210k|    else
  106|   210k|        pad = 1;
  107|   596k|    if (cont) {
  ------------------
  |  Branch (107:9): [True: 103k, False: 493k]
  ------------------
  108|   103k|        if (pad)
  ------------------
  |  Branch (108:13): [True: 36.3k, False: 66.8k]
  ------------------
  109|  36.3k|            *cont++ = 0;
  110|   103k|        BN_bn2bin(bn, cont);
  111|   103k|    }
  112|   596k|    return pad + BN_num_bytes(bn);
  ------------------
  |  |  189|   596k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  113|   596k|}
x_bignum.c:bn_print:
  151|  50.4k|{
  152|  50.4k|    if (!BN_print(out, *(BIGNUM **)pval))
  ------------------
  |  Branch (152:9): [True: 0, False: 50.4k]
  ------------------
  153|      0|        return 0;
  154|  50.4k|    if (BIO_puts(out, "\n") <= 0)
  ------------------
  |  Branch (154:9): [True: 0, False: 50.4k]
  ------------------
  155|      0|        return 0;
  156|  50.4k|    return 1;
  157|  50.4k|}
x_bignum.c:bn_secure_new:
   75|   108k|{
   76|   108k|    *pval = (ASN1_VALUE *)BN_secure_new();
   77|   108k|    if (*pval != NULL)
  ------------------
  |  Branch (77:9): [True: 108k, False: 0]
  ------------------
   78|   108k|        return 1;
   79|      0|    else
   80|      0|        return 0;
   81|   108k|}
x_bignum.c:bn_secure_c2i:
  132|   107k|{
  133|   107k|    int ret;
  134|   107k|    BIGNUM *bn;
  135|       |
  136|   107k|    if (*pval == NULL && !bn_secure_new(pval, it))
  ------------------
  |  Branch (136:9): [True: 9.01k, False: 98.9k]
  |  Branch (136:26): [True: 0, False: 9.01k]
  ------------------
  137|      0|        return 0;
  138|       |
  139|   107k|    ret = bn_c2i(pval, cont, len, utype, free_cont, it);
  140|   107k|    if (!ret)
  ------------------
  |  Branch (140:9): [True: 0, False: 107k]
  ------------------
  141|      0|        return 0;
  142|       |
  143|       |    /* Set constant-time flag for all secure BIGNUMS */
  144|   107k|    bn = (BIGNUM *)*pval;
  145|   107k|    BN_set_flags(bn, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|   107k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  146|   107k|    return ret;
  147|   107k|}

INT32_it:
  250|   324k|ASN1_ITEM_start(INT32)
  ------------------
  |  |   95|   324k|        { \
  |  |   96|   324k|                static const ASN1_ITEM local_it = {
  ------------------
  251|   324k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf,
  ------------------
  |  |   80|   324k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf,
  ------------------
  |  |   64|   324k|# define V_ASN1_INTEGER                  2
  ------------------
  252|   324k|    INTxx_FLAG_SIGNED, "INT32"
  ------------------
  |  |   27|   324k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  253|   324k|ASN1_ITEM_end(INT32)
  ------------------
  |  |  102|   324k|                }; \
  |  |  103|   324k|        return &local_it; \
  |  |  104|   324k|        }
  ------------------
UINT32_it:
  255|  70.0k|ASN1_ITEM_start(UINT32)
  ------------------
  |  |   95|  70.0k|        { \
  |  |   96|  70.0k|                static const ASN1_ITEM local_it = {
  ------------------
  256|  70.0k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf, 0, "UINT32"
  ------------------
  |  |   80|  70.0k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf, 0, "UINT32"
  ------------------
  |  |   64|  70.0k|# define V_ASN1_INTEGER                  2
  ------------------
  257|  70.0k|ASN1_ITEM_end(UINT32)
  ------------------
  |  |  102|  70.0k|                }; \
  |  |  103|  70.0k|        return &local_it; \
  |  |  104|  70.0k|        }
  ------------------
INT64_it:
  259|  11.7k|ASN1_ITEM_start(INT64)
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  260|  11.7k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf,
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf,
  ------------------
  |  |   64|  11.7k|# define V_ASN1_INTEGER                  2
  ------------------
  261|  11.7k|    INTxx_FLAG_SIGNED, "INT64"
  ------------------
  |  |   27|  11.7k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  262|  11.7k|ASN1_ITEM_end(INT64)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
UINT64_it:
  264|  11.7k|ASN1_ITEM_start(UINT64)
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  265|  11.7k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf, 0, "UINT64"
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf, 0, "UINT64"
  ------------------
  |  |   64|  11.7k|# define V_ASN1_INTEGER                  2
  ------------------
  266|  11.7k|ASN1_ITEM_end(UINT64)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ZINT32_it:
  268|  43.7k|ASN1_ITEM_start(ZINT32)
  ------------------
  |  |   95|  43.7k|        { \
  |  |   96|  43.7k|                static const ASN1_ITEM local_it = {
  ------------------
  269|  43.7k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf,
  ------------------
  |  |   80|  43.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf,
  ------------------
  |  |   64|  43.7k|# define V_ASN1_INTEGER                  2
  ------------------
  270|  43.7k|    INTxx_FLAG_ZERO_DEFAULT|INTxx_FLAG_SIGNED, "ZINT32"
  ------------------
  |  |   26|  43.7k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
                  INTxx_FLAG_ZERO_DEFAULT|INTxx_FLAG_SIGNED, "ZINT32"
  ------------------
  |  |   27|  43.7k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  271|  43.7k|ASN1_ITEM_end(ZINT32)
  ------------------
  |  |  102|  43.7k|                }; \
  |  |  103|  43.7k|        return &local_it; \
  |  |  104|  43.7k|        }
  ------------------
ZUINT32_it:
  273|  99.3k|ASN1_ITEM_start(ZUINT32)
  ------------------
  |  |   95|  99.3k|        { \
  |  |   96|  99.3k|                static const ASN1_ITEM local_it = {
  ------------------
  274|  99.3k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf,
  ------------------
  |  |   80|  99.3k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint32_pf,
  ------------------
  |  |   64|  99.3k|# define V_ASN1_INTEGER                  2
  ------------------
  275|  99.3k|    INTxx_FLAG_ZERO_DEFAULT, "ZUINT32"
  ------------------
  |  |   26|  99.3k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
  276|  99.3k|ASN1_ITEM_end(ZUINT32)
  ------------------
  |  |  102|  99.3k|                }; \
  |  |  103|  99.3k|        return &local_it; \
  |  |  104|  99.3k|        }
  ------------------
ZINT64_it:
  278|  70.8k|ASN1_ITEM_start(ZINT64)
  ------------------
  |  |   95|  70.8k|        { \
  |  |   96|  70.8k|                static const ASN1_ITEM local_it = {
  ------------------
  279|  70.8k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf,
  ------------------
  |  |   80|  70.8k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf,
  ------------------
  |  |   64|  70.8k|# define V_ASN1_INTEGER                  2
  ------------------
  280|  70.8k|    INTxx_FLAG_ZERO_DEFAULT|INTxx_FLAG_SIGNED, "ZINT64"
  ------------------
  |  |   26|  70.8k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
                  INTxx_FLAG_ZERO_DEFAULT|INTxx_FLAG_SIGNED, "ZINT64"
  ------------------
  |  |   27|  70.8k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  281|  70.8k|ASN1_ITEM_end(ZINT64)
  ------------------
  |  |  102|  70.8k|                }; \
  |  |  103|  70.8k|        return &local_it; \
  |  |  104|  70.8k|        }
  ------------------
ZUINT64_it:
  283|  70.2k|ASN1_ITEM_start(ZUINT64)
  ------------------
  |  |   95|  70.2k|        { \
  |  |   96|  70.2k|                static const ASN1_ITEM local_it = {
  ------------------
  284|  70.2k|    ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf,
  ------------------
  |  |   80|  70.2k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                  ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &uint64_pf,
  ------------------
  |  |   64|  70.2k|# define V_ASN1_INTEGER                  2
  ------------------
  285|  70.2k|    INTxx_FLAG_ZERO_DEFAULT, "ZUINT64"
  ------------------
  |  |   26|  70.2k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
  286|  70.2k|ASN1_ITEM_end(ZUINT64)
  ------------------
  |  |  102|  70.2k|                }; \
  |  |  103|  70.2k|        return &local_it; \
  |  |  104|  70.2k|        }
  ------------------
x_int64.c:uint32_free:
  130|  46.8k|{
  131|  46.8k|    OPENSSL_free(*pval);
  ------------------
  |  |  107|  46.8k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  46.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  46.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  132|  46.8k|    *pval = NULL;
  133|  46.8k|}
x_int64.c:uint32_clear:
  136|   282k|{
  137|   282k|    **(uint32_t **)pval = 0;
  138|   282k|}
x_int64.c:uint32_c2i:
  173|  69.7k|{
  174|  69.7k|    uint64_t utmp = 0;
  175|  69.7k|    uint32_t utmp2 = 0;
  176|  69.7k|    char *cp;
  177|  69.7k|    int neg = 0;
  178|       |
  179|  69.7k|    if (*pval == NULL && !uint64_new(pval, it))
  ------------------
  |  Branch (179:9): [True: 2.15k, False: 67.5k]
  |  Branch (179:26): [True: 0, False: 2.15k]
  ------------------
  180|      0|        return 0;
  181|       |
  182|  69.7k|    cp = (char *)*pval;
  183|       |
  184|       |    /*
  185|       |     * Strictly speaking, zero length is malformed.  However, long_c2i
  186|       |     * (x_long.c) encodes 0 as a zero length INTEGER (wrongly, of course),
  187|       |     * so for the sake of backward compatibility, we still decode zero
  188|       |     * length INTEGERs as the number zero.
  189|       |     */
  190|  69.7k|    if (len == 0)
  ------------------
  |  Branch (190:9): [True: 8.38k, False: 61.3k]
  ------------------
  191|  8.38k|        goto long_compat;
  192|       |
  193|  61.3k|    if (!ossl_c2i_uint64_int(&utmp, &neg, &cont, len))
  ------------------
  |  Branch (193:9): [True: 2.33k, False: 58.9k]
  ------------------
  194|  2.33k|        return 0;
  195|  58.9k|    if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) {
  ------------------
  |  |   27|  58.9k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (195:9): [True: 4.14k, False: 54.8k]
  |  Branch (195:48): [True: 1.26k, False: 2.88k]
  ------------------
  196|  1.26k|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE);
  ------------------
  |  |  401|  1.26k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.26k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.26k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.26k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.26k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.26k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.26k|     ERR_set_error)
  |  |  ------------------
  ------------------
  197|  1.26k|        return 0;
  198|  1.26k|    }
  199|  57.7k|    if (neg) {
  ------------------
  |  Branch (199:9): [True: 14.6k, False: 43.0k]
  ------------------
  200|  14.6k|        if (utmp > ABS_INT32_MIN) {
  ------------------
  |  |  169|  14.6k|#define ABS_INT32_MIN ((uint32_t)INT32_MAX + 1)
  ------------------
  |  Branch (200:13): [True: 1.60k, False: 13.0k]
  ------------------
  201|  1.60k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
  ------------------
  |  |  401|  1.60k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.60k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.60k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.60k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.60k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.60k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.60k|     ERR_set_error)
  |  |  ------------------
  ------------------
  202|  1.60k|            return 0;
  203|  1.60k|        }
  204|  13.0k|        utmp = 0 - utmp;
  205|  43.0k|    } else {
  206|  43.0k|        if (((it->size & INTxx_FLAG_SIGNED) != 0 && utmp > INT32_MAX)
  ------------------
  |  |   27|  43.0k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (206:14): [True: 40.1k, False: 2.88k]
  |  Branch (206:53): [True: 2.04k, False: 38.1k]
  ------------------
  207|  43.0k|            || ((it->size & INTxx_FLAG_SIGNED) == 0 && utmp > UINT32_MAX)) {
  ------------------
  |  |   27|  41.0k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (207:17): [True: 2.88k, False: 38.1k]
  |  Branch (207:56): [True: 397, False: 2.48k]
  ------------------
  208|  2.44k|            ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LARGE);
  ------------------
  |  |  401|  2.44k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  2.44k|    (ERR_new(),                                                 \
  |  |  |  |  404|  2.44k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  2.44k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  2.44k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  2.44k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  2.44k|     ERR_set_error)
  |  |  ------------------
  ------------------
  209|  2.44k|            return 0;
  210|  2.44k|        }
  211|  43.0k|    }
  212|       |
  213|  62.0k| long_compat:
  214|  62.0k|    utmp2 = (uint32_t)utmp;
  215|  62.0k|    memcpy(cp, &utmp2, sizeof(utmp2));
  216|  62.0k|    return 1;
  217|  57.7k|}
x_int64.c:uint64_new:
   30|  4.31k|{
   31|  4.31k|    if ((*pval = (ASN1_VALUE *)OPENSSL_zalloc(sizeof(uint64_t))) == NULL)
  ------------------
  |  |   99|  4.31k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  4.31k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  4.31k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (31:9): [True: 0, False: 4.31k]
  ------------------
   32|      0|        return 0;
   33|  4.31k|    return 1;
   34|  4.31k|}
x_int64.c:uint32_i2c:
  142|  31.9k|{
  143|  31.9k|    uint32_t utmp;
  144|  31.9k|    int neg = 0;
  145|       |    /* this exists to bypass broken gcc optimization */
  146|  31.9k|    char *cp = (char *)*pval;
  147|       |
  148|       |    /* use memcpy, because we may not be uint32_t aligned */
  149|  31.9k|    memcpy(&utmp, cp, sizeof(utmp));
  150|       |
  151|  31.9k|    if ((it->size & INTxx_FLAG_ZERO_DEFAULT) == INTxx_FLAG_ZERO_DEFAULT
  ------------------
  |  |   26|  31.9k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
                  if ((it->size & INTxx_FLAG_ZERO_DEFAULT) == INTxx_FLAG_ZERO_DEFAULT
  ------------------
  |  |   26|  63.8k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
  |  Branch (151:9): [True: 5.56k, False: 26.3k]
  ------------------
  152|  31.9k|        && utmp == 0)
  ------------------
  |  Branch (152:12): [True: 4.62k, False: 940]
  ------------------
  153|  4.62k|        return -1;
  154|  27.3k|    if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
  ------------------
  |  |   27|  27.3k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
                  if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
  ------------------
  |  |   27|  54.6k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (154:9): [True: 23.4k, False: 3.87k]
  ------------------
  155|  27.3k|        && (int32_t)utmp < 0) {
  ------------------
  |  Branch (155:12): [True: 3.84k, False: 19.5k]
  ------------------
  156|       |        /* ossl_i2c_uint64_int() assumes positive values */
  157|  3.84k|        utmp = 0 - utmp;
  158|  3.84k|        neg = 1;
  159|  3.84k|    }
  160|       |
  161|  27.3k|    return ossl_i2c_uint64_int(cont, (uint64_t)utmp, neg);
  162|  31.9k|}
x_int64.c:uint32_print:
  221|  1.99k|{
  222|  1.99k|    if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED)
  ------------------
  |  |   27|  1.99k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
                  if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED)
  ------------------
  |  |   27|  1.99k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (222:9): [True: 1.79k, False: 206]
  ------------------
  223|  1.79k|        return BIO_printf(out, "%d\n", (int)**(int32_t **)pval);
  224|    206|    return BIO_printf(out, "%u\n", (unsigned int)**(uint32_t **)pval);
  225|  1.99k|}
x_int64.c:uint64_free:
   37|  46.8k|{
   38|  46.8k|    OPENSSL_free(*pval);
  ------------------
  |  |  107|  46.8k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  46.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  46.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   39|  46.8k|    *pval = NULL;
   40|  46.8k|}
x_int64.c:uint64_clear:
   43|  75.1k|{
   44|  75.1k|    **(uint64_t **)pval = 0;
   45|  75.1k|}
x_int64.c:uint64_c2i:
   73|  2.58k|{
   74|  2.58k|    uint64_t utmp = 0;
   75|  2.58k|    char *cp;
   76|  2.58k|    int neg = 0;
   77|       |
   78|  2.58k|    if (*pval == NULL && !uint64_new(pval, it))
  ------------------
  |  Branch (78:9): [True: 2.15k, False: 433]
  |  Branch (78:26): [True: 0, False: 2.15k]
  ------------------
   79|      0|        return 0;
   80|       |
   81|  2.58k|    cp = (char *)*pval;
   82|       |
   83|       |    /*
   84|       |     * Strictly speaking, zero length is malformed.  However, long_c2i
   85|       |     * (x_long.c) encodes 0 as a zero length INTEGER (wrongly, of course),
   86|       |     * so for the sake of backward compatibility, we still decode zero
   87|       |     * length INTEGERs as the number zero.
   88|       |     */
   89|  2.58k|    if (len == 0)
  ------------------
  |  Branch (89:9): [True: 5, False: 2.58k]
  ------------------
   90|      5|        goto long_compat;
   91|       |
   92|  2.58k|    if (!ossl_c2i_uint64_int(&utmp, &neg, &cont, len))
  ------------------
  |  Branch (92:9): [True: 473, False: 2.11k]
  ------------------
   93|    473|        return 0;
   94|  2.11k|    if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) {
  ------------------
  |  |   27|  2.11k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (94:9): [True: 937, False: 1.17k]
  |  Branch (94:48): [True: 355, False: 582]
  ------------------
   95|    355|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE);
  ------------------
  |  |  401|    355|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    355|    (ERR_new(),                                                 \
  |  |  |  |  404|    355|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    355|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    355|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    355|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    355|     ERR_set_error)
  |  |  ------------------
  ------------------
   96|    355|        return 0;
   97|    355|    }
   98|  1.75k|    if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
  ------------------
  |  |   27|  1.75k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
                  if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
  ------------------
  |  |   27|  3.51k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (98:9): [True: 1.17k, False: 582]
  ------------------
   99|  1.75k|            && !neg && utmp > INT64_MAX) {
  ------------------
  |  Branch (99:16): [True: 585, False: 589]
  |  Branch (99:24): [True: 125, False: 460]
  ------------------
  100|    125|        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LARGE);
  ------------------
  |  |  401|    125|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    125|    (ERR_new(),                                                 \
  |  |  |  |  404|    125|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    125|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    125|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    125|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    125|     ERR_set_error)
  |  |  ------------------
  ------------------
  101|    125|        return 0;
  102|    125|    }
  103|  1.63k|    if (neg)
  ------------------
  |  Branch (103:9): [True: 589, False: 1.04k]
  ------------------
  104|       |        /* ossl_c2i_uint64_int() returns positive values */
  105|    589|        utmp = 0 - utmp;
  106|       |
  107|  1.63k| long_compat:
  108|  1.63k|    memcpy(cp, &utmp, sizeof(utmp));
  109|  1.63k|    return 1;
  110|  1.63k|}
x_int64.c:uint64_i2c:
   49|  9.60k|{
   50|  9.60k|    uint64_t utmp;
   51|  9.60k|    int neg = 0;
   52|       |    /* this exists to bypass broken gcc optimization */
   53|  9.60k|    char *cp = (char *)*pval;
   54|       |
   55|       |    /* use memcpy, because we may not be uint64_t aligned */
   56|  9.60k|    memcpy(&utmp, cp, sizeof(utmp));
   57|       |
   58|  9.60k|    if ((it->size & INTxx_FLAG_ZERO_DEFAULT) == INTxx_FLAG_ZERO_DEFAULT
  ------------------
  |  |   26|  9.60k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
                  if ((it->size & INTxx_FLAG_ZERO_DEFAULT) == INTxx_FLAG_ZERO_DEFAULT
  ------------------
  |  |   26|  19.2k|#define INTxx_FLAG_ZERO_DEFAULT (1<<0)
  ------------------
  |  Branch (58:9): [True: 7.79k, False: 1.80k]
  ------------------
   59|  9.60k|        && utmp == 0)
  ------------------
  |  Branch (59:12): [True: 1.90k, False: 5.88k]
  ------------------
   60|  1.90k|        return -1;
   61|  7.69k|    if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
  ------------------
  |  |   27|  7.69k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
                  if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
  ------------------
  |  |   27|  15.3k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (61:9): [True: 5.76k, False: 1.92k]
  ------------------
   62|  7.69k|        && (int64_t)utmp < 0) {
  ------------------
  |  Branch (62:12): [True: 852, False: 4.91k]
  ------------------
   63|       |        /* ossl_i2c_uint64_int() assumes positive values */
   64|    852|        utmp = 0 - utmp;
   65|    852|        neg = 1;
   66|    852|    }
   67|       |
   68|  7.69k|    return ossl_i2c_uint64_int(cont, utmp, neg);
   69|  9.60k|}
x_int64.c:uint64_print:
  114|  1.20k|{
  115|  1.20k|    if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED)
  ------------------
  |  |   27|  1.20k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
                  if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED)
  ------------------
  |  |   27|  1.20k|#define INTxx_FLAG_SIGNED       (1<<1)
  ------------------
  |  Branch (115:9): [True: 718, False: 488]
  ------------------
  116|    718|        return BIO_printf(out, "%jd\n", **(int64_t **)pval);
  117|    488|    return BIO_printf(out, "%ju\n", **(uint64_t **)pval);
  118|  1.20k|}

LONG_it:
   41|  11.7k|ASN1_ITEM_start(LONG)
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
   42|  11.7k|        ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, ASN1_LONG_UNDEF, "LONG"
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                      ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, ASN1_LONG_UNDEF, "LONG"
  ------------------
  |  |   64|  11.7k|# define V_ASN1_INTEGER                  2
  ------------------
                      ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, ASN1_LONG_UNDEF, "LONG"
  ------------------
  |  |  211|  11.7k|# define ASN1_LONG_UNDEF 0x7fffffffL
  ------------------
   43|  11.7k|ASN1_ITEM_end(LONG)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ZLONG_it:
   45|  11.7k|ASN1_ITEM_start(ZLONG)
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
   46|  11.7k|        ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, 0, "ZLONG"
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
                      ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, 0, "ZLONG"
  ------------------
  |  |   64|  11.7k|# define V_ASN1_INTEGER                  2
  ------------------
   47|  11.7k|ASN1_ITEM_end(ZLONG)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
x_long.c:long_free:
   56|  23.4k|{
   57|  23.4k|    memcpy(pval, &it->size, COPY_SIZE(*pval, it->size));
  ------------------
  |  |   14|  23.4k|#define COPY_SIZE(a, b) (sizeof(a) < sizeof(b) ? sizeof(a) : sizeof(b))
  |  |  ------------------
  |  |  |  Branch (14:26): [Folded - Ignored]
  |  |  ------------------
  ------------------
   58|  23.4k|}
x_long.c:long_c2i:
  130|  1.07k|{
  131|  1.07k|    int i;
  132|  1.07k|    long ltmp;
  133|  1.07k|    unsigned long utmp = 0, sign = 0x100;
  134|       |
  135|  1.07k|    if (len > 1) {
  ------------------
  |  Branch (135:9): [True: 1.02k, False: 52]
  ------------------
  136|       |        /*
  137|       |         * Check possible pad byte.  Worst case, we're skipping past actual
  138|       |         * content, but since that's only with 0x00 and 0xff and we set neg
  139|       |         * accordingly, the result will be correct in the end anyway.
  140|       |         */
  141|  1.02k|        switch (cont[0]) {
  ------------------
  |  Branch (141:17): [True: 568, False: 458]
  ------------------
  142|    254|        case 0xff:
  ------------------
  |  Branch (142:9): [True: 254, False: 772]
  ------------------
  143|    254|            cont++;
  144|    254|            len--;
  145|    254|            sign = 0xff;
  146|    254|            break;
  147|    204|        case 0:
  ------------------
  |  Branch (147:9): [True: 204, False: 822]
  ------------------
  148|    204|            cont++;
  149|    204|            len--;
  150|    204|            sign = 0;
  151|    204|            break;
  152|  1.02k|        }
  153|  1.02k|    }
  154|  1.07k|    if (len > (int)sizeof(long)) {
  ------------------
  |  Branch (154:9): [True: 84, False: 994]
  ------------------
  155|     84|        ERR_raise(ERR_LIB_ASN1, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
  ------------------
  |  |  401|     84|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     84|    (ERR_new(),                                                 \
  |  |  |  |  404|     84|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     84|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     84|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     84|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     84|     ERR_set_error)
  |  |  ------------------
  ------------------
  156|     84|        return 0;
  157|     84|    }
  158|       |
  159|    994|    if (sign == 0x100) {
  ------------------
  |  Branch (159:9): [True: 550, False: 444]
  ------------------
  160|       |        /* Is it negative? */
  161|    550|        if (len && (cont[0] & 0x80))
  ------------------
  |  Branch (161:13): [True: 548, False: 2]
  |  Branch (161:20): [True: 258, False: 290]
  ------------------
  162|    258|            sign = 0xff;
  163|    292|        else
  164|    292|            sign = 0;
  165|    550|    } else if (((sign ^ cont[0]) & 0x80) == 0) { /* same sign bit? */
  ------------------
  |  Branch (165:16): [True: 152, False: 292]
  ------------------
  166|    152|        ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_PADDING);
  ------------------
  |  |  401|    152|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    152|    (ERR_new(),                                                 \
  |  |  |  |  404|    152|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    152|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    152|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    152|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    152|     ERR_set_error)
  |  |  ------------------
  ------------------
  167|    152|        return 0;
  168|    152|    }
  169|    842|    utmp = 0;
  170|  5.33k|    for (i = 0; i < len; i++) {
  ------------------
  |  Branch (170:17): [True: 4.49k, False: 842]
  ------------------
  171|  4.49k|        utmp <<= 8;
  172|  4.49k|        utmp |= cont[i] ^ sign;
  173|  4.49k|    }
  174|    842|    ltmp = (long)utmp;
  175|    842|    if (ltmp < 0) {
  ------------------
  |  Branch (175:9): [True: 194, False: 648]
  ------------------
  176|    194|        ERR_raise(ERR_LIB_ASN1, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
  ------------------
  |  |  401|    194|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    194|    (ERR_new(),                                                 \
  |  |  |  |  404|    194|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    194|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    194|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    194|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    194|     ERR_set_error)
  |  |  ------------------
  ------------------
  177|    194|        return 0;
  178|    194|    }
  179|    648|    if (sign)
  ------------------
  |  Branch (179:9): [True: 284, False: 364]
  ------------------
  180|    284|        ltmp = -ltmp - 1;
  181|    648|    if (ltmp == it->size) {
  ------------------
  |  Branch (181:9): [True: 3, False: 645]
  ------------------
  182|      3|        ERR_raise(ERR_LIB_ASN1, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
  ------------------
  |  |  401|      3|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      3|    (ERR_new(),                                                 \
  |  |  |  |  404|      3|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      3|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      3|     ERR_set_error)
  |  |  ------------------
  ------------------
  183|      3|        return 0;
  184|      3|    }
  185|    645|    memcpy(pval, &ltmp, COPY_SIZE(*pval, ltmp));
  ------------------
  |  |   14|    645|#define COPY_SIZE(a, b) (sizeof(a) < sizeof(b) ? sizeof(a) : sizeof(b))
  |  |  ------------------
  |  |  |  Branch (14:26): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|    645|    return 1;
  187|    648|}
x_long.c:long_i2c:
   87|  1.92k|{
   88|  1.92k|    long ltmp;
   89|  1.92k|    unsigned long utmp, sign;
   90|  1.92k|    int clen, pad, i;
   91|       |
   92|  1.92k|    memcpy(&ltmp, pval, COPY_SIZE(*pval, ltmp));
  ------------------
  |  |   14|  1.92k|#define COPY_SIZE(a, b) (sizeof(a) < sizeof(b) ? sizeof(a) : sizeof(b))
  |  |  ------------------
  |  |  |  Branch (14:26): [Folded - Ignored]
  |  |  ------------------
  ------------------
   93|  1.92k|    if (ltmp == it->size)
  ------------------
  |  Branch (93:9): [True: 0, False: 1.92k]
  ------------------
   94|      0|        return -1;
   95|       |    /*
   96|       |     * Convert the long to positive: we subtract one if negative so we can
   97|       |     * cleanly handle the padding if only the MSB of the leading octet is
   98|       |     * set.
   99|       |     */
  100|  1.92k|    if (ltmp < 0) {
  ------------------
  |  Branch (100:9): [True: 852, False: 1.07k]
  ------------------
  101|    852|        sign = 0xff;
  102|    852|        utmp = 0 - (unsigned long)ltmp - 1;
  103|  1.07k|    } else {
  104|  1.07k|        sign = 0;
  105|  1.07k|        utmp = ltmp;
  106|  1.07k|    }
  107|  1.92k|    clen = num_bits_ulong(utmp);
  108|       |    /* If MSB of leading octet set we need to pad */
  109|  1.92k|    if (!(clen & 0x7))
  ------------------
  |  Branch (109:9): [True: 300, False: 1.62k]
  ------------------
  110|    300|        pad = 1;
  111|  1.62k|    else
  112|  1.62k|        pad = 0;
  113|       |
  114|       |    /* Convert number of bits to number of octets */
  115|  1.92k|    clen = (clen + 7) >> 3;
  116|       |
  117|  1.92k|    if (cont != NULL) {
  ------------------
  |  Branch (117:9): [True: 643, False: 1.28k]
  ------------------
  118|    643|        if (pad)
  ------------------
  |  Branch (118:13): [True: 100, False: 543]
  ------------------
  119|    100|            *cont++ = (unsigned char)sign;
  120|  3.57k|        for (i = clen - 1; i >= 0; i--) {
  ------------------
  |  Branch (120:28): [True: 2.93k, False: 643]
  ------------------
  121|  2.93k|            cont[i] = (unsigned char)(utmp ^ sign);
  122|  2.93k|            utmp >>= 8;
  123|  2.93k|        }
  124|    643|    }
  125|  1.92k|    return clen + pad;
  126|  1.92k|}
x_long.c:num_bits_ulong:
   67|  1.92k|{
   68|  1.92k|    size_t i;
   69|  1.92k|    unsigned long ret = 0;
   70|       |
   71|       |    /*
   72|       |     * It is argued that *on average* constant counter loop performs
   73|       |     * not worse [if not better] than one with conditional break or
   74|       |     * mask-n-table-lookup-style, because of branch misprediction
   75|       |     * penalties.
   76|       |     */
   77|   125k|    for (i = 0; i < sizeof(value) * 8; i++) {
  ------------------
  |  Branch (77:17): [True: 123k, False: 1.92k]
  ------------------
   78|   123k|        ret += (value != 0);
   79|   123k|        value >>= 1;
   80|   123k|    }
   81|       |
   82|  1.92k|    return (int)ret;
   83|  1.92k|}
x_long.c:long_print:
  191|    643|{
  192|    643|    long l;
  193|       |
  194|    643|    memcpy(&l, pval, COPY_SIZE(*pval, l));
  ------------------
  |  |   14|    643|#define COPY_SIZE(a, b) (sizeof(a) < sizeof(b) ? sizeof(a) : sizeof(b))
  |  |  ------------------
  |  |  |  Branch (14:26): [Folded - Ignored]
  |  |  ------------------
  ------------------
  195|    643|    return BIO_printf(out, "%ld\n", l);
  196|    643|}

ossl_encode_der_length:
   40|  32.9k|{
   41|  32.9k|    if (cont_len > 0xffff)
  ------------------
  |  Branch (41:9): [True: 0, False: 32.9k]
  ------------------
   42|      0|        return 0; /* Too large for supported length encodings */
   43|       |
   44|  32.9k|    if (cont_len > 0xff) {
  ------------------
  |  Branch (44:9): [True: 19, False: 32.9k]
  ------------------
   45|     19|        if (!WPACKET_put_bytes_u8(pkt, 0x82)
  ------------------
  |  |  878|     38|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  |  Branch (45:13): [True: 0, False: 19]
  ------------------
   46|     19|                || !WPACKET_put_bytes_u16(pkt, cont_len))
  ------------------
  |  |  880|     19|    WPACKET_put_bytes__((pkt), (val), 2)
  ------------------
  |  Branch (46:20): [True: 0, False: 19]
  ------------------
   47|      0|            return 0;
   48|  32.9k|    } else {
   49|  32.9k|        if (cont_len > 0x7f
  ------------------
  |  Branch (49:13): [True: 836, False: 32.0k]
  ------------------
   50|  32.9k|                && !WPACKET_put_bytes_u8(pkt, 0x81))
  ------------------
  |  |  878|    836|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  |  Branch (50:20): [True: 0, False: 836]
  ------------------
   51|      0|            return 0;
   52|  32.9k|        if (!WPACKET_put_bytes_u8(pkt, cont_len))
  ------------------
  |  |  878|  32.9k|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  |  Branch (52:13): [True: 0, False: 32.9k]
  ------------------
   53|      0|            return 0;
   54|  32.9k|    }
   55|       |
   56|  32.9k|    return 1;
   57|  32.9k|}
ossl_encode_der_integer:
   67|  21.9k|{
   68|  21.9k|    unsigned char *bnbytes;
   69|  21.9k|    size_t cont_len;
   70|       |
   71|  21.9k|    if (BN_is_negative(n))
  ------------------
  |  Branch (71:9): [True: 0, False: 21.9k]
  ------------------
   72|      0|        return 0;
   73|       |
   74|       |    /*
   75|       |     * Calculate the ASN.1 INTEGER DER content length for n.
   76|       |     * This is the number of whole bytes required to represent n (i.e. rounded
   77|       |     * down), plus one.
   78|       |     * If n is zero then the content is a single zero byte (length = 1).
   79|       |     * If the number of bits of n is a multiple of 8 then an extra zero padding
   80|       |     * byte is included to ensure that the value is still treated as positive
   81|       |     * in the INTEGER two's complement representation.
   82|       |     */
   83|  21.9k|    cont_len = BN_num_bits(n) / 8 + 1;
   84|       |
   85|  21.9k|    if (!WPACKET_start_sub_packet(pkt)
  ------------------
  |  Branch (85:9): [True: 0, False: 21.9k]
  ------------------
   86|  21.9k|            || !WPACKET_put_bytes_u8(pkt, ID_INTEGER)
  ------------------
  |  |  878|  43.9k|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  |  Branch (86:16): [True: 0, False: 21.9k]
  ------------------
   87|  21.9k|            || !ossl_encode_der_length(pkt, cont_len)
  ------------------
  |  Branch (87:16): [True: 0, False: 21.9k]
  ------------------
   88|  21.9k|            || !WPACKET_allocate_bytes(pkt, cont_len, &bnbytes)
  ------------------
  |  Branch (88:16): [True: 0, False: 21.9k]
  ------------------
   89|  21.9k|            || !WPACKET_close(pkt))
  ------------------
  |  Branch (89:16): [True: 0, False: 21.9k]
  ------------------
   90|      0|        return 0;
   91|       |
   92|  21.9k|    if (bnbytes != NULL
  ------------------
  |  Branch (92:9): [True: 64, False: 21.9k]
  ------------------
   93|  21.9k|            && BN_bn2binpad(n, bnbytes, (int)cont_len) != (int)cont_len)
  ------------------
  |  Branch (93:16): [True: 0, False: 64]
  ------------------
   94|      0|        return 0;
   95|       |
   96|  21.9k|    return 1;
   97|  21.9k|}
ossl_encode_der_dsa_sig:
  107|  10.9k|{
  108|  10.9k|    WPACKET tmppkt, *dummypkt;
  109|  10.9k|    size_t cont_len;
  110|  10.9k|    int isnull = WPACKET_is_null_buf(pkt);
  111|       |
  112|  10.9k|    if (!WPACKET_start_sub_packet(pkt))
  ------------------
  |  Branch (112:9): [True: 0, False: 10.9k]
  ------------------
  113|      0|        return 0;
  114|       |
  115|  10.9k|    if (!isnull) {
  ------------------
  |  Branch (115:9): [True: 32, False: 10.9k]
  ------------------
  116|     32|        if (!WPACKET_init_null(&tmppkt, 0))
  ------------------
  |  Branch (116:13): [True: 0, False: 32]
  ------------------
  117|      0|            return 0;
  118|     32|        dummypkt = &tmppkt;
  119|  10.9k|    } else {
  120|       |        /* If the input packet has a NULL buffer, we don't need a dummy packet */
  121|  10.9k|        dummypkt = pkt;
  122|  10.9k|    }
  123|       |
  124|       |    /* Calculate the content length */
  125|  10.9k|    if (!ossl_encode_der_integer(dummypkt, r)
  ------------------
  |  Branch (125:9): [True: 0, False: 10.9k]
  ------------------
  126|  10.9k|            || !ossl_encode_der_integer(dummypkt, s)
  ------------------
  |  Branch (126:16): [True: 0, False: 10.9k]
  ------------------
  127|  10.9k|            || !WPACKET_get_length(dummypkt, &cont_len)
  ------------------
  |  Branch (127:16): [True: 0, False: 10.9k]
  ------------------
  128|  10.9k|            || (!isnull && !WPACKET_finish(dummypkt))) {
  ------------------
  |  Branch (128:17): [True: 32, False: 10.9k]
  |  Branch (128:28): [True: 0, False: 32]
  ------------------
  129|      0|        if (!isnull)
  ------------------
  |  Branch (129:13): [True: 0, False: 0]
  ------------------
  130|      0|            WPACKET_cleanup(dummypkt);
  131|      0|        return 0;
  132|      0|    }
  133|       |
  134|       |    /* Add the tag and length bytes */
  135|  10.9k|    if (!WPACKET_put_bytes_u8(pkt, ID_SEQUENCE)
  ------------------
  |  |  878|  21.9k|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  |  Branch (135:9): [True: 0, False: 10.9k]
  ------------------
  136|  10.9k|            || !ossl_encode_der_length(pkt, cont_len)
  ------------------
  |  Branch (136:16): [True: 0, False: 10.9k]
  ------------------
  137|       |               /*
  138|       |                * Really encode the integers. We already wrote to the main pkt
  139|       |                * if it had a NULL buffer, so don't do it again
  140|       |                */
  141|  10.9k|            || (!isnull && !ossl_encode_der_integer(pkt, r))
  ------------------
  |  Branch (141:17): [True: 32, False: 10.9k]
  |  Branch (141:28): [True: 0, False: 32]
  ------------------
  142|  10.9k|            || (!isnull && !ossl_encode_der_integer(pkt, s))
  ------------------
  |  Branch (142:17): [True: 32, False: 10.9k]
  |  Branch (142:28): [True: 0, False: 32]
  ------------------
  143|  10.9k|            || !WPACKET_close(pkt))
  ------------------
  |  Branch (143:16): [True: 0, False: 10.9k]
  ------------------
  144|      0|        return 0;
  145|       |
  146|  10.9k|    return 1;
  147|  10.9k|}
ossl_decode_der_length:
  156|  22.4k|{
  157|  22.4k|    unsigned int byte;
  158|       |
  159|  22.4k|    if (!PACKET_get_1(pkt, &byte))
  ------------------
  |  Branch (159:9): [True: 8, False: 22.4k]
  ------------------
  160|      8|        return 0;
  161|       |
  162|  22.4k|    if (byte < 0x80)
  ------------------
  |  Branch (162:9): [True: 8.06k, False: 14.4k]
  ------------------
  163|  8.06k|        return PACKET_get_sub_packet(pkt, subpkt, (size_t)byte);
  164|  14.4k|    if (byte == 0x81)
  ------------------
  |  Branch (164:9): [True: 152, False: 14.2k]
  ------------------
  165|    152|        return PACKET_get_length_prefixed_1(pkt, subpkt);
  166|  14.2k|    if (byte == 0x82)
  ------------------
  |  Branch (166:9): [True: 954, False: 13.3k]
  ------------------
  167|    954|        return PACKET_get_length_prefixed_2(pkt, subpkt);
  168|       |
  169|       |    /* Too large, invalid, or not DER. */
  170|  13.3k|    return 0;
  171|  14.2k|}
ossl_decode_der_integer:
  188|  6.92k|{
  189|  6.92k|    PACKET contpkt, tmppkt;
  190|  6.92k|    unsigned int tag, tmp;
  191|       |
  192|       |    /* Check we have an integer and get the content bytes */
  193|  6.92k|    if (!PACKET_get_1(pkt, &tag)
  ------------------
  |  Branch (193:9): [True: 296, False: 6.62k]
  ------------------
  194|  6.92k|            || tag != ID_INTEGER
  ------------------
  |  |   30|  13.5k|#define ID_INTEGER 0x02
  ------------------
  |  Branch (194:16): [True: 2.76k, False: 3.86k]
  ------------------
  195|  6.92k|            || !ossl_decode_der_length(pkt, &contpkt))
  ------------------
  |  Branch (195:16): [True: 60, False: 3.80k]
  ------------------
  196|  3.11k|        return 0;
  197|       |
  198|       |    /* Peek ahead at the first bytes to check for proper encoding */
  199|  3.80k|    tmppkt = contpkt;
  200|       |    /* The INTEGER must be positive */
  201|  3.80k|    if (!PACKET_get_1(&tmppkt, &tmp)
  ------------------
  |  Branch (201:9): [True: 574, False: 3.23k]
  ------------------
  202|  3.80k|            || (tmp & 0x80) != 0)
  ------------------
  |  Branch (202:16): [True: 958, False: 2.27k]
  ------------------
  203|  1.53k|        return 0;
  204|       |    /* If there a zero padding byte the next byte must have the msb set */
  205|  2.27k|    if (PACKET_remaining(&tmppkt) > 0 && tmp == 0) {
  ------------------
  |  Branch (205:9): [True: 866, False: 1.40k]
  |  Branch (205:42): [True: 246, False: 620]
  ------------------
  206|    246|        if (!PACKET_get_1(&tmppkt, &tmp)
  ------------------
  |  Branch (206:13): [True: 0, False: 246]
  ------------------
  207|    246|                || (tmp & 0x80) == 0)
  ------------------
  |  Branch (207:20): [True: 20, False: 226]
  ------------------
  208|     20|            return 0;
  209|    246|    }
  210|       |
  211|  2.25k|    if (BN_bin2bn(PACKET_data(&contpkt),
  ------------------
  |  Branch (211:9): [True: 0, False: 2.25k]
  ------------------
  212|  2.25k|                  (int)PACKET_remaining(&contpkt), n) == NULL)
  213|      0|        return 0;
  214|       |
  215|  2.25k|    return 1;
  216|  2.25k|}
ossl_decode_der_dsa_sig:
  235|  23.4k|{
  236|  23.4k|    size_t consumed;
  237|  23.4k|    PACKET pkt, contpkt;
  238|  23.4k|    unsigned int tag;
  239|       |
  240|  23.4k|    if (!PACKET_buf_init(&pkt, *ppin, len)
  ------------------
  |  Branch (240:9): [True: 0, False: 23.4k]
  ------------------
  241|  23.4k|            || !PACKET_get_1(&pkt, &tag)
  ------------------
  |  Branch (241:16): [True: 0, False: 23.4k]
  ------------------
  242|  23.4k|            || tag != ID_SEQUENCE
  ------------------
  |  |   29|  46.8k|#define ID_SEQUENCE 0x30
  ------------------
  |  Branch (242:16): [True: 4.82k, False: 18.6k]
  ------------------
  243|  23.4k|            || !ossl_decode_der_length(&pkt, &contpkt)
  ------------------
  |  Branch (243:16): [True: 13.3k, False: 5.22k]
  ------------------
  244|  23.4k|            || !ossl_decode_der_integer(&contpkt, r)
  ------------------
  |  Branch (244:16): [True: 3.51k, False: 1.70k]
  ------------------
  245|  23.4k|            || !ossl_decode_der_integer(&contpkt, s)
  ------------------
  |  Branch (245:16): [True: 1.15k, False: 550]
  ------------------
  246|  23.4k|            || PACKET_remaining(&contpkt) != 0)
  ------------------
  |  Branch (246:16): [True: 518, False: 32]
  ------------------
  247|  23.4k|        return 0;
  248|       |
  249|     32|    consumed = PACKET_data(&pkt) - *ppin;
  250|     32|    *ppin += consumed;
  251|     32|    return consumed;
  252|  23.4k|}

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

BIO_f_prefix:
   41|  8.43M|{
   42|  8.43M|    return &prefix_meth;
   43|  8.43M|}
bf_prefix.c:prefix_write:
   83|  8.43M|{
   84|  8.43M|    PREFIX_CTX *ctx = BIO_get_data(b);
   85|       |
   86|  8.43M|    if (ctx == NULL)
  ------------------
  |  Branch (86:9): [True: 0, False: 8.43M]
  ------------------
   87|      0|        return 0;
   88|       |
   89|       |    /*
   90|       |     * If no prefix is set or if it's empty, and no indentation amount is set,
   91|       |     * we've got nothing to do here
   92|       |     */
   93|  8.43M|    if ((ctx->prefix == NULL || *ctx->prefix == '\0')
  ------------------
  |  Branch (93:10): [True: 0, False: 8.43M]
  |  Branch (93:33): [True: 0, False: 8.43M]
  ------------------
   94|  8.43M|        && ctx->indent == 0) {
  ------------------
  |  Branch (94:12): [True: 0, False: 0]
  ------------------
   95|       |        /*
   96|       |         * We do note if what comes next will be a new line, though, so we're
   97|       |         * prepared to handle prefix and indentation the next time around.
   98|       |         */
   99|      0|        if (outl > 0)
  ------------------
  |  Branch (99:13): [True: 0, False: 0]
  ------------------
  100|      0|            ctx->linestart = (out[outl-1] == '\n');
  101|      0|        return BIO_write_ex(BIO_next(b), out, outl, numwritten);
  102|      0|    }
  103|       |
  104|  8.43M|    *numwritten = 0;
  105|       |
  106|  16.8M|    while (outl > 0) {
  ------------------
  |  Branch (106:12): [True: 8.43M, False: 8.43M]
  ------------------
  107|  8.43M|        size_t i;
  108|  8.43M|        char c;
  109|       |
  110|       |        /*
  111|       |         * If we know that we're at the start of the line, output prefix and
  112|       |         * indentation.
  113|       |         */
  114|  8.43M|        if (ctx->linestart) {
  ------------------
  |  Branch (114:13): [True: 8.43M, False: 0]
  ------------------
  115|  8.43M|            size_t dontcare;
  116|       |
  117|  8.43M|            if (ctx->prefix != NULL
  ------------------
  |  Branch (117:17): [True: 8.43M, False: 0]
  ------------------
  118|  8.43M|                && !BIO_write_ex(BIO_next(b), ctx->prefix, strlen(ctx->prefix),
  ------------------
  |  Branch (118:20): [True: 0, False: 8.43M]
  ------------------
  119|  8.43M|                                 &dontcare))
  120|      0|                return 0;
  121|  8.43M|            BIO_printf(BIO_next(b), "%*s", ctx->indent, "");
  122|  8.43M|            ctx->linestart = 0;
  123|  8.43M|        }
  124|       |
  125|       |        /* Now, go look for the next LF, or the end of the string */
  126|   160M|        for (i = 0, c = '\0'; i < outl && (c = out[i]) != '\n'; i++)
  ------------------
  |  Branch (126:31): [True: 151M, False: 8.43M]
  |  Branch (126:43): [True: 151M, False: 0]
  ------------------
  127|   151M|            continue;
  128|  8.43M|        if (c == '\n')
  ------------------
  |  Branch (128:13): [True: 0, False: 8.43M]
  ------------------
  129|      0|            i++;
  130|       |
  131|       |        /* Output what we found so far */
  132|  16.8M|        while (i > 0) {
  ------------------
  |  Branch (132:16): [True: 8.43M, False: 8.43M]
  ------------------
  133|  8.43M|            size_t num = 0;
  134|       |
  135|  8.43M|            if (!BIO_write_ex(BIO_next(b), out, i, &num))
  ------------------
  |  Branch (135:17): [True: 0, False: 8.43M]
  ------------------
  136|      0|                return 0;
  137|  8.43M|            out += num;
  138|  8.43M|            outl -= num;
  139|  8.43M|            *numwritten += num;
  140|  8.43M|            i -= num;
  141|  8.43M|        }
  142|       |
  143|       |        /* If we found a LF, what follows is a new line, so take note */
  144|  8.43M|        if (c == '\n')
  ------------------
  |  Branch (144:13): [True: 0, False: 8.43M]
  ------------------
  145|      0|            ctx->linestart = 1;
  146|  8.43M|    }
  147|       |
  148|  8.43M|    return 1;
  149|  8.43M|}
bf_prefix.c:prefix_ctrl:
  152|  50.5M|{
  153|  50.5M|    long ret = 0;
  154|  50.5M|    PREFIX_CTX *ctx;
  155|       |
  156|  50.5M|    if (b == NULL || (ctx = BIO_get_data(b)) == NULL)
  ------------------
  |  Branch (156:9): [True: 0, False: 50.5M]
  |  Branch (156:22): [True: 0, False: 50.5M]
  ------------------
  157|      0|        return -1;
  158|       |
  159|  50.5M|    switch (cmd) {
  160|  8.43M|    case BIO_CTRL_SET_PREFIX:
  ------------------
  |  |  172|  8.43M|# define BIO_CTRL_SET_PREFIX                    79
  ------------------
  |  Branch (160:5): [True: 8.43M, False: 42.1M]
  ------------------
  161|  8.43M|        OPENSSL_free(ctx->prefix);
  ------------------
  |  |  107|  8.43M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.43M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.43M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  162|  8.43M|        if (ptr == NULL) {
  ------------------
  |  Branch (162:13): [True: 0, False: 8.43M]
  ------------------
  163|      0|            ctx->prefix = NULL;
  164|      0|            ret = 1;
  165|  8.43M|        } else {
  166|  8.43M|            ctx->prefix = OPENSSL_strdup((const char *)ptr);
  ------------------
  |  |  111|  8.43M|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.43M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.43M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  167|  8.43M|            ret = ctx->prefix != NULL;
  168|  8.43M|        }
  169|  8.43M|        break;
  170|  16.8M|    case BIO_CTRL_SET_INDENT:
  ------------------
  |  |  173|  16.8M|# define BIO_CTRL_SET_INDENT                    80
  ------------------
  |  Branch (170:5): [True: 16.8M, False: 33.7M]
  ------------------
  171|  16.8M|        if (num >= 0) {
  ------------------
  |  Branch (171:13): [True: 16.8M, False: 0]
  ------------------
  172|  16.8M|            ctx->indent = (unsigned int)num;
  173|  16.8M|            ret = 1;
  174|  16.8M|        }
  175|  16.8M|        break;
  176|  8.43M|    case BIO_CTRL_GET_INDENT:
  ------------------
  |  |  174|  8.43M|# define BIO_CTRL_GET_INDENT                    81
  ------------------
  |  Branch (176:5): [True: 8.43M, False: 42.1M]
  ------------------
  177|  8.43M|        ret = (long)ctx->indent;
  178|  8.43M|        break;
  179|  16.8M|    default:
  ------------------
  |  Branch (179:5): [True: 16.8M, False: 33.7M]
  ------------------
  180|       |        /* Commands that we intercept before passing them along */
  181|  16.8M|        switch (cmd) {
  ------------------
  |  Branch (181:17): [True: 16.8M, False: 0]
  ------------------
  182|      0|        case BIO_C_FILE_SEEK:
  ------------------
  |  |  453|      0|# define BIO_C_FILE_SEEK                         128
  ------------------
  |  Branch (182:9): [True: 0, False: 16.8M]
  ------------------
  183|      0|        case BIO_CTRL_RESET:
  ------------------
  |  |   85|      0|# define BIO_CTRL_RESET          1/* opt - rewind/zero etc */
  ------------------
  |  Branch (183:9): [True: 0, False: 16.8M]
  ------------------
  184|      0|            ctx->linestart = 1;
  185|      0|            break;
  186|  16.8M|        }
  187|  16.8M|        if (BIO_next(b) != NULL)
  ------------------
  |  Branch (187:13): [True: 16.8M, False: 0]
  ------------------
  188|  16.8M|            ret = BIO_ctrl(BIO_next(b), cmd, num, ptr);
  189|  16.8M|        break;
  190|  50.5M|    }
  191|  50.5M|    return ret;
  192|  50.5M|}
bf_prefix.c:prefix_create:
   53|  8.43M|{
   54|  8.43M|    PREFIX_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  8.43M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.43M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.43M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   55|       |
   56|  8.43M|    if (ctx == NULL)
  ------------------
  |  Branch (56:9): [True: 0, False: 8.43M]
  ------------------
   57|      0|        return 0;
   58|       |
   59|  8.43M|    ctx->prefix = NULL;
   60|  8.43M|    ctx->indent = 0;
   61|  8.43M|    ctx->linestart = 1;
   62|  8.43M|    BIO_set_data(b, ctx);
   63|  8.43M|    BIO_set_init(b, 1);
   64|  8.43M|    return 1;
   65|  8.43M|}
bf_prefix.c:prefix_destroy:
   68|  8.43M|{
   69|  8.43M|    PREFIX_CTX *ctx = BIO_get_data(b);
   70|       |
   71|  8.43M|    OPENSSL_free(ctx->prefix);
  ------------------
  |  |  107|  8.43M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.43M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.43M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   72|  8.43M|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  8.43M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.43M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.43M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   73|  8.43M|    return 1;
   74|  8.43M|}

BIO_dump_cb:
   24|     75|{
   25|     75|    return BIO_dump_indent_cb(cb, u, s, len, 0);
   26|     75|}
BIO_dump_indent_cb:
   30|  8.23k|{
   31|  8.23k|    const unsigned char *s = v;
   32|  8.23k|    int res, ret = 0;
   33|  8.23k|    char buf[288 + 1];
   34|  8.23k|    int i, j, rows, n;
   35|  8.23k|    unsigned char ch;
   36|  8.23k|    int dump_width;
   37|       |
   38|  8.23k|    if (indent < 0)
  ------------------
  |  Branch (38:9): [True: 0, False: 8.23k]
  ------------------
   39|      0|        indent = 0;
   40|  8.23k|    else if (indent > 64)
  ------------------
  |  Branch (40:14): [True: 17, False: 8.21k]
  ------------------
   41|     17|        indent = 64;
   42|       |
   43|  8.23k|    dump_width = DUMP_WIDTH_LESS_INDENT(indent);
  ------------------
  |  |   18|  8.23k|#define DUMP_WIDTH_LESS_INDENT(i) (DUMP_WIDTH - ((i - (i > 6 ? 6 : i) + 3) / 4))
  |  |  ------------------
  |  |  |  |   17|  8.23k|#define DUMP_WIDTH      16
  |  |  ------------------
  |  |  |  Branch (18:56): [True: 7.28k, False: 944]
  |  |  ------------------
  ------------------
   44|  8.23k|    rows = len / dump_width;
   45|  8.23k|    if ((rows * dump_width) < len)
  ------------------
  |  Branch (45:9): [True: 7.38k, False: 842]
  ------------------
   46|  7.38k|        rows++;
   47|   844k|    for (i = 0; i < rows; i++) {
  ------------------
  |  Branch (47:17): [True: 836k, False: 8.23k]
  ------------------
   48|   836k|        n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "",
   49|   836k|                         i * dump_width);
   50|  13.7M|        for (j = 0; j < dump_width; j++) {
  ------------------
  |  Branch (50:21): [True: 12.9M, False: 836k]
  ------------------
   51|  12.9M|            if (SPACE(buf, n, 3)) {
  ------------------
  |  |   20|  12.9M|#define SPACE(buf, pos, n)   (sizeof(buf) - (pos) > (n))
  |  |  ------------------
  |  |  |  Branch (20:30): [True: 12.9M, False: 0]
  |  |  ------------------
  ------------------
   52|  12.9M|                if (((i * dump_width) + j) >= len) {
  ------------------
  |  Branch (52:21): [True: 75.6k, False: 12.8M]
  ------------------
   53|  75.6k|                    strcpy(buf + n, "   ");
   54|  12.8M|                } else {
   55|  12.8M|                    ch = *(s + i * dump_width + j) & 0xff;
   56|  12.8M|                    BIO_snprintf(buf + n, 4, "%02x%c", ch,
   57|  12.8M|                                 j == 7 ? '-' : ' ');
  ------------------
  |  Branch (57:34): [True: 830k, False: 11.9M]
  ------------------
   58|  12.8M|                }
   59|  12.9M|                n += 3;
   60|  12.9M|            }
   61|  12.9M|        }
   62|   836k|        if (SPACE(buf, n, 2)) {
  ------------------
  |  |   20|   836k|#define SPACE(buf, pos, n)   (sizeof(buf) - (pos) > (n))
  |  |  ------------------
  |  |  |  Branch (20:30): [True: 836k, False: 0]
  |  |  ------------------
  ------------------
   63|   836k|            strcpy(buf + n, "  ");
   64|   836k|            n += 2;
   65|   836k|        }
   66|  13.6M|        for (j = 0; j < dump_width; j++) {
  ------------------
  |  Branch (66:21): [True: 12.8M, False: 829k]
  ------------------
   67|  12.8M|            if (((i * dump_width) + j) >= len)
  ------------------
  |  Branch (67:17): [True: 7.38k, False: 12.8M]
  ------------------
   68|  7.38k|                break;
   69|  12.8M|            if (SPACE(buf, n, 1)) {
  ------------------
  |  |   20|  12.8M|#define SPACE(buf, pos, n)   (sizeof(buf) - (pos) > (n))
  |  |  ------------------
  |  |  |  Branch (20:30): [True: 12.8M, False: 0]
  |  |  ------------------
  ------------------
   70|  12.8M|                ch = *(s + i * dump_width + j) & 0xff;
   71|  12.8M|#ifndef CHARSET_EBCDIC
   72|  12.8M|                buf[n++] = ((ch >= ' ') && (ch <= '~')) ? ch : '.';
  ------------------
  |  Branch (72:29): [True: 10.1M, False: 2.64M]
  |  Branch (72:44): [True: 284k, False: 9.89M]
  ------------------
   73|       |#else
   74|       |                buf[n++] = ((ch >= os_toascii[' ']) && (ch <= os_toascii['~']))
   75|       |                           ? os_toebcdic[ch]
   76|       |                           : '.';
   77|       |#endif
   78|  12.8M|                buf[n] = '\0';
   79|  12.8M|            }
   80|  12.8M|        }
   81|   836k|        if (SPACE(buf, n, 1)) {
  ------------------
  |  |   20|   836k|#define SPACE(buf, pos, n)   (sizeof(buf) - (pos) > (n))
  |  |  ------------------
  |  |  |  Branch (20:30): [True: 836k, False: 0]
  |  |  ------------------
  ------------------
   82|   836k|            buf[n++] = '\n';
   83|   836k|            buf[n] = '\0';
   84|   836k|        }
   85|       |        /*
   86|       |         * if this is the last call then update the ddt_dump thing so that we
   87|       |         * will move the selection point in the debug window
   88|       |         */
   89|   836k|        res = cb((void *)buf, n, u);
   90|   836k|        if (res < 0)
  ------------------
  |  Branch (90:13): [True: 0, False: 836k]
  ------------------
   91|      0|            return res;
   92|   836k|        ret += res;
   93|   836k|    }
   94|  8.23k|    return ret;
   95|  8.23k|}
BIO_dump:
  120|     75|{
  121|     75|    return BIO_dump_cb(write_bio, bp, s, len);
  122|     75|}
BIO_dump_indent:
  125|  8.15k|{
  126|  8.15k|    return BIO_dump_indent_cb(write_bio, bp, s, len, indent);
  127|  8.15k|}
bio_dump.c:write_bio:
  115|   836k|{
  116|   836k|    return BIO_write((BIO *)bp, (const char *)data, len);
  117|   836k|}

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

BIO_new_ex:
   82|  8.82M|{
   83|  8.82M|    BIO *bio = OPENSSL_zalloc(sizeof(*bio));
  ------------------
  |  |   99|  8.82M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.82M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.82M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   84|       |
   85|  8.82M|    if (bio == NULL)
  ------------------
  |  Branch (85:9): [True: 0, False: 8.82M]
  ------------------
   86|      0|        return NULL;
   87|       |
   88|  8.82M|    bio->libctx = libctx;
   89|  8.82M|    bio->method = method;
   90|  8.82M|    bio->shutdown = 1;
   91|       |
   92|  8.82M|    if (!CRYPTO_NEW_REF(&bio->references, 1))
  ------------------
  |  Branch (92:9): [True: 0, False: 8.82M]
  ------------------
   93|      0|        goto err;
   94|       |
   95|  8.82M|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data))
  ------------------
  |  |  230|  8.82M|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
  |  Branch (95:9): [True: 0, False: 8.82M]
  ------------------
   96|      0|        goto err;
   97|       |
   98|  8.82M|    if (method->create != NULL && !method->create(bio)) {
  ------------------
  |  Branch (98:9): [True: 8.77M, False: 47.4k]
  |  Branch (98:35): [True: 0, False: 8.77M]
  ------------------
   99|      0|        ERR_raise(ERR_LIB_BIO, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  100|      0|        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data);
  ------------------
  |  |  230|      0|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
  101|      0|        goto err;
  102|      0|    }
  103|  8.82M|    if (method->create == NULL)
  ------------------
  |  Branch (103:9): [True: 47.4k, False: 8.77M]
  ------------------
  104|  47.4k|        bio->init = 1;
  105|       |
  106|  8.82M|    return bio;
  107|       |
  108|      0|err:
  109|      0|    CRYPTO_FREE_REF(&bio->references);
  110|      0|    OPENSSL_free(bio);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  111|      0|    return NULL;
  112|  8.82M|}
BIO_new:
  115|  8.82M|{
  116|  8.82M|    return BIO_new_ex(NULL, method);
  117|  8.82M|}
BIO_free:
  120|  8.96M|{
  121|  8.96M|    int ret;
  122|       |
  123|  8.96M|    if (a == NULL)
  ------------------
  |  Branch (123:9): [True: 65.3k, False: 8.90M]
  ------------------
  124|  65.3k|        return 0;
  125|       |
  126|  8.90M|    if (CRYPTO_DOWN_REF(&a->references, &ret) <= 0)
  ------------------
  |  Branch (126:9): [True: 0, False: 8.90M]
  ------------------
  127|      0|        return 0;
  128|       |
  129|  8.90M|    REF_PRINT_COUNT("BIO", a);
  ------------------
  |  |  289|  8.90M|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  8.90M|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  8.90M|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  8.90M|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|  8.90M|    if (ret > 0)
  ------------------
  |  Branch (130:9): [True: 78.2k, False: 8.82M]
  ------------------
  131|  78.2k|        return 1;
  132|  8.82M|    REF_ASSERT_ISNT(ret < 0);
  ------------------
  |  |  281|  8.82M|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 8.82M]
  |  |  ------------------
  ------------------
  133|       |
  134|  8.82M|    if (HAS_CALLBACK(a)) {
  ------------------
  |  |   26|  8.82M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 8.82M]
  |  |  |  Branch (26:52): [True: 0, False: 8.82M]
  |  |  ------------------
  ------------------
  135|      0|        ret = (int)bio_call_callback(a, BIO_CB_FREE, NULL, 0, 0, 0L, 1L, NULL);
  ------------------
  |  |  285|      0|# define BIO_CB_FREE        0x01
  ------------------
  136|      0|        if (ret <= 0)
  ------------------
  |  Branch (136:13): [True: 0, False: 0]
  ------------------
  137|      0|            return 0;
  138|      0|    }
  139|       |
  140|  8.82M|    if ((a->method != NULL) && (a->method->destroy != NULL))
  ------------------
  |  Branch (140:9): [True: 8.82M, False: 0]
  |  Branch (140:32): [True: 8.77M, False: 47.4k]
  ------------------
  141|  8.77M|        a->method->destroy(a);
  142|       |
  143|  8.82M|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
  ------------------
  |  |  230|  8.82M|# define CRYPTO_EX_INDEX_BIO             12
  ------------------
  144|       |
  145|  8.82M|    CRYPTO_FREE_REF(&a->references);
  146|       |
  147|  8.82M|    OPENSSL_free(a);
  ------------------
  |  |  107|  8.82M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.82M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.82M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  148|       |
  149|  8.82M|    return 1;
  150|  8.82M|}
BIO_set_data:
  153|  8.69M|{
  154|  8.69M|    a->ptr = ptr;
  155|  8.69M|}
BIO_get_data:
  158|   189M|{
  159|   189M|    return a->ptr;
  160|   189M|}
BIO_set_init:
  163|  8.96M|{
  164|  8.96M|    a->init = init;
  165|  8.96M|}
BIO_up_ref:
  188|  78.2k|{
  189|  78.2k|    int i;
  190|       |
  191|  78.2k|    if (CRYPTO_UP_REF(&a->references, &i) <= 0)
  ------------------
  |  Branch (191:9): [True: 0, False: 78.2k]
  ------------------
  192|      0|        return 0;
  193|       |
  194|  78.2k|    REF_PRINT_COUNT("BIO", a);
  ------------------
  |  |  289|  78.2k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  78.2k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  78.2k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  78.2k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|  78.2k|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|  78.2k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 78.2k]
  |  |  ------------------
  ------------------
  196|  78.2k|    return i > 1;
  197|  78.2k|}
BIO_clear_flags:
  200|   120M|{
  201|   120M|    b->flags &= ~flags;
  202|   120M|}
BIO_read:
  304|   120M|{
  305|   120M|    size_t readbytes;
  306|   120M|    int ret;
  307|       |
  308|   120M|    if (dlen < 0)
  ------------------
  |  Branch (308:9): [True: 0, False: 120M]
  ------------------
  309|      0|        return 0;
  310|       |
  311|   120M|    ret = bio_read_intern(b, data, (size_t)dlen, &readbytes);
  312|       |
  313|   120M|    if (ret > 0) {
  ------------------
  |  Branch (313:9): [True: 120M, False: 181k]
  ------------------
  314|       |        /* *readbytes should always be <= dlen */
  315|   120M|        ret = (int)readbytes;
  316|   120M|    }
  317|       |
  318|   120M|    return ret;
  319|   120M|}
BIO_read_ex:
  322|   120M|{
  323|   120M|    return bio_read_intern(b, data, dlen, readbytes) > 0;
  324|   120M|}
BIO_write:
  371|  58.2M|{
  372|  58.2M|    size_t written;
  373|  58.2M|    int ret;
  374|       |
  375|  58.2M|    if (dlen <= 0)
  ------------------
  |  Branch (375:9): [True: 337k, False: 57.9M]
  ------------------
  376|   337k|        return 0;
  377|       |
  378|  57.9M|    ret = bio_write_intern(b, data, (size_t)dlen, &written);
  379|       |
  380|  57.9M|    if (ret > 0) {
  ------------------
  |  Branch (380:9): [True: 57.9M, False: 0]
  ------------------
  381|       |        /* written should always be <= dlen */
  382|  57.9M|        ret = (int)written;
  383|  57.9M|    }
  384|       |
  385|  57.9M|    return ret;
  386|  58.2M|}
BIO_write_ex:
  389|  18.2M|{
  390|  18.2M|    return bio_write_intern(b, data, dlen, written) > 0
  ------------------
  |  Branch (390:12): [True: 18.2M, False: 0]
  ------------------
  391|  18.2M|        || (b != NULL && dlen == 0); /* order is important for *written */
  ------------------
  |  Branch (391:13): [True: 0, False: 0]
  |  Branch (391:26): [True: 0, False: 0]
  ------------------
  392|  18.2M|}
BIO_puts:
  499|  1.84M|{
  500|  1.84M|    int ret;
  501|  1.84M|    size_t written = 0;
  502|       |
  503|  1.84M|    if (b == NULL) {
  ------------------
  |  Branch (503:9): [True: 0, False: 1.84M]
  ------------------
  504|      0|        ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  505|      0|        return -1;
  506|      0|    }
  507|  1.84M|    if (b->method == NULL || b->method->bputs == NULL) {
  ------------------
  |  Branch (507:9): [True: 0, False: 1.84M]
  |  Branch (507:30): [True: 0, False: 1.84M]
  ------------------
  508|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  509|      0|        return -2;
  510|      0|    }
  511|       |
  512|  1.84M|    if (HAS_CALLBACK(b)) {
  ------------------
  |  |   26|  1.84M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 1.84M]
  |  |  |  Branch (26:52): [True: 0, False: 1.84M]
  |  |  ------------------
  ------------------
  513|      0|        ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
  ------------------
  |  |  288|      0|# define BIO_CB_PUTS        0x04
  ------------------
  514|      0|        if (ret <= 0)
  ------------------
  |  Branch (514:13): [True: 0, False: 0]
  ------------------
  515|      0|            return ret;
  516|      0|    }
  517|       |
  518|  1.84M|    if (!b->init) {
  ------------------
  |  Branch (518:9): [True: 0, False: 1.84M]
  ------------------
  519|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNINITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  520|      0|        return -1;
  521|      0|    }
  522|       |
  523|  1.84M|    ret = b->method->bputs(b, buf);
  524|       |
  525|  1.84M|    if (ret > 0) {
  ------------------
  |  Branch (525:9): [True: 1.84M, False: 194]
  ------------------
  526|  1.84M|        b->num_write += (uint64_t)ret;
  527|  1.84M|        written = ret;
  528|  1.84M|        ret = 1;
  529|  1.84M|    }
  530|       |
  531|  1.84M|    if (HAS_CALLBACK(b))
  ------------------
  |  |   26|  1.84M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 1.84M]
  |  |  |  Branch (26:52): [True: 0, False: 1.84M]
  |  |  ------------------
  ------------------
  532|      0|        ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0,
  ------------------
  |  |  288|      0|# define BIO_CB_PUTS        0x04
  ------------------
                      ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0,
  ------------------
  |  |  298|      0|# define BIO_CB_RETURN   0x80
  ------------------
  533|      0|                                     0L, ret, &written);
  534|       |
  535|  1.84M|    if (ret > 0) {
  ------------------
  |  Branch (535:9): [True: 1.84M, False: 194]
  ------------------
  536|  1.84M|        if (written > INT_MAX) {
  ------------------
  |  Branch (536:13): [True: 0, False: 1.84M]
  ------------------
  537|      0|            ERR_raise(ERR_LIB_BIO, BIO_R_LENGTH_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  538|      0|            ret = -1;
  539|  1.84M|        } else {
  540|  1.84M|            ret = (int)written;
  541|  1.84M|        }
  542|  1.84M|    }
  543|       |
  544|  1.84M|    return ret;
  545|  1.84M|}
BIO_indent:
  631|  12.5k|{
  632|  12.5k|    if (indent < 0)
  ------------------
  |  Branch (632:9): [True: 0, False: 12.5k]
  ------------------
  633|      0|        indent = 0;
  634|  12.5k|    if (indent > max)
  ------------------
  |  Branch (634:9): [True: 0, False: 12.5k]
  ------------------
  635|      0|        indent = max;
  636|  30.8k|    while (indent--)
  ------------------
  |  Branch (636:12): [True: 18.3k, False: 12.5k]
  ------------------
  637|  18.3k|        if (BIO_puts(b, " ") != 1)
  ------------------
  |  Branch (637:13): [True: 0, False: 18.3k]
  ------------------
  638|      0|            return 0;
  639|  12.5k|    return 1;
  640|  12.5k|}
BIO_ctrl:
  661|  76.5M|{
  662|  76.5M|    long ret;
  663|       |
  664|  76.5M|    if (b == NULL)
  ------------------
  |  Branch (664:9): [True: 0, False: 76.5M]
  ------------------
  665|      0|        return -1;
  666|  76.5M|    if (b->method == NULL || b->method->ctrl == NULL) {
  ------------------
  |  Branch (666:9): [True: 0, False: 76.5M]
  |  Branch (666:30): [True: 0, False: 76.5M]
  ------------------
  667|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  668|      0|        return -2;
  669|      0|    }
  670|       |
  671|  76.5M|    if (HAS_CALLBACK(b)) {
  ------------------
  |  |   26|  76.5M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 76.5M]
  |  |  |  Branch (26:52): [True: 0, False: 76.5M]
  |  |  ------------------
  ------------------
  672|      0|        ret = bio_call_callback(b, BIO_CB_CTRL, parg, 0, cmd, larg, 1L, NULL);
  ------------------
  |  |  290|      0|# define BIO_CB_CTRL        0x06
  ------------------
  673|      0|        if (ret <= 0)
  ------------------
  |  Branch (673:13): [True: 0, False: 0]
  ------------------
  674|      0|            return ret;
  675|      0|    }
  676|       |
  677|  76.5M|    ret = b->method->ctrl(b, cmd, larg, parg);
  678|       |
  679|  76.5M|    if (HAS_CALLBACK(b))
  ------------------
  |  |   26|  76.5M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 76.5M]
  |  |  |  Branch (26:52): [True: 0, False: 76.5M]
  |  |  ------------------
  ------------------
  680|      0|        ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd,
  ------------------
  |  |  290|      0|# define BIO_CB_CTRL        0x06
  ------------------
                      ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd,
  ------------------
  |  |  298|      0|# define BIO_CB_RETURN   0x80
  ------------------
  681|      0|                                larg, ret, NULL);
  682|       |
  683|  76.5M|    return ret;
  684|  76.5M|}
BIO_push:
  747|  8.43M|{
  748|  8.43M|    BIO *lb;
  749|       |
  750|  8.43M|    if (b == NULL)
  ------------------
  |  Branch (750:9): [True: 0, False: 8.43M]
  ------------------
  751|      0|        return bio;
  752|  8.43M|    lb = b;
  753|  8.43M|    while (lb->next_bio != NULL)
  ------------------
  |  Branch (753:12): [True: 0, False: 8.43M]
  ------------------
  754|      0|        lb = lb->next_bio;
  755|  8.43M|    lb->next_bio = bio;
  756|  8.43M|    if (bio != NULL)
  ------------------
  |  Branch (756:9): [True: 8.43M, False: 0]
  ------------------
  757|  8.43M|        bio->prev_bio = lb;
  758|       |    /* called to do internal processing */
  759|  8.43M|    BIO_ctrl(b, BIO_CTRL_PUSH, 0, lb);
  ------------------
  |  |   90|  8.43M|# define BIO_CTRL_PUSH           6/* opt - internal, used to signify change */
  ------------------
  760|  8.43M|    return b;
  761|  8.43M|}
BIO_pop:
  765|  8.43M|{
  766|  8.43M|    BIO *ret;
  767|       |
  768|  8.43M|    if (b == NULL)
  ------------------
  |  Branch (768:9): [True: 0, False: 8.43M]
  ------------------
  769|      0|        return NULL;
  770|  8.43M|    ret = b->next_bio;
  771|       |
  772|  8.43M|    BIO_ctrl(b, BIO_CTRL_POP, 0, b);
  ------------------
  |  |   91|  8.43M|# define BIO_CTRL_POP            7/* opt - internal, used to signify change */
  ------------------
  773|       |
  774|  8.43M|    if (b->prev_bio != NULL)
  ------------------
  |  Branch (774:9): [True: 0, False: 8.43M]
  ------------------
  775|      0|        b->prev_bio->next_bio = b->next_bio;
  776|  8.43M|    if (b->next_bio != NULL)
  ------------------
  |  Branch (776:9): [True: 8.43M, False: 0]
  ------------------
  777|  8.43M|        b->next_bio->prev_bio = b->prev_bio;
  778|       |
  779|  8.43M|    b->next_bio = NULL;
  780|  8.43M|    b->prev_bio = NULL;
  781|  8.43M|    return ret;
  782|  8.43M|}
BIO_next:
  838|  59.0M|{
  839|  59.0M|    if (b == NULL)
  ------------------
  |  Branch (839:9): [True: 0, False: 59.0M]
  ------------------
  840|      0|        return NULL;
  841|  59.0M|    return b->next_bio;
  842|  59.0M|}
bio_cleanup:
  947|      2|{
  948|      2|#ifndef OPENSSL_NO_SOCK
  949|      2|    bio_sock_cleanup_int();
  950|      2|    CRYPTO_THREAD_lock_free(bio_lookup_lock);
  951|      2|    bio_lookup_lock = NULL;
  952|      2|#endif
  953|      2|    CRYPTO_FREE_REF(&bio_type_count);
  954|      2|}
bio_lib.c:bio_read_intern:
  263|   241M|{
  264|   241M|    int ret;
  265|       |
  266|   241M|    if (b == NULL) {
  ------------------
  |  Branch (266:9): [True: 0, False: 241M]
  ------------------
  267|      0|        ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  268|      0|        return -1;
  269|      0|    }
  270|   241M|    if (b->method == NULL || b->method->bread == NULL) {
  ------------------
  |  Branch (270:9): [True: 0, False: 241M]
  |  Branch (270:30): [True: 0, False: 241M]
  ------------------
  271|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|        return -2;
  273|      0|    }
  274|       |
  275|   241M|    if (HAS_CALLBACK(b) &&
  ------------------
  |  |   26|   482M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 241M]
  |  |  |  Branch (26:52): [True: 0, False: 241M]
  |  |  ------------------
  ------------------
  276|   241M|        ((ret = (int)bio_call_callback(b, BIO_CB_READ, data, dlen, 0, 0L, 1L,
  ------------------
  |  |  286|      0|# define BIO_CB_READ        0x02
  ------------------
  |  Branch (276:9): [True: 0, False: 0]
  ------------------
  277|      0|                                       NULL)) <= 0))
  278|      0|        return ret;
  279|       |
  280|   241M|    if (!b->init) {
  ------------------
  |  Branch (280:9): [True: 0, False: 241M]
  ------------------
  281|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNINITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  282|      0|        return -1;
  283|      0|    }
  284|       |
  285|   241M|    ret = b->method->bread(b, data, dlen, readbytes);
  286|       |
  287|   241M|    if (ret > 0)
  ------------------
  |  Branch (287:9): [True: 240M, False: 363k]
  ------------------
  288|   240M|        b->num_read += (uint64_t)*readbytes;
  289|       |
  290|   241M|    if (HAS_CALLBACK(b))
  ------------------
  |  |   26|   241M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 241M]
  |  |  |  Branch (26:52): [True: 0, False: 241M]
  |  |  ------------------
  ------------------
  291|      0|        ret = (int)bio_call_callback(b, BIO_CB_READ | BIO_CB_RETURN, data,
  ------------------
  |  |  286|      0|# define BIO_CB_READ        0x02
  ------------------
                      ret = (int)bio_call_callback(b, BIO_CB_READ | BIO_CB_RETURN, data,
  ------------------
  |  |  298|      0|# define BIO_CB_RETURN   0x80
  ------------------
  292|      0|                                     dlen, 0, 0L, ret, readbytes);
  293|       |
  294|       |    /* Shouldn't happen */
  295|   241M|    if (ret > 0 && *readbytes > dlen) {
  ------------------
  |  Branch (295:9): [True: 240M, False: 363k]
  |  Branch (295:20): [True: 0, False: 240M]
  ------------------
  296|      0|        ERR_raise(ERR_LIB_BIO, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  297|      0|        return -1;
  298|      0|    }
  299|       |
  300|   241M|    return ret;
  301|   241M|}
bio_lib.c:bio_write_intern:
  328|  76.1M|{
  329|  76.1M|    size_t local_written;
  330|  76.1M|    int ret;
  331|       |
  332|  76.1M|    if (written != NULL)
  ------------------
  |  Branch (332:9): [True: 76.1M, False: 0]
  ------------------
  333|  76.1M|        *written = 0;
  334|       |    /*
  335|       |     * b == NULL is not an error but just means that zero bytes are written.
  336|       |     * Do not raise an error here.
  337|       |     */
  338|  76.1M|    if (b == NULL)
  ------------------
  |  Branch (338:9): [True: 0, False: 76.1M]
  ------------------
  339|      0|        return 0;
  340|       |
  341|  76.1M|    if (b->method == NULL || b->method->bwrite == NULL) {
  ------------------
  |  Branch (341:9): [True: 0, False: 76.1M]
  |  Branch (341:30): [True: 0, False: 76.1M]
  ------------------
  342|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  343|      0|        return -2;
  344|      0|    }
  345|       |
  346|  76.1M|    if (HAS_CALLBACK(b) &&
  ------------------
  |  |   26|   152M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 76.1M]
  |  |  |  Branch (26:52): [True: 0, False: 76.1M]
  |  |  ------------------
  ------------------
  347|  76.1M|        ((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L,
  ------------------
  |  |  287|      0|# define BIO_CB_WRITE       0x03
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      0|                                       NULL)) <= 0))
  349|      0|        return ret;
  350|       |
  351|  76.1M|    if (!b->init) {
  ------------------
  |  Branch (351:9): [True: 0, False: 76.1M]
  ------------------
  352|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_UNINITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  353|      0|        return -1;
  354|      0|    }
  355|       |
  356|  76.1M|    ret = b->method->bwrite(b, data, dlen, &local_written);
  357|       |
  358|  76.1M|    if (ret > 0)
  ------------------
  |  Branch (358:9): [True: 76.1M, False: 0]
  ------------------
  359|  76.1M|        b->num_write += (uint64_t)local_written;
  360|       |
  361|  76.1M|    if (HAS_CALLBACK(b))
  ------------------
  |  |   26|  76.1M|# define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)
  |  |  ------------------
  |  |  |  Branch (26:27): [True: 0, False: 76.1M]
  |  |  |  Branch (26:52): [True: 0, False: 76.1M]
  |  |  ------------------
  ------------------
  362|      0|        ret = (int)bio_call_callback(b, BIO_CB_WRITE | BIO_CB_RETURN, data,
  ------------------
  |  |  287|      0|# define BIO_CB_WRITE       0x03
  ------------------
                      ret = (int)bio_call_callback(b, BIO_CB_WRITE | BIO_CB_RETURN, data,
  ------------------
  |  |  298|      0|# define BIO_CB_RETURN   0x80
  ------------------
  363|      0|                                     dlen, 0, 0L, ret, &local_written);
  364|       |
  365|  76.1M|    if (written != NULL)
  ------------------
  |  Branch (365:9): [True: 76.1M, False: 0]
  ------------------
  366|  76.1M|        *written = local_written;
  367|  76.1M|    return ret;
  368|  76.1M|}

BIO_meth_new:
   36|      1|{
   37|      1|    BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD));
  ------------------
  |  |   99|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   38|       |
   39|      1|    if (biom == NULL
  ------------------
  |  Branch (39:9): [True: 0, False: 1]
  ------------------
   40|      1|            || (biom->name = OPENSSL_strdup(name)) == NULL) {
  ------------------
  |  |  111|      1|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (40:16): [True: 0, False: 1]
  ------------------
   41|      0|        OPENSSL_free(biom);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   42|      0|        return NULL;
   43|      0|    }
   44|      1|    biom->type = type;
   45|      1|    return biom;
   46|      1|}
BIO_meth_free:
   49|      1|{
   50|      1|    if (biom != NULL) {
  ------------------
  |  Branch (50:9): [True: 1, False: 0]
  ------------------
   51|      1|        OPENSSL_free(biom->name);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   52|      1|        OPENSSL_free(biom);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   53|      1|    }
   54|      1|}
bwrite_conv:
   69|  66.3M|{
   70|  66.3M|    int ret;
   71|       |
   72|  66.3M|    if (datal > INT_MAX)
  ------------------
  |  Branch (72:9): [True: 0, False: 66.3M]
  ------------------
   73|      0|        datal = INT_MAX;
   74|       |
   75|  66.3M|    ret = bio->method->bwrite_old(bio, data, (int)datal);
   76|       |
   77|  66.3M|    if (ret <= 0) {
  ------------------
  |  Branch (77:9): [True: 0, False: 66.3M]
  ------------------
   78|      0|        *written = 0;
   79|      0|        return ret;
   80|      0|    }
   81|       |
   82|  66.3M|    *written = (size_t)ret;
   83|       |
   84|  66.3M|    return 1;
   85|  66.3M|}
BIO_meth_set_write_ex:
   97|      1|{
   98|      1|    biom->bwrite_old = NULL;
   99|      1|    biom->bwrite = bwrite;
  100|      1|    return 1;
  101|      1|}
bread_conv:
  115|   120M|{
  116|   120M|    int ret;
  117|       |
  118|   120M|    if (datal > INT_MAX)
  ------------------
  |  Branch (118:9): [True: 0, False: 120M]
  ------------------
  119|      0|        datal = INT_MAX;
  120|       |
  121|   120M|    ret = bio->method->bread_old(bio, data, (int)datal);
  122|       |
  123|   120M|    if (ret <= 0) {
  ------------------
  |  Branch (123:9): [True: 181k, False: 120M]
  ------------------
  124|   181k|        *readbytes = 0;
  125|   181k|        return ret;
  126|   181k|    }
  127|       |
  128|   120M|    *readbytes = (size_t)ret;
  129|       |
  130|   120M|    return 1;
  131|   120M|}
BIO_meth_set_read_ex:
  143|      1|{
  144|      1|    biom->bread_old = NULL;
  145|      1|    biom->bread = bread;
  146|      1|    return 1;
  147|      1|}
BIO_meth_set_puts:
  156|      1|{
  157|      1|    biom->bputs = bputs;
  158|      1|    return 1;
  159|      1|}
BIO_meth_set_gets:
  168|      1|{
  169|      1|    biom->bgets = bgets;
  170|      1|    return 1;
  171|      1|}
BIO_meth_set_ctrl:
  180|      1|{
  181|      1|    biom->ctrl = ctrl;
  182|      1|    return 1;
  183|      1|}
BIO_meth_set_create:
  191|      1|{
  192|      1|    biom->create = create;
  193|      1|    return 1;
  194|      1|}
BIO_meth_set_destroy:
  202|      1|{
  203|      1|    biom->destroy = destroy;
  204|      1|    return 1;
  205|      1|}

BIO_printf:
  879|  37.4M|{
  880|  37.4M|    va_list args;
  881|  37.4M|    int ret;
  882|       |
  883|  37.4M|    va_start(args, format);
  884|       |
  885|  37.4M|    ret = BIO_vprintf(bio, format, args);
  886|       |
  887|  37.4M|    va_end(args);
  888|  37.4M|    return ret;
  889|  37.4M|}
BIO_vprintf:
  892|  37.4M|{
  893|  37.4M|    int ret;
  894|  37.4M|    size_t retlen;
  895|  37.4M|    char hugebuf[1024 * 2];     /* Was previously 10k, which is unreasonable
  896|       |                                 * in small-stack environments, like threads
  897|       |                                 * or DOS programs. */
  898|  37.4M|    char *hugebufp = hugebuf;
  899|  37.4M|    size_t hugebufsize = sizeof(hugebuf);
  900|  37.4M|    char *dynbuf = NULL;
  901|  37.4M|    int ignored;
  902|       |
  903|  37.4M|    dynbuf = NULL;
  904|  37.4M|    if (!_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format,
  ------------------
  |  Branch (904:9): [True: 0, False: 37.4M]
  ------------------
  905|  37.4M|                args)) {
  906|      0|        OPENSSL_free(dynbuf);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  907|      0|        return -1;
  908|      0|    }
  909|  37.4M|    if (dynbuf) {
  ------------------
  |  Branch (909:9): [True: 30, False: 37.4M]
  ------------------
  910|     30|        ret = BIO_write(bio, dynbuf, (int)retlen);
  911|     30|        OPENSSL_free(dynbuf);
  ------------------
  |  |  107|     30|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     30|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     30|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  912|  37.4M|    } else {
  913|  37.4M|        ret = BIO_write(bio, hugebuf, (int)retlen);
  914|  37.4M|    }
  915|  37.4M|    return ret;
  916|  37.4M|}
BIO_snprintf:
  925|  23.7M|{
  926|  23.7M|    va_list args;
  927|  23.7M|    int ret;
  928|       |
  929|  23.7M|    va_start(args, format);
  930|       |
  931|  23.7M|    ret = BIO_vsnprintf(buf, n, format, args);
  932|       |
  933|  23.7M|    va_end(args);
  934|  23.7M|    return ret;
  935|  23.7M|}
BIO_vsnprintf:
  938|  23.7M|{
  939|  23.7M|    size_t retlen;
  940|  23.7M|    int truncated;
  941|       |
  942|  23.7M|    if (!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args))
  ------------------
  |  Branch (942:9): [True: 0, False: 23.7M]
  ------------------
  943|      0|        return -1;
  944|       |
  945|  23.7M|    if (truncated)
  ------------------
  |  Branch (945:9): [True: 0, False: 23.7M]
  ------------------
  946|       |        /*
  947|       |         * In case of truncation, return -1 like traditional snprintf.
  948|       |         * (Current drafts for ISO/IEC 9899 say snprintf should return the
  949|       |         * number of characters that would have been written, had the buffer
  950|       |         * been large enough.)
  951|       |         */
  952|      0|        return -1;
  953|  23.7M|    return (retlen <= INT_MAX) ? (int)retlen : -1;
  ------------------
  |  Branch (953:12): [True: 23.7M, False: 0]
  ------------------
  954|  23.7M|}
bio_print.c:_dopr:
   91|  61.2M|{
   92|  61.2M|    char ch;
   93|  61.2M|    int64_t value;
   94|  61.2M|#ifndef OPENSSL_SYS_UEFI
   95|  61.2M|    LDOUBLE fvalue;
  ------------------
  |  |   28|  61.2M|# define LDOUBLE double
  ------------------
   96|  61.2M|#endif
   97|  61.2M|    char *strvalue;
   98|  61.2M|    int min;
   99|  61.2M|    int max;
  100|  61.2M|    int state;
  101|  61.2M|    int flags;
  102|  61.2M|    int cflags;
  103|  61.2M|    size_t currlen;
  104|       |
  105|  61.2M|    state = DP_S_DEFAULT;
  ------------------
  |  |   45|  61.2M|#define DP_S_DEFAULT    0
  ------------------
  106|  61.2M|    flags = currlen = cflags = min = 0;
  107|  61.2M|    max = -1;
  108|  61.2M|    ch = *format++;
  109|       |
  110|  1.01G|    while (state != DP_S_DONE) {
  ------------------
  |  |   52|  1.01G|#define DP_S_DONE       7
  ------------------
  |  Branch (110:12): [True: 952M, False: 61.2M]
  ------------------
  111|   952M|        if (ch == '\0' || (buffer == NULL && currlen >= *maxlen))
  ------------------
  |  Branch (111:13): [True: 61.2M, False: 891M]
  |  Branch (111:28): [True: 584M, False: 306M]
  |  Branch (111:46): [True: 0, False: 584M]
  ------------------
  112|  61.2M|            state = DP_S_DONE;
  ------------------
  |  |   52|  61.2M|#define DP_S_DONE       7
  ------------------
  113|       |
  114|   952M|        switch (state) {
  115|   216M|        case DP_S_DEFAULT:
  ------------------
  |  |   45|   216M|#define DP_S_DEFAULT    0
  ------------------
  |  Branch (115:9): [True: 216M, False: 736M]
  ------------------
  116|   216M|            if (ch == '%')
  ------------------
  |  Branch (116:17): [True: 110M, False: 106M]
  ------------------
  117|   110M|                state = DP_S_FLAGS;
  ------------------
  |  |   46|   110M|#define DP_S_FLAGS      1
  ------------------
  118|   106M|            else
  119|   106M|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
  ------------------
  |  Branch (119:21): [True: 0, False: 106M]
  ------------------
  120|      0|                    return 0;
  121|   216M|            ch = *format++;
  122|   216M|            break;
  123|   159M|        case DP_S_FLAGS:
  ------------------
  |  |   46|   159M|#define DP_S_FLAGS      1
  ------------------
  |  Branch (123:9): [True: 159M, False: 792M]
  ------------------
  124|   159M|            switch (ch) {
  125|  16.8M|            case '-':
  ------------------
  |  Branch (125:13): [True: 16.8M, False: 143M]
  ------------------
  126|  16.8M|                flags |= DP_F_MINUS;
  ------------------
  |  |   56|  16.8M|#define DP_F_MINUS      (1 << 0)
  ------------------
  127|  16.8M|                ch = *format++;
  128|  16.8M|                break;
  129|      0|            case '+':
  ------------------
  |  Branch (129:13): [True: 0, False: 159M]
  ------------------
  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: 159M]
  ------------------
  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: 159M]
  ------------------
  138|      0|                flags |= DP_F_NUM;
  ------------------
  |  |   62|      0|#define DP_F_NUM        (1 << 3)
  ------------------
  139|      0|                ch = *format++;
  140|      0|                break;
  141|  32.7M|            case '0':
  ------------------
  |  Branch (141:13): [True: 32.7M, False: 127M]
  ------------------
  142|  32.7M|                flags |= DP_F_ZERO;
  ------------------
  |  |   64|  32.7M|#define DP_F_ZERO       (1 << 4)
  ------------------
  143|  32.7M|                ch = *format++;
  144|  32.7M|                break;
  145|   110M|            default:
  ------------------
  |  Branch (145:13): [True: 110M, False: 49.6M]
  ------------------
  146|   110M|                state = DP_S_MIN;
  ------------------
  |  |   47|   110M|#define DP_S_MIN        2
  ------------------
  147|   110M|                break;
  148|   159M|            }
  149|   159M|            break;
  150|   184M|        case DP_S_MIN:
  ------------------
  |  |   47|   184M|#define DP_S_MIN        2
  ------------------
  |  Branch (150:9): [True: 184M, False: 768M]
  ------------------
  151|   184M|            if (ossl_isdigit(ch)) {
  ------------------
  |  Branch (151:17): [True: 73.7M, False: 110M]
  ------------------
  152|  73.7M|                min = 10 * min + char_to_int(ch);
  ------------------
  |  |   83|  73.7M|#define char_to_int(p) (p - '0')
  ------------------
  153|  73.7M|                ch = *format++;
  154|   110M|            } else if (ch == '*') {
  ------------------
  |  Branch (154:24): [True: 9.38M, False: 100M]
  ------------------
  155|  9.38M|                min = va_arg(args, int);
  156|  9.38M|                ch = *format++;
  157|  9.38M|                state = DP_S_DOT;
  ------------------
  |  |   48|  9.38M|#define DP_S_DOT        3
  ------------------
  158|  9.38M|            } else
  159|   100M|                state = DP_S_DOT;
  ------------------
  |  |   48|   100M|#define DP_S_DOT        3
  ------------------
  160|   184M|            break;
  161|   110M|        case DP_S_DOT:
  ------------------
  |  |   48|   110M|#define DP_S_DOT        3
  ------------------
  |  Branch (161:9): [True: 110M, False: 842M]
  ------------------
  162|   110M|            if (ch == '.') {
  ------------------
  |  Branch (162:17): [True: 624, False: 110M]
  ------------------
  163|    624|                state = DP_S_MAX;
  ------------------
  |  |   49|    624|#define DP_S_MAX        4
  ------------------
  164|    624|                ch = *format++;
  165|    624|            } else
  166|   110M|                state = DP_S_MOD;
  ------------------
  |  |   50|   110M|#define DP_S_MOD        5
  ------------------
  167|   110M|            break;
  168|    624|        case DP_S_MAX:
  ------------------
  |  |   49|    624|#define DP_S_MAX        4
  ------------------
  |  Branch (168:9): [True: 624, False: 952M]
  ------------------
  169|    624|            if (ossl_isdigit(ch)) {
  ------------------
  |  Branch (169:17): [True: 0, False: 624]
  ------------------
  170|      0|                if (max < 0)
  ------------------
  |  Branch (170:21): [True: 0, False: 0]
  ------------------
  171|      0|                    max = 0;
  172|      0|                max = 10 * max + char_to_int(ch);
  ------------------
  |  |   83|      0|#define char_to_int(p) (p - '0')
  ------------------
  173|      0|                ch = *format++;
  174|    624|            } else if (ch == '*') {
  ------------------
  |  Branch (174:24): [True: 624, False: 0]
  ------------------
  175|    624|                max = va_arg(args, int);
  176|    624|                ch = *format++;
  177|    624|                state = DP_S_MOD;
  ------------------
  |  |   50|    624|#define DP_S_MOD        5
  ------------------
  178|    624|            } else
  179|      0|                state = DP_S_MOD;
  ------------------
  |  |   50|      0|#define DP_S_MOD        5
  ------------------
  180|    624|            break;
  181|   110M|        case DP_S_MOD:
  ------------------
  |  |   50|   110M|#define DP_S_MOD        5
  ------------------
  |  Branch (181:9): [True: 110M, False: 842M]
  ------------------
  182|   110M|            switch (ch) {
  183|      0|            case 'h':
  ------------------
  |  Branch (183:13): [True: 0, False: 110M]
  ------------------
  184|      0|                cflags = DP_C_SHORT;
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  185|      0|                ch = *format++;
  186|      0|                break;
  187|  25.4M|            case 'l':
  ------------------
  |  Branch (187:13): [True: 25.4M, False: 84.8M]
  ------------------
  188|  25.4M|                if (*format == 'l') {
  ------------------
  |  Branch (188:21): [True: 716, False: 25.4M]
  ------------------
  189|    716|                    cflags = DP_C_LLONG;
  ------------------
  |  |   74|    716|#define DP_C_LLONG      4
  ------------------
  190|    716|                    format++;
  191|    716|                } else
  192|  25.4M|                    cflags = DP_C_LONG;
  ------------------
  |  |   72|  25.4M|#define DP_C_LONG       2
  ------------------
  193|  25.4M|                ch = *format++;
  194|  25.4M|                break;
  195|      0|            case 'q':
  ------------------
  |  Branch (195:13): [True: 0, False: 110M]
  ------------------
  196|  1.20k|            case 'j':
  ------------------
  |  Branch (196:13): [True: 1.20k, False: 110M]
  ------------------
  197|  1.20k|                cflags = DP_C_LLONG;
  ------------------
  |  |   74|  1.20k|#define DP_C_LLONG      4
  ------------------
  198|  1.20k|                ch = *format++;
  199|  1.20k|                break;
  200|      0|            case 'L':
  ------------------
  |  Branch (200:13): [True: 0, False: 110M]
  ------------------
  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: 110M]
  ------------------
  205|      0|                cflags = DP_C_SIZE;
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  206|      0|                ch = *format++;
  207|      0|                break;
  208|  84.8M|            default:
  ------------------
  |  Branch (208:13): [True: 84.8M, False: 25.4M]
  ------------------
  209|  84.8M|                break;
  210|   110M|            }
  211|   110M|            state = DP_S_CONV;
  ------------------
  |  |   51|   110M|#define DP_S_CONV       6
  ------------------
  212|   110M|            break;
  213|   110M|        case DP_S_CONV:
  ------------------
  |  |   51|   110M|#define DP_S_CONV       6
  ------------------
  |  Branch (213:9): [True: 110M, False: 842M]
  ------------------
  214|   110M|            switch (ch) {
  215|  32.6M|            case 'd':
  ------------------
  |  Branch (215:13): [True: 32.6M, False: 77.6M]
  ------------------
  216|  32.6M|            case 'i':
  ------------------
  |  Branch (216:13): [True: 0, False: 110M]
  ------------------
  217|  32.6M|                switch (cflags) {
  218|      0|                case DP_C_SHORT:
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  |  Branch (218:17): [True: 0, False: 32.6M]
  ------------------
  219|      0|                    value = (short int)va_arg(args, int);
  220|      0|                    break;
  221|  24.0M|                case DP_C_LONG:
  ------------------
  |  |   72|  24.0M|#define DP_C_LONG       2
  ------------------
  |  Branch (221:17): [True: 24.0M, False: 8.63M]
  ------------------
  222|  24.0M|                    value = va_arg(args, long int);
  223|  24.0M|                    break;
  224|  1.43k|                case DP_C_LLONG:
  ------------------
  |  |   74|  1.43k|#define DP_C_LLONG      4
  ------------------
  |  Branch (224:17): [True: 1.43k, False: 32.6M]
  ------------------
  225|  1.43k|                    value = va_arg(args, int64_t);
  226|  1.43k|                    break;
  227|      0|                case DP_C_SIZE:
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  |  Branch (227:17): [True: 0, False: 32.6M]
  ------------------
  228|      0|                    value = va_arg(args, ossl_ssize_t);
  229|      0|                    break;
  230|  8.63M|                default:
  ------------------
  |  Branch (230:17): [True: 8.63M, False: 24.0M]
  ------------------
  231|  8.63M|                    value = va_arg(args, int);
  232|  8.63M|                    break;
  233|  32.6M|                }
  234|  32.6M|                if (!fmtint(sbuffer, buffer, &currlen, maxlen, value, 10, min,
  ------------------
  |  Branch (234:21): [True: 0, False: 32.6M]
  ------------------
  235|  32.6M|                            max, flags))
  236|      0|                    return 0;
  237|  32.6M|                break;
  238|  32.6M|            case 'X':
  ------------------
  |  Branch (238:13): [True: 19.0M, False: 91.3M]
  ------------------
  239|  19.0M|                flags |= DP_F_UP;
  ------------------
  |  |   66|  19.0M|#define DP_F_UP         (1 << 5)
  ------------------
  240|       |                /* FALLTHROUGH */
  241|  32.8M|            case 'x':
  ------------------
  |  Branch (241:13): [True: 13.7M, False: 96.5M]
  ------------------
  242|  32.8M|            case 'o':
  ------------------
  |  Branch (242:13): [True: 0, False: 110M]
  ------------------
  243|  34.1M|            case 'u':
  ------------------
  |  Branch (243:13): [True: 1.36M, False: 108M]
  ------------------
  244|  34.1M|                flags |= DP_F_UNSIGNED;
  ------------------
  |  |   68|  34.1M|#define DP_F_UNSIGNED   (1 << 6)
  ------------------
  245|  34.1M|                switch (cflags) {
  246|      0|                case DP_C_SHORT:
  ------------------
  |  |   71|      0|#define DP_C_SHORT      1
  ------------------
  |  Branch (246:17): [True: 0, False: 34.1M]
  ------------------
  247|      0|                    value = (unsigned short int)va_arg(args, unsigned int);
  248|      0|                    break;
  249|  1.39M|                case DP_C_LONG:
  ------------------
  |  |   72|  1.39M|#define DP_C_LONG       2
  ------------------
  |  Branch (249:17): [True: 1.39M, False: 32.7M]
  ------------------
  250|  1.39M|                    value = va_arg(args, unsigned long int);
  251|  1.39M|                    break;
  252|    488|                case DP_C_LLONG:
  ------------------
  |  |   74|    488|#define DP_C_LLONG      4
  ------------------
  |  Branch (252:17): [True: 488, False: 34.1M]
  ------------------
  253|    488|                    value = va_arg(args, uint64_t);
  254|    488|                    break;
  255|      0|                case DP_C_SIZE:
  ------------------
  |  |   75|      0|#define DP_C_SIZE       5
  ------------------
  |  Branch (255:17): [True: 0, False: 34.1M]
  ------------------
  256|      0|                    value = va_arg(args, size_t);
  257|      0|                    break;
  258|  32.7M|                default:
  ------------------
  |  Branch (258:17): [True: 32.7M, False: 1.39M]
  ------------------
  259|  32.7M|                    value = va_arg(args, unsigned int);
  260|  32.7M|                    break;
  261|  34.1M|                }
  262|  34.1M|                if (!fmtint(sbuffer, buffer, &currlen, maxlen, value,
  ------------------
  |  Branch (262:21): [True: 0, False: 34.1M]
  ------------------
  263|  34.1M|                            ch == 'o' ? 8 : (ch == 'u' ? 10 : 16),
  ------------------
  |  Branch (263:29): [True: 0, False: 34.1M]
  |  Branch (263:46): [True: 1.36M, False: 32.8M]
  ------------------
  264|  34.1M|                            min, max, flags))
  265|      0|                    return 0;
  266|  34.1M|                break;
  267|  34.1M|#ifndef OPENSSL_SYS_UEFI
  268|  34.1M|            case 'f':
  ------------------
  |  Branch (268:13): [True: 0, False: 110M]
  ------------------
  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: 110M]
  ------------------
  278|      0|                flags |= DP_F_UP;
  ------------------
  |  |   66|      0|#define DP_F_UP         (1 << 5)
  ------------------
  279|       |                /* fall through */
  280|      0|            case 'e':
  ------------------
  |  Branch (280:13): [True: 0, False: 110M]
  ------------------
  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: 110M]
  ------------------
  290|      0|                flags |= DP_F_UP;
  ------------------
  |  |   66|      0|#define DP_F_UP         (1 << 5)
  ------------------
  291|       |                /* fall through */
  292|      0|            case 'g':
  ------------------
  |  Branch (292:13): [True: 0, False: 110M]
  ------------------
  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|       |                ERR_raise(ERR_LIB_BIO, ERR_R_UNSUPPORTED);
  309|       |                return 0;
  310|       |#endif
  311|  15.2M|            case 'c':
  ------------------
  |  Branch (311:13): [True: 15.2M, False: 95.1M]
  ------------------
  312|  15.2M|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen,
  ------------------
  |  Branch (312:21): [True: 0, False: 15.2M]
  ------------------
  313|  15.2M|                                 va_arg(args, int)))
  314|      0|                    return 0;
  315|  15.2M|                break;
  316|  28.2M|            case 's':
  ------------------
  |  Branch (316:13): [True: 28.2M, False: 82.1M]
  ------------------
  317|  28.2M|                strvalue = va_arg(args, char *);
  318|  28.2M|                if (max < 0) {
  ------------------
  |  Branch (318:21): [True: 28.2M, False: 624]
  ------------------
  319|  28.2M|                    if (buffer)
  ------------------
  |  Branch (319:25): [True: 18.7M, False: 9.44M]
  ------------------
  320|  18.7M|                        max = INT_MAX;
  321|  9.44M|                    else
  322|  9.44M|                        max = *maxlen;
  323|  28.2M|                }
  324|  28.2M|                if (!fmtstr(sbuffer, buffer, &currlen, maxlen, strvalue,
  ------------------
  |  Branch (324:21): [True: 0, False: 28.2M]
  ------------------
  325|  28.2M|                            flags, min, max))
  326|      0|                    return 0;
  327|  28.2M|                break;
  328|  28.2M|            case 'p':
  ------------------
  |  Branch (328:13): [True: 0, False: 110M]
  ------------------
  329|      0|                value = (size_t)va_arg(args, void *);
  330|      0|                if (!fmtint(sbuffer, buffer, &currlen, maxlen,
  ------------------
  |  Branch (330:21): [True: 0, False: 0]
  ------------------
  331|      0|                            value, 16, min, max, flags | DP_F_NUM))
  ------------------
  |  |   62|      0|#define DP_F_NUM        (1 << 3)
  ------------------
  332|      0|                    return 0;
  333|      0|                break;
  334|      0|            case 'n':
  ------------------
  |  Branch (334:13): [True: 0, False: 110M]
  ------------------
  335|      0|                {
  336|      0|                    int *num;
  337|      0|                    num = va_arg(args, int *);
  338|      0|                    *num = currlen;
  339|      0|                }
  340|      0|                break;
  341|      0|            case '%':
  ------------------
  |  Branch (341:13): [True: 0, False: 110M]
  ------------------
  342|      0|                if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch))
  ------------------
  |  Branch (342:21): [True: 0, False: 0]
  ------------------
  343|      0|                    return 0;
  344|      0|                break;
  345|      0|            case 'w':
  ------------------
  |  Branch (345:13): [True: 0, False: 110M]
  ------------------
  346|       |                /* not supported yet, treat as next char */
  347|      0|                format++;
  348|      0|                break;
  349|      0|            default:
  ------------------
  |  Branch (349:13): [True: 0, False: 110M]
  ------------------
  350|       |                /* unknown, skip */
  351|      0|                break;
  352|   110M|            }
  353|   110M|            ch = *format++;
  354|   110M|            state = DP_S_DEFAULT;
  ------------------
  |  |   45|   110M|#define DP_S_DEFAULT    0
  ------------------
  355|   110M|            flags = cflags = min = 0;
  356|   110M|            max = -1;
  357|   110M|            break;
  358|  61.2M|        case DP_S_DONE:
  ------------------
  |  |   52|  61.2M|#define DP_S_DONE       7
  ------------------
  |  Branch (358:9): [True: 61.2M, False: 891M]
  ------------------
  359|  61.2M|            break;
  360|      0|        default:
  ------------------
  |  Branch (360:9): [True: 0, False: 952M]
  ------------------
  361|      0|            break;
  362|   952M|        }
  363|   952M|    }
  364|       |    /*
  365|       |     * We have to truncate if there is no dynamic buffer and we have filled the
  366|       |     * static buffer.
  367|       |     */
  368|  61.2M|    if (buffer == NULL) {
  ------------------
  |  Branch (368:9): [True: 23.7M, False: 37.4M]
  ------------------
  369|  23.7M|        *truncated = (currlen > *maxlen - 1);
  370|  23.7M|        if (*truncated)
  ------------------
  |  Branch (370:13): [True: 0, False: 23.7M]
  ------------------
  371|      0|            currlen = *maxlen - 1;
  372|  23.7M|    }
  373|  61.2M|    if (!doapr_outch(sbuffer, buffer, &currlen, maxlen, '\0'))
  ------------------
  |  Branch (373:9): [True: 0, False: 61.2M]
  ------------------
  374|      0|        return 0;
  375|  61.2M|    *retlen = currlen - 1;
  376|  61.2M|    return 1;
  377|  61.2M|}
bio_print.c:doapr_outch:
  833|   615M|{
  834|       |    /* If we haven't at least one buffer, someone has done a big booboo */
  835|   615M|    if (!ossl_assert(*sbuffer != NULL || buffer != NULL))
  ------------------
  |  |   52|   616M|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 614M, False: 1.15M]
  |  |  |  Branch (52:43): [True: 1.15M, False: 0]
  |  |  ------------------
  |  |   53|   615M|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (835:9): [True: 0, False: 615M]
  ------------------
  836|      0|        return 0;
  837|       |
  838|       |    /* |currlen| must always be <= |*maxlen| */
  839|   615M|    if (!ossl_assert(*currlen <= *maxlen))
  ------------------
  |  |   52|   615M|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|   615M|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (839:9): [True: 0, False: 615M]
  ------------------
  840|      0|        return 0;
  841|       |
  842|   615M|    if (buffer && *currlen == *maxlen) {
  ------------------
  |  Branch (842:9): [True: 285M, False: 330M]
  |  Branch (842:19): [True: 1.15k, False: 285M]
  ------------------
  843|  1.15k|        if (*maxlen > INT_MAX - BUFFER_INC)
  ------------------
  |  |  828|  1.15k|#define BUFFER_INC  1024
  ------------------
  |  Branch (843:13): [True: 0, False: 1.15k]
  ------------------
  844|      0|            return 0;
  845|       |
  846|  1.15k|        *maxlen += BUFFER_INC;
  ------------------
  |  |  828|  1.15k|#define BUFFER_INC  1024
  ------------------
  847|  1.15k|        if (*buffer == NULL) {
  ------------------
  |  Branch (847:13): [True: 30, False: 1.12k]
  ------------------
  848|     30|            if ((*buffer = OPENSSL_malloc(*maxlen)) == NULL)
  ------------------
  |  |   97|     30|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     30|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     30|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (848:17): [True: 0, False: 30]
  ------------------
  849|      0|                return 0;
  850|     30|            if (*currlen > 0) {
  ------------------
  |  Branch (850:17): [True: 30, False: 0]
  ------------------
  851|     30|                if (!ossl_assert(*sbuffer != NULL))
  ------------------
  |  |   52|     30|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     30|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (851:21): [True: 0, False: 30]
  ------------------
  852|      0|                    return 0;
  853|     30|                memcpy(*buffer, *sbuffer, *currlen);
  854|     30|            }
  855|     30|            *sbuffer = NULL;
  856|  1.12k|        } else {
  857|  1.12k|            char *tmpbuf;
  858|       |
  859|  1.12k|            tmpbuf = OPENSSL_realloc(*buffer, *maxlen);
  ------------------
  |  |  101|  1.12k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.12k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.12k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  860|  1.12k|            if (tmpbuf == NULL)
  ------------------
  |  Branch (860:17): [True: 0, False: 1.12k]
  ------------------
  861|      0|                return 0;
  862|  1.12k|            *buffer = tmpbuf;
  863|  1.12k|        }
  864|  1.15k|    }
  865|       |
  866|   615M|    if (*currlen < *maxlen) {
  ------------------
  |  Branch (866:9): [True: 615M, False: 0]
  ------------------
  867|   615M|        if (*sbuffer)
  ------------------
  |  Branch (867:13): [True: 614M, False: 1.15M]
  ------------------
  868|   614M|            (*sbuffer)[(*currlen)++] = (char)c;
  869|  1.15M|        else
  870|  1.15M|            (*buffer)[(*currlen)++] = (char)c;
  871|   615M|    }
  872|       |
  873|   615M|    return 1;
  874|   615M|}
bio_print.c:fmtint:
  436|  66.8M|{
  437|  66.8M|    int signvalue = 0;
  438|  66.8M|    const char *prefix = "";
  439|  66.8M|    uint64_t uvalue;
  440|  66.8M|    char convert[DECIMAL_SIZE(value) + 3];
  441|  66.8M|    int place = 0;
  442|  66.8M|    int spadlen = 0;
  443|  66.8M|    int zpadlen = 0;
  444|  66.8M|    int caps = 0;
  445|       |
  446|  66.8M|    if (max < 0)
  ------------------
  |  Branch (446:9): [True: 66.8M, False: 0]
  ------------------
  447|  66.8M|        max = 0;
  448|  66.8M|    uvalue = value;
  449|  66.8M|    if (!(flags & DP_F_UNSIGNED)) {
  ------------------
  |  |   68|  66.8M|#define DP_F_UNSIGNED   (1 << 6)
  ------------------
  |  Branch (449:9): [True: 32.6M, False: 34.1M]
  ------------------
  450|  32.6M|        if (value < 0) {
  ------------------
  |  Branch (450:13): [True: 1.04k, False: 32.6M]
  ------------------
  451|  1.04k|            signvalue = '-';
  452|  1.04k|            uvalue = 0 - (uint64_t)value;
  453|  32.6M|        } else if (flags & DP_F_PLUS)
  ------------------
  |  |   58|  32.6M|#define DP_F_PLUS       (1 << 1)
  ------------------
  |  Branch (453:20): [True: 0, False: 32.6M]
  ------------------
  454|      0|            signvalue = '+';
  455|  32.6M|        else if (flags & DP_F_SPACE)
  ------------------
  |  |   60|  32.6M|#define DP_F_SPACE      (1 << 2)
  ------------------
  |  Branch (455:18): [True: 0, False: 32.6M]
  ------------------
  456|      0|            signvalue = ' ';
  457|  32.6M|    }
  458|  66.8M|    if (flags & DP_F_NUM) {
  ------------------
  |  |   62|  66.8M|#define DP_F_NUM        (1 << 3)
  ------------------
  |  Branch (458:9): [True: 0, False: 66.8M]
  ------------------
  459|      0|        if (base == 8)
  ------------------
  |  Branch (459:13): [True: 0, False: 0]
  ------------------
  460|      0|            prefix = "0";
  461|      0|        if (base == 16)
  ------------------
  |  Branch (461:13): [True: 0, False: 0]
  ------------------
  462|      0|            prefix = "0x";
  463|      0|    }
  464|  66.8M|    if (flags & DP_F_UP)
  ------------------
  |  |   66|  66.8M|#define DP_F_UP         (1 << 5)
  ------------------
  |  Branch (464:9): [True: 19.0M, False: 47.8M]
  ------------------
  465|  19.0M|        caps = 1;
  466|   126M|    do {
  467|   126M|        convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
  ------------------
  |  Branch (467:29): [True: 28.7M, False: 97.3M]
  ------------------
  468|   126M|            [uvalue % (unsigned)base];
  469|   126M|        uvalue = (uvalue / (unsigned)base);
  470|   126M|    } while (uvalue && (place < (int)sizeof(convert)));
  ------------------
  |  Branch (470:14): [True: 59.2M, False: 66.8M]
  |  Branch (470:24): [True: 59.2M, False: 0]
  ------------------
  471|  66.8M|    if (place == sizeof(convert))
  ------------------
  |  Branch (471:9): [True: 0, False: 66.8M]
  ------------------
  472|      0|        place--;
  473|  66.8M|    convert[place] = 0;
  474|       |
  475|  66.8M|    zpadlen = max - place;
  476|  66.8M|    spadlen =
  477|  66.8M|        min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix);
  ------------------
  |  |   84|  66.8M|#define OSSL_MAX(p,q) ((p >= q) ? p : q)
  |  |  ------------------
  |  |  |  Branch (84:24): [True: 0, False: 66.8M]
  |  |  ------------------
  ------------------
  |  Branch (477:39): [True: 1.04k, False: 66.8M]
  ------------------
  478|  66.8M|    if (zpadlen < 0)
  ------------------
  |  Branch (478:9): [True: 66.8M, False: 0]
  ------------------
  479|  66.8M|        zpadlen = 0;
  480|  66.8M|    if (spadlen < 0)
  ------------------
  |  Branch (480:9): [True: 14.9M, False: 51.9M]
  ------------------
  481|  14.9M|        spadlen = 0;
  482|  66.8M|    if (flags & DP_F_ZERO) {
  ------------------
  |  |   64|  66.8M|#define DP_F_ZERO       (1 << 4)
  ------------------
  |  Branch (482:9): [True: 32.7M, False: 34.0M]
  ------------------
  483|  32.7M|        zpadlen = OSSL_MAX(zpadlen, spadlen);
  ------------------
  |  |   84|  32.7M|#define OSSL_MAX(p,q) ((p >= q) ? p : q)
  |  |  ------------------
  |  |  |  Branch (84:24): [True: 20.8M, False: 11.9M]
  |  |  ------------------
  ------------------
  484|  32.7M|        spadlen = 0;
  485|  32.7M|    }
  486|  66.8M|    if (flags & DP_F_MINUS)
  ------------------
  |  |   56|  66.8M|#define DP_F_MINUS      (1 << 0)
  ------------------
  |  Branch (486:9): [True: 8.43M, False: 58.4M]
  ------------------
  487|  8.43M|        spadlen = -spadlen;
  488|       |
  489|       |    /* spaces */
  490|  92.6M|    while (spadlen > 0) {
  ------------------
  |  Branch (490:12): [True: 25.7M, False: 66.8M]
  ------------------
  491|  25.7M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (491:13): [True: 0, False: 25.7M]
  ------------------
  492|      0|            return 0;
  493|  25.7M|        --spadlen;
  494|  25.7M|    }
  495|       |
  496|       |    /* sign */
  497|  66.8M|    if (signvalue)
  ------------------
  |  Branch (497:9): [True: 1.04k, False: 66.8M]
  ------------------
  498|  1.04k|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue))
  ------------------
  |  Branch (498:13): [True: 0, False: 1.04k]
  ------------------
  499|      0|            return 0;
  500|       |
  501|       |    /* prefix */
  502|  66.8M|    while (*prefix) {
  ------------------
  |  Branch (502:12): [True: 0, False: 66.8M]
  ------------------
  503|      0|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix))
  ------------------
  |  Branch (503:13): [True: 0, False: 0]
  ------------------
  504|      0|            return 0;
  505|      0|        prefix++;
  506|      0|    }
  507|       |
  508|       |    /* zeros */
  509|  66.8M|    if (zpadlen > 0) {
  ------------------
  |  Branch (509:9): [True: 11.9M, False: 54.9M]
  ------------------
  510|  23.9M|        while (zpadlen > 0) {
  ------------------
  |  Branch (510:16): [True: 11.9M, False: 11.9M]
  ------------------
  511|  11.9M|            if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0'))
  ------------------
  |  Branch (511:17): [True: 0, False: 11.9M]
  ------------------
  512|      0|                return 0;
  513|  11.9M|            --zpadlen;
  514|  11.9M|        }
  515|  11.9M|    }
  516|       |    /* digits */
  517|   192M|    while (place > 0) {
  ------------------
  |  Branch (517:12): [True: 126M, False: 66.8M]
  ------------------
  518|   126M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place]))
  ------------------
  |  Branch (518:13): [True: 0, False: 126M]
  ------------------
  519|      0|            return 0;
  520|   126M|    }
  521|       |
  522|       |    /* left justified spaces */
  523|  74.8M|    while (spadlen < 0) {
  ------------------
  |  Branch (523:12): [True: 7.94M, False: 66.8M]
  ------------------
  524|  7.94M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (524:13): [True: 0, False: 7.94M]
  ------------------
  525|      0|            return 0;
  526|  7.94M|        ++spadlen;
  527|  7.94M|    }
  528|  66.8M|    return 1;
  529|  66.8M|}
bio_print.c:fmtstr:
  384|  28.2M|{
  385|  28.2M|    int padlen;
  386|  28.2M|    size_t strln;
  387|  28.2M|    int cnt = 0;
  388|       |
  389|  28.2M|    if (value == 0)
  ------------------
  |  Branch (389:9): [True: 227, False: 28.2M]
  ------------------
  390|    227|        value = "<NULL>";
  391|       |
  392|  28.2M|    strln = OPENSSL_strnlen(value, max < 0 ? SIZE_MAX : (size_t)max);
  ------------------
  |  Branch (392:36): [True: 0, False: 28.2M]
  ------------------
  393|       |
  394|  28.2M|    padlen = min - strln;
  395|  28.2M|    if (min < 0 || padlen < 0)
  ------------------
  |  Branch (395:9): [True: 0, False: 28.2M]
  |  Branch (395:20): [True: 10.1M, False: 18.1M]
  ------------------
  396|  10.1M|        padlen = 0;
  397|  28.2M|    if (max >= 0) {
  ------------------
  |  Branch (397:9): [True: 28.2M, False: 0]
  ------------------
  398|       |        /*
  399|       |         * Calculate the maximum output including padding.
  400|       |         * Make sure max doesn't overflow into negativity
  401|       |         */
  402|  28.2M|        if (max < INT_MAX - padlen)
  ------------------
  |  Branch (402:13): [True: 9.44M, False: 18.7M]
  ------------------
  403|  9.44M|            max += padlen;
  404|  18.7M|        else
  405|  18.7M|            max = INT_MAX;
  406|  28.2M|    }
  407|  28.2M|    if (flags & DP_F_MINUS)
  ------------------
  |  |   56|  28.2M|#define DP_F_MINUS      (1 << 0)
  ------------------
  |  Branch (407:9): [True: 8.43M, False: 19.8M]
  ------------------
  408|  8.43M|        padlen = -padlen;
  409|       |
  410|  80.4M|    while ((padlen > 0) && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (410:12): [True: 52.1M, False: 28.2M]
  |  Branch (410:29): [True: 0, False: 52.1M]
  |  Branch (410:40): [True: 52.1M, False: 0]
  ------------------
  411|  52.1M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (411:13): [True: 0, False: 52.1M]
  ------------------
  412|      0|            return 0;
  413|  52.1M|        --padlen;
  414|  52.1M|        ++cnt;
  415|  52.1M|    }
  416|   126M|    while (strln > 0 && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (416:12): [True: 98.2M, False: 28.2M]
  |  Branch (416:26): [True: 0, False: 98.2M]
  |  Branch (416:37): [True: 98.2M, False: 0]
  ------------------
  417|  98.2M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *value++))
  ------------------
  |  Branch (417:13): [True: 0, False: 98.2M]
  ------------------
  418|      0|            return 0;
  419|  98.2M|        --strln;
  420|  98.2M|        ++cnt;
  421|  98.2M|    }
  422|   138M|    while ((padlen < 0) && (max < 0 || cnt < max)) {
  ------------------
  |  Branch (422:12): [True: 110M, False: 28.2M]
  |  Branch (422:29): [True: 0, False: 110M]
  |  Branch (422:40): [True: 110M, False: 0]
  ------------------
  423|   110M|        if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' '))
  ------------------
  |  Branch (423:13): [True: 0, False: 110M]
  ------------------
  424|      0|            return 0;
  425|   110M|        ++padlen;
  426|   110M|        ++cnt;
  427|   110M|    }
  428|  28.2M|    return 1;
  429|  28.2M|}

bio_sock_cleanup_int:
  204|      2|{
  205|       |# ifdef OPENSSL_SYS_WINDOWS
  206|       |    if (wsa_init_done) {
  207|       |        wsa_init_done = 0;
  208|       |        WSACleanup();
  209|       |    }
  210|       |# endif
  211|      2|}

ossl_bio_core_globals_free:
   26|      2|{
   27|      2|    OPENSSL_free(vbcg);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   28|      2|}
ossl_bio_core_globals_new:
   31|      4|{
   32|      4|    return OPENSSL_zalloc(sizeof(BIO_CORE_GLOBALS));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   33|      4|}

BIO_new_file:
   58|      2|{
   59|      2|    BIO  *ret;
   60|      2|    FILE *file = openssl_fopen(filename, mode);
   61|      2|    int fp_flags = BIO_CLOSE;
  ------------------
  |  |   80|      2|# define BIO_CLOSE               0x01
  ------------------
   62|       |
   63|      2|    if (strchr(mode, 'b') == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 2]
  ------------------
   64|      0|        fp_flags |= BIO_FP_TEXT;
  ------------------
  |  |  214|      0|# define BIO_FP_TEXT             0x10
  ------------------
   65|       |
   66|      2|    if (file == NULL) {
  ------------------
  |  Branch (66:9): [True: 2, False: 0]
  ------------------
   67|      2|        ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      2|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |   72|      2|# define ERR_LIB_SYS             2
  ------------------
                      ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |   30|      2|# define get_last_sys_error()    errno
  ------------------
   68|      2|                       "calling fopen(%s, %s)",
   69|      2|                       filename, mode);
   70|      2|        if (errno == ENOENT
  ------------------
  |  Branch (70:13): [True: 2, False: 0]
  ------------------
   71|      2|#ifdef ENXIO
   72|      2|            || errno == ENXIO
  ------------------
  |  Branch (72:16): [True: 0, False: 0]
  ------------------
   73|      2|#endif
   74|      2|            )
   75|      2|            ERR_raise(ERR_LIB_BIO, BIO_R_NO_SUCH_FILE);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
   76|      0|        else
   77|      2|            ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   78|      2|        return NULL;
   79|      2|    }
   80|      0|    if ((ret = BIO_new(BIO_s_file())) == NULL) {
  ------------------
  |  Branch (80:9): [True: 0, False: 0]
  ------------------
   81|      0|        fclose(file);
   82|      0|        return NULL;
   83|      0|    }
   84|       |
   85|       |    /* we did fopen -> we disengage UPLINK */
   86|      0|    BIO_clear_flags(ret, BIO_FLAGS_UPLINK_INTERNAL);
  ------------------
  |  |   18|      0|#  define BIO_FLAGS_UPLINK_INTERNAL 0
  ------------------
   87|      0|    BIO_set_fp(ret, file, fp_flags);
  ------------------
  |  |  559|      0|# define BIO_set_fp(b,fp,c)      BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp))
  |  |  ------------------
  |  |  |  |  431|      0|# define BIO_C_SET_FILE_PTR                      106
  |  |  ------------------
  ------------------
   88|      0|    return ret;
   89|      0|}

BIO_s_mem:
   73|  78.1k|{
   74|  78.1k|    return &mem_method;
   75|  78.1k|}
BIO_new_mem_buf:
   83|  76.4k|{
   84|  76.4k|    BIO *ret;
   85|  76.4k|    BUF_MEM *b;
   86|  76.4k|    BIO_BUF_MEM *bb;
   87|  76.4k|    size_t sz;
   88|       |
   89|  76.4k|    if (buf == NULL) {
  ------------------
  |  Branch (89:9): [True: 0, False: 76.4k]
  ------------------
   90|      0|        ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   91|      0|        return NULL;
   92|      0|    }
   93|  76.4k|    sz = (len < 0) ? strlen(buf) : (size_t)len;
  ------------------
  |  Branch (93:10): [True: 0, False: 76.4k]
  ------------------
   94|  76.4k|    if ((ret = BIO_new(BIO_s_mem())) == NULL)
  ------------------
  |  Branch (94:9): [True: 0, False: 76.4k]
  ------------------
   95|      0|        return NULL;
   96|  76.4k|    bb = (BIO_BUF_MEM *)ret->ptr;
   97|  76.4k|    b = bb->buf;
   98|       |    /* Cast away const and trust in the MEM_RDONLY flag. */
   99|  76.4k|    b->data = (void *)buf;
  100|  76.4k|    b->length = sz;
  101|  76.4k|    b->max = sz;
  102|  76.4k|    *bb->readp = *bb->buf;
  103|  76.4k|    ret->flags |= BIO_FLAGS_MEM_RDONLY;
  ------------------
  |  |  233|  76.4k|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  104|       |    /* Since this is static data retrying won't help */
  105|  76.4k|    ret->num = 0;
  106|  76.4k|    return ret;
  107|  76.4k|}
bss_mem.c:mem_write:
  215|  1.30k|{
  216|  1.30k|    int ret = -1;
  217|  1.30k|    int blen;
  218|  1.30k|    BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr;
  219|       |
  220|  1.30k|    if (b->flags & BIO_FLAGS_MEM_RDONLY) {
  ------------------
  |  |  233|  1.30k|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  |  Branch (220:9): [True: 0, False: 1.30k]
  ------------------
  221|      0|        ERR_raise(ERR_LIB_BIO, BIO_R_WRITE_TO_READ_ONLY_BIO);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  222|      0|        goto end;
  223|      0|    }
  224|  1.30k|    BIO_clear_retry_flags(b);
  ------------------
  |  |  257|  1.30k|                BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
  |  |  ------------------
  |  |  |  |  219|  1.30k|# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  216|  1.30k|# define BIO_FLAGS_READ          0x01
  |  |  |  |  ------------------
  |  |  |  |               # define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|  1.30k|# define BIO_FLAGS_WRITE         0x02
  |  |  |  |  ------------------
  |  |  |  |               # define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  218|  1.30k|# define BIO_FLAGS_IO_SPECIAL    0x04
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                               BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
  |  |  ------------------
  |  |  |  |  220|  1.30k|# define BIO_FLAGS_SHOULD_RETRY  0x08
  |  |  ------------------
  ------------------
  225|  1.30k|    if (inl == 0)
  ------------------
  |  Branch (225:9): [True: 0, False: 1.30k]
  ------------------
  226|      0|        return 0;
  227|  1.30k|    if (in == NULL) {
  ------------------
  |  Branch (227:9): [True: 0, False: 1.30k]
  ------------------
  228|      0|        ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  229|      0|        goto end;
  230|      0|    }
  231|  1.30k|    blen = bbm->readp->length;
  232|  1.30k|    mem_buf_sync(b);
  233|  1.30k|    if (BUF_MEM_grow_clean(bbm->buf, blen + inl) == 0)
  ------------------
  |  Branch (233:9): [True: 0, False: 1.30k]
  ------------------
  234|      0|        goto end;
  235|  1.30k|    memcpy(bbm->buf->data + blen, in, inl);
  236|  1.30k|    *bbm->readp = *bbm->buf;
  237|  1.30k|    ret = inl;
  238|  1.30k| end:
  239|  1.30k|    return ret;
  240|  1.30k|}
bss_mem.c:mem_buf_sync:
  178|  2.60k|{
  179|  2.60k|    if (b != NULL && b->init != 0 && b->ptr != NULL) {
  ------------------
  |  Branch (179:9): [True: 2.60k, False: 0]
  |  Branch (179:22): [True: 2.60k, False: 0]
  |  Branch (179:38): [True: 2.60k, False: 0]
  ------------------
  180|  2.60k|        BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr;
  181|       |
  182|  2.60k|        if (bbm->readp->data != bbm->buf->data) {
  ------------------
  |  Branch (182:13): [True: 0, False: 2.60k]
  ------------------
  183|      0|            memmove(bbm->buf->data, bbm->readp->data, bbm->readp->length);
  184|      0|            bbm->buf->length = bbm->readp->length;
  185|      0|            bbm->readp->data = bbm->buf->data;
  186|      0|        }
  187|  2.60k|    }
  188|  2.60k|    return 0;
  189|  2.60k|}
bss_mem.c:mem_read:
  192|   120M|{
  193|   120M|    int ret = -1;
  194|   120M|    BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr;
  195|   120M|    BUF_MEM *bm = bbm->readp;
  196|       |
  197|   120M|    if (b->flags & BIO_FLAGS_MEM_RDONLY)
  ------------------
  |  |  233|   120M|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  |  Branch (197:9): [True: 120M, False: 0]
  ------------------
  198|   120M|        bm = bbm->buf;
  199|   120M|    BIO_clear_retry_flags(b);
  ------------------
  |  |  257|   120M|                BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
  |  |  ------------------
  |  |  |  |  219|   120M|# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  216|   120M|# define BIO_FLAGS_READ          0x01
  |  |  |  |  ------------------
  |  |  |  |               # define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|   120M|# define BIO_FLAGS_WRITE         0x02
  |  |  |  |  ------------------
  |  |  |  |               # define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  218|   120M|# define BIO_FLAGS_IO_SPECIAL    0x04
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                               BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
  |  |  ------------------
  |  |  |  |  220|   120M|# define BIO_FLAGS_SHOULD_RETRY  0x08
  |  |  ------------------
  ------------------
  200|   120M|    ret = (outl >= 0 && (size_t)outl > bm->length) ? (int)bm->length : outl;
  ------------------
  |  Branch (200:12): [True: 120M, False: 0]
  |  Branch (200:25): [True: 287k, False: 120M]
  ------------------
  201|   120M|    if ((out != NULL) && (ret > 0)) {
  ------------------
  |  Branch (201:9): [True: 120M, False: 0]
  |  Branch (201:26): [True: 120M, False: 181k]
  ------------------
  202|   120M|        memcpy(out, bm->data, ret);
  203|   120M|        bm->length -= ret;
  204|   120M|        bm->max -= ret;
  205|   120M|        bm->data += ret;
  206|   120M|    } else if (bm->length == 0) {
  ------------------
  |  Branch (206:16): [True: 181k, False: 0]
  ------------------
  207|   181k|        ret = b->num;
  208|   181k|        if (ret != 0)
  ------------------
  |  Branch (208:13): [True: 0, False: 181k]
  ------------------
  209|      0|            BIO_set_retry_read(b);
  ------------------
  |  |  251|      0|                BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
  |  |  ------------------
  |  |  |  |  216|      0|# define BIO_FLAGS_READ          0x01
  |  |  ------------------
  |  |                               BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
  |  |  ------------------
  |  |  |  |  220|      0|# define BIO_FLAGS_SHOULD_RETRY  0x08
  |  |  ------------------
  ------------------
  210|   181k|    }
  211|   120M|    return ret;
  212|   120M|}
bss_mem.c:mem_ctrl:
  243|   665k|{
  244|   665k|    long ret = 1;
  245|   665k|    char **pptr;
  246|   665k|    BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr;
  247|   665k|    BUF_MEM *bm, *bo;            /* bio_mem, bio_other */
  248|   665k|    long off, remain;
  249|       |
  250|   665k|    if (b->flags & BIO_FLAGS_MEM_RDONLY) {
  ------------------
  |  |  233|   665k|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  |  Branch (250:9): [True: 663k, False: 1.30k]
  ------------------
  251|   663k|        bm = bbm->buf;
  252|   663k|        bo = bbm->readp;
  253|   663k|    } else {
  254|  1.30k|        bm = bbm->readp;
  255|  1.30k|        bo = bbm->buf;
  256|  1.30k|    }
  257|   665k|    off = (bm->data == bo->data) ? 0 : bm->data - bo->data;
  ------------------
  |  Branch (257:11): [True: 460k, False: 205k]
  ------------------
  258|   665k|    remain = bm->length;
  259|       |
  260|   665k|    switch (cmd) {
  261|      0|    case BIO_CTRL_RESET:
  ------------------
  |  |   85|      0|# define BIO_CTRL_RESET          1/* opt - rewind/zero etc */
  ------------------
  |  Branch (261:5): [True: 0, False: 665k]
  ------------------
  262|      0|        bm = bbm->buf;
  263|      0|        if (bm->data != NULL) {
  ------------------
  |  Branch (263:13): [True: 0, False: 0]
  ------------------
  264|      0|            if (!(b->flags & BIO_FLAGS_MEM_RDONLY)) {
  ------------------
  |  |  233|      0|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  |  Branch (264:17): [True: 0, False: 0]
  ------------------
  265|      0|                if (!(b->flags & BIO_FLAGS_NONCLEAR_RST)) {
  ------------------
  |  |  234|      0|# define BIO_FLAGS_NONCLEAR_RST  0x400
  ------------------
  |  Branch (265:21): [True: 0, False: 0]
  ------------------
  266|      0|                    memset(bm->data, 0, bm->max);
  267|      0|                    bm->length = 0;
  268|      0|                }
  269|      0|                *bbm->readp = *bbm->buf;
  270|      0|            } else {
  271|       |                /* For read only case just reset to the start again */
  272|      0|                *bbm->buf = *bbm->readp;
  273|      0|            }
  274|      0|        }
  275|      0|        break;
  276|   264k|    case BIO_C_FILE_SEEK:
  ------------------
  |  |  453|   264k|# define BIO_C_FILE_SEEK                         128
  ------------------
  |  Branch (276:5): [True: 264k, False: 400k]
  ------------------
  277|   264k|        if (num < 0 || num > off + remain)
  ------------------
  |  Branch (277:13): [True: 0, False: 264k]
  |  Branch (277:24): [True: 0, False: 264k]
  ------------------
  278|      0|            return -1;   /* Can't see outside of the current buffer */
  279|       |
  280|   264k|        bm->data = (num != 0) ? bo->data + num : bo->data;
  ------------------
  |  Branch (280:20): [True: 0, False: 264k]
  ------------------
  281|   264k|        bm->length = bo->length - num;
  282|   264k|        bm->max = bo->max - num;
  283|   264k|        off = num;
  284|       |        /* FALLTHRU */
  285|   648k|    case BIO_C_FILE_TELL:
  ------------------
  |  |  459|   648k|# define BIO_C_FILE_TELL                         133
  ------------------
  |  Branch (285:5): [True: 384k, False: 280k]
  ------------------
  286|   648k|        ret = off;
  287|   648k|        break;
  288|      0|    case BIO_CTRL_EOF:
  ------------------
  |  |   86|      0|# define BIO_CTRL_EOF            2/* opt - are we at the eof */
  ------------------
  |  Branch (288:5): [True: 0, False: 665k]
  ------------------
  289|      0|        ret = (long)(bm->length == 0);
  290|      0|        break;
  291|      0|    case BIO_C_SET_BUF_MEM_EOF_RETURN:
  ------------------
  |  |  455|      0|# define BIO_C_SET_BUF_MEM_EOF_RETURN            130/* return end of input
  ------------------
  |  Branch (291:5): [True: 0, False: 665k]
  ------------------
  292|      0|        b->num = (int)num;
  293|      0|        break;
  294|  15.0k|    case BIO_CTRL_INFO:
  ------------------
  |  |   87|  15.0k|# define BIO_CTRL_INFO           3/* opt - extra tit-bits */
  ------------------
  |  Branch (294:5): [True: 15.0k, False: 650k]
  ------------------
  295|  15.0k|        ret = (long)bm->length;
  296|  15.0k|        if (ptr != NULL) {
  ------------------
  |  Branch (296:13): [True: 15.0k, False: 0]
  ------------------
  297|  15.0k|            pptr = (char **)ptr;
  298|  15.0k|            *pptr = (char *)(bm->data);
  299|  15.0k|        }
  300|  15.0k|        break;
  301|      0|    case BIO_C_SET_BUF_MEM:
  ------------------
  |  |  439|      0|# define BIO_C_SET_BUF_MEM                       114
  ------------------
  |  Branch (301:5): [True: 0, False: 665k]
  ------------------
  302|      0|        mem_buf_free(b);
  303|      0|        b->shutdown = (int)num;
  304|      0|        bbm->buf = ptr;
  305|      0|        *bbm->readp = *bbm->buf;
  306|      0|        break;
  307|  1.30k|    case BIO_C_GET_BUF_MEM_PTR:
  ------------------
  |  |  440|  1.30k|# define BIO_C_GET_BUF_MEM_PTR                   115
  ------------------
  |  Branch (307:5): [True: 1.30k, False: 663k]
  ------------------
  308|  1.30k|        if (ptr != NULL) {
  ------------------
  |  Branch (308:13): [True: 1.30k, False: 0]
  ------------------
  309|  1.30k|            if (!(b->flags & BIO_FLAGS_MEM_RDONLY))
  ------------------
  |  |  233|  1.30k|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  |  Branch (309:17): [True: 1.30k, False: 0]
  ------------------
  310|  1.30k|                mem_buf_sync(b);
  311|  1.30k|            bm = bbm->buf;
  312|  1.30k|            pptr = (char **)ptr;
  313|  1.30k|            *pptr = (char *)bm;
  314|  1.30k|        }
  315|  1.30k|        break;
  316|      0|    case BIO_CTRL_GET_CLOSE:
  ------------------
  |  |   92|      0|# define BIO_CTRL_GET_CLOSE      8/* man - set the 'close' on free */
  ------------------
  |  Branch (316:5): [True: 0, False: 665k]
  ------------------
  317|      0|        ret = (long)b->shutdown;
  318|      0|        break;
  319|      0|    case BIO_CTRL_SET_CLOSE:
  ------------------
  |  |   93|      0|# define BIO_CTRL_SET_CLOSE      9/* man - set the 'close' on free */
  ------------------
  |  Branch (319:5): [True: 0, False: 665k]
  ------------------
  320|      0|        b->shutdown = (int)num;
  321|      0|        break;
  322|      0|    case BIO_CTRL_WPENDING:
  ------------------
  |  |   97|      0|# define BIO_CTRL_WPENDING       13/* opt - number of bytes still to write */
  ------------------
  |  Branch (322:5): [True: 0, False: 665k]
  ------------------
  323|      0|        ret = 0L;
  324|      0|        break;
  325|      0|    case BIO_CTRL_PENDING:
  ------------------
  |  |   94|      0|# define BIO_CTRL_PENDING        10/* opt - is their more data buffered */
  ------------------
  |  Branch (325:5): [True: 0, False: 665k]
  ------------------
  326|      0|        ret = (long)bm->length;
  327|      0|        break;
  328|      0|    case BIO_CTRL_DUP:
  ------------------
  |  |   96|      0|# define BIO_CTRL_DUP            12/* man - extra stuff for 'duped' BIO */
  ------------------
  |  Branch (328:5): [True: 0, False: 665k]
  ------------------
  329|      0|    case BIO_CTRL_FLUSH:
  ------------------
  |  |   95|      0|# define BIO_CTRL_FLUSH          11/* opt - 'flush' buffered output */
  ------------------
  |  Branch (329:5): [True: 0, False: 665k]
  ------------------
  330|      0|        ret = 1;
  331|      0|        break;
  332|      0|    case BIO_CTRL_PUSH:
  ------------------
  |  |   90|      0|# define BIO_CTRL_PUSH           6/* opt - internal, used to signify change */
  ------------------
  |  Branch (332:5): [True: 0, False: 665k]
  ------------------
  333|      0|    case BIO_CTRL_POP:
  ------------------
  |  |   91|      0|# define BIO_CTRL_POP            7/* opt - internal, used to signify change */
  ------------------
  |  Branch (333:5): [True: 0, False: 665k]
  ------------------
  334|      0|    default:
  ------------------
  |  Branch (334:5): [True: 0, False: 665k]
  ------------------
  335|      0|        ret = 0;
  336|      0|        break;
  337|   665k|    }
  338|   665k|    return ret;
  339|   665k|}
bss_mem.c:mem_buf_free:
  158|  78.1k|{
  159|  78.1k|    if (a == NULL)
  ------------------
  |  Branch (159:9): [True: 0, False: 78.1k]
  ------------------
  160|      0|        return 0;
  161|       |
  162|  78.1k|    if (a->shutdown && a->init && a->ptr != NULL) {
  ------------------
  |  Branch (162:9): [True: 78.1k, False: 0]
  |  Branch (162:24): [True: 78.1k, False: 0]
  |  Branch (162:35): [True: 78.1k, False: 0]
  ------------------
  163|  78.1k|        BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr;
  164|  78.1k|        BUF_MEM *b = bb->buf;
  165|       |
  166|  78.1k|        if (a->flags & BIO_FLAGS_MEM_RDONLY)
  ------------------
  |  |  233|  78.1k|# define BIO_FLAGS_MEM_RDONLY    0x200
  ------------------
  |  Branch (166:13): [True: 76.4k, False: 1.63k]
  ------------------
  167|  76.4k|            b->data = NULL;
  168|  78.1k|        BUF_MEM_free(b);
  169|  78.1k|    }
  170|  78.1k|    return 1;
  171|  78.1k|}
bss_mem.c:mem_new:
  133|  78.1k|{
  134|  78.1k|    return mem_init(bi, 0L);
  135|  78.1k|}
bss_mem.c:mem_init:
  110|  78.1k|{
  111|  78.1k|    BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
  ------------------
  |  |   99|  78.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  112|       |
  113|  78.1k|    if (bb == NULL)
  ------------------
  |  Branch (113:9): [True: 0, False: 78.1k]
  ------------------
  114|      0|        return 0;
  115|  78.1k|    if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL) {
  ------------------
  |  Branch (115:9): [True: 0, False: 78.1k]
  ------------------
  116|      0|        OPENSSL_free(bb);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  117|      0|        return 0;
  118|      0|    }
  119|  78.1k|    if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL) {
  ------------------
  |  |   99|  78.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (119:9): [True: 0, False: 78.1k]
  ------------------
  120|      0|        BUF_MEM_free(bb->buf);
  121|      0|        OPENSSL_free(bb);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  122|      0|        return 0;
  123|      0|    }
  124|  78.1k|    *bb->readp = *bb->buf;
  125|  78.1k|    bi->shutdown = 1;
  126|  78.1k|    bi->init = 1;
  127|  78.1k|    bi->num = -1;
  128|  78.1k|    bi->ptr = (char *)bb;
  129|  78.1k|    return 1;
  130|  78.1k|}
bss_mem.c:mem_free:
  143|  78.1k|{
  144|  78.1k|    BIO_BUF_MEM *bb;
  145|       |
  146|  78.1k|    if (a == NULL)
  ------------------
  |  Branch (146:9): [True: 0, False: 78.1k]
  ------------------
  147|      0|        return 0;
  148|       |
  149|  78.1k|    bb = (BIO_BUF_MEM *)a->ptr;
  150|  78.1k|    if (!mem_buf_free(a))
  ------------------
  |  Branch (150:9): [True: 0, False: 78.1k]
  ------------------
  151|      0|        return 0;
  152|  78.1k|    OPENSSL_free(bb->readp);
  ------------------
  |  |  107|  78.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  153|  78.1k|    OPENSSL_free(bb);
  ------------------
  |  |  107|  78.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  154|  78.1k|    return 1;
  155|  78.1k|}

BIO_s_null:
   36|  47.4k|{
   37|  47.4k|    return &null_method;
   38|  47.4k|}
bss_null.c:null_write:
   46|  66.3M|{
   47|  66.3M|    return inl;
   48|  66.3M|}
bss_null.c:null_puts:
   81|  1.84M|{
   82|  1.84M|    if (str == NULL)
  ------------------
  |  Branch (82:9): [True: 0, False: 1.84M]
  ------------------
   83|      0|        return 0;
   84|  1.84M|    return strlen(str);
   85|  1.84M|}
bss_null.c:null_ctrl:
   51|  25.2M|{
   52|  25.2M|    long ret = 1;
   53|       |
   54|  25.2M|    switch (cmd) {
   55|      0|    case BIO_CTRL_RESET:
  ------------------
  |  |   85|      0|# define BIO_CTRL_RESET          1/* opt - rewind/zero etc */
  ------------------
  |  Branch (55:5): [True: 0, False: 25.2M]
  ------------------
   56|      0|    case BIO_CTRL_EOF:
  ------------------
  |  |   86|      0|# define BIO_CTRL_EOF            2/* opt - are we at the eof */
  ------------------
  |  Branch (56:5): [True: 0, False: 25.2M]
  ------------------
   57|      0|    case BIO_CTRL_SET:
  ------------------
  |  |   88|      0|# define BIO_CTRL_SET            4/* man - set the 'IO' type */
  ------------------
  |  Branch (57:5): [True: 0, False: 25.2M]
  ------------------
   58|      0|    case BIO_CTRL_SET_CLOSE:
  ------------------
  |  |   93|      0|# define BIO_CTRL_SET_CLOSE      9/* man - set the 'close' on free */
  ------------------
  |  Branch (58:5): [True: 0, False: 25.2M]
  ------------------
   59|      0|    case BIO_CTRL_FLUSH:
  ------------------
  |  |   95|      0|# define BIO_CTRL_FLUSH          11/* opt - 'flush' buffered output */
  ------------------
  |  Branch (59:5): [True: 0, False: 25.2M]
  ------------------
   60|      0|    case BIO_CTRL_DUP:
  ------------------
  |  |   96|      0|# define BIO_CTRL_DUP            12/* man - extra stuff for 'duped' BIO */
  ------------------
  |  Branch (60:5): [True: 0, False: 25.2M]
  ------------------
   61|      0|        ret = 1;
   62|      0|        break;
   63|      0|    case BIO_CTRL_GET_CLOSE:
  ------------------
  |  |   92|      0|# define BIO_CTRL_GET_CLOSE      8/* man - set the 'close' on free */
  ------------------
  |  Branch (63:5): [True: 0, False: 25.2M]
  ------------------
   64|      0|    case BIO_CTRL_INFO:
  ------------------
  |  |   87|      0|# define BIO_CTRL_INFO           3/* opt - extra tit-bits */
  ------------------
  |  Branch (64:5): [True: 0, False: 25.2M]
  ------------------
   65|      0|    case BIO_CTRL_GET:
  ------------------
  |  |   89|      0|# define BIO_CTRL_GET            5/* man - get the 'IO' type */
  ------------------
  |  Branch (65:5): [True: 0, False: 25.2M]
  ------------------
   66|      0|    case BIO_CTRL_PENDING:
  ------------------
  |  |   94|      0|# define BIO_CTRL_PENDING        10/* opt - is their more data buffered */
  ------------------
  |  Branch (66:5): [True: 0, False: 25.2M]
  ------------------
   67|      0|    case BIO_CTRL_WPENDING:
  ------------------
  |  |   97|      0|# define BIO_CTRL_WPENDING       13/* opt - number of bytes still to write */
  ------------------
  |  Branch (67:5): [True: 0, False: 25.2M]
  ------------------
   68|  25.2M|    default:
  ------------------
  |  Branch (68:5): [True: 25.2M, False: 0]
  ------------------
   69|  25.2M|        ret = 0;
   70|  25.2M|        break;
   71|  25.2M|    }
   72|  25.2M|    return ret;
   73|  25.2M|}

ossl_core_bio_up_ref:
   35|   267k|{
   36|   267k|    int ref = 0;
   37|       |
   38|   267k|    return CRYPTO_UP_REF(&cb->ref_cnt, &ref);
   39|   267k|}
ossl_core_bio_free:
   42|   361k|{
   43|   361k|    int ref = 0, res = 1;
   44|       |
   45|   361k|    if (cb != NULL) {
  ------------------
  |  Branch (45:9): [True: 346k, False: 15.0k]
  ------------------
   46|   346k|        CRYPTO_DOWN_REF(&cb->ref_cnt, &ref);
   47|   346k|        if (ref <= 0) {
  ------------------
  |  Branch (47:13): [True: 78.2k, False: 267k]
  ------------------
   48|  78.2k|            res = BIO_free(cb->bio);
   49|  78.2k|            CRYPTO_FREE_REF(&cb->ref_cnt);
   50|  78.2k|            OPENSSL_free(cb);
  ------------------
  |  |  107|  78.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   51|  78.2k|        }
   52|   346k|    }
   53|   361k|    return res;
   54|   361k|}
ossl_core_bio_new_from_bio:
   57|  78.2k|{
   58|  78.2k|    OSSL_CORE_BIO *cb = core_bio_new();
   59|       |
   60|  78.2k|    if (cb == NULL || !BIO_up_ref(bio)) {
  ------------------
  |  Branch (60:9): [True: 0, False: 78.2k]
  |  Branch (60:23): [True: 0, False: 78.2k]
  ------------------
   61|      0|        ossl_core_bio_free(cb);
   62|      0|        return NULL;
   63|      0|    }
   64|  78.2k|    cb->bio = bio;
   65|  78.2k|    return cb;
   66|  78.2k|}
ossl_core_bio_read_ex:
   94|   120M|{
   95|   120M|    return BIO_read_ex(cb->bio, data, dlen, readbytes);
   96|   120M|}
ossl_core_bio_write_ex:
  100|  1.42M|{
  101|  1.42M|    return BIO_write_ex(cb->bio, data, dlen, written);
  102|  1.42M|}
ossl_core_bio.c:core_bio_new:
   24|  78.2k|{
   25|  78.2k|    OSSL_CORE_BIO *cb = OPENSSL_malloc(sizeof(*cb));
  ------------------
  |  |   97|  78.2k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|       |
   27|  78.2k|    if (cb == NULL || !CRYPTO_NEW_REF(&cb->ref_cnt, 1)) {
  ------------------
  |  Branch (27:9): [True: 0, False: 78.2k]
  |  Branch (27:23): [True: 0, False: 78.2k]
  ------------------
   28|      0|        OPENSSL_free(cb);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   29|      0|        return NULL;
   30|      0|    }
   31|  78.2k|    return cb;
   32|  78.2k|}

bn_mul_add_words:
  112|  3.10M|{
  113|  3.10M|    BN_ULONG c1 = 0;
  ------------------
  |  |   37|  3.10M|#  define BN_ULONG        unsigned long
  ------------------
  114|       |
  115|  3.10M|    if (num <= 0)
  ------------------
  |  Branch (115:9): [True: 0, False: 3.10M]
  ------------------
  116|      0|        return c1;
  117|       |
  118|   158M|    while (num & ~3) {
  ------------------
  |  Branch (118:12): [True: 155M, False: 3.10M]
  ------------------
  119|   155M|        mul_add(rp[0], ap[0], w, c1);
  ------------------
  |  |   74|   155M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   155M|        register BN_ULONG high,low;     \
  |  |   76|   155M|        asm ("mulq %3"                  \
  |  |   77|   155M|                : "=a"(low),"=d"(high)  \
  |  |   78|   155M|                : "a"(word),"m"(a)      \
  |  |   79|   155M|                : "cc");                \
  |  |   80|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   155M|                : "+r"(carry),"+d"(high)\
  |  |   82|   155M|                : "a"(low),"g"(0)       \
  |  |   83|   155M|                : "cc");                \
  |  |   84|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   155M|                : "+m"(r),"+d"(high)    \
  |  |   86|   155M|                : "r"(carry),"g"(0)     \
  |  |   87|   155M|                : "cc");                \
  |  |   88|   155M|        carry=high;                     \
  |  |   89|   155M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  120|   155M|        mul_add(rp[1], ap[1], w, c1);
  ------------------
  |  |   74|   155M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   155M|        register BN_ULONG high,low;     \
  |  |   76|   155M|        asm ("mulq %3"                  \
  |  |   77|   155M|                : "=a"(low),"=d"(high)  \
  |  |   78|   155M|                : "a"(word),"m"(a)      \
  |  |   79|   155M|                : "cc");                \
  |  |   80|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   155M|                : "+r"(carry),"+d"(high)\
  |  |   82|   155M|                : "a"(low),"g"(0)       \
  |  |   83|   155M|                : "cc");                \
  |  |   84|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   155M|                : "+m"(r),"+d"(high)    \
  |  |   86|   155M|                : "r"(carry),"g"(0)     \
  |  |   87|   155M|                : "cc");                \
  |  |   88|   155M|        carry=high;                     \
  |  |   89|   155M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|   155M|        mul_add(rp[2], ap[2], w, c1);
  ------------------
  |  |   74|   155M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   155M|        register BN_ULONG high,low;     \
  |  |   76|   155M|        asm ("mulq %3"                  \
  |  |   77|   155M|                : "=a"(low),"=d"(high)  \
  |  |   78|   155M|                : "a"(word),"m"(a)      \
  |  |   79|   155M|                : "cc");                \
  |  |   80|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   155M|                : "+r"(carry),"+d"(high)\
  |  |   82|   155M|                : "a"(low),"g"(0)       \
  |  |   83|   155M|                : "cc");                \
  |  |   84|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   155M|                : "+m"(r),"+d"(high)    \
  |  |   86|   155M|                : "r"(carry),"g"(0)     \
  |  |   87|   155M|                : "cc");                \
  |  |   88|   155M|        carry=high;                     \
  |  |   89|   155M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  122|   155M|        mul_add(rp[3], ap[3], w, c1);
  ------------------
  |  |   74|   155M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   155M|        register BN_ULONG high,low;     \
  |  |   76|   155M|        asm ("mulq %3"                  \
  |  |   77|   155M|                : "=a"(low),"=d"(high)  \
  |  |   78|   155M|                : "a"(word),"m"(a)      \
  |  |   79|   155M|                : "cc");                \
  |  |   80|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   155M|                : "+r"(carry),"+d"(high)\
  |  |   82|   155M|                : "a"(low),"g"(0)       \
  |  |   83|   155M|                : "cc");                \
  |  |   84|   155M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   155M|                : "+m"(r),"+d"(high)    \
  |  |   86|   155M|                : "r"(carry),"g"(0)     \
  |  |   87|   155M|                : "cc");                \
  |  |   88|   155M|        carry=high;                     \
  |  |   89|   155M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|   155M|        ap += 4;
  124|   155M|        rp += 4;
  125|   155M|        num -= 4;
  126|   155M|    }
  127|  3.10M|    if (num) {
  ------------------
  |  Branch (127:9): [True: 440k, False: 2.66M]
  ------------------
  128|   440k|        mul_add(rp[0], ap[0], w, c1);
  ------------------
  |  |   74|   440k|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   440k|        register BN_ULONG high,low;     \
  |  |   76|   440k|        asm ("mulq %3"                  \
  |  |   77|   440k|                : "=a"(low),"=d"(high)  \
  |  |   78|   440k|                : "a"(word),"m"(a)      \
  |  |   79|   440k|                : "cc");                \
  |  |   80|   440k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   440k|                : "+r"(carry),"+d"(high)\
  |  |   82|   440k|                : "a"(low),"g"(0)       \
  |  |   83|   440k|                : "cc");                \
  |  |   84|   440k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   440k|                : "+m"(r),"+d"(high)    \
  |  |   86|   440k|                : "r"(carry),"g"(0)     \
  |  |   87|   440k|                : "cc");                \
  |  |   88|   440k|        carry=high;                     \
  |  |   89|   440k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|   440k|        if (--num == 0)
  ------------------
  |  Branch (129:13): [True: 119k, False: 320k]
  ------------------
  130|   119k|            return c1;
  131|   320k|        mul_add(rp[1], ap[1], w, c1);
  ------------------
  |  |   74|   320k|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   320k|        register BN_ULONG high,low;     \
  |  |   76|   320k|        asm ("mulq %3"                  \
  |  |   77|   320k|                : "=a"(low),"=d"(high)  \
  |  |   78|   320k|                : "a"(word),"m"(a)      \
  |  |   79|   320k|                : "cc");                \
  |  |   80|   320k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   320k|                : "+r"(carry),"+d"(high)\
  |  |   82|   320k|                : "a"(low),"g"(0)       \
  |  |   83|   320k|                : "cc");                \
  |  |   84|   320k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   320k|                : "+m"(r),"+d"(high)    \
  |  |   86|   320k|                : "r"(carry),"g"(0)     \
  |  |   87|   320k|                : "cc");                \
  |  |   88|   320k|        carry=high;                     \
  |  |   89|   320k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|   320k|        if (--num == 0)
  ------------------
  |  Branch (132:13): [True: 158k, False: 162k]
  ------------------
  133|   158k|            return c1;
  134|   162k|        mul_add(rp[2], ap[2], w, c1);
  ------------------
  |  |   74|   162k|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   162k|        register BN_ULONG high,low;     \
  |  |   76|   162k|        asm ("mulq %3"                  \
  |  |   77|   162k|                : "=a"(low),"=d"(high)  \
  |  |   78|   162k|                : "a"(word),"m"(a)      \
  |  |   79|   162k|                : "cc");                \
  |  |   80|   162k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   162k|                : "+r"(carry),"+d"(high)\
  |  |   82|   162k|                : "a"(low),"g"(0)       \
  |  |   83|   162k|                : "cc");                \
  |  |   84|   162k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   162k|                : "+m"(r),"+d"(high)    \
  |  |   86|   162k|                : "r"(carry),"g"(0)     \
  |  |   87|   162k|                : "cc");                \
  |  |   88|   162k|        carry=high;                     \
  |  |   89|   162k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  135|   162k|        return c1;
  136|   320k|    }
  137|       |
  138|  2.66M|    return c1;
  139|  3.10M|}
bn_mul_words:
  142|  17.5M|{
  143|  17.5M|    BN_ULONG c1 = 0;
  ------------------
  |  |   37|  17.5M|#  define BN_ULONG        unsigned long
  ------------------
  144|       |
  145|  17.5M|    if (num <= 0)
  ------------------
  |  Branch (145:9): [True: 0, False: 17.5M]
  ------------------
  146|      0|        return c1;
  147|       |
  148|  48.0M|    while (num & ~3) {
  ------------------
  |  Branch (148:12): [True: 30.4M, False: 17.5M]
  ------------------
  149|  30.4M|        mul(rp[0], ap[0], w, c1);
  ------------------
  |  |   91|  30.4M|# define mul(r,a,word,carry) do {       \
  |  |   92|  30.4M|        register BN_ULONG high,low;     \
  |  |   93|  30.4M|        asm ("mulq %3"                  \
  |  |   94|  30.4M|                : "=a"(low),"=d"(high)  \
  |  |   95|  30.4M|                : "a"(word),"g"(a)      \
  |  |   96|  30.4M|                : "cc");                \
  |  |   97|  30.4M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  30.4M|                : "+r"(carry),"+d"(high)\
  |  |   99|  30.4M|                : "a"(low),"g"(0)       \
  |  |  100|  30.4M|                : "cc");                \
  |  |  101|  30.4M|        (r)=carry, carry=high;          \
  |  |  102|  30.4M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  150|  30.4M|        mul(rp[1], ap[1], w, c1);
  ------------------
  |  |   91|  30.4M|# define mul(r,a,word,carry) do {       \
  |  |   92|  30.4M|        register BN_ULONG high,low;     \
  |  |   93|  30.4M|        asm ("mulq %3"                  \
  |  |   94|  30.4M|                : "=a"(low),"=d"(high)  \
  |  |   95|  30.4M|                : "a"(word),"g"(a)      \
  |  |   96|  30.4M|                : "cc");                \
  |  |   97|  30.4M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  30.4M|                : "+r"(carry),"+d"(high)\
  |  |   99|  30.4M|                : "a"(low),"g"(0)       \
  |  |  100|  30.4M|                : "cc");                \
  |  |  101|  30.4M|        (r)=carry, carry=high;          \
  |  |  102|  30.4M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|  30.4M|        mul(rp[2], ap[2], w, c1);
  ------------------
  |  |   91|  30.4M|# define mul(r,a,word,carry) do {       \
  |  |   92|  30.4M|        register BN_ULONG high,low;     \
  |  |   93|  30.4M|        asm ("mulq %3"                  \
  |  |   94|  30.4M|                : "=a"(low),"=d"(high)  \
  |  |   95|  30.4M|                : "a"(word),"g"(a)      \
  |  |   96|  30.4M|                : "cc");                \
  |  |   97|  30.4M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  30.4M|                : "+r"(carry),"+d"(high)\
  |  |   99|  30.4M|                : "a"(low),"g"(0)       \
  |  |  100|  30.4M|                : "cc");                \
  |  |  101|  30.4M|        (r)=carry, carry=high;          \
  |  |  102|  30.4M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  152|  30.4M|        mul(rp[3], ap[3], w, c1);
  ------------------
  |  |   91|  30.4M|# define mul(r,a,word,carry) do {       \
  |  |   92|  30.4M|        register BN_ULONG high,low;     \
  |  |   93|  30.4M|        asm ("mulq %3"                  \
  |  |   94|  30.4M|                : "=a"(low),"=d"(high)  \
  |  |   95|  30.4M|                : "a"(word),"g"(a)      \
  |  |   96|  30.4M|                : "cc");                \
  |  |   97|  30.4M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  30.4M|                : "+r"(carry),"+d"(high)\
  |  |   99|  30.4M|                : "a"(low),"g"(0)       \
  |  |  100|  30.4M|                : "cc");                \
  |  |  101|  30.4M|        (r)=carry, carry=high;          \
  |  |  102|  30.4M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|  30.4M|        ap += 4;
  154|  30.4M|        rp += 4;
  155|  30.4M|        num -= 4;
  156|  30.4M|    }
  157|  17.5M|    if (num) {
  ------------------
  |  Branch (157:9): [True: 595k, False: 16.9M]
  ------------------
  158|   595k|        mul(rp[0], ap[0], w, c1);
  ------------------
  |  |   91|   595k|# define mul(r,a,word,carry) do {       \
  |  |   92|   595k|        register BN_ULONG high,low;     \
  |  |   93|   595k|        asm ("mulq %3"                  \
  |  |   94|   595k|                : "=a"(low),"=d"(high)  \
  |  |   95|   595k|                : "a"(word),"g"(a)      \
  |  |   96|   595k|                : "cc");                \
  |  |   97|   595k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|   595k|                : "+r"(carry),"+d"(high)\
  |  |   99|   595k|                : "a"(low),"g"(0)       \
  |  |  100|   595k|                : "cc");                \
  |  |  101|   595k|        (r)=carry, carry=high;          \
  |  |  102|   595k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|   595k|        if (--num == 0)
  ------------------
  |  Branch (159:13): [True: 360k, False: 234k]
  ------------------
  160|   360k|            return c1;
  161|   234k|        mul(rp[1], ap[1], w, c1);
  ------------------
  |  |   91|   234k|# define mul(r,a,word,carry) do {       \
  |  |   92|   234k|        register BN_ULONG high,low;     \
  |  |   93|   234k|        asm ("mulq %3"                  \
  |  |   94|   234k|                : "=a"(low),"=d"(high)  \
  |  |   95|   234k|                : "a"(word),"g"(a)      \
  |  |   96|   234k|                : "cc");                \
  |  |   97|   234k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|   234k|                : "+r"(carry),"+d"(high)\
  |  |   99|   234k|                : "a"(low),"g"(0)       \
  |  |  100|   234k|                : "cc");                \
  |  |  101|   234k|        (r)=carry, carry=high;          \
  |  |  102|   234k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  162|   234k|        if (--num == 0)
  ------------------
  |  Branch (162:13): [True: 161k, False: 73.8k]
  ------------------
  163|   161k|            return c1;
  164|  73.8k|        mul(rp[2], ap[2], w, c1);
  ------------------
  |  |   91|  73.8k|# define mul(r,a,word,carry) do {       \
  |  |   92|  73.8k|        register BN_ULONG high,low;     \
  |  |   93|  73.8k|        asm ("mulq %3"                  \
  |  |   94|  73.8k|                : "=a"(low),"=d"(high)  \
  |  |   95|  73.8k|                : "a"(word),"g"(a)      \
  |  |   96|  73.8k|                : "cc");                \
  |  |   97|  73.8k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  73.8k|                : "+r"(carry),"+d"(high)\
  |  |   99|  73.8k|                : "a"(low),"g"(0)       \
  |  |  100|  73.8k|                : "cc");                \
  |  |  101|  73.8k|        (r)=carry, carry=high;          \
  |  |  102|  73.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  165|  73.8k|    }
  166|  17.0M|    return c1;
  167|  17.5M|}
bn_sqr_words:
  170|  25.6k|{
  171|  25.6k|    if (n <= 0)
  ------------------
  |  Branch (171:9): [True: 0, False: 25.6k]
  ------------------
  172|      0|        return;
  173|       |
  174|  42.3k|    while (n & ~3) {
  ------------------
  |  Branch (174:12): [True: 16.6k, False: 25.6k]
  ------------------
  175|  16.6k|        sqr(r[0], r[1], a[0]);
  ------------------
  |  |  105|  16.6k|        asm ("mulq %2"                  \
  |  |  106|  16.6k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  16.6k|                : "a"(a)                \
  |  |  108|  16.6k|                : "cc");
  ------------------
  176|  16.6k|        sqr(r[2], r[3], a[1]);
  ------------------
  |  |  105|  16.6k|        asm ("mulq %2"                  \
  |  |  106|  16.6k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  16.6k|                : "a"(a)                \
  |  |  108|  16.6k|                : "cc");
  ------------------
  177|  16.6k|        sqr(r[4], r[5], a[2]);
  ------------------
  |  |  105|  16.6k|        asm ("mulq %2"                  \
  |  |  106|  16.6k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  16.6k|                : "a"(a)                \
  |  |  108|  16.6k|                : "cc");
  ------------------
  178|  16.6k|        sqr(r[6], r[7], a[3]);
  ------------------
  |  |  105|  16.6k|        asm ("mulq %2"                  \
  |  |  106|  16.6k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  16.6k|                : "a"(a)                \
  |  |  108|  16.6k|                : "cc");
  ------------------
  179|  16.6k|        a += 4;
  180|  16.6k|        r += 8;
  181|  16.6k|        n -= 4;
  182|  16.6k|    }
  183|  25.6k|    if (n) {
  ------------------
  |  Branch (183:9): [True: 25.6k, False: 0]
  ------------------
  184|  25.6k|        sqr(r[0], r[1], a[0]);
  ------------------
  |  |  105|  25.6k|        asm ("mulq %2"                  \
  |  |  106|  25.6k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  25.6k|                : "a"(a)                \
  |  |  108|  25.6k|                : "cc");
  ------------------
  185|  25.6k|        if (--n == 0)
  ------------------
  |  Branch (185:13): [True: 13.6k, False: 12.0k]
  ------------------
  186|  13.6k|            return;
  187|  12.0k|        sqr(r[2], r[3], a[1]);
  ------------------
  |  |  105|  12.0k|        asm ("mulq %2"                  \
  |  |  106|  12.0k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  12.0k|                : "a"(a)                \
  |  |  108|  12.0k|                : "cc");
  ------------------
  188|  12.0k|        if (--n == 0)
  ------------------
  |  Branch (188:13): [True: 9.07k, False: 2.96k]
  ------------------
  189|  9.07k|            return;
  190|  2.96k|        sqr(r[4], r[5], a[2]);
  ------------------
  |  |  105|  2.96k|        asm ("mulq %2"                  \
  |  |  106|  2.96k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  2.96k|                : "a"(a)                \
  |  |  108|  2.96k|                : "cc");
  ------------------
  191|  2.96k|    }
  192|  25.6k|}
bn_div_words:
  195|  17.1M|{
  196|  17.1M|    BN_ULONG ret, waste;
  ------------------
  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  ------------------
  197|       |
  198|  17.1M| asm("divq      %4":"=a"(ret), "=d"(waste)
  199|  17.1M| :     "a"(l), "d"(h), "r"(d)
  200|  17.1M| :     "cc");
  201|       |
  202|  17.1M|    return ret;
  203|  17.1M|}
bn_add_words:
  207|  19.6M|{
  208|  19.6M|    BN_ULONG ret;
  ------------------
  |  |   37|  19.6M|#  define BN_ULONG        unsigned long
  ------------------
  209|  19.6M|    size_t i = 0;
  210|       |
  211|  19.6M|    if (n <= 0)
  ------------------
  |  Branch (211:9): [True: 25.5k, False: 19.6M]
  ------------------
  212|  25.5k|        return 0;
  213|       |
  214|  19.6M|    asm volatile ("       subq    %0,%0           \n" /* clear carry */
  215|  19.6M|                  "       jmp     1f              \n"
  216|  19.6M|                  ".p2align 4                     \n"
  217|  19.6M|                  "1:     movq    (%4,%2,8),%0    \n"
  218|  19.6M|                  "       adcq    (%5,%2,8),%0    \n"
  219|  19.6M|                  "       movq    %0,(%3,%2,8)    \n"
  220|  19.6M|                  "       lea     1(%2),%2        \n"
  221|  19.6M|                  "       dec     %1              \n"
  222|  19.6M|                  "       jnz     1b              \n"
  223|  19.6M|                  "       sbbq    %0,%0           \n"
  224|  19.6M|                  :"=&r" (ret), "+c"(n), "+r"(i)
  225|  19.6M|                  :"r"(rp), "r"(ap), "r"(bp)
  226|  19.6M|                  :"cc", "memory");
  227|       |
  228|  19.6M|    return ret & 1;
  229|  19.6M|}
bn_sub_words:
  234|  23.6M|{
  235|  23.6M|    BN_ULONG ret;
  ------------------
  |  |   37|  23.6M|#  define BN_ULONG        unsigned long
  ------------------
  236|  23.6M|    size_t i = 0;
  237|       |
  238|  23.6M|    if (n <= 0)
  ------------------
  |  Branch (238:9): [True: 164k, False: 23.4M]
  ------------------
  239|   164k|        return 0;
  240|       |
  241|  23.4M|    asm volatile ("       subq    %0,%0           \n" /* clear borrow */
  242|  23.4M|                  "       jmp     1f              \n"
  243|  23.4M|                  ".p2align 4                     \n"
  244|  23.4M|                  "1:     movq    (%4,%2,8),%0    \n"
  245|  23.4M|                  "       sbbq    (%5,%2,8),%0    \n"
  246|  23.4M|                  "       movq    %0,(%3,%2,8)    \n"
  247|  23.4M|                  "       lea     1(%2),%2        \n"
  248|  23.4M|                  "       dec     %1              \n"
  249|  23.4M|                  "       jnz     1b              \n"
  250|  23.4M|                  "       sbbq    %0,%0           \n"
  251|  23.4M|                  :"=&r" (ret), "+c"(n), "+r"(i)
  252|  23.4M|                  :"r"(rp), "r"(ap), "r"(bp)
  253|  23.4M|                  :"cc", "memory");
  254|       |
  255|  23.4M|    return ret & 1;
  256|  23.6M|}
bn_mul_comba8:
  394|  12.5k|{
  395|  12.5k|    BN_ULONG c1, c2, c3;
  ------------------
  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  ------------------
  396|       |
  397|  12.5k|    c1 = 0;
  398|  12.5k|    c2 = 0;
  399|  12.5k|    c3 = 0;
  400|  12.5k|    mul_add_c(a[0], b[0], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  401|  12.5k|    r[0] = c1;
  402|  12.5k|    c1 = 0;
  403|  12.5k|    mul_add_c(a[0], b[1], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  404|  12.5k|    mul_add_c(a[1], b[0], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  405|  12.5k|    r[1] = c2;
  406|  12.5k|    c2 = 0;
  407|  12.5k|    mul_add_c(a[2], b[0], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  408|  12.5k|    mul_add_c(a[1], b[1], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  409|  12.5k|    mul_add_c(a[0], b[2], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  410|  12.5k|    r[2] = c3;
  411|  12.5k|    c3 = 0;
  412|  12.5k|    mul_add_c(a[0], b[3], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  413|  12.5k|    mul_add_c(a[1], b[2], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  414|  12.5k|    mul_add_c(a[2], b[1], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  415|  12.5k|    mul_add_c(a[3], b[0], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  416|  12.5k|    r[3] = c1;
  417|  12.5k|    c1 = 0;
  418|  12.5k|    mul_add_c(a[4], b[0], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  419|  12.5k|    mul_add_c(a[3], b[1], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  420|  12.5k|    mul_add_c(a[2], b[2], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  421|  12.5k|    mul_add_c(a[1], b[3], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  422|  12.5k|    mul_add_c(a[0], b[4], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  423|  12.5k|    r[4] = c2;
  424|  12.5k|    c2 = 0;
  425|  12.5k|    mul_add_c(a[0], b[5], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  426|  12.5k|    mul_add_c(a[1], b[4], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  427|  12.5k|    mul_add_c(a[2], b[3], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  428|  12.5k|    mul_add_c(a[3], b[2], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  429|  12.5k|    mul_add_c(a[4], b[1], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  430|  12.5k|    mul_add_c(a[5], b[0], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  431|  12.5k|    r[5] = c3;
  432|  12.5k|    c3 = 0;
  433|  12.5k|    mul_add_c(a[6], b[0], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  434|  12.5k|    mul_add_c(a[5], b[1], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  435|  12.5k|    mul_add_c(a[4], b[2], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  436|  12.5k|    mul_add_c(a[3], b[3], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  437|  12.5k|    mul_add_c(a[2], b[4], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  438|  12.5k|    mul_add_c(a[1], b[5], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  439|  12.5k|    mul_add_c(a[0], b[6], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  440|  12.5k|    r[6] = c1;
  441|  12.5k|    c1 = 0;
  442|  12.5k|    mul_add_c(a[0], b[7], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  443|  12.5k|    mul_add_c(a[1], b[6], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  444|  12.5k|    mul_add_c(a[2], b[5], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  445|  12.5k|    mul_add_c(a[3], b[4], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  446|  12.5k|    mul_add_c(a[4], b[3], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  447|  12.5k|    mul_add_c(a[5], b[2], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  448|  12.5k|    mul_add_c(a[6], b[1], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  449|  12.5k|    mul_add_c(a[7], b[0], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  450|  12.5k|    r[7] = c2;
  451|  12.5k|    c2 = 0;
  452|  12.5k|    mul_add_c(a[7], b[1], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  453|  12.5k|    mul_add_c(a[6], b[2], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  454|  12.5k|    mul_add_c(a[5], b[3], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  455|  12.5k|    mul_add_c(a[4], b[4], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  456|  12.5k|    mul_add_c(a[3], b[5], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  457|  12.5k|    mul_add_c(a[2], b[6], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  458|  12.5k|    mul_add_c(a[1], b[7], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  459|  12.5k|    r[8] = c3;
  460|  12.5k|    c3 = 0;
  461|  12.5k|    mul_add_c(a[2], b[7], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  462|  12.5k|    mul_add_c(a[3], b[6], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  463|  12.5k|    mul_add_c(a[4], b[5], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  464|  12.5k|    mul_add_c(a[5], b[4], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  465|  12.5k|    mul_add_c(a[6], b[3], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  466|  12.5k|    mul_add_c(a[7], b[2], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  467|  12.5k|    r[9] = c1;
  468|  12.5k|    c1 = 0;
  469|  12.5k|    mul_add_c(a[7], b[3], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  470|  12.5k|    mul_add_c(a[6], b[4], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  471|  12.5k|    mul_add_c(a[5], b[5], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  472|  12.5k|    mul_add_c(a[4], b[6], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  473|  12.5k|    mul_add_c(a[3], b[7], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  474|  12.5k|    r[10] = c2;
  475|  12.5k|    c2 = 0;
  476|  12.5k|    mul_add_c(a[4], b[7], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  477|  12.5k|    mul_add_c(a[5], b[6], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  478|  12.5k|    mul_add_c(a[6], b[5], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  479|  12.5k|    mul_add_c(a[7], b[4], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  480|  12.5k|    r[11] = c3;
  481|  12.5k|    c3 = 0;
  482|  12.5k|    mul_add_c(a[7], b[5], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  483|  12.5k|    mul_add_c(a[6], b[6], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  484|  12.5k|    mul_add_c(a[5], b[7], c1, c2, c3);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  485|  12.5k|    r[12] = c1;
  486|  12.5k|    c1 = 0;
  487|  12.5k|    mul_add_c(a[6], b[7], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  488|  12.5k|    mul_add_c(a[7], b[6], c2, c3, c1);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  489|  12.5k|    r[13] = c2;
  490|  12.5k|    c2 = 0;
  491|  12.5k|    mul_add_c(a[7], b[7], c3, c1, c2);
  ------------------
  |  |  349|  12.5k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|  12.5k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  12.5k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|  12.5k|        asm ("mulq %3"                  \
  |  |  352|  12.5k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|  12.5k|                : "a"(a),"m"(b)         \
  |  |  354|  12.5k|                : "cc");                \
  |  |  355|  12.5k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|  12.5k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|  12.5k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|  12.5k|                : "cc");                                \
  |  |  359|  12.5k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  492|  12.5k|    r[14] = c3;
  493|  12.5k|    r[15] = c1;
  494|  12.5k|}
bn_sqr_comba8:
  536|  1.27k|{
  537|  1.27k|    BN_ULONG c1, c2, c3;
  ------------------
  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  ------------------
  538|       |
  539|  1.27k|    c1 = 0;
  540|  1.27k|    c2 = 0;
  541|  1.27k|    c3 = 0;
  542|  1.27k|    sqr_add_c(a, 0, c1, c2, c3);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  543|  1.27k|    r[0] = c1;
  544|  1.27k|    c1 = 0;
  545|  1.27k|    sqr_add_c2(a, 1, 0, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  546|  1.27k|    r[1] = c2;
  547|  1.27k|    c2 = 0;
  548|  1.27k|    sqr_add_c(a, 1, c3, c1, c2);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  549|  1.27k|    sqr_add_c2(a, 2, 0, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  550|  1.27k|    r[2] = c3;
  551|  1.27k|    c3 = 0;
  552|  1.27k|    sqr_add_c2(a, 3, 0, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  553|  1.27k|    sqr_add_c2(a, 2, 1, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  554|  1.27k|    r[3] = c1;
  555|  1.27k|    c1 = 0;
  556|  1.27k|    sqr_add_c(a, 2, c2, c3, c1);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  557|  1.27k|    sqr_add_c2(a, 3, 1, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  558|  1.27k|    sqr_add_c2(a, 4, 0, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  559|  1.27k|    r[4] = c2;
  560|  1.27k|    c2 = 0;
  561|  1.27k|    sqr_add_c2(a, 5, 0, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  562|  1.27k|    sqr_add_c2(a, 4, 1, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  563|  1.27k|    sqr_add_c2(a, 3, 2, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  564|  1.27k|    r[5] = c3;
  565|  1.27k|    c3 = 0;
  566|  1.27k|    sqr_add_c(a, 3, c1, c2, c3);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  567|  1.27k|    sqr_add_c2(a, 4, 2, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  568|  1.27k|    sqr_add_c2(a, 5, 1, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  569|  1.27k|    sqr_add_c2(a, 6, 0, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  570|  1.27k|    r[6] = c1;
  571|  1.27k|    c1 = 0;
  572|  1.27k|    sqr_add_c2(a, 7, 0, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  573|  1.27k|    sqr_add_c2(a, 6, 1, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  574|  1.27k|    sqr_add_c2(a, 5, 2, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  575|  1.27k|    sqr_add_c2(a, 4, 3, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  576|  1.27k|    r[7] = c2;
  577|  1.27k|    c2 = 0;
  578|  1.27k|    sqr_add_c(a, 4, c3, c1, c2);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  579|  1.27k|    sqr_add_c2(a, 5, 3, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  580|  1.27k|    sqr_add_c2(a, 6, 2, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  581|  1.27k|    sqr_add_c2(a, 7, 1, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  582|  1.27k|    r[8] = c3;
  583|  1.27k|    c3 = 0;
  584|  1.27k|    sqr_add_c2(a, 7, 2, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  585|  1.27k|    sqr_add_c2(a, 6, 3, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  586|  1.27k|    sqr_add_c2(a, 5, 4, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  587|  1.27k|    r[9] = c1;
  588|  1.27k|    c1 = 0;
  589|  1.27k|    sqr_add_c(a, 5, c2, c3, c1);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  590|  1.27k|    sqr_add_c2(a, 6, 4, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  591|  1.27k|    sqr_add_c2(a, 7, 3, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  592|  1.27k|    r[10] = c2;
  593|  1.27k|    c2 = 0;
  594|  1.27k|    sqr_add_c2(a, 7, 4, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  595|  1.27k|    sqr_add_c2(a, 6, 5, c3, c1, c2);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  596|  1.27k|    r[11] = c3;
  597|  1.27k|    c3 = 0;
  598|  1.27k|    sqr_add_c(a, 6, c1, c2, c3);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  599|  1.27k|    sqr_add_c2(a, 7, 5, c1, c2, c3);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  600|  1.27k|    r[12] = c1;
  601|  1.27k|    c1 = 0;
  602|  1.27k|    sqr_add_c2(a, 7, 6, c2, c3, c1);
  ------------------
  |  |  391|  1.27k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  1.27k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  1.27k|        asm ("mulq %3"                  \
  |  |  |  |  376|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  1.27k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  1.27k|                : "cc");                \
  |  |  |  |  379|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  1.27k|                : "cc");                                \
  |  |  |  |  383|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  1.27k|                : "cc");                                \
  |  |  |  |  387|  1.27k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|  1.27k|    r[13] = c2;
  604|  1.27k|    c2 = 0;
  605|  1.27k|    sqr_add_c(a, 7, c3, c1, c2);
  ------------------
  |  |  361|  1.27k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  1.27k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  1.27k|        asm ("mulq %2"                  \
  |  |  364|  1.27k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  1.27k|                : "a"(a[i])             \
  |  |  366|  1.27k|                : "cc");                \
  |  |  367|  1.27k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  1.27k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  1.27k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  1.27k|                : "cc");                                \
  |  |  371|  1.27k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  606|  1.27k|    r[14] = c3;
  607|  1.27k|    r[15] = c1;
  608|  1.27k|}
bn_sqr_comba4:
  611|  3.93M|{
  612|  3.93M|    BN_ULONG c1, c2, c3;
  ------------------
  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  ------------------
  613|       |
  614|  3.93M|    c1 = 0;
  615|  3.93M|    c2 = 0;
  616|  3.93M|    c3 = 0;
  617|  3.93M|    sqr_add_c(a, 0, c1, c2, c3);
  ------------------
  |  |  361|  3.93M|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  3.93M|        asm ("mulq %2"                  \
  |  |  364|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  3.93M|                : "a"(a[i])             \
  |  |  366|  3.93M|                : "cc");                \
  |  |  367|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  3.93M|                : "cc");                                \
  |  |  371|  3.93M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  618|  3.93M|    r[0] = c1;
  619|  3.93M|    c1 = 0;
  620|  3.93M|    sqr_add_c2(a, 1, 0, c2, c3, c1);
  ------------------
  |  |  391|  3.93M|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  3.93M|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  3.93M|        asm ("mulq %3"                  \
  |  |  |  |  376|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  3.93M|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  3.93M|                : "cc");                \
  |  |  |  |  379|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  3.93M|                : "cc");                                \
  |  |  |  |  383|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  3.93M|                : "cc");                                \
  |  |  |  |  387|  3.93M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  621|  3.93M|    r[1] = c2;
  622|  3.93M|    c2 = 0;
  623|  3.93M|    sqr_add_c(a, 1, c3, c1, c2);
  ------------------
  |  |  361|  3.93M|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  3.93M|        asm ("mulq %2"                  \
  |  |  364|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  3.93M|                : "a"(a[i])             \
  |  |  366|  3.93M|                : "cc");                \
  |  |  367|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  3.93M|                : "cc");                                \
  |  |  371|  3.93M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  624|  3.93M|    sqr_add_c2(a, 2, 0, c3, c1, c2);
  ------------------
  |  |  391|  3.93M|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  3.93M|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  3.93M|        asm ("mulq %3"                  \
  |  |  |  |  376|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  3.93M|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  3.93M|                : "cc");                \
  |  |  |  |  379|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  3.93M|                : "cc");                                \
  |  |  |  |  383|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  3.93M|                : "cc");                                \
  |  |  |  |  387|  3.93M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|  3.93M|    r[2] = c3;
  626|  3.93M|    c3 = 0;
  627|  3.93M|    sqr_add_c2(a, 3, 0, c1, c2, c3);
  ------------------
  |  |  391|  3.93M|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  3.93M|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  3.93M|        asm ("mulq %3"                  \
  |  |  |  |  376|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  3.93M|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  3.93M|                : "cc");                \
  |  |  |  |  379|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  3.93M|                : "cc");                                \
  |  |  |  |  383|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  3.93M|                : "cc");                                \
  |  |  |  |  387|  3.93M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  628|  3.93M|    sqr_add_c2(a, 2, 1, c1, c2, c3);
  ------------------
  |  |  391|  3.93M|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  3.93M|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  3.93M|        asm ("mulq %3"                  \
  |  |  |  |  376|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  3.93M|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  3.93M|                : "cc");                \
  |  |  |  |  379|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  3.93M|                : "cc");                                \
  |  |  |  |  383|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  3.93M|                : "cc");                                \
  |  |  |  |  387|  3.93M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  629|  3.93M|    r[3] = c1;
  630|  3.93M|    c1 = 0;
  631|  3.93M|    sqr_add_c(a, 2, c2, c3, c1);
  ------------------
  |  |  361|  3.93M|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  3.93M|        asm ("mulq %2"                  \
  |  |  364|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  3.93M|                : "a"(a[i])             \
  |  |  366|  3.93M|                : "cc");                \
  |  |  367|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  3.93M|                : "cc");                                \
  |  |  371|  3.93M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  632|  3.93M|    sqr_add_c2(a, 3, 1, c2, c3, c1);
  ------------------
  |  |  391|  3.93M|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  3.93M|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  3.93M|        asm ("mulq %3"                  \
  |  |  |  |  376|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  3.93M|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  3.93M|                : "cc");                \
  |  |  |  |  379|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  3.93M|                : "cc");                                \
  |  |  |  |  383|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  3.93M|                : "cc");                                \
  |  |  |  |  387|  3.93M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|  3.93M|    r[4] = c2;
  634|  3.93M|    c2 = 0;
  635|  3.93M|    sqr_add_c2(a, 3, 2, c3, c1, c2);
  ------------------
  |  |  391|  3.93M|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  3.93M|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  3.93M|        asm ("mulq %3"                  \
  |  |  |  |  376|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  3.93M|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  3.93M|                : "cc");                \
  |  |  |  |  379|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  3.93M|                : "cc");                                \
  |  |  |  |  383|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  3.93M|                : "cc");                                \
  |  |  |  |  387|  3.93M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|  3.93M|    r[5] = c3;
  637|  3.93M|    c3 = 0;
  638|  3.93M|    sqr_add_c(a, 3, c1, c2, c3);
  ------------------
  |  |  361|  3.93M|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  3.93M|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  3.93M|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  3.93M|        asm ("mulq %2"                  \
  |  |  364|  3.93M|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  3.93M|                : "a"(a[i])             \
  |  |  366|  3.93M|                : "cc");                \
  |  |  367|  3.93M|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  3.93M|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  3.93M|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  3.93M|                : "cc");                                \
  |  |  371|  3.93M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  639|  3.93M|    r[6] = c1;
  640|  3.93M|    r[7] = c2;
  641|  3.93M|}

BN_add:
   15|   719k|{
   16|   719k|    int ret, r_neg, cmp_res;
   17|       |
   18|   719k|    bn_check_top(a);
   19|   719k|    bn_check_top(b);
   20|       |
   21|   719k|    if (a->neg == b->neg) {
  ------------------
  |  Branch (21:9): [True: 16.1k, False: 703k]
  ------------------
   22|  16.1k|        r_neg = a->neg;
   23|  16.1k|        ret = BN_uadd(r, a, b);
   24|   703k|    } else {
   25|   703k|        cmp_res = BN_ucmp(a, b);
   26|   703k|        if (cmp_res > 0) {
  ------------------
  |  Branch (26:13): [True: 0, False: 703k]
  ------------------
   27|      0|            r_neg = a->neg;
   28|      0|            ret = BN_usub(r, a, b);
   29|   703k|        } else if (cmp_res < 0) {
  ------------------
  |  Branch (29:20): [True: 703k, False: 0]
  ------------------
   30|   703k|            r_neg = b->neg;
   31|   703k|            ret = BN_usub(r, b, a);
   32|   703k|        } else {
   33|      0|            r_neg = 0;
   34|      0|            BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   35|      0|            ret = 1;
   36|      0|        }
   37|   703k|    }
   38|       |
   39|   719k|    r->neg = r_neg;
   40|   719k|    bn_check_top(r);
   41|   719k|    return ret;
   42|   719k|}
BN_sub:
   46|  2.00M|{
   47|  2.00M|    int ret, r_neg, cmp_res;
   48|       |
   49|  2.00M|    bn_check_top(a);
   50|  2.00M|    bn_check_top(b);
   51|       |
   52|  2.00M|    if (a->neg != b->neg) {
  ------------------
  |  Branch (52:9): [True: 0, False: 2.00M]
  ------------------
   53|      0|        r_neg = a->neg;
   54|      0|        ret = BN_uadd(r, a, b);
   55|  2.00M|    } else {
   56|  2.00M|        cmp_res = BN_ucmp(a, b);
   57|  2.00M|        if (cmp_res > 0) {
  ------------------
  |  Branch (57:13): [True: 1.30M, False: 705k]
  ------------------
   58|  1.30M|            r_neg = a->neg;
   59|  1.30M|            ret = BN_usub(r, a, b);
   60|  1.30M|        } else if (cmp_res < 0) {
  ------------------
  |  Branch (60:20): [True: 703k, False: 2.00k]
  ------------------
   61|   703k|            r_neg = !b->neg;
   62|   703k|            ret = BN_usub(r, b, a);
   63|   703k|        } else {
   64|  2.00k|            r_neg = 0;
   65|  2.00k|            BN_zero(r);
  ------------------
  |  |  202|  2.00k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   66|  2.00k|            ret = 1;
   67|  2.00k|        }
   68|  2.00M|    }
   69|       |
   70|  2.00M|    r->neg = r_neg;
   71|  2.00M|    bn_check_top(r);
   72|  2.00M|    return ret;
   73|  2.00M|}
BN_uadd:
   77|  2.37M|{
   78|  2.37M|    int max, min, dif;
   79|  2.37M|    const BN_ULONG *ap, *bp;
   80|  2.37M|    BN_ULONG *rp, carry, t1, t2;
  ------------------
  |  |   37|  2.37M|#  define BN_ULONG        unsigned long
  ------------------
   81|       |
   82|  2.37M|    bn_check_top(a);
   83|  2.37M|    bn_check_top(b);
   84|       |
   85|  2.37M|    if (a->top < b->top) {
  ------------------
  |  Branch (85:9): [True: 55.1k, False: 2.32M]
  ------------------
   86|  55.1k|        const BIGNUM *tmp;
   87|       |
   88|  55.1k|        tmp = a;
   89|  55.1k|        a = b;
   90|  55.1k|        b = tmp;
   91|  55.1k|    }
   92|  2.37M|    max = a->top;
   93|  2.37M|    min = b->top;
   94|  2.37M|    dif = max - min;
   95|       |
   96|  2.37M|    if (bn_wexpand(r, max + 1) == NULL)
  ------------------
  |  Branch (96:9): [True: 0, False: 2.37M]
  ------------------
   97|      0|        return 0;
   98|       |
   99|  2.37M|    r->top = max;
  100|       |
  101|  2.37M|    ap = a->d;
  102|  2.37M|    bp = b->d;
  103|  2.37M|    rp = r->d;
  104|       |
  105|  2.37M|    carry = bn_add_words(rp, ap, bp, min);
  106|  2.37M|    rp += min;
  107|  2.37M|    ap += min;
  108|       |
  109|  2.92M|    while (dif) {
  ------------------
  |  Branch (109:12): [True: 547k, False: 2.37M]
  ------------------
  110|   547k|        dif--;
  111|   547k|        t1 = *(ap++);
  112|   547k|        t2 = (t1 + carry) & BN_MASK2;
  ------------------
  |  |   94|   547k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  113|   547k|        *(rp++) = t2;
  114|   547k|        carry &= (t2 == 0);
  115|   547k|    }
  116|  2.37M|    *rp = carry;
  117|  2.37M|    r->top += carry;
  118|       |
  119|  2.37M|    r->neg = 0;
  120|  2.37M|    bn_check_top(r);
  121|  2.37M|    return 1;
  122|  2.37M|}
BN_usub:
  126|  4.22M|{
  127|  4.22M|    int max, min, dif;
  128|  4.22M|    BN_ULONG t1, t2, borrow, *rp;
  ------------------
  |  |   37|  4.22M|#  define BN_ULONG        unsigned long
  ------------------
  129|  4.22M|    const BN_ULONG *ap, *bp;
  130|       |
  131|  4.22M|    bn_check_top(a);
  132|  4.22M|    bn_check_top(b);
  133|       |
  134|  4.22M|    max = a->top;
  135|  4.22M|    min = b->top;
  136|  4.22M|    dif = max - min;
  137|       |
  138|  4.22M|    if (dif < 0) {              /* hmm... should not be happening */
  ------------------
  |  Branch (138:9): [True: 0, False: 4.22M]
  ------------------
  139|      0|        ERR_raise(ERR_LIB_BN, BN_R_ARG2_LT_ARG3);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  140|      0|        return 0;
  141|      0|    }
  142|       |
  143|  4.22M|    if (bn_wexpand(r, max) == NULL)
  ------------------
  |  Branch (143:9): [True: 0, False: 4.22M]
  ------------------
  144|      0|        return 0;
  145|       |
  146|  4.22M|    ap = a->d;
  147|  4.22M|    bp = b->d;
  148|  4.22M|    rp = r->d;
  149|       |
  150|  4.22M|    borrow = bn_sub_words(rp, ap, bp, min);
  151|  4.22M|    ap += min;
  152|  4.22M|    rp += min;
  153|       |
  154|  4.91M|    while (dif) {
  ------------------
  |  Branch (154:12): [True: 688k, False: 4.22M]
  ------------------
  155|   688k|        dif--;
  156|   688k|        t1 = *(ap++);
  157|   688k|        t2 = (t1 - borrow) & BN_MASK2;
  ------------------
  |  |   94|   688k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  158|   688k|        *(rp++) = t2;
  159|   688k|        borrow &= (t1 == 0);
  160|   688k|    }
  161|       |
  162|  4.27M|    while (max && *--rp == 0)
  ------------------
  |  Branch (162:12): [True: 4.24M, False: 25.2k]
  |  Branch (162:19): [True: 49.3k, False: 4.19M]
  ------------------
  163|  49.3k|        max--;
  164|       |
  165|  4.22M|    r->top = max;
  166|  4.22M|    r->neg = 0;
  167|  4.22M|    bn_pollute(r);
  168|       |
  169|  4.22M|    return 1;
  170|  4.22M|}

BN_BLINDING_free:
   80|   102k|{
   81|   102k|    if (r == NULL)
  ------------------
  |  Branch (81:9): [True: 102k, False: 0]
  ------------------
   82|   102k|        return;
   83|      0|    BN_free(r->A);
   84|      0|    BN_free(r->Ai);
   85|      0|    BN_free(r->e);
   86|      0|    BN_free(r->mod);
   87|      0|    CRYPTO_THREAD_lock_free(r->lock);
   88|      0|    OPENSSL_free(r);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   89|      0|}

BN_bn2hex:
   18|  5.09k|{
   19|  5.09k|    int i, j, v, z = 0;
   20|  5.09k|    char *buf;
   21|  5.09k|    char *p;
   22|       |
   23|  5.09k|    if (BN_is_zero(a))
  ------------------
  |  Branch (23:9): [True: 16, False: 5.08k]
  ------------------
   24|     16|        return OPENSSL_strdup("0");
  ------------------
  |  |  111|     16|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   25|  5.08k|    buf = OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
  ------------------
  |  |   97|  5.08k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  5.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  5.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|  5.08k|    if (buf == NULL)
  ------------------
  |  Branch (26:9): [True: 0, False: 5.08k]
  ------------------
   27|      0|        goto err;
   28|  5.08k|    p = buf;
   29|  5.08k|    if (a->neg)
  ------------------
  |  Branch (29:9): [True: 564, False: 4.51k]
  ------------------
   30|    564|        *p++ = '-';
   31|   503k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (31:26): [True: 498k, False: 5.08k]
  ------------------
   32|  4.48M|        for (j = BN_BITS2 - 8; j >= 0; j -= 8) {
  ------------------
  |  |   54|   498k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   498k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (32:32): [True: 3.98M, False: 498k]
  ------------------
   33|       |            /* strip leading zeros */
   34|  3.98M|            v = (int)((a->d[i] >> j) & 0xff);
   35|  3.98M|            if (z || v != 0) {
  ------------------
  |  Branch (35:17): [True: 3.96M, False: 19.2k]
  |  Branch (35:22): [True: 5.08k, False: 14.1k]
  ------------------
   36|  3.97M|                *p++ = Hex[v >> 4];
   37|  3.97M|                *p++ = Hex[v & 0x0f];
   38|  3.97M|                z = 1;
   39|  3.97M|            }
   40|  3.98M|        }
   41|   498k|    }
   42|  5.08k|    *p = '\0';
   43|  5.08k| err:
   44|  5.08k|    return buf;
   45|  5.08k|}
BN_bn2dec:
   51|  16.1k|{
   52|  16.1k|    int i = 0, num, ok = 0, n, tbytes;
   53|  16.1k|    char *buf = NULL;
   54|  16.1k|    char *p;
   55|  16.1k|    BIGNUM *t = NULL;
   56|  16.1k|    BN_ULONG *bn_data = NULL, *lp;
  ------------------
  |  |   37|  16.1k|#  define BN_ULONG        unsigned long
  ------------------
   57|  16.1k|    int bn_data_num;
   58|       |
   59|       |    /*-
   60|       |     * get an upper bound for the length of the decimal integer
   61|       |     * num <= (BN_num_bits(a) + 1) * log(2)
   62|       |     *     <= 3 * BN_num_bits(a) * 0.101 + log(2) + 1     (rounding error)
   63|       |     *     <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1
   64|       |     */
   65|  16.1k|    i = BN_num_bits(a) * 3;
   66|  16.1k|    num = (i / 10 + i / 1000 + 1) + 1;
   67|  16.1k|    tbytes = num + 3;   /* negative and terminator and one spare? */
   68|  16.1k|    bn_data_num = num / BN_DEC_NUM + 1;
  ------------------
  |  |   99|  16.1k|#  define BN_DEC_NUM      19
  ------------------
   69|  16.1k|    bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG));
  ------------------
  |  |   97|  16.1k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  16.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  16.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   70|  16.1k|    buf = OPENSSL_malloc(tbytes);
  ------------------
  |  |   97|  16.1k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  16.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  16.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   71|  16.1k|    if (buf == NULL || bn_data == NULL)
  ------------------
  |  Branch (71:9): [True: 0, False: 16.1k]
  |  Branch (71:24): [True: 0, False: 16.1k]
  ------------------
   72|      0|        goto err;
   73|  16.1k|    if ((t = BN_dup(a)) == NULL)
  ------------------
  |  Branch (73:9): [True: 0, False: 16.1k]
  ------------------
   74|      0|        goto err;
   75|       |
   76|  16.1k|    p = buf;
   77|  16.1k|    lp = bn_data;
   78|  16.1k|    if (BN_is_zero(t)) {
  ------------------
  |  Branch (78:9): [True: 1.81k, False: 14.3k]
  ------------------
   79|  1.81k|        *p++ = '0';
   80|  1.81k|        *p++ = '\0';
   81|  14.3k|    } else {
   82|  14.3k|        if (BN_is_negative(t))
  ------------------
  |  Branch (82:13): [True: 3.01k, False: 11.3k]
  ------------------
   83|  3.01k|            *p++ = '-';
   84|       |
   85|  35.4k|        while (!BN_is_zero(t)) {
  ------------------
  |  Branch (85:16): [True: 21.0k, False: 14.3k]
  ------------------
   86|  21.0k|            if (lp - bn_data >= bn_data_num)
  ------------------
  |  Branch (86:17): [True: 0, False: 21.0k]
  ------------------
   87|      0|                goto err;
   88|  21.0k|            *lp = BN_div_word(t, BN_DEC_CONV);
  ------------------
  |  |   98|  21.0k|#  define BN_DEC_CONV     (10000000000000000000UL)
  ------------------
   89|  21.0k|            if (*lp == (BN_ULONG)-1)
  ------------------
  |  Branch (89:17): [True: 0, False: 21.0k]
  ------------------
   90|      0|                goto err;
   91|  21.0k|            lp++;
   92|  21.0k|        }
   93|  14.3k|        lp--;
   94|       |        /*
   95|       |         * We now have a series of blocks, BN_DEC_NUM chars in length, where
   96|       |         * the last one needs truncation. The blocks need to be reversed in
   97|       |         * order.
   98|       |         */
   99|  14.3k|        n = BIO_snprintf(p, tbytes - (size_t)(p - buf), BN_DEC_FMT1, *lp);
  ------------------
  |  |  100|  14.3k|#  define BN_DEC_FMT1     "%lu"
  ------------------
  100|  14.3k|        if (n < 0)
  ------------------
  |  Branch (100:13): [True: 0, False: 14.3k]
  ------------------
  101|      0|            goto err;
  102|  14.3k|        p += n;
  103|  21.0k|        while (lp != bn_data) {
  ------------------
  |  Branch (103:16): [True: 6.72k, False: 14.3k]
  ------------------
  104|  6.72k|            lp--;
  105|  6.72k|            n = BIO_snprintf(p, tbytes - (size_t)(p - buf), BN_DEC_FMT2, *lp);
  ------------------
  |  |  101|  6.72k|#  define BN_DEC_FMT2     "%019lu"
  ------------------
  106|  6.72k|            if (n < 0)
  ------------------
  |  Branch (106:17): [True: 0, False: 6.72k]
  ------------------
  107|      0|                goto err;
  108|  6.72k|            p += n;
  109|  6.72k|        }
  110|  14.3k|    }
  111|  16.1k|    ok = 1;
  112|  16.1k| err:
  113|  16.1k|    OPENSSL_free(bn_data);
  ------------------
  |  |  107|  16.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  16.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  16.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  114|  16.1k|    BN_free(t);
  115|  16.1k|    if (ok)
  ------------------
  |  Branch (115:9): [True: 16.1k, False: 0]
  ------------------
  116|  16.1k|        return buf;
  117|      0|    OPENSSL_free(buf);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  118|      0|    return NULL;
  119|  16.1k|}

BN_CTX_new_ex:
  119|  82.6k|{
  120|  82.6k|    BN_CTX *ret;
  121|       |
  122|  82.6k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|  82.6k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  82.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  82.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (122:9): [True: 0, False: 82.6k]
  ------------------
  123|      0|        return NULL;
  124|       |    /* Initialise the structure */
  125|  82.6k|    BN_POOL_init(&ret->pool);
  126|  82.6k|    BN_STACK_init(&ret->stack);
  127|  82.6k|    ret->libctx = ctx;
  128|  82.6k|    return ret;
  129|  82.6k|}
BN_CTX_new:
  133|  11.0k|{
  134|  11.0k|    return BN_CTX_new_ex(NULL);
  135|  11.0k|}
BN_CTX_free:
  155|   265k|{
  156|   265k|    if (ctx == NULL)
  ------------------
  |  Branch (156:9): [True: 183k, False: 82.6k]
  ------------------
  157|   183k|        return;
  158|  82.6k|#ifndef FIPS_MODULE
  159|  82.6k|    OSSL_TRACE_BEGIN(BN_CTX) {
  ------------------
  |  |  219|  82.6k|    do {                                        \
  |  |  220|  82.6k|        BIO *trc_out = NULL;                    \
  |  |  221|  82.6k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  160|      0|        BN_POOL_ITEM *pool = ctx->pool.head;
  161|      0|        BIO_printf(trc_out,
  162|      0|                   "BN_CTX_free(): stack-size=%d, pool-bignums=%d\n",
  163|      0|                   ctx->stack.size, ctx->pool.size);
  164|      0|        BIO_printf(trc_out, "  dmaxs: ");
  165|      0|        while (pool) {
  ------------------
  |  Branch (165:16): [True: 0, False: 0]
  ------------------
  166|      0|            unsigned loop = 0;
  167|      0|            while (loop < BN_CTX_POOL_SIZE)
  ------------------
  |  |   15|      0|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (167:20): [True: 0, False: 0]
  ------------------
  168|      0|                BIO_printf(trc_out, "%02x ", pool->vals[loop++].dmax);
  169|      0|            pool = pool->next;
  170|      0|        }
  171|      0|        BIO_printf(trc_out, "\n");
  172|  82.6k|    } OSSL_TRACE_END(BN_CTX);
  ------------------
  |  |  224|  82.6k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  82.6k|#endif
  174|  82.6k|    BN_STACK_finish(&ctx->stack);
  175|  82.6k|    BN_POOL_finish(&ctx->pool);
  176|  82.6k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  82.6k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  82.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  82.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  177|  82.6k|}
BN_CTX_start:
  180|  62.4M|{
  181|  62.4M|    CTXDBG("ENTER BN_CTX_start()", ctx);
  ------------------
  |  |  110|  62.4M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  62.4M|    do {                                        \
  |  |  |  |  220|  62.4M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  62.4M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  62.4M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  62.4M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|       |    /* If we're already overflowing ... */
  183|  62.4M|    if (ctx->err_stack || ctx->too_many)
  ------------------
  |  Branch (183:9): [True: 0, False: 62.4M]
  |  Branch (183:27): [True: 0, False: 62.4M]
  ------------------
  184|      0|        ctx->err_stack++;
  185|       |    /* (Try to) get a new frame pointer */
  186|  62.4M|    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
  ------------------
  |  Branch (186:14): [True: 0, False: 62.4M]
  ------------------
  187|      0|        ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  188|      0|        ctx->err_stack++;
  189|      0|    }
  190|  62.4M|    CTXDBG("LEAVE BN_CTX_start()", ctx);
  ------------------
  |  |  110|  62.4M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  62.4M|    do {                                        \
  |  |  |  |  220|  62.4M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  62.4M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  62.4M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  62.4M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|  62.4M|}
BN_CTX_end:
  194|  62.4M|{
  195|  62.4M|    if (ctx == NULL)
  ------------------
  |  Branch (195:9): [True: 0, False: 62.4M]
  ------------------
  196|      0|        return;
  197|  62.4M|    CTXDBG("ENTER BN_CTX_end()", ctx);
  ------------------
  |  |  110|  62.4M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  62.4M|    do {                                        \
  |  |  |  |  220|  62.4M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  62.4M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  62.4M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  62.4M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|  62.4M|    if (ctx->err_stack)
  ------------------
  |  Branch (198:9): [True: 0, False: 62.4M]
  ------------------
  199|      0|        ctx->err_stack--;
  200|  62.4M|    else {
  201|  62.4M|        unsigned int fp = BN_STACK_pop(&ctx->stack);
  202|       |        /* Does this stack frame have anything to release? */
  203|  62.4M|        if (fp < ctx->used)
  ------------------
  |  Branch (203:13): [True: 62.1M, False: 289k]
  ------------------
  204|  62.1M|            BN_POOL_release(&ctx->pool, ctx->used - fp);
  205|  62.4M|        ctx->used = fp;
  206|       |        /* Unjam "too_many" in case "get" had failed */
  207|  62.4M|        ctx->too_many = 0;
  208|  62.4M|    }
  209|  62.4M|    CTXDBG("LEAVE BN_CTX_end()", ctx);
  ------------------
  |  |  110|  62.4M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  62.4M|    do {                                        \
  |  |  |  |  220|  62.4M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  62.4M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  62.4M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  62.4M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|  62.4M|}
BN_CTX_get:
  213|  77.6M|{
  214|  77.6M|    BIGNUM *ret;
  215|       |
  216|  77.6M|    CTXDBG("ENTER BN_CTX_get()", ctx);
  ------------------
  |  |  110|  77.6M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  77.6M|    do {                                        \
  |  |  |  |  220|  77.6M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  77.6M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  77.6M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  77.6M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  217|  77.6M|    if (ctx->err_stack || ctx->too_many)
  ------------------
  |  Branch (217:9): [True: 0, False: 77.6M]
  |  Branch (217:27): [True: 0, False: 77.6M]
  ------------------
  218|      0|        return NULL;
  219|  77.6M|    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
  ------------------
  |  Branch (219:9): [True: 0, False: 77.6M]
  ------------------
  220|       |        /*
  221|       |         * Setting too_many prevents repeated "get" attempts from cluttering
  222|       |         * the error stack.
  223|       |         */
  224|      0|        ctx->too_many = 1;
  225|      0|        ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  226|      0|        return NULL;
  227|      0|    }
  228|       |    /* OK, make sure the returned bignum is "zero" */
  229|  77.6M|    BN_zero(ret);
  ------------------
  |  |  202|  77.6M|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  230|       |    /* clear BN_FLG_CONSTTIME if leaked from previous frames */
  231|  77.6M|    ret->flags &= (~BN_FLG_CONSTTIME);
  ------------------
  |  |   67|  77.6M|# define BN_FLG_CONSTTIME        0x04
  ------------------
  232|  77.6M|    ctx->used++;
  233|  77.6M|    CTXDBG("LEAVE BN_CTX_get()", ctx);
  ------------------
  |  |  110|  77.6M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  77.6M|    do {                                        \
  |  |  |  |  220|  77.6M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  77.6M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  77.6M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  77.6M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  77.6M|    return ret;
  235|  77.6M|}
ossl_bn_get_libctx:
  238|  68.1k|{
  239|  68.1k|    if (ctx == NULL)
  ------------------
  |  Branch (239:9): [True: 3.14k, False: 65.0k]
  ------------------
  240|  3.14k|        return NULL;
  241|  65.0k|    return ctx->libctx;
  242|  68.1k|}
bn_ctx.c:BN_STACK_init:
  249|  82.6k|{
  250|  82.6k|    st->indexes = NULL;
  251|  82.6k|    st->depth = st->size = 0;
  252|  82.6k|}
bn_ctx.c:BN_STACK_finish:
  255|  82.6k|{
  256|  82.6k|    OPENSSL_free(st->indexes);
  ------------------
  |  |  107|  82.6k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  82.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  82.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  257|  82.6k|    st->indexes = NULL;
  258|  82.6k|}
bn_ctx.c:BN_STACK_push:
  262|  62.4M|{
  263|  62.4M|    if (st->depth == st->size) {
  ------------------
  |  Branch (263:9): [True: 71.7k, False: 62.3M]
  ------------------
  264|       |        /* Need to expand */
  265|  71.7k|        unsigned int newsize =
  266|  71.7k|            st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
  ------------------
  |  |   17|  71.7k|#define BN_CTX_START_FRAMES     32
  ------------------
  |  Branch (266:13): [True: 0, False: 71.7k]
  ------------------
  267|  71.7k|        unsigned int *newitems;
  268|       |
  269|  71.7k|        if ((newitems = OPENSSL_malloc(sizeof(*newitems) * newsize)) == NULL)
  ------------------
  |  |   97|  71.7k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  71.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  71.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (269:13): [True: 0, False: 71.7k]
  ------------------
  270|      0|            return 0;
  271|  71.7k|        if (st->depth)
  ------------------
  |  Branch (271:13): [True: 0, False: 71.7k]
  ------------------
  272|      0|            memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
  273|  71.7k|        OPENSSL_free(st->indexes);
  ------------------
  |  |  107|  71.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  71.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  71.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  274|  71.7k|        st->indexes = newitems;
  275|  71.7k|        st->size = newsize;
  276|  71.7k|    }
  277|  62.4M|    st->indexes[(st->depth)++] = idx;
  278|  62.4M|    return 1;
  279|  62.4M|}
bn_ctx.c:BN_STACK_pop:
  282|  62.4M|{
  283|  62.4M|    return st->indexes[--(st->depth)];
  284|  62.4M|}
bn_ctx.c:BN_POOL_init:
  291|  82.6k|{
  292|  82.6k|    p->head = p->current = p->tail = NULL;
  293|  82.6k|    p->used = p->size = 0;
  294|  82.6k|}
bn_ctx.c:BN_POOL_finish:
  297|  82.6k|{
  298|  82.6k|    unsigned int loop;
  299|  82.6k|    BIGNUM *bn;
  300|       |
  301|   150k|    while (p->head) {
  ------------------
  |  Branch (301:12): [True: 67.5k, False: 82.6k]
  ------------------
  302|  1.14M|        for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
  ------------------
  |  |   15|  1.14M|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (302:44): [True: 1.08M, False: 67.5k]
  ------------------
  303|  1.08M|            if (bn->d)
  ------------------
  |  Branch (303:17): [True: 575k, False: 504k]
  ------------------
  304|   575k|                BN_clear_free(bn);
  305|  67.5k|        p->current = p->head->next;
  306|  67.5k|        OPENSSL_free(p->head);
  ------------------
  |  |  107|  67.5k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  67.5k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  67.5k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  307|  67.5k|        p->head = p->current;
  308|  67.5k|    }
  309|  82.6k|}
bn_ctx.c:BN_POOL_get:
  313|  77.6M|{
  314|  77.6M|    BIGNUM *bn;
  315|  77.6M|    unsigned int loop;
  316|       |
  317|       |    /* Full; allocate a new pool item and link it in. */
  318|  77.6M|    if (p->used == p->size) {
  ------------------
  |  Branch (318:9): [True: 67.5k, False: 77.6M]
  ------------------
  319|  67.5k|        BN_POOL_ITEM *item;
  320|       |
  321|  67.5k|        if ((item = OPENSSL_malloc(sizeof(*item))) == NULL)
  ------------------
  |  |   97|  67.5k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  67.5k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  67.5k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (321:13): [True: 0, False: 67.5k]
  ------------------
  322|      0|            return NULL;
  323|  1.14M|        for (loop = 0, bn = item->vals; loop++ < BN_CTX_POOL_SIZE; bn++) {
  ------------------
  |  |   15|  1.14M|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (323:41): [True: 1.08M, False: 67.5k]
  ------------------
  324|  1.08M|            bn_init(bn);
  325|  1.08M|            if ((flag & BN_FLG_SECURE) != 0)
  ------------------
  |  |   68|  1.08M|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (325:17): [True: 0, False: 1.08M]
  ------------------
  326|      0|                BN_set_flags(bn, BN_FLG_SECURE);
  ------------------
  |  |   68|      0|# define BN_FLG_SECURE           0x08
  ------------------
  327|  1.08M|        }
  328|  67.5k|        item->prev = p->tail;
  329|  67.5k|        item->next = NULL;
  330|       |
  331|  67.5k|        if (p->head == NULL)
  ------------------
  |  Branch (331:13): [True: 61.1k, False: 6.37k]
  ------------------
  332|  61.1k|            p->head = p->current = p->tail = item;
  333|  6.37k|        else {
  334|  6.37k|            p->tail->next = item;
  335|  6.37k|            p->tail = item;
  336|  6.37k|            p->current = item;
  337|  6.37k|        }
  338|  67.5k|        p->size += BN_CTX_POOL_SIZE;
  ------------------
  |  |   15|  67.5k|#define BN_CTX_POOL_SIZE        16
  ------------------
  339|  67.5k|        p->used++;
  340|       |        /* Return the first bignum from the new pool */
  341|  67.5k|        return item->vals;
  342|  67.5k|    }
  343|       |
  344|  77.6M|    if (!p->used)
  ------------------
  |  Branch (344:9): [True: 91.9k, False: 77.5M]
  ------------------
  345|  91.9k|        p->current = p->head;
  346|  77.5M|    else if ((p->used % BN_CTX_POOL_SIZE) == 0)
  ------------------
  |  |   15|  77.5M|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (346:14): [True: 4.17M, False: 73.3M]
  ------------------
  347|  4.17M|        p->current = p->current->next;
  348|  77.6M|    return p->current->vals + ((p->used++) % BN_CTX_POOL_SIZE);
  ------------------
  |  |   15|  77.6M|#define BN_CTX_POOL_SIZE        16
  ------------------
  349|  77.6M|}
bn_ctx.c:BN_POOL_release:
  352|  62.1M|{
  353|  62.1M|    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
  ------------------
  |  |   15|  62.1M|#define BN_CTX_POOL_SIZE        16
  ------------------
  354|       |
  355|  62.1M|    p->used -= num;
  356|   139M|    while (num--) {
  ------------------
  |  Branch (356:12): [True: 77.6M, False: 62.1M]
  ------------------
  357|  77.6M|        bn_check_top(p->current->vals + offset);
  358|  77.6M|        if (offset == 0) {
  ------------------
  |  Branch (358:13): [True: 4.33M, False: 73.3M]
  ------------------
  359|  4.33M|            offset = BN_CTX_POOL_SIZE - 1;
  ------------------
  |  |   15|  4.33M|#define BN_CTX_POOL_SIZE        16
  ------------------
  360|  4.33M|            p->current = p->current->prev;
  361|  4.33M|        } else
  362|  73.3M|            offset--;
  363|  77.6M|    }
  364|  62.1M|}

BN_div:
  211|  4.51M|{
  212|  4.51M|    int ret;
  213|       |
  214|  4.51M|    if (BN_is_zero(divisor)) {
  ------------------
  |  Branch (214:9): [True: 0, False: 4.51M]
  ------------------
  215|      0|        ERR_raise(ERR_LIB_BN, BN_R_DIV_BY_ZERO);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  216|      0|        return 0;
  217|      0|    }
  218|       |
  219|       |    /*
  220|       |     * Invalid zero-padding would have particularly bad consequences so don't
  221|       |     * just rely on bn_check_top() here (bn_check_top() works only for
  222|       |     * BN_DEBUG builds)
  223|       |     */
  224|  4.51M|    if (divisor->d[divisor->top - 1] == 0) {
  ------------------
  |  Branch (224:9): [True: 0, False: 4.51M]
  ------------------
  225|      0|        ERR_raise(ERR_LIB_BN, BN_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  226|      0|        return 0;
  227|      0|    }
  228|       |
  229|  4.51M|    ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
  230|       |
  231|  4.51M|    if (ret) {
  ------------------
  |  Branch (231:9): [True: 4.51M, False: 0]
  ------------------
  232|  4.51M|        if (dv != NULL)
  ------------------
  |  Branch (232:13): [True: 35.8k, False: 4.47M]
  ------------------
  233|  35.8k|            bn_correct_top(dv);
  234|  4.51M|        if (rm != NULL)
  ------------------
  |  Branch (234:13): [True: 4.47M, False: 33.5k]
  ------------------
  235|  4.47M|            bn_correct_top(rm);
  236|  4.51M|    }
  237|       |
  238|  4.51M|    return ret;
  239|  4.51M|}
bn_div_fixed_top:
  266|  4.51M|{
  267|  4.51M|    int norm_shift, i, j, loop;
  268|  4.51M|    BIGNUM *tmp, *snum, *sdiv, *res;
  269|  4.51M|    BN_ULONG *resp, *wnum, *wnumtop;
  ------------------
  |  |   37|  4.51M|#  define BN_ULONG        unsigned long
  ------------------
  270|  4.51M|    BN_ULONG d0, d1;
  ------------------
  |  |   37|  4.51M|#  define BN_ULONG        unsigned long
  ------------------
  271|  4.51M|    int num_n, div_n, num_neg;
  272|       |
  273|  4.51M|    assert(divisor->top > 0 && divisor->d[divisor->top - 1] != 0);
  274|       |
  275|  4.51M|    bn_check_top(num);
  276|  4.51M|    bn_check_top(divisor);
  277|  4.51M|    bn_check_top(dv);
  278|  4.51M|    bn_check_top(rm);
  279|       |
  280|  4.51M|    BN_CTX_start(ctx);
  281|  4.51M|    res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
  ------------------
  |  Branch (281:11): [True: 4.47M, False: 35.8k]
  ------------------
  282|  4.51M|    tmp = BN_CTX_get(ctx);
  283|  4.51M|    snum = BN_CTX_get(ctx);
  284|  4.51M|    sdiv = BN_CTX_get(ctx);
  285|  4.51M|    if (sdiv == NULL)
  ------------------
  |  Branch (285:9): [True: 0, False: 4.51M]
  ------------------
  286|      0|        goto err;
  287|       |
  288|       |    /* First we normalise the numbers */
  289|  4.51M|    if (!BN_copy(sdiv, divisor))
  ------------------
  |  Branch (289:9): [True: 0, False: 4.51M]
  ------------------
  290|      0|        goto err;
  291|  4.51M|    norm_shift = bn_left_align(sdiv);
  292|  4.51M|    sdiv->neg = 0;
  293|       |    /*
  294|       |     * Note that bn_lshift_fixed_top's output is always one limb longer
  295|       |     * than input, even when norm_shift is zero. This means that amount of
  296|       |     * inner loop iterations is invariant of dividend value, and that one
  297|       |     * doesn't need to compare dividend and divisor if they were originally
  298|       |     * of the same bit length.
  299|       |     */
  300|  4.51M|    if (!(bn_lshift_fixed_top(snum, num, norm_shift)))
  ------------------
  |  Branch (300:9): [True: 0, False: 4.51M]
  ------------------
  301|      0|        goto err;
  302|       |
  303|  4.51M|    div_n = sdiv->top;
  304|  4.51M|    num_n = snum->top;
  305|       |
  306|  4.51M|    if (num_n <= div_n) {
  ------------------
  |  Branch (306:9): [True: 23.4k, False: 4.48M]
  ------------------
  307|       |        /* caller didn't pad dividend -> no constant-time guarantee... */
  308|  23.4k|        if (bn_wexpand(snum, div_n + 1) == NULL)
  ------------------
  |  Branch (308:13): [True: 0, False: 23.4k]
  ------------------
  309|      0|            goto err;
  310|  23.4k|        memset(&(snum->d[num_n]), 0, (div_n - num_n + 1) * sizeof(BN_ULONG));
  311|  23.4k|        snum->top = num_n = div_n + 1;
  312|  23.4k|    }
  313|       |
  314|  4.51M|    loop = num_n - div_n;
  315|       |    /*
  316|       |     * Lets setup a 'window' into snum This is the part that corresponds to
  317|       |     * the current 'area' being divided
  318|       |     */
  319|  4.51M|    wnum = &(snum->d[loop]);
  320|  4.51M|    wnumtop = &(snum->d[num_n - 1]);
  321|       |
  322|       |    /* Get the top 2 words of sdiv */
  323|  4.51M|    d0 = sdiv->d[div_n - 1];
  324|  4.51M|    d1 = (div_n == 1) ? 0 : sdiv->d[div_n - 2];
  ------------------
  |  Branch (324:10): [True: 148k, False: 4.36M]
  ------------------
  325|       |
  326|       |    /* Setup quotient */
  327|  4.51M|    if (!bn_wexpand(res, loop))
  ------------------
  |  Branch (327:9): [True: 0, False: 4.51M]
  ------------------
  328|      0|        goto err;
  329|  4.51M|    num_neg = num->neg;
  330|  4.51M|    res->neg = (num_neg ^ divisor->neg);
  331|  4.51M|    res->top = loop;
  332|  4.51M|    res->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  4.51M|#  define BN_FLG_FIXED_TOP 0
  ------------------
  333|  4.51M|    resp = &(res->d[loop]);
  334|       |
  335|       |    /* space for temp */
  336|  4.51M|    if (!bn_wexpand(tmp, (div_n + 1)))
  ------------------
  |  Branch (336:9): [True: 0, False: 4.51M]
  ------------------
  337|      0|        goto err;
  338|       |
  339|  21.7M|    for (i = 0; i < loop; i++, wnumtop--) {
  ------------------
  |  Branch (339:17): [True: 17.1M, False: 4.51M]
  ------------------
  340|  17.1M|        BN_ULONG q, l0;
  ------------------
  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  ------------------
  341|       |        /*
  342|       |         * the first part of the loop uses the top two words of snum and sdiv
  343|       |         * to calculate a BN_ULONG q such that | wnum - sdiv * q | < sdiv
  344|       |         */
  345|       |# if defined(BN_DIV3W)
  346|       |        q = bn_div_3_words(wnumtop, d1, d0);
  347|       |# else
  348|  17.1M|        BN_ULONG n0, n1, rem = 0;
  ------------------
  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  ------------------
  349|       |
  350|  17.1M|        n0 = wnumtop[0];
  351|  17.1M|        n1 = wnumtop[-1];
  352|  17.1M|        if (n0 == d0)
  ------------------
  |  Branch (352:13): [True: 83.3k, False: 17.1M]
  ------------------
  353|  83.3k|            q = BN_MASK2;
  ------------------
  |  |   94|  83.3k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  354|  17.1M|        else {                  /* n0 < d0 */
  355|  17.1M|            BN_ULONG n2 = (wnumtop == wnum) ? 0 : wnumtop[-2];
  ------------------
  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  ------------------
  |  Branch (355:27): [True: 282k, False: 16.8M]
  ------------------
  356|       |#  ifdef BN_LLONG
  357|       |            BN_ULLONG t2;
  358|       |
  359|       |#   if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words)
  360|       |            q = (BN_ULONG)(((((BN_ULLONG) n0) << BN_BITS2) | n1) / d0);
  361|       |#   else
  362|       |            q = bn_div_words(n0, n1, d0);
  363|       |#   endif
  364|       |
  365|       |#   ifndef REMAINDER_IS_ALREADY_CALCULATED
  366|       |            /*
  367|       |             * rem doesn't have to be BN_ULLONG. The least we
  368|       |             * know it's less that d0, isn't it?
  369|       |             */
  370|       |            rem = (n1 - q * d0) & BN_MASK2;
  371|       |#   endif
  372|       |            t2 = (BN_ULLONG) d1 *q;
  373|       |
  374|       |            for (;;) {
  375|       |                if (t2 <= ((((BN_ULLONG) rem) << BN_BITS2) | n2))
  376|       |                    break;
  377|       |                q--;
  378|       |                rem += d0;
  379|       |                if (rem < d0)
  380|       |                    break;      /* don't let rem overflow */
  381|       |                t2 -= d1;
  382|       |            }
  383|       |#  else                         /* !BN_LLONG */
  384|  17.1M|            BN_ULONG t2l, t2h;
  ------------------
  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  ------------------
  385|       |
  386|  17.1M|            q = bn_div_words(n0, n1, d0);
  387|  17.1M|#   ifndef REMAINDER_IS_ALREADY_CALCULATED
  388|  17.1M|            rem = (n1 - q * d0) & BN_MASK2;
  ------------------
  |  |   94|  17.1M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  389|  17.1M|#   endif
  390|       |
  391|       |#   if defined(BN_UMULT_LOHI)
  392|       |            BN_UMULT_LOHI(t2l, t2h, d1, q);
  393|       |#   elif defined(BN_UMULT_HIGH)
  394|       |            t2l = d1 * q;
  395|       |            t2h = BN_UMULT_HIGH(d1, q);
  396|       |#   else
  397|  17.1M|            {
  398|  17.1M|                BN_ULONG ql, qh;
  ------------------
  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  ------------------
  399|  17.1M|                t2l = LBITS(d1);
  ------------------
  |  |  566|  17.1M|#  define LBITS(a)        ((a)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  17.1M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  400|  17.1M|                t2h = HBITS(d1);
  ------------------
  |  |  567|  17.1M|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   93|  17.1M|#  define BN_BITS4        32
  |  |  ------------------
  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  17.1M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  401|  17.1M|                ql = LBITS(q);
  ------------------
  |  |  566|  17.1M|#  define LBITS(a)        ((a)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  17.1M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  402|  17.1M|                qh = HBITS(q);
  ------------------
  |  |  567|  17.1M|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   93|  17.1M|#  define BN_BITS4        32
  |  |  ------------------
  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  17.1M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  403|  17.1M|                mul64(t2l, t2h, ql, qh); /* t2=(BN_ULLONG)d1*q; */
  ------------------
  |  |  575|  17.1M|        { \
  |  |  576|  17.1M|        BN_ULONG m,m1,lt,ht; \
  |  |  ------------------
  |  |  |  |   37|  17.1M|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  577|  17.1M| \
  |  |  578|  17.1M|        lt=l; \
  |  |  579|  17.1M|        ht=h; \
  |  |  580|  17.1M|        m =(bh)*(lt); \
  |  |  581|  17.1M|        lt=(bl)*(lt); \
  |  |  582|  17.1M|        m1=(bl)*(ht); \
  |  |  583|  17.1M|        ht =(bh)*(ht); \
  |  |  584|  17.1M|        m=(m+m1)&BN_MASK2; ht += L2HBITS((BN_ULONG)(m < m1)); \
  |  |  ------------------
  |  |  |  |   94|  17.1M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |                       m=(m+m1)&BN_MASK2; ht += L2HBITS((BN_ULONG)(m < m1)); \
  |  |  ------------------
  |  |  |  |  568|  17.1M|#  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  17.1M|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  17.1M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|  17.1M|        ht+=HBITS(m); \
  |  |  ------------------
  |  |  |  |  567|  17.1M|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  17.1M|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  17.1M|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  586|  17.1M|        m1=L2HBITS(m); \
  |  |  ------------------
  |  |  |  |  568|  17.1M|#  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  17.1M|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  17.1M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  587|  17.1M|        lt=(lt+m1)&BN_MASK2; ht += (lt < m1); \
  |  |  ------------------
  |  |  |  |   94|  17.1M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |  588|  17.1M|        (l)=lt; \
  |  |  589|  17.1M|        (h)=ht; \
  |  |  590|  17.1M|        }
  ------------------
  404|  17.1M|            }
  405|  17.1M|#   endif
  406|       |
  407|  17.1M|            for (;;) {
  408|  17.1M|                if ((t2h < rem) || ((t2h == rem) && (t2l <= n2)))
  ------------------
  |  Branch (408:21): [True: 10.6M, False: 6.47M]
  |  Branch (408:37): [True: 358k, False: 6.12M]
  |  Branch (408:53): [True: 271k, False: 86.4k]
  ------------------
  409|  10.9M|                    break;
  410|  6.20M|                q--;
  411|  6.20M|                rem += d0;
  412|  6.20M|                if (rem < d0)
  ------------------
  |  Branch (412:21): [True: 6.17M, False: 32.8k]
  ------------------
  413|  6.17M|                    break;      /* don't let rem overflow */
  414|  32.8k|                if (t2l < d1)
  ------------------
  |  Branch (414:21): [True: 19.2k, False: 13.6k]
  ------------------
  415|  19.2k|                    t2h--;
  416|  32.8k|                t2l -= d1;
  417|  32.8k|            }
  418|  17.1M|#  endif                        /* !BN_LLONG */
  419|  17.1M|        }
  420|  17.1M|# endif                         /* !BN_DIV3W */
  421|       |
  422|  17.1M|        l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
  423|  17.1M|        tmp->d[div_n] = l0;
  424|  17.1M|        wnum--;
  425|       |        /*
  426|       |         * ignore top values of the bignums just sub the two BN_ULONG arrays
  427|       |         * with bn_sub_words
  428|       |         */
  429|  17.1M|        l0 = bn_sub_words(wnum, wnum, tmp->d, div_n + 1);
  430|  17.1M|        q -= l0;
  431|       |        /*
  432|       |         * Note: As we have considered only the leading two BN_ULONGs in
  433|       |         * the calculation of q, sdiv * q might be greater than wnum (but
  434|       |         * then (q-1) * sdiv is less or equal than wnum)
  435|       |         */
  436|  85.3M|        for (l0 = 0 - l0, j = 0; j < div_n; j++)
  ------------------
  |  Branch (436:34): [True: 68.1M, False: 17.1M]
  ------------------
  437|  68.1M|            tmp->d[j] = sdiv->d[j] & l0;
  438|  17.1M|        l0 = bn_add_words(wnum, wnum, tmp->d, div_n);
  439|  17.1M|        (*wnumtop) += l0;
  440|  17.1M|        assert((*wnumtop) == 0);
  441|       |
  442|       |        /* store part of the result */
  443|  17.1M|        *--resp = q;
  444|  17.1M|    }
  445|       |    /* snum holds remainder, it's as wide as divisor */
  446|  4.51M|    snum->neg = num_neg;
  447|  4.51M|    snum->top = div_n;
  448|  4.51M|    snum->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  4.51M|#  define BN_FLG_FIXED_TOP 0
  ------------------
  449|       |
  450|  4.51M|    if (rm != NULL && bn_rshift_fixed_top(rm, snum, norm_shift) == 0)
  ------------------
  |  Branch (450:9): [True: 4.47M, False: 33.5k]
  |  Branch (450:23): [True: 0, False: 4.47M]
  ------------------
  451|      0|        goto err;
  452|       |
  453|  4.51M|    BN_CTX_end(ctx);
  454|  4.51M|    return 1;
  455|      0| err:
  456|      0|    bn_check_top(rm);
  457|      0|    BN_CTX_end(ctx);
  458|      0|    return 0;
  459|  4.51M|}
bn_div.c:bn_left_align:
  142|  4.51M|{
  143|  4.51M|    BN_ULONG *d = num->d, n, m, rmask;
  ------------------
  |  |   37|  4.51M|#  define BN_ULONG        unsigned long
  ------------------
  144|  4.51M|    int top = num->top;
  145|  4.51M|    int rshift = BN_num_bits_word(d[top - 1]), lshift, i;
  146|       |
  147|  4.51M|    lshift = BN_BITS2 - rshift;
  ------------------
  |  |   54|  4.51M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.51M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  148|  4.51M|    rshift %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|  4.51M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.51M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  149|  4.51M|    rmask = (BN_ULONG)0 - rshift;  /* rmask = 0 - (rshift != 0) */
  150|  4.51M|    rmask |= rmask >> 8;
  151|       |
  152|  22.1M|    for (i = 0, m = 0; i < top; i++) {
  ------------------
  |  Branch (152:24): [True: 17.5M, False: 4.51M]
  ------------------
  153|  17.5M|        n = d[i];
  154|  17.5M|        d[i] = ((n << lshift) | m) & BN_MASK2;
  ------------------
  |  |   94|  17.5M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  155|  17.5M|        m = (n >> rshift) & rmask;
  156|  17.5M|    }
  157|       |
  158|  4.51M|    return lshift;
  159|  4.51M|}

ossl_err_load_BN_strings:
   50|      2|{
   51|      2|#ifndef OPENSSL_NO_ERR
   52|      2|    if (ERR_reason_error_string(BN_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (52:9): [True: 2, False: 0]
  ------------------
   53|      2|        ERR_load_strings_const(BN_str_reasons);
   54|      2|#endif
   55|      2|    return 1;
   56|      2|}

BN_mod_exp:
   99|  8.84k|{
  100|  8.84k|    int ret;
  101|       |
  102|  8.84k|    bn_check_top(a);
  103|  8.84k|    bn_check_top(p);
  104|  8.84k|    bn_check_top(m);
  105|       |
  106|       |    /*-
  107|       |     * For even modulus  m = 2^k*m_odd, it might make sense to compute
  108|       |     * a^p mod m_odd  and  a^p mod 2^k  separately (with Montgomery
  109|       |     * exponentiation for the odd part), using appropriate exponent
  110|       |     * reductions, and combine the results using the CRT.
  111|       |     *
  112|       |     * For now, we use Montgomery only if the modulus is odd; otherwise,
  113|       |     * exponentiation using the reciprocal-based quick remaindering
  114|       |     * algorithm is used.
  115|       |     *
  116|       |     * (Timing obtained with expspeed.c [computations  a^p mod m
  117|       |     * where  a, p, m  are of the same length: 256, 512, 1024, 2048,
  118|       |     * 4096, 8192 bits], compared to the running time of the
  119|       |     * standard algorithm:
  120|       |     *
  121|       |     *   BN_mod_exp_mont   33 .. 40 %  [AMD K6-2, Linux, debug configuration]
  122|       |     *                     55 .. 77 %  [UltraSparc processor, but
  123|       |     *                                  debug-solaris-sparcv8-gcc conf.]
  124|       |     *
  125|       |     *   BN_mod_exp_recp   50 .. 70 %  [AMD K6-2, Linux, debug configuration]
  126|       |     *                     62 .. 118 % [UltraSparc, debug-solaris-sparcv8-gcc]
  127|       |     *
  128|       |     * On the Sparc, BN_mod_exp_recp was faster than BN_mod_exp_mont
  129|       |     * at 2048 and more bits, but at 512 and 1024 bits, it was
  130|       |     * slower even than the standard algorithm!
  131|       |     *
  132|       |     * "Real" timings [linux-elf, solaris-sparcv9-gcc configurations]
  133|       |     * should be obtained when the new Montgomery reduction code
  134|       |     * has been integrated into OpenSSL.)
  135|       |     */
  136|       |
  137|  8.84k|#define MONT_MUL_MOD
  138|  8.84k|#define MONT_EXP_WORD
  139|  8.84k|#define RECP_MUL_MOD
  140|       |
  141|  8.84k|#ifdef MONT_MUL_MOD
  142|  8.84k|    if (BN_is_odd(m)) {
  ------------------
  |  Branch (142:9): [True: 8.84k, False: 6]
  ------------------
  143|  8.84k|# ifdef MONT_EXP_WORD
  144|  8.84k|        if (a->top == 1 && !a->neg
  ------------------
  |  Branch (144:13): [True: 2.73k, False: 6.10k]
  |  Branch (144:28): [True: 2.73k, False: 0]
  ------------------
  145|  8.84k|            && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)
  ------------------
  |  |   67|  2.73k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (145:16): [True: 2.58k, False: 152]
  ------------------
  146|  8.84k|            && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0)
  ------------------
  |  |   67|  2.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (146:16): [True: 2.58k, False: 0]
  ------------------
  147|  8.84k|            && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) {
  ------------------
  |  |   67|  2.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (147:16): [True: 2.58k, False: 0]
  ------------------
  148|  2.58k|            BN_ULONG A = a->d[0];
  ------------------
  |  |   37|  2.58k|#  define BN_ULONG        unsigned long
  ------------------
  149|  2.58k|            ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
  150|  2.58k|        } else
  151|  6.25k|# endif
  152|  6.25k|            ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
  153|  8.84k|    } else
  154|      6|#endif
  155|      6|#ifdef RECP_MUL_MOD
  156|      6|    {
  157|      6|        ret = BN_mod_exp_recp(r, a, p, m, ctx);
  158|      6|    }
  159|       |#else
  160|       |    {
  161|       |        ret = BN_mod_exp_simple(r, a, p, m, ctx);
  162|       |    }
  163|       |#endif
  164|       |
  165|  8.84k|    bn_check_top(r);
  166|  8.84k|    return ret;
  167|  8.84k|}
BN_mod_exp_recp:
  171|      6|{
  172|      6|    int i, j, bits, ret = 0, wstart, wend, window;
  173|      6|    int start = 1;
  174|      6|    BIGNUM *aa;
  175|       |    /* Table of variables obtained from 'ctx' */
  176|      6|    BIGNUM *val[TABLE_SIZE];
  177|      6|    BN_RECP_CTX recp;
  178|       |
  179|      6|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|      6|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (179:9): [True: 6, False: 0]
  ------------------
  180|      6|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (180:16): [True: 0, False: 0]
  ------------------
  181|      6|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (181:16): [True: 0, False: 0]
  ------------------
  182|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
  183|      6|        ERR_raise(ERR_LIB_BN, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      6|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      6|    (ERR_new(),                                                 \
  |  |  |  |  404|      6|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      6|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      6|     ERR_set_error)
  |  |  ------------------
  ------------------
  184|      6|        return 0;
  185|      6|    }
  186|       |
  187|      0|    bits = BN_num_bits(p);
  188|      0|    if (bits == 0) {
  ------------------
  |  Branch (188:9): [True: 0, False: 0]
  ------------------
  189|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  190|      0|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (190:13): [True: 0, False: 0]
  ------------------
  191|      0|            ret = 1;
  192|      0|            BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  193|      0|        } else {
  194|      0|            ret = BN_one(r);
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  195|      0|        }
  196|      0|        return ret;
  197|      0|    }
  198|       |
  199|      0|    BN_RECP_CTX_init(&recp);
  200|       |
  201|      0|    BN_CTX_start(ctx);
  202|      0|    aa = BN_CTX_get(ctx);
  203|      0|    val[0] = BN_CTX_get(ctx);
  204|      0|    if (val[0] == NULL)
  ------------------
  |  Branch (204:9): [True: 0, False: 0]
  ------------------
  205|      0|        goto err;
  206|       |
  207|      0|    if (m->neg) {
  ------------------
  |  Branch (207:9): [True: 0, False: 0]
  ------------------
  208|       |        /* ignore sign of 'm' */
  209|      0|        if (!BN_copy(aa, m))
  ------------------
  |  Branch (209:13): [True: 0, False: 0]
  ------------------
  210|      0|            goto err;
  211|      0|        aa->neg = 0;
  212|      0|        if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)
  ------------------
  |  Branch (212:13): [True: 0, False: 0]
  ------------------
  213|      0|            goto err;
  214|      0|    } else {
  215|      0|        if (BN_RECP_CTX_set(&recp, m, ctx) <= 0)
  ------------------
  |  Branch (215:13): [True: 0, False: 0]
  ------------------
  216|      0|            goto err;
  217|      0|    }
  218|       |
  219|      0|    if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (219:9): [True: 0, False: 0]
  ------------------
  220|      0|        goto err;               /* 1 */
  221|      0|    if (BN_is_zero(val[0])) {
  ------------------
  |  Branch (221:9): [True: 0, False: 0]
  ------------------
  222|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  223|      0|        ret = 1;
  224|      0|        goto err;
  225|      0|    }
  226|       |
  227|      0|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|      0|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  323|      0|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  324|      0|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  325|      0|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  228|      0|    if (window > 1) {
  ------------------
  |  Branch (228:9): [True: 0, False: 0]
  ------------------
  229|      0|        if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx))
  ------------------
  |  Branch (229:13): [True: 0, False: 0]
  ------------------
  230|      0|            goto err;           /* 2 */
  231|      0|        j = 1 << (window - 1);
  232|      0|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (232:21): [True: 0, False: 0]
  ------------------
  233|      0|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (233:17): [True: 0, False: 0]
  ------------------
  234|      0|                !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx))
  ------------------
  |  Branch (234:17): [True: 0, False: 0]
  ------------------
  235|      0|                goto err;
  236|      0|        }
  237|      0|    }
  238|       |
  239|      0|    start = 1;                  /* This is used to avoid multiplication etc
  240|       |                                 * when there is only the value '1' in the
  241|       |                                 * buffer. */
  242|      0|    wstart = bits - 1;          /* The top bit of the window */
  243|      0|    wend = 0;                   /* The bottom bit of the window */
  244|       |
  245|      0|    if (!BN_one(r))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (245:9): [True: 0, False: 0]
  ------------------
  246|      0|        goto err;
  247|       |
  248|      0|    for (;;) {
  249|      0|        int wvalue;             /* The 'value' of the window */
  250|       |
  251|      0|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (251:13): [True: 0, False: 0]
  ------------------
  252|      0|            if (!start)
  ------------------
  |  Branch (252:17): [True: 0, False: 0]
  ------------------
  253|      0|                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
  ------------------
  |  Branch (253:21): [True: 0, False: 0]
  ------------------
  254|      0|                    goto err;
  255|      0|            if (wstart == 0)
  ------------------
  |  Branch (255:17): [True: 0, False: 0]
  ------------------
  256|      0|                break;
  257|      0|            wstart--;
  258|      0|            continue;
  259|      0|        }
  260|       |        /*
  261|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
  262|       |         * a window to do.  To do this we need to scan forward until the last
  263|       |         * set bit before the end of the window
  264|       |         */
  265|      0|        wvalue = 1;
  266|      0|        wend = 0;
  267|      0|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (267:21): [True: 0, False: 0]
  ------------------
  268|      0|            if (wstart - i < 0)
  ------------------
  |  Branch (268:17): [True: 0, False: 0]
  ------------------
  269|      0|                break;
  270|      0|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (270:17): [True: 0, False: 0]
  ------------------
  271|      0|                wvalue <<= (i - wend);
  272|      0|                wvalue |= 1;
  273|      0|                wend = i;
  274|      0|            }
  275|      0|        }
  276|       |
  277|       |        /* wend is the size of the current window */
  278|      0|        j = wend + 1;
  279|       |        /* add the 'bytes above' */
  280|      0|        if (!start)
  ------------------
  |  Branch (280:13): [True: 0, False: 0]
  ------------------
  281|      0|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (281:25): [True: 0, False: 0]
  ------------------
  282|      0|                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
  ------------------
  |  Branch (282:21): [True: 0, False: 0]
  ------------------
  283|      0|                    goto err;
  284|      0|            }
  285|       |
  286|       |        /* wvalue will be an odd number < 2^window */
  287|      0|        if (!BN_mod_mul_reciprocal(r, r, val[wvalue >> 1], &recp, ctx))
  ------------------
  |  Branch (287:13): [True: 0, False: 0]
  ------------------
  288|      0|            goto err;
  289|       |
  290|       |        /* move the 'window' down further */
  291|      0|        wstart -= wend + 1;
  292|      0|        start = 0;
  293|      0|        if (wstart < 0)
  ------------------
  |  Branch (293:13): [True: 0, False: 0]
  ------------------
  294|      0|            break;
  295|      0|    }
  296|      0|    ret = 1;
  297|      0| err:
  298|      0|    BN_CTX_end(ctx);
  299|      0|    BN_RECP_CTX_free(&recp);
  300|      0|    bn_check_top(r);
  301|      0|    return ret;
  302|      0|}
BN_mod_exp_mont:
  306|  6.93k|{
  307|  6.93k|    int i, j, bits, ret = 0, wstart, wend, window;
  308|  6.93k|    int start = 1;
  309|  6.93k|    BIGNUM *d, *r;
  310|  6.93k|    const BIGNUM *aa;
  311|       |    /* Table of variables obtained from 'ctx' */
  312|  6.93k|    BIGNUM *val[TABLE_SIZE];
  313|  6.93k|    BN_MONT_CTX *mont = NULL;
  314|       |
  315|  6.93k|    bn_check_top(a);
  316|  6.93k|    bn_check_top(p);
  317|  6.93k|    bn_check_top(m);
  318|       |
  319|  6.93k|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (319:9): [True: 0, False: 6.93k]
  ------------------
  320|      0|        ERR_raise(ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  321|      0|        return 0;
  322|      0|    }
  323|       |
  324|  6.93k|    if (m->top <= BN_CONSTTIME_SIZE_LIMIT
  ------------------
  |  |   46|  13.8k|#define BN_CONSTTIME_SIZE_LIMIT (INT_MAX / BN_BYTES / 256)
  |  |  ------------------
  |  |  |  |   38|  6.93k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (324:9): [True: 6.93k, False: 0]
  ------------------
  325|  6.93k|        && (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  6.93k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (325:13): [True: 542, False: 6.39k]
  ------------------
  326|  6.93k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  6.39k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (326:16): [True: 0, False: 6.39k]
  ------------------
  327|  6.93k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0)) {
  ------------------
  |  |   67|  6.39k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (327:16): [True: 0, False: 6.39k]
  ------------------
  328|    542|        return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
  329|    542|    }
  330|       |
  331|  6.39k|    bits = BN_num_bits(p);
  332|  6.39k|    if (bits == 0) {
  ------------------
  |  Branch (332:9): [True: 0, False: 6.39k]
  ------------------
  333|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  334|      0|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (334:13): [True: 0, False: 0]
  ------------------
  335|      0|            ret = 1;
  336|      0|            BN_zero(rr);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  337|      0|        } else {
  338|      0|            ret = BN_one(rr);
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  339|      0|        }
  340|      0|        return ret;
  341|      0|    }
  342|       |
  343|  6.39k|    BN_CTX_start(ctx);
  344|  6.39k|    d = BN_CTX_get(ctx);
  345|  6.39k|    r = BN_CTX_get(ctx);
  346|  6.39k|    val[0] = BN_CTX_get(ctx);
  347|  6.39k|    if (val[0] == NULL)
  ------------------
  |  Branch (347:9): [True: 0, False: 6.39k]
  ------------------
  348|      0|        goto err;
  349|       |
  350|       |    /*
  351|       |     * If this is not done, things will break in the montgomery part
  352|       |     */
  353|       |
  354|  6.39k|    if (in_mont != NULL)
  ------------------
  |  Branch (354:9): [True: 653, False: 5.74k]
  ------------------
  355|    653|        mont = in_mont;
  356|  5.74k|    else {
  357|  5.74k|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (357:13): [True: 0, False: 5.74k]
  ------------------
  358|      0|            goto err;
  359|  5.74k|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (359:13): [True: 0, False: 5.74k]
  ------------------
  360|      0|            goto err;
  361|  5.74k|    }
  362|       |
  363|  6.39k|    if (a->neg || BN_ucmp(a, m) >= 0) {
  ------------------
  |  Branch (363:9): [True: 0, False: 6.39k]
  |  Branch (363:19): [True: 0, False: 6.39k]
  ------------------
  364|      0|        if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (364:13): [True: 0, False: 0]
  ------------------
  365|      0|            goto err;
  366|      0|        aa = val[0];
  367|      0|    } else
  368|  6.39k|        aa = a;
  369|  6.39k|    if (!bn_to_mont_fixed_top(val[0], aa, mont, ctx))
  ------------------
  |  Branch (369:9): [True: 0, False: 6.39k]
  ------------------
  370|      0|        goto err;               /* 1 */
  371|       |
  372|  6.39k|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|  6.39k|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 0, False: 6.39k]
  |  |  ------------------
  |  |  323|  6.39k|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 2.46k, False: 3.93k]
  |  |  ------------------
  |  |  324|  6.39k|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 3.89k, False: 39]
  |  |  ------------------
  |  |  325|  3.93k|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 17, False: 22]
  |  |  ------------------
  ------------------
  373|  6.39k|    if (window > 1) {
  ------------------
  |  Branch (373:9): [True: 6.37k, False: 22]
  ------------------
  374|  6.37k|        if (!bn_mul_mont_fixed_top(d, val[0], val[0], mont, ctx))
  ------------------
  |  Branch (374:13): [True: 0, False: 6.37k]
  ------------------
  375|      0|            goto err;           /* 2 */
  376|  6.37k|        j = 1 << (window - 1);
  377|  70.6k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (377:21): [True: 64.2k, False: 6.37k]
  ------------------
  378|  64.2k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (378:17): [True: 0, False: 64.2k]
  ------------------
  379|  64.2k|                !bn_mul_mont_fixed_top(val[i], val[i - 1], d, mont, ctx))
  ------------------
  |  Branch (379:17): [True: 0, False: 64.2k]
  ------------------
  380|      0|                goto err;
  381|  64.2k|        }
  382|  6.37k|    }
  383|       |
  384|  6.39k|    start = 1;                  /* This is used to avoid multiplication etc
  385|       |                                 * when there is only the value '1' in the
  386|       |                                 * buffer. */
  387|  6.39k|    wstart = bits - 1;          /* The top bit of the window */
  388|  6.39k|    wend = 0;                   /* The bottom bit of the window */
  389|       |
  390|  6.39k|#if 1                           /* by Shay Gueron's suggestion */
  391|  6.39k|    j = m->top;                 /* borrow j */
  392|  6.39k|    if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {
  ------------------
  |  |   54|  6.39k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.39k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (392:9): [True: 1.63k, False: 4.76k]
  ------------------
  393|  1.63k|        if (bn_wexpand(r, j) == NULL)
  ------------------
  |  Branch (393:13): [True: 0, False: 1.63k]
  ------------------
  394|      0|            goto err;
  395|       |        /* 2^(top*BN_BITS2) - m */
  396|  1.63k|        r->d[0] = (0 - m->d[0]) & BN_MASK2;
  ------------------
  |  |   94|  1.63k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  397|  9.14k|        for (i = 1; i < j; i++)
  ------------------
  |  Branch (397:21): [True: 7.51k, False: 1.63k]
  ------------------
  398|  7.51k|            r->d[i] = (~m->d[i]) & BN_MASK2;
  ------------------
  |  |   94|  9.14k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  399|  1.63k|        r->top = j;
  400|  1.63k|        r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.63k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  401|  1.63k|    } else
  402|  4.76k|#endif
  403|  4.76k|    if (!bn_to_mont_fixed_top(r, BN_value_one(), mont, ctx))
  ------------------
  |  Branch (403:9): [True: 0, False: 4.76k]
  ------------------
  404|      0|        goto err;
  405|   981k|    for (;;) {
  406|   981k|        int wvalue;             /* The 'value' of the window */
  407|       |
  408|   981k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (408:13): [True: 754k, False: 226k]
  ------------------
  409|   754k|            if (!start) {
  ------------------
  |  Branch (409:17): [True: 754k, False: 0]
  ------------------
  410|   754k|                if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
  ------------------
  |  Branch (410:21): [True: 0, False: 754k]
  ------------------
  411|      0|                    goto err;
  412|   754k|            }
  413|   754k|            if (wstart == 0)
  ------------------
  |  Branch (413:17): [True: 2.82k, False: 751k]
  ------------------
  414|  2.82k|                break;
  415|   751k|            wstart--;
  416|   751k|            continue;
  417|   754k|        }
  418|       |        /*
  419|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
  420|       |         * a window to do.  To do this we need to scan forward until the last
  421|       |         * set bit before the end of the window
  422|       |         */
  423|   226k|        wvalue = 1;
  424|   226k|        wend = 0;
  425|   990k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (425:21): [True: 765k, False: 224k]
  ------------------
  426|   765k|            if (wstart - i < 0)
  ------------------
  |  Branch (426:17): [True: 2.53k, False: 763k]
  ------------------
  427|  2.53k|                break;
  428|   763k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (428:17): [True: 703k, False: 60.2k]
  ------------------
  429|   703k|                wvalue <<= (i - wend);
  430|   703k|                wvalue |= 1;
  431|   703k|                wend = i;
  432|   703k|            }
  433|   763k|        }
  434|       |
  435|       |        /* wend is the size of the current window */
  436|   226k|        j = wend + 1;
  437|       |        /* add the 'bytes above' */
  438|   226k|        if (!start)
  ------------------
  |  Branch (438:13): [True: 220k, False: 6.39k]
  ------------------
  439|  1.14M|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (439:25): [True: 921k, False: 220k]
  ------------------
  440|   921k|                if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
  ------------------
  |  Branch (440:21): [True: 0, False: 921k]
  ------------------
  441|      0|                    goto err;
  442|   921k|            }
  443|       |
  444|       |        /* wvalue will be an odd number < 2^window */
  445|   226k|        if (!bn_mul_mont_fixed_top(r, r, val[wvalue >> 1], mont, ctx))
  ------------------
  |  Branch (445:13): [True: 0, False: 226k]
  ------------------
  446|      0|            goto err;
  447|       |
  448|       |        /* move the 'window' down further */
  449|   226k|        wstart -= wend + 1;
  450|   226k|        start = 0;
  451|   226k|        if (wstart < 0)
  ------------------
  |  Branch (451:13): [True: 3.56k, False: 223k]
  ------------------
  452|  3.56k|            break;
  453|   226k|    }
  454|       |    /*
  455|       |     * Done with zero-padded intermediate BIGNUMs. Final BN_from_montgomery
  456|       |     * removes padding [if any] and makes return value suitable for public
  457|       |     * API consumer.
  458|       |     */
  459|       |#if defined(SPARC_T4_MONT)
  460|       |    if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) {
  461|       |        j = mont->N.top;        /* borrow j */
  462|       |        val[0]->d[0] = 1;       /* borrow val[0] */
  463|       |        for (i = 1; i < j; i++)
  464|       |            val[0]->d[i] = 0;
  465|       |        val[0]->top = j;
  466|       |        if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx))
  467|       |            goto err;
  468|       |    } else
  469|       |#endif
  470|  6.39k|    if (!BN_from_montgomery(rr, r, mont, ctx))
  ------------------
  |  Branch (470:9): [True: 0, False: 6.39k]
  ------------------
  471|      0|        goto err;
  472|  6.39k|    ret = 1;
  473|  6.39k| err:
  474|  6.39k|    if (in_mont == NULL)
  ------------------
  |  Branch (474:9): [True: 5.74k, False: 653]
  ------------------
  475|  5.74k|        BN_MONT_CTX_free(mont);
  476|  6.39k|    BN_CTX_end(ctx);
  477|  6.39k|    bn_check_top(rr);
  478|  6.39k|    return ret;
  479|  6.39k|}
BN_mod_exp_mont_consttime:
  604|    542|{
  605|    542|    int i, bits, ret = 0, window, wvalue, wmask, window0;
  606|    542|    int top;
  607|    542|    BN_MONT_CTX *mont = NULL;
  608|       |
  609|    542|    int numPowers;
  610|    542|    unsigned char *powerbufFree = NULL;
  611|    542|    int powerbufLen = 0;
  612|    542|    unsigned char *powerbuf = NULL;
  613|    542|    BIGNUM tmp, am;
  614|       |#if defined(SPARC_T4_MONT)
  615|       |    unsigned int t4 = 0;
  616|       |#endif
  617|       |
  618|    542|    bn_check_top(a);
  619|    542|    bn_check_top(p);
  620|    542|    bn_check_top(m);
  621|       |
  622|    542|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (622:9): [True: 0, False: 542]
  ------------------
  623|      0|        ERR_raise(ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  624|      0|        return 0;
  625|      0|    }
  626|       |
  627|    542|    top = m->top;
  628|       |
  629|    542|    if (top > BN_CONSTTIME_SIZE_LIMIT) {
  ------------------
  |  |   46|    542|#define BN_CONSTTIME_SIZE_LIMIT (INT_MAX / BN_BYTES / 256)
  |  |  ------------------
  |  |  |  |   38|    542|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (629:9): [True: 0, False: 542]
  ------------------
  630|       |        /* Prevent overflowing the powerbufLen computation below */
  631|      0|        return BN_mod_exp_mont(rr, a, p, m, ctx, in_mont);
  632|      0|    }
  633|       |
  634|       |    /*
  635|       |     * Use all bits stored in |p|, rather than |BN_num_bits|, so we do not leak
  636|       |     * whether the top bits are zero.
  637|       |     */
  638|    542|    bits = p->top * BN_BITS2;
  ------------------
  |  |   54|    542|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|    542|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  639|    542|    if (bits == 0) {
  ------------------
  |  Branch (639:9): [True: 2, False: 540]
  ------------------
  640|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  641|      2|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (641:13): [True: 1, False: 1]
  ------------------
  642|      1|            ret = 1;
  643|      1|            BN_zero(rr);
  ------------------
  |  |  202|      1|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  644|      1|        } else {
  645|      1|            ret = BN_one(rr);
  ------------------
  |  |  197|      1|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  646|      1|        }
  647|      2|        return ret;
  648|      2|    }
  649|       |
  650|    540|    BN_CTX_start(ctx);
  651|       |
  652|       |    /*
  653|       |     * Allocate a montgomery context if it was not supplied by the caller. If
  654|       |     * this is not done, things will break in the montgomery part.
  655|       |     */
  656|    540|    if (in_mont != NULL)
  ------------------
  |  Branch (656:9): [True: 25, False: 515]
  ------------------
  657|     25|        mont = in_mont;
  658|    515|    else {
  659|    515|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (659:13): [True: 0, False: 515]
  ------------------
  660|      0|            goto err;
  661|    515|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (661:13): [True: 0, False: 515]
  ------------------
  662|      0|            goto err;
  663|    515|    }
  664|       |
  665|    540|    if (a->neg || BN_ucmp(a, m) >= 0) {
  ------------------
  |  Branch (665:9): [True: 0, False: 540]
  |  Branch (665:19): [True: 26, False: 514]
  ------------------
  666|     26|        BIGNUM *reduced = BN_CTX_get(ctx);
  667|     26|        if (reduced == NULL
  ------------------
  |  Branch (667:13): [True: 0, False: 26]
  ------------------
  668|     26|            || !BN_nnmod(reduced, a, m, ctx)) {
  ------------------
  |  Branch (668:16): [True: 0, False: 26]
  ------------------
  669|      0|            goto err;
  670|      0|        }
  671|     26|        a = reduced;
  672|     26|    }
  673|       |
  674|    540|#ifdef RSAZ_ENABLED
  675|       |    /*
  676|       |     * If the size of the operands allow it, perform the optimized
  677|       |     * RSAZ exponentiation. For further information see
  678|       |     * crypto/bn/rsaz_exp.c and accompanying assembly modules.
  679|       |     */
  680|    540|    if ((16 == a->top) && (16 == p->top) && (BN_num_bits(m) == 1024)
  ------------------
  |  Branch (680:9): [True: 6, False: 534]
  |  Branch (680:27): [True: 0, False: 6]
  |  Branch (680:45): [True: 0, False: 0]
  ------------------
  681|    540|        && rsaz_avx2_eligible()) {
  ------------------
  |  Branch (681:12): [True: 0, False: 0]
  ------------------
  682|      0|        if (NULL == bn_wexpand(rr, 16))
  ------------------
  |  Branch (682:13): [True: 0, False: 0]
  ------------------
  683|      0|            goto err;
  684|      0|        RSAZ_1024_mod_exp_avx2(rr->d, a->d, p->d, m->d, mont->RR.d,
  685|      0|                               mont->n0[0]);
  686|      0|        rr->top = 16;
  687|      0|        rr->neg = 0;
  688|      0|        bn_correct_top(rr);
  689|      0|        ret = 1;
  690|      0|        goto err;
  691|    540|    } else if ((8 == a->top) && (8 == p->top) && (BN_num_bits(m) == 512)) {
  ------------------
  |  Branch (691:16): [True: 7, False: 533]
  |  Branch (691:33): [True: 5, False: 2]
  |  Branch (691:50): [True: 1, False: 4]
  ------------------
  692|      1|        if (NULL == bn_wexpand(rr, 8))
  ------------------
  |  Branch (692:13): [True: 0, False: 1]
  ------------------
  693|      0|            goto err;
  694|      1|        RSAZ_512_mod_exp(rr->d, a->d, p->d, m->d, mont->n0[0], mont->RR.d);
  695|      1|        rr->top = 8;
  696|      1|        rr->neg = 0;
  697|      1|        bn_correct_top(rr);
  698|      1|        ret = 1;
  699|      1|        goto err;
  700|      1|    }
  701|    539|#endif
  702|       |
  703|       |    /* Get the window size to use with size of p. */
  704|    539|    window = BN_window_bits_for_ctime_exponent_size(bits);
  ------------------
  |  |  346|    539|                ((b) > 937 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (346:18): [True: 1, False: 538]
  |  |  ------------------
  |  |  347|    539|                 (b) > 306 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (347:18): [True: 43, False: 495]
  |  |  ------------------
  |  |  348|    538|                 (b) >  89 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (348:18): [True: 16, False: 479]
  |  |  ------------------
  |  |  349|    495|                 (b) >  22 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (349:18): [True: 479, False: 0]
  |  |  ------------------
  ------------------
  705|       |#if defined(SPARC_T4_MONT)
  706|       |    if (window >= 5 && (top & 15) == 0 && top <= 64 &&
  707|       |        (OPENSSL_sparcv9cap_P[1] & (CFR_MONTMUL | CFR_MONTSQR)) ==
  708|       |        (CFR_MONTMUL | CFR_MONTSQR) && (t4 = OPENSSL_sparcv9cap_P[0]))
  709|       |        window = 5;
  710|       |    else
  711|       |#endif
  712|    539|#if defined(OPENSSL_BN_ASM_MONT5)
  713|    539|    if (window >= 5 && top <= BN_SOFT_LIMIT) {
  ------------------
  |  |   62|     44|#  define BN_SOFT_LIMIT         (4096 / BN_BYTES)
  |  |  ------------------
  |  |  |  |   38|     44|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (713:9): [True: 44, False: 495]
  |  Branch (713:24): [True: 44, False: 0]
  ------------------
  714|     44|        window = 5;             /* ~5% improvement for RSA2048 sign, and even
  715|       |                                 * for RSA4096 */
  716|       |        /* reserve space for mont->N.d[] copy */
  717|     44|        powerbufLen += top * sizeof(mont->N.d[0]);
  718|     44|    }
  719|    539|#endif
  720|    539|    (void)0;
  721|       |
  722|       |    /*
  723|       |     * Allocate a buffer large enough to hold all of the pre-computed powers
  724|       |     * of am, am itself and tmp.
  725|       |     */
  726|    539|    numPowers = 1 << window;
  727|    539|    powerbufLen += sizeof(m->d[0]) * (top * numPowers +
  728|    539|                                      ((2 * top) >
  ------------------
  |  Branch (728:40): [True: 371, False: 168]
  ------------------
  729|    539|                                       numPowers ? (2 * top) : numPowers));
  730|    539|#ifdef alloca
  731|    539|    if (powerbufLen < 3072)
  ------------------
  |  Branch (731:9): [True: 534, False: 5]
  ------------------
  732|    534|        powerbufFree =
  733|    534|            alloca(powerbufLen + MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
  734|      5|    else
  735|      5|#endif
  736|      5|        if ((powerbufFree =
  ------------------
  |  Branch (736:13): [True: 0, False: 5]
  ------------------
  737|      5|             OPENSSL_malloc(powerbufLen + MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH))
  ------------------
  |  |   97|      5|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  738|      5|            == NULL)
  739|      0|        goto err;
  740|       |
  741|    539|    powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
  ------------------
  |  |  592|    539|        ((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((size_t)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
  |  |  ------------------
  |  |  |  |  331|    539|# define MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH      ( 64 )
  |  |  ------------------
  |  |                       ((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((size_t)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
  |  |  ------------------
  |  |  |  |  332|    539|# define MOD_EXP_CTIME_MIN_CACHE_LINE_MASK       (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    539|# define MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH      ( 64 )
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  742|    539|    memset(powerbuf, 0, powerbufLen);
  743|       |
  744|    539|#ifdef alloca
  745|    539|    if (powerbufLen < 3072)
  ------------------
  |  Branch (745:9): [True: 534, False: 5]
  ------------------
  746|    534|        powerbufFree = NULL;
  747|    539|#endif
  748|       |
  749|       |    /* lay down tmp and am right after powers table */
  750|    539|    tmp.d = (BN_ULONG *)(powerbuf + sizeof(m->d[0]) * top * numPowers);
  751|    539|    am.d = tmp.d + top;
  752|    539|    tmp.top = am.top = 0;
  753|    539|    tmp.dmax = am.dmax = top;
  754|    539|    tmp.neg = am.neg = 0;
  755|    539|    tmp.flags = am.flags = BN_FLG_STATIC_DATA;
  ------------------
  |  |   59|    539|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  756|       |
  757|       |    /* prepare a^0 in Montgomery domain */
  758|    539|#if 1                           /* by Shay Gueron's suggestion */
  759|    539|    if (m->d[top - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {
  ------------------
  |  |   54|    539|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|    539|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (759:9): [True: 78, False: 461]
  ------------------
  760|       |        /* 2^(top*BN_BITS2) - m */
  761|     78|        tmp.d[0] = (0 - m->d[0]) & BN_MASK2;
  ------------------
  |  |   94|     78|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  762|    354|        for (i = 1; i < top; i++)
  ------------------
  |  Branch (762:21): [True: 276, False: 78]
  ------------------
  763|    276|            tmp.d[i] = (~m->d[i]) & BN_MASK2;
  ------------------
  |  |   94|    276|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  764|     78|        tmp.top = top;
  765|     78|    } else
  766|    461|#endif
  767|    461|    if (!bn_to_mont_fixed_top(&tmp, BN_value_one(), mont, ctx))
  ------------------
  |  Branch (767:9): [True: 0, False: 461]
  ------------------
  768|      0|        goto err;
  769|       |
  770|       |    /* prepare a^1 in Montgomery domain */
  771|    539|    if (!bn_to_mont_fixed_top(&am, a, mont, ctx))
  ------------------
  |  Branch (771:9): [True: 0, False: 539]
  ------------------
  772|      0|        goto err;
  773|       |
  774|    539|    if (top > BN_SOFT_LIMIT)
  ------------------
  |  |   62|    539|#  define BN_SOFT_LIMIT         (4096 / BN_BYTES)
  |  |  ------------------
  |  |  |  |   38|    539|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (774:9): [True: 0, False: 539]
  ------------------
  775|      0|        goto fallback;
  776|       |
  777|       |#if defined(SPARC_T4_MONT)
  778|       |    if (t4) {
  779|       |        typedef int (*bn_pwr5_mont_f) (BN_ULONG *tp, const BN_ULONG *np,
  780|       |                                       const BN_ULONG *n0, const void *table,
  781|       |                                       int power, int bits);
  782|       |        int bn_pwr5_mont_t4_8(BN_ULONG *tp, const BN_ULONG *np,
  783|       |                              const BN_ULONG *n0, const void *table,
  784|       |                              int power, int bits);
  785|       |        int bn_pwr5_mont_t4_16(BN_ULONG *tp, const BN_ULONG *np,
  786|       |                               const BN_ULONG *n0, const void *table,
  787|       |                               int power, int bits);
  788|       |        int bn_pwr5_mont_t4_24(BN_ULONG *tp, const BN_ULONG *np,
  789|       |                               const BN_ULONG *n0, const void *table,
  790|       |                               int power, int bits);
  791|       |        int bn_pwr5_mont_t4_32(BN_ULONG *tp, const BN_ULONG *np,
  792|       |                               const BN_ULONG *n0, const void *table,
  793|       |                               int power, int bits);
  794|       |        static const bn_pwr5_mont_f pwr5_funcs[4] = {
  795|       |            bn_pwr5_mont_t4_8, bn_pwr5_mont_t4_16,
  796|       |            bn_pwr5_mont_t4_24, bn_pwr5_mont_t4_32
  797|       |        };
  798|       |        bn_pwr5_mont_f pwr5_worker = pwr5_funcs[top / 16 - 1];
  799|       |
  800|       |        typedef int (*bn_mul_mont_f) (BN_ULONG *rp, const BN_ULONG *ap,
  801|       |                                      const void *bp, const BN_ULONG *np,
  802|       |                                      const BN_ULONG *n0);
  803|       |        int bn_mul_mont_t4_8(BN_ULONG *rp, const BN_ULONG *ap, const void *bp,
  804|       |                             const BN_ULONG *np, const BN_ULONG *n0);
  805|       |        int bn_mul_mont_t4_16(BN_ULONG *rp, const BN_ULONG *ap,
  806|       |                              const void *bp, const BN_ULONG *np,
  807|       |                              const BN_ULONG *n0);
  808|       |        int bn_mul_mont_t4_24(BN_ULONG *rp, const BN_ULONG *ap,
  809|       |                              const void *bp, const BN_ULONG *np,
  810|       |                              const BN_ULONG *n0);
  811|       |        int bn_mul_mont_t4_32(BN_ULONG *rp, const BN_ULONG *ap,
  812|       |                              const void *bp, const BN_ULONG *np,
  813|       |                              const BN_ULONG *n0);
  814|       |        static const bn_mul_mont_f mul_funcs[4] = {
  815|       |            bn_mul_mont_t4_8, bn_mul_mont_t4_16,
  816|       |            bn_mul_mont_t4_24, bn_mul_mont_t4_32
  817|       |        };
  818|       |        bn_mul_mont_f mul_worker = mul_funcs[top / 16 - 1];
  819|       |
  820|       |        void bn_mul_mont_vis3(BN_ULONG *rp, const BN_ULONG *ap,
  821|       |                              const void *bp, const BN_ULONG *np,
  822|       |                              const BN_ULONG *n0, int num);
  823|       |        void bn_mul_mont_t4(BN_ULONG *rp, const BN_ULONG *ap,
  824|       |                            const void *bp, const BN_ULONG *np,
  825|       |                            const BN_ULONG *n0, int num);
  826|       |        void bn_mul_mont_gather5_t4(BN_ULONG *rp, const BN_ULONG *ap,
  827|       |                                    const void *table, const BN_ULONG *np,
  828|       |                                    const BN_ULONG *n0, int num, int power);
  829|       |        void bn_flip_n_scatter5_t4(const BN_ULONG *inp, size_t num,
  830|       |                                   void *table, size_t power);
  831|       |        void bn_gather5_t4(BN_ULONG *out, size_t num,
  832|       |                           void *table, size_t power);
  833|       |        void bn_flip_t4(BN_ULONG *dst, BN_ULONG *src, size_t num);
  834|       |
  835|       |        BN_ULONG *np = mont->N.d, *n0 = mont->n0;
  836|       |        int stride = 5 * (6 - (top / 16 - 1)); /* multiple of 5, but less
  837|       |                                                * than 32 */
  838|       |
  839|       |        /*
  840|       |         * BN_to_montgomery can contaminate words above .top [in
  841|       |         * BN_DEBUG build...
  842|       |         */
  843|       |        for (i = am.top; i < top; i++)
  844|       |            am.d[i] = 0;
  845|       |        for (i = tmp.top; i < top; i++)
  846|       |            tmp.d[i] = 0;
  847|       |
  848|       |        bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, 0);
  849|       |        bn_flip_n_scatter5_t4(am.d, top, powerbuf, 1);
  850|       |        if (!(*mul_worker) (tmp.d, am.d, am.d, np, n0) &&
  851|       |            !(*mul_worker) (tmp.d, am.d, am.d, np, n0))
  852|       |            bn_mul_mont_vis3(tmp.d, am.d, am.d, np, n0, top);
  853|       |        bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, 2);
  854|       |
  855|       |        for (i = 3; i < 32; i++) {
  856|       |            /* Calculate a^i = a^(i-1) * a */
  857|       |            if (!(*mul_worker) (tmp.d, tmp.d, am.d, np, n0) &&
  858|       |                !(*mul_worker) (tmp.d, tmp.d, am.d, np, n0))
  859|       |                bn_mul_mont_vis3(tmp.d, tmp.d, am.d, np, n0, top);
  860|       |            bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, i);
  861|       |        }
  862|       |
  863|       |        /* switch to 64-bit domain */
  864|       |        np = alloca(top * sizeof(BN_ULONG));
  865|       |        top /= 2;
  866|       |        bn_flip_t4(np, mont->N.d, top);
  867|       |
  868|       |        /*
  869|       |         * The exponent may not have a whole number of fixed-size windows.
  870|       |         * To simplify the main loop, the initial window has between 1 and
  871|       |         * full-window-size bits such that what remains is always a whole
  872|       |         * number of windows
  873|       |         */
  874|       |        window0 = (bits - 1) % 5 + 1;
  875|       |        wmask = (1 << window0) - 1;
  876|       |        bits -= window0;
  877|       |        wvalue = bn_get_bits(p, bits) & wmask;
  878|       |        bn_gather5_t4(tmp.d, top, powerbuf, wvalue);
  879|       |
  880|       |        /*
  881|       |         * Scan the exponent one window at a time starting from the most
  882|       |         * significant bits.
  883|       |         */
  884|       |        while (bits > 0) {
  885|       |            if (bits < stride)
  886|       |                stride = bits;
  887|       |            bits -= stride;
  888|       |            wvalue = bn_get_bits(p, bits);
  889|       |
  890|       |            if ((*pwr5_worker) (tmp.d, np, n0, powerbuf, wvalue, stride))
  891|       |                continue;
  892|       |            /* retry once and fall back */
  893|       |            if ((*pwr5_worker) (tmp.d, np, n0, powerbuf, wvalue, stride))
  894|       |                continue;
  895|       |
  896|       |            bits += stride - 5;
  897|       |            wvalue >>= stride - 5;
  898|       |            wvalue &= 31;
  899|       |            bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
  900|       |            bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
  901|       |            bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
  902|       |            bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
  903|       |            bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
  904|       |            bn_mul_mont_gather5_t4(tmp.d, tmp.d, powerbuf, np, n0, top,
  905|       |                                   wvalue);
  906|       |        }
  907|       |
  908|       |        bn_flip_t4(tmp.d, tmp.d, top);
  909|       |        top *= 2;
  910|       |        /* back to 32-bit domain */
  911|       |        tmp.top = top;
  912|       |        bn_correct_top(&tmp);
  913|       |        OPENSSL_cleanse(np, top * sizeof(BN_ULONG));
  914|       |    } else
  915|       |#endif
  916|    539|#if defined(OPENSSL_BN_ASM_MONT5)
  917|    539|    if (window == 5 && top > 1) {
  ------------------
  |  Branch (917:9): [True: 44, False: 495]
  |  Branch (917:24): [True: 39, False: 5]
  ------------------
  918|       |        /*
  919|       |         * This optimization uses ideas from https://eprint.iacr.org/2011/239,
  920|       |         * specifically optimization of cache-timing attack countermeasures,
  921|       |         * pre-computation optimization, and Almost Montgomery Multiplication.
  922|       |         *
  923|       |         * The paper discusses a 4-bit window to optimize 512-bit modular
  924|       |         * exponentiation, used in RSA-1024 with CRT, but RSA-1024 is no longer
  925|       |         * important.
  926|       |         *
  927|       |         * |bn_mul_mont_gather5| and |bn_power5| implement the "almost"
  928|       |         * reduction variant, so the values here may not be fully reduced.
  929|       |         * They are bounded by R (i.e. they fit in |top| words), not |m|.
  930|       |         * Additionally, we pass these "almost" reduced inputs into
  931|       |         * |bn_mul_mont|, which implements the normal reduction variant.
  932|       |         * Given those inputs, |bn_mul_mont| may not give reduced
  933|       |         * output, but it will still produce "almost" reduced output.
  934|       |         */
  935|     39|        void bn_mul_mont_gather5(BN_ULONG *rp, const BN_ULONG *ap,
  936|     39|                                 const void *table, const BN_ULONG *np,
  937|     39|                                 const BN_ULONG *n0, int num, int power);
  938|     39|        void bn_scatter5(const BN_ULONG *inp, size_t num,
  939|     39|                         void *table, size_t power);
  940|     39|        void bn_gather5(BN_ULONG *out, size_t num, void *table, size_t power);
  941|     39|        void bn_power5(BN_ULONG *rp, const BN_ULONG *ap,
  942|     39|                       const void *table, const BN_ULONG *np,
  943|     39|                       const BN_ULONG *n0, int num, int power);
  944|     39|        int bn_get_bits5(const BN_ULONG *ap, int off);
  945|       |
  946|     39|        BN_ULONG *n0 = mont->n0, *np;
  ------------------
  |  |   37|     39|#  define BN_ULONG        unsigned long
  ------------------
  947|       |
  948|       |        /*
  949|       |         * BN_to_montgomery can contaminate words above .top [in
  950|       |         * BN_DEBUG build...
  951|       |         */
  952|     39|        for (i = am.top; i < top; i++)
  ------------------
  |  Branch (952:26): [True: 0, False: 39]
  ------------------
  953|      0|            am.d[i] = 0;
  954|     39|        for (i = tmp.top; i < top; i++)
  ------------------
  |  Branch (954:27): [True: 0, False: 39]
  ------------------
  955|      0|            tmp.d[i] = 0;
  956|       |
  957|       |        /*
  958|       |         * copy mont->N.d[] to improve cache locality
  959|       |         */
  960|    284|        for (np = am.d + top, i = 0; i < top; i++)
  ------------------
  |  Branch (960:38): [True: 245, False: 39]
  ------------------
  961|    245|            np[i] = mont->N.d[i];
  962|       |
  963|     39|        bn_scatter5(tmp.d, top, powerbuf, 0);
  964|     39|        bn_scatter5(am.d, am.top, powerbuf, 1);
  965|     39|        bn_mul_mont(tmp.d, am.d, am.d, np, n0, top);
  966|     39|        bn_scatter5(tmp.d, top, powerbuf, 2);
  967|       |
  968|       |# if 0
  969|       |        for (i = 3; i < 32; i++) {
  970|       |            /* Calculate a^i = a^(i-1) * a */
  971|       |            bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
  972|       |            bn_scatter5(tmp.d, top, powerbuf, i);
  973|       |        }
  974|       |# else
  975|       |        /* same as above, but uses squaring for 1/2 of operations */
  976|    156|        for (i = 4; i < 32; i *= 2) {
  ------------------
  |  Branch (976:21): [True: 117, False: 39]
  ------------------
  977|    117|            bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
  978|    117|            bn_scatter5(tmp.d, top, powerbuf, i);
  979|    117|        }
  980|    156|        for (i = 3; i < 8; i += 2) {
  ------------------
  |  Branch (980:21): [True: 117, False: 39]
  ------------------
  981|    117|            int j;
  982|    117|            bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
  983|    117|            bn_scatter5(tmp.d, top, powerbuf, i);
  984|    390|            for (j = 2 * i; j < 32; j *= 2) {
  ------------------
  |  Branch (984:29): [True: 273, False: 117]
  ------------------
  985|    273|                bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
  986|    273|                bn_scatter5(tmp.d, top, powerbuf, j);
  987|    273|            }
  988|    117|        }
  989|    195|        for (; i < 16; i += 2) {
  ------------------
  |  Branch (989:16): [True: 156, False: 39]
  ------------------
  990|    156|            bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
  991|    156|            bn_scatter5(tmp.d, top, powerbuf, i);
  992|    156|            bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
  993|    156|            bn_scatter5(tmp.d, top, powerbuf, 2 * i);
  994|    156|        }
  995|    351|        for (; i < 32; i += 2) {
  ------------------
  |  Branch (995:16): [True: 312, False: 39]
  ------------------
  996|    312|            bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
  997|    312|            bn_scatter5(tmp.d, top, powerbuf, i);
  998|    312|        }
  999|     39|# endif
 1000|       |        /*
 1001|       |         * The exponent may not have a whole number of fixed-size windows.
 1002|       |         * To simplify the main loop, the initial window has between 1 and
 1003|       |         * full-window-size bits such that what remains is always a whole
 1004|       |         * number of windows
 1005|       |         */
 1006|     39|        window0 = (bits - 1) % 5 + 1;
 1007|     39|        wmask = (1 << window0) - 1;
 1008|     39|        bits -= window0;
 1009|     39|        wvalue = bn_get_bits(p, bits) & wmask;
 1010|     39|        bn_gather5(tmp.d, top, powerbuf, wvalue);
 1011|       |
 1012|       |        /*
 1013|       |         * Scan the exponent one window at a time starting from the most
 1014|       |         * significant bits.
 1015|       |         */
 1016|     39|        if (top & 7) {
  ------------------
  |  Branch (1016:13): [True: 30, False: 9]
  ------------------
 1017|  2.22k|            while (bits > 0) {
  ------------------
  |  Branch (1017:20): [True: 2.19k, False: 30]
  ------------------
 1018|  2.19k|                bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
 1019|  2.19k|                bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
 1020|  2.19k|                bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
 1021|  2.19k|                bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
 1022|  2.19k|                bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
 1023|  2.19k|                bn_mul_mont_gather5(tmp.d, tmp.d, powerbuf, np, n0, top,
 1024|  2.19k|                                    bn_get_bits5(p->d, bits -= 5));
 1025|  2.19k|            }
 1026|     30|        } else {
 1027|  1.04k|            while (bits > 0) {
  ------------------
  |  Branch (1027:20): [True: 1.03k, False: 9]
  ------------------
 1028|  1.03k|                bn_power5(tmp.d, tmp.d, powerbuf, np, n0, top,
 1029|  1.03k|                          bn_get_bits5(p->d, bits -= 5));
 1030|  1.03k|            }
 1031|      9|        }
 1032|       |
 1033|     39|        tmp.top = top;
 1034|       |        /*
 1035|       |         * The result is now in |tmp| in Montgomery form, but it may not be
 1036|       |         * fully reduced. This is within bounds for |BN_from_montgomery|
 1037|       |         * (tmp < R <= m*R) so it will, when converting from Montgomery form,
 1038|       |         * produce a fully reduced result.
 1039|       |         *
 1040|       |         * This differs from Figure 2 of the paper, which uses AMM(h, 1) to
 1041|       |         * convert from Montgomery form with unreduced output, followed by an
 1042|       |         * extra reduction step. In the paper's terminology, we replace
 1043|       |         * steps 9 and 10 with MM(h, 1).
 1044|       |         */
 1045|     39|    } else
 1046|    500|#endif
 1047|    500|    {
 1048|    500| fallback:
 1049|    500|        if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, window))
  ------------------
  |  Branch (1049:13): [True: 0, False: 500]
  ------------------
 1050|      0|            goto err;
 1051|    500|        if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, window))
  ------------------
  |  Branch (1051:13): [True: 0, False: 500]
  ------------------
 1052|      0|            goto err;
 1053|       |
 1054|       |        /*
 1055|       |         * If the window size is greater than 1, then calculate
 1056|       |         * val[i=2..2^winsize-1]. Powers are computed as a*a^(i-1) (even
 1057|       |         * powers could instead be computed as (a^(i/2))^2 to use the slight
 1058|       |         * performance advantage of sqr over mul).
 1059|       |         */
 1060|    500|        if (window > 1) {
  ------------------
  |  Branch (1060:13): [True: 500, False: 0]
  ------------------
 1061|    500|            if (!bn_mul_mont_fixed_top(&tmp, &am, &am, mont, ctx))
  ------------------
  |  Branch (1061:17): [True: 0, False: 500]
  ------------------
 1062|      0|                goto err;
 1063|    500|            if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 2,
  ------------------
  |  Branch (1063:17): [True: 0, False: 500]
  ------------------
 1064|    500|                                              window))
 1065|      0|                goto err;
 1066|  3.24k|            for (i = 3; i < numPowers; i++) {
  ------------------
  |  Branch (1066:25): [True: 2.74k, False: 500]
  ------------------
 1067|       |                /* Calculate a^i = a^(i-1) * a */
 1068|  2.74k|                if (!bn_mul_mont_fixed_top(&tmp, &am, &tmp, mont, ctx))
  ------------------
  |  Branch (1068:21): [True: 0, False: 2.74k]
  ------------------
 1069|      0|                    goto err;
 1070|  2.74k|                if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, i,
  ------------------
  |  Branch (1070:21): [True: 0, False: 2.74k]
  ------------------
 1071|  2.74k|                                                  window))
 1072|      0|                    goto err;
 1073|  2.74k|            }
 1074|    500|        }
 1075|       |
 1076|       |        /*
 1077|       |         * The exponent may not have a whole number of fixed-size windows.
 1078|       |         * To simplify the main loop, the initial window has between 1 and
 1079|       |         * full-window-size bits such that what remains is always a whole
 1080|       |         * number of windows
 1081|       |         */
 1082|    500|        window0 = (bits - 1) % window + 1;
 1083|    500|        wmask = (1 << window0) - 1;
 1084|    500|        bits -= window0;
 1085|    500|        wvalue = bn_get_bits(p, bits) & wmask;
 1086|    500|        if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
  ------------------
  |  Branch (1086:13): [True: 0, False: 500]
  ------------------
 1087|    500|                                            window))
 1088|      0|            goto err;
 1089|       |
 1090|    500|        wmask = (1 << window) - 1;
 1091|       |        /*
 1092|       |         * Scan the exponent one window at a time starting from the most
 1093|       |         * significant bits.
 1094|       |         */
 1095|  11.9k|        while (bits > 0) {
  ------------------
  |  Branch (1095:16): [True: 11.4k, False: 500]
  ------------------
 1096|       |
 1097|       |            /* Square the result window-size times */
 1098|  47.9k|            for (i = 0; i < window; i++)
  ------------------
  |  Branch (1098:25): [True: 36.4k, False: 11.4k]
  ------------------
 1099|  36.4k|                if (!bn_mul_mont_fixed_top(&tmp, &tmp, &tmp, mont, ctx))
  ------------------
  |  Branch (1099:21): [True: 0, False: 36.4k]
  ------------------
 1100|      0|                    goto err;
 1101|       |
 1102|       |            /*
 1103|       |             * Get a window's worth of bits from the exponent
 1104|       |             * This avoids calling BN_is_bit_set for each bit, which
 1105|       |             * is not only slower but also makes each bit vulnerable to
 1106|       |             * EM (and likely other) side-channel attacks like One&Done
 1107|       |             * (for details see "One&Done: A Single-Decryption EM-Based
 1108|       |             *  Attack on OpenSSL's Constant-Time Blinded RSA" by M. Alam,
 1109|       |             *  H. Khan, M. Dey, N. Sinha, R. Callan, A. Zajic, and
 1110|       |             *  M. Prvulovic, in USENIX Security'18)
 1111|       |             */
 1112|  11.4k|            bits -= window;
 1113|  11.4k|            wvalue = bn_get_bits(p, bits) & wmask;
 1114|       |            /*
 1115|       |             * Fetch the appropriate pre-computed value from the pre-buf
 1116|       |             */
 1117|  11.4k|            if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&am, top, powerbuf, wvalue,
  ------------------
  |  Branch (1117:17): [True: 0, False: 11.4k]
  ------------------
 1118|  11.4k|                                                window))
 1119|      0|                goto err;
 1120|       |
 1121|       |            /* Multiply the result into the intermediate result */
 1122|  11.4k|            if (!bn_mul_mont_fixed_top(&tmp, &tmp, &am, mont, ctx))
  ------------------
  |  Branch (1122:17): [True: 0, False: 11.4k]
  ------------------
 1123|      0|                goto err;
 1124|  11.4k|        }
 1125|    500|    }
 1126|       |
 1127|       |    /*
 1128|       |     * Done with zero-padded intermediate BIGNUMs. Final BN_from_montgomery
 1129|       |     * removes padding [if any] and makes return value suitable for public
 1130|       |     * API consumer.
 1131|       |     */
 1132|       |#if defined(SPARC_T4_MONT)
 1133|       |    if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) {
 1134|       |        am.d[0] = 1;            /* borrow am */
 1135|       |        for (i = 1; i < top; i++)
 1136|       |            am.d[i] = 0;
 1137|       |        if (!BN_mod_mul_montgomery(rr, &tmp, &am, mont, ctx))
 1138|       |            goto err;
 1139|       |    } else
 1140|       |#endif
 1141|    539|    if (!BN_from_montgomery(rr, &tmp, mont, ctx))
  ------------------
  |  Branch (1141:9): [True: 0, False: 539]
  ------------------
 1142|      0|        goto err;
 1143|    539|    ret = 1;
 1144|    540| err:
 1145|    540|    if (in_mont == NULL)
  ------------------
  |  Branch (1145:9): [True: 515, False: 25]
  ------------------
 1146|    515|        BN_MONT_CTX_free(mont);
 1147|    540|    if (powerbuf != NULL) {
  ------------------
  |  Branch (1147:9): [True: 539, False: 1]
  ------------------
 1148|    539|        OPENSSL_cleanse(powerbuf, powerbufLen);
 1149|    539|        OPENSSL_free(powerbufFree);
  ------------------
  |  |  107|    539|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    539|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    539|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1150|    539|    }
 1151|    540|    BN_CTX_end(ctx);
 1152|    540|    return ret;
 1153|    539|}
BN_mod_exp_mont_word:
 1157|  2.58k|{
 1158|  2.58k|    BN_MONT_CTX *mont = NULL;
 1159|  2.58k|    int b, bits, ret = 0;
 1160|  2.58k|    int r_is_one;
 1161|  2.58k|    BN_ULONG w, next_w;
  ------------------
  |  |   37|  2.58k|#  define BN_ULONG        unsigned long
  ------------------
 1162|  2.58k|    BIGNUM *r, *t;
 1163|  2.58k|    BIGNUM *swap_tmp;
 1164|  2.58k|#define BN_MOD_MUL_WORD(r, w, m) \
 1165|  2.58k|                (BN_mul_word(r, (w)) && \
 1166|  2.58k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
 1167|  2.58k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
 1168|       |    /*
 1169|       |     * BN_MOD_MUL_WORD is only used with 'w' large, so the BN_ucmp test is
 1170|       |     * probably more overhead than always using BN_mod (which uses BN_copy if
 1171|       |     * a similar test returns true).
 1172|       |     */
 1173|       |    /*
 1174|       |     * We can use BN_mod and do not need BN_nnmod because our accumulator is
 1175|       |     * never negative (the result of BN_mod does not depend on the sign of
 1176|       |     * the modulus).
 1177|       |     */
 1178|  2.58k|#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
 1179|  2.58k|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
 1180|       |
 1181|  2.58k|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  2.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1181:9): [True: 0, False: 2.58k]
  ------------------
 1182|  2.58k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|  2.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1182:16): [True: 0, False: 2.58k]
  ------------------
 1183|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 1184|      0|        ERR_raise(ERR_LIB_BN, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1185|      0|        return 0;
 1186|      0|    }
 1187|       |
 1188|  2.58k|    bn_check_top(p);
 1189|  2.58k|    bn_check_top(m);
 1190|       |
 1191|  2.58k|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (1191:9): [True: 0, False: 2.58k]
  ------------------
 1192|      0|        ERR_raise(ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1193|      0|        return 0;
 1194|      0|    }
 1195|  2.58k|    if (m->top == 1)
  ------------------
  |  Branch (1195:9): [True: 0, False: 2.58k]
  ------------------
 1196|      0|        a %= m->d[0];           /* make sure that 'a' is reduced */
 1197|       |
 1198|  2.58k|    bits = BN_num_bits(p);
 1199|  2.58k|    if (bits == 0) {
  ------------------
  |  Branch (1199:9): [True: 0, False: 2.58k]
  ------------------
 1200|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
 1201|      0|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (1201:13): [True: 0, False: 0]
  ------------------
 1202|      0|            ret = 1;
 1203|      0|            BN_zero(rr);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1204|      0|        } else {
 1205|      0|            ret = BN_one(rr);
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
 1206|      0|        }
 1207|      0|        return ret;
 1208|      0|    }
 1209|  2.58k|    if (a == 0) {
  ------------------
  |  Branch (1209:9): [True: 0, False: 2.58k]
  ------------------
 1210|      0|        BN_zero(rr);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1211|      0|        ret = 1;
 1212|      0|        return ret;
 1213|      0|    }
 1214|       |
 1215|  2.58k|    BN_CTX_start(ctx);
 1216|  2.58k|    r = BN_CTX_get(ctx);
 1217|  2.58k|    t = BN_CTX_get(ctx);
 1218|  2.58k|    if (t == NULL)
  ------------------
  |  Branch (1218:9): [True: 0, False: 2.58k]
  ------------------
 1219|      0|        goto err;
 1220|       |
 1221|  2.58k|    if (in_mont != NULL)
  ------------------
  |  Branch (1221:9): [True: 0, False: 2.58k]
  ------------------
 1222|      0|        mont = in_mont;
 1223|  2.58k|    else {
 1224|  2.58k|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (1224:13): [True: 0, False: 2.58k]
  ------------------
 1225|      0|            goto err;
 1226|  2.58k|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (1226:13): [True: 0, False: 2.58k]
  ------------------
 1227|      0|            goto err;
 1228|  2.58k|    }
 1229|       |
 1230|  2.58k|    r_is_one = 1;               /* except for Montgomery factor */
 1231|       |
 1232|       |    /* bits-1 >= 0 */
 1233|       |
 1234|       |    /* The result is accumulated in the product r*w. */
 1235|  2.58k|    w = a;                      /* bit 'bits-1' of 'p' is always set */
 1236|   365k|    for (b = bits - 2; b >= 0; b--) {
  ------------------
  |  Branch (1236:24): [True: 363k, False: 2.58k]
  ------------------
 1237|       |        /* First, square r*w. */
 1238|   363k|        next_w = w * w;
 1239|   363k|        if ((next_w / w) != w) { /* overflow */
  ------------------
  |  Branch (1239:13): [True: 86.8k, False: 276k]
  ------------------
 1240|  86.8k|            if (r_is_one) {
  ------------------
  |  Branch (1240:17): [True: 2.54k, False: 84.3k]
  ------------------
 1241|  2.54k|                if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1179|  2.54k|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1179:18): [True: 2.54k, False: 0]
  |  |  |  Branch (1179:41): [True: 2.54k, False: 0]
  |  |  ------------------
  ------------------
 1242|      0|                    goto err;
 1243|  2.54k|                r_is_one = 0;
 1244|  84.3k|            } else {
 1245|  84.3k|                if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1165|  84.3k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1165:18): [True: 84.3k, False: 0]
  |  |  ------------------
  |  | 1166|  84.3k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1167|  84.3k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|   168k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 84.3k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1167:50): [True: 84.3k, False: 0]
  |  |  ------------------
  ------------------
 1246|      0|                    goto err;
 1247|  84.3k|            }
 1248|  86.8k|            next_w = 1;
 1249|  86.8k|        }
 1250|   363k|        w = next_w;
 1251|   363k|        if (!r_is_one) {
  ------------------
  |  Branch (1251:13): [True: 355k, False: 7.77k]
  ------------------
 1252|   355k|            if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))
  ------------------
  |  Branch (1252:17): [True: 0, False: 355k]
  ------------------
 1253|      0|                goto err;
 1254|   355k|        }
 1255|       |
 1256|       |        /* Second, multiply r*w by 'a' if exponent bit is set. */
 1257|   363k|        if (BN_is_bit_set(p, b)) {
  ------------------
  |  Branch (1257:13): [True: 303k, False: 59.4k]
  ------------------
 1258|   303k|            next_w = w * a;
 1259|   303k|            if ((next_w / a) != w) { /* overflow */
  ------------------
  |  Branch (1259:17): [True: 3.58k, False: 300k]
  ------------------
 1260|  3.58k|                if (r_is_one) {
  ------------------
  |  Branch (1260:21): [True: 30, False: 3.55k]
  ------------------
 1261|     30|                    if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1179|     30|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1179:18): [True: 30, False: 0]
  |  |  |  Branch (1179:41): [True: 30, False: 0]
  |  |  ------------------
  ------------------
 1262|      0|                        goto err;
 1263|     30|                    r_is_one = 0;
 1264|  3.55k|                } else {
 1265|  3.55k|                    if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1165|  3.55k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1165:18): [True: 3.55k, False: 0]
  |  |  ------------------
  |  | 1166|  3.55k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1167|  3.55k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|  7.11k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 3.55k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1167:50): [True: 3.55k, False: 0]
  |  |  ------------------
  ------------------
 1266|      0|                        goto err;
 1267|  3.55k|                }
 1268|  3.58k|                next_w = a;
 1269|  3.58k|            }
 1270|   303k|            w = next_w;
 1271|   303k|        }
 1272|   363k|    }
 1273|       |
 1274|       |    /* Finally, set r:=r*w. */
 1275|  2.58k|    if (w != 1) {
  ------------------
  |  Branch (1275:9): [True: 2.54k, False: 42]
  ------------------
 1276|  2.54k|        if (r_is_one) {
  ------------------
  |  Branch (1276:13): [True: 10, False: 2.53k]
  ------------------
 1277|     10|            if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1179|     10|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1179:18): [True: 10, False: 0]
  |  |  |  Branch (1179:41): [True: 10, False: 0]
  |  |  ------------------
  ------------------
 1278|      0|                goto err;
 1279|     10|            r_is_one = 0;
 1280|  2.53k|        } else {
 1281|  2.53k|            if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1165|  2.53k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1165:18): [True: 2.53k, False: 0]
  |  |  ------------------
  |  | 1166|  2.53k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1167|  2.53k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|  5.06k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 2.53k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1167:50): [True: 2.53k, False: 0]
  |  |  ------------------
  ------------------
 1282|      0|                goto err;
 1283|  2.53k|        }
 1284|  2.54k|    }
 1285|       |
 1286|  2.58k|    if (r_is_one) {             /* can happen only if a == 1 */
  ------------------
  |  Branch (1286:9): [True: 0, False: 2.58k]
  ------------------
 1287|      0|        if (!BN_one(rr))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1287:13): [True: 0, False: 0]
  ------------------
 1288|      0|            goto err;
 1289|  2.58k|    } else {
 1290|  2.58k|        if (!BN_from_montgomery(rr, r, mont, ctx))
  ------------------
  |  Branch (1290:13): [True: 0, False: 2.58k]
  ------------------
 1291|      0|            goto err;
 1292|  2.58k|    }
 1293|  2.58k|    ret = 1;
 1294|  2.58k| err:
 1295|  2.58k|    if (in_mont == NULL)
  ------------------
  |  Branch (1295:9): [True: 2.58k, False: 0]
  ------------------
 1296|  2.58k|        BN_MONT_CTX_free(mont);
 1297|  2.58k|    BN_CTX_end(ctx);
 1298|  2.58k|    bn_check_top(rr);
 1299|  2.58k|    return ret;
 1300|  2.58k|}
bn_exp.c:bn_get_bits:
  482|  12.0k|{
  483|  12.0k|    BN_ULONG ret = 0;
  ------------------
  |  |   37|  12.0k|#  define BN_ULONG        unsigned long
  ------------------
  484|  12.0k|    int wordpos;
  485|       |
  486|  12.0k|    wordpos = bitpos / BN_BITS2;
  ------------------
  |  |   54|  12.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  12.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  487|  12.0k|    bitpos %= BN_BITS2;
  ------------------
  |  |   54|  12.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  12.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  488|  12.0k|    if (wordpos >= 0 && wordpos < a->top) {
  ------------------
  |  Branch (488:9): [True: 12.0k, False: 0]
  |  Branch (488:25): [True: 12.0k, False: 0]
  ------------------
  489|  12.0k|        ret = a->d[wordpos] & BN_MASK2;
  ------------------
  |  |   94|  12.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  490|  12.0k|        if (bitpos) {
  ------------------
  |  Branch (490:13): [True: 11.4k, False: 542]
  ------------------
  491|  11.4k|            ret >>= bitpos;
  492|  11.4k|            if (++wordpos < a->top)
  ------------------
  |  Branch (492:17): [True: 1.07k, False: 10.4k]
  ------------------
  493|  1.07k|                ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
  ------------------
  |  |   54|  1.07k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.07k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  494|  11.4k|        }
  495|  12.0k|    }
  496|       |
  497|  12.0k|    return ret & BN_MASK2;
  ------------------
  |  |   94|  12.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  498|  12.0k|}
bn_exp.c:MOD_EXP_CTIME_COPY_TO_PREBUF:
  510|  4.24k|{
  511|  4.24k|    int i, j;
  512|  4.24k|    int width = 1 << window;
  513|  4.24k|    BN_ULONG *table = (BN_ULONG *)buf;
  ------------------
  |  |   37|  4.24k|#  define BN_ULONG        unsigned long
  ------------------
  514|       |
  515|  4.24k|    if (top > b->top)
  ------------------
  |  Branch (515:9): [True: 0, False: 4.24k]
  ------------------
  516|      0|        top = b->top;           /* this works because 'buf' is explicitly
  517|       |                                 * zeroed */
  518|  59.7k|    for (i = 0, j = idx; i < top; i++, j += width) {
  ------------------
  |  Branch (518:26): [True: 55.5k, False: 4.24k]
  ------------------
  519|  55.5k|        table[j] = b->d[i];
  520|  55.5k|    }
  521|       |
  522|  4.24k|    return 1;
  523|  4.24k|}
bn_exp.c:MOD_EXP_CTIME_COPY_FROM_PREBUF:
  528|  11.9k|{
  529|  11.9k|    int i, j;
  530|  11.9k|    int width = 1 << window;
  531|       |    /*
  532|       |     * We declare table 'volatile' in order to discourage compiler
  533|       |     * from reordering loads from the table. Concern is that if
  534|       |     * reordered in specific manner loads might give away the
  535|       |     * information we are trying to conceal. Some would argue that
  536|       |     * compiler can reorder them anyway, but it can as well be
  537|       |     * argued that doing so would be violation of standard...
  538|       |     */
  539|  11.9k|    volatile BN_ULONG *table = (volatile BN_ULONG *)buf;
  540|       |
  541|  11.9k|    if (bn_wexpand(b, top) == NULL)
  ------------------
  |  Branch (541:9): [True: 0, False: 11.9k]
  ------------------
  542|      0|        return 0;
  543|       |
  544|  11.9k|    if (window <= 3) {
  ------------------
  |  Branch (544:9): [True: 10.5k, False: 1.43k]
  ------------------
  545|   159k|        for (i = 0; i < top; i++, table += width) {
  ------------------
  |  Branch (545:21): [True: 149k, False: 10.5k]
  ------------------
  546|   149k|            BN_ULONG acc = 0;
  ------------------
  |  |   37|   149k|#  define BN_ULONG        unsigned long
  ------------------
  547|       |
  548|  1.34M|            for (j = 0; j < width; j++) {
  ------------------
  |  Branch (548:25): [True: 1.19M, False: 149k]
  ------------------
  549|  1.19M|                acc |= table[j] &
  550|  1.19M|                       ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1));
  551|  1.19M|            }
  552|       |
  553|   149k|            b->d[i] = acc;
  554|   149k|        }
  555|  10.5k|    } else {
  556|  1.43k|        int xstride = 1 << (window - 2);
  557|  1.43k|        BN_ULONG y0, y1, y2, y3;
  ------------------
  |  |   37|  1.43k|#  define BN_ULONG        unsigned long
  ------------------
  558|       |
  559|  1.43k|        i = idx >> (window - 2);        /* equivalent of idx / xstride */
  560|  1.43k|        idx &= xstride - 1;             /* equivalent of idx % xstride */
  561|       |
  562|  1.43k|        y0 = (BN_ULONG)0 - (constant_time_eq_int(i,0)&1);
  563|  1.43k|        y1 = (BN_ULONG)0 - (constant_time_eq_int(i,1)&1);
  564|  1.43k|        y2 = (BN_ULONG)0 - (constant_time_eq_int(i,2)&1);
  565|  1.43k|        y3 = (BN_ULONG)0 - (constant_time_eq_int(i,3)&1);
  566|       |
  567|  5.20k|        for (i = 0; i < top; i++, table += width) {
  ------------------
  |  Branch (567:21): [True: 3.77k, False: 1.43k]
  ------------------
  568|  3.77k|            BN_ULONG acc = 0;
  ------------------
  |  |   37|  3.77k|#  define BN_ULONG        unsigned long
  ------------------
  569|       |
  570|  21.2k|            for (j = 0; j < xstride; j++) {
  ------------------
  |  Branch (570:25): [True: 17.4k, False: 3.77k]
  ------------------
  571|  17.4k|                acc |= ( (table[j + 0 * xstride] & y0) |
  572|  17.4k|                         (table[j + 1 * xstride] & y1) |
  573|  17.4k|                         (table[j + 2 * xstride] & y2) |
  574|  17.4k|                         (table[j + 3 * xstride] & y3) )
  575|  17.4k|                       & ((BN_ULONG)0 - (constant_time_eq_int(j,idx)&1));
  576|  17.4k|            }
  577|       |
  578|  3.77k|            b->d[i] = acc;
  579|  3.77k|        }
  580|  1.43k|    }
  581|       |
  582|  11.9k|    b->top = top;
  583|  11.9k|    b->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  11.9k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  584|  11.9k|    return 1;
  585|  11.9k|}

int_bn_mod_inverse:
  200|  25.5k|{
  201|  25.5k|    BIGNUM *A, *B, *X, *Y, *M, *D, *T, *R = NULL;
  202|  25.5k|    BIGNUM *ret = NULL;
  203|  25.5k|    int sign;
  204|       |
  205|       |    /* This is invalid input so we don't worry about constant time here */
  206|  25.5k|    if (BN_abs_is_word(n, 1) || BN_is_zero(n)) {
  ------------------
  |  Branch (206:9): [True: 0, False: 25.5k]
  |  Branch (206:33): [True: 10, False: 25.5k]
  ------------------
  207|     10|        *pnoinv = 1;
  208|     10|        return NULL;
  209|     10|    }
  210|       |
  211|  25.5k|    *pnoinv = 0;
  212|       |
  213|  25.5k|    if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  25.5k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (213:9): [True: 0, False: 25.5k]
  ------------------
  214|  25.5k|        || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
  ------------------
  |  |   67|  25.5k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (214:12): [True: 0, False: 25.5k]
  ------------------
  215|      0|        return bn_mod_inverse_no_branch(in, a, n, ctx, pnoinv);
  216|      0|    }
  217|       |
  218|  25.5k|    bn_check_top(a);
  219|  25.5k|    bn_check_top(n);
  220|       |
  221|  25.5k|    BN_CTX_start(ctx);
  222|  25.5k|    A = BN_CTX_get(ctx);
  223|  25.5k|    B = BN_CTX_get(ctx);
  224|  25.5k|    X = BN_CTX_get(ctx);
  225|  25.5k|    D = BN_CTX_get(ctx);
  226|  25.5k|    M = BN_CTX_get(ctx);
  227|  25.5k|    Y = BN_CTX_get(ctx);
  228|  25.5k|    T = BN_CTX_get(ctx);
  229|  25.5k|    if (T == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 25.5k]
  ------------------
  230|      0|        goto err;
  231|       |
  232|  25.5k|    if (in == NULL)
  ------------------
  |  Branch (232:9): [True: 0, False: 25.5k]
  ------------------
  233|      0|        R = BN_new();
  234|  25.5k|    else
  235|  25.5k|        R = in;
  236|  25.5k|    if (R == NULL)
  ------------------
  |  Branch (236:9): [True: 0, False: 25.5k]
  ------------------
  237|      0|        goto err;
  238|       |
  239|  25.5k|    if (!BN_one(X))
  ------------------
  |  |  197|  25.5k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (239:9): [True: 0, False: 25.5k]
  ------------------
  240|      0|        goto err;
  241|  25.5k|    BN_zero(Y);
  ------------------
  |  |  202|  25.5k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  242|  25.5k|    if (BN_copy(B, a) == NULL)
  ------------------
  |  Branch (242:9): [True: 0, False: 25.5k]
  ------------------
  243|      0|        goto err;
  244|  25.5k|    if (BN_copy(A, n) == NULL)
  ------------------
  |  Branch (244:9): [True: 0, False: 25.5k]
  ------------------
  245|      0|        goto err;
  246|  25.5k|    A->neg = 0;
  247|  25.5k|    if (B->neg || (BN_ucmp(B, A) >= 0)) {
  ------------------
  |  Branch (247:9): [True: 0, False: 25.5k]
  |  Branch (247:19): [True: 25.5k, False: 0]
  ------------------
  248|  25.5k|        if (!BN_nnmod(B, B, A, ctx))
  ------------------
  |  Branch (248:13): [True: 0, False: 25.5k]
  ------------------
  249|      0|            goto err;
  250|  25.5k|    }
  251|  25.5k|    sign = -1;
  252|       |    /*-
  253|       |     * From  B = a mod |n|,  A = |n|  it follows that
  254|       |     *
  255|       |     *      0 <= B < A,
  256|       |     *     -sign*X*a  ==  B   (mod |n|),
  257|       |     *      sign*Y*a  ==  A   (mod |n|).
  258|       |     */
  259|       |
  260|  25.5k|    if (BN_is_odd(n) && (BN_num_bits(n) <= 2048)) {
  ------------------
  |  Branch (260:9): [True: 25.2k, False: 305]
  |  Branch (260:25): [True: 25.2k, False: 0]
  ------------------
  261|       |        /*
  262|       |         * Binary inversion algorithm; requires odd modulus. This is faster
  263|       |         * than the general algorithm if the modulus is sufficiently small
  264|       |         * (about 400 .. 500 bits on 32-bit systems, but much more on 64-bit
  265|       |         * systems)
  266|       |         */
  267|  25.2k|        int shift;
  268|       |
  269|  1.53M|        while (!BN_is_zero(B)) {
  ------------------
  |  Branch (269:16): [True: 1.50M, False: 25.2k]
  ------------------
  270|       |            /*-
  271|       |             *      0 < B < |n|,
  272|       |             *      0 < A <= |n|,
  273|       |             * (1) -sign*X*a  ==  B   (mod |n|),
  274|       |             * (2)  sign*Y*a  ==  A   (mod |n|)
  275|       |             */
  276|       |
  277|       |            /*
  278|       |             * Now divide B by the maximum possible power of two in the
  279|       |             * integers, and divide X by the same value mod |n|. When we're
  280|       |             * done, (1) still holds.
  281|       |             */
  282|  1.50M|            shift = 0;
  283|  2.09M|            while (!BN_is_bit_set(B, shift)) { /* note that 0 < B */
  ------------------
  |  Branch (283:20): [True: 584k, False: 1.50M]
  ------------------
  284|   584k|                shift++;
  285|       |
  286|   584k|                if (BN_is_odd(X)) {
  ------------------
  |  Branch (286:21): [True: 300k, False: 283k]
  ------------------
  287|   300k|                    if (!BN_uadd(X, X, n))
  ------------------
  |  Branch (287:25): [True: 0, False: 300k]
  ------------------
  288|      0|                        goto err;
  289|   300k|                }
  290|       |                /*
  291|       |                 * now X is even, so we can easily divide it by two
  292|       |                 */
  293|   584k|                if (!BN_rshift1(X, X))
  ------------------
  |  Branch (293:21): [True: 0, False: 584k]
  ------------------
  294|      0|                    goto err;
  295|   584k|            }
  296|  1.50M|            if (shift > 0) {
  ------------------
  |  Branch (296:17): [True: 559k, False: 949k]
  ------------------
  297|   559k|                if (!BN_rshift(B, B, shift))
  ------------------
  |  Branch (297:21): [True: 0, False: 559k]
  ------------------
  298|      0|                    goto err;
  299|   559k|            }
  300|       |
  301|       |            /*
  302|       |             * Same for A and Y.  Afterwards, (2) still holds.
  303|       |             */
  304|  1.50M|            shift = 0;
  305|  2.45M|            while (!BN_is_bit_set(A, shift)) { /* note that 0 < A */
  ------------------
  |  Branch (305:20): [True: 944k, False: 1.50M]
  ------------------
  306|   944k|                shift++;
  307|       |
  308|   944k|                if (BN_is_odd(Y)) {
  ------------------
  |  Branch (308:21): [True: 549k, False: 395k]
  ------------------
  309|   549k|                    if (!BN_uadd(Y, Y, n))
  ------------------
  |  Branch (309:25): [True: 0, False: 549k]
  ------------------
  310|      0|                        goto err;
  311|   549k|                }
  312|       |                /* now Y is even */
  313|   944k|                if (!BN_rshift1(Y, Y))
  ------------------
  |  Branch (313:21): [True: 0, False: 944k]
  ------------------
  314|      0|                    goto err;
  315|   944k|            }
  316|  1.50M|            if (shift > 0) {
  ------------------
  |  Branch (316:17): [True: 929k, False: 579k]
  ------------------
  317|   929k|                if (!BN_rshift(A, A, shift))
  ------------------
  |  Branch (317:21): [True: 0, False: 929k]
  ------------------
  318|      0|                    goto err;
  319|   929k|            }
  320|       |
  321|       |            /*-
  322|       |             * We still have (1) and (2).
  323|       |             * Both  A  and  B  are odd.
  324|       |             * The following computations ensure that
  325|       |             *
  326|       |             *     0 <= B < |n|,
  327|       |             *      0 < A < |n|,
  328|       |             * (1) -sign*X*a  ==  B   (mod |n|),
  329|       |             * (2)  sign*Y*a  ==  A   (mod |n|),
  330|       |             *
  331|       |             * and that either  A  or  B  is even in the next iteration.
  332|       |             */
  333|  1.50M|            if (BN_ucmp(B, A) >= 0) {
  ------------------
  |  Branch (333:17): [True: 579k, False: 929k]
  ------------------
  334|       |                /* -sign*(X + Y)*a == B - A  (mod |n|) */
  335|   579k|                if (!BN_uadd(X, X, Y))
  ------------------
  |  Branch (335:21): [True: 0, False: 579k]
  ------------------
  336|      0|                    goto err;
  337|       |                /*
  338|       |                 * NB: we could use BN_mod_add_quick(X, X, Y, n), but that
  339|       |                 * actually makes the algorithm slower
  340|       |                 */
  341|   579k|                if (!BN_usub(B, B, A))
  ------------------
  |  Branch (341:21): [True: 0, False: 579k]
  ------------------
  342|      0|                    goto err;
  343|   929k|            } else {
  344|       |                /*  sign*(X + Y)*a == A - B  (mod |n|) */
  345|   929k|                if (!BN_uadd(Y, Y, X))
  ------------------
  |  Branch (345:21): [True: 0, False: 929k]
  ------------------
  346|      0|                    goto err;
  347|       |                /*
  348|       |                 * as above, BN_mod_add_quick(Y, Y, X, n) would slow things down
  349|       |                 */
  350|   929k|                if (!BN_usub(A, A, B))
  ------------------
  |  Branch (350:21): [True: 0, False: 929k]
  ------------------
  351|      0|                    goto err;
  352|   929k|            }
  353|  1.50M|        }
  354|  25.2k|    } else {
  355|       |        /* general inversion algorithm */
  356|       |
  357|  6.99k|        while (!BN_is_zero(B)) {
  ------------------
  |  Branch (357:16): [True: 6.69k, False: 305]
  ------------------
  358|  6.69k|            BIGNUM *tmp;
  359|       |
  360|       |            /*-
  361|       |             *      0 < B < A,
  362|       |             * (*) -sign*X*a  ==  B   (mod |n|),
  363|       |             *      sign*Y*a  ==  A   (mod |n|)
  364|       |             */
  365|       |
  366|       |            /* (D, M) := (A/B, A%B) ... */
  367|  6.69k|            if (BN_num_bits(A) == BN_num_bits(B)) {
  ------------------
  |  Branch (367:17): [True: 1.11k, False: 5.57k]
  ------------------
  368|  1.11k|                if (!BN_one(D))
  ------------------
  |  |  197|  1.11k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (368:21): [True: 0, False: 1.11k]
  ------------------
  369|      0|                    goto err;
  370|  1.11k|                if (!BN_sub(M, A, B))
  ------------------
  |  Branch (370:21): [True: 0, False: 1.11k]
  ------------------
  371|      0|                    goto err;
  372|  5.57k|            } else if (BN_num_bits(A) == BN_num_bits(B) + 1) {
  ------------------
  |  Branch (372:24): [True: 3.31k, False: 2.26k]
  ------------------
  373|       |                /* A/B is 1, 2, or 3 */
  374|  3.31k|                if (!BN_lshift1(T, B))
  ------------------
  |  Branch (374:21): [True: 0, False: 3.31k]
  ------------------
  375|      0|                    goto err;
  376|  3.31k|                if (BN_ucmp(A, T) < 0) {
  ------------------
  |  Branch (376:21): [True: 1.74k, False: 1.57k]
  ------------------
  377|       |                    /* A < 2*B, so D=1 */
  378|  1.74k|                    if (!BN_one(D))
  ------------------
  |  |  197|  1.74k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (378:25): [True: 0, False: 1.74k]
  ------------------
  379|      0|                        goto err;
  380|  1.74k|                    if (!BN_sub(M, A, B))
  ------------------
  |  Branch (380:25): [True: 0, False: 1.74k]
  ------------------
  381|      0|                        goto err;
  382|  1.74k|                } else {
  383|       |                    /* A >= 2*B, so D=2 or D=3 */
  384|  1.57k|                    if (!BN_sub(M, A, T))
  ------------------
  |  Branch (384:25): [True: 0, False: 1.57k]
  ------------------
  385|      0|                        goto err;
  386|  1.57k|                    if (!BN_add(D, T, B))
  ------------------
  |  Branch (386:25): [True: 0, False: 1.57k]
  ------------------
  387|      0|                        goto err; /* use D (:= 3*B) as temp */
  388|  1.57k|                    if (BN_ucmp(A, D) < 0) {
  ------------------
  |  Branch (388:25): [True: 1.27k, False: 296]
  ------------------
  389|       |                        /* A < 3*B, so D=2 */
  390|  1.27k|                        if (!BN_set_word(D, 2))
  ------------------
  |  Branch (390:29): [True: 0, False: 1.27k]
  ------------------
  391|      0|                            goto err;
  392|       |                        /*
  393|       |                         * M (= A - 2*B) already has the correct value
  394|       |                         */
  395|  1.27k|                    } else {
  396|       |                        /* only D=3 remains */
  397|    296|                        if (!BN_set_word(D, 3))
  ------------------
  |  Branch (397:29): [True: 0, False: 296]
  ------------------
  398|      0|                            goto err;
  399|       |                        /*
  400|       |                         * currently M = A - 2*B, but we need M = A - 3*B
  401|       |                         */
  402|    296|                        if (!BN_sub(M, M, B))
  ------------------
  |  Branch (402:29): [True: 0, False: 296]
  ------------------
  403|      0|                            goto err;
  404|    296|                    }
  405|  1.57k|                }
  406|  3.31k|            } else {
  407|  2.26k|                if (!BN_div(D, M, A, B, ctx))
  ------------------
  |  Branch (407:21): [True: 0, False: 2.26k]
  ------------------
  408|      0|                    goto err;
  409|  2.26k|            }
  410|       |
  411|       |            /*-
  412|       |             * Now
  413|       |             *      A = D*B + M;
  414|       |             * thus we have
  415|       |             * (**)  sign*Y*a  ==  D*B + M   (mod |n|).
  416|       |             */
  417|       |
  418|  6.69k|            tmp = A;    /* keep the BIGNUM object, the value does not matter */
  419|       |
  420|       |            /* (A, B) := (B, A mod B) ... */
  421|  6.69k|            A = B;
  422|  6.69k|            B = M;
  423|       |            /* ... so we have  0 <= B < A  again */
  424|       |
  425|       |            /*-
  426|       |             * Since the former  M  is now  B  and the former  B  is now  A,
  427|       |             * (**) translates into
  428|       |             *       sign*Y*a  ==  D*A + B    (mod |n|),
  429|       |             * i.e.
  430|       |             *       sign*Y*a - D*A  ==  B    (mod |n|).
  431|       |             * Similarly, (*) translates into
  432|       |             *      -sign*X*a  ==  A          (mod |n|).
  433|       |             *
  434|       |             * Thus,
  435|       |             *   sign*Y*a + D*sign*X*a  ==  B  (mod |n|),
  436|       |             * i.e.
  437|       |             *        sign*(Y + D*X)*a  ==  B  (mod |n|).
  438|       |             *
  439|       |             * So if we set  (X, Y, sign) := (Y + D*X, X, -sign), we arrive back at
  440|       |             *      -sign*X*a  ==  B   (mod |n|),
  441|       |             *       sign*Y*a  ==  A   (mod |n|).
  442|       |             * Note that  X  and  Y  stay non-negative all the time.
  443|       |             */
  444|       |
  445|       |            /*
  446|       |             * most of the time D is very small, so we can optimize tmp := D*X+Y
  447|       |             */
  448|  6.69k|            if (BN_is_one(D)) {
  ------------------
  |  Branch (448:17): [True: 2.86k, False: 3.83k]
  ------------------
  449|  2.86k|                if (!BN_add(tmp, X, Y))
  ------------------
  |  Branch (449:21): [True: 0, False: 2.86k]
  ------------------
  450|      0|                    goto err;
  451|  3.83k|            } else {
  452|  3.83k|                if (BN_is_word(D, 2)) {
  ------------------
  |  Branch (452:21): [True: 1.67k, False: 2.15k]
  ------------------
  453|  1.67k|                    if (!BN_lshift1(tmp, X))
  ------------------
  |  Branch (453:25): [True: 0, False: 1.67k]
  ------------------
  454|      0|                        goto err;
  455|  2.15k|                } else if (BN_is_word(D, 4)) {
  ------------------
  |  Branch (455:28): [True: 276, False: 1.88k]
  ------------------
  456|    276|                    if (!BN_lshift(tmp, X, 2))
  ------------------
  |  Branch (456:25): [True: 0, False: 276]
  ------------------
  457|      0|                        goto err;
  458|  1.88k|                } else if (D->top == 1) {
  ------------------
  |  Branch (458:28): [True: 1.88k, False: 0]
  ------------------
  459|  1.88k|                    if (!BN_copy(tmp, X))
  ------------------
  |  Branch (459:25): [True: 0, False: 1.88k]
  ------------------
  460|      0|                        goto err;
  461|  1.88k|                    if (!BN_mul_word(tmp, D->d[0]))
  ------------------
  |  Branch (461:25): [True: 0, False: 1.88k]
  ------------------
  462|      0|                        goto err;
  463|  1.88k|                } else {
  464|      0|                    if (!BN_mul(tmp, D, X, ctx))
  ------------------
  |  Branch (464:25): [True: 0, False: 0]
  ------------------
  465|      0|                        goto err;
  466|      0|                }
  467|  3.83k|                if (!BN_add(tmp, tmp, Y))
  ------------------
  |  Branch (467:21): [True: 0, False: 3.83k]
  ------------------
  468|      0|                    goto err;
  469|  3.83k|            }
  470|       |
  471|  6.69k|            M = Y;      /* keep the BIGNUM object, the value does not matter */
  472|  6.69k|            Y = X;
  473|  6.69k|            X = tmp;
  474|  6.69k|            sign = -sign;
  475|  6.69k|        }
  476|    305|    }
  477|       |
  478|       |    /*-
  479|       |     * The while loop (Euclid's algorithm) ends when
  480|       |     *      A == gcd(a,n);
  481|       |     * we have
  482|       |     *       sign*Y*a  ==  A  (mod |n|),
  483|       |     * where  Y  is non-negative.
  484|       |     */
  485|       |
  486|  25.5k|    if (sign < 0) {
  ------------------
  |  Branch (486:9): [True: 25.3k, False: 176]
  ------------------
  487|  25.3k|        if (!BN_sub(Y, n, Y))
  ------------------
  |  Branch (487:13): [True: 0, False: 25.3k]
  ------------------
  488|      0|            goto err;
  489|  25.3k|    }
  490|       |    /* Now  Y*a  ==  A  (mod |n|).  */
  491|       |
  492|  25.5k|    if (BN_is_one(A)) {
  ------------------
  |  Branch (492:9): [True: 25.2k, False: 305]
  ------------------
  493|       |        /* Y*a == 1  (mod |n|) */
  494|  25.2k|        if (!Y->neg && BN_ucmp(Y, n) < 0) {
  ------------------
  |  Branch (494:13): [True: 4.40k, False: 20.8k]
  |  Branch (494:24): [True: 4.40k, False: 0]
  ------------------
  495|  4.40k|            if (!BN_copy(R, Y))
  ------------------
  |  Branch (495:17): [True: 0, False: 4.40k]
  ------------------
  496|      0|                goto err;
  497|  20.8k|        } else {
  498|  20.8k|            if (!BN_nnmod(R, Y, n, ctx))
  ------------------
  |  Branch (498:17): [True: 0, False: 20.8k]
  ------------------
  499|      0|                goto err;
  500|  20.8k|        }
  501|  25.2k|    } else {
  502|    305|        *pnoinv = 1;
  503|    305|        goto err;
  504|    305|    }
  505|  25.2k|    ret = R;
  506|  25.5k| err:
  507|  25.5k|    if ((ret == NULL) && (in == NULL))
  ------------------
  |  Branch (507:9): [True: 305, False: 25.2k]
  |  Branch (507:26): [True: 0, False: 305]
  ------------------
  508|      0|        BN_free(R);
  509|  25.5k|    BN_CTX_end(ctx);
  510|  25.5k|    bn_check_top(ret);
  511|  25.5k|    return ret;
  512|  25.2k|}
BN_mod_inverse:
  517|  25.5k|{
  518|  25.5k|    BN_CTX *new_ctx = NULL;
  519|  25.5k|    BIGNUM *rv;
  520|  25.5k|    int noinv = 0;
  521|       |
  522|  25.5k|    if (ctx == NULL) {
  ------------------
  |  Branch (522:9): [True: 0, False: 25.5k]
  ------------------
  523|      0|        ctx = new_ctx = BN_CTX_new_ex(NULL);
  524|      0|        if (ctx == NULL) {
  ------------------
  |  Branch (524:13): [True: 0, False: 0]
  ------------------
  525|      0|            ERR_raise(ERR_LIB_BN, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  526|      0|            return NULL;
  527|      0|        }
  528|      0|    }
  529|       |
  530|  25.5k|    rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
  531|  25.5k|    if (noinv)
  ------------------
  |  Branch (531:9): [True: 315, False: 25.2k]
  ------------------
  532|  25.5k|        ERR_raise(ERR_LIB_BN, BN_R_NO_INVERSE);
  ------------------
  |  |  401|    315|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    315|    (ERR_new(),                                                 \
  |  |  |  |  404|    315|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    315|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    315|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    315|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    315|     ERR_set_error)
  |  |  ------------------
  ------------------
  533|  25.5k|    BN_CTX_free(new_ctx);
  534|  25.5k|    return rv;
  535|  25.5k|}

BN_GF2m_add:
  253|  31.8M|{
  254|  31.8M|    int i;
  255|  31.8M|    const BIGNUM *at, *bt;
  256|       |
  257|  31.8M|    bn_check_top(a);
  258|  31.8M|    bn_check_top(b);
  259|       |
  260|  31.8M|    if (a->top < b->top) {
  ------------------
  |  Branch (260:9): [True: 60.3k, False: 31.7M]
  ------------------
  261|  60.3k|        at = b;
  262|  60.3k|        bt = a;
  263|  31.7M|    } else {
  264|  31.7M|        at = a;
  265|  31.7M|        bt = b;
  266|  31.7M|    }
  267|       |
  268|  31.8M|    if (bn_wexpand(r, at->top) == NULL)
  ------------------
  |  Branch (268:9): [True: 0, False: 31.8M]
  ------------------
  269|      0|        return 0;
  270|       |
  271|   220M|    for (i = 0; i < bt->top; i++) {
  ------------------
  |  Branch (271:17): [True: 188M, False: 31.8M]
  ------------------
  272|   188M|        r->d[i] = at->d[i] ^ bt->d[i];
  273|   188M|    }
  274|  32.1M|    for (; i < at->top; i++) {
  ------------------
  |  Branch (274:12): [True: 331k, False: 31.8M]
  ------------------
  275|   331k|        r->d[i] = at->d[i];
  276|   331k|    }
  277|       |
  278|  31.8M|    r->top = at->top;
  279|  31.8M|    bn_correct_top(r);
  280|       |
  281|  31.8M|    return 1;
  282|  31.8M|}
BN_GF2m_mod_arr:
  293|  48.7M|{
  294|  48.7M|    int j, k;
  295|  48.7M|    int n, dN, d0, d1;
  296|  48.7M|    BN_ULONG zz, *z;
  ------------------
  |  |   37|  48.7M|#  define BN_ULONG        unsigned long
  ------------------
  297|       |
  298|  48.7M|    bn_check_top(a);
  299|       |
  300|  48.7M|    if (p[0] == 0) {
  ------------------
  |  Branch (300:9): [True: 0, False: 48.7M]
  ------------------
  301|       |        /* reduction mod 1 => return 0 */
  302|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  303|      0|        return 1;
  304|      0|    }
  305|       |
  306|       |    /*
  307|       |     * Since the algorithm does reduction in the r value, if a != r, copy the
  308|       |     * contents of a into r so we can do reduction in r.
  309|       |     */
  310|  48.7M|    if (a != r) {
  ------------------
  |  Branch (310:9): [True: 48.6M, False: 42.3k]
  ------------------
  311|  48.6M|        if (!bn_wexpand(r, a->top))
  ------------------
  |  Branch (311:13): [True: 0, False: 48.6M]
  ------------------
  312|      0|            return 0;
  313|   622M|        for (j = 0; j < a->top; j++) {
  ------------------
  |  Branch (313:21): [True: 574M, False: 48.6M]
  ------------------
  314|   574M|            r->d[j] = a->d[j];
  315|   574M|        }
  316|  48.6M|        r->top = a->top;
  317|  48.6M|    }
  318|  48.7M|    z = r->d;
  319|       |
  320|       |    /* start reduction */
  321|  48.7M|    dN = p[0] / BN_BITS2;
  ------------------
  |  |   54|  48.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  48.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  322|   621M|    for (j = r->top - 1; j > dN;) {
  ------------------
  |  Branch (322:26): [True: 572M, False: 48.7M]
  ------------------
  323|   572M|        zz = z[j];
  324|   572M|        if (z[j] == 0) {
  ------------------
  |  Branch (324:13): [True: 286M, False: 286M]
  ------------------
  325|   286M|            j--;
  326|   286M|            continue;
  327|   286M|        }
  328|   286M|        z[j] = 0;
  329|       |
  330|  1.13G|        for (k = 1; p[k] != 0; k++) {
  ------------------
  |  Branch (330:21): [True: 853M, False: 286M]
  ------------------
  331|       |            /* reducing component t^p[k] */
  332|   853M|            n = p[0] - p[k];
  333|   853M|            d0 = n % BN_BITS2;
  ------------------
  |  |   54|   853M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   853M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  334|   853M|            d1 = BN_BITS2 - d0;
  ------------------
  |  |   54|   853M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   853M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  335|   853M|            n /= BN_BITS2;
  ------------------
  |  |   54|   853M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   853M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  336|   853M|            z[j - n] ^= (zz >> d0);
  337|   853M|            if (d0)
  ------------------
  |  Branch (337:17): [True: 853M, False: 241k]
  ------------------
  338|   853M|                z[j - n - 1] ^= (zz << d1);
  339|   853M|        }
  340|       |
  341|       |        /* reducing component t^0 */
  342|   286M|        n = dN;
  343|   286M|        d0 = p[0] % BN_BITS2;
  ------------------
  |  |   54|   286M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   286M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  344|   286M|        d1 = BN_BITS2 - d0;
  ------------------
  |  |   54|   286M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   286M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  345|   286M|        z[j - n] ^= (zz >> d0);
  346|   286M|        if (d0)
  ------------------
  |  Branch (346:13): [True: 286M, False: 0]
  ------------------
  347|   286M|            z[j - n - 1] ^= (zz << d1);
  348|   286M|    }
  349|       |
  350|       |    /* final round of reduction */
  351|  97.1M|    while (j == dN) {
  ------------------
  |  Branch (351:12): [True: 97.0M, False: 111k]
  ------------------
  352|       |
  353|  97.0M|        d0 = p[0] % BN_BITS2;
  ------------------
  |  |   54|  97.0M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  97.0M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  354|  97.0M|        zz = z[dN] >> d0;
  355|  97.0M|        if (zz == 0)
  ------------------
  |  Branch (355:13): [True: 48.5M, False: 48.4M]
  ------------------
  356|  48.5M|            break;
  357|  48.4M|        d1 = BN_BITS2 - d0;
  ------------------
  |  |   54|  48.4M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  48.4M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  358|       |
  359|       |        /* clear up the top d1 bits */
  360|  48.4M|        if (d0)
  ------------------
  |  Branch (360:13): [True: 48.4M, False: 0]
  ------------------
  361|  48.4M|            z[dN] = (z[dN] << d1) >> d1;
  362|      0|        else
  363|      0|            z[dN] = 0;
  364|  48.4M|        z[0] ^= zz;             /* reduction t^0 component */
  365|       |
  366|   191M|        for (k = 1; p[k] != 0; k++) {
  ------------------
  |  Branch (366:21): [True: 143M, False: 48.4M]
  ------------------
  367|   143M|            BN_ULONG tmp_ulong;
  ------------------
  |  |   37|   143M|#  define BN_ULONG        unsigned long
  ------------------
  368|       |
  369|       |            /* reducing component t^p[k] */
  370|   143M|            n = p[k] / BN_BITS2;
  ------------------
  |  |   54|   143M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   143M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  371|   143M|            d0 = p[k] % BN_BITS2;
  ------------------
  |  |   54|   143M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   143M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  372|   143M|            d1 = BN_BITS2 - d0;
  ------------------
  |  |   54|   143M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   143M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  373|   143M|            z[n] ^= (zz << d0);
  374|   143M|            if (d0 && (tmp_ulong = zz >> d1))
  ------------------
  |  Branch (374:17): [True: 143M, False: 0]
  |  Branch (374:23): [True: 228k, False: 143M]
  ------------------
  375|   228k|                z[n + 1] ^= tmp_ulong;
  376|   143M|        }
  377|       |
  378|  48.4M|    }
  379|       |
  380|  48.7M|    bn_correct_top(r);
  381|  48.7M|    return 1;
  382|  48.7M|}
BN_GF2m_mod:
  391|  6.89k|{
  392|  6.89k|    int ret = 0;
  393|  6.89k|    int arr[6];
  394|  6.89k|    bn_check_top(a);
  395|  6.89k|    bn_check_top(p);
  396|  6.89k|    ret = BN_GF2m_poly2arr(p, arr, OSSL_NELEM(arr));
  ------------------
  |  |   14|  6.89k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  397|  6.89k|    if (!ret || ret > (int)OSSL_NELEM(arr)) {
  ------------------
  |  |   14|  6.89k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (397:9): [True: 0, False: 6.89k]
  |  Branch (397:17): [True: 0, False: 6.89k]
  ------------------
  398|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  399|      0|        return 0;
  400|      0|    }
  401|  6.89k|    ret = BN_GF2m_mod_arr(r, a, arr);
  402|  6.89k|    bn_check_top(r);
  403|  6.89k|    return ret;
  404|  6.89k|}
BN_GF2m_mod_mul_arr:
  412|  16.2M|{
  413|  16.2M|    int zlen, i, j, k, ret = 0;
  414|  16.2M|    BIGNUM *s;
  415|  16.2M|    BN_ULONG x1, x0, y1, y0, zz[4];
  ------------------
  |  |   37|  16.2M|#  define BN_ULONG        unsigned long
  ------------------
  416|       |
  417|  16.2M|    bn_check_top(a);
  418|  16.2M|    bn_check_top(b);
  419|       |
  420|  16.2M|    if (a == b) {
  ------------------
  |  Branch (420:9): [True: 0, False: 16.2M]
  ------------------
  421|      0|        return BN_GF2m_mod_sqr_arr(r, a, p, ctx);
  422|      0|    }
  423|       |
  424|  16.2M|    BN_CTX_start(ctx);
  425|  16.2M|    if ((s = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (425:9): [True: 0, False: 16.2M]
  ------------------
  426|      0|        goto err;
  427|       |
  428|  16.2M|    zlen = a->top + b->top + 4;
  429|  16.2M|    if (!bn_wexpand(s, zlen))
  ------------------
  |  Branch (429:9): [True: 0, False: 16.2M]
  ------------------
  430|      0|        goto err;
  431|  16.2M|    s->top = zlen;
  432|       |
  433|   273M|    for (i = 0; i < zlen; i++)
  ------------------
  |  Branch (433:17): [True: 257M, False: 16.2M]
  ------------------
  434|   257M|        s->d[i] = 0;
  435|       |
  436|  64.6M|    for (j = 0; j < b->top; j += 2) {
  ------------------
  |  Branch (436:17): [True: 48.3M, False: 16.2M]
  ------------------
  437|  48.3M|        y0 = b->d[j];
  438|  48.3M|        y1 = ((j + 1) == b->top) ? 0 : b->d[j + 1];
  ------------------
  |  Branch (438:14): [True: 555k, False: 47.8M]
  ------------------
  439|   194M|        for (i = 0; i < a->top; i += 2) {
  ------------------
  |  Branch (439:21): [True: 145M, False: 48.3M]
  ------------------
  440|   145M|            x0 = a->d[i];
  441|   145M|            x1 = ((i + 1) == a->top) ? 0 : a->d[i + 1];
  ------------------
  |  Branch (441:18): [True: 1.71M, False: 144M]
  ------------------
  442|   145M|            bn_GF2m_mul_2x2(zz, x1, x0, y1, y0);
  443|   729M|            for (k = 0; k < 4; k++)
  ------------------
  |  Branch (443:25): [True: 583M, False: 145M]
  ------------------
  444|   583M|                s->d[i + j + k] ^= zz[k];
  445|   145M|        }
  446|  48.3M|    }
  447|       |
  448|  16.2M|    bn_correct_top(s);
  449|  16.2M|    if (BN_GF2m_mod_arr(r, s, p))
  ------------------
  |  Branch (449:9): [True: 16.2M, False: 0]
  ------------------
  450|  16.2M|        ret = 1;
  451|  16.2M|    bn_check_top(r);
  452|       |
  453|  16.2M| err:
  454|  16.2M|    BN_CTX_end(ctx);
  455|  16.2M|    return ret;
  456|  16.2M|}
BN_GF2m_mod_mul:
  467|  20.2k|{
  468|  20.2k|    int ret = 0;
  469|  20.2k|    const int max = BN_num_bits(p) + 1;
  470|  20.2k|    int *arr;
  471|       |
  472|  20.2k|    bn_check_top(a);
  473|  20.2k|    bn_check_top(b);
  474|  20.2k|    bn_check_top(p);
  475|       |
  476|  20.2k|    arr = OPENSSL_malloc(sizeof(*arr) * max);
  ------------------
  |  |   97|  20.2k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  20.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  20.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  477|  20.2k|    if (arr == NULL)
  ------------------
  |  Branch (477:9): [True: 0, False: 20.2k]
  ------------------
  478|      0|        return 0;
  479|  20.2k|    ret = BN_GF2m_poly2arr(p, arr, max);
  480|  20.2k|    if (!ret || ret > max) {
  ------------------
  |  Branch (480:9): [True: 0, False: 20.2k]
  |  Branch (480:17): [True: 0, False: 20.2k]
  ------------------
  481|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  482|      0|        goto err;
  483|      0|    }
  484|  20.2k|    ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);
  485|  20.2k|    bn_check_top(r);
  486|  20.2k| err:
  487|  20.2k|    OPENSSL_free(arr);
  ------------------
  |  |  107|  20.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  20.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  20.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  488|  20.2k|    return ret;
  489|  20.2k|}
BN_GF2m_mod_sqr_arr:
  494|  32.3M|{
  495|  32.3M|    int i, ret = 0;
  496|  32.3M|    BIGNUM *s;
  497|       |
  498|  32.3M|    bn_check_top(a);
  499|  32.3M|    BN_CTX_start(ctx);
  500|  32.3M|    if ((s = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (500:9): [True: 0, False: 32.3M]
  ------------------
  501|      0|        goto err;
  502|  32.3M|    if (!bn_wexpand(s, 2 * a->top))
  ------------------
  |  Branch (502:9): [True: 0, False: 32.3M]
  ------------------
  503|      0|        goto err;
  504|       |
  505|   223M|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (505:26): [True: 191M, False: 32.3M]
  ------------------
  506|   191M|        s->d[2 * i + 1] = SQR1(a->d[i]);
  ------------------
  |  |   34|   191M|    SQR_nibble((w) >> 60) << 56 | SQR_nibble((w) >> 56) << 48 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 60) << 56 | SQR_nibble((w) >> 56) << 48 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |   35|   191M|    SQR_nibble((w) >> 52) << 40 | SQR_nibble((w) >> 48) << 32 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 52) << 40 | SQR_nibble((w) >> 48) << 32 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |   36|   191M|    SQR_nibble((w) >> 44) << 24 | SQR_nibble((w) >> 40) << 16 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 44) << 24 | SQR_nibble((w) >> 40) << 16 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |   37|   191M|    SQR_nibble((w) >> 36) <<  8 | SQR_nibble((w) >> 32)
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 36) <<  8 | SQR_nibble((w) >> 32)
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  ------------------
  507|   191M|        s->d[2 * i] = SQR0(a->d[i]);
  ------------------
  |  |   39|   191M|    SQR_nibble((w) >> 28) << 56 | SQR_nibble((w) >> 24) << 48 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 28) << 56 | SQR_nibble((w) >> 24) << 48 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |   40|   191M|    SQR_nibble((w) >> 20) << 40 | SQR_nibble((w) >> 16) << 32 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 20) << 40 | SQR_nibble((w) >> 16) << 32 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |   41|   191M|    SQR_nibble((w) >> 12) << 24 | SQR_nibble((w) >>  8) << 16 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >> 12) << 24 | SQR_nibble((w) >>  8) << 16 | \
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |   42|   191M|    SQR_nibble((w) >>  4) <<  8 | SQR_nibble((w)      )
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  |  |                   SQR_nibble((w) >>  4) <<  8 | SQR_nibble((w)      )
  |  |  ------------------
  |  |  |  |   25|   191M|# define SQR_nibble(w)   ((((w) & 8) << 3) \
  |  |  |  |   26|   191M|                       |  (((w) & 4) << 2) \
  |  |  |  |   27|   191M|                       |  (((w) & 2) << 1) \
  |  |  |  |   28|   191M|                       |   ((w) & 1))
  |  |  ------------------
  ------------------
  508|   191M|    }
  509|       |
  510|  32.3M|    s->top = 2 * a->top;
  511|  32.3M|    bn_correct_top(s);
  512|  32.3M|    if (!BN_GF2m_mod_arr(r, s, p))
  ------------------
  |  Branch (512:9): [True: 0, False: 32.3M]
  ------------------
  513|      0|        goto err;
  514|  32.3M|    bn_check_top(r);
  515|  32.3M|    ret = 1;
  516|  32.3M| err:
  517|  32.3M|    BN_CTX_end(ctx);
  518|  32.3M|    return ret;
  519|  32.3M|}
BN_GF2m_mod_inv:
  730|  6.89k|{
  731|  6.89k|    BIGNUM *b = NULL;
  732|  6.89k|    int ret = 0;
  733|       |
  734|  6.89k|    BN_CTX_start(ctx);
  735|  6.89k|    if ((b = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (735:9): [True: 0, False: 6.89k]
  ------------------
  736|      0|        goto err;
  737|       |
  738|       |    /* generate blinding value */
  739|  6.89k|    do {
  740|  6.89k|        if (!BN_priv_rand_ex(b, BN_num_bits(p) - 1,
  ------------------
  |  Branch (740:13): [True: 0, False: 6.89k]
  ------------------
  741|  6.89k|                             BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx))
  ------------------
  |  |   80|  6.89k|#define BN_RAND_TOP_ANY    -1
  ------------------
                                           BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx))
  ------------------
  |  |   85|  6.89k|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  742|      0|            goto err;
  743|  6.89k|    } while (BN_is_zero(b));
  ------------------
  |  Branch (743:14): [True: 0, False: 6.89k]
  ------------------
  744|       |
  745|       |    /* r := a * b */
  746|  6.89k|    if (!BN_GF2m_mod_mul(r, a, b, p, ctx))
  ------------------
  |  Branch (746:9): [True: 0, False: 6.89k]
  ------------------
  747|      0|        goto err;
  748|       |
  749|       |    /* r := 1/(a * b) */
  750|  6.89k|    if (!BN_GF2m_mod_inv_vartime(r, r, p, ctx))
  ------------------
  |  Branch (750:9): [True: 0, False: 6.89k]
  ------------------
  751|      0|        goto err;
  752|       |
  753|       |    /* r := b/(a * b) = 1/a */
  754|  6.89k|    if (!BN_GF2m_mod_mul(r, r, b, p, ctx))
  ------------------
  |  Branch (754:9): [True: 0, False: 6.89k]
  ------------------
  755|      0|        goto err;
  756|       |
  757|  6.89k|    ret = 1;
  758|       |
  759|  6.89k| err:
  760|  6.89k|    BN_CTX_end(ctx);
  761|  6.89k|    return ret;
  762|  6.89k|}
BN_GF2m_mod_div:
  797|  6.41k|{
  798|  6.41k|    BIGNUM *xinv = NULL;
  799|  6.41k|    int ret = 0;
  800|       |
  801|  6.41k|    bn_check_top(y);
  802|  6.41k|    bn_check_top(x);
  803|  6.41k|    bn_check_top(p);
  804|       |
  805|  6.41k|    BN_CTX_start(ctx);
  806|  6.41k|    xinv = BN_CTX_get(ctx);
  807|  6.41k|    if (xinv == NULL)
  ------------------
  |  Branch (807:9): [True: 0, False: 6.41k]
  ------------------
  808|      0|        goto err;
  809|       |
  810|  6.41k|    if (!BN_GF2m_mod_inv(xinv, x, p, ctx))
  ------------------
  |  Branch (810:9): [True: 0, False: 6.41k]
  ------------------
  811|      0|        goto err;
  812|  6.41k|    if (!BN_GF2m_mod_mul(r, y, xinv, p, ctx))
  ------------------
  |  Branch (812:9): [True: 0, False: 6.41k]
  ------------------
  813|      0|        goto err;
  814|  6.41k|    bn_check_top(r);
  815|  6.41k|    ret = 1;
  816|       |
  817|  6.41k| err:
  818|  6.41k|    BN_CTX_end(ctx);
  819|  6.41k|    return ret;
  820|  6.41k|}
BN_GF2m_mod_exp_arr:
  858|    427|{
  859|    427|    int ret = 0, i, n;
  860|    427|    BIGNUM *u;
  861|       |
  862|    427|    bn_check_top(a);
  863|    427|    bn_check_top(b);
  864|       |
  865|    427|    if (BN_is_zero(b))
  ------------------
  |  Branch (865:9): [True: 0, False: 427]
  ------------------
  866|      0|        return BN_one(r);
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  867|       |
  868|    427|    if (BN_abs_is_word(b, 1))
  ------------------
  |  Branch (868:9): [True: 0, False: 427]
  ------------------
  869|      0|        return (BN_copy(r, a) != NULL);
  870|       |
  871|    427|    BN_CTX_start(ctx);
  872|    427|    if ((u = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (872:9): [True: 0, False: 427]
  ------------------
  873|      0|        goto err;
  874|       |
  875|    427|    if (!BN_GF2m_mod_arr(u, a, p))
  ------------------
  |  Branch (875:9): [True: 0, False: 427]
  ------------------
  876|      0|        goto err;
  877|       |
  878|    427|    n = BN_num_bits(b) - 1;
  879|  49.3k|    for (i = n - 1; i >= 0; i--) {
  ------------------
  |  Branch (879:21): [True: 48.9k, False: 427]
  ------------------
  880|  48.9k|        if (!BN_GF2m_mod_sqr_arr(u, u, p, ctx))
  ------------------
  |  Branch (880:13): [True: 0, False: 48.9k]
  ------------------
  881|      0|            goto err;
  882|  48.9k|        if (BN_is_bit_set(b, i)) {
  ------------------
  |  Branch (882:13): [True: 0, False: 48.9k]
  ------------------
  883|      0|            if (!BN_GF2m_mod_mul_arr(u, u, a, p, ctx))
  ------------------
  |  Branch (883:17): [True: 0, False: 0]
  ------------------
  884|      0|                goto err;
  885|      0|        }
  886|  48.9k|    }
  887|    427|    if (!BN_copy(r, u))
  ------------------
  |  Branch (887:9): [True: 0, False: 427]
  ------------------
  888|      0|        goto err;
  889|    427|    bn_check_top(r);
  890|    427|    ret = 1;
  891|    427| err:
  892|    427|    BN_CTX_end(ctx);
  893|    427|    return ret;
  894|    427|}
BN_GF2m_mod_sqrt_arr:
  934|    427|{
  935|    427|    int ret = 0;
  936|    427|    BIGNUM *u;
  937|       |
  938|    427|    bn_check_top(a);
  939|       |
  940|    427|    if (p[0] == 0) {
  ------------------
  |  Branch (940:9): [True: 0, False: 427]
  ------------------
  941|       |        /* reduction mod 1 => return 0 */
  942|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  943|      0|        return 1;
  944|      0|    }
  945|       |
  946|    427|    BN_CTX_start(ctx);
  947|    427|    if ((u = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (947:9): [True: 0, False: 427]
  ------------------
  948|      0|        goto err;
  949|       |
  950|    427|    if (!BN_set_bit(u, p[0] - 1))
  ------------------
  |  Branch (950:9): [True: 0, False: 427]
  ------------------
  951|      0|        goto err;
  952|    427|    ret = BN_GF2m_mod_exp_arr(r, a, u, p, ctx);
  953|    427|    bn_check_top(r);
  954|       |
  955|    427| err:
  956|    427|    BN_CTX_end(ctx);
  957|    427|    return ret;
  958|    427|}
BN_GF2m_mod_solve_quad_arr:
  996|  6.11k|{
  997|  6.11k|    int ret = 0, count = 0, j;
  998|  6.11k|    BIGNUM *a, *z, *rho, *w, *w2, *tmp;
  999|       |
 1000|  6.11k|    bn_check_top(a_);
 1001|       |
 1002|  6.11k|    if (p[0] == 0) {
  ------------------
  |  Branch (1002:9): [True: 0, False: 6.11k]
  ------------------
 1003|       |        /* reduction mod 1 => return 0 */
 1004|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1005|      0|        return 1;
 1006|      0|    }
 1007|       |
 1008|  6.11k|    BN_CTX_start(ctx);
 1009|  6.11k|    a = BN_CTX_get(ctx);
 1010|  6.11k|    z = BN_CTX_get(ctx);
 1011|  6.11k|    w = BN_CTX_get(ctx);
 1012|  6.11k|    if (w == NULL)
  ------------------
  |  Branch (1012:9): [True: 0, False: 6.11k]
  ------------------
 1013|      0|        goto err;
 1014|       |
 1015|  6.11k|    if (!BN_GF2m_mod_arr(a, a_, p))
  ------------------
  |  Branch (1015:9): [True: 0, False: 6.11k]
  ------------------
 1016|      0|        goto err;
 1017|       |
 1018|  6.11k|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (1018:9): [True: 255, False: 5.86k]
  ------------------
 1019|    255|        BN_zero(r);
  ------------------
  |  |  202|    255|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1020|    255|        ret = 1;
 1021|    255|        goto err;
 1022|    255|    }
 1023|       |
 1024|  5.86k|    if (p[0] & 0x1) {           /* m is odd */
  ------------------
  |  Branch (1024:9): [True: 4.69k, False: 1.16k]
  ------------------
 1025|       |        /* compute half-trace of a */
 1026|  4.69k|        if (!BN_copy(z, a))
  ------------------
  |  Branch (1026:13): [True: 0, False: 4.69k]
  ------------------
 1027|      0|            goto err;
 1028|   364k|        for (j = 1; j <= (p[0] - 1) / 2; j++) {
  ------------------
  |  Branch (1028:21): [True: 360k, False: 4.69k]
  ------------------
 1029|   360k|            if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
  ------------------
  |  Branch (1029:17): [True: 0, False: 360k]
  ------------------
 1030|      0|                goto err;
 1031|   360k|            if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
  ------------------
  |  Branch (1031:17): [True: 0, False: 360k]
  ------------------
 1032|      0|                goto err;
 1033|   360k|            if (!BN_GF2m_add(z, z, a))
  ------------------
  |  Branch (1033:17): [True: 0, False: 360k]
  ------------------
 1034|      0|                goto err;
 1035|   360k|        }
 1036|       |
 1037|  4.69k|    } else {                    /* m is even */
 1038|       |
 1039|  1.16k|        rho = BN_CTX_get(ctx);
 1040|  1.16k|        w2 = BN_CTX_get(ctx);
 1041|  1.16k|        tmp = BN_CTX_get(ctx);
 1042|  1.16k|        if (tmp == NULL)
  ------------------
  |  Branch (1042:13): [True: 0, False: 1.16k]
  ------------------
 1043|      0|            goto err;
 1044|  42.3k|        do {
 1045|  42.3k|            if (!BN_priv_rand_ex(rho, p[0], BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY,
  ------------------
  |  |   81|  42.3k|#define BN_RAND_TOP_ONE     0
  ------------------
                          if (!BN_priv_rand_ex(rho, p[0], BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY,
  ------------------
  |  |   85|  42.3k|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  |  Branch (1045:17): [True: 0, False: 42.3k]
  ------------------
 1046|  42.3k|                                 0, ctx))
 1047|      0|                goto err;
 1048|  42.3k|            if (!BN_GF2m_mod_arr(rho, rho, p))
  ------------------
  |  Branch (1048:17): [True: 0, False: 42.3k]
  ------------------
 1049|      0|                goto err;
 1050|  42.3k|            BN_zero(z);
  ------------------
  |  |  202|  42.3k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1051|  42.3k|            if (!BN_copy(w, rho))
  ------------------
  |  Branch (1051:17): [True: 0, False: 42.3k]
  ------------------
 1052|      0|                goto err;
 1053|  15.5M|            for (j = 1; j <= p[0] - 1; j++) {
  ------------------
  |  Branch (1053:25): [True: 15.5M, False: 42.3k]
  ------------------
 1054|  15.5M|                if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
  ------------------
  |  Branch (1054:21): [True: 0, False: 15.5M]
  ------------------
 1055|      0|                    goto err;
 1056|  15.5M|                if (!BN_GF2m_mod_sqr_arr(w2, w, p, ctx))
  ------------------
  |  Branch (1056:21): [True: 0, False: 15.5M]
  ------------------
 1057|      0|                    goto err;
 1058|  15.5M|                if (!BN_GF2m_mod_mul_arr(tmp, w2, a, p, ctx))
  ------------------
  |  Branch (1058:21): [True: 0, False: 15.5M]
  ------------------
 1059|      0|                    goto err;
 1060|  15.5M|                if (!BN_GF2m_add(z, z, tmp))
  ------------------
  |  Branch (1060:21): [True: 0, False: 15.5M]
  ------------------
 1061|      0|                    goto err;
 1062|  15.5M|                if (!BN_GF2m_add(w, w2, rho))
  ------------------
  |  Branch (1062:21): [True: 0, False: 15.5M]
  ------------------
 1063|      0|                    goto err;
 1064|  15.5M|            }
 1065|  42.3k|            count++;
 1066|  42.3k|        } while (BN_is_zero(w) && (count < MAX_ITERATIONS));
  ------------------
  |  |   23|  42.0k|# define MAX_ITERATIONS 50
  ------------------
  |  Branch (1066:18): [True: 42.0k, False: 322]
  |  Branch (1066:35): [True: 41.2k, False: 841]
  ------------------
 1067|  1.16k|        if (BN_is_zero(w)) {
  ------------------
  |  Branch (1067:13): [True: 841, False: 322]
  ------------------
 1068|    841|            ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS);
  ------------------
  |  |  401|    841|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    841|    (ERR_new(),                                                 \
  |  |  |  |  404|    841|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    841|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    841|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    841|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    841|     ERR_set_error)
  |  |  ------------------
  ------------------
 1069|    841|            goto err;
 1070|    841|        }
 1071|  1.16k|    }
 1072|       |
 1073|  5.02k|    if (!BN_GF2m_mod_sqr_arr(w, z, p, ctx))
  ------------------
  |  Branch (1073:9): [True: 0, False: 5.02k]
  ------------------
 1074|      0|        goto err;
 1075|  5.02k|    if (!BN_GF2m_add(w, z, w))
  ------------------
  |  Branch (1075:9): [True: 0, False: 5.02k]
  ------------------
 1076|      0|        goto err;
 1077|  5.02k|    if (BN_GF2m_cmp(w, a)) {
  ------------------
  |  |  504|  5.02k|#  define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
  |  |  ------------------
  |  |  |  Branch (504:29): [True: 928, False: 4.09k]
  |  |  ------------------
  ------------------
 1078|    928|        ERR_raise(ERR_LIB_BN, BN_R_NO_SOLUTION);
  ------------------
  |  |  401|    928|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    928|    (ERR_new(),                                                 \
  |  |  |  |  404|    928|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    928|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    928|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    928|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    928|     ERR_set_error)
  |  |  ------------------
  ------------------
 1079|    928|        goto err;
 1080|    928|    }
 1081|       |
 1082|  4.09k|    if (!BN_copy(r, z))
  ------------------
  |  Branch (1082:9): [True: 0, False: 4.09k]
  ------------------
 1083|      0|        goto err;
 1084|  4.09k|    bn_check_top(r);
 1085|       |
 1086|  4.09k|    ret = 1;
 1087|       |
 1088|  6.11k| err:
 1089|  6.11k|    BN_CTX_end(ctx);
 1090|  6.11k|    return ret;
 1091|  4.09k|}
BN_GF2m_poly2arr:
 1132|  36.8k|{
 1133|  36.8k|    int i, j, k = 0;
 1134|  36.8k|    BN_ULONG mask;
  ------------------
  |  |   37|  36.8k|#  define BN_ULONG        unsigned long
  ------------------
 1135|       |
 1136|  36.8k|    if (BN_is_zero(a))
  ------------------
  |  Branch (1136:9): [True: 0, False: 36.8k]
  ------------------
 1137|      0|        return 0;
 1138|       |
 1139|   161k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (1139:26): [True: 124k, False: 36.8k]
  ------------------
 1140|   124k|        if (!a->d[i])
  ------------------
  |  Branch (1140:13): [True: 44.0k, False: 80.2k]
  ------------------
 1141|       |            /* skip word if a->d[i] == 0 */
 1142|  44.0k|            continue;
 1143|  80.2k|        mask = BN_TBIT;
  ------------------
  |  |   56|  80.2k|# define BN_TBIT        ((BN_ULONG)1 << (BN_BITS2 - 1))
  |  |  ------------------
  |  |  |  |   54|  80.2k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  80.2k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1144|  5.21M|        for (j = BN_BITS2 - 1; j >= 0; j--) {
  ------------------
  |  |   54|  80.2k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  80.2k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (1144:32): [True: 5.13M, False: 80.2k]
  ------------------
 1145|  5.13M|            if (a->d[i] & mask) {
  ------------------
  |  Branch (1145:17): [True: 142k, False: 4.99M]
  ------------------
 1146|   142k|                if (k < max)
  ------------------
  |  Branch (1146:21): [True: 142k, False: 0]
  ------------------
 1147|   142k|                    p[k] = BN_BITS2 * i + j;
  ------------------
  |  |   54|   142k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   142k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
 1148|   142k|                k++;
 1149|   142k|            }
 1150|  5.13M|            mask >>= 1;
 1151|  5.13M|        }
 1152|  80.2k|    }
 1153|       |
 1154|  36.8k|    if (k < max) {
  ------------------
  |  Branch (1154:9): [True: 36.8k, False: 0]
  ------------------
 1155|  36.8k|        p[k] = -1;
 1156|  36.8k|        k++;
 1157|  36.8k|    }
 1158|       |
 1159|  36.8k|    return k;
 1160|  36.8k|}
bn_gf2m.c:BN_GF2m_mod_inv_vartime:
  559|  6.89k|{
  560|  6.89k|    BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp;
  561|  6.89k|    int ret = 0;
  562|       |
  563|  6.89k|    bn_check_top(a);
  564|  6.89k|    bn_check_top(p);
  565|       |
  566|  6.89k|    BN_CTX_start(ctx);
  567|       |
  568|  6.89k|    b = BN_CTX_get(ctx);
  569|  6.89k|    c = BN_CTX_get(ctx);
  570|  6.89k|    u = BN_CTX_get(ctx);
  571|  6.89k|    v = BN_CTX_get(ctx);
  572|  6.89k|    if (v == NULL)
  ------------------
  |  Branch (572:9): [True: 0, False: 6.89k]
  ------------------
  573|      0|        goto err;
  574|       |
  575|  6.89k|    if (!BN_GF2m_mod(u, a, p))
  ------------------
  |  Branch (575:9): [True: 0, False: 6.89k]
  ------------------
  576|      0|        goto err;
  577|  6.89k|    if (BN_is_zero(u))
  ------------------
  |  Branch (577:9): [True: 0, False: 6.89k]
  ------------------
  578|      0|        goto err;
  579|       |
  580|  6.89k|    if (!BN_copy(v, p))
  ------------------
  |  Branch (580:9): [True: 0, False: 6.89k]
  ------------------
  581|      0|        goto err;
  582|       |# if 0
  583|       |    if (!BN_one(b))
  584|       |        goto err;
  585|       |
  586|       |    while (1) {
  587|       |        while (!BN_is_odd(u)) {
  588|       |            if (BN_is_zero(u))
  589|       |                goto err;
  590|       |            if (!BN_rshift1(u, u))
  591|       |                goto err;
  592|       |            if (BN_is_odd(b)) {
  593|       |                if (!BN_GF2m_add(b, b, p))
  594|       |                    goto err;
  595|       |            }
  596|       |            if (!BN_rshift1(b, b))
  597|       |                goto err;
  598|       |        }
  599|       |
  600|       |        if (BN_abs_is_word(u, 1))
  601|       |            break;
  602|       |
  603|       |        if (BN_num_bits(u) < BN_num_bits(v)) {
  604|       |            tmp = u;
  605|       |            u = v;
  606|       |            v = tmp;
  607|       |            tmp = b;
  608|       |            b = c;
  609|       |            c = tmp;
  610|       |        }
  611|       |
  612|       |        if (!BN_GF2m_add(u, u, v))
  613|       |            goto err;
  614|       |        if (!BN_GF2m_add(b, b, c))
  615|       |            goto err;
  616|       |    }
  617|       |# else
  618|  6.89k|    {
  619|  6.89k|        int i;
  620|  6.89k|        int ubits = BN_num_bits(u);
  621|  6.89k|        int vbits = BN_num_bits(v); /* v is copy of p */
  622|  6.89k|        int top = p->top;
  623|  6.89k|        BN_ULONG *udp, *bdp, *vdp, *cdp;
  ------------------
  |  |   37|  6.89k|#  define BN_ULONG        unsigned long
  ------------------
  624|       |
  625|  6.89k|        if (!bn_wexpand(u, top))
  ------------------
  |  Branch (625:13): [True: 0, False: 6.89k]
  ------------------
  626|      0|            goto err;
  627|  6.89k|        udp = u->d;
  628|  6.93k|        for (i = u->top; i < top; i++)
  ------------------
  |  Branch (628:26): [True: 35, False: 6.89k]
  ------------------
  629|     35|            udp[i] = 0;
  630|  6.89k|        u->top = top;
  631|  6.89k|        if (!bn_wexpand(b, top))
  ------------------
  |  Branch (631:13): [True: 0, False: 6.89k]
  ------------------
  632|      0|          goto err;
  633|  6.89k|        bdp = b->d;
  634|  6.89k|        bdp[0] = 1;
  635|  23.5k|        for (i = 1; i < top; i++)
  ------------------
  |  Branch (635:21): [True: 16.6k, False: 6.89k]
  ------------------
  636|  16.6k|            bdp[i] = 0;
  637|  6.89k|        b->top = top;
  638|  6.89k|        if (!bn_wexpand(c, top))
  ------------------
  |  Branch (638:13): [True: 0, False: 6.89k]
  ------------------
  639|      0|          goto err;
  640|  6.89k|        cdp = c->d;
  641|  30.4k|        for (i = 0; i < top; i++)
  ------------------
  |  Branch (641:21): [True: 23.5k, False: 6.89k]
  ------------------
  642|  23.5k|            cdp[i] = 0;
  643|  6.89k|        c->top = top;
  644|  6.89k|        vdp = v->d;             /* It pays off to "cache" *->d pointers,
  645|       |                                 * because it allows optimizer to be more
  646|       |                                 * aggressive. But we don't have to "cache"
  647|       |                                 * p->d, because *p is declared 'const'... */
  648|  1.11M|        while (1) {
  ------------------
  |  Branch (648:16): [Folded - Ignored]
  ------------------
  649|  3.36M|            while (ubits && !(udp[0] & 1)) {
  ------------------
  |  Branch (649:20): [True: 3.36M, False: 0]
  |  Branch (649:29): [True: 2.25M, False: 1.11M]
  ------------------
  650|  2.25M|                BN_ULONG u0, u1, b0, b1, mask;
  ------------------
  |  |   37|  2.25M|#  define BN_ULONG        unsigned long
  ------------------
  651|       |
  652|  2.25M|                u0 = udp[0];
  653|  2.25M|                b0 = bdp[0];
  654|  2.25M|                mask = (BN_ULONG)0 - (b0 & 1);
  655|  2.25M|                b0 ^= p->d[0] & mask;
  656|  9.71M|                for (i = 0; i < top - 1; i++) {
  ------------------
  |  Branch (656:29): [True: 7.46M, False: 2.25M]
  ------------------
  657|  7.46M|                    u1 = udp[i + 1];
  658|  7.46M|                    udp[i] = ((u0 >> 1) | (u1 << (BN_BITS2 - 1))) & BN_MASK2;
  ------------------
  |  |   54|  7.46M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  7.46M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                                  udp[i] = ((u0 >> 1) | (u1 << (BN_BITS2 - 1))) & BN_MASK2;
  ------------------
  |  |   94|  7.46M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  659|  7.46M|                    u0 = u1;
  660|  7.46M|                    b1 = bdp[i + 1] ^ (p->d[i + 1] & mask);
  661|  7.46M|                    bdp[i] = ((b0 >> 1) | (b1 << (BN_BITS2 - 1))) & BN_MASK2;
  ------------------
  |  |   54|  7.46M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  7.46M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                                  bdp[i] = ((b0 >> 1) | (b1 << (BN_BITS2 - 1))) & BN_MASK2;
  ------------------
  |  |   94|  7.46M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  662|  7.46M|                    b0 = b1;
  663|  7.46M|                }
  664|  2.25M|                udp[i] = u0 >> 1;
  665|  2.25M|                bdp[i] = b0 >> 1;
  666|  2.25M|                ubits--;
  667|  2.25M|            }
  668|       |
  669|  1.11M|            if (ubits <= BN_BITS2) {
  ------------------
  |  |   54|  1.11M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.11M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (669:17): [True: 355k, False: 761k]
  ------------------
  670|   355k|                if (udp[0] == 0) /* poly was reducible */
  ------------------
  |  Branch (670:21): [True: 0, False: 355k]
  ------------------
  671|      0|                    goto err;
  672|   355k|                if (udp[0] == 1)
  ------------------
  |  Branch (672:21): [True: 6.89k, False: 348k]
  ------------------
  673|  6.89k|                    break;
  674|   355k|            }
  675|       |
  676|  1.10M|            if (ubits < vbits) {
  ------------------
  |  Branch (676:17): [True: 455k, False: 654k]
  ------------------
  677|   455k|                i = ubits;
  678|   455k|                ubits = vbits;
  679|   455k|                vbits = i;
  680|   455k|                tmp = u;
  681|   455k|                u = v;
  682|   455k|                v = tmp;
  683|   455k|                tmp = b;
  684|   455k|                b = c;
  685|   455k|                c = tmp;
  686|   455k|                udp = vdp;
  687|   455k|                vdp = v->d;
  688|   455k|                bdp = cdp;
  689|   455k|                cdp = c->d;
  690|   455k|            }
  691|  5.92M|            for (i = 0; i < top; i++) {
  ------------------
  |  Branch (691:25): [True: 4.81M, False: 1.10M]
  ------------------
  692|  4.81M|                udp[i] ^= vdp[i];
  693|  4.81M|                bdp[i] ^= cdp[i];
  694|  4.81M|            }
  695|  1.10M|            if (ubits == vbits) {
  ------------------
  |  Branch (695:17): [True: 217k, False: 891k]
  ------------------
  696|   217k|                BN_ULONG ul;
  ------------------
  |  |   37|   217k|#  define BN_ULONG        unsigned long
  ------------------
  697|   217k|                int utop = (ubits - 1) / BN_BITS2;
  ------------------
  |  |   54|   217k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   217k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  698|       |
  699|   223k|                while ((ul = udp[utop]) == 0 && utop)
  ------------------
  |  Branch (699:24): [True: 5.79k, False: 217k]
  |  Branch (699:49): [True: 5.79k, False: 0]
  ------------------
  700|  5.79k|                    utop--;
  701|   217k|                ubits = utop * BN_BITS2 + BN_num_bits_word(ul);
  ------------------
  |  |   54|   217k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   217k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  702|   217k|            }
  703|  1.10M|        }
  704|  6.89k|        bn_correct_top(b);
  705|  6.89k|    }
  706|      0|# endif
  707|       |
  708|  6.89k|    if (!BN_copy(r, b))
  ------------------
  |  Branch (708:9): [True: 0, False: 6.89k]
  ------------------
  709|      0|        goto err;
  710|  6.89k|    bn_check_top(r);
  711|  6.89k|    ret = 1;
  712|       |
  713|  6.89k| err:
  714|       |# ifdef BN_DEBUG
  715|       |    /* BN_CTX_end would complain about the expanded form */
  716|       |    bn_correct_top(c);
  717|       |    bn_correct_top(u);
  718|       |    bn_correct_top(v);
  719|       |# endif
  720|  6.89k|    BN_CTX_end(ctx);
  721|  6.89k|    return ret;
  722|  6.89k|}

bn_compute_wNAF:
   23|    201|{
   24|    201|    int window_val;
   25|    201|    signed char *r = NULL;
   26|    201|    int sign = 1;
   27|    201|    int bit, next_bit, mask;
   28|    201|    size_t len = 0, j;
   29|       |
   30|    201|    if (BN_is_zero(scalar)) {
  ------------------
  |  Branch (30:9): [True: 4, False: 197]
  ------------------
   31|      4|        r = OPENSSL_malloc(1);
  ------------------
  |  |   97|      4|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   32|      4|        if (r == NULL)
  ------------------
  |  Branch (32:13): [True: 0, False: 4]
  ------------------
   33|      0|            goto err;
   34|      4|        r[0] = 0;
   35|      4|        *ret_len = 1;
   36|      4|        return r;
   37|      4|    }
   38|       |
   39|    197|    if (w <= 0 || w > 7) {      /* 'signed char' can represent integers with
  ------------------
  |  Branch (39:9): [True: 0, False: 197]
  |  Branch (39:19): [True: 0, False: 197]
  ------------------
   40|       |                                 * absolute values less than 2^7 */
   41|      0|        ERR_raise(ERR_LIB_BN, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   42|      0|        goto err;
   43|      0|    }
   44|    197|    bit = 1 << w;               /* at most 128 */
   45|    197|    next_bit = bit << 1;        /* at most 256 */
   46|    197|    mask = next_bit - 1;        /* at most 255 */
   47|       |
   48|    197|    if (BN_is_negative(scalar)) {
  ------------------
  |  Branch (48:9): [True: 0, False: 197]
  ------------------
   49|      0|        sign = -1;
   50|      0|    }
   51|       |
   52|    197|    if (scalar->d == NULL || scalar->top == 0) {
  ------------------
  |  Branch (52:9): [True: 0, False: 197]
  |  Branch (52:30): [True: 0, False: 197]
  ------------------
   53|      0|        ERR_raise(ERR_LIB_BN, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   54|      0|        goto err;
   55|      0|    }
   56|       |
   57|    197|    len = BN_num_bits(scalar);
   58|    197|    r = OPENSSL_malloc(len + 1); /*
  ------------------
  |  |   97|    197|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    197|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    197|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   59|       |                                  * Modified wNAF may be one digit longer than binary representation
   60|       |                                  * (*ret_len will be set to the actual length, i.e. at most
   61|       |                                  * BN_num_bits(scalar) + 1)
   62|       |                                  */
   63|    197|    if (r == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 197]
  ------------------
   64|      0|        goto err;
   65|    197|    window_val = scalar->d[0] & mask;
   66|    197|    j = 0;
   67|  54.0k|    while ((window_val != 0) || (j + w + 1 < len)) { /* if j+w+1 >= len,
  ------------------
  |  Branch (67:12): [True: 40.3k, False: 13.6k]
  |  Branch (67:33): [True: 13.4k, False: 197]
  ------------------
   68|       |                                                      * window_val will not
   69|       |                                                      * increase */
   70|  53.8k|        int digit = 0;
   71|       |
   72|       |        /* 0 <= window_val <= 2^(w+1) */
   73|       |
   74|  53.8k|        if (window_val & 1) {
  ------------------
  |  Branch (74:13): [True: 6.54k, False: 47.2k]
  ------------------
   75|       |            /* 0 < window_val < 2^(w+1) */
   76|       |
   77|  6.54k|            if (window_val & bit) {
  ------------------
  |  Branch (77:17): [True: 2.72k, False: 3.81k]
  ------------------
   78|  2.72k|                digit = window_val - next_bit; /* -2^w < digit < 0 */
   79|       |
   80|  2.72k|#if 1                           /* modified wNAF */
   81|  2.72k|                if (j + w + 1 >= len) {
  ------------------
  |  Branch (81:21): [True: 54, False: 2.67k]
  ------------------
   82|       |                    /*
   83|       |                     * Special case for generating modified wNAFs:
   84|       |                     * no new bits will be added into window_val,
   85|       |                     * so using a positive digit here will decrease
   86|       |                     * the total length of the representation
   87|       |                     */
   88|       |
   89|     54|                    digit = window_val & (mask >> 1); /* 0 < digit < 2^w */
   90|     54|                }
   91|  2.72k|#endif
   92|  3.81k|            } else {
   93|  3.81k|                digit = window_val; /* 0 < digit < 2^w */
   94|  3.81k|            }
   95|       |
   96|  6.54k|            if (digit <= -bit || digit >= bit || !(digit & 1)) {
  ------------------
  |  Branch (96:17): [True: 0, False: 6.54k]
  |  Branch (96:34): [True: 0, False: 6.54k]
  |  Branch (96:50): [True: 0, False: 6.54k]
  ------------------
   97|      0|                ERR_raise(ERR_LIB_BN, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   98|      0|                goto err;
   99|      0|            }
  100|       |
  101|  6.54k|            window_val -= digit;
  102|       |
  103|       |            /*
  104|       |             * now window_val is 0 or 2^(w+1) in standard wNAF generation;
  105|       |             * for modified window NAFs, it may also be 2^w
  106|       |             */
  107|  6.54k|            if (window_val != 0 && window_val != next_bit
  ------------------
  |  Branch (107:17): [True: 2.72k, False: 3.81k]
  |  Branch (107:36): [True: 54, False: 2.67k]
  ------------------
  108|  6.54k|                && window_val != bit) {
  ------------------
  |  Branch (108:20): [True: 0, False: 54]
  ------------------
  109|      0|                ERR_raise(ERR_LIB_BN, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  110|      0|                goto err;
  111|      0|            }
  112|  6.54k|        }
  113|       |
  114|  53.8k|        r[j++] = sign * digit;
  115|       |
  116|  53.8k|        window_val >>= 1;
  117|  53.8k|        window_val += bit * BN_is_bit_set(scalar, j + w);
  118|       |
  119|  53.8k|        if (window_val > next_bit) {
  ------------------
  |  Branch (119:13): [True: 0, False: 53.8k]
  ------------------
  120|      0|            ERR_raise(ERR_LIB_BN, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  121|      0|            goto err;
  122|      0|        }
  123|  53.8k|    }
  124|       |
  125|    197|    if (j > len + 1) {
  ------------------
  |  Branch (125:9): [True: 0, False: 197]
  ------------------
  126|      0|        ERR_raise(ERR_LIB_BN, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  127|      0|        goto err;
  128|      0|    }
  129|    197|    *ret_len = j;
  130|    197|    return r;
  131|       |
  132|      0| err:
  133|      0|    OPENSSL_free(r);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  134|      0|    return NULL;
  135|    197|}
bn_get_top:
  138|  2.01k|{
  139|  2.01k|    return a->top;
  140|  2.01k|}
bn_set_all_zero:
  148|  37.6k|{
  149|  37.6k|    int i;
  150|       |
  151|  86.2k|    for (i = a->top; i < a->dmax; i++)
  ------------------
  |  Branch (151:22): [True: 48.6k, False: 37.6k]
  ------------------
  152|  48.6k|        a->d[i] = 0;
  153|  37.6k|}
bn_copy_words:
  156|    216|{
  157|    216|    if (in->top > size)
  ------------------
  |  Branch (157:9): [True: 0, False: 216]
  ------------------
  158|      0|        return 0;
  159|       |
  160|    216|    memset(out, 0, sizeof(*out) * size);
  161|    216|    if (in->d != NULL)
  ------------------
  |  Branch (161:9): [True: 216, False: 0]
  ------------------
  162|    216|        memcpy(out, in->d, sizeof(*out) * in->top);
  163|    216|    return 1;
  164|    216|}
bn_get_words:
  167|  45.4k|{
  168|  45.4k|    return a->d;
  169|  45.4k|}
bn_set_words:
  185|    180|{
  186|    180|    if (bn_wexpand(a, num_words) == NULL) {
  ------------------
  |  Branch (186:9): [True: 0, False: 180]
  ------------------
  187|      0|        ERR_raise(ERR_LIB_BN, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  188|      0|        return 0;
  189|      0|    }
  190|       |
  191|    180|    memcpy(a->d, words, sizeof(BN_ULONG) * num_words);
  192|    180|    a->top = num_words;
  193|    180|    bn_correct_top(a);
  194|    180|    return 1;
  195|    180|}

BN_kronecker:
   18|  24.1k|{
   19|  24.1k|    int i;
   20|  24.1k|    int ret = -2;               /* avoid 'uninitialized' warning */
   21|  24.1k|    int err = 0;
   22|  24.1k|    BIGNUM *A, *B, *tmp;
   23|       |    /*-
   24|       |     * In 'tab', only odd-indexed entries are relevant:
   25|       |     * For any odd BIGNUM n,
   26|       |     *     tab[BN_lsw(n) & 7]
   27|       |     * is $(-1)^{(n^2-1)/8}$ (using TeX notation).
   28|       |     * Note that the sign of n does not matter.
   29|       |     */
   30|  24.1k|    static const int tab[8] = { 0, 1, 0, -1, 0, -1, 0, 1 };
   31|       |
   32|  24.1k|    bn_check_top(a);
   33|  24.1k|    bn_check_top(b);
   34|       |
   35|  24.1k|    BN_CTX_start(ctx);
   36|  24.1k|    A = BN_CTX_get(ctx);
   37|  24.1k|    B = BN_CTX_get(ctx);
   38|  24.1k|    if (B == NULL)
  ------------------
  |  Branch (38:9): [True: 0, False: 24.1k]
  ------------------
   39|      0|        goto end;
   40|       |
   41|  24.1k|    err = !BN_copy(A, a);
   42|  24.1k|    if (err)
  ------------------
  |  Branch (42:9): [True: 0, False: 24.1k]
  ------------------
   43|      0|        goto end;
   44|  24.1k|    err = !BN_copy(B, b);
   45|  24.1k|    if (err)
  ------------------
  |  Branch (45:9): [True: 0, False: 24.1k]
  ------------------
   46|      0|        goto end;
   47|       |
   48|       |    /*
   49|       |     * Kronecker symbol, implemented according to Henri Cohen,
   50|       |     * "A Course in Computational Algebraic Number Theory"
   51|       |     * (algorithm 1.4.10).
   52|       |     */
   53|       |
   54|       |    /* Cohen's step 1: */
   55|       |
   56|  24.1k|    if (BN_is_zero(B)) {
  ------------------
  |  Branch (56:9): [True: 0, False: 24.1k]
  ------------------
   57|      0|        ret = BN_abs_is_word(A, 1);
   58|      0|        goto end;
   59|      0|    }
   60|       |
   61|       |    /* Cohen's step 2: */
   62|       |
   63|  24.1k|    if (!BN_is_odd(A) && !BN_is_odd(B)) {
  ------------------
  |  Branch (63:9): [True: 12.2k, False: 11.8k]
  |  Branch (63:26): [True: 0, False: 12.2k]
  ------------------
   64|      0|        ret = 0;
   65|      0|        goto end;
   66|      0|    }
   67|       |
   68|       |    /* now  B  is non-zero */
   69|  24.1k|    i = 0;
   70|  24.1k|    while (!BN_is_bit_set(B, i))
  ------------------
  |  Branch (70:12): [True: 0, False: 24.1k]
  ------------------
   71|      0|        i++;
   72|  24.1k|    err = !BN_rshift(B, B, i);
   73|  24.1k|    if (err)
  ------------------
  |  Branch (73:9): [True: 0, False: 24.1k]
  ------------------
   74|      0|        goto end;
   75|  24.1k|    if (i & 1) {
  ------------------
  |  Branch (75:9): [True: 0, False: 24.1k]
  ------------------
   76|       |        /* i is odd */
   77|       |        /* (thus  B  was even, thus  A  must be odd!)  */
   78|       |
   79|       |        /* set 'ret' to $(-1)^{(A^2-1)/8}$ */
   80|      0|        ret = tab[BN_lsw(A) & 7];
  ------------------
  |  |   14|      0|#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])
  |  |  ------------------
  |  |  |  Branch (14:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   81|  24.1k|    } else {
   82|       |        /* i is even */
   83|  24.1k|        ret = 1;
   84|  24.1k|    }
   85|       |
   86|  24.1k|    if (B->neg) {
  ------------------
  |  Branch (86:9): [True: 0, False: 24.1k]
  ------------------
   87|      0|        B->neg = 0;
   88|      0|        if (A->neg)
  ------------------
  |  Branch (88:13): [True: 0, False: 0]
  ------------------
   89|      0|            ret = -ret;
   90|      0|    }
   91|       |
   92|       |    /*
   93|       |     * now B is positive and odd, so what remains to be done is to compute
   94|       |     * the Jacobi symbol (A/B) and multiply it by 'ret'
   95|       |     */
   96|       |
   97|   162k|    while (1) {
  ------------------
  |  Branch (97:12): [Folded - Ignored]
  ------------------
   98|       |        /* Cohen's step 3: */
   99|       |
  100|       |        /*  B  is positive and odd */
  101|       |
  102|   162k|        if (BN_is_zero(A)) {
  ------------------
  |  Branch (102:13): [True: 24.1k, False: 138k]
  ------------------
  103|  24.1k|            ret = BN_is_one(B) ? ret : 0;
  ------------------
  |  Branch (103:19): [True: 24.1k, False: 23]
  ------------------
  104|  24.1k|            goto end;
  105|  24.1k|        }
  106|       |
  107|       |        /* now  A  is non-zero */
  108|   138k|        i = 0;
  109|   279k|        while (!BN_is_bit_set(A, i))
  ------------------
  |  Branch (109:16): [True: 141k, False: 138k]
  ------------------
  110|   141k|            i++;
  111|   138k|        err = !BN_rshift(A, A, i);
  112|   138k|        if (err)
  ------------------
  |  Branch (112:13): [True: 0, False: 138k]
  ------------------
  113|      0|            goto end;
  114|   138k|        if (i & 1) {
  ------------------
  |  Branch (114:13): [True: 45.4k, False: 92.6k]
  ------------------
  115|       |            /* i is odd */
  116|       |            /* multiply 'ret' by  $(-1)^{(B^2-1)/8}$ */
  117|  45.4k|            ret = ret * tab[BN_lsw(B) & 7];
  ------------------
  |  |   14|  45.4k|#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])
  |  |  ------------------
  |  |  |  Branch (14:20): [True: 0, False: 45.4k]
  |  |  ------------------
  ------------------
  118|  45.4k|        }
  119|       |
  120|       |        /* Cohen's step 4: */
  121|       |        /* multiply 'ret' by  $(-1)^{(A-1)(B-1)/4}$ */
  122|   138k|        if ((A->neg ? ~BN_lsw(A) : BN_lsw(A)) & BN_lsw(B) & 2)
  ------------------
  |  |   14|      0|#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])
  |  |  ------------------
  |  |  |  Branch (14:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      if ((A->neg ? ~BN_lsw(A) : BN_lsw(A)) & BN_lsw(B) & 2)
  ------------------
  |  |   14|   138k|#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])
  |  |  ------------------
  |  |  |  Branch (14:20): [True: 0, False: 138k]
  |  |  ------------------
  ------------------
                      if ((A->neg ? ~BN_lsw(A) : BN_lsw(A)) & BN_lsw(B) & 2)
  ------------------
  |  |   14|   138k|#define BN_lsw(n) (((n)->top == 0) ? (BN_ULONG) 0 : (n)->d[0])
  |  |  ------------------
  |  |  |  Branch (14:20): [True: 0, False: 138k]
  |  |  ------------------
  ------------------
  |  Branch (122:13): [True: 24.5k, False: 113k]
  |  Branch (122:14): [True: 0, False: 138k]
  ------------------
  123|  24.5k|            ret = -ret;
  124|       |
  125|       |        /* (A, B) := (B mod |A|, |A|) */
  126|   138k|        err = !BN_nnmod(B, B, A, ctx);
  127|   138k|        if (err)
  ------------------
  |  Branch (127:13): [True: 0, False: 138k]
  ------------------
  128|      0|            goto end;
  129|   138k|        tmp = A;
  130|   138k|        A = B;
  131|   138k|        B = tmp;
  132|   138k|        tmp->neg = 0;
  133|   138k|    }
  134|  24.1k| end:
  135|  24.1k|    BN_CTX_end(ctx);
  136|  24.1k|    if (err)
  ------------------
  |  Branch (136:9): [True: 0, False: 24.1k]
  ------------------
  137|      0|        return -2;
  138|  24.1k|    else
  139|  24.1k|        return ret;
  140|  24.1k|}

BN_value_one:
   83|  42.1k|{
   84|  42.1k|    static const BN_ULONG data_one = 1L;
   85|  42.1k|    static const BIGNUM const_one =
   86|  42.1k|        { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
  ------------------
  |  |   59|  42.1k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
   87|       |
   88|  42.1k|    return &const_one;
   89|  42.1k|}
BN_num_bits_word:
  101|  10.7M|{
  102|  10.7M|    BN_ULONG x, mask;
  ------------------
  |  |   37|  10.7M|#  define BN_ULONG        unsigned long
  ------------------
  103|  10.7M|    int bits = (l != 0);
  104|       |
  105|  10.7M|#if BN_BITS2 > 32
  106|  10.7M|    x = l >> 32;
  107|  10.7M|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|  10.7M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  108|  10.7M|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|  10.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  10.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  109|  10.7M|    bits += 32 & mask;
  110|  10.7M|    l ^= (x ^ l) & mask;
  111|  10.7M|#endif
  112|       |
  113|  10.7M|    x = l >> 16;
  114|  10.7M|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|  10.7M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  115|  10.7M|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|  10.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  10.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  116|  10.7M|    bits += 16 & mask;
  117|  10.7M|    l ^= (x ^ l) & mask;
  118|       |
  119|  10.7M|    x = l >> 8;
  120|  10.7M|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|  10.7M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  121|  10.7M|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|  10.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  10.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  122|  10.7M|    bits += 8 & mask;
  123|  10.7M|    l ^= (x ^ l) & mask;
  124|       |
  125|  10.7M|    x = l >> 4;
  126|  10.7M|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|  10.7M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  127|  10.7M|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|  10.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  10.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  128|  10.7M|    bits += 4 & mask;
  129|  10.7M|    l ^= (x ^ l) & mask;
  130|       |
  131|  10.7M|    x = l >> 2;
  132|  10.7M|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|  10.7M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  133|  10.7M|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|  10.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  10.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  134|  10.7M|    bits += 2 & mask;
  135|  10.7M|    l ^= (x ^ l) & mask;
  136|       |
  137|  10.7M|    x = l >> 1;
  138|  10.7M|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|  10.7M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  139|  10.7M|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|  10.7M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  10.7M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  140|  10.7M|    bits += 1 & mask;
  141|       |
  142|  10.7M|    return bits;
  143|  10.7M|}
BN_num_bits:
  179|  2.56M|{
  180|  2.56M|    int i = a->top - 1;
  181|  2.56M|    bn_check_top(a);
  182|       |
  183|  2.56M|    if (a->flags & BN_FLG_CONSTTIME) {
  ------------------
  |  |   67|  2.56M|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (183:9): [True: 1.29M, False: 1.26M]
  ------------------
  184|       |        /*
  185|       |         * We assume that BIGNUMs flagged as CONSTTIME have also been expanded
  186|       |         * so that a->dmax is not leaking secret information.
  187|       |         *
  188|       |         * In other words, it's the caller's responsibility to ensure `a` has
  189|       |         * been preallocated in advance to a public length if we hit this
  190|       |         * branch.
  191|       |         *
  192|       |         */
  193|  1.29M|        return bn_num_bits_consttime(a);
  194|  1.29M|    }
  195|       |
  196|  1.26M|    if (BN_is_zero(a))
  ------------------
  |  Branch (196:9): [True: 160k, False: 1.10M]
  ------------------
  197|   160k|        return 0;
  198|       |
  199|  1.10M|    return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
  ------------------
  |  |   54|  1.10M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.10M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  200|  1.26M|}
BN_clear_free:
  214|  1.41M|{
  215|  1.41M|    if (a == NULL)
  ------------------
  |  Branch (215:9): [True: 494k, False: 922k]
  ------------------
  216|   494k|        return;
  217|   922k|    if (a->d != NULL && !BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|   810k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (217:9): [True: 810k, False: 112k]
  |  Branch (217:25): [True: 810k, False: 25]
  ------------------
  218|   810k|        bn_free_d(a, 1);
  219|   922k|    if (BN_get_flags(a, BN_FLG_MALLOCED)) {
  ------------------
  |  |   58|   922k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (219:9): [True: 192k, False: 730k]
  ------------------
  220|   192k|        OPENSSL_cleanse(a, sizeof(*a));
  221|   192k|        OPENSSL_free(a);
  ------------------
  |  |  107|   192k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   192k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   192k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  222|   192k|    }
  223|   922k|}
BN_free:
  226|  2.06M|{
  227|  2.06M|    if (a == NULL)
  ------------------
  |  Branch (227:9): [True: 1.40M, False: 659k]
  ------------------
  228|  1.40M|        return;
  229|   659k|    if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|   659k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (229:9): [True: 659k, False: 0]
  ------------------
  230|   659k|        bn_free_d(a, 0);
  231|   659k|    if (a->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|   659k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (231:9): [True: 659k, False: 0]
  ------------------
  232|   659k|        OPENSSL_free(a);
  ------------------
  |  |  107|   659k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   659k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   659k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  233|   659k|}
bn_init:
  236|  1.26M|{
  237|  1.26M|    static BIGNUM nilbn;
  238|       |
  239|  1.26M|    *a = nilbn;
  240|  1.26M|    bn_check_top(a);
  241|  1.26M|}
BN_new:
  244|   851k|{
  245|   851k|    BIGNUM *ret;
  246|       |
  247|   851k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|   851k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   851k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   851k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (247:9): [True: 0, False: 851k]
  ------------------
  248|      0|        return NULL;
  249|   851k|    ret->flags = BN_FLG_MALLOCED;
  ------------------
  |  |   58|   851k|# define BN_FLG_MALLOCED         0x01
  ------------------
  250|   851k|    bn_check_top(ret);
  251|   851k|    return ret;
  252|   851k|}
BN_secure_new:
  255|   132k| {
  256|   132k|     BIGNUM *ret = BN_new();
  257|   132k|     if (ret != NULL)
  ------------------
  |  Branch (257:10): [True: 132k, False: 0]
  ------------------
  258|   132k|         ret->flags |= BN_FLG_SECURE;
  ------------------
  |  |   68|   132k|# define BN_FLG_SECURE           0x08
  ------------------
  259|   132k|     return ret;
  260|   132k| }
bn_expand2:
  299|  1.83M|{
  300|  1.83M|    if (words > b->dmax) {
  ------------------
  |  Branch (300:9): [True: 1.83M, False: 0]
  ------------------
  301|  1.83M|        BN_ULONG *a = bn_expand_internal(b, words);
  ------------------
  |  |   37|  1.83M|#  define BN_ULONG        unsigned long
  ------------------
  302|  1.83M|        if (!a)
  ------------------
  |  Branch (302:13): [True: 0, False: 1.83M]
  ------------------
  303|      0|            return NULL;
  304|  1.83M|        if (b->d != NULL)
  ------------------
  |  Branch (304:13): [True: 449k, False: 1.38M]
  ------------------
  305|   449k|            bn_free_d(b, 1);
  306|  1.83M|        b->d = a;
  307|  1.83M|        b->dmax = words;
  308|  1.83M|    }
  309|       |
  310|  1.83M|    return b;
  311|  1.83M|}
BN_dup:
  314|  20.2k|{
  315|  20.2k|    BIGNUM *t;
  316|       |
  317|  20.2k|    if (a == NULL)
  ------------------
  |  Branch (317:9): [True: 0, False: 20.2k]
  ------------------
  318|      0|        return NULL;
  319|  20.2k|    bn_check_top(a);
  320|       |
  321|  20.2k|    t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();
  ------------------
  |  |   68|  20.2k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (321:9): [True: 0, False: 20.2k]
  ------------------
  322|  20.2k|    if (t == NULL)
  ------------------
  |  Branch (322:9): [True: 0, False: 20.2k]
  ------------------
  323|      0|        return NULL;
  324|  20.2k|    if (!BN_copy(t, a)) {
  ------------------
  |  Branch (324:9): [True: 0, False: 20.2k]
  ------------------
  325|      0|        BN_free(t);
  326|      0|        return NULL;
  327|      0|    }
  328|  20.2k|    bn_check_top(t);
  329|  20.2k|    return t;
  330|  20.2k|}
BN_copy:
  333|  5.60M|{
  334|  5.60M|    int bn_words;
  335|       |
  336|  5.60M|    bn_check_top(b);
  337|       |
  338|  5.60M|    bn_words = BN_get_flags(b, BN_FLG_CONSTTIME) ? b->dmax : b->top;
  ------------------
  |  |   67|  5.60M|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (338:16): [True: 1.20k, False: 5.60M]
  ------------------
  339|       |
  340|  5.60M|    if (a == b)
  ------------------
  |  Branch (340:9): [True: 0, False: 5.60M]
  ------------------
  341|      0|        return a;
  342|  5.60M|    if (bn_wexpand(a, bn_words) == NULL)
  ------------------
  |  Branch (342:9): [True: 0, False: 5.60M]
  ------------------
  343|      0|        return NULL;
  344|       |
  345|  5.60M|    if (b->top > 0)
  ------------------
  |  Branch (345:9): [True: 5.43M, False: 171k]
  ------------------
  346|  5.43M|        memcpy(a->d, b->d, sizeof(b->d[0]) * bn_words);
  347|       |
  348|  5.60M|    a->neg = b->neg;
  349|  5.60M|    a->top = b->top;
  350|  5.60M|    a->flags |= b->flags & BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  5.60M|#  define BN_FLG_FIXED_TOP 0
  ------------------
  351|  5.60M|    bn_check_top(a);
  352|  5.60M|    return a;
  353|  5.60M|}
BN_clear:
  395|  33.3k|{
  396|  33.3k|    if (a == NULL)
  ------------------
  |  Branch (396:9): [True: 0, False: 33.3k]
  ------------------
  397|      0|        return;
  398|  33.3k|    bn_check_top(a);
  399|  33.3k|    if (a->d != NULL)
  ------------------
  |  Branch (399:9): [True: 0, False: 33.3k]
  ------------------
  400|      0|        OPENSSL_cleanse(a->d, sizeof(*a->d) * a->dmax);
  401|  33.3k|    a->neg = 0;
  402|  33.3k|    a->top = 0;
  403|  33.3k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  33.3k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  404|  33.3k|}
BN_get_word:
  407|     28|{
  408|     28|    if (a->top > 1)
  ------------------
  |  Branch (408:9): [True: 1, False: 27]
  ------------------
  409|      1|        return BN_MASK2;
  ------------------
  |  |   94|      1|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  410|     27|    else if (a->top == 1)
  ------------------
  |  Branch (410:14): [True: 25, False: 2]
  ------------------
  411|     25|        return a->d[0];
  412|       |    /* a->top == 0 */
  413|      2|    return 0;
  414|     28|}
BN_set_word:
  417|  84.7k|{
  418|  84.7k|    bn_check_top(a);
  419|  84.7k|    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  ------------------
  |  Branch (419:9): [True: 0, False: 84.7k]
  ------------------
  420|      0|        return 0;
  421|  84.7k|    a->neg = 0;
  422|  84.7k|    a->d[0] = w;
  423|  84.7k|    a->top = (w ? 1 : 0);
  ------------------
  |  Branch (423:15): [True: 84.6k, False: 68]
  ------------------
  424|  84.7k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  84.7k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  425|  84.7k|    bn_check_top(a);
  426|  84.7k|    return 1;
  427|  84.7k|}
BN_bin2bn:
  535|   400k|{
  536|   400k|    return bin2bn(s, len, ret, BIG, UNSIGNED);
  537|   400k|}
BN_bn2binpad:
  628|  14.9k|{
  629|  14.9k|    if (tolen < 0)
  ------------------
  |  Branch (629:9): [True: 0, False: 14.9k]
  ------------------
  630|      0|        return -1;
  631|  14.9k|    return bn2binpad(a, to, tolen, BIG, UNSIGNED);
  632|  14.9k|}
BN_bn2bin:
  642|   106k|{
  643|   106k|    return bn2binpad(a, to, -1, BIG, UNSIGNED);
  644|   106k|}
BN_lebin2bn:
  647|  1.03k|{
  648|  1.03k|    return bin2bn(s, len, ret, LITTLE, UNSIGNED);
  649|  1.03k|}
BN_bn2lebinpad:
  657|    967|{
  658|    967|    if (tolen < 0)
  ------------------
  |  Branch (658:9): [True: 0, False: 967]
  ------------------
  659|      0|        return -1;
  660|    967|    return bn2binpad(a, to, tolen, LITTLE, UNSIGNED);
  661|    967|}
BN_ucmp:
  707|  4.35M|{
  708|  4.35M|    int i;
  709|  4.35M|    BN_ULONG t1, t2, *ap, *bp;
  ------------------
  |  |   37|  4.35M|#  define BN_ULONG        unsigned long
  ------------------
  710|       |
  711|  4.35M|    bn_check_top(a);
  712|  4.35M|    bn_check_top(b);
  713|       |
  714|  4.35M|    i = a->top - b->top;
  715|  4.35M|    if (i != 0)
  ------------------
  |  Branch (715:9): [True: 269k, False: 4.08M]
  ------------------
  716|   269k|        return i;
  717|  4.08M|    ap = a->d;
  718|  4.08M|    bp = b->d;
  719|  4.19M|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (719:26): [True: 4.15M, False: 44.6k]
  ------------------
  720|  4.15M|        t1 = ap[i];
  721|  4.15M|        t2 = bp[i];
  722|  4.15M|        if (t1 != t2)
  ------------------
  |  Branch (722:13): [True: 4.04M, False: 107k]
  ------------------
  723|  4.04M|            return ((t1 > t2) ? 1 : -1);
  ------------------
  |  Branch (723:21): [True: 1.67M, False: 2.37M]
  ------------------
  724|  4.15M|    }
  725|  44.6k|    return 0;
  726|  4.08M|}
BN_cmp:
  729|  1.06M|{
  730|  1.06M|    int i;
  731|  1.06M|    int gt, lt;
  732|  1.06M|    BN_ULONG t1, t2;
  ------------------
  |  |   37|  1.06M|#  define BN_ULONG        unsigned long
  ------------------
  733|       |
  734|  1.06M|    if ((a == NULL) || (b == NULL)) {
  ------------------
  |  Branch (734:9): [True: 0, False: 1.06M]
  |  Branch (734:24): [True: 0, False: 1.06M]
  ------------------
  735|      0|        if (a != NULL)
  ------------------
  |  Branch (735:13): [True: 0, False: 0]
  ------------------
  736|      0|            return -1;
  737|      0|        else if (b != NULL)
  ------------------
  |  Branch (737:18): [True: 0, False: 0]
  ------------------
  738|      0|            return 1;
  739|      0|        else
  740|      0|            return 0;
  741|      0|    }
  742|       |
  743|  1.06M|    bn_check_top(a);
  744|  1.06M|    bn_check_top(b);
  745|       |
  746|  1.06M|    if (a->neg != b->neg) {
  ------------------
  |  Branch (746:9): [True: 0, False: 1.06M]
  ------------------
  747|      0|        if (a->neg)
  ------------------
  |  Branch (747:13): [True: 0, False: 0]
  ------------------
  748|      0|            return -1;
  749|      0|        else
  750|      0|            return 1;
  751|      0|    }
  752|  1.06M|    if (a->neg == 0) {
  ------------------
  |  Branch (752:9): [True: 1.06M, False: 0]
  ------------------
  753|  1.06M|        gt = 1;
  754|  1.06M|        lt = -1;
  755|  1.06M|    } else {
  756|      0|        gt = -1;
  757|      0|        lt = 1;
  758|      0|    }
  759|       |
  760|  1.06M|    if (a->top > b->top)
  ------------------
  |  Branch (760:9): [True: 24.0k, False: 1.03M]
  ------------------
  761|  24.0k|        return gt;
  762|  1.03M|    if (a->top < b->top)
  ------------------
  |  Branch (762:9): [True: 187k, False: 852k]
  ------------------
  763|   187k|        return lt;
  764|   995k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (764:26): [True: 969k, False: 25.9k]
  ------------------
  765|   969k|        t1 = a->d[i];
  766|   969k|        t2 = b->d[i];
  767|   969k|        if (t1 > t2)
  ------------------
  |  Branch (767:13): [True: 422k, False: 546k]
  ------------------
  768|   422k|            return gt;
  769|   546k|        if (t1 < t2)
  ------------------
  |  Branch (769:13): [True: 403k, False: 143k]
  ------------------
  770|   403k|            return lt;
  771|   546k|    }
  772|  25.9k|    return 0;
  773|   852k|}
BN_set_bit:
  776|  64.2k|{
  777|  64.2k|    int i, j, k;
  778|       |
  779|  64.2k|    if (n < 0)
  ------------------
  |  Branch (779:9): [True: 0, False: 64.2k]
  ------------------
  780|      0|        return 0;
  781|       |
  782|  64.2k|    i = n / BN_BITS2;
  ------------------
  |  |   54|  64.2k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  64.2k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  783|  64.2k|    j = n % BN_BITS2;
  ------------------
  |  |   54|  64.2k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  64.2k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  784|  64.2k|    if (a->top <= i) {
  ------------------
  |  Branch (784:9): [True: 64.2k, False: 0]
  ------------------
  785|  64.2k|        if (bn_wexpand(a, i + 1) == NULL)
  ------------------
  |  Branch (785:13): [True: 0, False: 64.2k]
  ------------------
  786|      0|            return 0;
  787|   435k|        for (k = a->top; k < i + 1; k++)
  ------------------
  |  Branch (787:26): [True: 371k, False: 64.2k]
  ------------------
  788|   371k|            a->d[k] = 0;
  789|  64.2k|        a->top = i + 1;
  790|  64.2k|        a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  64.2k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  791|  64.2k|    }
  792|       |
  793|  64.2k|    a->d[i] |= (((BN_ULONG)1) << j);
  794|  64.2k|    bn_check_top(a);
  795|  64.2k|    return 1;
  796|  64.2k|}
BN_is_bit_set:
  817|  7.61M|{
  818|  7.61M|    int i, j;
  819|       |
  820|  7.61M|    bn_check_top(a);
  821|  7.61M|    if (n < 0)
  ------------------
  |  Branch (821:9): [True: 0, False: 7.61M]
  ------------------
  822|      0|        return 0;
  823|  7.61M|    i = n / BN_BITS2;
  ------------------
  |  |   54|  7.61M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  7.61M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  824|  7.61M|    j = n % BN_BITS2;
  ------------------
  |  |   54|  7.61M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  7.61M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  825|  7.61M|    if (a->top <= i)
  ------------------
  |  Branch (825:9): [True: 141, False: 7.61M]
  ------------------
  826|    141|        return 0;
  827|  7.61M|    return (int)(((a->d[i]) >> j) & ((BN_ULONG)1));
  828|  7.61M|}
BN_set_negative:
  853|  59.4k|{
  854|  59.4k|    if (b && !BN_is_zero(a))
  ------------------
  |  Branch (854:9): [True: 3.73k, False: 55.7k]
  |  Branch (854:14): [True: 3.73k, False: 0]
  ------------------
  855|  3.73k|        a->neg = 1;
  856|  55.7k|    else
  857|  55.7k|        a->neg = 0;
  858|  59.4k|}
bn_cmp_words:
  861|  10.9k|{
  862|  10.9k|    int i;
  863|  10.9k|    BN_ULONG aa, bb;
  ------------------
  |  |   37|  10.9k|#  define BN_ULONG        unsigned long
  ------------------
  864|       |
  865|  10.9k|    if (n == 0)
  ------------------
  |  Branch (865:9): [True: 0, False: 10.9k]
  ------------------
  866|      0|        return 0;
  867|       |
  868|  10.9k|    aa = a[n - 1];
  869|  10.9k|    bb = b[n - 1];
  870|  10.9k|    if (aa != bb)
  ------------------
  |  Branch (870:9): [True: 8.18k, False: 2.78k]
  ------------------
  871|  8.18k|        return ((aa > bb) ? 1 : -1);
  ------------------
  |  Branch (871:17): [True: 4.33k, False: 3.85k]
  ------------------
  872|  11.4k|    for (i = n - 2; i >= 0; i--) {
  ------------------
  |  Branch (872:21): [True: 10.8k, False: 608]
  ------------------
  873|  10.8k|        aa = a[i];
  874|  10.8k|        bb = b[i];
  875|  10.8k|        if (aa != bb)
  ------------------
  |  Branch (875:13): [True: 2.17k, False: 8.70k]
  ------------------
  876|  2.17k|            return ((aa > bb) ? 1 : -1);
  ------------------
  |  Branch (876:21): [True: 1.15k, False: 1.02k]
  ------------------
  877|  10.8k|    }
  878|    608|    return 0;
  879|  2.78k|}
bn_cmp_part_words:
  891|  12.9k|{
  892|  12.9k|    int n, i;
  893|  12.9k|    n = cl - 1;
  894|       |
  895|  12.9k|    if (dl < 0) {
  ------------------
  |  Branch (895:9): [True: 1.13k, False: 11.7k]
  ------------------
  896|  2.86k|        for (i = dl; i < 0; i++) {
  ------------------
  |  Branch (896:22): [True: 2.73k, False: 139]
  ------------------
  897|  2.73k|            if (b[n - i] != 0)
  ------------------
  |  Branch (897:17): [True: 994, False: 1.73k]
  ------------------
  898|    994|                return -1;      /* a < b */
  899|  2.73k|        }
  900|  1.13k|    }
  901|  11.9k|    if (dl > 0) {
  ------------------
  |  Branch (901:9): [True: 1.14k, False: 10.7k]
  ------------------
  902|  3.70k|        for (i = dl; i > 0; i--) {
  ------------------
  |  Branch (902:22): [True: 3.52k, False: 188]
  ------------------
  903|  3.52k|            if (a[n + i] != 0)
  ------------------
  |  Branch (903:17): [True: 955, False: 2.56k]
  ------------------
  904|    955|                return 1;       /* a > b */
  905|  3.52k|        }
  906|  1.14k|    }
  907|  10.9k|    return bn_cmp_words(a, b, cl);
  908|  11.9k|}
BN_consttime_swap:
  918|  1.01M|{
  919|  1.01M|    BN_ULONG t;
  ------------------
  |  |   37|  1.01M|#  define BN_ULONG        unsigned long
  ------------------
  920|  1.01M|    int i;
  921|       |
  922|  1.01M|    bn_wcheck_size(a, nwords);
  923|  1.01M|    bn_wcheck_size(b, nwords);
  924|       |
  925|  1.01M|    condition = ((~condition & ((condition - 1))) >> (BN_BITS2 - 1)) - 1;
  ------------------
  |  |   54|  1.01M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.01M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  926|       |
  927|  1.01M|    t = (a->top ^ b->top) & condition;
  928|  1.01M|    a->top ^= t;
  929|  1.01M|    b->top ^= t;
  930|       |
  931|  1.01M|    t = (a->neg ^ b->neg) & condition;
  932|  1.01M|    a->neg ^= t;
  933|  1.01M|    b->neg ^= t;
  934|       |
  935|       |    /*-
  936|       |     * BN_FLG_STATIC_DATA: indicates that data may not be written to. Intention
  937|       |     * is actually to treat it as it's read-only data, and some (if not most)
  938|       |     * of it does reside in read-only segment. In other words observation of
  939|       |     * BN_FLG_STATIC_DATA in BN_consttime_swap should be treated as fatal
  940|       |     * condition. It would either cause SEGV or effectively cause data
  941|       |     * corruption.
  942|       |     *
  943|       |     * BN_FLG_MALLOCED: refers to BN structure itself, and hence must be
  944|       |     * preserved.
  945|       |     *
  946|       |     * BN_FLG_SECURE: must be preserved, because it determines how x->d was
  947|       |     * allocated and hence how to free it.
  948|       |     *
  949|       |     * BN_FLG_CONSTTIME: sufficient to mask and swap
  950|       |     *
  951|       |     * BN_FLG_FIXED_TOP: indicates that we haven't called bn_correct_top() on
  952|       |     * the data, so the d array may be padded with additional 0 values (i.e.
  953|       |     * top could be greater than the minimal value that it could be). We should
  954|       |     * be swapping it
  955|       |     */
  956|       |
  957|  1.01M|#define BN_CONSTTIME_SWAP_FLAGS (BN_FLG_CONSTTIME | BN_FLG_FIXED_TOP)
  958|       |
  959|  1.01M|    t = ((a->flags ^ b->flags) & BN_CONSTTIME_SWAP_FLAGS) & condition;
  ------------------
  |  |  957|  1.01M|#define BN_CONSTTIME_SWAP_FLAGS (BN_FLG_CONSTTIME | BN_FLG_FIXED_TOP)
  |  |  ------------------
  |  |  |  |   67|  1.01M|# define BN_FLG_CONSTTIME        0x04
  |  |  ------------------
  |  |               #define BN_CONSTTIME_SWAP_FLAGS (BN_FLG_CONSTTIME | BN_FLG_FIXED_TOP)
  |  |  ------------------
  |  |  |  |  226|  1.01M|#  define BN_FLG_FIXED_TOP 0
  |  |  ------------------
  ------------------
  960|  1.01M|    a->flags ^= t;
  961|  1.01M|    b->flags ^= t;
  962|       |
  963|       |    /* conditionally swap the data */
  964|  5.32M|    for (i = 0; i < nwords; i++) {
  ------------------
  |  Branch (964:17): [True: 4.30M, False: 1.01M]
  ------------------
  965|  4.30M|        t = (a->d[i] ^ b->d[i]) & condition;
  966|  4.30M|        a->d[i] ^= t;
  967|  4.30M|        b->d[i] ^= t;
  968|  4.30M|    }
  969|  1.01M|}
BN_security_bits:
  976|    591|{
  977|    591|    int secbits, bits;
  978|    591|    if (L >= 15360)
  ------------------
  |  Branch (978:9): [True: 1, False: 590]
  ------------------
  979|      1|        secbits = 256;
  980|    590|    else if (L >= 7680)
  ------------------
  |  Branch (980:14): [True: 5, False: 585]
  ------------------
  981|      5|        secbits = 192;
  982|    585|    else if (L >= 3072)
  ------------------
  |  Branch (982:14): [True: 1, False: 584]
  ------------------
  983|      1|        secbits = 128;
  984|    584|    else if (L >= 2048)
  ------------------
  |  Branch (984:14): [True: 4, False: 580]
  ------------------
  985|      4|        secbits = 112;
  986|    580|    else if (L >= 1024)
  ------------------
  |  Branch (986:14): [True: 381, False: 199]
  ------------------
  987|    381|        secbits = 80;
  988|    199|    else
  989|    199|        return 0;
  990|    392|    if (N == -1)
  ------------------
  |  Branch (990:9): [True: 6, False: 386]
  ------------------
  991|      6|        return secbits;
  992|    386|    bits = N / 2;
  993|    386|    if (bits < 80)
  ------------------
  |  Branch (993:9): [True: 348, False: 38]
  ------------------
  994|    348|        return 0;
  995|     38|    return bits >= secbits ? secbits : bits;
  ------------------
  |  Branch (995:12): [True: 37, False: 1]
  ------------------
  996|    386|}
BN_zero_ex:
  999|  78.3M|{
 1000|  78.3M|    a->neg = 0;
 1001|  78.3M|    a->top = 0;
 1002|  78.3M|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  78.3M|#  define BN_FLG_FIXED_TOP 0
  ------------------
 1003|  78.3M|}
BN_abs_is_word:
 1006|  4.00M|{
 1007|  4.00M|    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
  ------------------
  |  Branch (1007:13): [True: 223k, False: 3.78M]
  |  Branch (1007:30): [True: 163k, False: 59.6k]
  |  Branch (1007:50): [True: 0, False: 3.84M]
  |  Branch (1007:62): [True: 0, False: 0]
  ------------------
 1008|  4.00M|}
BN_is_zero:
 1011|  9.70M|{
 1012|  9.70M|    return a->top == 0;
 1013|  9.70M|}
BN_is_one:
 1016|  3.96M|{
 1017|  3.96M|    return BN_abs_is_word(a, 1) && !a->neg;
  ------------------
  |  Branch (1017:12): [True: 155k, False: 3.80M]
  |  Branch (1017:36): [True: 155k, False: 0]
  ------------------
 1018|  3.96M|}
BN_is_word:
 1021|  12.5k|{
 1022|  12.5k|    return BN_abs_is_word(a, w) && (!w || !a->neg);
  ------------------
  |  Branch (1022:12): [True: 8.12k, False: 4.43k]
  |  Branch (1022:37): [True: 0, False: 8.12k]
  |  Branch (1022:43): [True: 8.12k, False: 0]
  ------------------
 1023|  12.5k|}
BN_is_odd:
 1026|  1.66M|{
 1027|  1.66M|    return (a->top > 0) && (a->d[0] & 1);
  ------------------
  |  Branch (1027:12): [True: 1.66M, False: 513]
  |  Branch (1027:28): [True: 960k, False: 705k]
  ------------------
 1028|  1.66M|}
BN_is_negative:
 1031|   183k|{
 1032|   183k|    return (a->neg != 0);
 1033|   183k|}
BN_to_montgomery:
 1037|  34.5k|{
 1038|  34.5k|    return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
 1039|  34.5k|}
BN_with_flags:
 1042|     25|{
 1043|     25|    dest->d = b->d;
 1044|     25|    dest->top = b->top;
 1045|     25|    dest->dmax = b->dmax;
 1046|     25|    dest->neg = b->neg;
 1047|     25|    dest->flags = ((dest->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|     25|# define BN_FLG_MALLOCED         0x01
  ------------------
 1048|     25|                   | (b->flags & ~BN_FLG_MALLOCED)
  ------------------
  |  |   58|     25|# define BN_FLG_MALLOCED         0x01
  ------------------
 1049|     25|                   | BN_FLG_STATIC_DATA | flags);
  ------------------
  |  |   59|     25|# define BN_FLG_STATIC_DATA      0x02
  ------------------
 1050|     25|}
BN_set_flags:
 1070|   119k|{
 1071|   119k|    b->flags |= n;
 1072|   119k|}
BN_get_flags:
 1075|  13.7M|{
 1076|  13.7M|    return b->flags & n;
 1077|  13.7M|}
bn_wexpand:
 1105|   174M|{
 1106|   174M|    return (words <= a->dmax) ? a : bn_expand2(a, words);
  ------------------
  |  Branch (1106:12): [True: 173M, False: 1.80M]
  ------------------
 1107|   174M|}
bn_correct_top:
 1132|   147M|{
 1133|   147M|    BN_ULONG *ftl;
  ------------------
  |  |   37|   147M|#  define BN_ULONG        unsigned long
  ------------------
 1134|   147M|    int tmp_top = a->top;
 1135|       |
 1136|   147M|    if (tmp_top > 0) {
  ------------------
  |  Branch (1136:9): [True: 147M, False: 94.0k]
  ------------------
 1137|   506M|        for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
  ------------------
  |  Branch (1137:38): [True: 505M, False: 719k]
  ------------------
 1138|   505M|            ftl--;
 1139|   505M|            if (*ftl != 0)
  ------------------
  |  Branch (1139:17): [True: 146M, False: 359M]
  ------------------
 1140|   146M|                break;
 1141|   505M|        }
 1142|   147M|        a->top = tmp_top;
 1143|   147M|    }
 1144|   147M|    if (a->top == 0)
  ------------------
  |  Branch (1144:9): [True: 813k, False: 146M]
  ------------------
 1145|   813k|        a->neg = 0;
 1146|   147M|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   147M|#  define BN_FLG_FIXED_TOP 0
  ------------------
 1147|   147M|    bn_pollute(a);
 1148|   147M|}
bn_lib.c:bn_num_bits_consttime:
  154|  1.29M|{
  155|  1.29M|    int j, ret;
  156|  1.29M|    unsigned int mask, past_i;
  157|  1.29M|    int i = a->top - 1;
  158|  1.29M|    bn_check_top(a);
  159|       |
  160|  6.18M|    for (j = 0, past_i = 0, ret = 0; j < a->dmax; j++) {
  ------------------
  |  Branch (160:38): [True: 4.89M, False: 1.29M]
  ------------------
  161|  4.89M|        mask = constant_time_eq_int(i, j); /* 0xff..ff if i==j, 0x0 otherwise */
  162|       |
  163|  4.89M|        ret += BN_BITS2 & (~mask & ~past_i);
  ------------------
  |  |   54|  4.89M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.89M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  164|  4.89M|        ret += BN_num_bits_word(a->d[j]) & mask;
  165|       |
  166|  4.89M|        past_i |= mask; /* past_i will become 0xff..ff after i==j */
  167|  4.89M|    }
  168|       |
  169|       |    /*
  170|       |     * if BN_is_zero(a) => i is -1 and ret contains garbage, so we mask the
  171|       |     * final result.
  172|       |     */
  173|  1.29M|    mask = ~(constant_time_eq_int(i, ((int)-1)));
  174|       |
  175|  1.29M|    return ret & mask;
  176|  1.29M|}
bn_lib.c:bn_free_d:
  203|  1.91M|{
  204|  1.91M|    if (BN_get_flags(a, BN_FLG_SECURE))
  ------------------
  |  |   68|  1.91M|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (204:9): [True: 117k, False: 1.80M]
  ------------------
  205|   117k|        OPENSSL_secure_clear_free(a->d, a->dmax * sizeof(a->d[0]));
  ------------------
  |  |  121|   117k|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   117k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   117k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  206|  1.80M|    else if (clear != 0)
  ------------------
  |  Branch (206:14): [True: 1.14M, False: 659k]
  ------------------
  207|  1.14M|        OPENSSL_clear_free(a->d, a->dmax * sizeof(a->d[0]));
  ------------------
  |  |  105|  1.14M|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.14M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.14M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  208|   659k|    else
  209|   659k|        OPENSSL_free(a->d);
  ------------------
  |  |  107|   659k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   659k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   659k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  210|  1.91M|}
bn_lib.c:bn_expand_internal:
  265|  1.83M|{
  266|  1.83M|    BN_ULONG *a = NULL;
  ------------------
  |  |   37|  1.83M|#  define BN_ULONG        unsigned long
  ------------------
  267|       |
  268|  1.83M|    if (words > (INT_MAX / (4 * BN_BITS2))) {
  ------------------
  |  |   54|  1.83M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.83M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (268:9): [True: 0, False: 1.83M]
  ------------------
  269|      0|        ERR_raise(ERR_LIB_BN, BN_R_BIGNUM_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  270|      0|        return NULL;
  271|      0|    }
  272|  1.83M|    if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
  ------------------
  |  |   59|  1.83M|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (272:9): [True: 0, False: 1.83M]
  ------------------
  273|      0|        ERR_raise(ERR_LIB_BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  274|      0|        return NULL;
  275|      0|    }
  276|  1.83M|    if (BN_get_flags(b, BN_FLG_SECURE))
  ------------------
  |  |   68|  1.83M|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (276:9): [True: 117k, False: 1.72M]
  ------------------
  277|   117k|        a = OPENSSL_secure_zalloc(words * sizeof(*a));
  ------------------
  |  |  117|   117k|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   117k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   117k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  278|  1.72M|    else
  279|  1.72M|        a = OPENSSL_zalloc(words * sizeof(*a));
  ------------------
  |  |   99|  1.72M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.72M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.72M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  280|  1.83M|    if (a == NULL)
  ------------------
  |  Branch (280:9): [True: 0, False: 1.83M]
  ------------------
  281|      0|        return NULL;
  282|       |
  283|  1.83M|    assert(b->top <= words);
  284|  1.83M|    if (b->top > 0)
  ------------------
  |  Branch (284:9): [True: 180k, False: 1.65M]
  ------------------
  285|   180k|        memcpy(a, b->d, sizeof(*a) * b->top);
  286|       |
  287|  1.83M|    return a;
  288|  1.83M|}
bn_lib.c:bin2bn:
  434|   401k|{
  435|   401k|    int inc;
  436|   401k|    const unsigned char *s2;
  437|   401k|    int inc2;
  438|   401k|    int neg = 0, xor = 0, carry = 0;
  439|   401k|    unsigned int i;
  440|   401k|    unsigned int n;
  441|   401k|    BIGNUM *bn = NULL;
  442|       |
  443|       |    /* Negative length is not acceptable */
  444|   401k|    if (len < 0)
  ------------------
  |  Branch (444:9): [True: 0, False: 401k]
  ------------------
  445|      0|        return NULL;
  446|       |
  447|   401k|    if (ret == NULL)
  ------------------
  |  Branch (447:9): [True: 125k, False: 276k]
  ------------------
  448|   125k|        ret = bn = BN_new();
  449|   401k|    if (ret == NULL)
  ------------------
  |  Branch (449:9): [True: 0, False: 401k]
  ------------------
  450|      0|        return NULL;
  451|   401k|    bn_check_top(ret);
  452|       |
  453|       |    /*
  454|       |     * If the input has no bits, the number is considered zero.
  455|       |     * This makes calls with s==NULL and len==0 safe.
  456|       |     */
  457|   401k|    if (len == 0) {
  ------------------
  |  Branch (457:9): [True: 33.3k, False: 368k]
  ------------------
  458|  33.3k|        BN_clear(ret);
  459|  33.3k|        return ret;
  460|  33.3k|    }
  461|       |
  462|       |    /*
  463|       |     * The loop that does the work iterates from least to most
  464|       |     * significant BIGNUM chunk, so we adapt parameters to transfer
  465|       |     * input bytes accordingly.
  466|       |     */
  467|   368k|    if (endianness == LITTLE) {
  ------------------
  |  Branch (467:9): [True: 1.03k, False: 367k]
  ------------------
  468|  1.03k|        s2 = s + len - 1;
  469|  1.03k|        inc2 = -1;
  470|  1.03k|        inc = 1;
  471|   367k|    } else {
  472|   367k|        s2 = s;
  473|   367k|        inc2 = 1;
  474|   367k|        inc = -1;
  475|   367k|        s += len - 1;
  476|   367k|    }
  477|       |
  478|       |    /* Take note of the signedness of the input bytes*/
  479|   368k|    if (signedness == SIGNED) {
  ------------------
  |  Branch (479:9): [True: 0, False: 368k]
  ------------------
  480|      0|        neg = !!(*s2 & 0x80);
  481|      0|        xor = neg ? 0xff : 0x00;
  ------------------
  |  Branch (481:15): [True: 0, False: 0]
  ------------------
  482|      0|        carry = neg;
  483|      0|    }
  484|       |
  485|       |    /*
  486|       |     * Skip leading sign extensions (the value of |xor|).
  487|       |     * This is the only spot where |s2| and |inc2| are used.
  488|       |     */
  489|   928k|    for ( ; len > 0 && *s2 == xor; s2 += inc2, len--)
  ------------------
  |  Branch (489:13): [True: 917k, False: 10.6k]
  |  Branch (489:24): [True: 559k, False: 357k]
  ------------------
  490|   559k|        continue;
  491|       |
  492|       |    /*
  493|       |     * If there was a set of 0xff, we backtrack one byte unless the next
  494|       |     * one has a sign bit, as the last 0xff is then part of the actual
  495|       |     * number, rather then a mere sign extension.
  496|       |     */
  497|   368k|    if (xor == 0xff) {
  ------------------
  |  Branch (497:9): [True: 0, False: 368k]
  ------------------
  498|      0|        if (len == 0 || !(*s2 & 0x80))
  ------------------
  |  Branch (498:13): [True: 0, False: 0]
  |  Branch (498:25): [True: 0, False: 0]
  ------------------
  499|      0|            len++;
  500|      0|    }
  501|       |    /* If it was all zeros, we're done */
  502|   368k|    if (len == 0) {
  ------------------
  |  Branch (502:9): [True: 10.6k, False: 357k]
  ------------------
  503|  10.6k|        ret->top = 0;
  504|  10.6k|        return ret;
  505|  10.6k|    }
  506|   357k|    n = ((len - 1) / BN_BYTES) + 1; /* Number of resulting bignum chunks */
  ------------------
  |  |   38|   357k|#  define BN_BYTES        8
  ------------------
  507|   357k|    if (bn_wexpand(ret, (int)n) == NULL) {
  ------------------
  |  Branch (507:9): [True: 0, False: 357k]
  ------------------
  508|      0|        BN_free(bn);
  509|      0|        return NULL;
  510|      0|    }
  511|   357k|    ret->top = n;
  512|   357k|    ret->neg = neg;
  513|  2.74M|    for (i = 0; n-- > 0; i++) {
  ------------------
  |  Branch (513:17): [True: 2.39M, False: 357k]
  ------------------
  514|  2.39M|        BN_ULONG l = 0;        /* Accumulator */
  ------------------
  |  |   37|  2.39M|#  define BN_ULONG        unsigned long
  ------------------
  515|  2.39M|        unsigned int m = 0;    /* Offset in a bignum chunk, in bits */
  516|       |
  517|  19.9M|        for (; len > 0 && m < BN_BYTES * 8; len--, s += inc, m += 8) {
  ------------------
  |  |   38|  19.6M|#  define BN_BYTES        8
  ------------------
  |  Branch (517:16): [True: 19.6M, False: 357k]
  |  Branch (517:27): [True: 17.6M, False: 2.03M]
  ------------------
  518|  17.6M|            BN_ULONG byte_xored = *s ^ xor;
  ------------------
  |  |   37|  17.6M|#  define BN_ULONG        unsigned long
  ------------------
  519|  17.6M|            BN_ULONG byte = (byte_xored + carry) & 0xff;
  ------------------
  |  |   37|  17.6M|#  define BN_ULONG        unsigned long
  ------------------
  520|       |
  521|  17.6M|            carry = byte_xored > byte; /* Implicit 1 or 0 */
  522|  17.6M|            l |= (byte << m);
  523|  17.6M|        }
  524|  2.39M|        ret->d[i] = l;
  525|  2.39M|    }
  526|       |    /*
  527|       |     * need to call this due to clear byte at top if avoiding having the top
  528|       |     * bit set (-ve number)
  529|       |     */
  530|   357k|    bn_correct_top(ret);
  531|   357k|    return ret;
  532|   357k|}
bn_lib.c:bn2binpad:
  546|   122k|{
  547|   122k|    int inc;
  548|   122k|    int n, n8;
  549|   122k|    int xor = 0, carry = 0, ext = 0;
  550|   122k|    size_t i, lasti, j, atop, mask;
  551|   122k|    BN_ULONG l;
  ------------------
  |  |   37|   122k|#  define BN_ULONG        unsigned long
  ------------------
  552|       |
  553|       |    /*
  554|       |     * In case |a| is fixed-top, BN_num_bits can return bogus length,
  555|       |     * but it's assumed that fixed-top inputs ought to be "nominated"
  556|       |     * even for padded output, so it works out...
  557|       |     */
  558|   122k|    n8 = BN_num_bits(a);
  559|   122k|    n = (n8 + 7) / 8;           /* This is what BN_num_bytes() does */
  560|       |
  561|       |    /* Take note of the signedness of the bignum */
  562|   122k|    if (signedness == SIGNED) {
  ------------------
  |  Branch (562:9): [True: 0, False: 122k]
  ------------------
  563|      0|        xor = a->neg ? 0xff : 0x00;
  ------------------
  |  Branch (563:15): [True: 0, False: 0]
  ------------------
  564|      0|        carry = a->neg;
  565|       |
  566|       |        /*
  567|       |         * if |n * 8 == n|, then the MSbit is set, otherwise unset.
  568|       |         * We must compensate with one extra byte if that doesn't
  569|       |         * correspond to the signedness of the bignum with regards
  570|       |         * to 2's complement.
  571|       |         */
  572|      0|        ext = (n * 8 == n8)
  ------------------
  |  Branch (572:15): [True: 0, False: 0]
  ------------------
  573|      0|            ? !a->neg            /* MSbit set on nonnegative bignum */
  574|      0|            : a->neg;            /* MSbit unset on negative bignum */
  575|      0|    }
  576|       |
  577|   122k|    if (tolen == -1) {
  ------------------
  |  Branch (577:9): [True: 106k, False: 15.8k]
  ------------------
  578|   106k|        tolen = n + ext;
  579|   106k|    } else if (tolen < n + ext) { /* uncommon/unlike case */
  ------------------
  |  Branch (579:16): [True: 731, False: 15.1k]
  ------------------
  580|    731|        BIGNUM temp = *a;
  581|       |
  582|    731|        bn_correct_top(&temp);
  583|    731|        n8 = BN_num_bits(&temp);
  584|    731|        n = (n8 + 7) / 8;       /* This is what BN_num_bytes() does */
  585|    731|        if (tolen < n + ext)
  ------------------
  |  Branch (585:13): [True: 731, False: 0]
  ------------------
  586|    731|            return -1;
  587|    731|    }
  588|       |
  589|       |    /* Swipe through whole available data and don't give away padded zero. */
  590|   121k|    atop = a->dmax * BN_BYTES;
  ------------------
  |  |   38|   121k|#  define BN_BYTES        8
  ------------------
  591|   121k|    if (atop == 0) {
  ------------------
  |  Branch (591:9): [True: 10.0k, False: 111k]
  ------------------
  592|  10.0k|        if (tolen != 0)
  ------------------
  |  Branch (592:13): [True: 494, False: 9.51k]
  ------------------
  593|    494|            memset(to, '\0', tolen);
  594|  10.0k|        return tolen;
  595|  10.0k|    }
  596|       |
  597|       |    /*
  598|       |     * The loop that does the work iterates from least significant
  599|       |     * to most significant BIGNUM limb, so we adapt parameters to
  600|       |     * transfer output bytes accordingly.
  601|       |     */
  602|   111k|    if (endianness == LITTLE) {
  ------------------
  |  Branch (602:9): [True: 955, False: 110k]
  ------------------
  603|    955|        inc = 1;
  604|   110k|    } else {
  605|   110k|        inc = -1;
  606|   110k|        to += tolen - 1;         /* Move to the last byte, not beyond */
  607|   110k|    }
  608|       |
  609|   111k|    lasti = atop - 1;
  610|   111k|    atop = a->top * BN_BYTES;
  ------------------
  |  |   38|   111k|#  define BN_BYTES        8
  ------------------
  611|  4.99M|    for (i = 0, j = 0; j < (size_t)tolen; j++) {
  ------------------
  |  Branch (611:24): [True: 4.87M, False: 111k]
  ------------------
  612|  4.87M|        unsigned char byte, byte_xored;
  613|       |
  614|  4.87M|        l = a->d[i / BN_BYTES];
  ------------------
  |  |   38|  4.87M|#  define BN_BYTES        8
  ------------------
  615|  4.87M|        mask = 0 - ((j - atop) >> (8 * sizeof(i) - 1));
  616|  4.87M|        byte = (unsigned char)(l >> (8 * (i % BN_BYTES)) & mask);
  ------------------
  |  |   38|  4.87M|#  define BN_BYTES        8
  ------------------
  617|  4.87M|        byte_xored = byte ^ xor;
  618|  4.87M|        *to = (unsigned char)(byte_xored + carry);
  619|  4.87M|        carry = byte_xored > *to; /* Implicit 1 or 0 */
  620|  4.87M|        to += inc;
  621|  4.87M|        i += (i - lasti) >> (8 * sizeof(i) - 1); /* stay on last limb */
  622|  4.87M|    }
  623|       |
  624|   111k|    return tolen;
  625|   121k|}

bn_lib.c:bn_expand:
  670|  84.7k|{
  671|  84.7k|    if (bits > (INT_MAX - BN_BITS2 + 1))
  ------------------
  |  |   54|  84.7k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  84.7k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (671:9): [True: 0, False: 84.7k]
  ------------------
  672|      0|        return NULL;
  673|       |
  674|  84.7k|    if (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)
  ------------------
  |  |   54|  84.7k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  84.7k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  if (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)
  ------------------
  |  |   54|  84.7k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  84.7k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (674:9): [True: 55.0k, False: 29.6k]
  ------------------
  675|  55.0k|        return a;
  676|       |
  677|  29.6k|    return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
  ------------------
  |  |   54|  29.6k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  29.6k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
  ------------------
  |  |   54|  29.6k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  29.6k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  678|  84.7k|}

BN_nnmod:
   14|  4.19M|{
   15|       |    /*
   16|       |     * like BN_mod, but returns non-negative remainder (i.e., 0 <= r < |d|
   17|       |     * always holds)
   18|       |     */
   19|       |
   20|  4.19M|    if (!(BN_mod(r, m, d, ctx)))
  ------------------
  |  |  277|  4.19M|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  |  Branch (20:9): [True: 0, False: 4.19M]
  ------------------
   21|      0|        return 0;
   22|  4.19M|    if (!r->neg)
  ------------------
  |  Branch (22:9): [True: 4.17M, False: 20.8k]
  ------------------
   23|  4.17M|        return 1;
   24|       |    /* now   -|d| < r < 0,  so we have to set  r := r + |d| */
   25|  20.8k|    return (d->neg ? BN_sub : BN_add) (r, r, d);
  ------------------
  |  Branch (25:13): [True: 0, False: 20.8k]
  ------------------
   26|  4.19M|}
bn_mod_add_fixed_top:
   50|  1.51M|{
   51|  1.51M|    size_t i, ai, bi, mtop = m->top;
   52|  1.51M|    BN_ULONG storage[1024 / BN_BITS2];
  ------------------
  |  |   37|  1.51M|#  define BN_ULONG        unsigned long
  ------------------
   53|  1.51M|    BN_ULONG carry, temp, mask, *rp, *tp = storage;
  ------------------
  |  |   37|  1.51M|#  define BN_ULONG        unsigned long
  ------------------
   54|  1.51M|    const BN_ULONG *ap, *bp;
   55|       |
   56|  1.51M|    if (bn_wexpand(r, mtop) == NULL)
  ------------------
  |  Branch (56:9): [True: 0, False: 1.51M]
  ------------------
   57|      0|        return 0;
   58|       |
   59|  1.51M|    if (mtop > sizeof(storage) / sizeof(storage[0])) {
  ------------------
  |  Branch (59:9): [True: 0, False: 1.51M]
  ------------------
   60|      0|        tp = OPENSSL_malloc(mtop * sizeof(BN_ULONG));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|      0|        if (tp == NULL)
  ------------------
  |  Branch (61:13): [True: 0, False: 0]
  ------------------
   62|      0|            return 0;
   63|      0|    }
   64|       |
   65|  1.51M|    ap = a->d != NULL ? a->d : tp;
  ------------------
  |  Branch (65:10): [True: 1.51M, False: 0]
  ------------------
   66|  1.51M|    bp = b->d != NULL ? b->d : tp;
  ------------------
  |  Branch (66:10): [True: 1.51M, False: 210]
  ------------------
   67|       |
   68|  7.48M|    for (i = 0, ai = 0, bi = 0, carry = 0; i < mtop;) {
  ------------------
  |  Branch (68:44): [True: 5.97M, False: 1.51M]
  ------------------
   69|  5.97M|        mask = (BN_ULONG)0 - ((i - a->top) >> (8 * sizeof(i) - 1));
   70|  5.97M|        temp = ((ap[ai] & mask) + carry) & BN_MASK2;
  ------------------
  |  |   94|  5.97M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   71|  5.97M|        carry = (temp < carry);
   72|       |
   73|  5.97M|        mask = (BN_ULONG)0 - ((i - b->top) >> (8 * sizeof(i) - 1));
   74|  5.97M|        tp[i] = ((bp[bi] & mask) + temp) & BN_MASK2;
  ------------------
  |  |   94|  5.97M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   75|  5.97M|        carry += (tp[i] < temp);
   76|       |
   77|  5.97M|        i++;
   78|  5.97M|        ai += (i - a->dmax) >> (8 * sizeof(i) - 1);
   79|  5.97M|        bi += (i - b->dmax) >> (8 * sizeof(i) - 1);
   80|  5.97M|    }
   81|  1.51M|    rp = r->d;
   82|  1.51M|    carry -= bn_sub_words(rp, tp, m->d, mtop);
   83|  7.48M|    for (i = 0; i < mtop; i++) {
  ------------------
  |  Branch (83:17): [True: 5.97M, False: 1.51M]
  ------------------
   84|  5.97M|        rp[i] = (carry & tp[i]) | (~carry & rp[i]);
   85|  5.97M|        ((volatile BN_ULONG *)tp)[i] = 0;
   86|  5.97M|    }
   87|  1.51M|    r->top = mtop;
   88|  1.51M|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.51M|#  define BN_FLG_FIXED_TOP 0
  ------------------
   89|  1.51M|    r->neg = 0;
   90|       |
   91|  1.51M|    if (tp != storage)
  ------------------
  |  Branch (91:9): [True: 0, False: 1.51M]
  ------------------
   92|      0|        OPENSSL_free(tp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|       |
   94|  1.51M|    return 1;
   95|  1.51M|}
BN_mod_add_quick:
   99|  1.51M|{
  100|  1.51M|    int ret = bn_mod_add_fixed_top(r, a, b, m);
  101|       |
  102|  1.51M|    if (ret)
  ------------------
  |  Branch (102:9): [True: 1.51M, False: 0]
  ------------------
  103|  1.51M|        bn_correct_top(r);
  104|       |
  105|  1.51M|    return ret;
  106|  1.51M|}
BN_mod_sub_quick:
  186|  1.53M|{
  187|  1.53M|    if (!BN_sub(r, a, b))
  ------------------
  |  Branch (187:9): [True: 0, False: 1.53M]
  ------------------
  188|      0|        return 0;
  189|  1.53M|    if (r->neg)
  ------------------
  |  Branch (189:9): [True: 682k, False: 848k]
  ------------------
  190|   682k|        return BN_add(r, r, m);
  191|   848k|    return 1;
  192|  1.53M|}
BN_mod_mul:
  197|  3.93M|{
  198|  3.93M|    BIGNUM *t;
  199|  3.93M|    int ret = 0;
  200|       |
  201|  3.93M|    bn_check_top(a);
  202|  3.93M|    bn_check_top(b);
  203|  3.93M|    bn_check_top(m);
  204|       |
  205|  3.93M|    BN_CTX_start(ctx);
  206|  3.93M|    if ((t = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 3.93M]
  ------------------
  207|      0|        goto err;
  208|  3.93M|    if (a == b) {
  ------------------
  |  Branch (208:9): [True: 3.76M, False: 165k]
  ------------------
  209|  3.76M|        if (!BN_sqr(t, a, ctx))
  ------------------
  |  Branch (209:13): [True: 0, False: 3.76M]
  ------------------
  210|      0|            goto err;
  211|  3.76M|    } else {
  212|   165k|        if (!BN_mul(t, a, b, ctx))
  ------------------
  |  Branch (212:13): [True: 0, False: 165k]
  ------------------
  213|      0|            goto err;
  214|   165k|    }
  215|  3.93M|    if (!BN_nnmod(r, t, m, ctx))
  ------------------
  |  Branch (215:9): [True: 0, False: 3.93M]
  ------------------
  216|      0|        goto err;
  217|  3.93M|    bn_check_top(r);
  218|  3.93M|    ret = 1;
  219|  3.93M| err:
  220|  3.93M|    BN_CTX_end(ctx);
  221|  3.93M|    return ret;
  222|  3.93M|}
BN_mod_sqr:
  225|   160k|{
  226|   160k|    if (!BN_sqr(r, a, ctx))
  ------------------
  |  Branch (226:9): [True: 0, False: 160k]
  ------------------
  227|      0|        return 0;
  228|       |    /* r->neg == 0,  thus we don't need BN_nnmod */
  229|   160k|    return BN_mod(r, r, m, ctx);
  ------------------
  |  |  277|   160k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  230|   160k|}
BN_mod_lshift1_quick:
  245|   583k|{
  246|   583k|    if (!BN_lshift1(r, a))
  ------------------
  |  Branch (246:9): [True: 0, False: 583k]
  ------------------
  247|      0|        return 0;
  248|   583k|    bn_check_top(r);
  249|   583k|    if (BN_cmp(r, m) >= 0)
  ------------------
  |  Branch (249:9): [True: 285k, False: 297k]
  ------------------
  250|   285k|        return BN_sub(r, r, m);
  251|   297k|    return 1;
  252|   583k|}
BN_mod_lshift_quick:
  282|   305k|{
  283|   305k|    if (r != a) {
  ------------------
  |  Branch (283:9): [True: 267k, False: 37.5k]
  ------------------
  284|   267k|        if (BN_copy(r, a) == NULL)
  ------------------
  |  Branch (284:13): [True: 0, False: 267k]
  ------------------
  285|      0|            return 0;
  286|   267k|    }
  287|       |
  288|   737k|    while (n > 0) {
  ------------------
  |  Branch (288:12): [True: 432k, False: 305k]
  ------------------
  289|   432k|        int max_shift;
  290|       |
  291|       |        /* 0 < r < m */
  292|   432k|        max_shift = BN_num_bits(m) - BN_num_bits(r);
  293|       |        /* max_shift >= 0 */
  294|       |
  295|   432k|        if (max_shift < 0) {
  ------------------
  |  Branch (295:13): [True: 0, False: 432k]
  ------------------
  296|      0|            ERR_raise(ERR_LIB_BN, BN_R_INPUT_NOT_REDUCED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  297|      0|            return 0;
  298|      0|        }
  299|       |
  300|   432k|        if (max_shift > n)
  ------------------
  |  Branch (300:13): [True: 209k, False: 222k]
  ------------------
  301|   209k|            max_shift = n;
  302|       |
  303|   432k|        if (max_shift) {
  ------------------
  |  Branch (303:13): [True: 320k, False: 111k]
  ------------------
  304|   320k|            if (!BN_lshift(r, r, max_shift))
  ------------------
  |  Branch (304:17): [True: 0, False: 320k]
  ------------------
  305|      0|                return 0;
  306|   320k|            n -= max_shift;
  307|   320k|        } else {
  308|   111k|            if (!BN_lshift1(r, r))
  ------------------
  |  Branch (308:17): [True: 0, False: 111k]
  ------------------
  309|      0|                return 0;
  310|   111k|            --n;
  311|   111k|        }
  312|       |
  313|       |        /* BN_num_bits(r) <= BN_num_bits(m) */
  314|       |
  315|   432k|        if (BN_cmp(r, m) >= 0) {
  ------------------
  |  Branch (315:13): [True: 160k, False: 271k]
  ------------------
  316|   160k|            if (!BN_sub(r, r, m))
  ------------------
  |  Branch (316:17): [True: 0, False: 160k]
  ------------------
  317|      0|                return 0;
  318|   160k|        }
  319|   432k|    }
  320|   305k|    bn_check_top(r);
  321|       |
  322|   305k|    return 1;
  323|   305k|}

BN_mod_mul_montgomery:
   28|  5.46M|{
   29|  5.46M|    int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx);
   30|       |
   31|  5.46M|    bn_correct_top(r);
   32|  5.46M|    bn_check_top(r);
   33|       |
   34|  5.46M|    return ret;
   35|  5.46M|}
bn_mul_mont_fixed_top:
   39|  7.49M|{
   40|  7.49M|    BIGNUM *tmp;
   41|  7.49M|    int ret = 0;
   42|  7.49M|    int num = mont->N.top;
   43|       |
   44|  7.49M|#if defined(OPENSSL_BN_ASM_MONT) && defined(MONT_WORD)
   45|  7.49M|    if (num > 1 && num <= BN_SOFT_LIMIT && a->top == num && b->top == num) {
  ------------------
  |  |   62|  14.9M|#  define BN_SOFT_LIMIT         (4096 / BN_BYTES)
  |  |  ------------------
  |  |  |  |   38|  7.48M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (45:9): [True: 7.48M, False: 11.9k]
  |  Branch (45:20): [True: 7.48M, False: 0]
  |  Branch (45:44): [True: 7.12M, False: 365k]
  |  Branch (45:61): [True: 6.93M, False: 187k]
  ------------------
   46|  6.93M|        if (bn_wexpand(r, num) == NULL)
  ------------------
  |  Branch (46:13): [True: 0, False: 6.93M]
  ------------------
   47|      0|            return 0;
   48|  6.93M|        if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
  ------------------
  |  Branch (48:13): [True: 6.93M, False: 0]
  ------------------
   49|  6.93M|            r->neg = a->neg ^ b->neg;
   50|  6.93M|            r->top = num;
   51|  6.93M|            r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  6.93M|#  define BN_FLG_FIXED_TOP 0
  ------------------
   52|  6.93M|            return 1;
   53|  6.93M|        }
   54|  6.93M|    }
   55|   565k|#endif
   56|       |
   57|   565k|    if ((a->top + b->top) > 2 * num)
  ------------------
  |  Branch (57:9): [True: 0, False: 565k]
  ------------------
   58|      0|        return 0;
   59|       |
   60|   565k|    BN_CTX_start(ctx);
   61|   565k|    tmp = BN_CTX_get(ctx);
   62|   565k|    if (tmp == NULL)
  ------------------
  |  Branch (62:9): [True: 0, False: 565k]
  ------------------
   63|      0|        goto err;
   64|       |
   65|   565k|    bn_check_top(tmp);
   66|   565k|    if (a == b) {
  ------------------
  |  Branch (66:9): [True: 19.8k, False: 545k]
  ------------------
   67|  19.8k|        if (!bn_sqr_fixed_top(tmp, a, ctx))
  ------------------
  |  Branch (67:13): [True: 0, False: 19.8k]
  ------------------
   68|      0|            goto err;
   69|   545k|    } else {
   70|   545k|        if (!bn_mul_fixed_top(tmp, a, b, ctx))
  ------------------
  |  Branch (70:13): [True: 0, False: 545k]
  ------------------
   71|      0|            goto err;
   72|   545k|    }
   73|       |    /* reduce from aRR to aR */
   74|   565k|#ifdef MONT_WORD
   75|   565k|    if (!bn_from_montgomery_word(r, tmp, mont))
  ------------------
  |  Branch (75:9): [True: 0, False: 565k]
  ------------------
   76|      0|        goto err;
   77|       |#else
   78|       |    if (!BN_from_montgomery(r, tmp, mont, ctx))
   79|       |        goto err;
   80|       |#endif
   81|   565k|    ret = 1;
   82|   565k| err:
   83|   565k|    BN_CTX_end(ctx);
   84|   565k|    return ret;
   85|   565k|}
BN_from_montgomery:
  164|  26.6k|{
  165|  26.6k|    int retn;
  166|       |
  167|  26.6k|    retn = bn_from_mont_fixed_top(ret, a, mont, ctx);
  168|  26.6k|    bn_correct_top(ret);
  169|  26.6k|    bn_check_top(ret);
  170|       |
  171|  26.6k|    return retn;
  172|  26.6k|}
bn_from_mont_fixed_top:
  176|  26.6k|{
  177|  26.6k|    int retn = 0;
  178|  26.6k|#ifdef MONT_WORD
  179|  26.6k|    BIGNUM *t;
  180|       |
  181|  26.6k|    BN_CTX_start(ctx);
  182|  26.6k|    if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) {
  ------------------
  |  Branch (182:9): [True: 26.6k, False: 0]
  |  Branch (182:34): [True: 26.6k, False: 0]
  ------------------
  183|  26.6k|        retn = bn_from_montgomery_word(ret, t, mont);
  184|  26.6k|    }
  185|  26.6k|    BN_CTX_end(ctx);
  186|       |#else                           /* !MONT_WORD */
  187|       |    BIGNUM *t1, *t2;
  188|       |
  189|       |    BN_CTX_start(ctx);
  190|       |    t1 = BN_CTX_get(ctx);
  191|       |    t2 = BN_CTX_get(ctx);
  192|       |    if (t2 == NULL)
  193|       |        goto err;
  194|       |
  195|       |    if (!BN_copy(t1, a))
  196|       |        goto err;
  197|       |    BN_mask_bits(t1, mont->ri);
  198|       |
  199|       |    if (!BN_mul(t2, t1, &mont->Ni, ctx))
  200|       |        goto err;
  201|       |    BN_mask_bits(t2, mont->ri);
  202|       |
  203|       |    if (!BN_mul(t1, t2, &mont->N, ctx))
  204|       |        goto err;
  205|       |    if (!BN_add(t2, a, t1))
  206|       |        goto err;
  207|       |    if (!BN_rshift(ret, t2, mont->ri))
  208|       |        goto err;
  209|       |
  210|       |    if (BN_ucmp(ret, &(mont->N)) >= 0) {
  211|       |        if (!BN_usub(ret, ret, &(mont->N)))
  212|       |            goto err;
  213|       |    }
  214|       |    retn = 1;
  215|       |    bn_check_top(ret);
  216|       | err:
  217|       |    BN_CTX_end(ctx);
  218|       |#endif                          /* MONT_WORD */
  219|  26.6k|    return retn;
  220|  26.6k|}
bn_to_mont_fixed_top:
  224|  12.1k|{
  225|  12.1k|    return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx);
  226|  12.1k|}
BN_MONT_CTX_new:
  229|  51.5k|{
  230|  51.5k|    BN_MONT_CTX *ret;
  231|       |
  232|  51.5k|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   97|  51.5k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  51.5k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  51.5k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (232:9): [True: 0, False: 51.5k]
  ------------------
  233|      0|        return NULL;
  234|       |
  235|  51.5k|    BN_MONT_CTX_init(ret);
  236|  51.5k|    ret->flags = BN_FLG_MALLOCED;
  ------------------
  |  |   58|  51.5k|# define BN_FLG_MALLOCED         0x01
  ------------------
  237|  51.5k|    return ret;
  238|  51.5k|}
BN_MONT_CTX_init:
  241|  51.5k|{
  242|  51.5k|    ctx->ri = 0;
  243|  51.5k|    bn_init(&ctx->RR);
  244|  51.5k|    bn_init(&ctx->N);
  245|  51.5k|    bn_init(&ctx->Ni);
  246|  51.5k|    ctx->n0[0] = ctx->n0[1] = 0;
  247|  51.5k|    ctx->flags = 0;
  248|  51.5k|}
BN_MONT_CTX_free:
  251|   360k|{
  252|   360k|    if (mont == NULL)
  ------------------
  |  Branch (252:9): [True: 309k, False: 51.5k]
  ------------------
  253|   309k|        return;
  254|  51.5k|    BN_clear_free(&mont->RR);
  255|  51.5k|    BN_clear_free(&mont->N);
  256|  51.5k|    BN_clear_free(&mont->Ni);
  257|  51.5k|    if (mont->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  51.5k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (257:9): [True: 51.5k, False: 0]
  ------------------
  258|  51.5k|        OPENSSL_free(mont);
  ------------------
  |  |  107|  51.5k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  51.5k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  51.5k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  259|  51.5k|}
BN_MONT_CTX_set:
  262|  32.0k|{
  263|  32.0k|    int i, ret = 0;
  264|  32.0k|    BIGNUM *Ri, *R;
  265|       |
  266|  32.0k|    if (BN_is_zero(mod))
  ------------------
  |  Branch (266:9): [True: 0, False: 32.0k]
  ------------------
  267|      0|        return 0;
  268|       |
  269|  32.0k|    BN_CTX_start(ctx);
  270|  32.0k|    if ((Ri = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (270:9): [True: 0, False: 32.0k]
  ------------------
  271|      0|        goto err;
  272|  32.0k|    R = &(mont->RR);            /* grab RR as a temp */
  273|  32.0k|    if (!BN_copy(&(mont->N), mod))
  ------------------
  |  Branch (273:9): [True: 0, False: 32.0k]
  ------------------
  274|      0|        goto err;               /* Set N */
  275|  32.0k|    if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  32.0k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (275:9): [True: 0, False: 32.0k]
  ------------------
  276|      0|        BN_set_flags(&(mont->N), BN_FLG_CONSTTIME);
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  277|  32.0k|    mont->N.neg = 0;
  278|       |
  279|  32.0k|#ifdef MONT_WORD
  280|  32.0k|    {
  281|  32.0k|        BIGNUM tmod;
  282|  32.0k|        BN_ULONG buf[2];
  ------------------
  |  |   37|  32.0k|#  define BN_ULONG        unsigned long
  ------------------
  283|       |
  284|  32.0k|        bn_init(&tmod);
  285|  32.0k|        tmod.d = buf;
  286|  32.0k|        tmod.dmax = 2;
  287|  32.0k|        tmod.neg = 0;
  288|       |
  289|  32.0k|        if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  32.0k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (289:13): [True: 0, False: 32.0k]
  ------------------
  290|      0|            BN_set_flags(&tmod, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  291|       |
  292|  32.0k|        mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  32.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  32.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                      mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  32.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  32.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                      mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  32.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  32.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  293|       |
  294|       |# if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)
  295|       |        /*
  296|       |         * Only certain BN_BITS2<=32 platforms actually make use of n0[1],
  297|       |         * and we could use the #else case (with a shorter R value) for the
  298|       |         * others.  However, currently only the assembler files do know which
  299|       |         * is which.
  300|       |         */
  301|       |
  302|       |        BN_zero(R);
  303|       |        if (!(BN_set_bit(R, 2 * BN_BITS2)))
  304|       |            goto err;
  305|       |
  306|       |        tmod.top = 0;
  307|       |        if ((buf[0] = mod->d[0]))
  308|       |            tmod.top = 1;
  309|       |        if ((buf[1] = mod->top > 1 ? mod->d[1] : 0))
  310|       |            tmod.top = 2;
  311|       |
  312|       |        if (BN_is_one(&tmod))
  313|       |            BN_zero(Ri);
  314|       |        else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
  315|       |            goto err;
  316|       |        if (!BN_lshift(Ri, Ri, 2 * BN_BITS2))
  317|       |            goto err;           /* R*Ri */
  318|       |        if (!BN_is_zero(Ri)) {
  319|       |            if (!BN_sub_word(Ri, 1))
  320|       |                goto err;
  321|       |        } else {                /* if N mod word size == 1 */
  322|       |
  323|       |            if (bn_expand(Ri, (int)sizeof(BN_ULONG) * 2) == NULL)
  324|       |                goto err;
  325|       |            /* Ri-- (mod double word size) */
  326|       |            Ri->neg = 0;
  327|       |            Ri->d[0] = BN_MASK2;
  328|       |            Ri->d[1] = BN_MASK2;
  329|       |            Ri->top = 2;
  330|       |        }
  331|       |        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
  332|       |            goto err;
  333|       |        /*
  334|       |         * Ni = (R*Ri-1)/N, keep only couple of least significant words:
  335|       |         */
  336|       |        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;
  337|       |        mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0;
  338|       |# else
  339|  32.0k|        BN_zero(R);
  ------------------
  |  |  202|  32.0k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  340|  32.0k|        if (!(BN_set_bit(R, BN_BITS2)))
  ------------------
  |  |   54|  32.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  32.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (340:13): [True: 0, False: 32.0k]
  ------------------
  341|      0|            goto err;           /* R */
  342|       |
  343|  32.0k|        buf[0] = mod->d[0];     /* tmod = N mod word size */
  344|  32.0k|        buf[1] = 0;
  345|  32.0k|        tmod.top = buf[0] != 0 ? 1 : 0;
  ------------------
  |  Branch (345:20): [True: 32.0k, False: 10]
  ------------------
  346|       |        /* Ri = R^-1 mod N */
  347|  32.0k|        if (BN_is_one(&tmod))
  ------------------
  |  Branch (347:13): [True: 6.53k, False: 25.5k]
  ------------------
  348|  6.53k|            BN_zero(Ri);
  ------------------
  |  |  202|  6.53k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  349|  25.5k|        else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
  ------------------
  |  Branch (349:18): [True: 315, False: 25.2k]
  ------------------
  350|    315|            goto err;
  351|  31.7k|        if (!BN_lshift(Ri, Ri, BN_BITS2))
  ------------------
  |  |   54|  31.7k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  31.7k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (351:13): [True: 0, False: 31.7k]
  ------------------
  352|      0|            goto err;           /* R*Ri */
  353|  31.7k|        if (!BN_is_zero(Ri)) {
  ------------------
  |  Branch (353:13): [True: 25.2k, False: 6.53k]
  ------------------
  354|  25.2k|            if (!BN_sub_word(Ri, 1))
  ------------------
  |  Branch (354:17): [True: 0, False: 25.2k]
  ------------------
  355|      0|                goto err;
  356|  25.2k|        } else {                /* if N mod word size == 1 */
  357|       |
  358|  6.53k|            if (!BN_set_word(Ri, BN_MASK2))
  ------------------
  |  |   94|  6.53k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  |  Branch (358:17): [True: 0, False: 6.53k]
  ------------------
  359|      0|                goto err;       /* Ri-- (mod word size) */
  360|  6.53k|        }
  361|  31.7k|        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
  ------------------
  |  Branch (361:13): [True: 0, False: 31.7k]
  ------------------
  362|      0|            goto err;
  363|       |        /*
  364|       |         * Ni = (R*Ri-1)/N, keep only least significant word:
  365|       |         */
  366|  31.7k|        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;
  ------------------
  |  Branch (366:23): [True: 31.7k, False: 0]
  ------------------
  367|  31.7k|        mont->n0[1] = 0;
  368|  31.7k|# endif
  369|  31.7k|    }
  370|       |#else                           /* !MONT_WORD */
  371|       |    {                           /* bignum version */
  372|       |        mont->ri = BN_num_bits(&mont->N);
  373|       |        BN_zero(R);
  374|       |        if (!BN_set_bit(R, mont->ri))
  375|       |            goto err;           /* R = 2^ri */
  376|       |        /* Ri = R^-1 mod N */
  377|       |        if ((BN_mod_inverse(Ri, R, &mont->N, ctx)) == NULL)
  378|       |            goto err;
  379|       |        if (!BN_lshift(Ri, Ri, mont->ri))
  380|       |            goto err;           /* R*Ri */
  381|       |        if (!BN_sub_word(Ri, 1))
  382|       |            goto err;
  383|       |        /*
  384|       |         * Ni = (R*Ri-1) / N
  385|       |         */
  386|       |        if (!BN_div(&(mont->Ni), NULL, Ri, &mont->N, ctx))
  387|       |            goto err;
  388|       |    }
  389|       |#endif
  390|       |
  391|       |    /* setup RR for conversions */
  392|  31.7k|    BN_zero(&(mont->RR));
  ------------------
  |  |  202|  31.7k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  393|  31.7k|    if (!BN_set_bit(&(mont->RR), mont->ri * 2))
  ------------------
  |  Branch (393:9): [True: 0, False: 31.7k]
  ------------------
  394|      0|        goto err;
  395|  31.7k|    if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx))
  ------------------
  |  |  277|  31.7k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  |  Branch (395:9): [True: 0, False: 31.7k]
  ------------------
  396|      0|        goto err;
  397|       |
  398|  43.0k|    for (i = mont->RR.top, ret = mont->N.top; i < ret; i++)
  ------------------
  |  Branch (398:47): [True: 11.2k, False: 31.7k]
  ------------------
  399|  11.2k|        mont->RR.d[i] = 0;
  400|  31.7k|    mont->RR.top = ret;
  401|  31.7k|    mont->RR.flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  31.7k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  402|       |
  403|  31.7k|    ret = 1;
  404|  32.0k| err:
  405|  32.0k|    BN_CTX_end(ctx);
  406|  32.0k|    return ret;
  407|  31.7k|}
BN_MONT_CTX_copy:
  410|  19.4k|{
  411|  19.4k|    if (to == from)
  ------------------
  |  Branch (411:9): [True: 0, False: 19.4k]
  ------------------
  412|      0|        return to;
  413|       |
  414|  19.4k|    if (!BN_copy(&(to->RR), &(from->RR)))
  ------------------
  |  Branch (414:9): [True: 0, False: 19.4k]
  ------------------
  415|      0|        return NULL;
  416|  19.4k|    if (!BN_copy(&(to->N), &(from->N)))
  ------------------
  |  Branch (416:9): [True: 0, False: 19.4k]
  ------------------
  417|      0|        return NULL;
  418|  19.4k|    if (!BN_copy(&(to->Ni), &(from->Ni)))
  ------------------
  |  Branch (418:9): [True: 0, False: 19.4k]
  ------------------
  419|      0|        return NULL;
  420|  19.4k|    to->ri = from->ri;
  421|  19.4k|    to->n0[0] = from->n0[0];
  422|  19.4k|    to->n0[1] = from->n0[1];
  423|  19.4k|    return to;
  424|  19.4k|}
BN_MONT_CTX_set_locked:
  428|     27|{
  429|     27|    BN_MONT_CTX *ret;
  430|       |
  431|     27|    if (!CRYPTO_THREAD_read_lock(lock))
  ------------------
  |  Branch (431:9): [True: 0, False: 27]
  ------------------
  432|      0|        return NULL;
  433|     27|    ret = *pmont;
  434|     27|    CRYPTO_THREAD_unlock(lock);
  435|     27|    if (ret)
  ------------------
  |  Branch (435:9): [True: 0, False: 27]
  ------------------
  436|      0|        return ret;
  437|       |
  438|       |    /*
  439|       |     * We don't want to serialize globally while doing our lazy-init math in
  440|       |     * BN_MONT_CTX_set. That punishes threads that are doing independent
  441|       |     * things. Instead, punish the case where more than one thread tries to
  442|       |     * lazy-init the same 'pmont', by having each do the lazy-init math work
  443|       |     * independently and only use the one from the thread that wins the race
  444|       |     * (the losers throw away the work they've done).
  445|       |     */
  446|     27|    ret = BN_MONT_CTX_new();
  447|     27|    if (ret == NULL)
  ------------------
  |  Branch (447:9): [True: 0, False: 27]
  ------------------
  448|      0|        return NULL;
  449|     27|    if (!BN_MONT_CTX_set(ret, mod, ctx)) {
  ------------------
  |  Branch (449:9): [True: 2, False: 25]
  ------------------
  450|      2|        BN_MONT_CTX_free(ret);
  451|      2|        return NULL;
  452|      2|    }
  453|       |
  454|       |    /* The locked compare-and-set, after the local work is done. */
  455|     25|    if (!CRYPTO_THREAD_write_lock(lock)) {
  ------------------
  |  Branch (455:9): [True: 0, False: 25]
  ------------------
  456|      0|        BN_MONT_CTX_free(ret);
  457|      0|        return NULL;
  458|      0|    }
  459|       |
  460|     25|    if (*pmont) {
  ------------------
  |  Branch (460:9): [True: 0, False: 25]
  ------------------
  461|      0|        BN_MONT_CTX_free(ret);
  462|      0|        ret = *pmont;
  463|      0|    } else
  464|     25|        *pmont = ret;
  465|     25|    CRYPTO_THREAD_unlock(lock);
  466|     25|    return ret;
  467|     25|}
bn_mont.c:bn_from_montgomery_word:
   89|   592k|{
   90|   592k|    BIGNUM *n;
   91|   592k|    BN_ULONG *ap, *np, *rp, n0, v, carry;
  ------------------
  |  |   37|   592k|#  define BN_ULONG        unsigned long
  ------------------
   92|   592k|    int nl, max, i;
   93|   592k|    unsigned int rtop;
   94|       |
   95|   592k|    n = &(mont->N);
   96|   592k|    nl = n->top;
   97|   592k|    if (nl == 0) {
  ------------------
  |  Branch (97:9): [True: 0, False: 592k]
  ------------------
   98|      0|        ret->top = 0;
   99|      0|        return 1;
  100|      0|    }
  101|       |
  102|   592k|    max = (2 * nl);             /* carry is stored separately */
  103|   592k|    if (bn_wexpand(r, max) == NULL)
  ------------------
  |  Branch (103:9): [True: 0, False: 592k]
  ------------------
  104|      0|        return 0;
  105|       |
  106|   592k|    r->neg ^= n->neg;
  107|   592k|    np = n->d;
  108|   592k|    rp = r->d;
  109|       |
  110|       |    /* clear the top words of T */
  111|  5.14M|    for (rtop = r->top, i = 0; i < max; i++) {
  ------------------
  |  Branch (111:32): [True: 4.55M, False: 592k]
  ------------------
  112|  4.55M|        v = (BN_ULONG)0 - ((i - rtop) >> (8 * sizeof(rtop) - 1));
  113|  4.55M|        rp[i] &= v;
  114|  4.55M|    }
  115|       |
  116|   592k|    r->top = max;
  117|   592k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   592k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  118|   592k|    n0 = mont->n0[0];
  119|       |
  120|       |    /*
  121|       |     * Add multiples of |n| to |r| until R = 2^(nl * BN_BITS2) divides it. On
  122|       |     * input, we had |r| < |n| * R, so now |r| < 2 * |n| * R. Note that |r|
  123|       |     * includes |carry| which is stored separately.
  124|       |     */
  125|  2.87M|    for (carry = 0, i = 0; i < nl; i++, rp++) {
  ------------------
  |  Branch (125:28): [True: 2.27M, False: 592k]
  ------------------
  126|  2.27M|        v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
  ------------------
  |  |   94|  2.27M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  127|  2.27M|        v = (v + carry + rp[nl]) & BN_MASK2;
  ------------------
  |  |   94|  2.27M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  128|  2.27M|        carry |= (v != rp[nl]);
  129|  2.27M|        carry &= (v <= rp[nl]);
  130|  2.27M|        rp[nl] = v;
  131|  2.27M|    }
  132|       |
  133|   592k|    if (bn_wexpand(ret, nl) == NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 592k]
  ------------------
  134|      0|        return 0;
  135|   592k|    ret->top = nl;
  136|   592k|    ret->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   592k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  137|   592k|    ret->neg = r->neg;
  138|       |
  139|   592k|    rp = ret->d;
  140|       |
  141|       |    /*
  142|       |     * Shift |nl| words to divide by R. We have |ap| < 2 * |n|. Note that |ap|
  143|       |     * includes |carry| which is stored separately.
  144|       |     */
  145|   592k|    ap = &(r->d[nl]);
  146|       |
  147|   592k|    carry -= bn_sub_words(rp, ap, np, nl);
  148|       |    /*
  149|       |     * |carry| is -1 if |ap| - |np| underflowed or zero if it did not. Note
  150|       |     * |carry| cannot be 1. That would imply the subtraction did not fit in
  151|       |     * |nl| words, and we know at most one subtraction is needed.
  152|       |     */
  153|  2.87M|    for (i = 0; i < nl; i++) {
  ------------------
  |  Branch (153:17): [True: 2.27M, False: 592k]
  ------------------
  154|  2.27M|        rp[i] = (carry & ap[i]) | (~carry & rp[i]);
  155|  2.27M|        ap[i] = 0;
  156|  2.27M|    }
  157|       |
  158|   592k|    return 1;
  159|   592k|}

bn_sub_part_words:
   30|  11.9k|{
   31|  11.9k|    BN_ULONG c, t;
  ------------------
  |  |   37|  11.9k|#  define BN_ULONG        unsigned long
  ------------------
   32|       |
   33|  11.9k|    assert(cl >= 0);
   34|  11.9k|    c = bn_sub_words(r, a, b, cl);
   35|       |
   36|  11.9k|    if (dl == 0)
  ------------------
  |  Branch (36:9): [True: 9.65k, False: 2.27k]
  ------------------
   37|  9.65k|        return c;
   38|       |
   39|  2.27k|    r += cl;
   40|  2.27k|    a += cl;
   41|  2.27k|    b += cl;
   42|       |
   43|  2.27k|    if (dl < 0) {
  ------------------
  |  Branch (43:9): [True: 248, False: 2.02k]
  ------------------
   44|    540|        for (;;) {
   45|    540|            t = b[0];
   46|    540|            r[0] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|    540|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   47|    540|            if (t != 0)
  ------------------
  |  Branch (47:17): [True: 0, False: 540]
  ------------------
   48|      0|                c = 1;
   49|    540|            if (++dl >= 0)
  ------------------
  |  Branch (49:17): [True: 116, False: 424]
  ------------------
   50|    116|                break;
   51|       |
   52|    424|            t = b[1];
   53|    424|            r[1] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|    424|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   54|    424|            if (t != 0)
  ------------------
  |  Branch (54:17): [True: 0, False: 424]
  ------------------
   55|      0|                c = 1;
   56|    424|            if (++dl >= 0)
  ------------------
  |  Branch (56:17): [True: 36, False: 388]
  ------------------
   57|     36|                break;
   58|       |
   59|    388|            t = b[2];
   60|    388|            r[2] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|    388|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   61|    388|            if (t != 0)
  ------------------
  |  Branch (61:17): [True: 0, False: 388]
  ------------------
   62|      0|                c = 1;
   63|    388|            if (++dl >= 0)
  ------------------
  |  Branch (63:17): [True: 60, False: 328]
  ------------------
   64|     60|                break;
   65|       |
   66|    328|            t = b[3];
   67|    328|            r[3] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|    328|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   68|    328|            if (t != 0)
  ------------------
  |  Branch (68:17): [True: 0, False: 328]
  ------------------
   69|      0|                c = 1;
   70|    328|            if (++dl >= 0)
  ------------------
  |  Branch (70:17): [True: 36, False: 292]
  ------------------
   71|     36|                break;
   72|       |
   73|    292|            b += 4;
   74|    292|            r += 4;
   75|    292|        }
   76|  2.02k|    } else {
   77|  2.02k|        int save_dl = dl;
   78|  3.30k|        while (c) {
  ------------------
  |  Branch (78:16): [True: 1.55k, False: 1.74k]
  ------------------
   79|  1.55k|            t = a[0];
   80|  1.55k|            r[0] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  1.55k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   81|  1.55k|            if (t != 0)
  ------------------
  |  Branch (81:17): [True: 662, False: 897]
  ------------------
   82|    662|                c = 0;
   83|  1.55k|            if (--dl <= 0)
  ------------------
  |  Branch (83:17): [True: 176, False: 1.38k]
  ------------------
   84|    176|                break;
   85|       |
   86|  1.38k|            t = a[1];
   87|  1.38k|            r[1] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  1.38k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   88|  1.38k|            if (t != 0)
  ------------------
  |  Branch (88:17): [True: 509, False: 874]
  ------------------
   89|    509|                c = 0;
   90|  1.38k|            if (--dl <= 0)
  ------------------
  |  Branch (90:17): [True: 21, False: 1.36k]
  ------------------
   91|     21|                break;
   92|       |
   93|  1.36k|            t = a[2];
   94|  1.36k|            r[2] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  1.36k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   95|  1.36k|            if (t != 0)
  ------------------
  |  Branch (95:17): [True: 515, False: 847]
  ------------------
   96|    515|                c = 0;
   97|  1.36k|            if (--dl <= 0)
  ------------------
  |  Branch (97:17): [True: 45, False: 1.31k]
  ------------------
   98|     45|                break;
   99|       |
  100|  1.31k|            t = a[3];
  101|  1.31k|            r[3] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  1.31k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  102|  1.31k|            if (t != 0)
  ------------------
  |  Branch (102:17): [True: 493, False: 824]
  ------------------
  103|    493|                c = 0;
  104|  1.31k|            if (--dl <= 0)
  ------------------
  |  Branch (104:17): [True: 42, False: 1.27k]
  ------------------
  105|     42|                break;
  106|       |
  107|  1.27k|            save_dl = dl;
  108|  1.27k|            a += 4;
  109|  1.27k|            r += 4;
  110|  1.27k|        }
  111|  2.02k|        if (dl > 0) {
  ------------------
  |  Branch (111:13): [True: 1.74k, False: 284]
  ------------------
  112|  1.74k|            if (save_dl > dl) {
  ------------------
  |  Branch (112:17): [True: 0, False: 1.74k]
  ------------------
  113|      0|                switch (save_dl - dl) {
  ------------------
  |  Branch (113:25): [True: 0, False: 0]
  ------------------
  114|      0|                case 1:
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|      0|                    r[1] = a[1];
  116|      0|                    if (--dl <= 0)
  ------------------
  |  Branch (116:25): [True: 0, False: 0]
  ------------------
  117|      0|                        break;
  118|       |                    /* fall through */
  119|      0|                case 2:
  ------------------
  |  Branch (119:17): [True: 0, False: 0]
  ------------------
  120|      0|                    r[2] = a[2];
  121|      0|                    if (--dl <= 0)
  ------------------
  |  Branch (121:25): [True: 0, False: 0]
  ------------------
  122|      0|                        break;
  123|       |                    /* fall through */
  124|      0|                case 3:
  ------------------
  |  Branch (124:17): [True: 0, False: 0]
  ------------------
  125|      0|                    r[3] = a[3];
  126|      0|                    if (--dl <= 0)
  ------------------
  |  Branch (126:25): [True: 0, False: 0]
  ------------------
  127|      0|                        break;
  128|      0|                }
  129|      0|                a += 4;
  130|      0|                r += 4;
  131|      0|            }
  132|  1.74k|        }
  133|  2.02k|        if (dl > 0) {
  ------------------
  |  Branch (133:13): [True: 1.74k, False: 284]
  ------------------
  134|  5.54k|            for (;;) {
  135|  5.54k|                r[0] = a[0];
  136|  5.54k|                if (--dl <= 0)
  ------------------
  |  Branch (136:21): [True: 436, False: 5.11k]
  ------------------
  137|    436|                    break;
  138|  5.11k|                r[1] = a[1];
  139|  5.11k|                if (--dl <= 0)
  ------------------
  |  Branch (139:21): [True: 379, False: 4.73k]
  ------------------
  140|    379|                    break;
  141|  4.73k|                r[2] = a[2];
  142|  4.73k|                if (--dl <= 0)
  ------------------
  |  Branch (142:21): [True: 718, False: 4.01k]
  ------------------
  143|    718|                    break;
  144|  4.01k|                r[3] = a[3];
  145|  4.01k|                if (--dl <= 0)
  ------------------
  |  Branch (145:21): [True: 211, False: 3.80k]
  ------------------
  146|    211|                    break;
  147|       |
  148|  3.80k|                a += 4;
  149|  3.80k|                r += 4;
  150|  3.80k|            }
  151|  1.74k|        }
  152|  2.02k|    }
  153|  2.27k|    return c;
  154|  2.27k|}
bn_mul_recursive:
  177|  5.38k|{
  178|  5.38k|    int n = n2 / 2, c1, c2;
  179|  5.38k|    int tna = n + dna, tnb = n + dnb;
  180|  5.38k|    unsigned int neg, zero;
  181|  5.38k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|  5.38k|#  define BN_ULONG        unsigned long
  ------------------
  182|       |
  183|  5.38k|# ifdef BN_MUL_COMBA
  184|       |#  if 0
  185|       |    if (n2 == 4) {
  186|       |        bn_mul_comba4(r, a, b);
  187|       |        return;
  188|       |    }
  189|       |#  endif
  190|       |    /*
  191|       |     * Only call bn_mul_comba 8 if n2 == 8 and the two arrays are complete
  192|       |     * [steve]
  193|       |     */
  194|  5.38k|    if (n2 == 8 && dna == 0 && dnb == 0) {
  ------------------
  |  Branch (194:9): [True: 50, False: 5.33k]
  |  Branch (194:20): [True: 26, False: 24]
  |  Branch (194:32): [True: 22, False: 4]
  ------------------
  195|     22|        bn_mul_comba8(r, a, b);
  196|     22|        return;
  197|     22|    }
  198|  5.36k|# endif                         /* BN_MUL_COMBA */
  199|       |    /* Else do normal multiply */
  200|  5.36k|    if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  365|  5.36k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (200:9): [True: 28, False: 5.33k]
  ------------------
  201|     28|        bn_mul_normal(r, a, n2 + dna, b, n2 + dnb);
  202|     28|        if ((dna + dnb) < 0)
  ------------------
  |  Branch (202:13): [True: 28, False: 0]
  ------------------
  203|     28|            memset(&r[2 * n2 + dna + dnb], 0,
  204|     28|                   sizeof(BN_ULONG) * -(dna + dnb));
  205|     28|        return;
  206|     28|    }
  207|       |    /* r=(a[0]-a[1])*(b[1]-b[0]) */
  208|  5.33k|    c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
  209|  5.33k|    c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
  210|  5.33k|    zero = neg = 0;
  211|  5.33k|    switch (c1 * 3 + c2) {
  ------------------
  |  Branch (211:13): [True: 0, False: 5.33k]
  ------------------
  212|    965|    case -4:
  ------------------
  |  Branch (212:5): [True: 965, False: 4.36k]
  ------------------
  213|    965|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  214|    965|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  215|    965|        break;
  216|    108|    case -3:
  ------------------
  |  Branch (216:5): [True: 108, False: 5.22k]
  ------------------
  217|    108|        zero = 1;
  218|    108|        break;
  219|  1.06k|    case -2:
  ------------------
  |  Branch (219:5): [True: 1.06k, False: 4.26k]
  ------------------
  220|  1.06k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  221|  1.06k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); /* + */
  222|  1.06k|        neg = 1;
  223|  1.06k|        break;
  224|    134|    case -1:
  ------------------
  |  Branch (224:5): [True: 134, False: 5.20k]
  ------------------
  225|    204|    case 0:
  ------------------
  |  Branch (225:5): [True: 70, False: 5.26k]
  ------------------
  226|    298|    case 1:
  ------------------
  |  Branch (226:5): [True: 94, False: 5.24k]
  ------------------
  227|    298|        zero = 1;
  228|    298|        break;
  229|  1.50k|    case 2:
  ------------------
  |  Branch (229:5): [True: 1.50k, False: 3.82k]
  ------------------
  230|  1.50k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna); /* + */
  231|  1.50k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  232|  1.50k|        neg = 1;
  233|  1.50k|        break;
  234|     88|    case 3:
  ------------------
  |  Branch (234:5): [True: 88, False: 5.24k]
  ------------------
  235|     88|        zero = 1;
  236|     88|        break;
  237|  1.30k|    case 4:
  ------------------
  |  Branch (237:5): [True: 1.30k, False: 4.03k]
  ------------------
  238|  1.30k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna);
  239|  1.30k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n);
  240|  1.30k|        break;
  241|  5.33k|    }
  242|       |
  243|  5.33k|# ifdef BN_MUL_COMBA
  244|  5.33k|    if (n == 4 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba4 could take
  ------------------
  |  Branch (244:9): [True: 0, False: 5.33k]
  |  Branch (244:19): [True: 0, False: 0]
  |  Branch (244:31): [True: 0, False: 0]
  ------------------
  245|       |                                           * extra args to do this well */
  246|      0|        if (!zero)
  ------------------
  |  Branch (246:13): [True: 0, False: 0]
  ------------------
  247|      0|            bn_mul_comba4(&(t[n2]), t, &(t[n]));
  248|      0|        else
  249|      0|            memset(&t[n2], 0, sizeof(*t) * 8);
  250|       |
  251|      0|        bn_mul_comba4(r, a, b);
  252|      0|        bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n]));
  253|  5.33k|    } else if (n == 8 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba8 could
  ------------------
  |  Branch (253:16): [True: 4.18k, False: 1.14k]
  |  Branch (253:26): [True: 4.17k, False: 8]
  |  Branch (253:38): [True: 4.17k, False: 2]
  ------------------
  254|       |                                                  * take extra args to do
  255|       |                                                  * this well */
  256|  4.17k|        if (!zero)
  ------------------
  |  Branch (256:13): [True: 3.74k, False: 432]
  ------------------
  257|  3.74k|            bn_mul_comba8(&(t[n2]), t, &(t[n]));
  258|    432|        else
  259|    432|            memset(&t[n2], 0, sizeof(*t) * 16);
  260|       |
  261|  4.17k|        bn_mul_comba8(r, a, b);
  262|  4.17k|        bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n]));
  263|  4.17k|    } else
  264|  1.15k|# endif                         /* BN_MUL_COMBA */
  265|  1.15k|    {
  266|  1.15k|        p = &(t[n2 * 2]);
  267|  1.15k|        if (!zero)
  ------------------
  |  Branch (267:13): [True: 1.09k, False: 62]
  ------------------
  268|  1.09k|            bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
  269|     62|        else
  270|     62|            memset(&t[n2], 0, sizeof(*t) * n2);
  271|  1.15k|        bn_mul_recursive(r, a, b, n, 0, 0, p);
  272|  1.15k|        bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p);
  273|  1.15k|    }
  274|       |
  275|       |    /*-
  276|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
  277|       |     * r[10] holds (a[0]*b[0])
  278|       |     * r[32] holds (b[1]*b[1])
  279|       |     */
  280|       |
  281|  5.33k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  282|       |
  283|  5.33k|    if (neg) {                  /* if t[32] is negative */
  ------------------
  |  Branch (283:9): [True: 2.57k, False: 2.76k]
  ------------------
  284|  2.57k|        c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  285|  2.76k|    } else {
  286|       |        /* Might have a carry */
  287|  2.76k|        c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
  288|  2.76k|    }
  289|       |
  290|       |    /*-
  291|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
  292|       |     * r[10] holds (a[0]*b[0])
  293|       |     * r[32] holds (b[1]*b[1])
  294|       |     * c1 holds the carry bits
  295|       |     */
  296|  5.33k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  297|  5.33k|    if (c1) {
  ------------------
  |  Branch (297:9): [True: 1.22k, False: 4.10k]
  ------------------
  298|  1.22k|        p = &(r[n + n2]);
  299|  1.22k|        lo = *p;
  300|  1.22k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|  1.22k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  301|  1.22k|        *p = ln;
  302|       |
  303|       |        /*
  304|       |         * The overflow will stop before we over write words we should not
  305|       |         * overwrite
  306|       |         */
  307|  1.22k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (307:13): [True: 87, False: 1.13k]
  ------------------
  308|    307|            do {
  309|    307|                p++;
  310|    307|                lo = *p;
  311|    307|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|    307|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  312|    307|                *p = ln;
  313|    307|            } while (ln == 0);
  ------------------
  |  Branch (313:22): [True: 220, False: 87]
  ------------------
  314|     87|        }
  315|  1.22k|    }
  316|  5.33k|}
bn_mul_part_recursive:
  324|  1.12k|{
  325|  1.12k|    int i, j, n2 = n * 2;
  326|  1.12k|    int c1, c2, neg;
  327|  1.12k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|  1.12k|#  define BN_ULONG        unsigned long
  ------------------
  328|       |
  329|  1.12k|    if (n < 8) {
  ------------------
  |  Branch (329:9): [True: 0, False: 1.12k]
  ------------------
  330|      0|        bn_mul_normal(r, a, n + tna, b, n + tnb);
  331|      0|        return;
  332|      0|    }
  333|       |
  334|       |    /* r=(a[0]-a[1])*(b[1]-b[0]) */
  335|  1.12k|    c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
  336|  1.12k|    c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
  337|  1.12k|    neg = 0;
  338|  1.12k|    switch (c1 * 3 + c2) {
  ------------------
  |  Branch (338:13): [True: 0, False: 1.12k]
  ------------------
  339|     87|    case -4:
  ------------------
  |  Branch (339:5): [True: 87, False: 1.04k]
  ------------------
  340|     87|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  341|     87|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  342|     87|        break;
  343|      6|    case -3:
  ------------------
  |  Branch (343:5): [True: 6, False: 1.12k]
  ------------------
  344|     41|    case -2:
  ------------------
  |  Branch (344:5): [True: 35, False: 1.09k]
  ------------------
  345|     41|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  346|     41|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); /* + */
  347|     41|        neg = 1;
  348|     41|        break;
  349|      7|    case -1:
  ------------------
  |  Branch (349:5): [True: 7, False: 1.12k]
  ------------------
  350|     13|    case 0:
  ------------------
  |  Branch (350:5): [True: 6, False: 1.12k]
  ------------------
  351|     20|    case 1:
  ------------------
  |  Branch (351:5): [True: 7, False: 1.12k]
  ------------------
  352|    928|    case 2:
  ------------------
  |  Branch (352:5): [True: 908, False: 219]
  ------------------
  353|    928|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna); /* + */
  354|    928|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  355|    928|        neg = 1;
  356|    928|        break;
  357|     12|    case 3:
  ------------------
  |  Branch (357:5): [True: 12, False: 1.11k]
  ------------------
  358|     71|    case 4:
  ------------------
  |  Branch (358:5): [True: 59, False: 1.06k]
  ------------------
  359|     71|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna);
  360|     71|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n);
  361|     71|        break;
  362|  1.12k|    }
  363|       |    /*
  364|       |     * The zero case isn't yet implemented here. The speedup would probably
  365|       |     * be negligible.
  366|       |     */
  367|       |# if 0
  368|       |    if (n == 4) {
  369|       |        bn_mul_comba4(&(t[n2]), t, &(t[n]));
  370|       |        bn_mul_comba4(r, a, b);
  371|       |        bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
  372|       |        memset(&r[n2 + tn * 2], 0, sizeof(*r) * (n2 - tn * 2));
  373|       |    } else
  374|       |# endif
  375|  1.12k|    if (n == 8) {
  ------------------
  |  Branch (375:9): [True: 158, False: 969]
  ------------------
  376|    158|        bn_mul_comba8(&(t[n2]), t, &(t[n]));
  377|    158|        bn_mul_comba8(r, a, b);
  378|    158|        bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
  379|    158|        memset(&r[n2 + tna + tnb], 0, sizeof(*r) * (n2 - tna - tnb));
  380|    969|    } else {
  381|    969|        p = &(t[n2 * 2]);
  382|    969|        bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
  383|    969|        bn_mul_recursive(r, a, b, n, 0, 0, p);
  384|    969|        i = n / 2;
  385|       |        /*
  386|       |         * If there is only a bottom half to the number, just do it
  387|       |         */
  388|    969|        if (tna > tnb)
  ------------------
  |  Branch (388:13): [True: 78, False: 891]
  ------------------
  389|     78|            j = tna - i;
  390|    891|        else
  391|    891|            j = tnb - i;
  392|    969|        if (j == 0) {
  ------------------
  |  Branch (392:13): [True: 26, False: 943]
  ------------------
  393|     26|            bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]),
  394|     26|                             i, tna - i, tnb - i, p);
  395|     26|            memset(&r[n2 + i * 2], 0, sizeof(*r) * (n2 - i * 2));
  396|    943|        } else if (j > 0) {     /* eg, n == 16, i == 8 and tn == 11 */
  ------------------
  |  Branch (396:20): [True: 418, False: 525]
  ------------------
  397|    418|            bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]),
  398|    418|                                  i, tna - i, tnb - i, p);
  399|    418|            memset(&(r[n2 + tna + tnb]), 0,
  400|    418|                   sizeof(BN_ULONG) * (n2 - tna - tnb));
  401|    525|        } else {                /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
  402|       |
  403|    525|            memset(&r[n2], 0, sizeof(*r) * n2);
  404|    525|            if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
  ------------------
  |  |  365|  1.05k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (404:17): [True: 525, False: 0]
  ------------------
  405|    525|                && tnb < BN_MUL_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  365|    525|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (405:20): [True: 525, False: 0]
  ------------------
  406|    525|                bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
  407|    525|            } else {
  408|      0|                for (;;) {
  409|      0|                    i /= 2;
  410|       |                    /*
  411|       |                     * these simplified conditions work exclusively because
  412|       |                     * difference between tna and tnb is 1 or 0
  413|       |                     */
  414|      0|                    if (i < tna || i < tnb) {
  ------------------
  |  Branch (414:25): [True: 0, False: 0]
  |  Branch (414:36): [True: 0, False: 0]
  ------------------
  415|      0|                        bn_mul_part_recursive(&(r[n2]),
  416|      0|                                              &(a[n]), &(b[n]),
  417|      0|                                              i, tna - i, tnb - i, p);
  418|      0|                        break;
  419|      0|                    } else if (i == tna || i == tnb) {
  ------------------
  |  Branch (419:32): [True: 0, False: 0]
  |  Branch (419:44): [True: 0, False: 0]
  ------------------
  420|      0|                        bn_mul_recursive(&(r[n2]),
  421|      0|                                         &(a[n]), &(b[n]),
  422|      0|                                         i, tna - i, tnb - i, p);
  423|      0|                        break;
  424|      0|                    }
  425|      0|                }
  426|      0|            }
  427|    525|        }
  428|    969|    }
  429|       |
  430|       |    /*-
  431|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
  432|       |     * r[10] holds (a[0]*b[0])
  433|       |     * r[32] holds (b[1]*b[1])
  434|       |     */
  435|       |
  436|  1.12k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  437|       |
  438|  1.12k|    if (neg) {                  /* if t[32] is negative */
  ------------------
  |  Branch (438:9): [True: 969, False: 158]
  ------------------
  439|    969|        c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  440|    969|    } else {
  441|       |        /* Might have a carry */
  442|    158|        c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
  443|    158|    }
  444|       |
  445|       |    /*-
  446|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
  447|       |     * r[10] holds (a[0]*b[0])
  448|       |     * r[32] holds (b[1]*b[1])
  449|       |     * c1 holds the carry bits
  450|       |     */
  451|  1.12k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  452|  1.12k|    if (c1) {
  ------------------
  |  Branch (452:9): [True: 102, False: 1.02k]
  ------------------
  453|    102|        p = &(r[n + n2]);
  454|    102|        lo = *p;
  455|    102|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|    102|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  456|    102|        *p = ln;
  457|       |
  458|       |        /*
  459|       |         * The overflow will stop before we over write words we should not
  460|       |         * overwrite
  461|       |         */
  462|    102|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (462:13): [True: 22, False: 80]
  ------------------
  463|    120|            do {
  464|    120|                p++;
  465|    120|                lo = *p;
  466|    120|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|    120|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  467|    120|                *p = ln;
  468|    120|            } while (ln == 0);
  ------------------
  |  Branch (468:22): [True: 98, False: 22]
  ------------------
  469|     22|        }
  470|    102|    }
  471|  1.12k|}
BN_mul:
  498|   200k|{
  499|   200k|    int ret = bn_mul_fixed_top(r, a, b, ctx);
  500|       |
  501|   200k|    bn_correct_top(r);
  502|   200k|    bn_check_top(r);
  503|       |
  504|   200k|    return ret;
  505|   200k|}
bn_mul_fixed_top:
  508|   745k|{
  509|   745k|    int ret = 0;
  510|   745k|    int top, al, bl;
  511|   745k|    BIGNUM *rr;
  512|   745k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  513|   745k|    int i;
  514|   745k|#endif
  515|   745k|#ifdef BN_RECURSION
  516|   745k|    BIGNUM *t = NULL;
  517|   745k|    int j = 0, k;
  518|   745k|#endif
  519|       |
  520|   745k|    bn_check_top(a);
  521|   745k|    bn_check_top(b);
  522|   745k|    bn_check_top(r);
  523|       |
  524|   745k|    al = a->top;
  525|   745k|    bl = b->top;
  526|       |
  527|   745k|    if ((al == 0) || (bl == 0)) {
  ------------------
  |  Branch (527:9): [True: 298k, False: 447k]
  |  Branch (527:22): [True: 160k, False: 287k]
  ------------------
  528|   458k|        BN_zero(r);
  ------------------
  |  |  202|   458k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  529|   458k|        return 1;
  530|   458k|    }
  531|   287k|    top = al + bl;
  532|       |
  533|   287k|    BN_CTX_start(ctx);
  534|   287k|    if ((r == a) || (r == b)) {
  ------------------
  |  Branch (534:9): [True: 7.91k, False: 279k]
  |  Branch (534:21): [True: 0, False: 279k]
  ------------------
  535|  7.91k|        if ((rr = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (535:13): [True: 0, False: 7.91k]
  ------------------
  536|      0|            goto err;
  537|  7.91k|    } else
  538|   279k|        rr = r;
  539|       |
  540|   287k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  541|   287k|    i = al - bl;
  542|   287k|#endif
  543|   287k|#ifdef BN_MUL_COMBA
  544|   287k|    if (i == 0) {
  ------------------
  |  Branch (544:9): [True: 177k, False: 109k]
  ------------------
  545|       |# if 0
  546|       |        if (al == 4) {
  547|       |            if (bn_wexpand(rr, 8) == NULL)
  548|       |                goto err;
  549|       |            rr->top = 8;
  550|       |            bn_mul_comba4(rr->d, a->d, b->d);
  551|       |            goto end;
  552|       |        }
  553|       |# endif
  554|   177k|        if (al == 8) {
  ------------------
  |  Branch (554:13): [True: 67, False: 177k]
  ------------------
  555|     67|            if (bn_wexpand(rr, 16) == NULL)
  ------------------
  |  Branch (555:17): [True: 0, False: 67]
  ------------------
  556|      0|                goto err;
  557|     67|            rr->top = 16;
  558|     67|            bn_mul_comba8(rr->d, a->d, b->d);
  559|     67|            goto end;
  560|     67|        }
  561|   177k|    }
  562|   287k|#endif                          /* BN_MUL_COMBA */
  563|   287k|#ifdef BN_RECURSION
  564|   287k|    if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
  ------------------
  |  |  364|   287k|# define BN_MULL_SIZE_NORMAL                     (16)/* 32 */
  ------------------
                  if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
  ------------------
  |  |  364|  18.2k|# define BN_MULL_SIZE_NORMAL                     (16)/* 32 */
  ------------------
  |  Branch (564:9): [True: 18.2k, False: 269k]
  |  Branch (564:40): [True: 3.26k, False: 15.0k]
  ------------------
  565|  3.26k|        if (i >= -1 && i <= 1) {
  ------------------
  |  Branch (565:13): [True: 3.23k, False: 37]
  |  Branch (565:24): [True: 717, False: 2.51k]
  ------------------
  566|       |            /*
  567|       |             * Find out the power of two lower or equal to the longest of the
  568|       |             * two numbers
  569|       |             */
  570|    717|            if (i >= 0) {
  ------------------
  |  Branch (570:17): [True: 282, False: 435]
  ------------------
  571|    282|                j = BN_num_bits_word((BN_ULONG)al);
  572|    282|            }
  573|    717|            if (i == -1) {
  ------------------
  |  Branch (573:17): [True: 435, False: 282]
  ------------------
  574|    435|                j = BN_num_bits_word((BN_ULONG)bl);
  575|    435|            }
  576|    717|            j = 1 << (j - 1);
  577|    717|            assert(j <= al || j <= bl);
  578|    717|            k = j + j;
  579|    717|            t = BN_CTX_get(ctx);
  580|    717|            if (t == NULL)
  ------------------
  |  Branch (580:17): [True: 0, False: 717]
  ------------------
  581|      0|                goto err;
  582|    717|            if (al > j || bl > j) {
  ------------------
  |  Branch (582:17): [True: 706, False: 11]
  |  Branch (582:27): [True: 3, False: 8]
  ------------------
  583|    709|                if (bn_wexpand(t, k * 4) == NULL)
  ------------------
  |  Branch (583:21): [True: 0, False: 709]
  ------------------
  584|      0|                    goto err;
  585|    709|                if (bn_wexpand(rr, k * 4) == NULL)
  ------------------
  |  Branch (585:21): [True: 0, False: 709]
  ------------------
  586|      0|                    goto err;
  587|    709|                bn_mul_part_recursive(rr->d, a->d, b->d,
  588|    709|                                      j, al - j, bl - j, t->d);
  589|    709|            } else {            /* al <= j || bl <= j */
  590|       |
  591|      8|                if (bn_wexpand(t, k * 2) == NULL)
  ------------------
  |  Branch (591:21): [True: 0, False: 8]
  ------------------
  592|      0|                    goto err;
  593|      8|                if (bn_wexpand(rr, k * 2) == NULL)
  ------------------
  |  Branch (593:21): [True: 0, False: 8]
  ------------------
  594|      0|                    goto err;
  595|      8|                bn_mul_recursive(rr->d, a->d, b->d, j, al - j, bl - j, t->d);
  596|      8|            }
  597|    717|            rr->top = top;
  598|    717|            goto end;
  599|    717|        }
  600|  3.26k|    }
  601|   286k|#endif                          /* BN_RECURSION */
  602|   286k|    if (bn_wexpand(rr, top) == NULL)
  ------------------
  |  Branch (602:9): [True: 0, False: 286k]
  ------------------
  603|      0|        goto err;
  604|   286k|    rr->top = top;
  605|   286k|    bn_mul_normal(rr->d, a->d, al, b->d, bl);
  606|       |
  607|   286k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  608|   287k| end:
  609|   287k|#endif
  610|   287k|    rr->neg = a->neg ^ b->neg;
  611|   287k|    rr->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   287k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  612|   287k|    if (r != rr && BN_copy(r, rr) == NULL)
  ------------------
  |  Branch (612:9): [True: 7.91k, False: 279k]
  |  Branch (612:20): [True: 0, False: 7.91k]
  ------------------
  613|      0|        goto err;
  614|       |
  615|   287k|    ret = 1;
  616|   287k| err:
  617|   287k|    bn_check_top(r);
  618|   287k|    BN_CTX_end(ctx);
  619|   287k|    return ret;
  620|   287k|}
bn_mul_normal:
  623|   287k|{
  624|   287k|    BN_ULONG *rr;
  ------------------
  |  |   37|   287k|#  define BN_ULONG        unsigned long
  ------------------
  625|       |
  626|   287k|    if (na < nb) {
  ------------------
  |  Branch (626:9): [True: 57.8k, False: 229k]
  ------------------
  627|  57.8k|        int itmp;
  628|  57.8k|        BN_ULONG *ltmp;
  ------------------
  |  |   37|  57.8k|#  define BN_ULONG        unsigned long
  ------------------
  629|       |
  630|  57.8k|        itmp = na;
  631|  57.8k|        na = nb;
  632|  57.8k|        nb = itmp;
  633|  57.8k|        ltmp = a;
  634|  57.8k|        a = b;
  635|  57.8k|        b = ltmp;
  636|       |
  637|  57.8k|    }
  638|   287k|    rr = &(r[na]);
  639|   287k|    if (nb <= 0) {
  ------------------
  |  Branch (639:9): [True: 27, False: 287k]
  ------------------
  640|     27|        (void)bn_mul_words(r, a, na, 0);
  641|     27|        return;
  642|     27|    } else
  643|   287k|        rr[0] = bn_mul_words(r, a, na, b[0]);
  644|       |
  645|   340k|    for (;;) {
  646|   340k|        if (--nb <= 0)
  ------------------
  |  Branch (646:13): [True: 86.9k, False: 253k]
  ------------------
  647|  86.9k|            return;
  648|   253k|        rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]);
  649|   253k|        if (--nb <= 0)
  ------------------
  |  Branch (649:13): [True: 25.4k, False: 227k]
  ------------------
  650|  25.4k|            return;
  651|   227k|        rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]);
  652|   227k|        if (--nb <= 0)
  ------------------
  |  Branch (652:13): [True: 3.91k, False: 224k]
  ------------------
  653|  3.91k|            return;
  654|   224k|        rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]);
  655|   224k|        if (--nb <= 0)
  ------------------
  |  Branch (655:13): [True: 171k, False: 52.9k]
  ------------------
  656|   171k|            return;
  657|  52.9k|        rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
  658|  52.9k|        rr += 4;
  659|  52.9k|        r += 4;
  660|  52.9k|        b += 4;
  661|  52.9k|    }
  662|   287k|}

BN_nist_mod_224:
  467|  13.3k|{
  468|  13.3k|    int top = a->top, i;
  469|  13.3k|    int carry;
  470|  13.3k|    BN_ULONG *r_d, *a_d = a->d;
  ------------------
  |  |   37|  13.3k|#  define BN_ULONG        unsigned long
  ------------------
  471|  13.3k|    union {
  472|  13.3k|        BN_ULONG bn[BN_NIST_224_TOP];
  473|  13.3k|        unsigned int ui[BN_NIST_224_TOP * sizeof(BN_ULONG) /
  474|  13.3k|                        sizeof(unsigned int)];
  475|  13.3k|    } buf;
  476|  13.3k|    BN_ULONG c_d[BN_NIST_224_TOP], *res;
  ------------------
  |  |   37|  13.3k|#  define BN_ULONG        unsigned long
  ------------------
  477|  13.3k|    bn_addsub_f adjust;
  478|  13.3k|    static const BIGNUM ossl_bignum_nist_p_224_sqr = {
  479|  13.3k|        (BN_ULONG *)_nist_p_224_sqr,
  480|  13.3k|        OSSL_NELEM(_nist_p_224_sqr),
  ------------------
  |  |   14|  13.3k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  481|  13.3k|        OSSL_NELEM(_nist_p_224_sqr),
  ------------------
  |  |   14|  13.3k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  482|  13.3k|        0, BN_FLG_STATIC_DATA
  ------------------
  |  |   59|  13.3k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  483|  13.3k|    };
  484|       |
  485|  13.3k|    field = &ossl_bignum_nist_p_224; /* just to make sure */
  486|       |
  487|  13.3k|    if (BN_is_negative(a) || BN_ucmp(a, &ossl_bignum_nist_p_224_sqr) >= 0)
  ------------------
  |  Branch (487:9): [True: 0, False: 13.3k]
  |  Branch (487:30): [True: 0, False: 13.3k]
  ------------------
  488|      0|        return BN_nnmod(r, a, field, ctx);
  489|       |
  490|  13.3k|    i = BN_ucmp(field, a);
  491|  13.3k|    if (i == 0) {
  ------------------
  |  Branch (491:9): [True: 0, False: 13.3k]
  ------------------
  492|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  493|      0|        return 1;
  494|  13.3k|    } else if (i > 0)
  ------------------
  |  Branch (494:16): [True: 144, False: 13.1k]
  ------------------
  495|    144|        return (r == a) ? 1 : (BN_copy(r, a) != NULL);
  ------------------
  |  Branch (495:16): [True: 144, False: 0]
  ------------------
  496|       |
  497|  13.1k|    if (r != a) {
  ------------------
  |  Branch (497:9): [True: 0, False: 13.1k]
  ------------------
  498|      0|        if (!bn_wexpand(r, BN_NIST_224_TOP))
  ------------------
  |  |   14|      0|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (498:13): [True: 0, False: 0]
  ------------------
  499|      0|            return 0;
  500|      0|        r_d = r->d;
  501|      0|        nist_cp_bn(r_d, a_d, BN_NIST_224_TOP);
  ------------------
  |  |   14|      0|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  502|      0|    } else
  503|  13.1k|        r_d = a_d;
  504|       |
  505|  13.1k|#if BN_BITS2==64
  506|       |    /* copy upper 256 bits of 448 bit number ... */
  507|  13.1k|    nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP - 1),
  ------------------
  |  |  265|  13.1k|#define nist_cp_bn_0(dst, src_in, top, max) \
  |  |  266|  13.1k|{                                           \
  |  |  267|  13.1k|    int ii;                                 \
  |  |  268|  13.1k|    const BN_ULONG *src = src_in;           \
  |  |  269|  13.1k|                                            \
  |  |  270|  65.8k|    for (ii = 0; ii < top; ii++)            \
  |  |  ------------------
  |  |  |  Branch (270:18): [True: 52.6k, False: 13.1k]
  |  |  ------------------
  |  |  271|  52.6k|        (dst)[ii] = src[ii];                \
  |  |  272|  13.3k|    for (; ii < max; ii++)                  \
  |  |  ------------------
  |  |  |  Branch (272:12): [True: 123, False: 13.1k]
  |  |  ------------------
  |  |  273|  13.1k|        (dst)[ii] = 0;                      \
  |  |  274|  13.1k|}
  ------------------
  508|  13.1k|                 top - (BN_NIST_224_TOP - 1), BN_NIST_224_TOP);
  509|       |    /* ... and right shift by 32 to obtain upper 224 bits */
  510|  13.1k|    nist_set_224(buf.bn, c_d, 14, 13, 12, 11, 10, 9, 8);
  ------------------
  |  |  455|  13.1k|        { \
  |  |  456|  13.1k|        bn_cp_32(to, 0, from, (a7) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  13.1k|        bn_cp_32(to, 1, from, (a6) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  13.1k|        bn_cp_32(to, 2, from, (a5) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|  13.1k|        bn_cp_32(to, 3, from, (a4) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  13.1k|        bn_cp_32(to, 4, from, (a3) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  13.1k|        bn_cp_32(to, 5, from, (a2) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  13.1k|        bn_cp_32(to, 6, from, (a1) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  13.1k|        }
  ------------------
  511|       |    /* truncate lower part to 224 bits too */
  512|  13.1k|    r_d[BN_NIST_224_TOP - 1] &= BN_MASK2l;
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  r_d[BN_NIST_224_TOP - 1] &= BN_MASK2l;
  ------------------
  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  ------------------
  513|       |#else
  514|       |    nist_cp_bn_0(buf.bn, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP,
  515|       |                 BN_NIST_224_TOP);
  516|       |#endif
  517|       |
  518|       |#if defined(NIST_INT64) && BN_BITS2!=64
  519|       |    {
  520|       |        NIST_INT64 acc;         /* accumulator */
  521|       |        unsigned int *rp = (unsigned int *)r_d;
  522|       |        const unsigned int *bp = (const unsigned int *)buf.ui;
  523|       |
  524|       |        acc = rp[0];
  525|       |        acc -= bp[7 - 7];
  526|       |        acc -= bp[11 - 7];
  527|       |        rp[0] = (unsigned int)acc;
  528|       |        acc >>= 32;
  529|       |
  530|       |        acc += rp[1];
  531|       |        acc -= bp[8 - 7];
  532|       |        acc -= bp[12 - 7];
  533|       |        rp[1] = (unsigned int)acc;
  534|       |        acc >>= 32;
  535|       |
  536|       |        acc += rp[2];
  537|       |        acc -= bp[9 - 7];
  538|       |        acc -= bp[13 - 7];
  539|       |        rp[2] = (unsigned int)acc;
  540|       |        acc >>= 32;
  541|       |
  542|       |        acc += rp[3];
  543|       |        acc += bp[7 - 7];
  544|       |        acc += bp[11 - 7];
  545|       |        acc -= bp[10 - 7];
  546|       |        rp[3] = (unsigned int)acc;
  547|       |        acc >>= 32;
  548|       |
  549|       |        acc += rp[4];
  550|       |        acc += bp[8 - 7];
  551|       |        acc += bp[12 - 7];
  552|       |        acc -= bp[11 - 7];
  553|       |        rp[4] = (unsigned int)acc;
  554|       |        acc >>= 32;
  555|       |
  556|       |        acc += rp[5];
  557|       |        acc += bp[9 - 7];
  558|       |        acc += bp[13 - 7];
  559|       |        acc -= bp[12 - 7];
  560|       |        rp[5] = (unsigned int)acc;
  561|       |        acc >>= 32;
  562|       |
  563|       |        acc += rp[6];
  564|       |        acc += bp[10 - 7];
  565|       |        acc -= bp[13 - 7];
  566|       |        rp[6] = (unsigned int)acc;
  567|       |
  568|       |        carry = (int)(acc >> 32);
  569|       |# if BN_BITS2==64
  570|       |        rp[7] = carry;
  571|       |# endif
  572|       |    }
  573|       |#else
  574|  13.1k|    {
  575|  13.1k|        BN_ULONG t_d[BN_NIST_224_TOP];
  ------------------
  |  |   37|  13.1k|#  define BN_ULONG        unsigned long
  ------------------
  576|       |
  577|  13.1k|        nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0);
  ------------------
  |  |  455|  13.1k|        { \
  |  |  456|  13.1k|        bn_cp_32(to, 0, from, (a7) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  13.1k|        bn_cp_32(to, 1, from, (a6) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  13.1k|        bn_cp_32(to, 2, from, (a5) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|  13.1k|        bn_cp_32(to, 3, from, (a4) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  13.1k|        bn_cp_32(to, 4, from, (a3) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  13.1k|        bn_cp_32(to, 5, from, (a2) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  13.1k|        bn_cp_32(to, 6, from, (a1) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  13.1k|        }
  ------------------
  578|  13.1k|        carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  579|  13.1k|        nist_set_224(t_d, buf.bn, 0, 13, 12, 11, 0, 0, 0);
  ------------------
  |  |  455|  13.1k|        { \
  |  |  456|  13.1k|        bn_cp_32(to, 0, from, (a7) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  13.1k|        bn_cp_32(to, 1, from, (a6) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  13.1k|        bn_cp_32(to, 2, from, (a5) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|  13.1k|        bn_cp_32(to, 3, from, (a4) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  13.1k|        bn_cp_32(to, 4, from, (a3) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  13.1k|        bn_cp_32(to, 5, from, (a2) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  13.1k|        bn_cp_32(to, 6, from, (a1) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  13.1k|        }
  ------------------
  580|  13.1k|        carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  581|  13.1k|        nist_set_224(t_d, buf.bn, 13, 12, 11, 10, 9, 8, 7);
  ------------------
  |  |  455|  13.1k|        { \
  |  |  456|  13.1k|        bn_cp_32(to, 0, from, (a7) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  13.1k|        bn_cp_32(to, 1, from, (a6) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  13.1k|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  13.1k|        bn_cp_32(to, 2, from, (a5) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|  13.1k|        bn_cp_32(to, 3, from, (a4) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  13.1k|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  13.1k|        bn_cp_32(to, 4, from, (a3) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  13.1k|        bn_cp_32(to, 5, from, (a2) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  13.1k|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  13.1k|        bn_cp_32(to, 6, from, (a1) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  13.1k|        }
  ------------------
  582|  13.1k|        carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  583|  13.1k|        nist_set_224(t_d, buf.bn, 0, 0, 0, 0, 13, 12, 11);
  ------------------
  |  |  455|  13.1k|        { \
  |  |  456|  13.1k|        bn_cp_32(to, 0, from, (a7) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  13.1k|        bn_cp_32(to, 1, from, (a6) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  13.1k|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  13.1k|        bn_cp_32(to, 2, from, (a5) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|  13.1k|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|  13.1k|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|      0|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|  13.1k|        bn_cp_32(to, 3, from, (a4) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  13.1k|        bn_cp_32(to, 4, from, (a3) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  13.1k|        bn_cp_32(to, 5, from, (a2) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.1k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  13.1k|        bn_cp_32(to, 6, from, (a1) - 7) \
  |  |  ------------------
  |  |  |  |  294|  13.1k|# define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  291|      0|# define bn_cp_32_naked(to, n, from, m)  (((n)&1)?(to[(n)/2]|=((m)&1)?(from[(m)/2]&BN_MASK2h):(from[(m)/2]<<32))\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|      0|#  define BN_MASK2h       (0xffffffff00000000L)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (291:43): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (291:63): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  292|      0|                                                :(to[(n)/2] =((m)&1)?(from[(m)/2]>>32):(from[(m)/2]&BN_MASK2l)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (292:62): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define bn_cp_32(to,n,from,m)           ((m)>=0)?bn_cp_32_naked(to,n,from,m):bn_32_set_0(to,n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  293|  13.1k|# define bn_32_set_0(to, n)              (((n)&1)?(to[(n)/2]&=BN_MASK2l):(to[(n)/2]=0));
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (293:43): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (294:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  13.1k|        }
  ------------------
  584|  13.1k|        carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  585|       |
  586|  13.1k|# if BN_BITS2==64
  587|  13.1k|        carry = (int)(r_d[BN_NIST_224_TOP - 1] >> 32);
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  588|  13.1k|# endif
  589|  13.1k|    }
  590|  13.1k|#endif
  591|  13.1k|    adjust = bn_sub_words;
  592|  13.1k|    if (carry > 0) {
  ------------------
  |  Branch (592:9): [True: 6.27k, False: 6.91k]
  ------------------
  593|  6.27k|        carry =
  594|  6.27k|            (int)bn_sub_words(r_d, r_d, _nist_p_224[carry - 1],
  595|  6.27k|                              BN_NIST_224_TOP);
  ------------------
  |  |   14|  6.27k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  6.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  6.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  596|  6.27k|#if BN_BITS2==64
  597|  6.27k|        carry = (int)(~(r_d[BN_NIST_224_TOP - 1] >> 32)) & 1;
  ------------------
  |  |   14|  6.27k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  6.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  6.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  598|  6.27k|#endif
  599|  6.91k|    } else if (carry < 0) {
  ------------------
  |  Branch (599:16): [True: 1.83k, False: 5.08k]
  ------------------
  600|       |        /*
  601|       |         * it's a bit more complicated logic in this case. if bn_add_words
  602|       |         * yields no carry, then result has to be adjusted by unconditionally
  603|       |         * *adding* the modulus. but if it does, then result has to be
  604|       |         * compared to the modulus and conditionally adjusted by
  605|       |         * *subtracting* the latter.
  606|       |         */
  607|  1.83k|        carry =
  608|  1.83k|            (int)bn_add_words(r_d, r_d, _nist_p_224[-carry - 1],
  609|  1.83k|                              BN_NIST_224_TOP);
  ------------------
  |  |   14|  1.83k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  1.83k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.83k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  1.83k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.83k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  610|  1.83k|        adjust = carry ? bn_sub_words : bn_add_words;
  ------------------
  |  Branch (610:18): [True: 1.83k, False: 0]
  ------------------
  611|  1.83k|    } else
  612|  5.08k|        carry = 1;
  613|       |
  614|       |    /* otherwise it's effectively same as in BN_nist_mod_192... */
  615|  13.1k|    res = ((*adjust) (c_d, r_d, _nist_p_224[0], BN_NIST_224_TOP) && carry)
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (615:12): [True: 13.1k, False: 0]
  |  Branch (615:69): [True: 13.1k, False: 0]
  ------------------
  616|  13.1k|        ? r_d
  617|  13.1k|        : c_d;
  618|  13.1k|    nist_cp_bn(r_d, res, BN_NIST_224_TOP);
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  619|  13.1k|    r->top = BN_NIST_224_TOP;
  ------------------
  |  |   14|  13.1k|#define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_224_TOP (224+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  13.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  13.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  620|  13.1k|    bn_correct_top(r);
  621|       |
  622|  13.1k|    return 1;
  623|  13.1k|}
BN_nist_mod_384:
  876|  11.0k|{
  877|  11.0k|    int i, top = a->top;
  878|  11.0k|    int carry = 0;
  879|  11.0k|    register BN_ULONG *r_d, *a_d = a->d;
  880|  11.0k|    union {
  881|  11.0k|        BN_ULONG bn[BN_NIST_384_TOP];
  882|  11.0k|        unsigned int ui[BN_NIST_384_TOP * sizeof(BN_ULONG) /
  883|  11.0k|                        sizeof(unsigned int)];
  884|  11.0k|    } buf;
  885|  11.0k|    BN_ULONG c_d[BN_NIST_384_TOP], *res;
  ------------------
  |  |   37|  11.0k|#  define BN_ULONG        unsigned long
  ------------------
  886|  11.0k|    bn_addsub_f adjust;
  887|  11.0k|    static const BIGNUM ossl_bignum_nist_p_384_sqr = {
  888|  11.0k|        (BN_ULONG *)_nist_p_384_sqr,
  889|  11.0k|        OSSL_NELEM(_nist_p_384_sqr),
  ------------------
  |  |   14|  11.0k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  890|  11.0k|        OSSL_NELEM(_nist_p_384_sqr),
  ------------------
  |  |   14|  11.0k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  891|  11.0k|        0, BN_FLG_STATIC_DATA
  ------------------
  |  |   59|  11.0k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  892|  11.0k|    };
  893|       |
  894|  11.0k|    field = &ossl_bignum_nist_p_384; /* just to make sure */
  895|       |
  896|  11.0k|    if (BN_is_negative(a) || BN_ucmp(a, &ossl_bignum_nist_p_384_sqr) >= 0)
  ------------------
  |  Branch (896:9): [True: 0, False: 11.0k]
  |  Branch (896:30): [True: 0, False: 11.0k]
  ------------------
  897|      0|        return BN_nnmod(r, a, field, ctx);
  898|       |
  899|  11.0k|    i = BN_ucmp(field, a);
  900|  11.0k|    if (i == 0) {
  ------------------
  |  Branch (900:9): [True: 0, False: 11.0k]
  ------------------
  901|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  902|      0|        return 1;
  903|  11.0k|    } else if (i > 0)
  ------------------
  |  Branch (903:16): [True: 19, False: 11.0k]
  ------------------
  904|     19|        return (r == a) ? 1 : (BN_copy(r, a) != NULL);
  ------------------
  |  Branch (904:16): [True: 19, False: 0]
  ------------------
  905|       |
  906|  11.0k|    if (r != a) {
  ------------------
  |  Branch (906:9): [True: 0, False: 11.0k]
  ------------------
  907|      0|        if (!bn_wexpand(r, BN_NIST_384_TOP))
  ------------------
  |  |   16|      0|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (907:13): [True: 0, False: 0]
  ------------------
  908|      0|            return 0;
  909|      0|        r_d = r->d;
  910|      0|        nist_cp_bn(r_d, a_d, BN_NIST_384_TOP);
  ------------------
  |  |   16|      0|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  911|      0|    } else
  912|  11.0k|        r_d = a_d;
  913|       |
  914|  11.0k|    nist_cp_bn_0(buf.bn, a_d + BN_NIST_384_TOP, top - BN_NIST_384_TOP,
  ------------------
  |  |  265|  11.0k|#define nist_cp_bn_0(dst, src_in, top, max) \
  |  |  266|  11.0k|{                                           \
  |  |  267|  11.0k|    int ii;                                 \
  |  |  268|  11.0k|    const BN_ULONG *src = src_in;           \
  |  |  269|  11.0k|                                            \
  |  |  270|  76.8k|    for (ii = 0; ii < top; ii++)            \
  |  |  ------------------
  |  |  |  Branch (270:18): [True: 65.8k, False: 11.0k]
  |  |  ------------------
  |  |  271|  65.8k|        (dst)[ii] = src[ii];                \
  |  |  272|  11.1k|    for (; ii < max; ii++)                  \
  |  |  ------------------
  |  |  |  Branch (272:12): [True: 147, False: 11.0k]
  |  |  ------------------
  |  |  273|  11.0k|        (dst)[ii] = 0;                      \
  |  |  274|  11.0k|}
  ------------------
  915|  11.0k|                 BN_NIST_384_TOP);
  916|       |
  917|  11.0k|#if defined(NIST_INT64)
  918|  11.0k|    {
  919|  11.0k|        NIST_INT64 acc;         /* accumulator */
  ------------------
  |  |  299|  11.0k|#   define NIST_INT64 long long
  ------------------
  920|  11.0k|        unsigned int *rp = (unsigned int *)r_d;
  921|  11.0k|        const unsigned int *bp = (const unsigned int *)buf.ui;
  922|       |
  923|  11.0k|        acc = rp[0];
  924|  11.0k|        acc += bp[12 - 12];
  925|  11.0k|        acc += bp[21 - 12];
  926|  11.0k|        acc += bp[20 - 12];
  927|  11.0k|        acc -= bp[23 - 12];
  928|  11.0k|        rp[0] = (unsigned int)acc;
  929|  11.0k|        acc >>= 32;
  930|       |
  931|  11.0k|        acc += rp[1];
  932|  11.0k|        acc += bp[13 - 12];
  933|  11.0k|        acc += bp[22 - 12];
  934|  11.0k|        acc += bp[23 - 12];
  935|  11.0k|        acc -= bp[12 - 12];
  936|  11.0k|        acc -= bp[20 - 12];
  937|  11.0k|        rp[1] = (unsigned int)acc;
  938|  11.0k|        acc >>= 32;
  939|       |
  940|  11.0k|        acc += rp[2];
  941|  11.0k|        acc += bp[14 - 12];
  942|  11.0k|        acc += bp[23 - 12];
  943|  11.0k|        acc -= bp[13 - 12];
  944|  11.0k|        acc -= bp[21 - 12];
  945|  11.0k|        rp[2] = (unsigned int)acc;
  946|  11.0k|        acc >>= 32;
  947|       |
  948|  11.0k|        acc += rp[3];
  949|  11.0k|        acc += bp[15 - 12];
  950|  11.0k|        acc += bp[12 - 12];
  951|  11.0k|        acc += bp[20 - 12];
  952|  11.0k|        acc += bp[21 - 12];
  953|  11.0k|        acc -= bp[14 - 12];
  954|  11.0k|        acc -= bp[22 - 12];
  955|  11.0k|        acc -= bp[23 - 12];
  956|  11.0k|        rp[3] = (unsigned int)acc;
  957|  11.0k|        acc >>= 32;
  958|       |
  959|  11.0k|        acc += rp[4];
  960|  11.0k|        acc += bp[21 - 12];
  961|  11.0k|        acc += bp[21 - 12];
  962|  11.0k|        acc += bp[16 - 12];
  963|  11.0k|        acc += bp[13 - 12];
  964|  11.0k|        acc += bp[12 - 12];
  965|  11.0k|        acc += bp[20 - 12];
  966|  11.0k|        acc += bp[22 - 12];
  967|  11.0k|        acc -= bp[15 - 12];
  968|  11.0k|        acc -= bp[23 - 12];
  969|  11.0k|        acc -= bp[23 - 12];
  970|  11.0k|        rp[4] = (unsigned int)acc;
  971|  11.0k|        acc >>= 32;
  972|       |
  973|  11.0k|        acc += rp[5];
  974|  11.0k|        acc += bp[22 - 12];
  975|  11.0k|        acc += bp[22 - 12];
  976|  11.0k|        acc += bp[17 - 12];
  977|  11.0k|        acc += bp[14 - 12];
  978|  11.0k|        acc += bp[13 - 12];
  979|  11.0k|        acc += bp[21 - 12];
  980|  11.0k|        acc += bp[23 - 12];
  981|  11.0k|        acc -= bp[16 - 12];
  982|  11.0k|        rp[5] = (unsigned int)acc;
  983|  11.0k|        acc >>= 32;
  984|       |
  985|  11.0k|        acc += rp[6];
  986|  11.0k|        acc += bp[23 - 12];
  987|  11.0k|        acc += bp[23 - 12];
  988|  11.0k|        acc += bp[18 - 12];
  989|  11.0k|        acc += bp[15 - 12];
  990|  11.0k|        acc += bp[14 - 12];
  991|  11.0k|        acc += bp[22 - 12];
  992|  11.0k|        acc -= bp[17 - 12];
  993|  11.0k|        rp[6] = (unsigned int)acc;
  994|  11.0k|        acc >>= 32;
  995|       |
  996|  11.0k|        acc += rp[7];
  997|  11.0k|        acc += bp[19 - 12];
  998|  11.0k|        acc += bp[16 - 12];
  999|  11.0k|        acc += bp[15 - 12];
 1000|  11.0k|        acc += bp[23 - 12];
 1001|  11.0k|        acc -= bp[18 - 12];
 1002|  11.0k|        rp[7] = (unsigned int)acc;
 1003|  11.0k|        acc >>= 32;
 1004|       |
 1005|  11.0k|        acc += rp[8];
 1006|  11.0k|        acc += bp[20 - 12];
 1007|  11.0k|        acc += bp[17 - 12];
 1008|  11.0k|        acc += bp[16 - 12];
 1009|  11.0k|        acc -= bp[19 - 12];
 1010|  11.0k|        rp[8] = (unsigned int)acc;
 1011|  11.0k|        acc >>= 32;
 1012|       |
 1013|  11.0k|        acc += rp[9];
 1014|  11.0k|        acc += bp[21 - 12];
 1015|  11.0k|        acc += bp[18 - 12];
 1016|  11.0k|        acc += bp[17 - 12];
 1017|  11.0k|        acc -= bp[20 - 12];
 1018|  11.0k|        rp[9] = (unsigned int)acc;
 1019|  11.0k|        acc >>= 32;
 1020|       |
 1021|  11.0k|        acc += rp[10];
 1022|  11.0k|        acc += bp[22 - 12];
 1023|  11.0k|        acc += bp[19 - 12];
 1024|  11.0k|        acc += bp[18 - 12];
 1025|  11.0k|        acc -= bp[21 - 12];
 1026|  11.0k|        rp[10] = (unsigned int)acc;
 1027|  11.0k|        acc >>= 32;
 1028|       |
 1029|  11.0k|        acc += rp[11];
 1030|  11.0k|        acc += bp[23 - 12];
 1031|  11.0k|        acc += bp[20 - 12];
 1032|  11.0k|        acc += bp[19 - 12];
 1033|  11.0k|        acc -= bp[22 - 12];
 1034|  11.0k|        rp[11] = (unsigned int)acc;
 1035|       |
 1036|  11.0k|        carry = (int)(acc >> 32);
 1037|  11.0k|    }
 1038|       |#else
 1039|       |    {
 1040|       |        BN_ULONG t_d[BN_NIST_384_TOP];
 1041|       |
 1042|       |        /*
 1043|       |         * S1
 1044|       |         */
 1045|       |        nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23 - 4, 22 - 4, 21 - 4);
 1046|       |        /* left shift */
 1047|       |        {
 1048|       |            register BN_ULONG *ap, t, c;
 1049|       |            ap = t_d;
 1050|       |            c = 0;
 1051|       |            for (i = 3; i != 0; --i) {
 1052|       |                t = *ap;
 1053|       |                *(ap++) = ((t << 1) | c) & BN_MASK2;
 1054|       |                c = (t & BN_TBIT) ? 1 : 0;
 1055|       |            }
 1056|       |            *ap = c;
 1057|       |        }
 1058|       |        carry =
 1059|       |            (int)bn_add_words(r_d + (128 / BN_BITS2), r_d + (128 / BN_BITS2),
 1060|       |                              t_d, BN_NIST_256_TOP);
 1061|       |        /*
 1062|       |         * S2
 1063|       |         */
 1064|       |        carry += (int)bn_add_words(r_d, r_d, buf.bn, BN_NIST_384_TOP);
 1065|       |        /*
 1066|       |         * S3
 1067|       |         */
 1068|       |        nist_set_384(t_d, buf.bn, 20, 19, 18, 17, 16, 15, 14, 13, 12, 23, 22,
 1069|       |                     21);
 1070|       |        carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1071|       |        /*
 1072|       |         * S4
 1073|       |         */
 1074|       |        nist_set_384(t_d, buf.bn, 19, 18, 17, 16, 15, 14, 13, 12, 20, 0, 23,
 1075|       |                     0);
 1076|       |        carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1077|       |        /*
 1078|       |         * S5
 1079|       |         */
 1080|       |        nist_set_384(t_d, buf.bn, 0, 0, 0, 0, 23, 22, 21, 20, 0, 0, 0, 0);
 1081|       |        carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1082|       |        /*
 1083|       |         * S6
 1084|       |         */
 1085|       |        nist_set_384(t_d, buf.bn, 0, 0, 0, 0, 0, 0, 23, 22, 21, 0, 0, 20);
 1086|       |        carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1087|       |        /*
 1088|       |         * D1
 1089|       |         */
 1090|       |        nist_set_384(t_d, buf.bn, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
 1091|       |                     23);
 1092|       |        carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1093|       |        /*
 1094|       |         * D2
 1095|       |         */
 1096|       |        nist_set_384(t_d, buf.bn, 0, 0, 0, 0, 0, 0, 0, 23, 22, 21, 20, 0);
 1097|       |        carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1098|       |        /*
 1099|       |         * D3
 1100|       |         */
 1101|       |        nist_set_384(t_d, buf.bn, 0, 0, 0, 0, 0, 0, 0, 23, 23, 0, 0, 0);
 1102|       |        carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP);
 1103|       |
 1104|       |    }
 1105|       |#endif
 1106|       |    /* see BN_nist_mod_224 for explanation */
 1107|  11.0k|    adjust = bn_sub_words;
 1108|  11.0k|    if (carry > 0)
  ------------------
  |  Branch (1108:9): [True: 8.35k, False: 2.65k]
  ------------------
 1109|  8.35k|        carry =
 1110|  8.35k|            (int)bn_sub_words(r_d, r_d, _nist_p_384[carry - 1],
 1111|  8.35k|                              BN_NIST_384_TOP);
  ------------------
  |  |   16|  8.35k|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  8.35k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  8.35k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  8.35k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  8.35k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1112|  2.65k|    else if (carry < 0) {
  ------------------
  |  Branch (1112:14): [True: 96, False: 2.55k]
  ------------------
 1113|     96|        carry =
 1114|     96|            (int)bn_add_words(r_d, r_d, _nist_p_384[-carry - 1],
 1115|     96|                              BN_NIST_384_TOP);
  ------------------
  |  |   16|     96|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|     96|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     96|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|     96|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     96|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1116|     96|        adjust = carry ? bn_sub_words : bn_add_words;
  ------------------
  |  Branch (1116:18): [True: 96, False: 0]
  ------------------
 1117|     96|    } else
 1118|  2.55k|        carry = 1;
 1119|       |
 1120|  11.0k|    res = ((*adjust) (c_d, r_d, _nist_p_384[0], BN_NIST_384_TOP) && carry)
  ------------------
  |  |   16|  11.0k|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  11.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  11.0k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  11.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  11.0k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1120:12): [True: 11.0k, False: 0]
  |  Branch (1120:69): [True: 11.0k, False: 0]
  ------------------
 1121|  11.0k|        ? r_d
 1122|  11.0k|        : c_d;
 1123|  11.0k|    nist_cp_bn(r_d, res, BN_NIST_384_TOP);
  ------------------
  |  |   16|  11.0k|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  11.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  11.0k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  11.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  11.0k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1124|  11.0k|    r->top = BN_NIST_384_TOP;
  ------------------
  |  |   16|  11.0k|#define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  11.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  11.0k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_384_TOP (384+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  11.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  11.0k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1125|  11.0k|    bn_correct_top(r);
 1126|       |
 1127|  11.0k|    return 1;
 1128|  11.0k|}
BN_nist_mod_521:
 1136|  7.62k|{
 1137|  7.62k|    int top = a->top, i;
 1138|  7.62k|    BN_ULONG *r_d, *a_d = a->d, t_d[BN_NIST_521_TOP], val, tmp, *res;
  ------------------
  |  |   37|  7.62k|#  define BN_ULONG        unsigned long
  ------------------
 1139|  7.62k|    static const BIGNUM ossl_bignum_nist_p_521_sqr = {
 1140|  7.62k|        (BN_ULONG *)_nist_p_521_sqr,
 1141|  7.62k|        OSSL_NELEM(_nist_p_521_sqr),
  ------------------
  |  |   14|  7.62k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
 1142|  7.62k|        OSSL_NELEM(_nist_p_521_sqr),
  ------------------
  |  |   14|  7.62k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
 1143|  7.62k|        0, BN_FLG_STATIC_DATA
  ------------------
  |  |   59|  7.62k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
 1144|  7.62k|    };
 1145|       |
 1146|  7.62k|    field = &ossl_bignum_nist_p_521; /* just to make sure */
 1147|       |
 1148|  7.62k|    if (BN_is_negative(a) || BN_ucmp(a, &ossl_bignum_nist_p_521_sqr) >= 0)
  ------------------
  |  Branch (1148:9): [True: 0, False: 7.62k]
  |  Branch (1148:30): [True: 0, False: 7.62k]
  ------------------
 1149|      0|        return BN_nnmod(r, a, field, ctx);
 1150|       |
 1151|  7.62k|    i = BN_ucmp(field, a);
 1152|  7.62k|    if (i == 0) {
  ------------------
  |  Branch (1152:9): [True: 0, False: 7.62k]
  ------------------
 1153|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1154|      0|        return 1;
 1155|  7.62k|    } else if (i > 0)
  ------------------
  |  Branch (1155:16): [True: 349, False: 7.27k]
  ------------------
 1156|    349|        return (r == a) ? 1 : (BN_copy(r, a) != NULL);
  ------------------
  |  Branch (1156:16): [True: 349, False: 0]
  ------------------
 1157|       |
 1158|  7.27k|    if (r != a) {
  ------------------
  |  Branch (1158:9): [True: 0, False: 7.27k]
  ------------------
 1159|      0|        if (!bn_wexpand(r, BN_NIST_521_TOP))
  ------------------
  |  |   17|      0|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1159:13): [True: 0, False: 0]
  ------------------
 1160|      0|            return 0;
 1161|      0|        r_d = r->d;
 1162|      0|        nist_cp_bn(r_d, a_d, BN_NIST_521_TOP);
  ------------------
  |  |   17|      0|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|      0|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1163|      0|    } else
 1164|  7.27k|        r_d = a_d;
 1165|       |
 1166|       |    /* upper 521 bits, copy ... */
 1167|  7.27k|    nist_cp_bn_0(t_d, a_d + (BN_NIST_521_TOP - 1),
  ------------------
  |  |  265|  7.27k|#define nist_cp_bn_0(dst, src_in, top, max) \
  |  |  266|  7.27k|{                                           \
  |  |  267|  7.27k|    int ii;                                 \
  |  |  268|  7.27k|    const BN_ULONG *src = src_in;           \
  |  |  269|  7.27k|                                            \
  |  |  270|  69.4k|    for (ii = 0; ii < top; ii++)            \
  |  |  ------------------
  |  |  |  Branch (270:18): [True: 62.1k, False: 7.27k]
  |  |  ------------------
  |  |  271|  62.1k|        (dst)[ii] = src[ii];                \
  |  |  272|  10.5k|    for (; ii < max; ii++)                  \
  |  |  ------------------
  |  |  |  Branch (272:12): [True: 3.26k, False: 7.27k]
  |  |  ------------------
  |  |  273|  7.27k|        (dst)[ii] = 0;                      \
  |  |  274|  7.27k|}
  ------------------
 1168|  7.27k|                 top - (BN_NIST_521_TOP - 1), BN_NIST_521_TOP);
 1169|       |    /* ... and right shift */
 1170|  65.4k|    for (val = t_d[0], i = 0; i < BN_NIST_521_TOP - 1; i++) {
  ------------------
  |  |   17|  65.4k|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  65.4k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  65.4k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  65.4k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  65.4k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1170:31): [True: 58.1k, False: 7.27k]
  ------------------
 1171|       |#if 0
 1172|       |        /*
 1173|       |         * MSC ARM compiler [version 2013, presumably even earlier,
 1174|       |         * much earlier] miscompiles this code, but not one in
 1175|       |         * #else section. See RT#3541.
 1176|       |         */
 1177|       |        tmp = val >> BN_NIST_521_RSHIFT;
 1178|       |        val = t_d[i + 1];
 1179|       |        t_d[i] = (tmp | val << BN_NIST_521_LSHIFT) & BN_MASK2;
 1180|       |#else
 1181|  58.1k|        t_d[i] = (val >> BN_NIST_521_RSHIFT |
  ------------------
  |  | 1130|  58.1k|#define BN_NIST_521_RSHIFT      (521%BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|  58.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  58.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1182|  58.1k|                  (tmp = t_d[i + 1]) << BN_NIST_521_LSHIFT) & BN_MASK2;
  ------------------
  |  | 1131|  58.1k|#define BN_NIST_521_LSHIFT      (BN_BITS2-BN_NIST_521_RSHIFT)
  |  |  ------------------
  |  |  |  |   54|  58.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  58.1k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_LSHIFT      (BN_BITS2-BN_NIST_521_RSHIFT)
  |  |  ------------------
  |  |  |  | 1130|  58.1k|#define BN_NIST_521_RSHIFT      (521%BN_BITS2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|  58.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  58.1k|#  define BN_BYTES        8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                (tmp = t_d[i + 1]) << BN_NIST_521_LSHIFT) & BN_MASK2;
  ------------------
  |  |   94|  58.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
 1183|  58.1k|        val = tmp;
 1184|  58.1k|#endif
 1185|  58.1k|    }
 1186|  7.27k|    t_d[i] = val >> BN_NIST_521_RSHIFT;
  ------------------
  |  | 1130|  7.27k|#define BN_NIST_521_RSHIFT      (521%BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1187|       |    /* lower 521 bits */
 1188|  7.27k|    r_d[i] &= BN_NIST_521_TOP_MASK;
  ------------------
  |  | 1132|  7.27k|#define BN_NIST_521_TOP_MASK    ((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)
  |  |  ------------------
  |  |  |  |   94|  7.27k|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP_MASK    ((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)
  |  |  ------------------
  |  |  |  | 1131|  7.27k|#define BN_NIST_521_LSHIFT      (BN_BITS2-BN_NIST_521_RSHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define BN_NIST_521_LSHIFT      (BN_BITS2-BN_NIST_521_RSHIFT)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1130|  7.27k|#define BN_NIST_521_RSHIFT      (521%BN_BITS2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1189|       |
 1190|  7.27k|    bn_add_words(r_d, r_d, t_d, BN_NIST_521_TOP);
  ------------------
  |  |   17|  7.27k|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1191|  7.27k|    res = bn_sub_words(t_d, r_d, _nist_p_521,
  ------------------
  |  Branch (1191:11): [True: 6.76k, False: 505]
  ------------------
 1192|  7.27k|                       BN_NIST_521_TOP)
  ------------------
  |  |   17|  7.27k|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1193|  7.27k|        ? r_d
 1194|  7.27k|        : t_d;
 1195|  7.27k|    nist_cp_bn(r_d, res, BN_NIST_521_TOP);
  ------------------
  |  |   17|  7.27k|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1196|  7.27k|    r->top = BN_NIST_521_TOP;
  ------------------
  |  |   17|  7.27k|#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
  |  |  ------------------
  |  |  |  |   54|  7.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  7.27k|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1197|  7.27k|    bn_correct_top(r);
 1198|       |
 1199|  7.27k|    return 1;
 1200|  7.27k|}
bn_nist.c:nist_cp_bn:
  277|  31.4k|{
  278|  31.4k|    int i;
  279|       |
  280|   215k|    for (i = 0; i < top; i++)
  ------------------
  |  Branch (280:17): [True: 184k, False: 31.4k]
  ------------------
  281|   184k|        dst[i] = src[i];
  282|  31.4k|}

BN_print:
   32|  50.4k|{
   33|  50.4k|    int i, j, v, z = 0;
   34|  50.4k|    int ret = 0;
   35|       |
   36|  50.4k|    if ((a->neg) && BIO_write(bp, "-", 1) != 1)
  ------------------
  |  Branch (36:9): [True: 0, False: 50.4k]
  |  Branch (36:21): [True: 0, False: 0]
  ------------------
   37|      0|        goto end;
   38|  50.4k|    if (BN_is_zero(a) && BIO_write(bp, "0", 1) != 1)
  ------------------
  |  Branch (38:9): [True: 4.53k, False: 45.9k]
  |  Branch (38:26): [True: 0, False: 4.53k]
  ------------------
   39|      0|        goto end;
   40|   391k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (40:26): [True: 341k, False: 50.4k]
  ------------------
   41|  5.80M|        for (j = BN_BITS2 - 4; j >= 0; j -= 4) {
  ------------------
  |  |   54|   341k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   341k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (41:32): [True: 5.45M, False: 341k]
  ------------------
   42|       |            /* strip leading zeros */
   43|  5.45M|            v = (int)((a->d[i] >> j) & 0x0f);
   44|  5.45M|            if (z || v != 0) {
  ------------------
  |  Branch (44:17): [True: 4.88M, False: 572k]
  |  Branch (44:22): [True: 45.9k, False: 526k]
  ------------------
   45|  4.93M|                if (BIO_write(bp, &Hex[v], 1) != 1)
  ------------------
  |  Branch (45:21): [True: 0, False: 4.93M]
  ------------------
   46|      0|                    goto end;
   47|  4.93M|                z = 1;
   48|  4.93M|            }
   49|  5.45M|        }
   50|   341k|    }
   51|  50.4k|    ret = 1;
   52|  50.4k| end:
   53|  50.4k|    return ret;
   54|  50.4k|}

BN_priv_rand_ex:
  119|  51.5k|{
  120|  51.5k|    return bnrand(PRIVATE, rnd, bits, top, bottom, strength, ctx);
  121|  51.5k|}
BN_priv_rand_range_ex:
  218|  1.05k|{
  219|  1.05k|    return bnrand_range(PRIVATE, r, range, strength, ctx);
  220|  1.05k|}
bn_rand.c:bnrand:
   25|  52.6k|{
   26|  52.6k|    unsigned char *buf = NULL;
   27|  52.6k|    int b, ret = 0, bit, bytes, mask;
   28|  52.6k|    OSSL_LIB_CTX *libctx = ossl_bn_get_libctx(ctx);
   29|       |
   30|  52.6k|    if (bits == 0) {
  ------------------
  |  Branch (30:9): [True: 0, False: 52.6k]
  ------------------
   31|      0|        if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
  ------------------
  |  |   80|      0|#define BN_RAND_TOP_ANY    -1
  ------------------
                      if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
  ------------------
  |  |   85|      0|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  |  Branch (31:13): [True: 0, False: 0]
  |  Branch (31:39): [True: 0, False: 0]
  ------------------
   32|      0|            goto toosmall;
   33|      0|        BN_zero(rnd);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   34|      0|        return 1;
   35|      0|    }
   36|  52.6k|    if (bits < 0 || (bits == 1 && top > 0))
  ------------------
  |  Branch (36:9): [True: 0, False: 52.6k]
  |  Branch (36:22): [True: 0, False: 52.6k]
  |  Branch (36:35): [True: 0, False: 0]
  ------------------
   37|      0|        goto toosmall;
   38|       |
   39|  52.6k|    bytes = (bits + 7) / 8;
   40|  52.6k|    bit = (bits - 1) % 8;
   41|  52.6k|    mask = 0xff << (bit + 1);
   42|       |
   43|  52.6k|    buf = OPENSSL_malloc(bytes);
  ------------------
  |  |   97|  52.6k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  52.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  52.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   44|  52.6k|    if (buf == NULL)
  ------------------
  |  Branch (44:9): [True: 0, False: 52.6k]
  ------------------
   45|      0|        goto err;
   46|       |
   47|       |    /* make a random number and set the top and bottom bits */
   48|  52.6k|    b = flag == NORMAL ? RAND_bytes_ex(libctx, buf, bytes, strength)
  ------------------
  |  Branch (48:9): [True: 0, False: 52.6k]
  ------------------
   49|  52.6k|                       : RAND_priv_bytes_ex(libctx, buf, bytes, strength);
   50|  52.6k|    if (b <= 0)
  ------------------
  |  Branch (50:9): [True: 0, False: 52.6k]
  ------------------
   51|      0|        goto err;
   52|       |
   53|  52.6k|    if (flag == TESTING) {
  ------------------
  |  Branch (53:9): [True: 0, False: 52.6k]
  ------------------
   54|       |        /*
   55|       |         * generate patterns that are more likely to trigger BN library bugs
   56|       |         */
   57|      0|        int i;
   58|      0|        unsigned char c;
   59|       |
   60|      0|        for (i = 0; i < bytes; i++) {
  ------------------
  |  Branch (60:21): [True: 0, False: 0]
  ------------------
   61|      0|            if (RAND_bytes_ex(libctx, &c, 1, strength) <= 0)
  ------------------
  |  Branch (61:17): [True: 0, False: 0]
  ------------------
   62|      0|                goto err;
   63|      0|            if (c >= 128 && i > 0)
  ------------------
  |  Branch (63:17): [True: 0, False: 0]
  |  Branch (63:29): [True: 0, False: 0]
  ------------------
   64|      0|                buf[i] = buf[i - 1];
   65|      0|            else if (c < 42)
  ------------------
  |  Branch (65:22): [True: 0, False: 0]
  ------------------
   66|      0|                buf[i] = 0;
   67|      0|            else if (c < 84)
  ------------------
  |  Branch (67:22): [True: 0, False: 0]
  ------------------
   68|      0|                buf[i] = 255;
   69|      0|        }
   70|      0|    }
   71|       |
   72|  52.6k|    if (top >= 0) {
  ------------------
  |  Branch (72:9): [True: 43.6k, False: 9.03k]
  ------------------
   73|  43.6k|        if (top) {
  ------------------
  |  Branch (73:13): [True: 0, False: 43.6k]
  ------------------
   74|      0|            if (bit == 0) {
  ------------------
  |  Branch (74:17): [True: 0, False: 0]
  ------------------
   75|      0|                buf[0] = 1;
   76|      0|                buf[1] |= 0x80;
   77|      0|            } else {
   78|      0|                buf[0] |= (3 << (bit - 1));
   79|      0|            }
   80|  43.6k|        } else {
   81|  43.6k|            buf[0] |= (1 << bit);
   82|  43.6k|        }
   83|  43.6k|    }
   84|  52.6k|    buf[0] &= ~mask;
   85|  52.6k|    if (bottom)                 /* set bottom bit if requested */
  ------------------
  |  Branch (85:9): [True: 0, False: 52.6k]
  ------------------
   86|      0|        buf[bytes - 1] |= 1;
   87|  52.6k|    if (!BN_bin2bn(buf, bytes, rnd))
  ------------------
  |  Branch (87:9): [True: 0, False: 52.6k]
  ------------------
   88|      0|        goto err;
   89|  52.6k|    ret = 1;
   90|  52.6k| err:
   91|  52.6k|    OPENSSL_clear_free(buf, bytes);
  ------------------
  |  |  105|  52.6k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  52.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  52.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|  52.6k|    bn_check_top(rnd);
   93|  52.6k|    return ret;
   94|       |
   95|      0|toosmall:
   96|      0|    ERR_raise(ERR_LIB_BN, BN_R_BITS_TOO_SMALL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   97|      0|    return 0;
   98|  52.6k|}
bn_rand.c:bnrand_range:
  133|  1.05k|{
  134|  1.05k|    int n;
  135|  1.05k|    int count = 100;
  136|       |
  137|  1.05k|    if (r == NULL) {
  ------------------
  |  Branch (137:9): [True: 0, False: 1.05k]
  ------------------
  138|      0|        ERR_raise(ERR_LIB_BN, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  139|      0|        return 0;
  140|      0|    }
  141|       |
  142|  1.05k|    if (range->neg || BN_is_zero(range)) {
  ------------------
  |  Branch (142:9): [True: 0, False: 1.05k]
  |  Branch (142:23): [True: 0, False: 1.05k]
  ------------------
  143|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  144|      0|        return 0;
  145|      0|    }
  146|       |
  147|  1.05k|    n = BN_num_bits(range);     /* n > 0 */
  148|       |
  149|       |    /* BN_is_bit_set(range, n - 1) always holds */
  150|       |
  151|  1.05k|    if (n == 1)
  ------------------
  |  Branch (151:9): [True: 0, False: 1.05k]
  ------------------
  152|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  153|  1.05k|    else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) {
  ------------------
  |  Branch (153:14): [True: 340, False: 713]
  |  Branch (153:46): [True: 81, False: 259]
  ------------------
  154|       |        /*
  155|       |         * range = 100..._2, so 3*range (= 11..._2) is exactly one bit longer
  156|       |         * than range
  157|       |         */
  158|     81|        do {
  159|     81|            if (!bnrand(flag, r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY,
  ------------------
  |  |   80|     81|#define BN_RAND_TOP_ANY    -1
  ------------------
                          if (!bnrand(flag, r, n + 1, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY,
  ------------------
  |  |   85|     81|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  |  Branch (159:17): [True: 0, False: 81]
  ------------------
  160|     81|                        strength, ctx))
  161|      0|                return 0;
  162|       |
  163|       |            /*
  164|       |             * If r < 3*range, use r := r MOD range (which is either r, r -
  165|       |             * range, or r - 2*range). Otherwise, iterate once more. Since
  166|       |             * 3*range = 11..._2, each iteration succeeds with probability >=
  167|       |             * .75.
  168|       |             */
  169|     81|            if (BN_cmp(r, range) >= 0) {
  ------------------
  |  Branch (169:17): [True: 81, False: 0]
  ------------------
  170|     81|                if (!BN_sub(r, r, range))
  ------------------
  |  Branch (170:21): [True: 0, False: 81]
  ------------------
  171|      0|                    return 0;
  172|     81|                if (BN_cmp(r, range) >= 0)
  ------------------
  |  Branch (172:21): [True: 30, False: 51]
  ------------------
  173|     30|                    if (!BN_sub(r, r, range))
  ------------------
  |  Branch (173:25): [True: 0, False: 30]
  ------------------
  174|      0|                        return 0;
  175|     81|            }
  176|       |
  177|     81|            if (!--count) {
  ------------------
  |  Branch (177:17): [True: 0, False: 81]
  ------------------
  178|      0|                ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  179|      0|                return 0;
  180|      0|            }
  181|       |
  182|     81|        }
  183|     81|        while (BN_cmp(r, range) >= 0);
  ------------------
  |  Branch (183:16): [True: 0, False: 81]
  ------------------
  184|    972|    } else {
  185|    972|        do {
  186|       |            /* range = 11..._2  or  range = 101..._2 */
  187|    972|            if (!bnrand(flag, r, n, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0,
  ------------------
  |  |   80|    972|#define BN_RAND_TOP_ANY    -1
  ------------------
                          if (!bnrand(flag, r, n, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0,
  ------------------
  |  |   85|    972|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  |  Branch (187:17): [True: 0, False: 972]
  ------------------
  188|    972|                        ctx))
  189|      0|                return 0;
  190|       |
  191|    972|            if (!--count) {
  ------------------
  |  Branch (191:17): [True: 0, False: 972]
  ------------------
  192|      0|                ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  193|      0|                return 0;
  194|      0|            }
  195|    972|        }
  196|    972|        while (BN_cmp(r, range) >= 0);
  ------------------
  |  Branch (196:16): [True: 0, False: 972]
  ------------------
  197|    972|    }
  198|       |
  199|  1.05k|    bn_check_top(r);
  200|  1.05k|    return 1;
  201|  1.05k|}

BN_lshift1:
   15|   699k|{
   16|   699k|    register BN_ULONG *ap, *rp, t, c;
   17|   699k|    int i;
   18|       |
   19|   699k|    bn_check_top(r);
   20|   699k|    bn_check_top(a);
   21|       |
   22|   699k|    if (r != a) {
  ------------------
  |  Branch (22:9): [True: 125k, False: 573k]
  ------------------
   23|   125k|        r->neg = a->neg;
   24|   125k|        if (bn_wexpand(r, a->top + 1) == NULL)
  ------------------
  |  Branch (24:13): [True: 0, False: 125k]
  ------------------
   25|      0|            return 0;
   26|   125k|        r->top = a->top;
   27|   573k|    } else {
   28|   573k|        if (bn_wexpand(r, a->top + 1) == NULL)
  ------------------
  |  Branch (28:13): [True: 0, False: 573k]
  ------------------
   29|      0|            return 0;
   30|   573k|    }
   31|   699k|    ap = a->d;
   32|   699k|    rp = r->d;
   33|   699k|    c = 0;
   34|  3.40M|    for (i = 0; i < a->top; i++) {
  ------------------
  |  Branch (34:17): [True: 2.70M, False: 699k]
  ------------------
   35|  2.70M|        t = *(ap++);
   36|  2.70M|        *(rp++) = ((t << 1) | c) & BN_MASK2;
  ------------------
  |  |   94|  2.70M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   37|  2.70M|        c = t >> (BN_BITS2 - 1);
  ------------------
  |  |   54|  2.70M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  2.70M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   38|  2.70M|    }
   39|   699k|    *rp = c;
   40|   699k|    r->top += c;
   41|   699k|    bn_check_top(r);
   42|   699k|    return 1;
   43|   699k|}
BN_rshift1:
   46|  1.53M|{
   47|  1.53M|    BN_ULONG *ap, *rp, t, c;
  ------------------
  |  |   37|  1.53M|#  define BN_ULONG        unsigned long
  ------------------
   48|  1.53M|    int i;
   49|       |
   50|  1.53M|    bn_check_top(r);
   51|  1.53M|    bn_check_top(a);
   52|       |
   53|  1.53M|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (53:9): [True: 0, False: 1.53M]
  ------------------
   54|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   55|      0|        return 1;
   56|      0|    }
   57|  1.53M|    i = a->top;
   58|  1.53M|    ap = a->d;
   59|  1.53M|    if (a != r) {
  ------------------
  |  Branch (59:9): [True: 9.08k, False: 1.52M]
  ------------------
   60|  9.08k|        if (bn_wexpand(r, i) == NULL)
  ------------------
  |  Branch (60:13): [True: 0, False: 9.08k]
  ------------------
   61|      0|            return 0;
   62|  9.08k|        r->neg = a->neg;
   63|  9.08k|    }
   64|  1.53M|    rp = r->d;
   65|  1.53M|    r->top = i;
   66|  1.53M|    t = ap[--i];
   67|  1.53M|    rp[i] = t >> 1;
   68|  1.53M|    c = t << (BN_BITS2 - 1);
  ------------------
  |  |   54|  1.53M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.53M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   69|  1.53M|    r->top -= (t == 1);
   70|  2.62M|    while (i > 0) {
  ------------------
  |  Branch (70:12): [True: 1.08M, False: 1.53M]
  ------------------
   71|  1.08M|        t = ap[--i];
   72|  1.08M|        rp[i] = ((t >> 1) & BN_MASK2) | c;
  ------------------
  |  |   94|  1.08M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   73|  1.08M|        c = t << (BN_BITS2 - 1);
  ------------------
  |  |   54|  1.08M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.08M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   74|  1.08M|    }
   75|  1.53M|    if (!r->top)
  ------------------
  |  Branch (75:9): [True: 4, False: 1.53M]
  ------------------
   76|      4|        r->neg = 0; /* don't allow negative zero */
   77|  1.53M|    bn_check_top(r);
   78|  1.53M|    return 1;
   79|  1.53M|}
BN_lshift:
   82|   405k|{
   83|   405k|    int ret;
   84|       |
   85|   405k|    if (n < 0) {
  ------------------
  |  Branch (85:9): [True: 0, False: 405k]
  ------------------
   86|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_SHIFT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   87|      0|        return 0;
   88|      0|    }
   89|       |
   90|   405k|    ret = bn_lshift_fixed_top(r, a, n);
   91|       |
   92|   405k|    bn_correct_top(r);
   93|   405k|    bn_check_top(r);
   94|       |
   95|   405k|    return ret;
   96|   405k|}
bn_lshift_fixed_top:
  105|  4.91M|{
  106|  4.91M|    int i, nw;
  107|  4.91M|    unsigned int lb, rb;
  108|  4.91M|    BN_ULONG *t, *f;
  ------------------
  |  |   37|  4.91M|#  define BN_ULONG        unsigned long
  ------------------
  109|  4.91M|    BN_ULONG l, m, rmask = 0;
  ------------------
  |  |   37|  4.91M|#  define BN_ULONG        unsigned long
  ------------------
  110|       |
  111|  4.91M|    assert(n >= 0);
  112|       |
  113|  4.91M|    bn_check_top(r);
  114|  4.91M|    bn_check_top(a);
  115|       |
  116|  4.91M|    nw = n / BN_BITS2;
  ------------------
  |  |   54|  4.91M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.91M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  117|  4.91M|    if (bn_wexpand(r, a->top + nw + 1) == NULL)
  ------------------
  |  Branch (117:9): [True: 0, False: 4.91M]
  ------------------
  118|      0|        return 0;
  119|       |
  120|  4.91M|    if (a->top != 0) {
  ------------------
  |  Branch (120:9): [True: 4.76M, False: 149k]
  ------------------
  121|  4.76M|        lb = (unsigned int)n % BN_BITS2;
  ------------------
  |  |   54|  4.76M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.76M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  122|  4.76M|        rb = BN_BITS2 - lb;
  ------------------
  |  |   54|  4.76M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.76M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  123|  4.76M|        rb %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|  4.76M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.76M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  124|  4.76M|        rmask = (BN_ULONG)0 - rb;  /* rmask = 0 - (rb != 0) */
  125|  4.76M|        rmask |= rmask >> 8;
  126|  4.76M|        f = &(a->d[0]);
  127|  4.76M|        t = &(r->d[nw]);
  128|  4.76M|        l = f[a->top - 1];
  129|  4.76M|        t[a->top] = (l >> rb) & rmask;
  130|  31.0M|        for (i = a->top - 1; i > 0; i--) {
  ------------------
  |  Branch (130:30): [True: 26.2M, False: 4.76M]
  ------------------
  131|  26.2M|            m = l << lb;
  132|  26.2M|            l = f[i - 1];
  133|  26.2M|            t[i] = (m | ((l >> rb) & rmask)) & BN_MASK2;
  ------------------
  |  |   94|  26.2M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  134|  26.2M|        }
  135|  4.76M|        t[0] = (l << lb) & BN_MASK2;
  ------------------
  |  |   94|  4.76M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  136|  4.76M|    } else {
  137|       |        /* shouldn't happen, but formally required */
  138|   149k|        r->d[nw] = 0;
  139|   149k|    }
  140|  4.91M|    if (nw != 0)
  ------------------
  |  Branch (140:9): [True: 31.7k, False: 4.88M]
  ------------------
  141|  31.7k|        memset(r->d, 0, sizeof(*t) * nw);
  142|       |
  143|  4.91M|    r->neg = a->neg;
  144|  4.91M|    r->top = a->top + nw + 1;
  145|  4.91M|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  4.91M|#  define BN_FLG_FIXED_TOP 0
  ------------------
  146|       |
  147|  4.91M|    return 1;
  148|  4.91M|}
BN_rshift:
  151|  1.65M|{
  152|  1.65M|    int ret = 0;
  153|       |
  154|  1.65M|    if (n < 0) {
  ------------------
  |  Branch (154:9): [True: 0, False: 1.65M]
  ------------------
  155|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_SHIFT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  156|      0|        return 0;
  157|      0|    }
  158|       |
  159|  1.65M|    ret = bn_rshift_fixed_top(r, a, n);
  160|       |
  161|  1.65M|    bn_correct_top(r);
  162|  1.65M|    bn_check_top(r);
  163|       |
  164|  1.65M|    return ret;
  165|  1.65M|}
bn_rshift_fixed_top:
  174|  6.13M|{
  175|  6.13M|    int i, top, nw;
  176|  6.13M|    unsigned int lb, rb;
  177|  6.13M|    BN_ULONG *t, *f;
  ------------------
  |  |   37|  6.13M|#  define BN_ULONG        unsigned long
  ------------------
  178|  6.13M|    BN_ULONG l, m, mask;
  ------------------
  |  |   37|  6.13M|#  define BN_ULONG        unsigned long
  ------------------
  179|       |
  180|  6.13M|    bn_check_top(r);
  181|  6.13M|    bn_check_top(a);
  182|       |
  183|  6.13M|    assert(n >= 0);
  184|       |
  185|  6.13M|    nw = n / BN_BITS2;
  ------------------
  |  |   54|  6.13M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.13M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  186|  6.13M|    if (nw >= a->top) {
  ------------------
  |  Branch (186:9): [True: 0, False: 6.13M]
  ------------------
  187|       |        /* shouldn't happen, but formally required */
  188|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  189|      0|        return 1;
  190|      0|    }
  191|       |
  192|  6.13M|    rb = (unsigned int)n % BN_BITS2;
  ------------------
  |  |   54|  6.13M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.13M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  193|  6.13M|    lb = BN_BITS2 - rb;
  ------------------
  |  |   54|  6.13M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.13M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  194|  6.13M|    lb %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|  6.13M|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.13M|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  195|  6.13M|    mask = (BN_ULONG)0 - lb;   /* mask = 0 - (lb != 0) */
  196|  6.13M|    mask |= mask >> 8;
  197|  6.13M|    top = a->top - nw;
  198|  6.13M|    if (r != a && bn_wexpand(r, top) == NULL)
  ------------------
  |  Branch (198:9): [True: 4.48M, False: 1.65M]
  |  Branch (198:19): [True: 0, False: 4.48M]
  ------------------
  199|      0|        return 0;
  200|       |
  201|  6.13M|    t = &(r->d[0]);
  202|  6.13M|    f = &(a->d[nw]);
  203|  6.13M|    l = f[0];
  204|  19.4M|    for (i = 0; i < top - 1; i++) {
  ------------------
  |  Branch (204:17): [True: 13.2M, False: 6.13M]
  ------------------
  205|  13.2M|        m = f[i + 1];
  206|  13.2M|        t[i] = (l >> rb) | ((m << lb) & mask);
  207|  13.2M|        l = m;
  208|  13.2M|    }
  209|  6.13M|    t[i] = l >> rb;
  210|       |
  211|  6.13M|    r->neg = a->neg;
  212|  6.13M|    r->top = top;
  213|  6.13M|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  6.13M|#  define BN_FLG_FIXED_TOP 0
  ------------------
  214|       |
  215|  6.13M|    return 1;
  216|  6.13M|}

BN_sqr:
   18|  3.94M|{
   19|  3.94M|    int ret = bn_sqr_fixed_top(r, a, ctx);
   20|       |
   21|  3.94M|    bn_correct_top(r);
   22|  3.94M|    bn_check_top(r);
   23|       |
   24|  3.94M|    return ret;
   25|  3.94M|}
bn_sqr_fixed_top:
   28|  3.96M|{
   29|  3.96M|    int max, al;
   30|  3.96M|    int ret = 0;
   31|  3.96M|    BIGNUM *tmp, *rr;
   32|       |
   33|  3.96M|    bn_check_top(a);
   34|       |
   35|  3.96M|    al = a->top;
   36|  3.96M|    if (al <= 0) {
  ------------------
  |  Branch (36:9): [True: 9.11k, False: 3.95M]
  ------------------
   37|  9.11k|        r->top = 0;
   38|  9.11k|        r->neg = 0;
   39|  9.11k|        return 1;
   40|  9.11k|    }
   41|       |
   42|  3.95M|    BN_CTX_start(ctx);
   43|  3.95M|    rr = (a != r) ? r : BN_CTX_get(ctx);
  ------------------
  |  Branch (43:10): [True: 3.88M, False: 72.5k]
  ------------------
   44|  3.95M|    tmp = BN_CTX_get(ctx);
   45|  3.95M|    if (rr == NULL || tmp == NULL)
  ------------------
  |  Branch (45:9): [True: 0, False: 3.95M]
  |  Branch (45:23): [True: 0, False: 3.95M]
  ------------------
   46|      0|        goto err;
   47|       |
   48|  3.95M|    max = 2 * al;               /* Non-zero (from above) */
   49|  3.95M|    if (bn_wexpand(rr, max) == NULL)
  ------------------
  |  Branch (49:9): [True: 0, False: 3.95M]
  ------------------
   50|      0|        goto err;
   51|       |
   52|  3.95M|    if (al == 4) {
  ------------------
  |  Branch (52:9): [True: 3.93M, False: 26.9k]
  ------------------
   53|       |#ifndef BN_SQR_COMBA
   54|       |        BN_ULONG t[8];
   55|       |        bn_sqr_normal(rr->d, a->d, 4, t);
   56|       |#else
   57|  3.93M|        bn_sqr_comba4(rr->d, a->d);
   58|  3.93M|#endif
   59|  3.93M|    } else if (al == 8) {
  ------------------
  |  Branch (59:16): [True: 1.27k, False: 25.6k]
  ------------------
   60|       |#ifndef BN_SQR_COMBA
   61|       |        BN_ULONG t[16];
   62|       |        bn_sqr_normal(rr->d, a->d, 8, t);
   63|       |#else
   64|  1.27k|        bn_sqr_comba8(rr->d, a->d);
   65|  1.27k|#endif
   66|  25.6k|    } else {
   67|  25.6k|#if defined(BN_RECURSION)
   68|  25.6k|        if (al < BN_SQR_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  366|  25.6k|# define BN_SQR_RECURSIVE_SIZE_NORMAL            (16)/* 32 */
  ------------------
  |  Branch (68:13): [True: 25.6k, False: 0]
  ------------------
   69|  25.6k|            BN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL * 2];
  ------------------
  |  |   37|  25.6k|#  define BN_ULONG        unsigned long
  ------------------
   70|  25.6k|            bn_sqr_normal(rr->d, a->d, al, t);
   71|  25.6k|        } else {
   72|      0|            int j, k;
   73|       |
   74|      0|            j = BN_num_bits_word((BN_ULONG)al);
   75|      0|            j = 1 << (j - 1);
   76|      0|            k = j + j;
   77|      0|            if (al == j) {
  ------------------
  |  Branch (77:17): [True: 0, False: 0]
  ------------------
   78|      0|                if (bn_wexpand(tmp, k * 2) == NULL)
  ------------------
  |  Branch (78:21): [True: 0, False: 0]
  ------------------
   79|      0|                    goto err;
   80|      0|                bn_sqr_recursive(rr->d, a->d, al, tmp->d);
   81|      0|            } else {
   82|      0|                if (bn_wexpand(tmp, max) == NULL)
  ------------------
  |  Branch (82:21): [True: 0, False: 0]
  ------------------
   83|      0|                    goto err;
   84|      0|                bn_sqr_normal(rr->d, a->d, al, tmp->d);
   85|      0|            }
   86|      0|        }
   87|       |#else
   88|       |        if (bn_wexpand(tmp, max) == NULL)
   89|       |            goto err;
   90|       |        bn_sqr_normal(rr->d, a->d, al, tmp->d);
   91|       |#endif
   92|  25.6k|    }
   93|       |
   94|  3.95M|    rr->neg = 0;
   95|  3.95M|    rr->top = max;
   96|  3.95M|    rr->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  3.95M|#  define BN_FLG_FIXED_TOP 0
  ------------------
   97|  3.95M|    if (r != rr && BN_copy(r, rr) == NULL)
  ------------------
  |  Branch (97:9): [True: 72.5k, False: 3.88M]
  |  Branch (97:20): [True: 0, False: 72.5k]
  ------------------
   98|      0|        goto err;
   99|       |
  100|  3.95M|    ret = 1;
  101|  3.95M| err:
  102|  3.95M|    bn_check_top(rr);
  103|  3.95M|    bn_check_top(tmp);
  104|  3.95M|    BN_CTX_end(ctx);
  105|  3.95M|    return ret;
  106|  3.95M|}
bn_sqr_normal:
  110|  25.6k|{
  111|  25.6k|    int i, j, max;
  112|  25.6k|    const BN_ULONG *ap;
  113|  25.6k|    BN_ULONG *rp;
  ------------------
  |  |   37|  25.6k|#  define BN_ULONG        unsigned long
  ------------------
  114|       |
  115|  25.6k|    max = n * 2;
  116|  25.6k|    ap = a;
  117|  25.6k|    rp = r;
  118|  25.6k|    rp[0] = rp[max - 1] = 0;
  119|  25.6k|    rp++;
  120|  25.6k|    j = n;
  121|       |
  122|  25.6k|    if (--j > 0) {
  ------------------
  |  Branch (122:9): [True: 16.2k, False: 9.40k]
  ------------------
  123|  16.2k|        ap++;
  124|  16.2k|        rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
  125|  16.2k|        rp += 2;
  126|  16.2k|    }
  127|       |
  128|  91.1k|    for (i = n - 2; i > 0; i--) {
  ------------------
  |  Branch (128:21): [True: 65.4k, False: 25.6k]
  ------------------
  129|  65.4k|        j--;
  130|  65.4k|        ap++;
  131|  65.4k|        rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
  132|  65.4k|        rp += 2;
  133|  65.4k|    }
  134|       |
  135|  25.6k|    bn_add_words(r, r, r, max);
  136|       |
  137|       |    /* There will not be a carry */
  138|       |
  139|  25.6k|    bn_sqr_words(tmp, a, n);
  140|       |
  141|  25.6k|    bn_add_words(r, r, tmp, max);
  142|  25.6k|}

BN_mod_sqrt:
   20|  5.99k|{
   21|  5.99k|    BIGNUM *ret = in;
   22|  5.99k|    int err = 1;
   23|  5.99k|    int r;
   24|  5.99k|    BIGNUM *A, *b, *q, *t, *x, *y;
   25|  5.99k|    int e, i, j;
   26|  5.99k|    int used_ctx = 0;
   27|       |
   28|  5.99k|    if (!BN_is_odd(p) || BN_abs_is_word(p, 1)) {
  ------------------
  |  Branch (28:9): [True: 0, False: 5.99k]
  |  Branch (28:26): [True: 0, False: 5.99k]
  ------------------
   29|      0|        if (BN_abs_is_word(p, 2)) {
  ------------------
  |  Branch (29:13): [True: 0, False: 0]
  ------------------
   30|      0|            if (ret == NULL)
  ------------------
  |  Branch (30:17): [True: 0, False: 0]
  ------------------
   31|      0|                ret = BN_new();
   32|      0|            if (ret == NULL)
  ------------------
  |  Branch (32:17): [True: 0, False: 0]
  ------------------
   33|      0|                goto end;
   34|      0|            if (!BN_set_word(ret, BN_is_bit_set(a, 0))) {
  ------------------
  |  Branch (34:17): [True: 0, False: 0]
  ------------------
   35|      0|                if (ret != in)
  ------------------
  |  Branch (35:21): [True: 0, False: 0]
  ------------------
   36|      0|                    BN_free(ret);
   37|      0|                return NULL;
   38|      0|            }
   39|      0|            bn_check_top(ret);
   40|      0|            return ret;
   41|      0|        }
   42|       |
   43|      0|        ERR_raise(ERR_LIB_BN, BN_R_P_IS_NOT_PRIME);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   44|      0|        return NULL;
   45|      0|    }
   46|       |
   47|  5.99k|    if (BN_is_zero(a) || BN_is_one(a)) {
  ------------------
  |  Branch (47:9): [True: 67, False: 5.92k]
  |  Branch (47:26): [True: 10, False: 5.91k]
  ------------------
   48|     77|        if (ret == NULL)
  ------------------
  |  Branch (48:13): [True: 0, False: 77]
  ------------------
   49|      0|            ret = BN_new();
   50|     77|        if (ret == NULL)
  ------------------
  |  Branch (50:13): [True: 0, False: 77]
  ------------------
   51|      0|            goto end;
   52|     77|        if (!BN_set_word(ret, BN_is_one(a))) {
  ------------------
  |  Branch (52:13): [True: 0, False: 77]
  ------------------
   53|      0|            if (ret != in)
  ------------------
  |  Branch (53:17): [True: 0, False: 0]
  ------------------
   54|      0|                BN_free(ret);
   55|      0|            return NULL;
   56|      0|        }
   57|     77|        bn_check_top(ret);
   58|     77|        return ret;
   59|     77|    }
   60|       |
   61|  5.91k|    BN_CTX_start(ctx);
   62|  5.91k|    used_ctx = 1;
   63|  5.91k|    A = BN_CTX_get(ctx);
   64|  5.91k|    b = BN_CTX_get(ctx);
   65|  5.91k|    q = BN_CTX_get(ctx);
   66|  5.91k|    t = BN_CTX_get(ctx);
   67|  5.91k|    x = BN_CTX_get(ctx);
   68|  5.91k|    y = BN_CTX_get(ctx);
   69|  5.91k|    if (y == NULL)
  ------------------
  |  Branch (69:9): [True: 0, False: 5.91k]
  ------------------
   70|      0|        goto end;
   71|       |
   72|  5.91k|    if (ret == NULL)
  ------------------
  |  Branch (72:9): [True: 0, False: 5.91k]
  ------------------
   73|      0|        ret = BN_new();
   74|  5.91k|    if (ret == NULL)
  ------------------
  |  Branch (74:9): [True: 0, False: 5.91k]
  ------------------
   75|      0|        goto end;
   76|       |
   77|       |    /* A = a mod p */
   78|  5.91k|    if (!BN_nnmod(A, a, p, ctx))
  ------------------
  |  Branch (78:9): [True: 0, False: 5.91k]
  ------------------
   79|      0|        goto end;
   80|       |
   81|       |    /* now write  |p| - 1  as  2^e*q  where  q  is odd */
   82|  5.91k|    e = 1;
   83|   212k|    while (!BN_is_bit_set(p, e))
  ------------------
  |  Branch (83:12): [True: 206k, False: 5.91k]
  ------------------
   84|   206k|        e++;
   85|       |    /* we'll set  q  later (if needed) */
   86|       |
   87|  5.91k|    if (e == 1) {
  ------------------
  |  Branch (87:9): [True: 2.64k, False: 3.27k]
  ------------------
   88|       |        /*-
   89|       |         * The easy case:  (|p|-1)/2  is odd, so 2 has an inverse
   90|       |         * modulo  (|p|-1)/2,  and square roots can be computed
   91|       |         * directly by modular exponentiation.
   92|       |         * We have
   93|       |         *     2 * (|p|+1)/4 == 1   (mod (|p|-1)/2),
   94|       |         * so we can use exponent  (|p|+1)/4,  i.e.  (|p|-3)/4 + 1.
   95|       |         */
   96|  2.64k|        if (!BN_rshift(q, p, 2))
  ------------------
  |  Branch (96:13): [True: 0, False: 2.64k]
  ------------------
   97|      0|            goto end;
   98|  2.64k|        q->neg = 0;
   99|  2.64k|        if (!BN_add_word(q, 1))
  ------------------
  |  Branch (99:13): [True: 0, False: 2.64k]
  ------------------
  100|      0|            goto end;
  101|  2.64k|        if (!BN_mod_exp(ret, A, q, p, ctx))
  ------------------
  |  Branch (101:13): [True: 0, False: 2.64k]
  ------------------
  102|      0|            goto end;
  103|  2.64k|        err = 0;
  104|  2.64k|        goto vrfy;
  105|  2.64k|    }
  106|       |
  107|  3.27k|    if (e == 2) {
  ------------------
  |  Branch (107:9): [True: 785, False: 2.48k]
  ------------------
  108|       |        /*-
  109|       |         * |p| == 5  (mod 8)
  110|       |         *
  111|       |         * In this case  2  is always a non-square since
  112|       |         * Legendre(2,p) = (-1)^((p^2-1)/8)  for any odd prime.
  113|       |         * So if  a  really is a square, then  2*a  is a non-square.
  114|       |         * Thus for
  115|       |         *      b := (2*a)^((|p|-5)/8),
  116|       |         *      i := (2*a)*b^2
  117|       |         * we have
  118|       |         *     i^2 = (2*a)^((1 + (|p|-5)/4)*2)
  119|       |         *         = (2*a)^((p-1)/2)
  120|       |         *         = -1;
  121|       |         * so if we set
  122|       |         *      x := a*b*(i-1),
  123|       |         * then
  124|       |         *     x^2 = a^2 * b^2 * (i^2 - 2*i + 1)
  125|       |         *         = a^2 * b^2 * (-2*i)
  126|       |         *         = a*(-i)*(2*a*b^2)
  127|       |         *         = a*(-i)*i
  128|       |         *         = a.
  129|       |         *
  130|       |         * (This is due to A.O.L. Atkin,
  131|       |         * Subject: Square Roots and Cognate Matters modulo p=8n+5.
  132|       |         * URL: https://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind9211&L=NMBRTHRY&P=4026
  133|       |         * November 1992.)
  134|       |         */
  135|       |
  136|       |        /* t := 2*a */
  137|    785|        if (!BN_mod_lshift1_quick(t, A, p))
  ------------------
  |  Branch (137:13): [True: 0, False: 785]
  ------------------
  138|      0|            goto end;
  139|       |
  140|       |        /* b := (2*a)^((|p|-5)/8) */
  141|    785|        if (!BN_rshift(q, p, 3))
  ------------------
  |  Branch (141:13): [True: 0, False: 785]
  ------------------
  142|      0|            goto end;
  143|    785|        q->neg = 0;
  144|    785|        if (!BN_mod_exp(b, t, q, p, ctx))
  ------------------
  |  Branch (144:13): [True: 0, False: 785]
  ------------------
  145|      0|            goto end;
  146|       |
  147|       |        /* y := b^2 */
  148|    785|        if (!BN_mod_sqr(y, b, p, ctx))
  ------------------
  |  Branch (148:13): [True: 0, False: 785]
  ------------------
  149|      0|            goto end;
  150|       |
  151|       |        /* t := (2*a)*b^2 - 1 */
  152|    785|        if (!BN_mod_mul(t, t, y, p, ctx))
  ------------------
  |  Branch (152:13): [True: 0, False: 785]
  ------------------
  153|      0|            goto end;
  154|    785|        if (!BN_sub_word(t, 1))
  ------------------
  |  Branch (154:13): [True: 0, False: 785]
  ------------------
  155|      0|            goto end;
  156|       |
  157|       |        /* x = a*b*t */
  158|    785|        if (!BN_mod_mul(x, A, b, p, ctx))
  ------------------
  |  Branch (158:13): [True: 0, False: 785]
  ------------------
  159|      0|            goto end;
  160|    785|        if (!BN_mod_mul(x, x, t, p, ctx))
  ------------------
  |  Branch (160:13): [True: 0, False: 785]
  ------------------
  161|      0|            goto end;
  162|       |
  163|    785|        if (!BN_copy(ret, x))
  ------------------
  |  Branch (163:13): [True: 0, False: 785]
  ------------------
  164|      0|            goto end;
  165|    785|        err = 0;
  166|    785|        goto vrfy;
  167|    785|    }
  168|       |
  169|       |    /*
  170|       |     * e > 2, so we really have to use the Tonelli/Shanks algorithm. First,
  171|       |     * find some y that is not a square.
  172|       |     */
  173|  2.48k|    if (!BN_copy(q, p))
  ------------------
  |  Branch (173:9): [True: 0, False: 2.48k]
  ------------------
  174|      0|        goto end;               /* use 'q' as temp */
  175|  2.48k|    q->neg = 0;
  176|  2.48k|    i = 2;
  177|  24.1k|    do {
  178|       |        /*
  179|       |         * For efficiency, try small numbers first; if this fails, try random
  180|       |         * numbers.
  181|       |         */
  182|  24.1k|        if (i < 22) {
  ------------------
  |  Branch (182:13): [True: 22.8k, False: 1.23k]
  ------------------
  183|  22.8k|            if (!BN_set_word(y, i))
  ------------------
  |  Branch (183:17): [True: 0, False: 22.8k]
  ------------------
  184|      0|                goto end;
  185|  22.8k|        } else {
  186|  1.23k|            if (!BN_priv_rand_ex(y, BN_num_bits(p), 0, 0, 0, ctx))
  ------------------
  |  Branch (186:17): [True: 0, False: 1.23k]
  ------------------
  187|      0|                goto end;
  188|  1.23k|            if (BN_ucmp(y, p) >= 0) {
  ------------------
  |  Branch (188:17): [True: 619, False: 614]
  ------------------
  189|    619|                if (!(p->neg ? BN_add : BN_sub) (y, y, p))
  ------------------
  |  Branch (189:21): [True: 0, False: 619]
  |  Branch (189:23): [True: 0, False: 619]
  ------------------
  190|      0|                    goto end;
  191|    619|            }
  192|       |            /* now 0 <= y < |p| */
  193|  1.23k|            if (BN_is_zero(y))
  ------------------
  |  Branch (193:17): [True: 0, False: 1.23k]
  ------------------
  194|      0|                if (!BN_set_word(y, i))
  ------------------
  |  Branch (194:21): [True: 0, False: 0]
  ------------------
  195|      0|                    goto end;
  196|  1.23k|        }
  197|       |
  198|  24.1k|        r = BN_kronecker(y, q, ctx); /* here 'q' is |p| */
  199|  24.1k|        if (r < -1)
  ------------------
  |  Branch (199:13): [True: 0, False: 24.1k]
  ------------------
  200|      0|            goto end;
  201|  24.1k|        if (r == 0) {
  ------------------
  |  Branch (201:13): [True: 17, False: 24.1k]
  ------------------
  202|       |            /* m divides p */
  203|     17|            ERR_raise(ERR_LIB_BN, BN_R_P_IS_NOT_PRIME);
  ------------------
  |  |  401|     17|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     17|    (ERR_new(),                                                 \
  |  |  |  |  404|     17|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     17|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     17|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     17|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     17|     ERR_set_error)
  |  |  ------------------
  ------------------
  204|     17|            goto end;
  205|     17|        }
  206|  24.1k|    }
  207|  24.1k|    while (r == 1 && ++i < 82);
  ------------------
  |  Branch (207:12): [True: 21.6k, False: 2.44k]
  |  Branch (207:22): [True: 21.6k, False: 20]
  ------------------
  208|       |
  209|  2.46k|    if (r != -1) {
  ------------------
  |  Branch (209:9): [True: 20, False: 2.44k]
  ------------------
  210|       |        /*
  211|       |         * Many rounds and still no non-square -- this is more likely a bug
  212|       |         * than just bad luck. Even if p is not prime, we should have found
  213|       |         * some y such that r == -1.
  214|       |         */
  215|     20|        ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS);
  ------------------
  |  |  401|     20|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     20|    (ERR_new(),                                                 \
  |  |  |  |  404|     20|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     20|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     20|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     20|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     20|     ERR_set_error)
  |  |  ------------------
  ------------------
  216|     20|        goto end;
  217|     20|    }
  218|       |
  219|       |    /* Here's our actual 'q': */
  220|  2.44k|    if (!BN_rshift(q, q, e))
  ------------------
  |  Branch (220:9): [True: 0, False: 2.44k]
  ------------------
  221|      0|        goto end;
  222|       |
  223|       |    /*
  224|       |     * Now that we have some non-square, we can find an element of order 2^e
  225|       |     * by computing its q'th power.
  226|       |     */
  227|  2.44k|    if (!BN_mod_exp(y, y, q, p, ctx))
  ------------------
  |  Branch (227:9): [True: 0, False: 2.44k]
  ------------------
  228|      0|        goto end;
  229|  2.44k|    if (BN_is_one(y)) {
  ------------------
  |  Branch (229:9): [True: 0, False: 2.44k]
  ------------------
  230|      0|        ERR_raise(ERR_LIB_BN, BN_R_P_IS_NOT_PRIME);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  231|      0|        goto end;
  232|      0|    }
  233|       |
  234|       |    /*-
  235|       |     * Now we know that (if  p  is indeed prime) there is an integer
  236|       |     * k,  0 <= k < 2^e,  such that
  237|       |     *
  238|       |     *      a^q * y^k == 1   (mod p).
  239|       |     *
  240|       |     * As  a^q  is a square and  y  is not,  k  must be even.
  241|       |     * q+1  is even, too, so there is an element
  242|       |     *
  243|       |     *     X := a^((q+1)/2) * y^(k/2),
  244|       |     *
  245|       |     * and it satisfies
  246|       |     *
  247|       |     *     X^2 = a^q * a     * y^k
  248|       |     *         = a,
  249|       |     *
  250|       |     * so it is the square root that we are looking for.
  251|       |     */
  252|       |
  253|       |    /* t := (q-1)/2  (note that  q  is odd) */
  254|  2.44k|    if (!BN_rshift1(t, q))
  ------------------
  |  Branch (254:9): [True: 0, False: 2.44k]
  ------------------
  255|      0|        goto end;
  256|       |
  257|       |    /* x := a^((q-1)/2) */
  258|  2.44k|    if (BN_is_zero(t)) {        /* special case: p = 2^e + 1 */
  ------------------
  |  Branch (258:9): [True: 4, False: 2.44k]
  ------------------
  259|      4|        if (!BN_nnmod(t, A, p, ctx))
  ------------------
  |  Branch (259:13): [True: 0, False: 4]
  ------------------
  260|      0|            goto end;
  261|      4|        if (BN_is_zero(t)) {
  ------------------
  |  Branch (261:13): [True: 0, False: 4]
  ------------------
  262|       |            /* special case: a == 0  (mod p) */
  263|      0|            BN_zero(ret);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  264|      0|            err = 0;
  265|      0|            goto end;
  266|      4|        } else if (!BN_one(x))
  ------------------
  |  |  197|      4|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (266:20): [True: 0, False: 4]
  ------------------
  267|      0|            goto end;
  268|  2.44k|    } else {
  269|  2.44k|        if (!BN_mod_exp(x, A, t, p, ctx))
  ------------------
  |  Branch (269:13): [True: 0, False: 2.44k]
  ------------------
  270|      0|            goto end;
  271|  2.44k|        if (BN_is_zero(x)) {
  ------------------
  |  Branch (271:13): [True: 0, False: 2.44k]
  ------------------
  272|       |            /* special case: a == 0  (mod p) */
  273|      0|            BN_zero(ret);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  274|      0|            err = 0;
  275|      0|            goto end;
  276|      0|        }
  277|  2.44k|    }
  278|       |
  279|       |    /* b := a*x^2  (= a^q) */
  280|  2.44k|    if (!BN_mod_sqr(b, x, p, ctx))
  ------------------
  |  Branch (280:9): [True: 0, False: 2.44k]
  ------------------
  281|      0|        goto end;
  282|  2.44k|    if (!BN_mod_mul(b, b, A, p, ctx))
  ------------------
  |  Branch (282:9): [True: 0, False: 2.44k]
  ------------------
  283|      0|        goto end;
  284|       |
  285|       |    /* x := a*x    (= a^((q+1)/2)) */
  286|  2.44k|    if (!BN_mod_mul(x, x, A, p, ctx))
  ------------------
  |  Branch (286:9): [True: 0, False: 2.44k]
  ------------------
  287|      0|        goto end;
  288|       |
  289|  79.7k|    while (1) {
  ------------------
  |  Branch (289:12): [Folded - Ignored]
  ------------------
  290|       |        /*-
  291|       |         * Now  b  is  a^q * y^k  for some even  k  (0 <= k < 2^E
  292|       |         * where  E  refers to the original value of  e,  which we
  293|       |         * don't keep in a variable),  and  x  is  a^((q+1)/2) * y^(k/2).
  294|       |         *
  295|       |         * We have  a*b = x^2,
  296|       |         *    y^2^(e-1) = -1,
  297|       |         *    b^2^(e-1) = 1.
  298|       |         */
  299|       |
  300|  79.7k|        if (BN_is_one(b)) {
  ------------------
  |  Branch (300:13): [True: 1.85k, False: 77.8k]
  ------------------
  301|  1.85k|            if (!BN_copy(ret, x))
  ------------------
  |  Branch (301:17): [True: 0, False: 1.85k]
  ------------------
  302|      0|                goto end;
  303|  1.85k|            err = 0;
  304|  1.85k|            goto vrfy;
  305|  1.85k|        }
  306|       |
  307|       |        /* Find the smallest i, 0 < i < e, such that b^(2^i) = 1. */
  308|  3.76M|        for (i = 1; i < e; i++) {
  ------------------
  |  Branch (308:21): [True: 3.76M, False: 598]
  ------------------
  309|  3.76M|            if (i == 1) {
  ------------------
  |  Branch (309:17): [True: 77.8k, False: 3.69M]
  ------------------
  310|  77.8k|                if (!BN_mod_sqr(t, b, p, ctx))
  ------------------
  |  Branch (310:21): [True: 0, False: 77.8k]
  ------------------
  311|      0|                    goto end;
  312|       |
  313|  3.69M|            } else {
  314|  3.69M|                if (!BN_mod_mul(t, t, t, p, ctx))
  ------------------
  |  Branch (314:21): [True: 0, False: 3.69M]
  ------------------
  315|      0|                    goto end;
  316|  3.69M|            }
  317|  3.76M|            if (BN_is_one(t))
  ------------------
  |  Branch (317:17): [True: 77.2k, False: 3.69M]
  ------------------
  318|  77.2k|                break;
  319|  3.76M|        }
  320|       |        /* If not found, a is not a square or p is not prime. */
  321|  77.8k|        if (i >= e) {
  ------------------
  |  Branch (321:13): [True: 598, False: 77.2k]
  ------------------
  322|    598|            ERR_raise(ERR_LIB_BN, BN_R_NOT_A_SQUARE);
  ------------------
  |  |  401|    598|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    598|    (ERR_new(),                                                 \
  |  |  |  |  404|    598|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    598|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    598|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    598|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    598|     ERR_set_error)
  |  |  ------------------
  ------------------
  323|    598|            goto end;
  324|    598|        }
  325|       |
  326|       |        /* t := y^2^(e - i - 1) */
  327|  77.2k|        if (!BN_copy(t, y))
  ------------------
  |  Branch (327:13): [True: 0, False: 77.2k]
  ------------------
  328|      0|            goto end;
  329|   149k|        for (j = e - i - 1; j > 0; j--) {
  ------------------
  |  Branch (329:29): [True: 72.5k, False: 77.2k]
  ------------------
  330|  72.5k|            if (!BN_mod_sqr(t, t, p, ctx))
  ------------------
  |  Branch (330:17): [True: 0, False: 72.5k]
  ------------------
  331|      0|                goto end;
  332|  72.5k|        }
  333|  77.2k|        if (!BN_mod_mul(y, t, t, p, ctx))
  ------------------
  |  Branch (333:13): [True: 0, False: 77.2k]
  ------------------
  334|      0|            goto end;
  335|  77.2k|        if (!BN_mod_mul(x, x, t, p, ctx))
  ------------------
  |  Branch (335:13): [True: 0, False: 77.2k]
  ------------------
  336|      0|            goto end;
  337|  77.2k|        if (!BN_mod_mul(b, b, y, p, ctx))
  ------------------
  |  Branch (337:13): [True: 0, False: 77.2k]
  ------------------
  338|      0|            goto end;
  339|  77.2k|        e = i;
  340|  77.2k|    }
  341|       |
  342|  5.28k| vrfy:
  343|  5.28k|    if (!err) {
  ------------------
  |  Branch (343:9): [True: 5.28k, False: 0]
  ------------------
  344|       |        /*
  345|       |         * verify the result -- the input might have been not a square (test
  346|       |         * added in 0.9.8)
  347|       |         */
  348|       |
  349|  5.28k|        if (!BN_mod_sqr(x, ret, p, ctx))
  ------------------
  |  Branch (349:13): [True: 0, False: 5.28k]
  ------------------
  350|      0|            err = 1;
  351|       |
  352|  5.28k|        if (!err && 0 != BN_cmp(x, A)) {
  ------------------
  |  Branch (352:13): [True: 5.28k, False: 0]
  |  Branch (352:21): [True: 974, False: 4.30k]
  ------------------
  353|    974|            ERR_raise(ERR_LIB_BN, BN_R_NOT_A_SQUARE);
  ------------------
  |  |  401|    974|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    974|    (ERR_new(),                                                 \
  |  |  |  |  404|    974|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    974|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    974|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    974|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    974|     ERR_set_error)
  |  |  ------------------
  ------------------
  354|    974|            err = 1;
  355|    974|        }
  356|  5.28k|    }
  357|       |
  358|  5.91k| end:
  359|  5.91k|    if (err) {
  ------------------
  |  Branch (359:9): [True: 1.60k, False: 4.30k]
  ------------------
  360|  1.60k|        if (ret != in)
  ------------------
  |  Branch (360:13): [True: 0, False: 1.60k]
  ------------------
  361|      0|            BN_clear_free(ret);
  362|  1.60k|        ret = NULL;
  363|  1.60k|    }
  364|  5.91k|    if (used_ctx)
  ------------------
  |  Branch (364:9): [True: 5.91k, False: 0]
  ------------------
  365|  5.91k|        BN_CTX_end(ctx);
  366|  5.91k|    bn_check_top(ret);
  367|  5.91k|    return ret;
  368|  5.28k|}

BN_div_word:
   62|  21.0k|{
   63|  21.0k|    BN_ULONG ret = 0;
  ------------------
  |  |   37|  21.0k|#  define BN_ULONG        unsigned long
  ------------------
   64|  21.0k|    int i, j;
   65|       |
   66|  21.0k|    bn_check_top(a);
   67|  21.0k|    w &= BN_MASK2;
  ------------------
  |  |   94|  21.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   68|       |
   69|  21.0k|    if (!w)
  ------------------
  |  Branch (69:9): [True: 0, False: 21.0k]
  ------------------
   70|       |        /* actually this an error (division by zero) */
   71|      0|        return (BN_ULONG)-1;
   72|  21.0k|    if (a->top == 0)
  ------------------
  |  Branch (72:9): [True: 0, False: 21.0k]
  ------------------
   73|      0|        return 0;
   74|       |
   75|       |    /* normalize input (so bn_div_words doesn't complain) */
   76|  21.0k|    j = BN_BITS2 - BN_num_bits_word(w);
  ------------------
  |  |   54|  21.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  21.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   77|  21.0k|    w <<= j;
   78|  21.0k|    if (!BN_lshift(a, a, j))
  ------------------
  |  Branch (78:9): [True: 0, False: 21.0k]
  ------------------
   79|      0|        return (BN_ULONG)-1;
   80|       |
   81|  54.2k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (81:26): [True: 33.1k, False: 21.0k]
  ------------------
   82|  33.1k|        BN_ULONG l, d;
  ------------------
  |  |   37|  33.1k|#  define BN_ULONG        unsigned long
  ------------------
   83|       |
   84|  33.1k|        l = a->d[i];
   85|  33.1k|        d = bn_div_words(ret, l, w);
   86|  33.1k|        ret = (l - ((d * w) & BN_MASK2)) & BN_MASK2;
  ------------------
  |  |   94|  33.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
                      ret = (l - ((d * w) & BN_MASK2)) & BN_MASK2;
  ------------------
  |  |   94|  33.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   87|  33.1k|        a->d[i] = d;
   88|  33.1k|    }
   89|  21.0k|    if ((a->top > 0) && (a->d[a->top - 1] == 0))
  ------------------
  |  Branch (89:9): [True: 21.0k, False: 0]
  |  Branch (89:25): [True: 20.2k, False: 814]
  ------------------
   90|  20.2k|        a->top--;
   91|  21.0k|    ret >>= j;
   92|  21.0k|    if (!a->top)
  ------------------
  |  Branch (92:9): [True: 14.3k, False: 6.72k]
  ------------------
   93|  14.3k|        a->neg = 0; /* don't allow negative zero */
   94|  21.0k|    bn_check_top(a);
   95|  21.0k|    return ret;
   96|  21.0k|}
BN_add_word:
   99|  43.7k|{
  100|  43.7k|    BN_ULONG l;
  ------------------
  |  |   37|  43.7k|#  define BN_ULONG        unsigned long
  ------------------
  101|  43.7k|    int i;
  102|       |
  103|  43.7k|    bn_check_top(a);
  104|  43.7k|    w &= BN_MASK2;
  ------------------
  |  |   94|  43.7k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  105|       |
  106|       |    /* degenerate case: w is zero */
  107|  43.7k|    if (!w)
  ------------------
  |  Branch (107:9): [True: 7.60k, False: 36.1k]
  ------------------
  108|  7.60k|        return 1;
  109|       |    /* degenerate case: a is zero */
  110|  36.1k|    if (BN_is_zero(a))
  ------------------
  |  Branch (110:9): [True: 1.02k, False: 35.0k]
  ------------------
  111|  1.02k|        return BN_set_word(a, w);
  112|       |    /* handle 'a' when negative */
  113|  35.0k|    if (a->neg) {
  ------------------
  |  Branch (113:9): [True: 0, False: 35.0k]
  ------------------
  114|      0|        a->neg = 0;
  115|      0|        i = BN_sub_word(a, w);
  116|      0|        if (!BN_is_zero(a))
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|            a->neg = !(a->neg);
  118|      0|        return i;
  119|      0|    }
  120|  82.0k|    for (i = 0; w != 0 && i < a->top; i++) {
  ------------------
  |  Branch (120:17): [True: 47.0k, False: 35.0k]
  |  Branch (120:27): [True: 46.9k, False: 65]
  ------------------
  121|  46.9k|        a->d[i] = l = (a->d[i] + w) & BN_MASK2;
  ------------------
  |  |   94|  46.9k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  122|  46.9k|        w = (w > l) ? 1 : 0;
  ------------------
  |  Branch (122:13): [True: 11.9k, False: 35.0k]
  ------------------
  123|  46.9k|    }
  124|  35.0k|    if (w && i == a->top) {
  ------------------
  |  Branch (124:9): [True: 65, False: 35.0k]
  |  Branch (124:14): [True: 65, False: 0]
  ------------------
  125|     65|        if (bn_wexpand(a, a->top + 1) == NULL)
  ------------------
  |  Branch (125:13): [True: 0, False: 65]
  ------------------
  126|      0|            return 0;
  127|     65|        a->top++;
  128|     65|        a->d[i] = w;
  129|     65|    }
  130|  35.0k|    bn_check_top(a);
  131|  35.0k|    return 1;
  132|  35.0k|}
BN_sub_word:
  135|  27.4k|{
  136|  27.4k|    int i;
  137|       |
  138|  27.4k|    bn_check_top(a);
  139|  27.4k|    w &= BN_MASK2;
  ------------------
  |  |   94|  27.4k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  140|       |
  141|       |    /* degenerate case: w is zero */
  142|  27.4k|    if (!w)
  ------------------
  |  Branch (142:9): [True: 0, False: 27.4k]
  ------------------
  143|      0|        return 1;
  144|       |    /* degenerate case: a is zero */
  145|  27.4k|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (145:9): [True: 0, False: 27.4k]
  ------------------
  146|      0|        i = BN_set_word(a, w);
  147|      0|        if (i != 0)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            BN_set_negative(a, 1);
  149|      0|        return i;
  150|      0|    }
  151|       |    /* handle 'a' when negative */
  152|  27.4k|    if (a->neg) {
  ------------------
  |  Branch (152:9): [True: 0, False: 27.4k]
  ------------------
  153|      0|        a->neg = 0;
  154|      0|        i = BN_add_word(a, w);
  155|      0|        a->neg = 1;
  156|      0|        return i;
  157|      0|    }
  158|       |
  159|  27.4k|    if ((a->top == 1) && (a->d[0] < w)) {
  ------------------
  |  Branch (159:9): [True: 474, False: 26.9k]
  |  Branch (159:26): [True: 0, False: 474]
  ------------------
  160|      0|        a->d[0] = w - a->d[0];
  161|      0|        a->neg = 1;
  162|      0|        return 1;
  163|      0|    }
  164|  27.4k|    i = 0;
  165|  53.4k|    for (;;) {
  166|  53.4k|        if (a->d[i] >= w) {
  ------------------
  |  Branch (166:13): [True: 27.4k, False: 25.9k]
  ------------------
  167|  27.4k|            a->d[i] -= w;
  168|  27.4k|            break;
  169|  27.4k|        } else {
  170|  25.9k|            a->d[i] = (a->d[i] - w) & BN_MASK2;
  ------------------
  |  |   94|  25.9k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  171|  25.9k|            i++;
  172|  25.9k|            w = 1;
  173|  25.9k|        }
  174|  53.4k|    }
  175|  27.4k|    if ((a->d[i] == 0) && (i == (a->top - 1)))
  ------------------
  |  Branch (175:9): [True: 4.17k, False: 23.2k]
  |  Branch (175:27): [True: 3.83k, False: 346]
  ------------------
  176|  3.83k|        a->top--;
  177|  27.4k|    bn_check_top(a);
  178|  27.4k|    return 1;
  179|  27.4k|}
BN_mul_word:
  182|  92.3k|{
  183|  92.3k|    BN_ULONG ll;
  ------------------
  |  |   37|  92.3k|#  define BN_ULONG        unsigned long
  ------------------
  184|       |
  185|  92.3k|    bn_check_top(a);
  186|  92.3k|    w &= BN_MASK2;
  ------------------
  |  |   94|  92.3k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  187|  92.3k|    if (a->top) {
  ------------------
  |  Branch (187:9): [True: 92.3k, False: 0]
  ------------------
  188|  92.3k|        if (w == 0)
  ------------------
  |  Branch (188:13): [True: 0, False: 92.3k]
  ------------------
  189|      0|            BN_zero(a);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  190|  92.3k|        else {
  191|  92.3k|            ll = bn_mul_words(a->d, a->d, a->top, w);
  192|  92.3k|            if (ll) {
  ------------------
  |  Branch (192:17): [True: 88.6k, False: 3.62k]
  ------------------
  193|  88.6k|                if (bn_wexpand(a, a->top + 1) == NULL)
  ------------------
  |  Branch (193:21): [True: 0, False: 88.6k]
  ------------------
  194|      0|                    return 0;
  195|  88.6k|                a->d[a->top++] = ll;
  196|  88.6k|            }
  197|  92.3k|        }
  198|  92.3k|    }
  199|  92.3k|    bn_check_top(a);
  200|  92.3k|    return 1;
  201|  92.3k|}

RSAZ_512_mod_exp:
  258|      1|{
  259|      1|    unsigned char storage[16 * 8 * 8 + 64 * 2 + 64]; /* 1.2KB */
  260|      1|    unsigned char *table = storage + (64 - ((size_t)storage % 64));
  261|      1|    BN_ULONG *a_inv = (BN_ULONG *)(table + 16 * 8 * 8);
  ------------------
  |  |   37|      1|#  define BN_ULONG        unsigned long
  ------------------
  262|      1|    BN_ULONG *temp = (BN_ULONG *)(table + 16 * 8 * 8 + 8 * 8);
  ------------------
  |  |   37|      1|#  define BN_ULONG        unsigned long
  ------------------
  263|      1|    unsigned char *p_str = (unsigned char *)exponent;
  264|      1|    int index;
  265|      1|    unsigned int wvalue;
  266|      1|    BN_ULONG tmp[8];
  ------------------
  |  |   37|      1|#  define BN_ULONG        unsigned long
  ------------------
  267|       |
  268|       |    /* table[0] = 1_inv */
  269|      1|    temp[0] = 0 - m[0];
  270|      1|    temp[1] = ~m[1];
  271|      1|    temp[2] = ~m[2];
  272|      1|    temp[3] = ~m[3];
  273|      1|    temp[4] = ~m[4];
  274|      1|    temp[5] = ~m[5];
  275|      1|    temp[6] = ~m[6];
  276|      1|    temp[7] = ~m[7];
  277|      1|    rsaz_512_scatter4(table, temp, 0);
  278|       |
  279|       |    /* table [1] = a_inv^1 */
  280|      1|    rsaz_512_mul(a_inv, base, RR, m, k0);
  281|      1|    rsaz_512_scatter4(table, a_inv, 1);
  282|       |
  283|       |    /* table [2] = a_inv^2 */
  284|      1|    rsaz_512_sqr(temp, a_inv, m, k0, 1);
  285|      1|    rsaz_512_scatter4(table, temp, 2);
  286|       |
  287|     14|    for (index = 3; index < 16; index++)
  ------------------
  |  Branch (287:21): [True: 13, False: 1]
  ------------------
  288|     13|        rsaz_512_mul_scatter4(temp, a_inv, m, k0, table, index);
  289|       |
  290|       |    /* load first window */
  291|      1|    wvalue = p_str[63];
  292|       |
  293|      1|    rsaz_512_gather4(temp, table, wvalue >> 4);
  294|      1|    rsaz_512_sqr(temp, temp, m, k0, 4);
  295|      1|    rsaz_512_mul_gather4(temp, temp, table, m, k0, wvalue & 0xf);
  296|       |
  297|     64|    for (index = 62; index >= 0; index--) {
  ------------------
  |  Branch (297:22): [True: 63, False: 1]
  ------------------
  298|     63|        wvalue = p_str[index];
  299|       |
  300|     63|        rsaz_512_sqr(temp, temp, m, k0, 4);
  301|     63|        rsaz_512_mul_gather4(temp, temp, table, m, k0, wvalue >> 4);
  302|       |
  303|     63|        rsaz_512_sqr(temp, temp, m, k0, 4);
  304|     63|        rsaz_512_mul_gather4(temp, temp, table, m, k0, wvalue & 0x0f);
  305|     63|    }
  306|       |
  307|       |    /* from Montgomery */
  308|      1|    rsaz_512_mul_by_one(result, temp, m, k0);
  309|       |
  310|      1|    bn_reduce_once_in_place(result, /*carry=*/0, m, tmp, 8);
  311|       |
  312|      1|    OPENSSL_cleanse(storage, sizeof(storage));
  313|      1|    OPENSSL_cleanse(tmp, sizeof(tmp));
  314|      1|}

rsaz_exp.c:bn_reduce_once_in_place:
   72|      1|{
   73|      1|    carry -= bn_sub_words(tmp, r, m, num);
   74|      1|    bn_select_words(r, carry, r /* tmp < 0 */, tmp /* tmp >= 0 */, num);
   75|      1|    return carry;
   76|      1|}
rsaz_exp.c:bn_select_words:
   60|      1|{
   61|      1|    size_t i;
   62|       |
   63|      9|    for (i = 0; i < num; i++) {
  ------------------
  |  Branch (63:17): [True: 8, False: 1]
  ------------------
   64|      8|        r[i] = constant_time_select_64(mask, a[i], b[i]);
   65|      8|    }
   66|      1|}

ossl_bsearch:
   16|  3.05M|{
   17|  3.05M|    const char *base_ = base;
   18|  3.05M|    int l, h, i = 0, c = 0;
   19|  3.05M|    const char *p = NULL;
   20|       |
   21|  3.05M|    if (num == 0)
  ------------------
  |  Branch (21:9): [True: 0, False: 3.05M]
  ------------------
   22|      0|        return NULL;
   23|  3.05M|    l = 0;
   24|  3.05M|    h = num;
   25|  32.0M|    while (l < h) {
  ------------------
  |  Branch (25:12): [True: 29.6M, False: 2.38M]
  ------------------
   26|  29.6M|        i = (l + h) / 2;
   27|  29.6M|        p = &(base_[i * size]);
   28|  29.6M|        c = (*cmp) (key, p);
   29|  29.6M|        if (c < 0)
  ------------------
  |  Branch (29:13): [True: 22.1M, False: 7.56M]
  ------------------
   30|  22.1M|            h = i;
   31|  7.56M|        else if (c > 0)
  ------------------
  |  Branch (31:18): [True: 6.89M, False: 671k]
  ------------------
   32|  6.89M|            l = i + 1;
   33|   671k|        else
   34|   671k|            break;
   35|  29.6M|    }
   36|  3.05M|    if (c != 0 && !(flags & OSSL_BSEARCH_VALUE_ON_NOMATCH))
  ------------------
  |  |  149|  2.38M|# define OSSL_BSEARCH_VALUE_ON_NOMATCH            0x01
  ------------------
  |  Branch (36:9): [True: 2.38M, False: 671k]
  |  Branch (36:19): [True: 2.38M, False: 0]
  ------------------
   37|  2.38M|        p = NULL;
   38|   671k|    else if (c == 0 && (flags & OSSL_BSEARCH_FIRST_VALUE_ON_MATCH)) {
  ------------------
  |  |  150|   671k|# define OSSL_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
  ------------------
  |  Branch (38:14): [True: 671k, False: 0]
  |  Branch (38:24): [True: 0, False: 671k]
  ------------------
   39|      0|        while (i > 0 && (*cmp) (key, &(base_[(i - 1) * size])) == 0)
  ------------------
  |  Branch (39:16): [True: 0, False: 0]
  |  Branch (39:25): [True: 0, False: 0]
  ------------------
   40|      0|            i--;
   41|      0|        p = &(base_[i * size]);
   42|      0|    }
   43|  3.05M|    return p;
   44|  3.05M|}

ossl_err_load_BUF_strings:
   24|      2|{
   25|      2|#ifndef OPENSSL_NO_ERR
   26|      2|    if (ERR_reason_error_string(BUF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (26:9): [True: 2, False: 0]
  ------------------
   27|      2|        ERR_load_strings_const(BUF_str_reasons);
   28|      2|#endif
   29|      2|    return 1;
   30|      2|}

BUF_MEM_new_ex:
   22|  78.1k|{
   23|  78.1k|    BUF_MEM *ret;
   24|       |
   25|  78.1k|    ret = BUF_MEM_new();
   26|  78.1k|    if (ret != NULL)
  ------------------
  |  Branch (26:9): [True: 78.1k, False: 0]
  ------------------
   27|  78.1k|        ret->flags = flags;
   28|  78.1k|    return ret;
   29|  78.1k|}
BUF_MEM_new:
   32|   616k|{
   33|   616k|    BUF_MEM *ret;
   34|       |
   35|   616k|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|   616k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   616k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   616k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   36|   616k|    if (ret == NULL)
  ------------------
  |  Branch (36:9): [True: 0, False: 616k]
  ------------------
   37|      0|        return NULL;
   38|   616k|    return ret;
   39|   616k|}
BUF_MEM_free:
   42|   403k|{
   43|   403k|    if (a == NULL)
  ------------------
  |  Branch (43:9): [True: 0, False: 403k]
  ------------------
   44|      0|        return;
   45|   403k|    if (a->data != NULL) {
  ------------------
  |  Branch (45:9): [True: 137k, False: 266k]
  ------------------
   46|   137k|        if (a->flags & BUF_MEM_FLAG_SECURE)
  ------------------
  |  |   49|   137k|# define BUF_MEM_FLAG_SECURE  0x01
  ------------------
  |  Branch (46:13): [True: 0, False: 137k]
  ------------------
   47|      0|            OPENSSL_secure_clear_free(a->data, a->max);
  ------------------
  |  |  121|      0|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   48|   137k|        else
   49|   137k|            OPENSSL_clear_free(a->data, a->max);
  ------------------
  |  |  105|   137k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   137k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   137k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   50|   137k|    }
   51|   403k|    OPENSSL_free(a);
  ------------------
  |  |  107|   403k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   403k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   403k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   52|   403k|}
BUF_MEM_grow:
   72|   170k|{
   73|   170k|    char *ret;
   74|   170k|    size_t n;
   75|       |
   76|   170k|    if (str->length >= len) {
  ------------------
  |  Branch (76:9): [True: 626, False: 169k]
  ------------------
   77|    626|        str->length = len;
   78|    626|        return len;
   79|    626|    }
   80|   169k|    if (str->max >= len) {
  ------------------
  |  Branch (80:9): [True: 83.1k, False: 86.2k]
  ------------------
   81|  83.1k|        if (str->data != NULL)
  ------------------
  |  Branch (81:13): [True: 83.1k, False: 0]
  ------------------
   82|  83.1k|            memset(&str->data[str->length], 0, len - str->length);
   83|  83.1k|        str->length = len;
   84|  83.1k|        return len;
   85|  83.1k|    }
   86|       |    /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
   87|  86.2k|    if (len > LIMIT_BEFORE_EXPANSION) {
  ------------------
  |  |   19|  86.2k|#define LIMIT_BEFORE_EXPANSION 0x5ffffffc
  ------------------
  |  Branch (87:9): [True: 0, False: 86.2k]
  ------------------
   88|      0|        ERR_raise(ERR_LIB_BUF, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   89|      0|        return 0;
   90|      0|    }
   91|  86.2k|    n = (len + 3) / 3 * 4;
   92|  86.2k|    if ((str->flags & BUF_MEM_FLAG_SECURE))
  ------------------
  |  |   49|  86.2k|# define BUF_MEM_FLAG_SECURE  0x01
  ------------------
  |  Branch (92:9): [True: 0, False: 86.2k]
  ------------------
   93|      0|        ret = sec_alloc_realloc(str, n);
   94|  86.2k|    else
   95|  86.2k|        ret = OPENSSL_realloc(str->data, n);
  ------------------
  |  |  101|  86.2k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  86.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  86.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   96|  86.2k|    if (ret == NULL) {
  ------------------
  |  Branch (96:9): [True: 0, False: 86.2k]
  ------------------
   97|      0|        len = 0;
   98|  86.2k|    } else {
   99|  86.2k|        str->data = ret;
  100|  86.2k|        str->max = n;
  101|  86.2k|        memset(&str->data[str->length], 0, len - str->length);
  102|  86.2k|        str->length = len;
  103|  86.2k|    }
  104|  86.2k|    return len;
  105|  86.2k|}
BUF_MEM_grow_clean:
  108|   120M|{
  109|   120M|    char *ret;
  110|   120M|    size_t n;
  111|       |
  112|   120M|    if (str->length >= len) {
  ------------------
  |  Branch (112:9): [True: 1.80k, False: 120M]
  ------------------
  113|  1.80k|        if (str->data != NULL)
  ------------------
  |  Branch (113:13): [True: 1.80k, False: 0]
  ------------------
  114|  1.80k|            memset(&str->data[len], 0, str->length - len);
  115|  1.80k|        str->length = len;
  116|  1.80k|        return len;
  117|  1.80k|    }
  118|   120M|    if (str->max >= len) {
  ------------------
  |  Branch (118:9): [True: 119M, False: 1.26M]
  ------------------
  119|   119M|        memset(&str->data[str->length], 0, len - str->length);
  120|   119M|        str->length = len;
  121|   119M|        return len;
  122|   119M|    }
  123|       |    /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
  124|  1.26M|    if (len > LIMIT_BEFORE_EXPANSION) {
  ------------------
  |  |   19|  1.26M|#define LIMIT_BEFORE_EXPANSION 0x5ffffffc
  ------------------
  |  Branch (124:9): [True: 0, False: 1.26M]
  ------------------
  125|      0|        ERR_raise(ERR_LIB_BUF, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  126|      0|        return 0;
  127|      0|    }
  128|  1.26M|    n = (len + 3) / 3 * 4;
  129|  1.26M|    if ((str->flags & BUF_MEM_FLAG_SECURE))
  ------------------
  |  |   49|  1.26M|# define BUF_MEM_FLAG_SECURE  0x01
  ------------------
  |  Branch (129:9): [True: 0, False: 1.26M]
  ------------------
  130|      0|        ret = sec_alloc_realloc(str, n);
  131|  1.26M|    else
  132|  1.26M|        ret = OPENSSL_clear_realloc(str->data, str->max, n);
  ------------------
  |  |  103|  1.26M|        CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.26M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.26M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  133|  1.26M|    if (ret == NULL) {
  ------------------
  |  Branch (133:9): [True: 0, False: 1.26M]
  ------------------
  134|      0|        len = 0;
  135|  1.26M|    } else {
  136|  1.26M|        str->data = ret;
  137|  1.26M|        str->max = n;
  138|  1.26M|        memset(&str->data[str->length], 0, len - str->length);
  139|  1.26M|        str->length = len;
  140|  1.26M|    }
  141|  1.26M|    return len;
  142|  1.26M|}

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

OSSL_CMP_log_close:
   41|      2|{
   42|      2|    (void)OSSL_trace_set_channel(OSSL_TRACE_CATEGORY_CMP, NULL);
  ------------------
  |  |   53|      2|# define OSSL_TRACE_CATEGORY_CMP                13
  ------------------
   43|      2|}

cms_asn1.c:cms_si_cb:
   48|  11.3k|{
   49|  11.3k|    if (operation == ASN1_OP_FREE_POST) {
  ------------------
  |  |  745|  11.3k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (49:9): [True: 1.28k, False: 10.1k]
  ------------------
   50|  1.28k|        CMS_SignerInfo *si = (CMS_SignerInfo *)*pval;
   51|  1.28k|        EVP_PKEY_free(si->pkey);
   52|  1.28k|        X509_free(si->signer);
   53|  1.28k|        EVP_MD_CTX_free(si->mctx);
   54|  1.28k|    }
   55|  11.3k|    return 1;
   56|  11.3k|}
cms_asn1.c:cms_rek_cb:
  124|  1.61k|{
  125|  1.61k|    CMS_RecipientEncryptedKey *rek = (CMS_RecipientEncryptedKey *)*pval;
  126|  1.61k|    if (operation == ASN1_OP_FREE_POST) {
  ------------------
  |  |  745|  1.61k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (126:9): [True: 272, False: 1.34k]
  ------------------
  127|    272|        EVP_PKEY_free(rek->pkey);
  128|    272|    }
  129|  1.61k|    return 1;
  130|  1.61k|}
cms_asn1.c:cms_kari_cb:
  150|  11.9k|{
  151|  11.9k|    CMS_KeyAgreeRecipientInfo *kari = (CMS_KeyAgreeRecipientInfo *)*pval;
  152|  11.9k|    if (operation == ASN1_OP_NEW_POST) {
  ------------------
  |  |  743|  11.9k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (152:9): [True: 1.35k, False: 10.5k]
  ------------------
  153|  1.35k|        kari->ctx = EVP_CIPHER_CTX_new();
  154|  1.35k|        if (kari->ctx == NULL)
  ------------------
  |  Branch (154:13): [True: 0, False: 1.35k]
  ------------------
  155|      0|            return 0;
  156|  1.35k|        EVP_CIPHER_CTX_set_flags(kari->ctx, EVP_CIPHER_CTX_FLAG_WRAP_ALLOW);
  ------------------
  |  |  362|  1.35k|# define         EVP_CIPHER_CTX_FLAG_WRAP_ALLOW  0x1
  ------------------
  157|  1.35k|        kari->pctx = NULL;
  158|  10.5k|    } else if (operation == ASN1_OP_FREE_POST) {
  ------------------
  |  |  745|  10.5k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (158:16): [True: 1.35k, False: 9.22k]
  ------------------
  159|  1.35k|        EVP_PKEY_CTX_free(kari->pctx);
  160|  1.35k|        EVP_CIPHER_CTX_free(kari->ctx);
  161|  1.35k|    }
  162|  11.9k|    return 1;
  163|  11.9k|}
cms_asn1.c:cms_ri_cb:
  201|  35.9k|{
  202|  35.9k|    if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|  35.9k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (202:9): [True: 5.26k, False: 30.6k]
  ------------------
  203|  5.26k|        CMS_RecipientInfo *ri = (CMS_RecipientInfo *)*pval;
  204|  5.26k|        if (ri->type == CMS_RECIPINFO_TRANS) {
  ------------------
  |  |  164|  5.26k|# define CMS_RECIPINFO_TRANS             0
  ------------------
  |  Branch (204:13): [True: 76, False: 5.18k]
  ------------------
  205|     76|            CMS_KeyTransRecipientInfo *ktri = ri->d.ktri;
  206|     76|            EVP_PKEY_free(ktri->pkey);
  207|     76|            X509_free(ktri->recip);
  208|     76|            EVP_PKEY_CTX_free(ktri->pctx);
  209|  5.18k|        } else if (ri->type == CMS_RECIPINFO_KEK) {
  ------------------
  |  |  166|  5.18k|# define CMS_RECIPINFO_KEK               2
  ------------------
  |  Branch (209:20): [True: 130, False: 5.05k]
  ------------------
  210|    130|            CMS_KEKRecipientInfo *kekri = ri->d.kekri;
  211|    130|            OPENSSL_clear_free(kekri->key, kekri->keylen);
  ------------------
  |  |  105|    130|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    130|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    130|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  212|  5.05k|        } else if (ri->type == CMS_RECIPINFO_PASS) {
  ------------------
  |  |  167|  5.05k|# define CMS_RECIPINFO_PASS              3
  ------------------
  |  Branch (212:20): [True: 2.89k, False: 2.15k]
  ------------------
  213|  2.89k|            CMS_PasswordRecipientInfo *pwri = ri->d.pwri;
  214|  2.89k|            OPENSSL_clear_free(pwri->pass, pwri->passlen);
  ------------------
  |  |  105|  2.89k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.89k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.89k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  215|  2.89k|        }
  216|  5.26k|    }
  217|  35.9k|    return 1;
  218|  35.9k|}
cms_asn1.c:cms_cb:
  296|  47.9k|{
  297|  47.9k|    ASN1_STREAM_ARG *sarg = exarg;
  298|  47.9k|    CMS_ContentInfo *cms = NULL;
  299|  47.9k|    if (pval)
  ------------------
  |  Branch (299:9): [True: 47.9k, False: 0]
  ------------------
  300|  47.9k|        cms = (CMS_ContentInfo *)*pval;
  301|      0|    else
  302|      0|        return 1;
  303|  47.9k|    switch (operation) {
  ------------------
  |  Branch (303:13): [True: 47.9k, False: 0]
  ------------------
  304|       |
  305|      0|    case ASN1_OP_STREAM_PRE:
  ------------------
  |  |  752|      0|# define ASN1_OP_STREAM_PRE      10
  ------------------
  |  Branch (305:5): [True: 0, False: 47.9k]
  ------------------
  306|      0|        if (CMS_stream(&sarg->boundary, cms) <= 0)
  ------------------
  |  Branch (306:13): [True: 0, False: 0]
  ------------------
  307|      0|            return 0;
  308|       |        /* fall through */
  309|      0|    case ASN1_OP_DETACHED_PRE:
  ------------------
  |  |  754|      0|# define ASN1_OP_DETACHED_PRE    12
  ------------------
  |  Branch (309:5): [True: 0, False: 47.9k]
  ------------------
  310|      0|        sarg->ndef_bio = CMS_dataInit(cms, sarg->out);
  311|      0|        if (!sarg->ndef_bio)
  ------------------
  |  Branch (311:13): [True: 0, False: 0]
  ------------------
  312|      0|            return 0;
  313|      0|        break;
  314|       |
  315|      0|    case ASN1_OP_STREAM_POST:
  ------------------
  |  |  753|      0|# define ASN1_OP_STREAM_POST     11
  ------------------
  |  Branch (315:5): [True: 0, False: 47.9k]
  ------------------
  316|      0|    case ASN1_OP_DETACHED_POST:
  ------------------
  |  |  755|      0|# define ASN1_OP_DETACHED_POST   13
  ------------------
  |  Branch (316:5): [True: 0, False: 47.9k]
  ------------------
  317|      0|        if (CMS_dataFinal(cms, sarg->ndef_bio) <= 0)
  ------------------
  |  Branch (317:13): [True: 0, False: 0]
  ------------------
  318|      0|            return 0;
  319|      0|        break;
  320|       |
  321|  47.9k|    }
  322|  47.9k|    return 1;
  323|  47.9k|}

ossl_err_load_CMS_strings:
  171|      2|{
  172|      2|# ifndef OPENSSL_NO_ERR
  173|      2|    if (ERR_reason_error_string(CMS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (173:9): [True: 2, False: 0]
  ------------------
  174|      2|        ERR_load_strings_const(CMS_str_reasons);
  175|      2|# endif
  176|      2|    return 1;
  177|      2|}

ossl_comp_brotli_cleanup:
  353|      2|{
  354|       |#ifdef BROTLI_SHARED
  355|       |    DSO_free(brotli_encode_dso);
  356|       |    brotli_encode_dso = NULL;
  357|       |    DSO_free(brotli_decode_dso);
  358|       |    brotli_decode_dso = NULL;
  359|       |    p_encode_init = NULL;
  360|       |    p_encode_stream = NULL;
  361|       |    p_encode_has_more = NULL;
  362|       |    p_encode_end = NULL;
  363|       |    p_encode_oneshot = NULL;
  364|       |    p_decode_init = NULL;
  365|       |    p_decode_stream = NULL;
  366|       |    p_decode_has_more = NULL;
  367|       |    p_decode_end = NULL;
  368|       |    p_decode_error = NULL;
  369|       |    p_decode_error_string = NULL;
  370|       |    p_decode_is_finished = NULL;
  371|       |    p_decode_oneshot = NULL;
  372|       |#endif
  373|      2|}

COMP_zlib:
  311|      2|{
  312|      2|    COMP_METHOD *meth = NULL;
  313|       |
  314|       |#ifndef OPENSSL_NO_ZLIB
  315|       |    if (RUN_ONCE(&zlib_once, ossl_comp_zlib_init))
  316|       |        meth = &zlib_stateful_method;
  317|       |#endif
  318|       |
  319|      2|    return meth;
  320|      2|}
ossl_comp_zlib_cleanup:
  336|      2|{
  337|       |#ifdef ZLIB_SHARED
  338|       |    DSO_free(zlib_dso);
  339|       |    zlib_dso = NULL;
  340|       |#endif
  341|      2|}

ossl_comp_zstd_cleanup:
  428|      2|{
  429|       |#ifdef ZSTD_SHARED
  430|       |    DSO_free(zstd_dso);
  431|       |    zstd_dso = NULL;
  432|       |    p_createCStream = NULL;
  433|       |    p_initCStream = NULL;
  434|       |    p_freeCStream = NULL;
  435|       |    p_compressStream2 = NULL;
  436|       |    p_flushStream = NULL;
  437|       |    p_endStream = NULL;
  438|       |    p_compress = NULL;
  439|       |    p_createDStream = NULL;
  440|       |    p_initDStream = NULL;
  441|       |    p_freeDStream = NULL;
  442|       |    p_decompressStream = NULL;
  443|       |    p_decompress = NULL;
  444|       |    p_isError = NULL;
  445|       |    p_getErrorName = NULL;
  446|       |    p_DStreamInSize = NULL;
  447|       |    p_CStreamInSize = NULL;
  448|       |#endif
  449|      2|}

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

COMP_get_type:
   41|      2|{
   42|      2|    if (meth == NULL)
  ------------------
  |  Branch (42:9): [True: 2, False: 0]
  ------------------
   43|      2|        return NID_undef;
  ------------------
  |  |   18|      2|#define NID_undef                       0
  ------------------
   44|      0|    return meth->type;
   45|      2|}

_CONF_free_data:
  137|      2|{
  138|      2|    if (conf == NULL)
  ------------------
  |  Branch (138:9): [True: 0, False: 2]
  ------------------
  139|      0|        return;
  140|       |
  141|      2|    OPENSSL_free(conf->includedir);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  142|      2|    if (conf->data == NULL)
  ------------------
  |  Branch (142:9): [True: 2, False: 0]
  ------------------
  143|      2|        return;
  144|       |
  145|       |    /* evil thing to make sure the 'OPENSSL_free()' works as expected */
  146|      0|    lh_CONF_VALUE_set_down_load(conf->data, 0);
  ------------------
  |  |   83|      0|#define lh_CONF_VALUE_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_CONF_VALUE_lh_type(lh), dl)
  ------------------
  147|      0|    lh_CONF_VALUE_doall_LH_CONF_VALUE(conf->data, value_free_hash, conf->data);
  148|       |
  149|       |    /*
  150|       |     * We now have only 'section' entries in the hash table. Due to problems
  151|       |     * with
  152|       |     */
  153|       |
  154|      0|    lh_CONF_VALUE_doall(conf->data, value_free_stack_doall);
  ------------------
  |  |   84|      0|#define lh_CONF_VALUE_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_doallfunc_type(dfn))
  ------------------
  155|      0|    lh_CONF_VALUE_free(conf->data);
  ------------------
  |  |   72|      0|#define lh_CONF_VALUE_free(lh) OPENSSL_LH_free(ossl_check_CONF_VALUE_lh_type(lh))
  ------------------
  156|      0|}

NCONF_default:
   87|      2|{
   88|      2|    return &default_method;
   89|      2|}
conf_def.c:def_create:
  112|      2|{
  113|      2|    CONF *ret;
  114|       |
  115|      2|    ret = OPENSSL_malloc(sizeof(*ret));
  ------------------
  |  |   97|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  116|      2|    if (ret != NULL)
  ------------------
  |  Branch (116:9): [True: 2, False: 0]
  ------------------
  117|      2|        if (meth->init(ret) == 0) {
  ------------------
  |  Branch (117:13): [True: 0, False: 2]
  ------------------
  118|      0|            OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  119|      0|            ret = NULL;
  120|      0|        }
  121|      2|    return ret;
  122|      2|}
conf_def.c:def_init_default:
  125|      2|{
  126|      2|    if (conf == NULL)
  ------------------
  |  Branch (126:9): [True: 0, False: 2]
  ------------------
  127|      0|        return 0;
  128|       |
  129|      2|    memset(conf, 0, sizeof(*conf));
  130|      2|    conf->meth = &default_method;
  131|      2|    conf->meth_data = (void *)CONF_type_default;
  132|       |
  133|      2|    return 1;
  134|      2|}
conf_def.c:def_destroy:
  151|      2|{
  152|      2|    if (def_destroy_data(conf)) {
  ------------------
  |  Branch (152:9): [True: 2, False: 0]
  ------------------
  153|      2|        OPENSSL_free(conf);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  154|      2|        return 1;
  155|      2|    }
  156|      0|    return 0;
  157|      2|}
conf_def.c:def_destroy_data:
  160|      2|{
  161|      2|    if (conf == NULL)
  ------------------
  |  Branch (161:9): [True: 0, False: 2]
  ------------------
  162|      0|        return 0;
  163|      2|    _CONF_free_data(conf);
  164|      2|    return 1;
  165|      2|}
conf_def.c:def_load:
  168|      2|{
  169|      2|    int ret;
  170|      2|    BIO *in = NULL;
  171|       |
  172|       |#ifdef OPENSSL_SYS_VMS
  173|       |    in = BIO_new_file(name, "r");
  174|       |#else
  175|      2|    in = BIO_new_file(name, "rb");
  176|      2|#endif
  177|      2|    if (in == NULL) {
  ------------------
  |  Branch (177:9): [True: 2, False: 0]
  ------------------
  178|      2|        if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
  ------------------
  |  |   48|      2|# define BIO_R_NO_SUCH_FILE                               128
  ------------------
  |  Branch (178:13): [True: 2, False: 0]
  ------------------
  179|      2|            ERR_raise(ERR_LIB_CONF, CONF_R_NO_SUCH_FILE);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  180|      0|        else
  181|      2|            ERR_raise(ERR_LIB_CONF, ERR_R_SYS_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  182|      2|        return 0;
  183|      2|    }
  184|       |
  185|      0|    ret = def_load_bio(conf, in, line);
  186|      0|    BIO_free(in);
  187|       |
  188|      0|    return ret;
  189|      2|}

ossl_err_load_CONF_strings:
   66|      2|{
   67|      2|#ifndef OPENSSL_NO_ERR
   68|      2|    if (ERR_reason_error_string(CONF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (68:9): [True: 2, False: 0]
  ------------------
   69|      2|        ERR_load_strings_const(CONF_str_reasons);
   70|      2|#endif
   71|      2|    return 1;
   72|      2|}

NCONF_new_ex:
  183|      2|{
  184|      2|    CONF *ret;
  185|       |
  186|      2|    if (meth == NULL)
  ------------------
  |  Branch (186:9): [True: 2, False: 0]
  ------------------
  187|      2|        meth = NCONF_default();
  188|       |
  189|      2|    ret = meth->create(meth);
  190|      2|    if (ret == NULL) {
  ------------------
  |  Branch (190:9): [True: 0, False: 2]
  ------------------
  191|      0|        ERR_raise(ERR_LIB_CONF, ERR_R_CONF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  192|      0|        return NULL;
  193|      0|    }
  194|      2|    ret->libctx = libctx;
  195|       |
  196|      2|    return ret;
  197|      2|}
NCONF_free:
  205|      2|{
  206|      2|    if (conf == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 2]
  ------------------
  207|      0|        return;
  208|      2|    conf->meth->destroy(conf);
  209|      2|}
NCONF_load:
  251|      2|{
  252|      2|    if (conf == NULL) {
  ------------------
  |  Branch (252:9): [True: 0, False: 2]
  ------------------
  253|      0|        ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  254|      0|        return 0;
  255|      0|    }
  256|       |
  257|      2|    return conf->meth->load(conf, file, eline);
  258|      2|}

CONF_modules_load_file_ex:
  182|      2|{
  183|      2|    char *file = NULL;
  184|      2|    CONF *conf = NULL;
  185|      2|    int ret = 0, diagnostics = 0;
  186|       |
  187|      2|    ERR_set_mark();
  188|       |
  189|      2|    if (filename == NULL) {
  ------------------
  |  Branch (189:9): [True: 2, False: 0]
  ------------------
  190|      2|        file = CONF_get1_default_config_file();
  191|      2|        if (file == NULL)
  ------------------
  |  Branch (191:13): [True: 0, False: 2]
  ------------------
  192|      0|            goto err;
  193|      2|        if (*file == '\0') {
  ------------------
  |  Branch (193:13): [True: 0, False: 2]
  ------------------
  194|       |            /* Do not try to load an empty file name but do not error out */
  195|      0|            ret = 1;
  196|      0|            goto err;
  197|      0|        }
  198|      2|    } else {
  199|      0|        file = (char *)filename;
  200|      0|    }
  201|       |
  202|      2|    conf = NCONF_new_ex(libctx, NULL);
  203|      2|    if (conf == NULL)
  ------------------
  |  Branch (203:9): [True: 0, False: 2]
  ------------------
  204|      0|        goto err;
  205|       |
  206|      2|    if (NCONF_load(conf, file, NULL) <= 0) {
  ------------------
  |  Branch (206:9): [True: 2, False: 0]
  ------------------
  207|      2|        if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) &&
  ------------------
  |  |  110|      2|# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
  ------------------
  |  Branch (207:13): [True: 2, False: 0]
  ------------------
  208|      2|            (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) {
  ------------------
  |  |   36|      2|# define CONF_R_NO_SUCH_FILE                              114
  ------------------
  |  Branch (208:13): [True: 2, False: 0]
  ------------------
  209|      2|            ret = 1;
  210|      2|        }
  211|      2|        goto err;
  212|      2|    }
  213|       |
  214|      0|    ret = CONF_modules_load(conf, appname, flags);
  215|      0|    diagnostics = conf_diagnostics(conf);
  216|       |
  217|      2| err:
  218|      2|    if (filename == NULL)
  ------------------
  |  Branch (218:9): [True: 2, False: 0]
  ------------------
  219|      2|        OPENSSL_free(file);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  220|      2|    NCONF_free(conf);
  221|       |
  222|      2|    if ((flags & CONF_MFLAGS_IGNORE_RETURN_CODES) != 0 && !diagnostics)
  ------------------
  |  |  107|      2|# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
  ------------------
  |  Branch (222:9): [True: 2, False: 0]
  |  Branch (222:59): [True: 2, False: 0]
  ------------------
  223|      2|        ret = 1;
  224|       |
  225|      2|    if (ret > 0)
  ------------------
  |  Branch (225:9): [True: 2, False: 0]
  ------------------
  226|      2|        ERR_pop_to_mark();
  227|      0|    else
  228|      0|        ERR_clear_last_mark();
  229|       |
  230|      2|    return ret;
  231|      0|}
CONF_modules_unload:
  482|      2|{
  483|      2|    int i;
  484|      2|    CONF_MODULE *md;
  485|       |
  486|      2|    if (!conf_modules_finish_int()) /* also inits module list lock */
  ------------------
  |  Branch (486:9): [True: 0, False: 2]
  ------------------
  487|      0|        return;
  488|       |
  489|      2|    if (!CRYPTO_THREAD_write_lock(module_list_lock))
  ------------------
  |  Branch (489:9): [True: 0, False: 2]
  ------------------
  490|      0|        return;
  491|       |
  492|       |    /* unload modules in reverse order */
  493|      2|    for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) {
  ------------------
  |  Branch (493:57): [True: 0, False: 2]
  ------------------
  494|      0|        md = sk_CONF_MODULE_value(supported_modules, i);
  495|       |        /* If static or in use and 'all' not set ignore it */
  496|      0|        if (((md->links > 0) || !md->dso) && !all)
  ------------------
  |  Branch (496:14): [True: 0, False: 0]
  |  Branch (496:33): [True: 0, False: 0]
  |  Branch (496:46): [True: 0, False: 0]
  ------------------
  497|      0|            continue;
  498|       |        /* Since we're working in reverse this is OK */
  499|      0|        (void)sk_CONF_MODULE_delete(supported_modules, i);
  500|      0|        module_free(md);
  501|      0|    }
  502|       |
  503|      2|    if (sk_CONF_MODULE_num(supported_modules) == 0) {
  ------------------
  |  Branch (503:9): [True: 0, False: 2]
  ------------------
  504|      0|        sk_CONF_MODULE_free(supported_modules);
  505|      0|        supported_modules = NULL;
  506|      0|    }
  507|       |
  508|      2|    CRYPTO_THREAD_unlock(module_list_lock);
  509|      2|}
ossl_config_modules_free:
  576|      2|{
  577|      2|    CONF_modules_unload(1); /* calls CONF_modules_finish */
  578|      2|    module_lists_free();
  579|      2|}
CONF_get1_default_config_file:
  630|      2|{
  631|      2|    const char *t;
  632|      2|    char *file, *sep = "";
  633|      2|    size_t size;
  634|       |
  635|      2|    if ((file = ossl_safe_getenv("OPENSSL_CONF")) != NULL)
  ------------------
  |  Branch (635:9): [True: 0, False: 2]
  ------------------
  636|      0|        return OPENSSL_strdup(file);
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  637|       |
  638|      2|    t = X509_get_default_cert_area();
  639|      2|#ifndef OPENSSL_SYS_VMS
  640|      2|    sep = "/";
  641|      2|#endif
  642|      2|    size = strlen(t) + strlen(sep) + strlen(OPENSSL_CONF) + 1;
  ------------------
  |  |   81|      2|# define OPENSSL_CONF             "openssl.cnf"
  ------------------
  643|      2|    file = OPENSSL_malloc(size);
  ------------------
  |  |   97|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  644|       |
  645|      2|    if (file == NULL)
  ------------------
  |  Branch (645:9): [True: 0, False: 2]
  ------------------
  646|      0|        return NULL;
  647|      2|    BIO_snprintf(file, size, "%s%s%s", t, sep, OPENSSL_CONF);
  ------------------
  |  |   81|      2|# define OPENSSL_CONF             "openssl.cnf"
  ------------------
  648|       |
  649|      2|    return file;
  650|      2|}
conf_mod.c:do_init_module_list_lock:
  100|      2|{
  101|      2|    module_list_lock = CRYPTO_THREAD_lock_new();
  102|      2|    if (module_list_lock == NULL) {
  ------------------
  |  Branch (102:9): [True: 0, False: 2]
  ------------------
  103|      0|        ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  104|      0|        return 0;
  105|      0|    }
  106|       |
  107|      2|    return 1;
  108|      2|}
conf_mod.c:conf_modules_finish_int:
  522|      2|{
  523|      2|    CONF_IMODULE *imod;
  524|       |
  525|      2|    if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (525:9): [True: 0, False: 2]
  ------------------
  526|      0|        return 0;
  527|       |
  528|       |    /* If module_list_lock is NULL here it means we were already unloaded */
  529|      2|    if (module_list_lock == NULL
  ------------------
  |  Branch (529:9): [True: 0, False: 2]
  ------------------
  530|      2|        || !CRYPTO_THREAD_write_lock(module_list_lock))
  ------------------
  |  Branch (530:12): [True: 0, False: 2]
  ------------------
  531|      0|        return 0;
  532|       |
  533|      2|    while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  ------------------
  |  Branch (533:12): [True: 0, False: 2]
  ------------------
  534|      0|        imod = sk_CONF_IMODULE_pop(initialized_modules);
  535|      0|        module_finish(imod);
  536|      0|    }
  537|      2|    sk_CONF_IMODULE_free(initialized_modules);
  538|      2|    initialized_modules = NULL;
  539|       |
  540|      2|    CRYPTO_THREAD_unlock(module_list_lock);
  541|       |
  542|      2|    return 1;
  543|      2|}
conf_mod.c:module_lists_free:
   88|      2|{
   89|      2|    CRYPTO_THREAD_lock_free(module_list_lock);
   90|      2|    module_list_lock = NULL;
   91|       |
   92|      2|    sk_CONF_MODULE_free(supported_modules);
   93|      2|    supported_modules = NULL;
   94|       |
   95|      2|    sk_CONF_IMODULE_free(initialized_modules);
   96|      2|    initialized_modules = NULL;
   97|      2|}

ossl_config_int:
   45|      2|{
   46|      2|    int ret = 0;
   47|      2|#if defined(OPENSSL_INIT_DEBUG) || !defined(OPENSSL_SYS_UEFI)
   48|      2|    const char *filename;
   49|      2|    const char *appname;
   50|      2|    unsigned long flags;
   51|      2|#endif
   52|       |
   53|      2|    if (openssl_configured)
  ------------------
  |  Branch (53:9): [True: 0, False: 2]
  ------------------
   54|      0|        return 1;
   55|       |
   56|      2|#if defined(OPENSSL_INIT_DEBUG) || !defined(OPENSSL_SYS_UEFI)
   57|      2|    filename = settings ? settings->filename : NULL;
  ------------------
  |  Branch (57:16): [True: 0, False: 2]
  ------------------
   58|      2|    appname = settings ? settings->appname : NULL;
  ------------------
  |  Branch (58:15): [True: 0, False: 2]
  ------------------
   59|      2|    flags = settings ? settings->flags : DEFAULT_CONF_MFLAGS;
  ------------------
  |  |   17|      4|    (CONF_MFLAGS_DEFAULT_SECTION | \
  |  |  ------------------
  |  |  |  |  111|      2|# define CONF_MFLAGS_DEFAULT_SECTION     0x20
  |  |  ------------------
  |  |   18|      4|     CONF_MFLAGS_IGNORE_MISSING_FILE | \
  |  |  ------------------
  |  |  |  |  110|      2|# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
  |  |  ------------------
  |  |   19|      4|     CONF_MFLAGS_IGNORE_RETURN_CODES)
  |  |  ------------------
  |  |  |  |  107|      2|# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
  |  |  ------------------
  ------------------
  |  Branch (59:13): [True: 0, False: 2]
  ------------------
   60|      2|#endif
   61|       |
   62|       |#ifdef OPENSSL_INIT_DEBUG
   63|       |    fprintf(stderr, "OPENSSL_INIT: ossl_config_int(%s, %s, %lu)\n",
   64|       |            filename, appname, flags);
   65|       |#endif
   66|       |
   67|      2|#ifndef OPENSSL_SYS_UEFI
   68|      2|    ret = CONF_modules_load_file_ex(OSSL_LIB_CTX_get0_global_default(),
   69|      2|                                    filename, appname, flags);
   70|       |#else
   71|       |    ret = 1;
   72|       |#endif
   73|      2|    openssl_configured = 1;
   74|      2|    return ret;
   75|      2|}

ossl_lib_ctx_write_lock:
   55|     57|{
   56|     57|    return CRYPTO_THREAD_write_lock(ossl_lib_ctx_get_concrete(ctx)->lock);
   57|     57|}
ossl_lib_ctx_read_lock:
   60|    206|{
   61|    206|    return CRYPTO_THREAD_read_lock(ossl_lib_ctx_get_concrete(ctx)->lock);
   62|    206|}
ossl_lib_ctx_unlock:
   65|    263|{
   66|    263|    return CRYPTO_THREAD_unlock(ossl_lib_ctx_get_concrete(ctx)->lock);
   67|    263|}
ossl_lib_ctx_default_deinit:
  387|      2|{
  388|      2|    if (!default_context_inited)
  ------------------
  |  Branch (388:9): [True: 0, False: 2]
  ------------------
  389|      0|        return;
  390|      2|    context_deinit(&default_context_int);
  391|      2|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  392|      2|    default_context_inited = 0;
  393|      2|}
OSSL_LIB_CTX_new:
  422|      2|{
  423|      2|    OSSL_LIB_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  424|       |
  425|      2|    if (ctx != NULL && !context_init(ctx)) {
  ------------------
  |  Branch (425:9): [True: 2, False: 0]
  |  Branch (425:24): [True: 0, False: 2]
  ------------------
  426|      0|        OPENSSL_free(ctx);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  427|      0|        ctx = NULL;
  428|      0|    }
  429|      2|    return ctx;
  430|      2|}
OSSL_LIB_CTX_get0_global_default:
  487|      2|{
  488|      2|    if (!RUN_ONCE(&default_context_init, default_context_do_init))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (488:9): [True: 0, False: 2]
  ------------------
  489|      0|        return NULL;
  490|       |
  491|      2|    return &default_context_int;
  492|      2|}
ossl_release_default_drbg_ctx:
  508|      1|{
  509|       |    /* early release of the DRBG in global default libctx */
  510|      1|    if (default_context_int.drbg != NULL) {
  ------------------
  |  Branch (510:9): [True: 1, False: 0]
  ------------------
  511|      1|        ossl_rand_ctx_free(default_context_int.drbg);
  512|      1|        default_context_int.drbg = NULL;
  513|      1|    }
  514|      1|}
ossl_lib_ctx_get_concrete:
  518|  18.7M|{
  519|  18.7M|#ifndef FIPS_MODULE
  520|  18.7M|    if (ctx == NULL)
  ------------------
  |  Branch (520:9): [True: 18.3M, False: 379k]
  ------------------
  521|  18.3M|        return get_default_context();
  522|   379k|#endif
  523|   379k|    return ctx;
  524|  18.7M|}
ossl_lib_ctx_is_default:
  527|  6.75k|{
  528|  6.75k|#ifndef FIPS_MODULE
  529|  6.75k|    if (ctx == NULL || ctx == get_default_context())
  ------------------
  |  Branch (529:9): [True: 568, False: 6.18k]
  |  Branch (529:24): [True: 6.18k, False: 0]
  ------------------
  530|  6.75k|        return 1;
  531|      0|#endif
  532|      0|    return 0;
  533|  6.75k|}
ossl_lib_ctx_get_data:
  545|   504k|{
  546|   504k|    void *p;
  547|       |
  548|   504k|    ctx = ossl_lib_ctx_get_concrete(ctx);
  549|   504k|    if (ctx == NULL)
  ------------------
  |  Branch (549:9): [True: 0, False: 504k]
  ------------------
  550|      0|        return NULL;
  551|       |
  552|   504k|    switch (index) {
  553|   135k|    case OSSL_LIB_CTX_PROPERTY_STRING_INDEX:
  ------------------
  |  |  101|   135k|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  |  Branch (553:5): [True: 135k, False: 369k]
  ------------------
  554|   135k|        return ctx->property_string_data;
  555|  9.02k|    case OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX:
  ------------------
  |  |   98|  9.02k|# define OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX         0
  ------------------
  |  Branch (555:5): [True: 9.02k, False: 495k]
  ------------------
  556|  9.02k|        return ctx->evp_method_store;
  557|  6.76k|    case OSSL_LIB_CTX_PROVIDER_STORE_INDEX:
  ------------------
  |  |   99|  6.76k|# define OSSL_LIB_CTX_PROVIDER_STORE_INDEX           1
  ------------------
  |  Branch (557:5): [True: 6.76k, False: 497k]
  ------------------
  558|  6.76k|        return ctx->provider_store;
  559|   216k|    case OSSL_LIB_CTX_NAMEMAP_INDEX:
  ------------------
  |  |  102|   216k|# define OSSL_LIB_CTX_NAMEMAP_INDEX                  4
  ------------------
  |  Branch (559:5): [True: 216k, False: 288k]
  ------------------
  560|   216k|        return ctx->namemap;
  561|    263|    case OSSL_LIB_CTX_PROPERTY_DEFN_INDEX:
  ------------------
  |  |  100|    263|# define OSSL_LIB_CTX_PROPERTY_DEFN_INDEX            2
  ------------------
  |  Branch (561:5): [True: 263, False: 504k]
  ------------------
  562|    263|        return ctx->property_defns;
  563|      5|    case OSSL_LIB_CTX_GLOBAL_PROPERTIES:
  ------------------
  |  |  114|      5|# define OSSL_LIB_CTX_GLOBAL_PROPERTIES             14
  ------------------
  |  Branch (563:5): [True: 5, False: 504k]
  ------------------
  564|      5|        return ctx->global_properties;
  565|  52.6k|    case OSSL_LIB_CTX_DRBG_INDEX:
  ------------------
  |  |  103|  52.6k|# define OSSL_LIB_CTX_DRBG_INDEX                     5
  ------------------
  |  Branch (565:5): [True: 52.6k, False: 451k]
  ------------------
  566|  52.6k|        return ctx->drbg;
  567|      0|    case OSSL_LIB_CTX_DRBG_NONCE_INDEX:
  ------------------
  |  |  104|      0|# define OSSL_LIB_CTX_DRBG_NONCE_INDEX               6
  ------------------
  |  Branch (567:5): [True: 0, False: 504k]
  ------------------
  568|      0|        return ctx->drbg_nonce;
  569|      0|#ifndef FIPS_MODULE
  570|      0|    case OSSL_LIB_CTX_PROVIDER_CONF_INDEX:
  ------------------
  |  |  116|      0|# define OSSL_LIB_CTX_PROVIDER_CONF_INDEX           16
  ------------------
  |  Branch (570:5): [True: 0, False: 504k]
  ------------------
  571|      0|        return ctx->provider_conf;
  572|      0|    case OSSL_LIB_CTX_BIO_CORE_INDEX:
  ------------------
  |  |  117|      0|# define OSSL_LIB_CTX_BIO_CORE_INDEX                17
  ------------------
  |  Branch (572:5): [True: 0, False: 504k]
  ------------------
  573|      0|        return ctx->bio_core;
  574|      0|    case OSSL_LIB_CTX_CHILD_PROVIDER_INDEX:
  ------------------
  |  |  118|      0|# define OSSL_LIB_CTX_CHILD_PROVIDER_INDEX          18
  ------------------
  |  Branch (574:5): [True: 0, False: 504k]
  ------------------
  575|      0|        return ctx->child_provider;
  576|  1.81k|    case OSSL_LIB_CTX_DECODER_STORE_INDEX:
  ------------------
  |  |  111|  1.81k|# define OSSL_LIB_CTX_DECODER_STORE_INDEX           11
  ------------------
  |  Branch (576:5): [True: 1.81k, False: 502k]
  ------------------
  577|  1.81k|        return ctx->decoder_store;
  578|  45.4k|    case OSSL_LIB_CTX_DECODER_CACHE_INDEX:
  ------------------
  |  |  120|  45.4k|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  |  Branch (578:5): [True: 45.4k, False: 458k]
  ------------------
  579|  45.4k|        return ctx->decoder_cache;
  580|  37.1k|    case OSSL_LIB_CTX_ENCODER_STORE_INDEX:
  ------------------
  |  |  110|  37.1k|# define OSSL_LIB_CTX_ENCODER_STORE_INDEX           10
  ------------------
  |  Branch (580:5): [True: 37.1k, False: 467k]
  ------------------
  581|  37.1k|        return ctx->encoder_store;
  582|      2|    case OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX:
  ------------------
  |  |  115|      2|# define OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX      15
  ------------------
  |  Branch (582:5): [True: 2, False: 504k]
  ------------------
  583|      2|        return ctx->store_loader_store;
  584|      0|    case OSSL_LIB_CTX_SELF_TEST_CB_INDEX:
  ------------------
  |  |  112|      0|# define OSSL_LIB_CTX_SELF_TEST_CB_INDEX            12
  ------------------
  |  Branch (584:5): [True: 0, False: 504k]
  ------------------
  585|      0|        return ctx->self_test_cb;
  586|      0|#endif
  587|      0|#ifndef OPENSSL_NO_THREAD_POOL
  588|      0|    case OSSL_LIB_CTX_THREAD_INDEX:
  ------------------
  |  |  119|      0|# define OSSL_LIB_CTX_THREAD_INDEX                  19
  ------------------
  |  Branch (588:5): [True: 0, False: 504k]
  ------------------
  589|      0|        return ctx->threads;
  590|      0|#endif
  591|       |
  592|      0|    case OSSL_LIB_CTX_RAND_CRNGT_INDEX: {
  ------------------
  |  |  105|      0|# define OSSL_LIB_CTX_RAND_CRNGT_INDEX               7
  ------------------
  |  Branch (592:5): [True: 0, False: 504k]
  ------------------
  593|       |
  594|       |        /*
  595|       |         * rand_crngt must be lazily initialized because it calls into
  596|       |         * libctx, so must not be called from context_init, else a deadlock
  597|       |         * will occur.
  598|       |         *
  599|       |         * We use a separate lock because code called by the instantiation
  600|       |         * of rand_crngt is liable to try and take the libctx lock.
  601|       |         */
  602|      0|        if (CRYPTO_THREAD_read_lock(ctx->rand_crngt_lock) != 1)
  ------------------
  |  Branch (602:13): [True: 0, False: 0]
  ------------------
  603|      0|            return NULL;
  604|       |
  605|      0|        if (ctx->rand_crngt == NULL) {
  ------------------
  |  Branch (605:13): [True: 0, False: 0]
  ------------------
  606|      0|            CRYPTO_THREAD_unlock(ctx->rand_crngt_lock);
  607|       |
  608|      0|            if (CRYPTO_THREAD_write_lock(ctx->rand_crngt_lock) != 1)
  ------------------
  |  Branch (608:17): [True: 0, False: 0]
  ------------------
  609|      0|                return NULL;
  610|       |
  611|      0|            if (ctx->rand_crngt == NULL)
  ------------------
  |  Branch (611:17): [True: 0, False: 0]
  ------------------
  612|      0|                ctx->rand_crngt = ossl_rand_crng_ctx_new(ctx);
  613|      0|        }
  614|       |
  615|      0|        p = ctx->rand_crngt;
  616|       |
  617|      0|        CRYPTO_THREAD_unlock(ctx->rand_crngt_lock);
  618|       |
  619|      0|        return p;
  620|      0|    }
  621|       |
  622|       |#ifdef FIPS_MODULE
  623|       |    case OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX:
  624|       |        return ctx->thread_event_handler;
  625|       |
  626|       |    case OSSL_LIB_CTX_FIPS_PROV_INDEX:
  627|       |        return ctx->fips_prov;
  628|       |#endif
  629|       |
  630|      0|    default:
  ------------------
  |  Branch (630:5): [True: 0, False: 504k]
  ------------------
  631|      0|        return NULL;
  632|   504k|    }
  633|   504k|}
ossl_lib_ctx_get_ex_data_global:
  636|  18.2M|{
  637|  18.2M|    ctx = ossl_lib_ctx_get_concrete(ctx);
  638|  18.2M|    if (ctx == NULL)
  ------------------
  |  Branch (638:9): [True: 0, False: 18.2M]
  ------------------
  639|      0|        return NULL;
  640|  18.2M|    return &ctx->global;
  641|  18.2M|}
context.c:context_deinit:
  344|      2|{
  345|      2|    if (ctx == NULL)
  ------------------
  |  Branch (345:9): [True: 0, False: 2]
  ------------------
  346|      0|        return 1;
  347|       |
  348|      2|    ossl_ctx_thread_stop(ctx);
  349|       |
  350|      2|    context_deinit_objs(ctx);
  351|       |
  352|      2|    ossl_crypto_cleanup_all_ex_data_int(ctx);
  353|       |
  354|      2|    CRYPTO_THREAD_lock_free(ctx->rand_crngt_lock);
  355|      2|    CRYPTO_THREAD_lock_free(ctx->lock);
  356|      2|    ctx->rand_crngt_lock = NULL;
  357|      2|    ctx->lock = NULL;
  358|      2|    return 1;
  359|      2|}
context.c:context_deinit_objs:
  217|      2|{
  218|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  219|      2|    if (ctx->evp_method_store != NULL) {
  ------------------
  |  Branch (219:9): [True: 2, False: 0]
  ------------------
  220|      2|        ossl_method_store_free(ctx->evp_method_store);
  221|      2|        ctx->evp_method_store = NULL;
  222|      2|    }
  223|       |
  224|       |    /* P2. */
  225|      2|    if (ctx->drbg != NULL) {
  ------------------
  |  Branch (225:9): [True: 1, False: 1]
  ------------------
  226|      1|        ossl_rand_ctx_free(ctx->drbg);
  227|      1|        ctx->drbg = NULL;
  228|      1|    }
  229|       |
  230|      2|#ifndef FIPS_MODULE
  231|       |    /* P2. */
  232|      2|    if (ctx->provider_conf != NULL) {
  ------------------
  |  Branch (232:9): [True: 2, False: 0]
  ------------------
  233|      2|        ossl_prov_conf_ctx_free(ctx->provider_conf);
  234|      2|        ctx->provider_conf = NULL;
  235|      2|    }
  236|       |
  237|       |    /*
  238|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  239|       |     * provider store
  240|       |     */
  241|      2|    if (ctx->decoder_store != NULL) {
  ------------------
  |  Branch (241:9): [True: 2, False: 0]
  ------------------
  242|      2|        ossl_method_store_free(ctx->decoder_store);
  243|      2|        ctx->decoder_store = NULL;
  244|      2|    }
  245|      2|    if (ctx->decoder_cache != NULL) {
  ------------------
  |  Branch (245:9): [True: 2, False: 0]
  ------------------
  246|      2|        ossl_decoder_cache_free(ctx->decoder_cache);
  247|      2|        ctx->decoder_cache = NULL;
  248|      2|    }
  249|       |
  250|       |
  251|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  252|      2|    if (ctx->encoder_store != NULL) {
  ------------------
  |  Branch (252:9): [True: 2, False: 0]
  ------------------
  253|      2|        ossl_method_store_free(ctx->encoder_store);
  254|      2|        ctx->encoder_store = NULL;
  255|      2|    }
  256|       |
  257|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  258|      2|    if (ctx->store_loader_store != NULL) {
  ------------------
  |  Branch (258:9): [True: 2, False: 0]
  ------------------
  259|      2|        ossl_method_store_free(ctx->store_loader_store);
  260|      2|        ctx->store_loader_store = NULL;
  261|      2|    }
  262|      2|#endif
  263|       |
  264|       |    /* P1. Needs to be freed before the child provider data is freed */
  265|      2|    if (ctx->provider_store != NULL) {
  ------------------
  |  Branch (265:9): [True: 2, False: 0]
  ------------------
  266|      2|        ossl_provider_store_free(ctx->provider_store);
  267|      2|        ctx->provider_store = NULL;
  268|      2|    }
  269|       |
  270|       |    /* Default priority. */
  271|      2|    if (ctx->property_string_data != NULL) {
  ------------------
  |  Branch (271:9): [True: 2, False: 0]
  ------------------
  272|      2|        ossl_property_string_data_free(ctx->property_string_data);
  273|      2|        ctx->property_string_data = NULL;
  274|      2|    }
  275|       |
  276|      2|    if (ctx->namemap != NULL) {
  ------------------
  |  Branch (276:9): [True: 2, False: 0]
  ------------------
  277|      2|        ossl_stored_namemap_free(ctx->namemap);
  278|      2|        ctx->namemap = NULL;
  279|      2|    }
  280|       |
  281|      2|    if (ctx->property_defns != NULL) {
  ------------------
  |  Branch (281:9): [True: 2, False: 0]
  ------------------
  282|      2|        ossl_property_defns_free(ctx->property_defns);
  283|      2|        ctx->property_defns = NULL;
  284|      2|    }
  285|       |
  286|      2|    if (ctx->global_properties != NULL) {
  ------------------
  |  Branch (286:9): [True: 2, False: 0]
  ------------------
  287|      2|        ossl_ctx_global_properties_free(ctx->global_properties);
  288|      2|        ctx->global_properties = NULL;
  289|      2|    }
  290|       |
  291|      2|#ifndef FIPS_MODULE
  292|      2|    if (ctx->bio_core != NULL) {
  ------------------
  |  Branch (292:9): [True: 2, False: 0]
  ------------------
  293|      2|        ossl_bio_core_globals_free(ctx->bio_core);
  294|      2|        ctx->bio_core = NULL;
  295|      2|    }
  296|      2|#endif
  297|       |
  298|      2|    if (ctx->drbg_nonce != NULL) {
  ------------------
  |  Branch (298:9): [True: 2, False: 0]
  ------------------
  299|      2|        ossl_prov_drbg_nonce_ctx_free(ctx->drbg_nonce);
  300|      2|        ctx->drbg_nonce = NULL;
  301|      2|    }
  302|       |
  303|      2|#ifndef FIPS_MODULE
  304|      2|    if (ctx->self_test_cb != NULL) {
  ------------------
  |  Branch (304:9): [True: 2, False: 0]
  ------------------
  305|      2|        ossl_self_test_set_callback_free(ctx->self_test_cb);
  306|      2|        ctx->self_test_cb = NULL;
  307|      2|    }
  308|      2|#endif
  309|       |
  310|      2|    if (ctx->rand_crngt != NULL) {
  ------------------
  |  Branch (310:9): [True: 0, False: 2]
  ------------------
  311|      0|        ossl_rand_crng_ctx_free(ctx->rand_crngt);
  312|      0|        ctx->rand_crngt = NULL;
  313|      0|    }
  314|       |
  315|       |#ifdef FIPS_MODULE
  316|       |    if (ctx->thread_event_handler != NULL) {
  317|       |        ossl_thread_event_ctx_free(ctx->thread_event_handler);
  318|       |        ctx->thread_event_handler = NULL;
  319|       |    }
  320|       |
  321|       |    if (ctx->fips_prov != NULL) {
  322|       |        ossl_fips_prov_ossl_ctx_free(ctx->fips_prov);
  323|       |        ctx->fips_prov = NULL;
  324|       |    }
  325|       |#endif
  326|       |
  327|      2|#ifndef OPENSSL_NO_THREAD_POOL
  328|      2|    if (ctx->threads != NULL) {
  ------------------
  |  Branch (328:9): [True: 2, False: 0]
  ------------------
  329|      2|        ossl_threads_ctx_free(ctx->threads);
  330|      2|        ctx->threads = NULL;
  331|      2|    }
  332|      2|#endif
  333|       |
  334|       |    /* Low priority. */
  335|      2|#ifndef FIPS_MODULE
  336|      2|    if (ctx->child_provider != NULL) {
  ------------------
  |  Branch (336:9): [True: 2, False: 0]
  ------------------
  337|      2|        ossl_child_prov_ctx_free(ctx->child_provider);
  338|      2|        ctx->child_provider = NULL;
  339|      2|    }
  340|      2|#endif
  341|      2|}
context.c:context_init:
   81|      4|{
   82|      4|    int exdata_done = 0;
   83|       |
   84|      4|    ctx->lock = CRYPTO_THREAD_lock_new();
   85|      4|    if (ctx->lock == NULL)
  ------------------
  |  Branch (85:9): [True: 0, False: 4]
  ------------------
   86|      0|        return 0;
   87|       |
   88|      4|    ctx->rand_crngt_lock = CRYPTO_THREAD_lock_new();
   89|      4|    if (ctx->rand_crngt_lock == NULL)
  ------------------
  |  Branch (89:9): [True: 0, False: 4]
  ------------------
   90|      0|        goto err;
   91|       |
   92|       |    /* Initialize ex_data. */
   93|      4|    if (!ossl_do_ex_data_init(ctx))
  ------------------
  |  Branch (93:9): [True: 0, False: 4]
  ------------------
   94|      0|        goto err;
   95|      4|    exdata_done = 1;
   96|       |
   97|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
   98|      4|    ctx->evp_method_store = ossl_method_store_new(ctx);
   99|      4|    if (ctx->evp_method_store == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 4]
  ------------------
  100|      0|        goto err;
  101|       |
  102|      4|#ifndef FIPS_MODULE
  103|       |    /* P2. Must be freed before the provider store is freed */
  104|      4|    ctx->provider_conf = ossl_prov_conf_ctx_new(ctx);
  105|      4|    if (ctx->provider_conf == NULL)
  ------------------
  |  Branch (105:9): [True: 0, False: 4]
  ------------------
  106|      0|        goto err;
  107|      4|#endif
  108|       |
  109|       |    /* P2. */
  110|      4|    ctx->drbg = ossl_rand_ctx_new(ctx);
  111|      4|    if (ctx->drbg == NULL)
  ------------------
  |  Branch (111:9): [True: 0, False: 4]
  ------------------
  112|      0|        goto err;
  113|       |
  114|      4|#ifndef FIPS_MODULE
  115|       |    /*
  116|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  117|       |     * provider store
  118|       |     */
  119|      4|    ctx->decoder_store = ossl_method_store_new(ctx);
  120|      4|    if (ctx->decoder_store == NULL)
  ------------------
  |  Branch (120:9): [True: 0, False: 4]
  ------------------
  121|      0|        goto err;
  122|      4|    ctx->decoder_cache = ossl_decoder_cache_new(ctx);
  123|      4|    if (ctx->decoder_cache == NULL)
  ------------------
  |  Branch (123:9): [True: 0, False: 4]
  ------------------
  124|      0|        goto err;
  125|       |
  126|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  127|      4|    ctx->encoder_store = ossl_method_store_new(ctx);
  128|      4|    if (ctx->encoder_store == NULL)
  ------------------
  |  Branch (128:9): [True: 0, False: 4]
  ------------------
  129|      0|        goto err;
  130|       |
  131|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  132|      4|    ctx->store_loader_store = ossl_method_store_new(ctx);
  133|      4|    if (ctx->store_loader_store == NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 4]
  ------------------
  134|      0|        goto err;
  135|      4|#endif
  136|       |
  137|       |    /* P1. Needs to be freed before the child provider data is freed */
  138|      4|    ctx->provider_store = ossl_provider_store_new(ctx);
  139|      4|    if (ctx->provider_store == NULL)
  ------------------
  |  Branch (139:9): [True: 0, False: 4]
  ------------------
  140|      0|        goto err;
  141|       |
  142|       |    /* Default priority. */
  143|      4|    ctx->property_string_data = ossl_property_string_data_new(ctx);
  144|      4|    if (ctx->property_string_data == NULL)
  ------------------
  |  Branch (144:9): [True: 0, False: 4]
  ------------------
  145|      0|        goto err;
  146|       |
  147|      4|    ctx->namemap = ossl_stored_namemap_new(ctx);
  148|      4|    if (ctx->namemap == NULL)
  ------------------
  |  Branch (148:9): [True: 0, False: 4]
  ------------------
  149|      0|        goto err;
  150|       |
  151|      4|    ctx->property_defns = ossl_property_defns_new(ctx);
  152|      4|    if (ctx->property_defns == NULL)
  ------------------
  |  Branch (152:9): [True: 0, False: 4]
  ------------------
  153|      0|        goto err;
  154|       |
  155|      4|    ctx->global_properties = ossl_ctx_global_properties_new(ctx);
  156|      4|    if (ctx->global_properties == NULL)
  ------------------
  |  Branch (156:9): [True: 0, False: 4]
  ------------------
  157|      0|        goto err;
  158|       |
  159|      4|#ifndef FIPS_MODULE
  160|      4|    ctx->bio_core = ossl_bio_core_globals_new(ctx);
  161|      4|    if (ctx->bio_core == NULL)
  ------------------
  |  Branch (161:9): [True: 0, False: 4]
  ------------------
  162|      0|        goto err;
  163|      4|#endif
  164|       |
  165|      4|    ctx->drbg_nonce = ossl_prov_drbg_nonce_ctx_new(ctx);
  166|      4|    if (ctx->drbg_nonce == NULL)
  ------------------
  |  Branch (166:9): [True: 0, False: 4]
  ------------------
  167|      0|        goto err;
  168|       |
  169|      4|#ifndef FIPS_MODULE
  170|      4|    ctx->self_test_cb = ossl_self_test_set_callback_new(ctx);
  171|      4|    if (ctx->self_test_cb == NULL)
  ------------------
  |  Branch (171:9): [True: 0, False: 4]
  ------------------
  172|      0|        goto err;
  173|      4|#endif
  174|       |
  175|       |#ifdef FIPS_MODULE
  176|       |    ctx->thread_event_handler = ossl_thread_event_ctx_new(ctx);
  177|       |    if (ctx->thread_event_handler == NULL)
  178|       |        goto err;
  179|       |
  180|       |    ctx->fips_prov = ossl_fips_prov_ossl_ctx_new(ctx);
  181|       |    if (ctx->fips_prov == NULL)
  182|       |        goto err;
  183|       |#endif
  184|       |
  185|      4|#ifndef OPENSSL_NO_THREAD_POOL
  186|      4|    ctx->threads = ossl_threads_ctx_new(ctx);
  187|      4|    if (ctx->threads == NULL)
  ------------------
  |  Branch (187:9): [True: 0, False: 4]
  ------------------
  188|      0|        goto err;
  189|      4|#endif
  190|       |
  191|       |    /* Low priority. */
  192|      4|#ifndef FIPS_MODULE
  193|      4|    ctx->child_provider = ossl_child_prov_ctx_new(ctx);
  194|      4|    if (ctx->child_provider == NULL)
  ------------------
  |  Branch (194:9): [True: 0, False: 4]
  ------------------
  195|      0|        goto err;
  196|      4|#endif
  197|       |
  198|       |    /* Everything depends on properties, so we also pre-initialise that */
  199|      4|    if (!ossl_property_parse_init(ctx))
  ------------------
  |  Branch (199:9): [True: 0, False: 4]
  ------------------
  200|      0|        goto err;
  201|       |
  202|      4|    return 1;
  203|       |
  204|      0| err:
  205|      0|    context_deinit_objs(ctx);
  206|       |
  207|      0|    if (exdata_done)
  ------------------
  |  Branch (207:9): [True: 0, False: 0]
  ------------------
  208|      0|        ossl_crypto_cleanup_all_ex_data_int(ctx);
  209|       |
  210|      0|    CRYPTO_THREAD_lock_free(ctx->rand_crngt_lock);
  211|      0|    CRYPTO_THREAD_lock_free(ctx->lock);
  212|      0|    memset(ctx, '\0', sizeof(*ctx));
  213|      0|    return 0;
  214|      4|}
context.c:default_context_do_init:
  370|      2|{
  371|      2|    if (!CRYPTO_THREAD_init_local(&default_context_thread_local, NULL))
  ------------------
  |  Branch (371:9): [True: 0, False: 2]
  ------------------
  372|      0|        goto err;
  373|       |
  374|      2|    if (!context_init(&default_context_int))
  ------------------
  |  Branch (374:9): [True: 0, False: 2]
  ------------------
  375|      0|        goto deinit_thread;
  376|       |
  377|      2|    default_context_inited = 1;
  378|      2|    return 1;
  379|       |
  380|      0|deinit_thread:
  381|      0|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  382|      0|err:
  383|      0|    return 0;
  384|      0|}
context.c:get_default_context:
  404|  18.3M|{
  405|  18.3M|    OSSL_LIB_CTX *current_defctx = get_thread_default_context();
  406|       |
  407|  18.3M|    if (current_defctx == NULL)
  ------------------
  |  Branch (407:9): [True: 18.3M, False: 0]
  ------------------
  408|  18.3M|        current_defctx = &default_context_int;
  409|  18.3M|    return current_defctx;
  410|  18.3M|}
context.c:get_thread_default_context:
  396|  18.3M|{
  397|  18.3M|    if (!RUN_ONCE(&default_context_init, default_context_do_init))
  ------------------
  |  |  130|  18.3M|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 18.3M, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (397:9): [True: 0, False: 18.3M]
  ------------------
  398|      0|        return NULL;
  399|       |
  400|  18.3M|    return CRYPTO_THREAD_get_local(&default_context_thread_local);
  401|  18.3M|}

ossl_algorithm_do_all:
  149|  6.74k|{
  150|  6.74k|    struct algorithm_data_st cbdata = { 0, };
  151|       |
  152|  6.74k|    cbdata.libctx = libctx;
  153|  6.74k|    cbdata.operation_id = operation_id;
  154|  6.74k|    cbdata.pre = pre;
  155|  6.74k|    cbdata.reserve_store = reserve_store;
  156|  6.74k|    cbdata.fn = fn;
  157|  6.74k|    cbdata.unreserve_store = unreserve_store;
  158|  6.74k|    cbdata.post = post;
  159|  6.74k|    cbdata.data = data;
  160|       |
  161|  6.74k|    if (provider == NULL) {
  ------------------
  |  Branch (161:9): [True: 6.74k, False: 0]
  ------------------
  162|  6.74k|        ossl_provider_doall_activated(libctx, algorithm_do_this, &cbdata);
  163|  6.74k|    } else {
  164|      0|        OSSL_LIB_CTX *libctx2 = ossl_provider_libctx(provider);
  165|       |
  166|       |        /*
  167|       |         * If a provider is given, its library context MUST match the library
  168|       |         * context we're passed.  If this turns out not to be true, there is
  169|       |         * a programming error in the functions up the call stack.
  170|       |         */
  171|      0|        if (!ossl_assert(ossl_lib_ctx_get_concrete(libctx)
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (171:13): [True: 0, False: 0]
  ------------------
  172|      0|                         == ossl_lib_ctx_get_concrete(libctx2)))
  173|      0|            return;
  174|       |
  175|      0|        cbdata.libctx = libctx2;
  176|      0|        algorithm_do_this(provider, &cbdata);
  177|      0|    }
  178|  6.74k|}
ossl_algorithm_get1_first_name:
  181|    206|{
  182|    206|    const char *first_name_end = NULL;
  183|    206|    size_t first_name_len = 0;
  184|    206|    char *ret;
  185|       |
  186|    206|    if (algo->algorithm_names == NULL)
  ------------------
  |  Branch (186:9): [True: 0, False: 206]
  ------------------
  187|      0|        return NULL;
  188|       |
  189|    206|    first_name_end = strchr(algo->algorithm_names, ':');
  190|    206|    if (first_name_end == NULL)
  ------------------
  |  Branch (190:9): [True: 173, False: 33]
  ------------------
  191|    173|        first_name_len = strlen(algo->algorithm_names);
  192|     33|    else
  193|     33|        first_name_len = first_name_end - algo->algorithm_names;
  194|       |
  195|    206|    ret = OPENSSL_strndup(algo->algorithm_names, first_name_len);
  ------------------
  |  |  113|    206|        CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    206|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    206|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  196|    206|    return ret;
  197|    206|}
core_algorithm.c:algorithm_do_this:
  103|  13.4k|{
  104|  13.4k|    struct algorithm_data_st *data = cbdata;
  105|  13.4k|    int first_operation = 1;
  106|  13.4k|    int last_operation = OSSL_OP__HIGHEST;
  ------------------
  |  |  269|  13.4k|# define OSSL_OP__HIGHEST                           22
  ------------------
  107|  13.4k|    int cur_operation;
  108|  13.4k|    int ok = 1;
  109|       |
  110|  13.4k|    if (data->operation_id != 0)
  ------------------
  |  Branch (110:9): [True: 13.4k, False: 0]
  ------------------
  111|  13.4k|        first_operation = last_operation = data->operation_id;
  112|       |
  113|  13.4k|    for (cur_operation = first_operation;
  114|  26.9k|         cur_operation <= last_operation;
  ------------------
  |  Branch (114:10): [True: 13.4k, False: 13.4k]
  ------------------
  115|  13.4k|         cur_operation++) {
  116|  13.4k|        int no_store = 0;        /* Assume caching is ok */
  117|  13.4k|        const OSSL_ALGORITHM *map = NULL;
  118|  13.4k|        int ret = 0;
  119|       |
  120|  13.4k|        map = ossl_provider_query_operation(provider, cur_operation,
  121|  13.4k|                                            &no_store);
  122|  13.4k|        ret = algorithm_do_map(provider, map, cur_operation, no_store, data);
  123|  13.4k|        ossl_provider_unquery_operation(provider, cur_operation, map);
  124|       |
  125|  13.4k|        if (ret < 0)
  ------------------
  |  Branch (125:13): [True: 0, False: 13.4k]
  ------------------
  126|       |            /* Hard error, bail out immediately! */
  127|      0|            return 0;
  128|       |
  129|       |        /* If post-condition not fulfilled, set general failure */
  130|  13.4k|        if (!ret)
  ------------------
  |  Branch (130:13): [True: 0, False: 13.4k]
  ------------------
  131|      0|            ok = 0;
  132|  13.4k|    }
  133|       |
  134|  13.4k|    return ok;
  135|  13.4k|}
core_algorithm.c:algorithm_do_map:
   44|  13.4k|{
   45|  13.4k|    struct algorithm_data_st *data = cbdata;
   46|  13.4k|    int ret = 0;
   47|       |
   48|  13.4k|    if (!data->reserve_store(no_store, data->data))
  ------------------
  |  Branch (48:9): [True: 0, False: 13.4k]
  ------------------
   49|       |        /* Error, bail out! */
   50|      0|        return -1;
   51|       |
   52|       |    /* Do we fulfill pre-conditions? */
   53|  13.4k|    if (data->pre == NULL) {
  ------------------
  |  Branch (53:9): [True: 0, False: 13.4k]
  ------------------
   54|       |        /* If there is no pre-condition function, assume "yes" */
   55|      0|        ret = 1;
   56|  13.4k|    } else if (!data->pre(provider, cur_operation, no_store, data->data,
  ------------------
  |  Branch (56:16): [True: 0, False: 13.4k]
  ------------------
   57|  13.4k|                          &ret)) {
   58|       |        /* Error, bail out! */
   59|      0|        ret = -1;
   60|      0|        goto end;
   61|      0|    }
   62|       |
   63|       |    /*
   64|       |     * If pre-condition not fulfilled don't add this set of implementations,
   65|       |     * but do continue with the next.  This simply means that another thread
   66|       |     * got to it first.
   67|       |     */
   68|  13.4k|    if (ret == 0) {
  ------------------
  |  Branch (68:9): [True: 13.4k, False: 10]
  ------------------
   69|  13.4k|        ret = 1;
   70|  13.4k|        goto end;
   71|  13.4k|    }
   72|       |
   73|     10|    if (map != NULL) {
  ------------------
  |  Branch (73:9): [True: 6, False: 4]
  ------------------
   74|      6|        const OSSL_ALGORITHM *thismap;
   75|       |
   76|    212|        for (thismap = map; thismap->algorithm_names != NULL; thismap++)
  ------------------
  |  Branch (76:29): [True: 206, False: 6]
  ------------------
   77|    206|            data->fn(provider, thismap, no_store, data->data);
   78|      6|    }
   79|       |
   80|       |    /* Do we fulfill post-conditions? */
   81|     10|    if (data->post == NULL) {
  ------------------
  |  Branch (81:9): [True: 0, False: 10]
  ------------------
   82|       |        /* If there is no post-condition function, assume "yes" */
   83|      0|        ret = 1;
   84|     10|    } else if (!data->post(provider, cur_operation, no_store, data->data,
  ------------------
  |  Branch (84:16): [True: 0, False: 10]
  ------------------
   85|     10|                           &ret)) {
   86|       |        /* Error, bail out! */
   87|      0|        ret = -1;
   88|      0|    }
   89|       |
   90|  13.4k| end:
   91|  13.4k|    data->unreserve_store(data->data);
   92|       |
   93|  13.4k|    return ret;
   94|     10|}

ossl_method_construct:
  133|  6.74k|{
  134|  6.74k|    void *method = NULL;
  135|  6.74k|    OSSL_PROVIDER *provider = provider_rw != NULL ? *provider_rw : NULL;
  ------------------
  |  Branch (135:31): [True: 6.74k, False: 0]
  ------------------
  136|  6.74k|    struct construct_data_st cbdata;
  137|       |
  138|       |    /*
  139|       |     * We might be tempted to try to look into the method store without
  140|       |     * constructing to see if we can find our method there already.
  141|       |     * Unfortunately that does not work well if the query contains
  142|       |     * optional properties as newly loaded providers can match them better.
  143|       |     * We trust that ossl_method_construct_precondition() and
  144|       |     * ossl_method_construct_postcondition() make sure that the
  145|       |     * ossl_algorithm_do_all() does very little when methods from
  146|       |     * a provider have already been constructed.
  147|       |     */
  148|       |
  149|  6.74k|    cbdata.store = NULL;
  150|  6.74k|    cbdata.force_store = force_store;
  151|  6.74k|    cbdata.mcm = mcm;
  152|  6.74k|    cbdata.mcm_data = mcm_data;
  153|  6.74k|    ossl_algorithm_do_all(libctx, operation_id, provider,
  154|  6.74k|                          ossl_method_construct_precondition,
  155|  6.74k|                          ossl_method_construct_reserve_store,
  156|  6.74k|                          ossl_method_construct_this,
  157|  6.74k|                          ossl_method_construct_unreserve_store,
  158|  6.74k|                          ossl_method_construct_postcondition,
  159|  6.74k|                          &cbdata);
  160|       |
  161|       |    /* If there is a temporary store, try there first */
  162|  6.74k|    if (cbdata.store != NULL)
  ------------------
  |  Branch (162:9): [True: 0, False: 6.74k]
  ------------------
  163|      0|        method = mcm->get(cbdata.store, (const OSSL_PROVIDER **)provider_rw,
  164|      0|                          mcm_data);
  165|       |
  166|       |    /* If no method was found yet, try the global store */
  167|  6.74k|    if (method == NULL)
  ------------------
  |  Branch (167:9): [True: 6.74k, False: 0]
  ------------------
  168|  6.74k|        method = mcm->get(NULL, (const OSSL_PROVIDER **)provider_rw, mcm_data);
  169|       |
  170|  6.74k|    return method;
  171|  6.74k|}
core_fetch.c:ossl_method_construct_precondition:
   62|  13.4k|{
   63|  13.4k|    if (!ossl_assert(result != NULL)) {
  ------------------
  |  |   52|  13.4k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  13.4k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (63:9): [True: 0, False: 13.4k]
  ------------------
   64|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   65|      0|        return 0;
   66|      0|    }
   67|       |
   68|       |    /* Assume that no bits are set */
   69|  13.4k|    *result = 0;
   70|       |
   71|       |    /* No flag bits for temporary stores */
   72|  13.4k|    if (!is_temporary_method_store(no_store, cbdata)
  ------------------
  |  Branch (72:9): [True: 13.4k, False: 0]
  ------------------
   73|  13.4k|        && !ossl_provider_test_operation_bit(provider, operation_id, result))
  ------------------
  |  Branch (73:12): [True: 0, False: 13.4k]
  ------------------
   74|      0|        return 0;
   75|       |
   76|       |    /*
   77|       |     * The result we get tells if methods have already been constructed.
   78|       |     * However, we want to tell whether construction should happen (true)
   79|       |     * or not (false), which is the opposite of what we got.
   80|       |     */
   81|  13.4k|    *result = !*result;
   82|       |
   83|  13.4k|    return 1;
   84|  13.4k|}
core_fetch.c:is_temporary_method_store:
   28|  26.9k|{
   29|  26.9k|    struct construct_data_st *data = cbdata;
   30|       |
   31|  26.9k|    return no_store && !data->force_store;
  ------------------
  |  Branch (31:12): [True: 0, False: 26.9k]
  |  Branch (31:24): [True: 0, False: 0]
  ------------------
   32|  26.9k|}
core_fetch.c:ossl_method_construct_reserve_store:
   35|  13.4k|{
   36|  13.4k|    struct construct_data_st *data = cbdata;
   37|       |
   38|  13.4k|    if (is_temporary_method_store(no_store, data) && data->store == NULL) {
  ------------------
  |  Branch (38:9): [True: 0, False: 13.4k]
  |  Branch (38:54): [True: 0, False: 0]
  ------------------
   39|       |        /*
   40|       |         * If we have been told not to store the method "permanently", we
   41|       |         * ask for a temporary store, and store the method there.
   42|       |         * The owner of |data->mcm| is completely responsible for managing
   43|       |         * that temporary store.
   44|       |         */
   45|      0|        if ((data->store = data->mcm->get_tmp_store(data->mcm_data)) == NULL)
  ------------------
  |  Branch (45:13): [True: 0, False: 0]
  ------------------
   46|      0|            return 0;
   47|      0|    }
   48|       |
   49|  13.4k|    return data->mcm->lock_store(data->store, data->mcm_data);
   50|  13.4k|}
core_fetch.c:ossl_method_construct_this:
  105|    206|{
  106|    206|    struct construct_data_st *data = cbdata;
  107|    206|    void *method = NULL;
  108|       |
  109|    206|    if ((method = data->mcm->construct(algo, provider, data->mcm_data))
  ------------------
  |  Branch (109:9): [True: 0, False: 206]
  ------------------
  110|    206|        == NULL)
  111|      0|        return;
  112|       |
  113|       |    /*
  114|       |     * Note regarding putting the method in stores:
  115|       |     *
  116|       |     * we don't need to care if it actually got in or not here.
  117|       |     * If it didn't get in, it will simply not be available when
  118|       |     * ossl_method_construct() tries to get it from the store.
  119|       |     *
  120|       |     * It is *expected* that the put function increments the refcnt
  121|       |     * of the passed method.
  122|       |     */
  123|    206|    data->mcm->put(data->store, method, provider, algo->algorithm_names,
  124|    206|                   algo->property_definition, data->mcm_data);
  125|       |
  126|       |    /* refcnt-- because we're dropping the reference */
  127|    206|    data->mcm->destruct(method, data->mcm_data);
  128|    206|}
core_fetch.c:ossl_method_construct_unreserve_store:
   53|  13.4k|{
   54|  13.4k|    struct construct_data_st *data = cbdata;
   55|       |
   56|  13.4k|    return data->mcm->unlock_store(data->store, data->mcm_data);
   57|  13.4k|}
core_fetch.c:ossl_method_construct_postcondition:
   89|     10|{
   90|     10|    if (!ossl_assert(result != NULL)) {
  ------------------
  |  |   52|     10|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     10|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (90:9): [True: 0, False: 10]
  ------------------
   91|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   92|      0|        return 0;
   93|      0|    }
   94|       |
   95|     10|    *result = 1;
   96|       |
   97|       |    /* No flag bits for temporary stores */
   98|     10|    return is_temporary_method_store(no_store, cbdata)
  ------------------
  |  Branch (98:12): [True: 0, False: 10]
  ------------------
   99|     10|        || ossl_provider_set_operation_bit(provider, operation_id);
  ------------------
  |  Branch (99:12): [True: 10, False: 0]
  ------------------
  100|     10|}

ossl_stored_namemap_new:
   65|      4|{
   66|      4|    OSSL_NAMEMAP *namemap = ossl_namemap_new();
   67|       |
   68|      4|    if (namemap != NULL)
  ------------------
  |  Branch (68:9): [True: 4, False: 0]
  ------------------
   69|      4|        namemap->stored = 1;
   70|       |
   71|      4|    return namemap;
   72|      4|}
ossl_stored_namemap_free:
   75|      2|{
   76|      2|    OSSL_NAMEMAP *namemap = vnamemap;
   77|       |
   78|      2|    if (namemap != NULL) {
  ------------------
  |  Branch (78:9): [True: 2, False: 0]
  ------------------
   79|       |        /* Pretend it isn't stored, or ossl_namemap_free() will do nothing */
   80|      2|        namemap->stored = 0;
   81|      2|        ossl_namemap_free(namemap);
   82|      2|    }
   83|      2|}
ossl_namemap_empty:
   91|   216k|{
   92|       |#ifdef TSAN_REQUIRES_LOCKING
   93|       |    /* No TSAN support */
   94|       |    int rv;
   95|       |
   96|       |    if (namemap == NULL)
   97|       |        return 1;
   98|       |
   99|       |    if (!CRYPTO_THREAD_read_lock(namemap->lock))
  100|       |        return -1;
  101|       |    rv = namemap->max_number == 0;
  102|       |    CRYPTO_THREAD_unlock(namemap->lock);
  103|       |    return rv;
  104|       |#else
  105|       |    /* Have TSAN support */
  106|   216k|    return namemap == NULL || tsan_load(&namemap->max_number) == 0;
  ------------------
  |  |   61|   216k|#   define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed)
  ------------------
  |  Branch (106:12): [True: 0, False: 216k]
  |  Branch (106:31): [True: 1, False: 216k]
  ------------------
  107|   216k|#endif
  108|   216k|}
ossl_namemap_doall_names:
  132|  18.1k|{
  133|  18.1k|    DOALL_NAMES_DATA cbdata;
  134|  18.1k|    size_t num_names;
  135|  18.1k|    int i;
  136|       |
  137|  18.1k|    cbdata.number = number;
  138|  18.1k|    cbdata.found = 0;
  139|       |
  140|  18.1k|    if (namemap == NULL)
  ------------------
  |  Branch (140:9): [True: 0, False: 18.1k]
  ------------------
  141|      0|        return 0;
  142|       |
  143|       |    /*
  144|       |     * We collect all the names first under a read lock. Subsequently we call
  145|       |     * the user function, so that we're not holding the read lock when in user
  146|       |     * code. This could lead to deadlocks.
  147|       |     */
  148|  18.1k|    if (!CRYPTO_THREAD_read_lock(namemap->lock))
  ------------------
  |  Branch (148:9): [True: 0, False: 18.1k]
  ------------------
  149|      0|        return 0;
  150|       |
  151|  18.1k|    num_names = lh_NAMENUM_ENTRY_num_items(namemap->namenum);
  152|  18.1k|    if (num_names == 0) {
  ------------------
  |  Branch (152:9): [True: 0, False: 18.1k]
  ------------------
  153|      0|        CRYPTO_THREAD_unlock(namemap->lock);
  154|      0|        return 0;
  155|      0|    }
  156|  18.1k|    cbdata.names = OPENSSL_malloc(sizeof(*cbdata.names) * num_names);
  ------------------
  |  |   97|  18.1k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  18.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  18.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  157|  18.1k|    if (cbdata.names == NULL) {
  ------------------
  |  Branch (157:9): [True: 0, False: 18.1k]
  ------------------
  158|      0|        CRYPTO_THREAD_unlock(namemap->lock);
  159|      0|        return 0;
  160|      0|    }
  161|  18.1k|    lh_NAMENUM_ENTRY_doall_DOALL_NAMES_DATA(namemap->namenum, do_name,
  162|  18.1k|                                            &cbdata);
  163|  18.1k|    CRYPTO_THREAD_unlock(namemap->lock);
  164|       |
  165|  95.1k|    for (i = 0; i < cbdata.found; i++)
  ------------------
  |  Branch (165:17): [True: 77.0k, False: 18.1k]
  ------------------
  166|  77.0k|        fn(cbdata.names[i], data);
  167|       |
  168|  18.1k|    OPENSSL_free(cbdata.names);
  ------------------
  |  |  107|  18.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  18.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  18.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  169|  18.1k|    return 1;
  170|  18.1k|}
ossl_namemap_name2num:
  186|   217k|{
  187|   217k|    int number;
  188|       |
  189|   217k|#ifndef FIPS_MODULE
  190|   217k|    if (namemap == NULL)
  ------------------
  |  Branch (190:9): [True: 0, False: 217k]
  ------------------
  191|      0|        namemap = ossl_namemap_stored(NULL);
  192|   217k|#endif
  193|       |
  194|   217k|    if (namemap == NULL)
  ------------------
  |  Branch (194:9): [True: 0, False: 217k]
  ------------------
  195|      0|        return 0;
  196|       |
  197|   217k|    if (!CRYPTO_THREAD_read_lock(namemap->lock))
  ------------------
  |  Branch (197:9): [True: 0, False: 217k]
  ------------------
  198|      0|        return 0;
  199|   217k|    number = namemap_name2num(namemap, name);
  200|   217k|    CRYPTO_THREAD_unlock(namemap->lock);
  201|       |
  202|   217k|    return number;
  203|   217k|}
ossl_namemap_name2num_n:
  207|    207|{
  208|    207|    char *tmp;
  209|    207|    int ret;
  210|       |
  211|    207|    if (name == NULL || (tmp = OPENSSL_strndup(name, name_len)) == NULL)
  ------------------
  |  |  113|    207|        CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    207|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    207|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (211:9): [True: 0, False: 207]
  |  Branch (211:25): [True: 0, False: 207]
  ------------------
  212|      0|        return 0;
  213|       |
  214|    207|    ret = ossl_namemap_name2num(namemap, tmp);
  215|    207|    OPENSSL_free(tmp);
  ------------------
  |  |  107|    207|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    207|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    207|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  216|    207|    return ret;
  217|    207|}
ossl_namemap_add_name:
  279|    653|{
  280|    653|    int tmp_number;
  281|       |
  282|    653|#ifndef FIPS_MODULE
  283|    653|    if (namemap == NULL)
  ------------------
  |  Branch (283:9): [True: 0, False: 653]
  ------------------
  284|      0|        namemap = ossl_namemap_stored(NULL);
  285|    653|#endif
  286|       |
  287|    653|    if (name == NULL || *name == 0 || namemap == NULL)
  ------------------
  |  Branch (287:9): [True: 0, False: 653]
  |  Branch (287:25): [True: 0, False: 653]
  |  Branch (287:39): [True: 0, False: 653]
  ------------------
  288|      0|        return 0;
  289|       |
  290|    653|    if (!CRYPTO_THREAD_write_lock(namemap->lock))
  ------------------
  |  Branch (290:9): [True: 0, False: 653]
  ------------------
  291|      0|        return 0;
  292|    653|    tmp_number = namemap_add_name(namemap, number, name);
  293|    653|    CRYPTO_THREAD_unlock(namemap->lock);
  294|    653|    return tmp_number;
  295|    653|}
ossl_namemap_add_names:
  299|    206|{
  300|    206|    char *tmp, *p, *q, *endp;
  301|       |
  302|       |    /* Check that we have a namemap */
  303|    206|    if (!ossl_assert(namemap != NULL)) {
  ------------------
  |  |   52|    206|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    206|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (303:9): [True: 0, False: 206]
  ------------------
  304|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  305|      0|        return 0;
  306|      0|    }
  307|       |
  308|    206|    if ((tmp = OPENSSL_strdup(names)) == NULL)
  ------------------
  |  |  111|    206|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    206|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    206|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (308:9): [True: 0, False: 206]
  ------------------
  309|      0|        return 0;
  310|       |
  311|    206|    if (!CRYPTO_THREAD_write_lock(namemap->lock)) {
  ------------------
  |  Branch (311:9): [True: 0, False: 206]
  ------------------
  312|      0|        OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  313|      0|        return 0;
  314|      0|    }
  315|       |    /*
  316|       |     * Check that no name is an empty string, and that all names have at
  317|       |     * most one numeric identity together.
  318|       |     */
  319|    476|    for (p = tmp; *p != '\0'; p = q) {
  ------------------
  |  Branch (319:19): [True: 270, False: 206]
  ------------------
  320|    270|        int this_number;
  321|    270|        size_t l;
  322|       |
  323|    270|        if ((q = strchr(p, separator)) == NULL) {
  ------------------
  |  Branch (323:13): [True: 206, False: 64]
  ------------------
  324|    206|            l = strlen(p);       /* offset to \0 */
  325|    206|            q = p + l;
  326|    206|        } else {
  327|     64|            l = q - p;           /* offset to the next separator */
  328|     64|            *q++ = '\0';
  329|     64|        }
  330|       |
  331|    270|        if (*p == '\0') {
  ------------------
  |  Branch (331:13): [True: 0, False: 270]
  ------------------
  332|      0|            ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_BAD_ALGORITHM_NAME);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  333|      0|            number = 0;
  334|      0|            goto end;
  335|      0|        }
  336|       |
  337|    270|        this_number = namemap_name2num(namemap, p);
  338|       |
  339|    270|        if (number == 0) {
  ------------------
  |  Branch (339:13): [True: 229, False: 41]
  ------------------
  340|    229|            number = this_number;
  341|    229|        } else if (this_number != 0 && this_number != number) {
  ------------------
  |  Branch (341:20): [True: 36, False: 5]
  |  Branch (341:40): [True: 0, False: 36]
  ------------------
  342|      0|            ERR_raise_data(ERR_LIB_CRYPTO, CRYPTO_R_CONFLICTING_NAMES,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_CRYPTO, CRYPTO_R_CONFLICTING_NAMES,
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                          ERR_raise_data(ERR_LIB_CRYPTO, CRYPTO_R_CONFLICTING_NAMES,
  ------------------
  |  |   25|      0|# define CRYPTO_R_CONFLICTING_NAMES                       118
  ------------------
  343|      0|                           "\"%s\" has an existing different identity %d (from \"%s\")",
  344|      0|                           p, this_number, names);
  345|      0|            number = 0;
  346|      0|            goto end;
  347|      0|        }
  348|    270|    }
  349|    206|    endp = p;
  350|       |
  351|       |    /* Now that we have checked, register all names */
  352|    476|    for (p = tmp; p < endp; p = q) {
  ------------------
  |  Branch (352:19): [True: 270, False: 206]
  ------------------
  353|    270|        int this_number;
  354|       |
  355|    270|        q = p + strlen(p) + 1;
  356|       |
  357|    270|        this_number = namemap_add_name(namemap, number, p);
  358|    270|        if (number == 0) {
  ------------------
  |  Branch (358:13): [True: 22, False: 248]
  ------------------
  359|     22|            number = this_number;
  360|    248|        } else if (this_number != number) {
  ------------------
  |  Branch (360:20): [True: 0, False: 248]
  ------------------
  361|      0|            ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR,
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                          ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR,
  ------------------
  |  |  354|      0|# define ERR_R_INTERNAL_ERROR                    (259|ERR_R_FATAL)
  |  |  ------------------
  |  |  |  |  350|      0|# define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  236|      0|# define ERR_RFLAG_FATAL                (0x1 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  362|      0|                           "Got number %d when expecting %d",
  363|      0|                           this_number, number);
  364|      0|            number = 0;
  365|      0|            goto end;
  366|      0|        }
  367|    270|    }
  368|       |
  369|    206| end:
  370|    206|    CRYPTO_THREAD_unlock(namemap->lock);
  371|    206|    OPENSSL_free(tmp);
  ------------------
  |  |  107|    206|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    206|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    206|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  372|    206|    return number;
  373|    206|}
ossl_namemap_stored:
  471|   216k|{
  472|   216k|#ifndef FIPS_MODULE
  473|   216k|    int nms;
  474|   216k|#endif
  475|   216k|    OSSL_NAMEMAP *namemap =
  476|   216k|        ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX);
  ------------------
  |  |  102|   216k|# define OSSL_LIB_CTX_NAMEMAP_INDEX                  4
  ------------------
  477|       |
  478|   216k|    if (namemap == NULL)
  ------------------
  |  Branch (478:9): [True: 0, False: 216k]
  ------------------
  479|      0|        return NULL;
  480|       |
  481|   216k|#ifndef FIPS_MODULE
  482|   216k|    nms = ossl_namemap_empty(namemap);
  483|   216k|    if (nms < 0) {
  ------------------
  |  Branch (483:9): [True: 0, False: 216k]
  ------------------
  484|       |        /*
  485|       |         * Could not get lock to make the count, so maybe internal objects
  486|       |         * weren't added. This seems safest.
  487|       |         */
  488|      0|        return NULL;
  489|      0|    }
  490|   216k|    if (nms == 1) {
  ------------------
  |  Branch (490:9): [True: 1, False: 216k]
  ------------------
  491|      1|        int i, end;
  492|       |
  493|       |        /* Before pilfering, we make sure the legacy database is populated */
  494|      1|        OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
  ------------------
  |  |  451|      1|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  495|      1|                            | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
  ------------------
  |  |  452|      1|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  496|       |
  497|      1|        OBJ_NAME_do_all(OBJ_NAME_TYPE_CIPHER_METH,
  ------------------
  |  |   26|      1|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  498|      1|                        get_legacy_cipher_names, namemap);
  499|      1|        OBJ_NAME_do_all(OBJ_NAME_TYPE_MD_METH,
  ------------------
  |  |   25|      1|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  500|      1|                        get_legacy_md_names, namemap);
  501|       |
  502|       |        /* We also pilfer data from the legacy EVP_PKEY_ASN1_METHODs */
  503|     17|        for (i = 0, end = EVP_PKEY_asn1_get_count(); i < end; i++)
  ------------------
  |  Branch (503:54): [True: 16, False: 1]
  ------------------
  504|     16|            get_legacy_pkey_meth_names(EVP_PKEY_asn1_get0(i), namemap);
  505|      1|    }
  506|   216k|#endif
  507|       |
  508|   216k|    return namemap;
  509|   216k|}
ossl_namemap_new:
  512|      4|{
  513|      4|    OSSL_NAMEMAP *namemap;
  514|       |
  515|      4|    if ((namemap = OPENSSL_zalloc(sizeof(*namemap))) != NULL
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (515:9): [True: 4, False: 0]
  ------------------
  516|      4|        && (namemap->lock = CRYPTO_THREAD_lock_new()) != NULL
  ------------------
  |  Branch (516:12): [True: 4, False: 0]
  ------------------
  517|      4|        && (namemap->namenum =
  ------------------
  |  Branch (517:12): [True: 4, False: 0]
  ------------------
  518|      4|            lh_NAMENUM_ENTRY_new(namenum_hash, namenum_cmp)) != NULL)
  519|      4|        return namemap;
  520|       |
  521|      0|    ossl_namemap_free(namemap);
  522|      0|    return NULL;
  523|      4|}
ossl_namemap_free:
  526|      2|{
  527|      2|    if (namemap == NULL || namemap->stored)
  ------------------
  |  Branch (527:9): [True: 0, False: 2]
  |  Branch (527:28): [True: 0, False: 2]
  ------------------
  528|      0|        return;
  529|       |
  530|      2|    lh_NAMENUM_ENTRY_doall(namemap->namenum, namenum_free);
  531|      2|    lh_NAMENUM_ENTRY_free(namemap->namenum);
  532|       |
  533|      2|    CRYPTO_THREAD_lock_free(namemap->lock);
  534|      2|    OPENSSL_free(namemap);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  535|      2|}
core_namemap.c:do_name:
  117|  5.59M|{
  118|  5.59M|    if (namenum->number == data->number)
  ------------------
  |  Branch (118:9): [True: 77.0k, False: 5.52M]
  ------------------
  119|  77.0k|        data->names[data->found++] = namenum->name;
  120|  5.59M|}
core_namemap.c:namemap_name2num:
  175|   218k|{
  176|   218k|    NAMENUM_ENTRY *namenum_entry, namenum_tmpl;
  177|       |
  178|   218k|    namenum_tmpl.name = (char *)name;
  179|   218k|    namenum_tmpl.number = 0;
  180|   218k|    namenum_entry =
  181|   218k|        lh_NAMENUM_ENTRY_retrieve(namemap->namenum, &namenum_tmpl);
  182|   218k|    return namenum_entry != NULL ? namenum_entry->number : 0;
  ------------------
  |  Branch (182:12): [True: 203k, False: 15.1k]
  ------------------
  183|   218k|}
core_namemap.c:namemap_add_name:
  249|    923|{
  250|    923|    NAMENUM_ENTRY *namenum = NULL;
  251|    923|    int tmp_number;
  252|       |
  253|       |    /* If it already exists, we don't add it */
  254|    923|    if ((tmp_number = namemap_name2num(namemap, name)) != 0)
  ------------------
  |  Branch (254:9): [True: 613, False: 310]
  ------------------
  255|    613|        return tmp_number;
  256|       |
  257|    310|    if ((namenum = OPENSSL_zalloc(sizeof(*namenum))) == NULL)
  ------------------
  |  |   99|    310|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    310|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    310|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (257:9): [True: 0, False: 310]
  ------------------
  258|      0|        return 0;
  259|       |
  260|    310|    if ((namenum->name = OPENSSL_strdup(name)) == NULL)
  ------------------
  |  |  111|    310|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    310|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    310|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (260:9): [True: 0, False: 310]
  ------------------
  261|      0|        goto err;
  262|       |
  263|       |    /* The tsan_counter use here is safe since we're under lock */
  264|    310|    namenum->number =
  265|    310|        number != 0 ? number : 1 + tsan_counter(&namemap->max_number);
  ------------------
  |  |  150|    139|# define tsan_counter(ptr) tsan_add((ptr), 1)
  |  |  ------------------
  |  |  |  |   63|    449|#   define tsan_add(ptr, n) atomic_fetch_add_explicit((ptr), (n), memory_order_relaxed)
  |  |  ------------------
  ------------------
  |  Branch (265:9): [True: 171, False: 139]
  ------------------
  266|    310|    (void)lh_NAMENUM_ENTRY_insert(namemap->namenum, namenum);
  267|       |
  268|    310|    if (lh_NAMENUM_ENTRY_error(namemap->namenum))
  ------------------
  |  Branch (268:9): [True: 0, False: 310]
  ------------------
  269|      0|        goto err;
  270|    310|    return namenum->number;
  271|       |
  272|      0| err:
  273|      0|    namenum_free(namenum);
  274|      0|    return 0;
  275|    310|}
core_namemap.c:get_legacy_cipher_names:
  410|    183|{
  411|    183|    const EVP_CIPHER *cipher = (void *)OBJ_NAME_get(on->name, on->type);
  412|       |
  413|    183|    if (cipher != NULL)
  ------------------
  |  Branch (413:9): [True: 183, False: 0]
  ------------------
  414|    183|        get_legacy_evp_names(NID_undef, EVP_CIPHER_get_type(cipher), NULL, arg);
  ------------------
  |  |   18|    183|#define NID_undef                       0
  ------------------
  415|    183|}
core_namemap.c:get_legacy_evp_names:
  386|    259|{
  387|    259|    int num = 0;
  388|    259|    ASN1_OBJECT *obj;
  389|       |
  390|    259|    if (base_nid != NID_undef) {
  ------------------
  |  |   18|    259|#define NID_undef                       0
  ------------------
  |  Branch (390:9): [True: 5, False: 254]
  ------------------
  391|      5|        num = ossl_namemap_add_name(arg, num, OBJ_nid2sn(base_nid));
  392|      5|        num = ossl_namemap_add_name(arg, num, OBJ_nid2ln(base_nid));
  393|      5|    }
  394|       |
  395|    259|    if (nid != NID_undef) {
  ------------------
  |  |   18|    259|#define NID_undef                       0
  ------------------
  |  Branch (395:9): [True: 211, False: 48]
  ------------------
  396|    211|        num = ossl_namemap_add_name(arg, num, OBJ_nid2sn(nid));
  397|    211|        num = ossl_namemap_add_name(arg, num, OBJ_nid2ln(nid));
  398|    211|        if ((obj = OBJ_nid2obj(nid)) != NULL) {
  ------------------
  |  Branch (398:13): [True: 211, False: 0]
  ------------------
  399|    211|            char txtoid[OSSL_MAX_NAME_SIZE];
  400|       |
  401|    211|            if (OBJ_obj2txt(txtoid, sizeof(txtoid), obj, 1) > 0)
  ------------------
  |  Branch (401:17): [True: 210, False: 1]
  ------------------
  402|    210|                num = ossl_namemap_add_name(arg, num, txtoid);
  403|    211|        }
  404|    211|    }
  405|    259|    if (pem_name != NULL)
  ------------------
  |  Branch (405:9): [True: 11, False: 248]
  ------------------
  406|     11|        num = ossl_namemap_add_name(arg, num, pem_name);
  407|    259|}
core_namemap.c:get_legacy_md_names:
  418|     59|{
  419|     59|    const EVP_MD *md = (void *)OBJ_NAME_get(on->name, on->type);
  420|       |
  421|     59|    if (md != NULL)
  ------------------
  |  Branch (421:9): [True: 59, False: 0]
  ------------------
  422|     59|        get_legacy_evp_names(0, EVP_MD_get_type(md), NULL, arg);
  423|     59|}
core_namemap.c:get_legacy_pkey_meth_names:
  427|     16|{
  428|     16|    int nid = 0, base_nid = 0, flags = 0;
  429|     16|    const char *pem_name = NULL;
  430|       |
  431|     16|    EVP_PKEY_asn1_get0_info(&nid, &base_nid, &flags, NULL, &pem_name, ameth);
  432|     16|    if (nid != NID_undef) {
  ------------------
  |  |   18|     16|#define NID_undef                       0
  ------------------
  |  Branch (432:9): [True: 16, False: 0]
  ------------------
  433|     16|        if ((flags & ASN1_PKEY_ALIAS) == 0) {
  ------------------
  |  | 1549|     16|# define ASN1_PKEY_ALIAS         0x1
  ------------------
  |  Branch (433:13): [True: 10, False: 6]
  ------------------
  434|     10|            switch (nid) {
  435|      1|            case EVP_PKEY_DHX:
  ------------------
  |  |   68|      1|# define EVP_PKEY_DHX    NID_dhpublicnumber
  |  |  ------------------
  |  |  |  | 5295|      1|#define NID_dhpublicnumber              920
  |  |  ------------------
  ------------------
  |  Branch (435:13): [True: 1, False: 9]
  ------------------
  436|       |                /* We know that the name "DHX" is used too */
  437|      1|                get_legacy_evp_names(0, nid, "DHX", arg);
  438|       |                /* FALLTHRU */
  439|     10|            default:
  ------------------
  |  Branch (439:13): [True: 9, False: 1]
  ------------------
  440|     10|                get_legacy_evp_names(0, nid, pem_name, arg);
  441|     10|            }
  442|     10|        } else {
  443|       |            /*
  444|       |             * Treat aliases carefully, some of them are undesirable, or
  445|       |             * should not be treated as such for providers.
  446|       |             */
  447|       |
  448|      6|            switch (nid) {
  449|      1|            case EVP_PKEY_SM2:
  ------------------
  |  |   70|      1|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|      1|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  |  Branch (449:13): [True: 1, False: 5]
  ------------------
  450|       |                /*
  451|       |                 * SM2 is a separate keytype with providers, not an alias for
  452|       |                 * EC.
  453|       |                 */
  454|      1|                get_legacy_evp_names(0, nid, pem_name, arg);
  455|      1|                break;
  456|      5|            default:
  ------------------
  |  Branch (456:13): [True: 5, False: 1]
  ------------------
  457|       |                /* Use the short name of the base nid as the common reference */
  458|      5|                get_legacy_evp_names(base_nid, nid, pem_name, arg);
  459|      6|            }
  460|      6|        }
  461|     16|    }
  462|     16|}
core_namemap.c:namenum_hash:
   46|   218k|{
   47|   218k|    return ossl_lh_strcasehash(n->name);
   48|   218k|}
core_namemap.c:namenum_cmp:
   51|   203k|{
   52|   203k|    return OPENSSL_strcasecmp(a->name, b->name);
   53|   203k|}
core_namemap.c:namenum_free:
   56|    310|{
   57|    310|    if (n != NULL)
  ------------------
  |  Branch (57:9): [True: 310, False: 0]
  ------------------
   58|    310|        OPENSSL_free(n->name);
  ------------------
  |  |  107|    310|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    310|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    310|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   59|    310|    OPENSSL_free(n);
  ------------------
  |  |  107|    310|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    310|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    310|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   60|    310|}

ossl_err_load_CRYPTO_strings:
   82|      2|{
   83|      2|#ifndef OPENSSL_NO_ERR
   84|      2|    if (ERR_reason_error_string(CRYPTO_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (84:9): [True: 2, False: 0]
  ------------------
   85|      2|        ERR_load_strings_const(CRYPTO_str_reasons);
   86|      2|#endif
   87|      2|    return 1;
   88|      2|}

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

ossl_err_load_CRMF_strings:
   65|      2|{
   66|      2|# ifndef OPENSSL_NO_ERR
   67|      2|    if (ERR_reason_error_string(CRMF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (67:9): [True: 2, False: 0]
  ------------------
   68|      2|        ERR_load_strings_const(CRMF_str_reasons);
   69|      2|# endif
   70|      2|    return 1;
   71|      2|}

ossl_err_load_CT_strings:
   52|      2|{
   53|      2|# ifndef OPENSSL_NO_ERR
   54|      2|    if (ERR_reason_error_string(CT_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (54:9): [True: 2, False: 0]
  ------------------
   55|      2|        ERR_load_strings_const(CT_str_reasons);
   56|      2|# endif
   57|      2|    return 1;
   58|      2|}

ossl_ctype_check:
  253|   256k|{
  254|   256k|    const int max = sizeof(ctype_char_map) / sizeof(*ctype_char_map);
  255|   256k|    const int a = ossl_toascii(c);
  ------------------
  |  |   56|   256k|#  define ossl_toascii(c)       (c)
  ------------------
  256|       |
  257|   256k|    return a >= 0 && a < max && (ctype_char_map[a] & mask) != 0;
  ------------------
  |  Branch (257:12): [True: 256k, False: 0]
  |  Branch (257:22): [True: 255k, False: 1.76k]
  |  Branch (257:33): [True: 20.7k, False: 234k]
  ------------------
  258|   256k|}
ossl_isdigit:
  270|   184M|{
  271|   184M|    int a = ossl_toascii(c);
  ------------------
  |  |   56|   184M|#  define ossl_toascii(c)       (c)
  ------------------
  272|       |
  273|   184M|    return ASCII_IS_DIGIT(a);
  ------------------
  |  |  265|   184M|#define ASCII_IS_DIGIT(c)   (c >= 0x30 && c <= 0x39)
  |  |  ------------------
  |  |  |  Branch (265:30): [True: 174M, False: 9.38M]
  |  |  |  Branch (265:43): [True: 73.7M, False: 100M]
  |  |  ------------------
  ------------------
  274|   184M|}
ossl_isupper:
  277|  60.8k|{
  278|  60.8k|    int a = ossl_toascii(c);
  ------------------
  |  |   56|  60.8k|#  define ossl_toascii(c)       (c)
  ------------------
  279|       |
  280|  60.8k|    return ASCII_IS_UPPER(a);
  ------------------
  |  |  266|  60.8k|#define ASCII_IS_UPPER(c)   (c >= 0x41 && c <= 0x5A)
  |  |  ------------------
  |  |  |  Branch (266:30): [True: 52.0k, False: 8.79k]
  |  |  |  Branch (266:43): [True: 12.3k, False: 39.6k]
  |  |  ------------------
  ------------------
  281|  60.8k|}
ossl_tolower:
  297|  10.9M|{
  298|  10.9M|    int a = ossl_toascii(c);
  ------------------
  |  |   56|  10.9M|#  define ossl_toascii(c)       (c)
  ------------------
  299|       |
  300|  10.9M|    return ASCII_IS_UPPER(a) ? c ^ case_change : c;
  ------------------
  |  |  266|  10.9M|#define ASCII_IS_UPPER(c)   (c >= 0x41 && c <= 0x5A)
  |  |  ------------------
  |  |  |  Branch (266:30): [True: 8.95M, False: 1.99M]
  |  |  |  Branch (266:43): [True: 2.96M, False: 5.99M]
  |  |  ------------------
  ------------------
  301|  10.9M|}
ossl_ascii_isdigit:
  311|  42.7k|{
  312|  42.7k|    return ASCII_IS_DIGIT(c);
  ------------------
  |  |  265|  42.7k|#define ASCII_IS_DIGIT(c)   (c >= 0x30 && c <= 0x39)
  |  |  ------------------
  |  |  |  Branch (265:30): [True: 40.8k, False: 1.96k]
  |  |  |  Branch (265:43): [True: 40.1k, False: 632]
  |  |  ------------------
  ------------------
  313|  42.7k|}

ossl_DER_w_begin_sequence:
  172|      2|{
  173|      2|    return int_start_context(pkt, tag)
  ------------------
  |  Branch (173:12): [True: 2, False: 0]
  ------------------
  174|      2|        && WPACKET_start_sub_packet(pkt);
  ------------------
  |  Branch (174:12): [True: 2, False: 0]
  ------------------
  175|      2|}
ossl_DER_w_end_sequence:
  178|      2|{
  179|       |    /*
  180|       |     * If someone set the flag WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH on this
  181|       |     * sub-packet and this sub-packet has nothing written to it, the DER length
  182|       |     * will not be written, and the total written size will be unchanged before
  183|       |     * and after WPACKET_close().  We use size1 and size2 to determine if
  184|       |     * anything was written, and only write our tag if it has.
  185|       |     *
  186|       |     * Because we know that int_end_context() needs to do the same check,
  187|       |     * we reproduce this flag if the written length was unchanged, or we will
  188|       |     * have an erroneous context tag.
  189|       |     */
  190|      2|    size_t size1, size2;
  191|       |
  192|      2|    return WPACKET_get_total_written(pkt, &size1)
  ------------------
  |  Branch (192:12): [True: 2, False: 0]
  ------------------
  193|      2|        && WPACKET_close(pkt)
  ------------------
  |  Branch (193:12): [True: 2, False: 0]
  ------------------
  194|      2|        && WPACKET_get_total_written(pkt, &size2)
  ------------------
  |  Branch (194:12): [True: 2, False: 0]
  ------------------
  195|      2|        && (size1 == size2
  ------------------
  |  Branch (195:12): [True: 2, False: 0]
  |  Branch (195:13): [True: 0, False: 2]
  ------------------
  196|      2|            ? WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)
  ------------------
  |  |  692|      0|#define WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH    2
  ------------------
  197|      2|            : WPACKET_put_bytes_u8(pkt, DER_F_CONSTRUCTED | DER_P_SEQUENCE))
  ------------------
  |  |  878|      2|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  198|      2|        && int_end_context(pkt, tag);
  ------------------
  |  Branch (198:12): [True: 2, False: 0]
  ------------------
  199|      2|}
der_writer.c:int_start_context:
   17|      2|{
   18|      2|    if (tag < 0)
  ------------------
  |  Branch (18:9): [True: 2, False: 0]
  ------------------
   19|      2|        return 1;
   20|      0|    if (!ossl_assert(tag <= 30))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (20:9): [True: 0, False: 0]
  ------------------
   21|      0|        return 0;
   22|      0|    return WPACKET_start_sub_packet(pkt);
   23|      0|}
der_writer.c:int_end_context:
   26|      2|{
   27|       |    /*
   28|       |     * If someone set the flag WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH on this
   29|       |     * sub-packet and this sub-packet has nothing written to it, the DER length
   30|       |     * will not be written, and the total written size will be unchanged before
   31|       |     * and after WPACKET_close().  We use size1 and size2 to determine if
   32|       |     * anything was written, and only write our tag if it has.
   33|       |     *
   34|       |     */
   35|      2|    size_t size1, size2;
   36|       |
   37|      2|    if (tag < 0)
  ------------------
  |  Branch (37:9): [True: 2, False: 0]
  ------------------
   38|      2|        return 1;
   39|      0|    if (!ossl_assert(tag <= 30))
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (39:9): [True: 0, False: 0]
  ------------------
   40|      0|        return 0;
   41|       |
   42|       |    /* Context specific are normally (?) constructed */
   43|      0|    tag |= DER_F_CONSTRUCTED | DER_C_CONTEXT;
  ------------------
  |  |   58|      0|# define DER_F_CONSTRUCTED            0x20
  ------------------
                  tag |= DER_F_CONSTRUCTED | DER_C_CONTEXT;
  ------------------
  |  |   63|      0|# define DER_C_CONTEXT                0x80
  ------------------
   44|       |
   45|      0|    return WPACKET_get_total_written(pkt, &size1)
  ------------------
  |  Branch (45:12): [True: 0, False: 0]
  ------------------
   46|      0|        && WPACKET_close(pkt)
  ------------------
  |  Branch (46:12): [True: 0, False: 0]
  ------------------
   47|      0|        && WPACKET_get_total_written(pkt, &size2)
  ------------------
  |  Branch (47:12): [True: 0, False: 0]
  ------------------
   48|      0|        && (size1 == size2 || WPACKET_put_bytes_u8(pkt, tag));
  ------------------
  |  |  878|      0|    WPACKET_put_bytes__((pkt), (val), 1)
  |  |  ------------------
  |  |  |  Branch (878:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (48:13): [True: 0, False: 0]
  ------------------
   49|      0|}

dh_ameth.c:dh_pub_decode:
   61|  2.95k|{
   62|  2.95k|    const unsigned char *p, *pm;
   63|  2.95k|    int pklen, pmlen;
   64|  2.95k|    int ptype;
   65|  2.95k|    const void *pval;
   66|  2.95k|    const ASN1_STRING *pstr;
   67|  2.95k|    X509_ALGOR *palg;
   68|  2.95k|    ASN1_INTEGER *public_key = NULL;
   69|       |
   70|  2.95k|    DH *dh = NULL;
   71|       |
   72|  2.95k|    if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  ------------------
  |  Branch (72:9): [True: 0, False: 2.95k]
  ------------------
   73|      0|        return 0;
   74|  2.95k|    X509_ALGOR_get0(NULL, &ptype, &pval, palg);
   75|       |
   76|  2.95k|    if (ptype != V_ASN1_SEQUENCE) {
  ------------------
  |  |   74|  2.95k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (76:9): [True: 48, False: 2.90k]
  ------------------
   77|     48|        ERR_raise(ERR_LIB_DH, DH_R_PARAMETER_ENCODING_ERROR);
  ------------------
  |  |  401|     48|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     48|    (ERR_new(),                                                 \
  |  |  |  |  404|     48|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     48|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     48|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     48|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     48|     ERR_set_error)
  |  |  ------------------
  ------------------
   78|     48|        goto err;
   79|     48|    }
   80|       |
   81|  2.90k|    pstr = pval;
   82|  2.90k|    pm = pstr->data;
   83|  2.90k|    pmlen = pstr->length;
   84|       |
   85|  2.90k|    if ((dh = d2i_dhp(pkey, &pm, pmlen)) == NULL) {
  ------------------
  |  Branch (85:9): [True: 1.84k, False: 1.06k]
  ------------------
   86|  1.84k|        ERR_raise(ERR_LIB_DH, DH_R_DECODE_ERROR);
  ------------------
  |  |  401|  1.84k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.84k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.84k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.84k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.84k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.84k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.84k|     ERR_set_error)
  |  |  ------------------
  ------------------
   87|  1.84k|        goto err;
   88|  1.84k|    }
   89|       |
   90|  1.06k|    if ((public_key = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL) {
  ------------------
  |  Branch (90:9): [True: 1.00k, False: 61]
  ------------------
   91|  1.00k|        ERR_raise(ERR_LIB_DH, DH_R_DECODE_ERROR);
  ------------------
  |  |  401|  1.00k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.00k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.00k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.00k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.00k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.00k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.00k|     ERR_set_error)
  |  |  ------------------
  ------------------
   92|  1.00k|        goto err;
   93|  1.00k|    }
   94|       |
   95|       |    /* We have parameters now set public key */
   96|     61|    if ((dh->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) {
  ------------------
  |  Branch (96:9): [True: 0, False: 61]
  ------------------
   97|      0|        ERR_raise(ERR_LIB_DH, DH_R_BN_DECODE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   98|      0|        goto err;
   99|      0|    }
  100|       |
  101|     61|    ASN1_INTEGER_free(public_key);
  102|     61|    EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
  103|     61|    return 1;
  104|       |
  105|  2.89k| err:
  106|  2.89k|    ASN1_INTEGER_free(public_key);
  107|  2.89k|    DH_free(dh);
  108|  2.89k|    return 0;
  109|     61|}
dh_ameth.c:d2i_dhp:
   36|  2.90k|{
   37|  2.90k|    DH *dh = NULL;
   38|  2.90k|    int is_dhx = (pkey->ameth == &ossl_dhx_asn1_meth);
   39|       |
   40|  2.90k|    if (is_dhx)
  ------------------
  |  Branch (40:9): [True: 2.76k, False: 137]
  ------------------
   41|  2.76k|        dh = d2i_DHxparams(NULL, pp, length);
   42|    137|    else
   43|    137|        dh = d2i_DHparams(NULL, pp, length);
   44|       |
   45|  2.90k|    return dh;
   46|  2.90k|}
dh_ameth.c:dh_priv_decode:
  165|      9|{
  166|      9|    int ret = 0;
  167|      9|    DH *dh = ossl_dh_key_from_pkcs8(p8, NULL, NULL);
  168|       |
  169|      9|    if (dh != NULL) {
  ------------------
  |  Branch (169:9): [True: 0, False: 9]
  ------------------
  170|      0|        ret = 1;
  171|      0|        EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
  172|      0|    }
  173|       |
  174|      9|    return ret;
  175|      9|}
dh_ameth.c:int_dh_free:
   56|  2.96k|{
   57|  2.96k|    DH_free(pkey->pkey.dh);
   58|  2.96k|}

d2i_DHxparams:
   94|  14.5k|{
   95|  14.5k|    FFC_PARAMS *params;
   96|  14.5k|    int_dhx942_dh *dhx = NULL;
   97|  14.5k|    DH *dh = NULL;
   98|       |
   99|  14.5k|    dh = DH_new();
  100|  14.5k|    if (dh == NULL)
  ------------------
  |  Branch (100:9): [True: 0, False: 14.5k]
  ------------------
  101|      0|        return NULL;
  102|  14.5k|    dhx = d2i_int_dhx(NULL, pp, length);
  103|  14.5k|    if (dhx == NULL) {
  ------------------
  |  Branch (103:9): [True: 13.4k, False: 1.08k]
  ------------------
  104|  13.4k|        DH_free(dh);
  105|  13.4k|        return NULL;
  106|  13.4k|    }
  107|       |
  108|  1.08k|    if (a != NULL) {
  ------------------
  |  Branch (108:9): [True: 0, False: 1.08k]
  ------------------
  109|      0|        DH_free(*a);
  110|      0|        *a = dh;
  111|      0|    }
  112|       |
  113|  1.08k|    params = &dh->params;
  114|  1.08k|    DH_set0_pqg(dh, dhx->p, dhx->q, dhx->g);
  115|  1.08k|    ossl_ffc_params_set0_j(params, dhx->j);
  116|       |
  117|  1.08k|    if (dhx->vparams != NULL) {
  ------------------
  |  Branch (117:9): [True: 28, False: 1.05k]
  ------------------
  118|       |        /* The counter has a maximum value of 4 * numbits(p) - 1 */
  119|     28|        size_t counter = (size_t)BN_get_word(dhx->vparams->counter);
  120|     28|        ossl_ffc_params_set_validate_params(params, dhx->vparams->seed->data,
  121|     28|                                            dhx->vparams->seed->length,
  122|     28|                                            counter);
  123|     28|        ASN1_BIT_STRING_free(dhx->vparams->seed);
  124|     28|        BN_free(dhx->vparams->counter);
  125|     28|        OPENSSL_free(dhx->vparams);
  ------------------
  |  |  107|     28|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     28|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     28|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  126|     28|        dhx->vparams = NULL;
  127|     28|    }
  128|       |
  129|  1.08k|    OPENSSL_free(dhx);
  ------------------
  |  |  107|  1.08k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  130|  1.08k|    DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
  ------------------
  |  |  106|  1.08k|#  define DH_FLAG_TYPE_MASK             0xF000
  ------------------
  131|  1.08k|    DH_set_flags(dh, DH_FLAG_TYPE_DHX);
  ------------------
  |  |  108|  1.08k|#  define DH_FLAG_TYPE_DHX              0x1000
  ------------------
  132|  1.08k|    return dh;
  133|  14.5k|}
i2d_DHxparams:
  136|     75|{
  137|     75|    int ret = 0;
  138|     75|    int_dhx942_dh dhx;
  139|     75|    int_dhvparams dhv = { NULL, NULL };
  140|     75|    ASN1_BIT_STRING seed;
  141|     75|    size_t seedlen = 0;
  142|     75|    const FFC_PARAMS *params = &dh->params;
  143|     75|    int counter;
  144|       |
  145|     75|    ossl_ffc_params_get0_pqg(params, (const BIGNUM **)&dhx.p,
  146|     75|                             (const BIGNUM **)&dhx.q, (const BIGNUM **)&dhx.g);
  147|     75|    dhx.j = params->j;
  148|     75|    ossl_ffc_params_get_validate_params(params, &seed.data, &seedlen, &counter);
  149|     75|    seed.length = (int)seedlen;
  150|       |
  151|     75|    if (counter != -1 && seed.data != NULL && seed.length > 0) {
  ------------------
  |  Branch (151:9): [True: 27, False: 48]
  |  Branch (151:26): [True: 26, False: 1]
  |  Branch (151:47): [True: 26, False: 0]
  ------------------
  152|     26|        seed.flags = ASN1_STRING_FLAG_BITS_LEFT;
  ------------------
  |  |  161|     26|# define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
  ------------------
  153|     26|        dhv.seed = &seed;
  154|     26|        dhv.counter = BN_new();
  155|     26|        if (dhv.counter == NULL)
  ------------------
  |  Branch (155:13): [True: 0, False: 26]
  ------------------
  156|      0|            return 0;
  157|     26|        if (!BN_set_word(dhv.counter, (BN_ULONG)counter))
  ------------------
  |  Branch (157:13): [True: 0, False: 26]
  ------------------
  158|      0|            goto err;
  159|     26|        dhx.vparams = &dhv;
  160|     49|    } else {
  161|     49|        dhx.vparams = NULL;
  162|     49|    }
  163|     75|    ret = i2d_int_dhx(&dhx, pp);
  164|     75|err:
  165|     75|    BN_free(dhv.counter);
  166|     75|    return ret;
  167|     75|}
dh_asn1.c:dh_cb:
   27|  56.3k|{
   28|  56.3k|    if (operation == ASN1_OP_NEW_PRE) {
  ------------------
  |  |  742|  56.3k|# define ASN1_OP_NEW_PRE         0
  ------------------
  |  Branch (28:9): [True: 18.5k, False: 37.7k]
  ------------------
   29|  18.5k|        *pval = (ASN1_VALUE *)DH_new();
   30|  18.5k|        if (*pval != NULL)
  ------------------
  |  Branch (30:13): [True: 18.5k, False: 0]
  ------------------
   31|  18.5k|            return 2;
   32|      0|        return 0;
   33|  37.7k|    } else if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|  37.7k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (33:16): [True: 18.4k, False: 19.2k]
  ------------------
   34|  18.4k|        DH_free((DH *)*pval);
   35|  18.4k|        *pval = NULL;
   36|  18.4k|        return 2;
   37|  19.2k|    } else if (operation == ASN1_OP_D2I_POST) {
  ------------------
  |  |  747|  19.2k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (37:16): [True: 184, False: 19.0k]
  ------------------
   38|    184|        DH *dh = (DH *)*pval;
   39|       |
   40|    184|        DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
  ------------------
  |  |  106|    184|#  define DH_FLAG_TYPE_MASK             0xF000
  ------------------
   41|    184|        DH_set_flags(dh, DH_FLAG_TYPE_DH);
  ------------------
  |  |  107|    184|#  define DH_FLAG_TYPE_DH               0x0000
  ------------------
   42|    184|        ossl_dh_cache_named_group(dh);
   43|    184|        dh->dirty_cnt++;
   44|    184|    }
   45|  19.2k|    return 1;
   46|  56.3k|}

ossl_dh_params_todata:
   92|     86|{
   93|     86|    long l = DH_get_length(dh);
   94|       |
   95|     86|    if (!ossl_ffc_params_todata(ossl_dh_get0_params(dh), bld, params))
  ------------------
  |  Branch (95:9): [True: 0, False: 86]
  ------------------
   96|      0|        return 0;
   97|     86|    if (l > 0
  ------------------
  |  Branch (97:9): [True: 25, False: 61]
  ------------------
   98|     86|        && !ossl_param_build_set_long(bld, params, OSSL_PKEY_PARAM_DH_PRIV_LEN, l))
  ------------------
  |  |  321|     25|# define OSSL_PKEY_PARAM_DH_PRIV_LEN "priv_len"
  ------------------
  |  Branch (98:12): [True: 0, False: 25]
  ------------------
   99|      0|        return 0;
  100|     86|    return 1;
  101|     86|}
ossl_dh_key_todata:
  105|     86|{
  106|     86|    const BIGNUM *priv = NULL, *pub = NULL;
  107|       |
  108|     86|    if (dh == NULL)
  ------------------
  |  Branch (108:9): [True: 0, False: 86]
  ------------------
  109|      0|        return 0;
  110|       |
  111|     86|    DH_get0_key(dh, &pub, &priv);
  112|     86|    if (priv != NULL
  ------------------
  |  Branch (112:9): [True: 25, False: 61]
  ------------------
  113|     86|        && include_private
  ------------------
  |  Branch (113:12): [True: 25, False: 0]
  ------------------
  114|     86|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_PRIV_KEY, priv))
  ------------------
  |  |  372|     25|# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
  ------------------
  |  Branch (114:12): [True: 0, False: 25]
  ------------------
  115|      0|        return 0;
  116|     86|    if (pub != NULL
  ------------------
  |  Branch (116:9): [True: 86, False: 0]
  ------------------
  117|     86|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_PUB_KEY, pub))
  ------------------
  |  |  374|     86|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  |  Branch (117:12): [True: 0, False: 86]
  ------------------
  118|      0|        return 0;
  119|       |
  120|     86|    return 1;
  121|     86|}
ossl_dh_is_foreign:
  124|     60|{
  125|     60|#ifndef FIPS_MODULE
  126|     60|    if (dh->engine != NULL || ossl_dh_get_method(dh) != DH_OpenSSL())
  ------------------
  |  Branch (126:9): [True: 0, False: 60]
  |  Branch (126:31): [True: 0, False: 60]
  ------------------
  127|      0|        return 1;
  128|     60|#endif
  129|     60|    return 0;
  130|     60|}
ossl_dh_key_from_pkcs8:
  183|     46|{
  184|     46|    const unsigned char *p, *pm;
  185|     46|    int pklen, pmlen;
  186|     46|    int ptype;
  187|     46|    const void *pval;
  188|     46|    const ASN1_STRING *pstr;
  189|     46|    const X509_ALGOR *palg;
  190|     46|    BIGNUM *privkey_bn = NULL;
  191|     46|    ASN1_INTEGER *privkey = NULL;
  192|     46|    DH *dh = NULL;
  193|       |
  194|     46|    if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8inf))
  ------------------
  |  Branch (194:9): [True: 0, False: 46]
  ------------------
  195|      0|        return 0;
  196|       |
  197|     46|    X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  198|       |
  199|     46|    if (ptype != V_ASN1_SEQUENCE)
  ------------------
  |  |   74|     46|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (199:9): [True: 11, False: 35]
  ------------------
  200|     11|        goto decerr;
  201|     35|    if ((privkey = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL)
  ------------------
  |  Branch (201:9): [True: 3, False: 32]
  ------------------
  202|      3|        goto decerr;
  203|       |
  204|     32|    pstr = pval;
  205|     32|    pm = pstr->data;
  206|     32|    pmlen = pstr->length;
  207|     32|    switch (OBJ_obj2nid(palg->algorithm)) {
  208|      0|    case NID_dhKeyAgreement:
  ------------------
  |  |  621|      0|#define NID_dhKeyAgreement              28
  ------------------
  |  Branch (208:5): [True: 0, False: 32]
  ------------------
  209|      0|        dh = d2i_DHparams(NULL, &pm, pmlen);
  210|      0|        break;
  211|     32|    case NID_dhpublicnumber:
  ------------------
  |  | 5295|     32|#define NID_dhpublicnumber              920
  ------------------
  |  Branch (211:5): [True: 32, False: 0]
  ------------------
  212|     32|        dh = d2i_DHxparams(NULL, &pm, pmlen);
  213|     32|        break;
  214|      0|    default:
  ------------------
  |  Branch (214:5): [True: 0, False: 32]
  ------------------
  215|      0|        goto decerr;
  216|     32|    }
  217|     32|    if (dh == NULL)
  ------------------
  |  Branch (217:9): [True: 3, False: 29]
  ------------------
  218|      3|        goto decerr;
  219|       |
  220|       |    /* We have parameters now set private key */
  221|     29|    if ((privkey_bn = BN_secure_new()) == NULL
  ------------------
  |  Branch (221:9): [True: 0, False: 29]
  ------------------
  222|     29|        || !ASN1_INTEGER_to_BN(privkey, privkey_bn)) {
  ------------------
  |  Branch (222:12): [True: 0, False: 29]
  ------------------
  223|      0|        ERR_raise(ERR_LIB_DH, DH_R_BN_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  224|      0|        BN_clear_free(privkey_bn);
  225|      0|        goto dherr;
  226|      0|    }
  227|     29|    if (!DH_set0_key(dh, NULL, privkey_bn))
  ------------------
  |  Branch (227:9): [True: 0, False: 29]
  ------------------
  228|      0|        goto dherr;
  229|       |    /* Calculate public key, increments dirty_cnt */
  230|     29|    if (!DH_generate_key(dh))
  ------------------
  |  Branch (230:9): [True: 4, False: 25]
  ------------------
  231|      4|        goto dherr;
  232|       |
  233|     25|    goto done;
  234|       |
  235|     25| decerr:
  236|     17|    ERR_raise(ERR_LIB_DH, EVP_R_DECODE_ERROR);
  ------------------
  |  |  401|     17|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     17|    (ERR_new(),                                                 \
  |  |  |  |  404|     17|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     17|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     17|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     17|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     17|     ERR_set_error)
  |  |  ------------------
  ------------------
  237|     21| dherr:
  238|     21|    DH_free(dh);
  239|     21|    dh = NULL;
  240|     46| done:
  241|     46|    ASN1_STRING_clear_free(privkey);
  242|     46|    return dh;
  243|     21|}

ossl_err_load_DH_strings:
   67|      2|{
   68|      2|# ifndef OPENSSL_NO_ERR
   69|      2|    if (ERR_reason_error_string(DH_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (69:9): [True: 2, False: 0]
  ------------------
   70|      2|        ERR_load_strings_const(DH_str_reasons);
   71|      2|# endif
   72|      2|    return 1;
   73|      2|}

ossl_dh_cache_named_group:
   57|  1.26k|{
   58|  1.26k|    const DH_NAMED_GROUP *group;
   59|       |
   60|  1.26k|    if (dh == NULL)
  ------------------
  |  Branch (60:9): [True: 0, False: 1.26k]
  ------------------
   61|      0|        return;
   62|       |
   63|  1.26k|    dh->params.nid = NID_undef; /* flush cached value */
  ------------------
  |  |   18|  1.26k|#define NID_undef                       0
  ------------------
   64|       |
   65|       |    /* Exit if p or g is not set */
   66|  1.26k|    if (dh->params.p == NULL
  ------------------
  |  Branch (66:9): [True: 0, False: 1.26k]
  ------------------
   67|  1.26k|        || dh->params.g == NULL)
  ------------------
  |  Branch (67:12): [True: 0, False: 1.26k]
  ------------------
   68|      0|        return;
   69|       |
   70|  1.26k|    if ((group = ossl_ffc_numbers_to_dh_named_group(dh->params.p,
  ------------------
  |  Branch (70:9): [True: 0, False: 1.26k]
  ------------------
   71|  1.26k|                                                    dh->params.q,
   72|  1.26k|                                                    dh->params.g)) != NULL) {
   73|      0|        if (dh->params.q == NULL)
  ------------------
  |  Branch (73:13): [True: 0, False: 0]
  ------------------
   74|      0|            dh->params.q = (BIGNUM *)ossl_ffc_named_group_get_q(group);
   75|       |        /* cache the nid and default key length */
   76|      0|        dh->params.nid = ossl_ffc_named_group_get_uid(group);
   77|      0|        dh->params.keylength = ossl_ffc_named_group_get_keylength(group);
   78|      0|        dh->dirty_cnt++;
   79|      0|    }
   80|  1.26k|}

DH_OpenSSL:
  174|     60|{
  175|     60|    return &dh_ossl;
  176|     60|}
DH_get_default_method:
  179|  33.1k|{
  180|  33.1k|    return default_DH_method;
  181|  33.1k|}
DH_generate_key:
  216|     29|{
  217|       |#ifdef FIPS_MODULE
  218|       |    return generate_key(dh);
  219|       |#else
  220|     29|    return dh->meth->generate_key(dh);
  221|     29|#endif
  222|     29|}
ossl_dh_generate_public_key:
  226|     27|{
  227|     27|    int ret = 0;
  228|     27|    BIGNUM *prk = BN_new();
  229|     27|    BN_MONT_CTX *mont = NULL;
  230|       |
  231|     27|    if (prk == NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 27]
  ------------------
  232|      0|        return 0;
  233|       |
  234|     27|    if (dh->flags & DH_FLAG_CACHE_MONT_P) {
  ------------------
  |  |  104|     27|#  define DH_FLAG_CACHE_MONT_P     0x01
  ------------------
  |  Branch (234:9): [True: 27, False: 0]
  ------------------
  235|       |        /*
  236|       |         * We take the input DH as const, but we lie, because in some cases we
  237|       |         * want to get a hold of its Montgomery context.
  238|       |         *
  239|       |         * We cast to remove the const qualifier in this case, it should be
  240|       |         * fine...
  241|       |         */
  242|     27|        BN_MONT_CTX **pmont = (BN_MONT_CTX **)&dh->method_mont_p;
  243|       |
  244|     27|        mont = BN_MONT_CTX_set_locked(pmont, dh->lock, dh->params.p, ctx);
  245|     27|        if (mont == NULL)
  ------------------
  |  Branch (245:13): [True: 2, False: 25]
  ------------------
  246|      2|            goto err;
  247|     27|    }
  248|     25|    BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|     25|# define BN_FLG_CONSTTIME        0x04
  ------------------
  249|       |
  250|       |    /* pub_key = g^priv_key mod p */
  251|     25|    if (!dh->meth->bn_mod_exp(dh, pub_key, dh->params.g, prk, dh->params.p,
  ------------------
  |  Branch (251:9): [True: 0, False: 25]
  ------------------
  252|     25|                              ctx, mont))
  253|      0|        goto err;
  254|     25|    ret = 1;
  255|     27|err:
  256|     27|    BN_clear_free(prk);
  257|     27|    return ret;
  258|     25|}
dh_key.c:generate_key:
  261|     29|{
  262|     29|    int ok = 0;
  263|     29|    int generate_new_key = 0;
  264|     29|#ifndef FIPS_MODULE
  265|     29|    unsigned l;
  266|     29|#endif
  267|     29|    BN_CTX *ctx = NULL;
  268|     29|    BIGNUM *pub_key = NULL, *priv_key = NULL;
  269|       |
  270|     29|    if (BN_num_bits(dh->params.p) > OPENSSL_DH_MAX_MODULUS_BITS) {
  ------------------
  |  |   95|     29|#   define OPENSSL_DH_MAX_MODULUS_BITS        10000
  ------------------
  |  Branch (270:9): [True: 0, False: 29]
  ------------------
  271|      0|        ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|        return 0;
  273|      0|    }
  274|       |
  275|     29|    if (BN_num_bits(dh->params.p) < DH_MIN_MODULUS_BITS) {
  ------------------
  |  |   14|     29|#define DH_MIN_MODULUS_BITS     512
  ------------------
  |  Branch (275:9): [True: 2, False: 27]
  ------------------
  276|      2|        ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  277|      2|        return 0;
  278|      2|    }
  279|       |
  280|     27|    ctx = BN_CTX_new_ex(dh->libctx);
  281|     27|    if (ctx == NULL)
  ------------------
  |  Branch (281:9): [True: 0, False: 27]
  ------------------
  282|      0|        goto err;
  283|       |
  284|     27|    if (dh->priv_key == NULL) {
  ------------------
  |  Branch (284:9): [True: 0, False: 27]
  ------------------
  285|      0|        priv_key = BN_secure_new();
  286|      0|        if (priv_key == NULL)
  ------------------
  |  Branch (286:13): [True: 0, False: 0]
  ------------------
  287|      0|            goto err;
  288|      0|        generate_new_key = 1;
  289|     27|    } else {
  290|     27|        priv_key = dh->priv_key;
  291|     27|    }
  292|       |
  293|     27|    if (dh->pub_key == NULL) {
  ------------------
  |  Branch (293:9): [True: 27, False: 0]
  ------------------
  294|     27|        pub_key = BN_new();
  295|     27|        if (pub_key == NULL)
  ------------------
  |  Branch (295:13): [True: 0, False: 27]
  ------------------
  296|      0|            goto err;
  297|     27|    } else {
  298|      0|        pub_key = dh->pub_key;
  299|      0|    }
  300|     27|    if (generate_new_key) {
  ------------------
  |  Branch (300:9): [True: 0, False: 27]
  ------------------
  301|       |        /* Is it an approved safe prime ?*/
  302|      0|        if (DH_get_nid(dh) != NID_undef) {
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (302:13): [True: 0, False: 0]
  ------------------
  303|      0|            int max_strength =
  304|      0|                    ossl_ifc_ffc_compute_security_bits(BN_num_bits(dh->params.p));
  305|       |
  306|      0|            if (dh->params.q == NULL
  ------------------
  |  Branch (306:17): [True: 0, False: 0]
  ------------------
  307|      0|                || dh->length > BN_num_bits(dh->params.q))
  ------------------
  |  Branch (307:20): [True: 0, False: 0]
  ------------------
  308|      0|                goto err;
  309|       |            /* dh->length = maximum bit length of generated private key */
  310|      0|            if (!ossl_ffc_generate_private_key(ctx, &dh->params, dh->length,
  ------------------
  |  Branch (310:17): [True: 0, False: 0]
  ------------------
  311|      0|                                               max_strength, priv_key))
  312|      0|                goto err;
  313|      0|        } else {
  314|       |#ifdef FIPS_MODULE
  315|       |            if (dh->params.q == NULL)
  316|       |                goto err;
  317|       |#else
  318|      0|            if (dh->params.q == NULL) {
  ------------------
  |  Branch (318:17): [True: 0, False: 0]
  ------------------
  319|       |                /* secret exponent length, must satisfy 2^(l-1) <= p */
  320|      0|                if (dh->length != 0
  ------------------
  |  Branch (320:21): [True: 0, False: 0]
  ------------------
  321|      0|                    && dh->length >= BN_num_bits(dh->params.p))
  ------------------
  |  Branch (321:24): [True: 0, False: 0]
  ------------------
  322|      0|                    goto err;
  323|      0|                l = dh->length ? dh->length : BN_num_bits(dh->params.p) - 1;
  ------------------
  |  Branch (323:21): [True: 0, False: 0]
  ------------------
  324|      0|                if (!BN_priv_rand_ex(priv_key, l, BN_RAND_TOP_ONE,
  ------------------
  |  |   81|      0|#define BN_RAND_TOP_ONE     0
  ------------------
  |  Branch (324:21): [True: 0, False: 0]
  ------------------
  325|      0|                                     BN_RAND_BOTTOM_ANY, 0, ctx))
  ------------------
  |  |   85|      0|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  326|      0|                    goto err;
  327|       |                /*
  328|       |                 * We handle just one known case where g is a quadratic non-residue:
  329|       |                 * for g = 2: p % 8 == 3
  330|       |                 */
  331|      0|                if (BN_is_word(dh->params.g, DH_GENERATOR_2)
  ------------------
  |  |  143|      0|#   define DH_GENERATOR_2          2
  ------------------
  |  Branch (331:21): [True: 0, False: 0]
  ------------------
  332|      0|                    && !BN_is_bit_set(dh->params.p, 2)) {
  ------------------
  |  Branch (332:24): [True: 0, False: 0]
  ------------------
  333|       |                    /* clear bit 0, since it won't be a secret anyway */
  334|      0|                    if (!BN_clear_bit(priv_key, 0))
  ------------------
  |  Branch (334:25): [True: 0, False: 0]
  ------------------
  335|      0|                        goto err;
  336|      0|                }
  337|      0|            } else
  338|      0|#endif
  339|      0|            {
  340|       |                /* Do a partial check for invalid p, q, g */
  341|      0|                if (!ossl_ffc_params_simple_validate(dh->libctx, &dh->params,
  ------------------
  |  Branch (341:21): [True: 0, False: 0]
  ------------------
  342|      0|                                                     FFC_PARAM_TYPE_DH, NULL))
  ------------------
  |  |   27|      0|# define FFC_PARAM_TYPE_DH   1
  ------------------
  343|      0|                    goto err;
  344|       |                /*
  345|       |                 * For FFC FIPS 186-4 keygen
  346|       |                 * security strength s = 112,
  347|       |                 * Max Private key size N = len(q)
  348|       |                 */
  349|      0|                if (!ossl_ffc_generate_private_key(ctx, &dh->params,
  ------------------
  |  Branch (349:21): [True: 0, False: 0]
  ------------------
  350|      0|                                                   BN_num_bits(dh->params.q),
  351|      0|                                                   MIN_STRENGTH,
  ------------------
  |  |   26|      0|# define MIN_STRENGTH 80
  ------------------
  352|      0|                                                   priv_key))
  353|      0|                    goto err;
  354|      0|            }
  355|      0|        }
  356|      0|    }
  357|       |
  358|     27|    if (!ossl_dh_generate_public_key(ctx, dh, priv_key, pub_key))
  ------------------
  |  Branch (358:9): [True: 2, False: 25]
  ------------------
  359|      2|        goto err;
  360|       |
  361|     25|    dh->pub_key = pub_key;
  362|     25|    dh->priv_key = priv_key;
  363|     25|    dh->dirty_cnt++;
  364|     25|    ok = 1;
  365|     27| err:
  366|     27|    if (ok != 1)
  ------------------
  |  Branch (366:9): [True: 2, False: 25]
  ------------------
  367|     27|        ERR_raise(ERR_LIB_DH, ERR_R_BN_LIB);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  368|       |
  369|     27|    if (pub_key != dh->pub_key)
  ------------------
  |  Branch (369:9): [True: 2, False: 25]
  ------------------
  370|      2|        BN_free(pub_key);
  371|     27|    if (priv_key != dh->priv_key)
  ------------------
  |  Branch (371:9): [True: 0, False: 27]
  ------------------
  372|      0|        BN_free(priv_key);
  373|     27|    BN_CTX_free(ctx);
  374|     27|    return ok;
  375|     25|}
dh_key.c:dh_bn_mod_exp:
  186|     25|{
  187|       |#ifdef S390X_MOD_EXP
  188|       |    return s390x_mod_exp(r, a, p, m, ctx, m_ctx);
  189|       |#else
  190|     25|    return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx);
  191|     25|#endif
  192|     25|}
dh_key.c:dh_init:
  195|  33.1k|{
  196|  33.1k|    dh->flags |= DH_FLAG_CACHE_MONT_P;
  ------------------
  |  |  104|  33.1k|#  define DH_FLAG_CACHE_MONT_P     0x01
  ------------------
  197|  33.1k|    ossl_ffc_params_init(&dh->params);
  198|  33.1k|    dh->dirty_cnt++;
  199|  33.1k|    return 1;
  200|  33.1k|}
dh_key.c:dh_finish:
  203|  33.1k|{
  204|  33.1k|    BN_MONT_CTX_free(dh->method_mont_p);
  205|  33.1k|    return 1;
  206|  33.1k|}

ossl_dh_get_method:
   53|     60|{
   54|     60|    return dh->meth;
   55|     60|}
DH_new:
   58|  33.1k|{
   59|  33.1k|    return dh_new_intern(NULL, NULL);
   60|  33.1k|}
DH_free:
  135|  61.2k|{
  136|  61.2k|    int i;
  137|       |
  138|  61.2k|    if (r == NULL)
  ------------------
  |  Branch (138:9): [True: 28.0k, False: 33.1k]
  ------------------
  139|  28.0k|        return;
  140|       |
  141|  33.1k|    CRYPTO_DOWN_REF(&r->references, &i);
  142|  33.1k|    REF_PRINT_COUNT("DH", r);
  ------------------
  |  |  289|  33.1k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  33.1k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  33.1k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  33.1k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  143|  33.1k|    if (i > 0)
  ------------------
  |  Branch (143:9): [True: 61, False: 33.1k]
  ------------------
  144|     61|        return;
  145|  33.1k|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|  33.1k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 33.1k]
  |  |  ------------------
  ------------------
  146|       |
  147|  33.1k|    if (r->meth != NULL && r->meth->finish != NULL)
  ------------------
  |  Branch (147:9): [True: 33.1k, False: 0]
  |  Branch (147:28): [True: 33.1k, False: 0]
  ------------------
  148|  33.1k|        r->meth->finish(r);
  149|  33.1k|#if !defined(FIPS_MODULE)
  150|  33.1k|# if !defined(OPENSSL_NO_ENGINE)
  151|  33.1k|    ENGINE_finish(r->engine);
  152|  33.1k|# endif
  153|  33.1k|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data);
  ------------------
  |  |  224|  33.1k|# define CRYPTO_EX_INDEX_DH               6
  ------------------
  154|  33.1k|#endif
  155|       |
  156|  33.1k|    CRYPTO_THREAD_lock_free(r->lock);
  157|  33.1k|    CRYPTO_FREE_REF(&r->references);
  158|       |
  159|  33.1k|    ossl_ffc_params_cleanup(&r->params);
  160|  33.1k|    BN_clear_free(r->pub_key);
  161|  33.1k|    BN_clear_free(r->priv_key);
  162|  33.1k|    OPENSSL_free(r);
  ------------------
  |  |  107|  33.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  33.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  33.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|  33.1k|}
DH_up_ref:
  166|     61|{
  167|     61|    int i;
  168|       |
  169|     61|    if (CRYPTO_UP_REF(&r->references, &i) <= 0)
  ------------------
  |  Branch (169:9): [True: 0, False: 61]
  ------------------
  170|      0|        return 0;
  171|       |
  172|     61|    REF_PRINT_COUNT("DH", r);
  ------------------
  |  |  289|     61|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|     61|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|     61|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|     61|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  173|     61|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|     61|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 61]
  |  |  ------------------
  ------------------
  174|     61|    return ((i > 1) ? 1 : 0);
  ------------------
  |  Branch (174:13): [True: 61, False: 0]
  ------------------
  175|     61|}
ossl_dh_set0_libctx:
  178|     86|{
  179|     86|    d->libctx = libctx;
  180|     86|}
DH_bits:
  195|     86|{
  196|     86|    if (dh->params.p != NULL)
  ------------------
  |  Branch (196:9): [True: 86, False: 0]
  ------------------
  197|     86|        return BN_num_bits(dh->params.p);
  198|      0|    return -1;
  199|     86|}
DH_size:
  202|     86|{
  203|     86|    if (dh->params.p != NULL)
  ------------------
  |  Branch (203:9): [True: 86, False: 0]
  ------------------
  204|     86|        return BN_num_bytes(dh->params.p);
  ------------------
  |  |  189|     86|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  205|      0|    return -1;
  206|     86|}
DH_security_bits:
  209|     86|{
  210|     86|    int N;
  211|       |
  212|     86|    if (dh->params.q != NULL)
  ------------------
  |  Branch (212:9): [True: 26, False: 60]
  ------------------
  213|     26|        N = BN_num_bits(dh->params.q);
  214|     60|    else if (dh->length)
  ------------------
  |  Branch (214:14): [True: 53, False: 7]
  ------------------
  215|     53|        N = dh->length;
  216|      7|    else
  217|      7|        N = -1;
  218|     86|    if (dh->params.p != NULL)
  ------------------
  |  Branch (218:9): [True: 86, False: 0]
  ------------------
  219|     86|        return BN_security_bits(BN_num_bits(dh->params.p), N);
  220|      0|    return -1;
  221|     86|}
DH_set0_pqg:
  230|  1.08k|{
  231|       |    /*
  232|       |     * If the fields p and g in dh are NULL, the corresponding input
  233|       |     * parameters MUST be non-NULL.  q may remain NULL.
  234|       |     */
  235|  1.08k|    if ((dh->params.p == NULL && p == NULL)
  ------------------
  |  Branch (235:10): [True: 1.08k, False: 0]
  |  Branch (235:34): [True: 0, False: 1.08k]
  ------------------
  236|  1.08k|        || (dh->params.g == NULL && g == NULL))
  ------------------
  |  Branch (236:13): [True: 1.08k, False: 0]
  |  Branch (236:37): [True: 0, False: 1.08k]
  ------------------
  237|      0|        return 0;
  238|       |
  239|  1.08k|    ossl_ffc_params_set0_pqg(&dh->params, p, q, g);
  240|  1.08k|    ossl_dh_cache_named_group(dh);
  241|  1.08k|    dh->dirty_cnt++;
  242|  1.08k|    return 1;
  243|  1.08k|}
DH_get_length:
  246|    111|{
  247|    111|    return dh->length;
  248|    111|}
DH_get0_key:
  258|     86|{
  259|     86|    if (pub_key != NULL)
  ------------------
  |  Branch (259:9): [True: 86, False: 0]
  ------------------
  260|     86|        *pub_key = dh->pub_key;
  261|     86|    if (priv_key != NULL)
  ------------------
  |  Branch (261:9): [True: 86, False: 0]
  ------------------
  262|     86|        *priv_key = dh->priv_key;
  263|     86|}
DH_set0_key:
  266|     29|{
  267|     29|    if (pub_key != NULL) {
  ------------------
  |  Branch (267:9): [True: 0, False: 29]
  ------------------
  268|      0|        BN_clear_free(dh->pub_key);
  269|      0|        dh->pub_key = pub_key;
  270|      0|    }
  271|     29|    if (priv_key != NULL) {
  ------------------
  |  Branch (271:9): [True: 29, False: 0]
  ------------------
  272|     29|        BN_clear_free(dh->priv_key);
  273|     29|        dh->priv_key = priv_key;
  274|     29|    }
  275|       |
  276|     29|    dh->dirty_cnt++;
  277|     29|    return 1;
  278|     29|}
DH_get0_p:
  281|     25|{
  282|     25|    return dh->params.p;
  283|     25|}
DH_get0_priv_key:
  296|     75|{
  297|     75|    return dh->priv_key;
  298|     75|}
DH_get0_pub_key:
  301|     25|{
  302|     25|    return dh->pub_key;
  303|     25|}
DH_clear_flags:
  306|  1.26k|{
  307|  1.26k|    dh->flags &= ~flags;
  308|  1.26k|}
DH_test_flags:
  311|     25|{
  312|     25|    return dh->flags & flags;
  313|     25|}
DH_set_flags:
  316|  1.26k|{
  317|  1.26k|    dh->flags |= flags;
  318|  1.26k|}
ossl_dh_get0_params:
  328|    111|{
  329|    111|    return &dh->params;
  330|    111|}
dh_lib.c:dh_new_intern:
   75|  33.1k|{
   76|  33.1k|    DH *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  33.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  33.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  33.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|       |
   78|  33.1k|    if (ret == NULL)
  ------------------
  |  Branch (78:9): [True: 0, False: 33.1k]
  ------------------
   79|      0|        return NULL;
   80|       |
   81|  33.1k|    ret->lock = CRYPTO_THREAD_lock_new();
   82|  33.1k|    if (ret->lock == NULL) {
  ------------------
  |  Branch (82:9): [True: 0, False: 33.1k]
  ------------------
   83|      0|        ERR_raise(ERR_LIB_DH, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   84|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   85|      0|        return NULL;
   86|      0|    }
   87|       |
   88|  33.1k|    if (!CRYPTO_NEW_REF(&ret->references, 1)) {
  ------------------
  |  Branch (88:9): [True: 0, False: 33.1k]
  ------------------
   89|      0|        CRYPTO_THREAD_lock_free(ret->lock);
   90|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   91|      0|        return NULL;
   92|      0|    }
   93|       |
   94|  33.1k|    ret->libctx = libctx;
   95|  33.1k|    ret->meth = DH_get_default_method();
   96|  33.1k|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE)
   97|  33.1k|    ret->flags = ret->meth->flags;  /* early default init */
   98|  33.1k|    if (engine) {
  ------------------
  |  Branch (98:9): [True: 0, False: 33.1k]
  ------------------
   99|      0|        if (!ENGINE_init(engine)) {
  ------------------
  |  Branch (99:13): [True: 0, False: 0]
  ------------------
  100|      0|            ERR_raise(ERR_LIB_DH, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  101|      0|            goto err;
  102|      0|        }
  103|      0|        ret->engine = engine;
  104|      0|    } else
  105|  33.1k|        ret->engine = ENGINE_get_default_DH();
  106|  33.1k|    if (ret->engine) {
  ------------------
  |  Branch (106:9): [True: 0, False: 33.1k]
  ------------------
  107|      0|        ret->meth = ENGINE_get_DH(ret->engine);
  108|      0|        if (ret->meth == NULL) {
  ------------------
  |  Branch (108:13): [True: 0, False: 0]
  ------------------
  109|      0|            ERR_raise(ERR_LIB_DH, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  110|      0|            goto err;
  111|      0|        }
  112|      0|    }
  113|  33.1k|#endif
  114|       |
  115|  33.1k|    ret->flags = ret->meth->flags;
  116|       |
  117|  33.1k|#ifndef FIPS_MODULE
  118|  33.1k|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data))
  ------------------
  |  |  224|  33.1k|# define CRYPTO_EX_INDEX_DH               6
  ------------------
  |  Branch (118:9): [True: 0, False: 33.1k]
  ------------------
  119|      0|        goto err;
  120|  33.1k|#endif /* FIPS_MODULE */
  121|       |
  122|  33.1k|    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
  ------------------
  |  Branch (122:9): [True: 33.1k, False: 0]
  |  Branch (122:38): [True: 0, False: 33.1k]
  ------------------
  123|      0|        ERR_raise(ERR_LIB_DH, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  124|      0|        goto err;
  125|      0|    }
  126|       |
  127|  33.1k|    return ret;
  128|       |
  129|      0| err:
  130|      0|    DH_free(ret);
  131|      0|    return NULL;
  132|  33.1k|}

dsa_ameth.c:dsa_pub_decode:
   30|  2.25k|{
   31|  2.25k|    const unsigned char *p, *pm;
   32|  2.25k|    int pklen, pmlen;
   33|  2.25k|    int ptype;
   34|  2.25k|    const void *pval;
   35|  2.25k|    const ASN1_STRING *pstr;
   36|  2.25k|    X509_ALGOR *palg;
   37|  2.25k|    ASN1_INTEGER *public_key = NULL;
   38|       |
   39|  2.25k|    DSA *dsa = NULL;
   40|       |
   41|  2.25k|    if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  ------------------
  |  Branch (41:9): [True: 0, False: 2.25k]
  ------------------
   42|      0|        return 0;
   43|  2.25k|    X509_ALGOR_get0(NULL, &ptype, &pval, palg);
   44|       |
   45|  2.25k|    if (ptype == V_ASN1_SEQUENCE) {
  ------------------
  |  |   74|  2.25k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (45:9): [True: 131, False: 2.12k]
  ------------------
   46|    131|        pstr = pval;
   47|    131|        pm = pstr->data;
   48|    131|        pmlen = pstr->length;
   49|       |
   50|    131|        if ((dsa = d2i_DSAparams(NULL, &pm, pmlen)) == NULL) {
  ------------------
  |  Branch (50:13): [True: 86, False: 45]
  ------------------
   51|     86|            ERR_raise(ERR_LIB_DSA, DSA_R_DECODE_ERROR);
  ------------------
  |  |  401|     86|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     86|    (ERR_new(),                                                 \
  |  |  |  |  404|     86|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     86|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     86|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     86|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     86|     ERR_set_error)
  |  |  ------------------
  ------------------
   52|     86|            goto err;
   53|     86|        }
   54|       |
   55|  2.12k|    } else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF)) {
  ------------------
  |  |   67|  2.12k|# define V_ASN1_NULL                     5
  ------------------
                  } else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF)) {
  ------------------
  |  |   60|  1.84k|# define V_ASN1_UNDEF                    -1
  ------------------
  |  Branch (55:16): [True: 281, False: 1.84k]
  |  Branch (55:42): [True: 1.76k, False: 82]
  ------------------
   56|  2.04k|        if ((dsa = DSA_new()) == NULL) {
  ------------------
  |  Branch (56:13): [True: 0, False: 2.04k]
  ------------------
   57|      0|            ERR_raise(ERR_LIB_DSA, ERR_R_DSA_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   58|      0|            goto err;
   59|      0|        }
   60|  2.04k|    } else {
   61|     82|        ERR_raise(ERR_LIB_DSA, DSA_R_PARAMETER_ENCODING_ERROR);
  ------------------
  |  |  401|     82|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     82|    (ERR_new(),                                                 \
  |  |  |  |  404|     82|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     82|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     82|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     82|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     82|     ERR_set_error)
  |  |  ------------------
  ------------------
   62|     82|        goto err;
   63|     82|    }
   64|       |
   65|  2.09k|    if ((public_key = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL) {
  ------------------
  |  Branch (65:9): [True: 2.07k, False: 18]
  ------------------
   66|  2.07k|        ERR_raise(ERR_LIB_DSA, DSA_R_DECODE_ERROR);
  ------------------
  |  |  401|  2.07k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  2.07k|    (ERR_new(),                                                 \
  |  |  |  |  404|  2.07k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  2.07k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  2.07k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  2.07k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  2.07k|     ERR_set_error)
  |  |  ------------------
  ------------------
   67|  2.07k|        goto err;
   68|  2.07k|    }
   69|       |
   70|     18|    if ((dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) {
  ------------------
  |  Branch (70:9): [True: 0, False: 18]
  ------------------
   71|      0|        ERR_raise(ERR_LIB_DSA, DSA_R_BN_DECODE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   72|      0|        goto err;
   73|      0|    }
   74|       |
   75|     18|    dsa->dirty_cnt++;
   76|     18|    ASN1_INTEGER_free(public_key);
   77|     18|    EVP_PKEY_assign_DSA(pkey, dsa);
  ------------------
  |  |  503|     18|#  define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
  |  |  ------------------
  |  |  |  |   62|     18|# define EVP_PKEY_DSA    NID_dsa
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|     18|#define NID_dsa         116
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  504|     18|                                        (dsa))
  ------------------
   78|     18|    return 1;
   79|       |
   80|  2.24k| err:
   81|  2.24k|    ASN1_INTEGER_free(public_key);
   82|  2.24k|    DSA_free(dsa);
   83|  2.24k|    return 0;
   84|       |
   85|     18|}
dsa_ameth.c:do_dsa_print:
  273|     68|{
  274|     68|    int ret = 0;
  275|     68|    const char *ktype = NULL;
  276|     68|    const BIGNUM *priv_key, *pub_key;
  277|     68|    int mod_len = 0;
  278|       |
  279|     68|    if (x->params.p != NULL)
  ------------------
  |  Branch (279:9): [True: 68, False: 0]
  ------------------
  280|     68|        mod_len = DSA_bits(x);
  281|       |
  282|     68|    if (ptype == 2)
  ------------------
  |  Branch (282:9): [True: 68, False: 0]
  ------------------
  283|     68|        priv_key = x->priv_key;
  284|      0|    else
  285|      0|        priv_key = NULL;
  286|       |
  287|     68|    if (ptype > 0)
  ------------------
  |  Branch (287:9): [True: 68, False: 0]
  ------------------
  288|     68|        pub_key = x->pub_key;
  289|      0|    else
  290|      0|        pub_key = NULL;
  291|       |
  292|     68|    if (ptype == 2)
  ------------------
  |  Branch (292:9): [True: 68, False: 0]
  ------------------
  293|     68|        ktype = "Private-Key";
  294|      0|    else if (ptype == 1)
  ------------------
  |  Branch (294:14): [True: 0, False: 0]
  ------------------
  295|      0|        ktype = "Public-Key";
  296|      0|    else
  297|      0|        ktype = "DSA-Parameters";
  298|       |
  299|     68|    if (priv_key != NULL) {
  ------------------
  |  Branch (299:9): [True: 68, False: 0]
  ------------------
  300|     68|        if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (300:13): [True: 0, False: 68]
  ------------------
  301|      0|            goto err;
  302|     68|        if (BIO_printf(bp, "%s: (%d bit)\n", ktype, mod_len) <= 0)
  ------------------
  |  Branch (302:13): [True: 0, False: 68]
  ------------------
  303|      0|            goto err;
  304|     68|    } else {
  305|      0|        if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0)
  ------------------
  |  Branch (305:13): [True: 0, False: 0]
  ------------------
  306|      0|            goto err;
  307|      0|    }
  308|       |
  309|     68|    if (!ASN1_bn_print(bp, "priv:", priv_key, NULL, off))
  ------------------
  |  Branch (309:9): [True: 0, False: 68]
  ------------------
  310|      0|        goto err;
  311|     68|    if (!ASN1_bn_print(bp, "pub: ", pub_key, NULL, off))
  ------------------
  |  Branch (311:9): [True: 0, False: 68]
  ------------------
  312|      0|        goto err;
  313|     68|    if (!ossl_ffc_params_print(bp, &x->params, off))
  ------------------
  |  Branch (313:9): [True: 0, False: 68]
  ------------------
  314|      0|        goto err;
  315|     68|    ret = 1;
  316|     68| err:
  317|     68|    return ret;
  318|     68|}
dsa_ameth.c:dsa_priv_decode:
  151|     84|{
  152|     84|    int ret = 0;
  153|     84|    DSA *dsa = ossl_dsa_key_from_pkcs8(p8, NULL, NULL);
  154|       |
  155|     84|    if (dsa != NULL) {
  ------------------
  |  Branch (155:9): [True: 67, False: 17]
  ------------------
  156|     67|        ret = 1;
  157|     67|        EVP_PKEY_assign_DSA(pkey, dsa);
  ------------------
  |  |  503|     67|#  define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
  |  |  ------------------
  |  |  |  |   62|     67|# define EVP_PKEY_DSA    NID_dsa
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|     67|#define NID_dsa         116
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  504|     67|                                        (dsa))
  ------------------
  158|     67|    }
  159|       |
  160|     84|    return ret;
  161|     84|}
dsa_ameth.c:dsa_priv_print:
  352|     68|{
  353|     68|    return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);
  354|     68|}
dsa_ameth.c:int_dsa_free:
  268|  2.55k|{
  269|  2.55k|    DSA_free(pkey->pkey.dsa);
  270|  2.55k|}
dsa_ameth.c:old_dsa_priv_decode:
  358|    214|{
  359|    214|    DSA *dsa;
  360|       |
  361|    214|    if ((dsa = d2i_DSAPrivateKey(NULL, pder, derlen)) == NULL) {
  ------------------
  |  Branch (361:9): [True: 213, False: 1]
  ------------------
  362|    213|        ERR_raise(ERR_LIB_DSA, ERR_R_DSA_LIB);
  ------------------
  |  |  401|    213|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    213|    (ERR_new(),                                                 \
  |  |  |  |  404|    213|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    213|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    213|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    213|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    213|     ERR_set_error)
  |  |  ------------------
  ------------------
  363|    213|        return 0;
  364|    213|    }
  365|      1|    dsa->dirty_cnt++;
  366|      1|    EVP_PKEY_assign_DSA(pkey, dsa);
  ------------------
  |  |  503|      1|#  define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
  |  |  ------------------
  |  |  |  |   62|      1|# define EVP_PKEY_DSA    NID_dsa
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|      1|#define NID_dsa         116
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  504|      1|                                        (dsa))
  ------------------
  367|      1|    return 1;
  368|    214|}
dsa_ameth.c:old_dsa_priv_encode:
  371|     68|{
  372|     68|    return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);
  373|     68|}

dsa_asn1.c:dsa_cb:
   27|   132k|{
   28|   132k|    if (operation == ASN1_OP_NEW_PRE) {
  ------------------
  |  |  742|   132k|# define ASN1_OP_NEW_PRE         0
  ------------------
  |  Branch (28:9): [True: 43.7k, False: 89.2k]
  ------------------
   29|  43.7k|        *pval = (ASN1_VALUE *)DSA_new();
   30|  43.7k|        if (*pval != NULL)
  ------------------
  |  Branch (30:13): [True: 43.7k, False: 0]
  ------------------
   31|  43.7k|            return 2;
   32|      0|        return 0;
   33|  89.2k|    } else if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|  89.2k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (33:16): [True: 43.0k, False: 46.2k]
  ------------------
   34|  43.0k|        DSA_free((DSA *)*pval);
   35|  43.0k|        *pval = NULL;
   36|  43.0k|        return 2;
   37|  43.0k|    }
   38|  46.2k|    return 1;
   39|   132k|}

ossl_dsa_is_foreign:
   67|     86|{
   68|     86|#ifndef FIPS_MODULE
   69|     86|    if (dsa->engine != NULL || DSA_get_method((DSA *)dsa) != DSA_OpenSSL())
  ------------------
  |  Branch (69:9): [True: 0, False: 86]
  |  Branch (69:32): [True: 0, False: 86]
  ------------------
   70|      0|        return 1;
   71|     86|#endif
   72|     86|    return 0;
   73|     86|}
ossl_dsa_key_from_pkcs8:
  125|    542|{
  126|    542|    const unsigned char *p, *pm;
  127|    542|    int pklen, pmlen;
  128|    542|    int ptype;
  129|    542|    const void *pval;
  130|    542|    const ASN1_STRING *pstr;
  131|    542|    const X509_ALGOR *palg;
  132|    542|    ASN1_INTEGER *privkey = NULL;
  133|    542|    const BIGNUM *dsa_p, *dsa_g;
  134|    542|    BIGNUM *dsa_pubkey = NULL, *dsa_privkey = NULL;
  135|    542|    BN_CTX *ctx = NULL;
  136|       |
  137|    542|    DSA *dsa = NULL;
  138|       |
  139|    542|    if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8inf))
  ------------------
  |  Branch (139:9): [True: 0, False: 542]
  ------------------
  140|      0|        return 0;
  141|    542|    X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  142|       |
  143|    542|    if ((privkey = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL)
  ------------------
  |  Branch (143:9): [True: 4, False: 538]
  ------------------
  144|      4|        goto decerr;
  145|    538|    if (privkey->type == V_ASN1_NEG_INTEGER || ptype != V_ASN1_SEQUENCE)
  ------------------
  |  |   98|  1.07k|# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
  |  |  ------------------
  |  |  |  |   97|    538|# define V_ASN1_NEG                      0x100
  |  |  ------------------
  ------------------
                  if (privkey->type == V_ASN1_NEG_INTEGER || ptype != V_ASN1_SEQUENCE)
  ------------------
  |  |   74|    535|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (145:9): [True: 3, False: 535]
  |  Branch (145:48): [True: 9, False: 526]
  ------------------
  146|     12|        goto decerr;
  147|       |
  148|    526|    pstr = pval;
  149|    526|    pm = pstr->data;
  150|    526|    pmlen = pstr->length;
  151|    526|    if ((dsa = d2i_DSAparams(NULL, &pm, pmlen)) == NULL)
  ------------------
  |  Branch (151:9): [True: 3, False: 523]
  ------------------
  152|      3|        goto decerr;
  153|       |    /* We have parameters now set private key */
  154|    523|    if ((dsa_privkey = BN_secure_new()) == NULL
  ------------------
  |  Branch (154:9): [True: 0, False: 523]
  ------------------
  155|    523|        || !ASN1_INTEGER_to_BN(privkey, dsa_privkey)) {
  ------------------
  |  Branch (155:12): [True: 0, False: 523]
  ------------------
  156|      0|        ERR_raise(ERR_LIB_DSA, DSA_R_BN_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  157|      0|        goto dsaerr;
  158|      0|    }
  159|       |    /* Calculate public key */
  160|    523|    if ((dsa_pubkey = BN_new()) == NULL) {
  ------------------
  |  Branch (160:9): [True: 0, False: 523]
  ------------------
  161|      0|        ERR_raise(ERR_LIB_DSA, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  162|      0|        goto dsaerr;
  163|      0|    }
  164|    523|    if ((ctx = BN_CTX_new()) == NULL) {
  ------------------
  |  Branch (164:9): [True: 0, False: 523]
  ------------------
  165|      0|        ERR_raise(ERR_LIB_DSA, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  166|      0|        goto dsaerr;
  167|      0|    }
  168|       |
  169|    523|    dsa_p = DSA_get0_p(dsa);
  170|    523|    dsa_g = DSA_get0_g(dsa);
  171|    523|    BN_set_flags(dsa_privkey, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|    523|# define BN_FLG_CONSTTIME        0x04
  ------------------
  172|    523|    if (!BN_mod_exp(dsa_pubkey, dsa_g, dsa_privkey, dsa_p, ctx)) {
  ------------------
  |  Branch (172:9): [True: 6, False: 517]
  ------------------
  173|      6|        ERR_raise(ERR_LIB_DSA, DSA_R_BN_ERROR);
  ------------------
  |  |  401|      6|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      6|    (ERR_new(),                                                 \
  |  |  |  |  404|      6|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      6|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      6|     ERR_set_error)
  |  |  ------------------
  ------------------
  174|      6|        goto dsaerr;
  175|      6|    }
  176|    517|    if (!DSA_set0_key(dsa, dsa_pubkey, dsa_privkey)) {
  ------------------
  |  Branch (176:9): [True: 0, False: 517]
  ------------------
  177|      0|        ERR_raise(ERR_LIB_DSA, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  178|      0|        goto dsaerr;
  179|      0|    }
  180|       |
  181|    517|    goto done;
  182|       |
  183|    517| decerr:
  184|     19|    ERR_raise(ERR_LIB_DSA, DSA_R_DECODE_ERROR);
  ------------------
  |  |  401|     19|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     19|    (ERR_new(),                                                 \
  |  |  |  |  404|     19|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     19|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     19|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     19|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     19|     ERR_set_error)
  |  |  ------------------
  ------------------
  185|     25| dsaerr:
  186|     25|    BN_free(dsa_privkey);
  187|     25|    BN_free(dsa_pubkey);
  188|     25|    DSA_free(dsa);
  189|     25|    dsa = NULL;
  190|    542| done:
  191|    542|    BN_CTX_free(ctx);
  192|    542|    ASN1_STRING_clear_free(privkey);
  193|    542|    return dsa;
  194|     25|}

ossl_err_load_DSA_strings:
   46|      2|{
   47|      2|# ifndef OPENSSL_NO_ERR
   48|      2|    if (ERR_reason_error_string(DSA_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (48:9): [True: 2, False: 0]
  ------------------
   49|      2|        ERR_load_strings_const(DSA_str_reasons);
   50|      2|# endif
   51|      2|    return 1;
   52|      2|}

DSA_get_method:
  129|     86|{
  130|     86|    return d->meth;
  131|     86|}
DSA_new:
  206|  45.7k|{
  207|  45.7k|    return dsa_new_intern(NULL, NULL);
  208|  45.7k|}
DSA_free:
  212|  88.0k|{
  213|  88.0k|    int i;
  214|       |
  215|  88.0k|    if (r == NULL)
  ------------------
  |  Branch (215:9): [True: 42.2k, False: 45.7k]
  ------------------
  216|  42.2k|        return;
  217|       |
  218|  45.7k|    CRYPTO_DOWN_REF(&r->references, &i);
  219|  45.7k|    REF_PRINT_COUNT("DSA", r);
  ------------------
  |  |  289|  45.7k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  45.7k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  45.7k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  45.7k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  220|  45.7k|    if (i > 0)
  ------------------
  |  Branch (220:9): [True: 18, False: 45.7k]
  ------------------
  221|     18|        return;
  222|  45.7k|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|  45.7k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 45.7k]
  |  |  ------------------
  ------------------
  223|       |
  224|  45.7k|    if (r->meth != NULL && r->meth->finish != NULL)
  ------------------
  |  Branch (224:9): [True: 45.7k, False: 0]
  |  Branch (224:28): [True: 45.7k, False: 0]
  ------------------
  225|  45.7k|        r->meth->finish(r);
  226|  45.7k|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE)
  227|  45.7k|    ENGINE_finish(r->engine);
  228|  45.7k|#endif
  229|       |
  230|  45.7k|#ifndef FIPS_MODULE
  231|  45.7k|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, r, &r->ex_data);
  ------------------
  |  |  225|  45.7k|# define CRYPTO_EX_INDEX_DSA              7
  ------------------
  232|  45.7k|#endif
  233|       |
  234|  45.7k|    CRYPTO_THREAD_lock_free(r->lock);
  235|  45.7k|    CRYPTO_FREE_REF(&r->references);
  236|       |
  237|  45.7k|    ossl_ffc_params_cleanup(&r->params);
  238|  45.7k|    BN_clear_free(r->pub_key);
  239|  45.7k|    BN_clear_free(r->priv_key);
  240|  45.7k|    OPENSSL_free(r);
  ------------------
  |  |  107|  45.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  45.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  45.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  241|  45.7k|}
DSA_up_ref:
  244|     18|{
  245|     18|    int i;
  246|       |
  247|     18|    if (CRYPTO_UP_REF(&r->references, &i) <= 0)
  ------------------
  |  Branch (247:9): [True: 0, False: 18]
  ------------------
  248|      0|        return 0;
  249|       |
  250|     18|    REF_PRINT_COUNT("DSA", r);
  ------------------
  |  |  289|     18|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|     18|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|     18|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|     18|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|     18|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|     18|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 18]
  |  |  ------------------
  ------------------
  252|     18|    return ((i > 1) ? 1 : 0);
  ------------------
  |  Branch (252:13): [True: 18, False: 0]
  ------------------
  253|     18|}
ossl_dsa_set0_libctx:
  256|    505|{
  257|    505|    d->libctx = libctx;
  258|    505|}
DSA_get0_pqg:
  262|     18|{
  263|     18|    ossl_ffc_params_get0_pqg(&d->params, p, q, g);
  264|     18|}
DSA_get0_p:
  283|  1.01k|{
  284|  1.01k|    return d->params.p;
  285|  1.01k|}
DSA_get0_g:
  293|    523|{
  294|    523|    return d->params.g;
  295|    523|}
DSA_get0_pub_key:
  298|    495|{
  299|    495|    return d->pub_key;
  300|    495|}
DSA_get0_priv_key:
  303|    990|{
  304|    990|    return d->priv_key;
  305|    990|}
DSA_get0_key:
  309|    505|{
  310|    505|    if (pub_key != NULL)
  ------------------
  |  Branch (310:9): [True: 505, False: 0]
  ------------------
  311|    505|        *pub_key = d->pub_key;
  312|    505|    if (priv_key != NULL)
  ------------------
  |  Branch (312:9): [True: 505, False: 0]
  ------------------
  313|    505|        *priv_key = d->priv_key;
  314|    505|}
DSA_set0_key:
  317|    517|{
  318|    517|    if (pub_key != NULL) {
  ------------------
  |  Branch (318:9): [True: 517, False: 0]
  ------------------
  319|    517|        BN_free(d->pub_key);
  320|    517|        d->pub_key = pub_key;
  321|    517|    }
  322|    517|    if (priv_key != NULL) {
  ------------------
  |  Branch (322:9): [True: 517, False: 0]
  ------------------
  323|    517|        BN_free(d->priv_key);
  324|    517|        d->priv_key = priv_key;
  325|    517|    }
  326|    517|    d->dirty_cnt++;
  327|       |
  328|    517|    return 1;
  329|    517|}
DSA_security_bits:
  332|    505|{
  333|    505|    if (d->params.p != NULL && d->params.q != NULL)
  ------------------
  |  Branch (333:9): [True: 505, False: 0]
  |  Branch (333:32): [True: 505, False: 0]
  ------------------
  334|    505|        return BN_security_bits(BN_num_bits(d->params.p),
  335|    505|                                BN_num_bits(d->params.q));
  336|      0|    return -1;
  337|    505|}
DSA_bits:
  340|    573|{
  341|    573|    if (dsa->params.p != NULL)
  ------------------
  |  Branch (341:9): [True: 573, False: 0]
  ------------------
  342|    573|        return BN_num_bits(dsa->params.p);
  343|      0|    return -1;
  344|    573|}
ossl_dsa_get0_params:
  347|  1.00k|{
  348|  1.00k|    return &dsa->params;
  349|  1.00k|}
dsa_lib.c:dsa_new_intern:
  134|  45.7k|{
  135|  45.7k|    DSA *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  45.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  45.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  45.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  136|       |
  137|  45.7k|    if (ret == NULL)
  ------------------
  |  Branch (137:9): [True: 0, False: 45.7k]
  ------------------
  138|      0|        return NULL;
  139|       |
  140|  45.7k|    ret->lock = CRYPTO_THREAD_lock_new();
  141|  45.7k|    if (ret->lock == NULL) {
  ------------------
  |  Branch (141:9): [True: 0, False: 45.7k]
  ------------------
  142|      0|        ERR_raise(ERR_LIB_DSA, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  143|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  144|      0|        return NULL;
  145|      0|    }
  146|       |
  147|  45.7k|    if (!CRYPTO_NEW_REF(&ret->references, 1)) {
  ------------------
  |  Branch (147:9): [True: 0, False: 45.7k]
  ------------------
  148|      0|        CRYPTO_THREAD_lock_free(ret->lock);
  149|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  150|      0|        return NULL;
  151|      0|    }
  152|       |
  153|  45.7k|    ret->libctx = libctx;
  154|  45.7k|    ret->meth = DSA_get_default_method();
  155|  45.7k|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE)
  156|  45.7k|    ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW; /* early default init */
  ------------------
  |  |   99|  45.7k|#   define DSA_FLAG_NON_FIPS_ALLOW                 0x0400
  ------------------
  157|  45.7k|    if (engine) {
  ------------------
  |  Branch (157:9): [True: 0, False: 45.7k]
  ------------------
  158|      0|        if (!ENGINE_init(engine)) {
  ------------------
  |  Branch (158:13): [True: 0, False: 0]
  ------------------
  159|      0|            ERR_raise(ERR_LIB_DSA, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  160|      0|            goto err;
  161|      0|        }
  162|      0|        ret->engine = engine;
  163|      0|    } else
  164|  45.7k|        ret->engine = ENGINE_get_default_DSA();
  165|  45.7k|    if (ret->engine) {
  ------------------
  |  Branch (165:9): [True: 0, False: 45.7k]
  ------------------
  166|      0|        ret->meth = ENGINE_get_DSA(ret->engine);
  167|      0|        if (ret->meth == NULL) {
  ------------------
  |  Branch (167:13): [True: 0, False: 0]
  ------------------
  168|      0|            ERR_raise(ERR_LIB_DSA, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  169|      0|            goto err;
  170|      0|        }
  171|      0|    }
  172|  45.7k|#endif
  173|       |
  174|  45.7k|    ret->flags = ret->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
  ------------------
  |  |   99|  45.7k|#   define DSA_FLAG_NON_FIPS_ALLOW                 0x0400
  ------------------
  175|       |
  176|  45.7k|#ifndef FIPS_MODULE
  177|  45.7k|    if (!ossl_crypto_new_ex_data_ex(libctx, CRYPTO_EX_INDEX_DSA, ret,
  ------------------
  |  |  225|  45.7k|# define CRYPTO_EX_INDEX_DSA              7
  ------------------
  |  Branch (177:9): [True: 0, False: 45.7k]
  ------------------
  178|  45.7k|                                    &ret->ex_data))
  179|      0|        goto err;
  180|  45.7k|#endif
  181|       |
  182|  45.7k|    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
  ------------------
  |  Branch (182:9): [True: 45.7k, False: 0]
  |  Branch (182:38): [True: 0, False: 45.7k]
  ------------------
  183|      0|        ERR_raise(ERR_LIB_DSA, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  184|      0|        goto err;
  185|      0|    }
  186|       |
  187|  45.7k|    return ret;
  188|       |
  189|      0| err:
  190|      0|    DSA_free(ret);
  191|      0|    return NULL;
  192|  45.7k|}

DSA_get_default_method:
   67|  45.7k|{
   68|  45.7k|    return default_DSA_method;
   69|  45.7k|}
DSA_OpenSSL:
   72|     86|{
   73|     86|    return &openssl_dsa_meth;
   74|     86|}
dsa_ossl.c:dsa_init:
  463|  45.7k|{
  464|  45.7k|    dsa->flags |= DSA_FLAG_CACHE_MONT_P;
  ------------------
  |  |   82|  45.7k|#   define DSA_FLAG_CACHE_MONT_P   0x01
  ------------------
  465|  45.7k|    ossl_ffc_params_init(&dsa->params);
  466|  45.7k|    dsa->dirty_cnt++;
  467|  45.7k|    return 1;
  468|  45.7k|}
dsa_ossl.c:dsa_finish:
  471|  45.7k|{
  472|  45.7k|    BN_MONT_CTX_free(dsa->method_mont_p);
  473|  45.7k|    return 1;
  474|  45.7k|}

DSA_SIG_new:
   35|  11.7k|{
   36|  11.7k|    DSA_SIG *sig = OPENSSL_zalloc(sizeof(*sig));
  ------------------
  |  |   99|  11.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  11.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  11.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   37|       |
   38|  11.7k|    return sig;
   39|  11.7k|}
DSA_SIG_free:
   42|  11.7k|{
   43|  11.7k|    if (sig == NULL)
  ------------------
  |  Branch (43:9): [True: 0, False: 11.7k]
  ------------------
   44|      0|        return;
   45|  11.7k|    BN_clear_free(sig->r);
   46|  11.7k|    BN_clear_free(sig->s);
   47|  11.7k|    OPENSSL_free(sig);
  ------------------
  |  |  107|  11.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  11.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  11.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   48|  11.7k|}
d2i_DSA_SIG:
   51|  11.7k|{
   52|  11.7k|    DSA_SIG *sig;
   53|       |
   54|  11.7k|    if (len < 0)
  ------------------
  |  Branch (54:9): [True: 0, False: 11.7k]
  ------------------
   55|      0|        return NULL;
   56|  11.7k|    if (psig != NULL && *psig != NULL) {
  ------------------
  |  Branch (56:9): [True: 0, False: 11.7k]
  |  Branch (56:25): [True: 0, False: 0]
  ------------------
   57|      0|        sig = *psig;
   58|  11.7k|    } else {
   59|  11.7k|        sig = DSA_SIG_new();
   60|  11.7k|        if (sig == NULL)
  ------------------
  |  Branch (60:13): [True: 0, False: 11.7k]
  ------------------
   61|      0|            return NULL;
   62|  11.7k|    }
   63|  11.7k|    if (sig->r == NULL)
  ------------------
  |  Branch (63:9): [True: 11.7k, False: 0]
  ------------------
   64|  11.7k|        sig->r = BN_new();
   65|  11.7k|    if (sig->s == NULL)
  ------------------
  |  Branch (65:9): [True: 11.7k, False: 0]
  ------------------
   66|  11.7k|        sig->s = BN_new();
   67|  11.7k|    if (sig->r == NULL || sig->s == NULL
  ------------------
  |  Branch (67:9): [True: 0, False: 11.7k]
  |  Branch (67:27): [True: 0, False: 11.7k]
  ------------------
   68|  11.7k|        || ossl_decode_der_dsa_sig(sig->r, sig->s, ppin, (size_t)len) == 0) {
  ------------------
  |  Branch (68:12): [True: 11.7k, False: 16]
  ------------------
   69|  11.7k|        if (psig == NULL || *psig == NULL)
  ------------------
  |  Branch (69:13): [True: 11.7k, False: 0]
  |  Branch (69:29): [True: 0, False: 0]
  ------------------
   70|  11.7k|            DSA_SIG_free(sig);
   71|  11.7k|        return NULL;
   72|  11.7k|    }
   73|     16|    if (psig != NULL && *psig == NULL)
  ------------------
  |  Branch (73:9): [True: 0, False: 16]
  |  Branch (73:25): [True: 0, False: 0]
  ------------------
   74|      0|        *psig = sig;
   75|     16|    return sig;
   76|  11.7k|}
i2d_DSA_SIG:
   79|    521|{
   80|    521|    BUF_MEM *buf = NULL;
   81|    521|    size_t encoded_len;
   82|    521|    WPACKET pkt;
   83|       |
   84|    521|    if (ppout == NULL) {
  ------------------
  |  Branch (84:9): [True: 505, False: 16]
  ------------------
   85|    505|        if (!WPACKET_init_null(&pkt, 0))
  ------------------
  |  Branch (85:13): [True: 0, False: 505]
  ------------------
   86|      0|            return -1;
   87|    505|    } else if (*ppout == NULL) {
  ------------------
  |  Branch (87:16): [True: 16, False: 0]
  ------------------
   88|     16|        if ((buf = BUF_MEM_new()) == NULL
  ------------------
  |  Branch (88:13): [True: 0, False: 16]
  ------------------
   89|     16|                || !WPACKET_init_len(&pkt, buf, 0)) {
  ------------------
  |  Branch (89:20): [True: 0, False: 16]
  ------------------
   90|      0|            BUF_MEM_free(buf);
   91|      0|            return -1;
   92|      0|        }
   93|     16|    } else {
   94|      0|        if (!WPACKET_init_static_len(&pkt, *ppout, SIZE_MAX, 0))
  ------------------
  |  Branch (94:13): [True: 0, False: 0]
  ------------------
   95|      0|            return -1;
   96|      0|    }
   97|       |
   98|    521|    if (!ossl_encode_der_dsa_sig(&pkt, sig->r, sig->s)
  ------------------
  |  Branch (98:9): [True: 0, False: 521]
  ------------------
   99|    521|            || !WPACKET_get_total_written(&pkt, &encoded_len)
  ------------------
  |  Branch (99:16): [True: 0, False: 521]
  ------------------
  100|    521|            || !WPACKET_finish(&pkt)) {
  ------------------
  |  Branch (100:16): [True: 0, False: 521]
  ------------------
  101|      0|        BUF_MEM_free(buf);
  102|      0|        WPACKET_cleanup(&pkt);
  103|      0|        return -1;
  104|      0|    }
  105|       |
  106|    521|    if (ppout != NULL) {
  ------------------
  |  Branch (106:9): [True: 16, False: 505]
  ------------------
  107|     16|        if (*ppout == NULL) {
  ------------------
  |  Branch (107:13): [True: 16, False: 0]
  ------------------
  108|     16|            *ppout = (unsigned char *)buf->data;
  109|     16|            buf->data = NULL;
  110|     16|            BUF_MEM_free(buf);
  111|     16|        } else {
  112|      0|            *ppout += encoded_len;
  113|      0|        }
  114|     16|    }
  115|       |
  116|    521|    return (int)encoded_len;
  117|    521|}
DSA_size:
  120|    505|{
  121|    505|    int ret = -1;
  122|    505|    DSA_SIG sig;
  123|       |
  124|    505|    if (dsa->params.q != NULL) {
  ------------------
  |  Branch (124:9): [True: 505, False: 0]
  ------------------
  125|    505|        sig.r = sig.s = dsa->params.q;
  126|    505|        ret = i2d_DSA_SIG(&sig, NULL);
  127|       |
  128|    505|        if (ret < 0)
  ------------------
  |  Branch (128:13): [True: 0, False: 505]
  ------------------
  129|      0|            ret = 0;
  130|    505|    }
  131|    505|    return ret;
  132|    505|}

ossl_err_load_DSO_strings:
   50|      2|{
   51|      2|#ifndef OPENSSL_NO_ERR
   52|      2|    if (ERR_reason_error_string(DSO_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (52:9): [True: 2, False: 0]
  ------------------
   53|      2|        ERR_load_strings_const(DSO_str_reasons);
   54|      2|#endif
   55|      2|    return 1;
   56|      2|}

DSO_free:
   48|      1|{
   49|      1|    int i;
   50|       |
   51|      1|    if (dso == NULL)
  ------------------
  |  Branch (51:9): [True: 1, False: 0]
  ------------------
   52|      1|        return 1;
   53|       |
   54|      0|    if (CRYPTO_DOWN_REF(&dso->references, &i) <= 0)
  ------------------
  |  Branch (54:9): [True: 0, False: 0]
  ------------------
   55|      0|        return 0;
   56|       |
   57|      0|    REF_PRINT_COUNT("DSO", dso);
  ------------------
  |  |  289|      0|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|      0|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   58|      0|    if (i > 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 0]
  ------------------
   59|      0|        return 1;
   60|      0|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|      0|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   61|       |
   62|      0|    if ((dso->flags & DSO_FLAG_NO_UNLOAD_ON_FREE) == 0) {
  ------------------
  |  |   46|      0|# define DSO_FLAG_NO_UNLOAD_ON_FREE              0x04
  ------------------
  |  Branch (62:9): [True: 0, False: 0]
  ------------------
   63|      0|        if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) {
  ------------------
  |  Branch (63:13): [True: 0, False: 0]
  |  Branch (63:48): [True: 0, False: 0]
  ------------------
   64|      0|            ERR_raise(ERR_LIB_DSO, DSO_R_UNLOAD_FAILED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   65|      0|            return 0;
   66|      0|        }
   67|      0|    }
   68|       |
   69|      0|    if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) {
  ------------------
  |  Branch (69:9): [True: 0, False: 0]
  |  Branch (69:40): [True: 0, False: 0]
  ------------------
   70|      0|        ERR_raise(ERR_LIB_DSO, DSO_R_FINISH_FAILED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   71|      0|        return 0;
   72|      0|    }
   73|       |
   74|      0|    sk_void_free(dso->meth_data);
  ------------------
  |  |  193|      0|#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
  ------------------
   75|      0|    OPENSSL_free(dso->filename);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   76|      0|    OPENSSL_free(dso->loaded_filename);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|      0|    CRYPTO_FREE_REF(&dso->references);
   78|      0|    OPENSSL_free(dso);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|      0|    return 1;
   80|      0|}

ossl_ed25519_public_from_private:
 5653|      4|{
 5654|      4|    uint8_t az[SHA512_DIGEST_LENGTH];
 5655|      4|    ge_p3 A;
 5656|      4|    int r;
 5657|      4|    EVP_MD *sha512 = NULL;
 5658|       |
 5659|      4|    sha512 = EVP_MD_fetch(ctx, SN_sha512, propq);
  ------------------
  |  | 3254|      4|#define SN_sha512               "SHA512"
  ------------------
 5660|      4|    if (sha512 == NULL)
  ------------------
  |  Branch (5660:9): [True: 0, False: 4]
  ------------------
 5661|      0|        return 0;
 5662|      4|    r = EVP_Digest(private_key, 32, az, NULL, sha512, NULL);
 5663|      4|    EVP_MD_free(sha512);
 5664|      4|    if (!r) {
  ------------------
  |  Branch (5664:9): [True: 0, False: 4]
  ------------------
 5665|      0|        OPENSSL_cleanse(az, sizeof(az));
 5666|      0|        return 0;
 5667|      0|    }
 5668|       |
 5669|      4|    az[0] &= 248;
 5670|      4|    az[31] &= 63;
 5671|      4|    az[31] |= 64;
 5672|       |
 5673|      4|    ge_scalarmult_base(&A, az);
 5674|      4|    ge_p3_tobytes(out_public_key, &A);
 5675|       |
 5676|      4|    OPENSSL_cleanse(az, sizeof(az));
 5677|      4|    return 1;
 5678|      4|}
ossl_x25519_public_from_private:
 5693|      2|{
 5694|      2|    uint8_t e[32];
 5695|      2|    ge_p3 A;
 5696|      2|    fe zplusy, zminusy, zminusy_inv;
 5697|       |
 5698|      2|    memcpy(e, private_key, 32);
 5699|      2|    e[0] &= 248;
 5700|      2|    e[31] &= 127;
 5701|      2|    e[31] |= 64;
 5702|       |
 5703|      2|    ge_scalarmult_base(&A, e);
 5704|       |
 5705|       |    /*
 5706|       |     * We only need the u-coordinate of the curve25519 point.
 5707|       |     * The map is u=(y+1)/(1-y). Since y=Y/Z, this gives
 5708|       |     * u=(Z+Y)/(Z-Y).
 5709|       |     */
 5710|      2|    fe_add(zplusy, A.Z, A.Y);
 5711|      2|    fe_sub(zminusy, A.Z, A.Y);
 5712|      2|    fe_invert(zminusy_inv, zminusy);
 5713|      2|    fe_mul(zplusy, zplusy, zminusy_inv);
 5714|      2|    fe_tobytes(out_public_value, zplusy);
 5715|       |
 5716|      2|    OPENSSL_cleanse(e, sizeof(e));
 5717|      2|}
curve25519.c:ge_scalarmult_base:
 4234|      6|{
 4235|      6|    signed char e[64];
 4236|      6|    signed char carry;
 4237|      6|    ge_p1p1 r;
 4238|      6|    ge_p2 s;
 4239|      6|    ge_precomp t;
 4240|      6|    int i;
 4241|       |
 4242|    198|    for (i = 0; i < 32; ++i) {
  ------------------
  |  Branch (4242:17): [True: 192, False: 6]
  ------------------
 4243|    192|        e[2 * i + 0] = (a[i] >> 0) & 15;
 4244|    192|        e[2 * i + 1] = (a[i] >> 4) & 15;
 4245|    192|    }
 4246|       |    /* each e[i] is between 0 and 15 */
 4247|       |    /* e[63] is between 0 and 7 */
 4248|       |
 4249|      6|    carry = 0;
 4250|    384|    for (i = 0; i < 63; ++i) {
  ------------------
  |  Branch (4250:17): [True: 378, False: 6]
  ------------------
 4251|    378|        e[i] += carry;
 4252|    378|        carry = e[i] + 8;
 4253|    378|        carry >>= 4;
 4254|    378|        e[i] -= carry << 4;
 4255|    378|    }
 4256|      6|    e[63] += carry;
 4257|       |    /* each e[i] is between -8 and 8 */
 4258|       |
 4259|      6|    ge_p3_0(h);
 4260|    198|    for (i = 1; i < 64; i += 2) {
  ------------------
  |  Branch (4260:17): [True: 192, False: 6]
  ------------------
 4261|    192|        table_select(&t, i / 2, e[i]);
 4262|    192|        ge_madd(&r, h, &t);
 4263|    192|        ge_p1p1_to_p3(h, &r);
 4264|    192|    }
 4265|       |
 4266|      6|    ge_p3_dbl(&r, h);
 4267|      6|    ge_p1p1_to_p2(&s, &r);
 4268|      6|    ge_p2_dbl(&r, &s);
 4269|      6|    ge_p1p1_to_p2(&s, &r);
 4270|      6|    ge_p2_dbl(&r, &s);
 4271|      6|    ge_p1p1_to_p2(&s, &r);
 4272|      6|    ge_p2_dbl(&r, &s);
 4273|      6|    ge_p1p1_to_p3(h, &r);
 4274|       |
 4275|    198|    for (i = 0; i < 64; i += 2) {
  ------------------
  |  Branch (4275:17): [True: 192, False: 6]
  ------------------
 4276|    192|        table_select(&t, i / 2, e[i]);
 4277|    192|        ge_madd(&r, h, &t);
 4278|    192|        ge_p1p1_to_p3(h, &r);
 4279|    192|    }
 4280|       |
 4281|      6|    OPENSSL_cleanse(e, sizeof(e));
 4282|      6|}
curve25519.c:ge_p3_0:
 1914|      6|{
 1915|      6|    fe_0(h->X);
 1916|      6|    fe_1(h->Y);
 1917|      6|    fe_1(h->Z);
 1918|      6|    fe_0(h->T);
 1919|      6|}
curve25519.c:fe_0:
  962|    396|{
  963|    396|    memset(h, 0, sizeof(int32_t) * 10);
  964|    396|}
curve25519.c:fe_1:
  968|    780|{
  969|    780|    memset(h, 0, sizeof(int32_t) * 10);
  970|    780|    h[0] = 1;
  971|    780|}
curve25519.c:table_select:
 4204|    384|{
 4205|    384|    ge_precomp minust;
 4206|    384|    uint8_t bnegative = negative(b);
 4207|    384|    uint8_t babs = b - ((uint8_t)((-bnegative) & b) << 1);
 4208|       |
 4209|    384|    ge_precomp_0(t);
 4210|    384|    cmov(t, &k25519Precomp[pos][0], equal(babs, 1));
 4211|    384|    cmov(t, &k25519Precomp[pos][1], equal(babs, 2));
 4212|    384|    cmov(t, &k25519Precomp[pos][2], equal(babs, 3));
 4213|    384|    cmov(t, &k25519Precomp[pos][3], equal(babs, 4));
 4214|    384|    cmov(t, &k25519Precomp[pos][4], equal(babs, 5));
 4215|    384|    cmov(t, &k25519Precomp[pos][5], equal(babs, 6));
 4216|    384|    cmov(t, &k25519Precomp[pos][6], equal(babs, 7));
 4217|    384|    cmov(t, &k25519Precomp[pos][7], equal(babs, 8));
 4218|    384|    fe_copy(minust.yplusx, t->yminusx);
 4219|    384|    fe_copy(minust.yminusx, t->yplusx);
 4220|    384|    fe_neg(minust.xy2d, t->xy2d);
 4221|    384|    cmov(t, &minust, bnegative);
 4222|    384|}
curve25519.c:negative:
 4196|    384|{
 4197|    384|    uint32_t x = b;
 4198|       |
 4199|    384|    x >>= 31; /* 1: yes; 0: no */
 4200|    384|    return x;
 4201|    384|}
curve25519.c:ge_precomp_0:
 1922|    384|{
 1923|    384|    fe_1(h->yplusx);
 1924|    384|    fe_1(h->yminusx);
 1925|    384|    fe_0(h->xy2d);
 1926|    384|}
curve25519.c:cmov:
 2073|  3.45k|{
 2074|  3.45k|    fe_cmov(t->yplusx, u->yplusx, b);
 2075|  3.45k|    fe_cmov(t->yminusx, u->yminusx, b);
 2076|  3.45k|    fe_cmov(t->xy2d, u->xy2d, b);
 2077|  3.45k|}
curve25519.c:fe_cmov:
 1528|  10.3k|{
 1529|  10.3k|    size_t i;
 1530|       |
 1531|  10.3k|    b = 0-b;
 1532|   114k|    for (i = 0; i < 10; i++) {
  ------------------
  |  Branch (1532:17): [True: 103k, False: 10.3k]
  ------------------
 1533|   103k|        int32_t x = f[i] ^ g[i];
 1534|   103k|        x &= b;
 1535|   103k|        f[i] ^= x;
 1536|   103k|    }
 1537|  10.3k|}
curve25519.c:equal:
 2062|  3.07k|{
 2063|  3.07k|    uint8_t ub = b;
 2064|  3.07k|    uint8_t uc = c;
 2065|  3.07k|    uint8_t x = ub ^ uc; /* 0: yes; 1..255: no */
 2066|  3.07k|    uint32_t y = x;      /* 0: yes; 1..255: no */
 2067|  3.07k|    y -= 1;              /* 4294967295: yes; 0..254: no */
 2068|  3.07k|    y >>= 31;            /* 1: yes; 0: no */
 2069|  3.07k|    return y;
 2070|  3.07k|}
curve25519.c:fe_copy:
  956|    786|{
  957|    786|    memmove(h, f, sizeof(int32_t) * 10);
  958|    786|}
curve25519.c:ge_madd:
 1993|    384|{
 1994|    384|    fe t0;
 1995|       |
 1996|    384|    fe_add(r->X, p->Y, p->X);
 1997|    384|    fe_sub(r->Y, p->Y, p->X);
 1998|    384|    fe_mul(r->Z, r->X, q->yplusx);
 1999|    384|    fe_mul(r->Y, r->Y, q->yminusx);
 2000|    384|    fe_mul(r->T, q->xy2d, p->T);
 2001|    384|    fe_add(t0, p->Z, p->Z);
 2002|    384|    fe_sub(r->X, r->Z, r->Y);
 2003|    384|    fe_add(r->Y, r->Z, r->Y);
 2004|    384|    fe_add(r->Z, t0, r->T);
 2005|    384|    fe_sub(r->T, t0, r->T);
 2006|    384|}
curve25519.c:ge_p1p1_to_p3:
 1960|    390|{
 1961|    390|    fe_mul(r->X, p->X, p->T);
 1962|    390|    fe_mul(r->Y, p->Y, p->Z);
 1963|    390|    fe_mul(r->Z, p->Z, p->T);
 1964|    390|    fe_mul(r->T, p->X, p->Y);
 1965|    390|}
curve25519.c:ge_p3_dbl:
 1985|      6|{
 1986|      6|    ge_p2 q;
 1987|      6|    ge_p3_to_p2(&q, p);
 1988|      6|    ge_p2_dbl(r, &q);
 1989|      6|}
curve25519.c:ge_p3_to_p2:
 1930|      6|{
 1931|      6|    fe_copy(r->X, p->X);
 1932|      6|    fe_copy(r->Y, p->Y);
 1933|      6|    fe_copy(r->Z, p->Z);
 1934|      6|}
curve25519.c:ge_p1p1_to_p2:
 1952|     18|{
 1953|     18|    fe_mul(r->X, p->X, p->T);
 1954|     18|    fe_mul(r->Y, p->Y, p->Z);
 1955|     18|    fe_mul(r->Z, p->Z, p->T);
 1956|     18|}
curve25519.c:ge_p2_dbl:
 1969|     24|{
 1970|     24|    fe t0;
 1971|       |
 1972|     24|    fe_sq(r->X, p->X);
 1973|     24|    fe_sq(r->Z, p->Y);
 1974|     24|    fe_sq2(r->T, p->Z);
 1975|     24|    fe_add(r->Y, p->X, p->Y);
 1976|     24|    fe_sq(t0, r->Y);
 1977|     24|    fe_add(r->Y, r->Z, r->X);
 1978|     24|    fe_sub(r->Z, r->Z, r->X);
 1979|     24|    fe_sub(r->X, t0, r->Y);
 1980|     24|    fe_sub(r->T, r->T, r->Z);
 1981|     24|}
curve25519.c:fe_sq:
 1276|  1.59k|{
 1277|  1.59k|    int32_t f0 = f[0];
 1278|  1.59k|    int32_t f1 = f[1];
 1279|  1.59k|    int32_t f2 = f[2];
 1280|  1.59k|    int32_t f3 = f[3];
 1281|  1.59k|    int32_t f4 = f[4];
 1282|  1.59k|    int32_t f5 = f[5];
 1283|  1.59k|    int32_t f6 = f[6];
 1284|  1.59k|    int32_t f7 = f[7];
 1285|  1.59k|    int32_t f8 = f[8];
 1286|  1.59k|    int32_t f9 = f[9];
 1287|  1.59k|    int32_t f0_2 = 2 * f0;
 1288|  1.59k|    int32_t f1_2 = 2 * f1;
 1289|  1.59k|    int32_t f2_2 = 2 * f2;
 1290|  1.59k|    int32_t f3_2 = 2 * f3;
 1291|  1.59k|    int32_t f4_2 = 2 * f4;
 1292|  1.59k|    int32_t f5_2 = 2 * f5;
 1293|  1.59k|    int32_t f6_2 = 2 * f6;
 1294|  1.59k|    int32_t f7_2 = 2 * f7;
 1295|  1.59k|    int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */
 1296|  1.59k|    int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */
 1297|  1.59k|    int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */
 1298|  1.59k|    int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */
 1299|  1.59k|    int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */
 1300|  1.59k|    int64_t f0f0    = f0   * (int64_t) f0;
 1301|  1.59k|    int64_t f0f1_2  = f0_2 * (int64_t) f1;
 1302|  1.59k|    int64_t f0f2_2  = f0_2 * (int64_t) f2;
 1303|  1.59k|    int64_t f0f3_2  = f0_2 * (int64_t) f3;
 1304|  1.59k|    int64_t f0f4_2  = f0_2 * (int64_t) f4;
 1305|  1.59k|    int64_t f0f5_2  = f0_2 * (int64_t) f5;
 1306|  1.59k|    int64_t f0f6_2  = f0_2 * (int64_t) f6;
 1307|  1.59k|    int64_t f0f7_2  = f0_2 * (int64_t) f7;
 1308|  1.59k|    int64_t f0f8_2  = f0_2 * (int64_t) f8;
 1309|  1.59k|    int64_t f0f9_2  = f0_2 * (int64_t) f9;
 1310|  1.59k|    int64_t f1f1_2  = f1_2 * (int64_t) f1;
 1311|  1.59k|    int64_t f1f2_2  = f1_2 * (int64_t) f2;
 1312|  1.59k|    int64_t f1f3_4  = f1_2 * (int64_t) f3_2;
 1313|  1.59k|    int64_t f1f4_2  = f1_2 * (int64_t) f4;
 1314|  1.59k|    int64_t f1f5_4  = f1_2 * (int64_t) f5_2;
 1315|  1.59k|    int64_t f1f6_2  = f1_2 * (int64_t) f6;
 1316|  1.59k|    int64_t f1f7_4  = f1_2 * (int64_t) f7_2;
 1317|  1.59k|    int64_t f1f8_2  = f1_2 * (int64_t) f8;
 1318|  1.59k|    int64_t f1f9_76 = f1_2 * (int64_t) f9_38;
 1319|  1.59k|    int64_t f2f2    = f2   * (int64_t) f2;
 1320|  1.59k|    int64_t f2f3_2  = f2_2 * (int64_t) f3;
 1321|  1.59k|    int64_t f2f4_2  = f2_2 * (int64_t) f4;
 1322|  1.59k|    int64_t f2f5_2  = f2_2 * (int64_t) f5;
 1323|  1.59k|    int64_t f2f6_2  = f2_2 * (int64_t) f6;
 1324|  1.59k|    int64_t f2f7_2  = f2_2 * (int64_t) f7;
 1325|  1.59k|    int64_t f2f8_38 = f2_2 * (int64_t) f8_19;
 1326|  1.59k|    int64_t f2f9_38 = f2   * (int64_t) f9_38;
 1327|  1.59k|    int64_t f3f3_2  = f3_2 * (int64_t) f3;
 1328|  1.59k|    int64_t f3f4_2  = f3_2 * (int64_t) f4;
 1329|  1.59k|    int64_t f3f5_4  = f3_2 * (int64_t) f5_2;
 1330|  1.59k|    int64_t f3f6_2  = f3_2 * (int64_t) f6;
 1331|  1.59k|    int64_t f3f7_76 = f3_2 * (int64_t) f7_38;
 1332|  1.59k|    int64_t f3f8_38 = f3_2 * (int64_t) f8_19;
 1333|  1.59k|    int64_t f3f9_76 = f3_2 * (int64_t) f9_38;
 1334|  1.59k|    int64_t f4f4    = f4   * (int64_t) f4;
 1335|  1.59k|    int64_t f4f5_2  = f4_2 * (int64_t) f5;
 1336|  1.59k|    int64_t f4f6_38 = f4_2 * (int64_t) f6_19;
 1337|  1.59k|    int64_t f4f7_38 = f4   * (int64_t) f7_38;
 1338|  1.59k|    int64_t f4f8_38 = f4_2 * (int64_t) f8_19;
 1339|  1.59k|    int64_t f4f9_38 = f4   * (int64_t) f9_38;
 1340|  1.59k|    int64_t f5f5_38 = f5   * (int64_t) f5_38;
 1341|  1.59k|    int64_t f5f6_38 = f5_2 * (int64_t) f6_19;
 1342|  1.59k|    int64_t f5f7_76 = f5_2 * (int64_t) f7_38;
 1343|  1.59k|    int64_t f5f8_38 = f5_2 * (int64_t) f8_19;
 1344|  1.59k|    int64_t f5f9_76 = f5_2 * (int64_t) f9_38;
 1345|  1.59k|    int64_t f6f6_19 = f6   * (int64_t) f6_19;
 1346|  1.59k|    int64_t f6f7_38 = f6   * (int64_t) f7_38;
 1347|  1.59k|    int64_t f6f8_38 = f6_2 * (int64_t) f8_19;
 1348|  1.59k|    int64_t f6f9_38 = f6   * (int64_t) f9_38;
 1349|  1.59k|    int64_t f7f7_38 = f7   * (int64_t) f7_38;
 1350|  1.59k|    int64_t f7f8_38 = f7_2 * (int64_t) f8_19;
 1351|  1.59k|    int64_t f7f9_76 = f7_2 * (int64_t) f9_38;
 1352|  1.59k|    int64_t f8f8_19 = f8   * (int64_t) f8_19;
 1353|  1.59k|    int64_t f8f9_38 = f8   * (int64_t) f9_38;
 1354|  1.59k|    int64_t f9f9_38 = f9   * (int64_t) f9_38;
 1355|  1.59k|    int64_t h0 = f0f0   + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38;
 1356|  1.59k|    int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38;
 1357|  1.59k|    int64_t h2 = f0f2_2 + f1f1_2  + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19;
 1358|  1.59k|    int64_t h3 = f0f3_2 + f1f2_2  + f4f9_38 + f5f8_38 + f6f7_38;
 1359|  1.59k|    int64_t h4 = f0f4_2 + f1f3_4  + f2f2    + f5f9_76 + f6f8_38 + f7f7_38;
 1360|  1.59k|    int64_t h5 = f0f5_2 + f1f4_2  + f2f3_2  + f6f9_38 + f7f8_38;
 1361|  1.59k|    int64_t h6 = f0f6_2 + f1f5_4  + f2f4_2  + f3f3_2  + f7f9_76 + f8f8_19;
 1362|  1.59k|    int64_t h7 = f0f7_2 + f1f6_2  + f2f5_2  + f3f4_2  + f8f9_38;
 1363|  1.59k|    int64_t h8 = f0f8_2 + f1f7_4  + f2f6_2  + f3f5_4  + f4f4    + f9f9_38;
 1364|  1.59k|    int64_t h9 = f0f9_2 + f1f8_2  + f2f7_2  + f3f6_2  + f4f5_2;
 1365|  1.59k|    int64_t carry0;
 1366|  1.59k|    int64_t carry1;
 1367|  1.59k|    int64_t carry2;
 1368|  1.59k|    int64_t carry3;
 1369|  1.59k|    int64_t carry4;
 1370|  1.59k|    int64_t carry5;
 1371|  1.59k|    int64_t carry6;
 1372|  1.59k|    int64_t carry7;
 1373|  1.59k|    int64_t carry8;
 1374|  1.59k|    int64_t carry9;
 1375|       |
 1376|  1.59k|    carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
 1377|  1.59k|    carry4 = h4 + (1 << 25); h5 += carry4 >> 26; h4 -= carry4 & kTop38Bits;
 1378|       |
 1379|  1.59k|    carry1 = h1 + (1 << 24); h2 += carry1 >> 25; h1 -= carry1 & kTop39Bits;
 1380|  1.59k|    carry5 = h5 + (1 << 24); h6 += carry5 >> 25; h5 -= carry5 & kTop39Bits;
 1381|       |
 1382|  1.59k|    carry2 = h2 + (1 << 25); h3 += carry2 >> 26; h2 -= carry2 & kTop38Bits;
 1383|  1.59k|    carry6 = h6 + (1 << 25); h7 += carry6 >> 26; h6 -= carry6 & kTop38Bits;
 1384|       |
 1385|  1.59k|    carry3 = h3 + (1 << 24); h4 += carry3 >> 25; h3 -= carry3 & kTop39Bits;
 1386|  1.59k|    carry7 = h7 + (1 << 24); h8 += carry7 >> 25; h7 -= carry7 & kTop39Bits;
 1387|       |
 1388|  1.59k|    carry4 = h4 + (1 << 25); h5 += carry4 >> 26; h4 -= carry4 & kTop38Bits;
 1389|  1.59k|    carry8 = h8 + (1 << 25); h9 += carry8 >> 26; h8 -= carry8 & kTop38Bits;
 1390|       |
 1391|  1.59k|    carry9 = h9 + (1 << 24); h0 += (carry9 >> 25) * 19; h9 -= carry9 & kTop39Bits;
 1392|       |
 1393|  1.59k|    carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
 1394|       |
 1395|  1.59k|    h[0] = (int32_t)h0;
 1396|  1.59k|    h[1] = (int32_t)h1;
 1397|  1.59k|    h[2] = (int32_t)h2;
 1398|  1.59k|    h[3] = (int32_t)h3;
 1399|  1.59k|    h[4] = (int32_t)h4;
 1400|  1.59k|    h[5] = (int32_t)h5;
 1401|  1.59k|    h[6] = (int32_t)h6;
 1402|  1.59k|    h[7] = (int32_t)h7;
 1403|  1.59k|    h[8] = (int32_t)h8;
 1404|  1.59k|    h[9] = (int32_t)h9;
 1405|  1.59k|}
curve25519.c:fe_sq2:
 1585|     24|{
 1586|     24|    int32_t f0 = f[0];
 1587|     24|    int32_t f1 = f[1];
 1588|     24|    int32_t f2 = f[2];
 1589|     24|    int32_t f3 = f[3];
 1590|     24|    int32_t f4 = f[4];
 1591|     24|    int32_t f5 = f[5];
 1592|     24|    int32_t f6 = f[6];
 1593|     24|    int32_t f7 = f[7];
 1594|     24|    int32_t f8 = f[8];
 1595|     24|    int32_t f9 = f[9];
 1596|     24|    int32_t f0_2 = 2 * f0;
 1597|     24|    int32_t f1_2 = 2 * f1;
 1598|     24|    int32_t f2_2 = 2 * f2;
 1599|     24|    int32_t f3_2 = 2 * f3;
 1600|     24|    int32_t f4_2 = 2 * f4;
 1601|     24|    int32_t f5_2 = 2 * f5;
 1602|     24|    int32_t f6_2 = 2 * f6;
 1603|     24|    int32_t f7_2 = 2 * f7;
 1604|     24|    int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */
 1605|     24|    int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */
 1606|     24|    int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */
 1607|     24|    int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */
 1608|     24|    int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */
 1609|     24|    int64_t f0f0    = f0   * (int64_t) f0;
 1610|     24|    int64_t f0f1_2  = f0_2 * (int64_t) f1;
 1611|     24|    int64_t f0f2_2  = f0_2 * (int64_t) f2;
 1612|     24|    int64_t f0f3_2  = f0_2 * (int64_t) f3;
 1613|     24|    int64_t f0f4_2  = f0_2 * (int64_t) f4;
 1614|     24|    int64_t f0f5_2  = f0_2 * (int64_t) f5;
 1615|     24|    int64_t f0f6_2  = f0_2 * (int64_t) f6;
 1616|     24|    int64_t f0f7_2  = f0_2 * (int64_t) f7;
 1617|     24|    int64_t f0f8_2  = f0_2 * (int64_t) f8;
 1618|     24|    int64_t f0f9_2  = f0_2 * (int64_t) f9;
 1619|     24|    int64_t f1f1_2  = f1_2 * (int64_t) f1;
 1620|     24|    int64_t f1f2_2  = f1_2 * (int64_t) f2;
 1621|     24|    int64_t f1f3_4  = f1_2 * (int64_t) f3_2;
 1622|     24|    int64_t f1f4_2  = f1_2 * (int64_t) f4;
 1623|     24|    int64_t f1f5_4  = f1_2 * (int64_t) f5_2;
 1624|     24|    int64_t f1f6_2  = f1_2 * (int64_t) f6;
 1625|     24|    int64_t f1f7_4  = f1_2 * (int64_t) f7_2;
 1626|     24|    int64_t f1f8_2  = f1_2 * (int64_t) f8;
 1627|     24|    int64_t f1f9_76 = f1_2 * (int64_t) f9_38;
 1628|     24|    int64_t f2f2    = f2   * (int64_t) f2;
 1629|     24|    int64_t f2f3_2  = f2_2 * (int64_t) f3;
 1630|     24|    int64_t f2f4_2  = f2_2 * (int64_t) f4;
 1631|     24|    int64_t f2f5_2  = f2_2 * (int64_t) f5;
 1632|     24|    int64_t f2f6_2  = f2_2 * (int64_t) f6;
 1633|     24|    int64_t f2f7_2  = f2_2 * (int64_t) f7;
 1634|     24|    int64_t f2f8_38 = f2_2 * (int64_t) f8_19;
 1635|     24|    int64_t f2f9_38 = f2   * (int64_t) f9_38;
 1636|     24|    int64_t f3f3_2  = f3_2 * (int64_t) f3;
 1637|     24|    int64_t f3f4_2  = f3_2 * (int64_t) f4;
 1638|     24|    int64_t f3f5_4  = f3_2 * (int64_t) f5_2;
 1639|     24|    int64_t f3f6_2  = f3_2 * (int64_t) f6;
 1640|     24|    int64_t f3f7_76 = f3_2 * (int64_t) f7_38;
 1641|     24|    int64_t f3f8_38 = f3_2 * (int64_t) f8_19;
 1642|     24|    int64_t f3f9_76 = f3_2 * (int64_t) f9_38;
 1643|     24|    int64_t f4f4    = f4   * (int64_t) f4;
 1644|     24|    int64_t f4f5_2  = f4_2 * (int64_t) f5;
 1645|     24|    int64_t f4f6_38 = f4_2 * (int64_t) f6_19;
 1646|     24|    int64_t f4f7_38 = f4   * (int64_t) f7_38;
 1647|     24|    int64_t f4f8_38 = f4_2 * (int64_t) f8_19;
 1648|     24|    int64_t f4f9_38 = f4   * (int64_t) f9_38;
 1649|     24|    int64_t f5f5_38 = f5   * (int64_t) f5_38;
 1650|     24|    int64_t f5f6_38 = f5_2 * (int64_t) f6_19;
 1651|     24|    int64_t f5f7_76 = f5_2 * (int64_t) f7_38;
 1652|     24|    int64_t f5f8_38 = f5_2 * (int64_t) f8_19;
 1653|     24|    int64_t f5f9_76 = f5_2 * (int64_t) f9_38;
 1654|     24|    int64_t f6f6_19 = f6   * (int64_t) f6_19;
 1655|     24|    int64_t f6f7_38 = f6   * (int64_t) f7_38;
 1656|     24|    int64_t f6f8_38 = f6_2 * (int64_t) f8_19;
 1657|     24|    int64_t f6f9_38 = f6   * (int64_t) f9_38;
 1658|     24|    int64_t f7f7_38 = f7   * (int64_t) f7_38;
 1659|     24|    int64_t f7f8_38 = f7_2 * (int64_t) f8_19;
 1660|     24|    int64_t f7f9_76 = f7_2 * (int64_t) f9_38;
 1661|     24|    int64_t f8f8_19 = f8   * (int64_t) f8_19;
 1662|     24|    int64_t f8f9_38 = f8   * (int64_t) f9_38;
 1663|     24|    int64_t f9f9_38 = f9   * (int64_t) f9_38;
 1664|     24|    int64_t h0 = f0f0   + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38;
 1665|     24|    int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38;
 1666|     24|    int64_t h2 = f0f2_2 + f1f1_2  + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19;
 1667|     24|    int64_t h3 = f0f3_2 + f1f2_2  + f4f9_38 + f5f8_38 + f6f7_38;
 1668|     24|    int64_t h4 = f0f4_2 + f1f3_4  + f2f2    + f5f9_76 + f6f8_38 + f7f7_38;
 1669|     24|    int64_t h5 = f0f5_2 + f1f4_2  + f2f3_2  + f6f9_38 + f7f8_38;
 1670|     24|    int64_t h6 = f0f6_2 + f1f5_4  + f2f4_2  + f3f3_2  + f7f9_76 + f8f8_19;
 1671|     24|    int64_t h7 = f0f7_2 + f1f6_2  + f2f5_2  + f3f4_2  + f8f9_38;
 1672|     24|    int64_t h8 = f0f8_2 + f1f7_4  + f2f6_2  + f3f5_4  + f4f4    + f9f9_38;
 1673|     24|    int64_t h9 = f0f9_2 + f1f8_2  + f2f7_2  + f3f6_2  + f4f5_2;
 1674|     24|    int64_t carry0;
 1675|     24|    int64_t carry1;
 1676|     24|    int64_t carry2;
 1677|     24|    int64_t carry3;
 1678|     24|    int64_t carry4;
 1679|     24|    int64_t carry5;
 1680|     24|    int64_t carry6;
 1681|     24|    int64_t carry7;
 1682|     24|    int64_t carry8;
 1683|     24|    int64_t carry9;
 1684|       |
 1685|     24|    h0 += h0;
 1686|     24|    h1 += h1;
 1687|     24|    h2 += h2;
 1688|     24|    h3 += h3;
 1689|     24|    h4 += h4;
 1690|     24|    h5 += h5;
 1691|     24|    h6 += h6;
 1692|     24|    h7 += h7;
 1693|     24|    h8 += h8;
 1694|     24|    h9 += h9;
 1695|       |
 1696|     24|    carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
 1697|     24|    carry4 = h4 + (1 << 25); h5 += carry4 >> 26; h4 -= carry4 & kTop38Bits;
 1698|       |
 1699|     24|    carry1 = h1 + (1 << 24); h2 += carry1 >> 25; h1 -= carry1 & kTop39Bits;
 1700|     24|    carry5 = h5 + (1 << 24); h6 += carry5 >> 25; h5 -= carry5 & kTop39Bits;
 1701|       |
 1702|     24|    carry2 = h2 + (1 << 25); h3 += carry2 >> 26; h2 -= carry2 & kTop38Bits;
 1703|     24|    carry6 = h6 + (1 << 25); h7 += carry6 >> 26; h6 -= carry6 & kTop38Bits;
 1704|       |
 1705|     24|    carry3 = h3 + (1 << 24); h4 += carry3 >> 25; h3 -= carry3 & kTop39Bits;
 1706|     24|    carry7 = h7 + (1 << 24); h8 += carry7 >> 25; h7 -= carry7 & kTop39Bits;
 1707|       |
 1708|     24|    carry4 = h4 + (1 << 25); h5 += carry4 >> 26; h4 -= carry4 & kTop38Bits;
 1709|     24|    carry8 = h8 + (1 << 25); h9 += carry8 >> 26; h8 -= carry8 & kTop38Bits;
 1710|       |
 1711|     24|    carry9 = h9 + (1 << 24); h0 += (carry9 >> 25) * 19; h9 -= carry9 & kTop39Bits;
 1712|       |
 1713|     24|    carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
 1714|       |
 1715|     24|    h[0] = (int32_t)h0;
 1716|     24|    h[1] = (int32_t)h1;
 1717|     24|    h[2] = (int32_t)h2;
 1718|     24|    h[3] = (int32_t)h3;
 1719|     24|    h[4] = (int32_t)h4;
 1720|     24|    h[5] = (int32_t)h5;
 1721|     24|    h[6] = (int32_t)h6;
 1722|     24|    h[7] = (int32_t)h7;
 1723|     24|    h[8] = (int32_t)h8;
 1724|     24|    h[9] = (int32_t)h9;
 1725|     24|}
curve25519.c:ge_p3_tobytes:
 1845|      4|{
 1846|      4|    fe recip;
 1847|      4|    fe x;
 1848|      4|    fe y;
 1849|       |
 1850|      4|    fe_invert(recip, h->Z);
 1851|      4|    fe_mul(x, h->X, recip);
 1852|      4|    fe_mul(y, h->Y, recip);
 1853|      4|    fe_tobytes(s, y);
 1854|      4|    s[31] ^= fe_isnegative(x) << 7;
 1855|      4|}
curve25519.c:fe_isnegative:
 1564|      4|{
 1565|      4|    uint8_t s[32];
 1566|       |
 1567|      4|    fe_tobytes(s, f);
 1568|      4|    return s[0] & 1;
 1569|      4|}
curve25519.c:fe_neg:
 1513|    384|{
 1514|    384|    unsigned i;
 1515|       |
 1516|  4.22k|    for (i = 0; i < 10; i++) {
  ------------------
  |  Branch (1516:17): [True: 3.84k, False: 384]
  ------------------
 1517|  3.84k|        h[i] = -f[i];
 1518|  3.84k|    }
 1519|    384|}
curve25519.c:fe_add:
  986|  1.58k|{
  987|  1.58k|    unsigned i;
  988|       |
  989|  17.4k|    for (i = 0; i < 10; i++) {
  ------------------
  |  Branch (989:17): [True: 15.8k, False: 1.58k]
  ------------------
  990|  15.8k|        h[i] = f[i] + g[i];
  991|  15.8k|    }
  992|  1.58k|}
curve25519.c:fe_sub:
 1007|  1.22k|{
 1008|  1.22k|    unsigned i;
 1009|       |
 1010|  13.4k|    for (i = 0; i < 10; i++) {
  ------------------
  |  Branch (1010:17): [True: 12.2k, False: 1.22k]
  ------------------
 1011|  12.2k|        h[i] = f[i] - g[i];
 1012|  12.2k|    }
 1013|  1.22k|}
curve25519.c:fe_invert:
 1408|      6|{
 1409|      6|    fe t0;
 1410|      6|    fe t1;
 1411|      6|    fe t2;
 1412|      6|    fe t3;
 1413|      6|    int i;
 1414|       |
 1415|       |    /*
 1416|       |     * Compute z ** -1 = z ** (2 ** 255 - 19 - 2) with the exponent as
 1417|       |     * 2 ** 255 - 21 = (2 ** 5) * (2 ** 250 - 1) + 11.
 1418|       |     */
 1419|       |
 1420|       |    /* t0 = z ** 2 */
 1421|      6|    fe_sq(t0, z);
 1422|       |
 1423|       |    /* t1 = t0 ** (2 ** 2) = z ** 8 */
 1424|      6|    fe_sq(t1, t0);
 1425|      6|    fe_sq(t1, t1);
 1426|       |
 1427|       |    /* t1 = z * t1 = z ** 9 */
 1428|      6|    fe_mul(t1, z, t1);
 1429|       |    /* t0 = t0 * t1 = z ** 11 -- stash t0 away for the end. */
 1430|      6|    fe_mul(t0, t0, t1);
 1431|       |
 1432|       |    /* t2 = t0 ** 2 = z ** 22 */
 1433|      6|    fe_sq(t2, t0);
 1434|       |
 1435|       |    /* t1 = t1 * t2 = z ** (2 ** 5 - 1) */
 1436|      6|    fe_mul(t1, t1, t2);
 1437|       |
 1438|       |    /* t2 = t1 ** (2 ** 5) = z ** ((2 ** 5) * (2 ** 5 - 1)) */
 1439|      6|    fe_sq(t2, t1);
 1440|     30|    for (i = 1; i < 5; ++i) {
  ------------------
  |  Branch (1440:17): [True: 24, False: 6]
  ------------------
 1441|     24|        fe_sq(t2, t2);
 1442|     24|    }
 1443|       |
 1444|       |    /* t1 = t1 * t2 = z ** ((2 ** 5 + 1) * (2 ** 5 - 1)) = z ** (2 ** 10 - 1) */
 1445|      6|    fe_mul(t1, t2, t1);
 1446|       |
 1447|       |    /* Continuing similarly... */
 1448|       |
 1449|       |    /* t2 = z ** (2 ** 20 - 1) */
 1450|      6|    fe_sq(t2, t1);
 1451|     60|    for (i = 1; i < 10; ++i) {
  ------------------
  |  Branch (1451:17): [True: 54, False: 6]
  ------------------
 1452|     54|        fe_sq(t2, t2);
 1453|     54|    }
 1454|      6|    fe_mul(t2, t2, t1);
 1455|       |
 1456|       |    /* t2 = z ** (2 ** 40 - 1) */
 1457|      6|    fe_sq(t3, t2);
 1458|    120|    for (i = 1; i < 20; ++i) {
  ------------------
  |  Branch (1458:17): [True: 114, False: 6]
  ------------------
 1459|    114|        fe_sq(t3, t3);
 1460|    114|    }
 1461|      6|    fe_mul(t2, t3, t2);
 1462|       |
 1463|       |    /* t2 = z ** (2 ** 10) * (2 ** 40 - 1) */
 1464|     66|    for (i = 0; i < 10; ++i) {
  ------------------
  |  Branch (1464:17): [True: 60, False: 6]
  ------------------
 1465|     60|        fe_sq(t2, t2);
 1466|     60|    }
 1467|       |    /* t1 = z ** (2 ** 50 - 1) */
 1468|      6|    fe_mul(t1, t2, t1);
 1469|       |
 1470|       |    /* t2 = z ** (2 ** 100 - 1) */
 1471|      6|    fe_sq(t2, t1);
 1472|    300|    for (i = 1; i < 50; ++i) {
  ------------------
  |  Branch (1472:17): [True: 294, False: 6]
  ------------------
 1473|    294|        fe_sq(t2, t2);
 1474|    294|    }
 1475|      6|    fe_mul(t2, t2, t1);
 1476|       |
 1477|       |    /* t2 = z ** (2 ** 200 - 1) */
 1478|      6|    fe_sq(t3, t2);
 1479|    600|    for (i = 1; i < 100; ++i) {
  ------------------
  |  Branch (1479:17): [True: 594, False: 6]
  ------------------
 1480|    594|        fe_sq(t3, t3);
 1481|    594|    }
 1482|      6|    fe_mul(t2, t3, t2);
 1483|       |
 1484|       |    /* t2 = z ** ((2 ** 50) * (2 ** 200 - 1) */
 1485|      6|    fe_sq(t2, t2);
 1486|    300|    for (i = 1; i < 50; ++i) {
  ------------------
  |  Branch (1486:17): [True: 294, False: 6]
  ------------------
 1487|    294|        fe_sq(t2, t2);
 1488|    294|    }
 1489|       |
 1490|       |    /* t1 = z ** (2 ** 250 - 1) */
 1491|      6|    fe_mul(t1, t2, t1);
 1492|       |
 1493|       |    /* t1 = z ** ((2 ** 5) * (2 ** 250 - 1)) */
 1494|      6|    fe_sq(t1, t1);
 1495|     30|    for (i = 1; i < 5; ++i) {
  ------------------
  |  Branch (1495:17): [True: 24, False: 6]
  ------------------
 1496|     24|        fe_sq(t1, t1);
 1497|     24|    }
 1498|       |
 1499|       |    /* Recall t0 = z ** 11; out = z ** (2 ** 255 - 21) */
 1500|      6|    fe_mul(out, t1, t0);
 1501|      6|}
curve25519.c:fe_mul:
 1046|  2.84k|{
 1047|  2.84k|    int32_t f0 = f[0];
 1048|  2.84k|    int32_t f1 = f[1];
 1049|  2.84k|    int32_t f2 = f[2];
 1050|  2.84k|    int32_t f3 = f[3];
 1051|  2.84k|    int32_t f4 = f[4];
 1052|  2.84k|    int32_t f5 = f[5];
 1053|  2.84k|    int32_t f6 = f[6];
 1054|  2.84k|    int32_t f7 = f[7];
 1055|  2.84k|    int32_t f8 = f[8];
 1056|  2.84k|    int32_t f9 = f[9];
 1057|  2.84k|    int32_t g0 = g[0];
 1058|  2.84k|    int32_t g1 = g[1];
 1059|  2.84k|    int32_t g2 = g[2];
 1060|  2.84k|    int32_t g3 = g[3];
 1061|  2.84k|    int32_t g4 = g[4];
 1062|  2.84k|    int32_t g5 = g[5];
 1063|  2.84k|    int32_t g6 = g[6];
 1064|  2.84k|    int32_t g7 = g[7];
 1065|  2.84k|    int32_t g8 = g[8];
 1066|  2.84k|    int32_t g9 = g[9];
 1067|  2.84k|    int32_t g1_19 = 19 * g1; /* 1.959375*2^29 */
 1068|  2.84k|    int32_t g2_19 = 19 * g2; /* 1.959375*2^30; still ok */
 1069|  2.84k|    int32_t g3_19 = 19 * g3;
 1070|  2.84k|    int32_t g4_19 = 19 * g4;
 1071|  2.84k|    int32_t g5_19 = 19 * g5;
 1072|  2.84k|    int32_t g6_19 = 19 * g6;
 1073|  2.84k|    int32_t g7_19 = 19 * g7;
 1074|  2.84k|    int32_t g8_19 = 19 * g8;
 1075|  2.84k|    int32_t g9_19 = 19 * g9;
 1076|  2.84k|    int32_t f1_2 = 2 * f1;
 1077|  2.84k|    int32_t f3_2 = 2 * f3;
 1078|  2.84k|    int32_t f5_2 = 2 * f5;
 1079|  2.84k|    int32_t f7_2 = 2 * f7;
 1080|  2.84k|    int32_t f9_2 = 2 * f9;
 1081|  2.84k|    int64_t f0g0    = f0   * (int64_t) g0;
 1082|  2.84k|    int64_t f0g1    = f0   * (int64_t) g1;
 1083|  2.84k|    int64_t f0g2    = f0   * (int64_t) g2;
 1084|  2.84k|    int64_t f0g3    = f0   * (int64_t) g3;
 1085|  2.84k|    int64_t f0g4    = f0   * (int64_t) g4;
 1086|  2.84k|    int64_t f0g5    = f0   * (int64_t) g5;
 1087|  2.84k|    int64_t f0g6    = f0   * (int64_t) g6;
 1088|  2.84k|    int64_t f0g7    = f0   * (int64_t) g7;
 1089|  2.84k|    int64_t f0g8    = f0   * (int64_t) g8;
 1090|  2.84k|    int64_t f0g9    = f0   * (int64_t) g9;
 1091|  2.84k|    int64_t f1g0    = f1   * (int64_t) g0;
 1092|  2.84k|    int64_t f1g1_2  = f1_2 * (int64_t) g1;
 1093|  2.84k|    int64_t f1g2    = f1   * (int64_t) g2;
 1094|  2.84k|    int64_t f1g3_2  = f1_2 * (int64_t) g3;
 1095|  2.84k|    int64_t f1g4    = f1   * (int64_t) g4;
 1096|  2.84k|    int64_t f1g5_2  = f1_2 * (int64_t) g5;
 1097|  2.84k|    int64_t f1g6    = f1   * (int64_t) g6;
 1098|  2.84k|    int64_t f1g7_2  = f1_2 * (int64_t) g7;
 1099|  2.84k|    int64_t f1g8    = f1   * (int64_t) g8;
 1100|  2.84k|    int64_t f1g9_38 = f1_2 * (int64_t) g9_19;
 1101|  2.84k|    int64_t f2g0    = f2   * (int64_t) g0;
 1102|  2.84k|    int64_t f2g1    = f2   * (int64_t) g1;
 1103|  2.84k|    int64_t f2g2    = f2   * (int64_t) g2;
 1104|  2.84k|    int64_t f2g3    = f2   * (int64_t) g3;
 1105|  2.84k|    int64_t f2g4    = f2   * (int64_t) g4;
 1106|  2.84k|    int64_t f2g5    = f2   * (int64_t) g5;
 1107|  2.84k|    int64_t f2g6    = f2   * (int64_t) g6;
 1108|  2.84k|    int64_t f2g7    = f2   * (int64_t) g7;
 1109|  2.84k|    int64_t f2g8_19 = f2   * (int64_t) g8_19;
 1110|  2.84k|    int64_t f2g9_19 = f2   * (int64_t) g9_19;
 1111|  2.84k|    int64_t f3g0    = f3   * (int64_t) g0;
 1112|  2.84k|    int64_t f3g1_2  = f3_2 * (int64_t) g1;
 1113|  2.84k|    int64_t f3g2    = f3   * (int64_t) g2;
 1114|  2.84k|    int64_t f3g3_2  = f3_2 * (int64_t) g3;
 1115|  2.84k|    int64_t f3g4    = f3   * (int64_t) g4;
 1116|  2.84k|    int64_t f3g5_2  = f3_2 * (int64_t) g5;
 1117|  2.84k|    int64_t f3g6    = f3   * (int64_t) g6;
 1118|  2.84k|    int64_t f3g7_38 = f3_2 * (int64_t) g7_19;
 1119|  2.84k|    int64_t f3g8_19 = f3   * (int64_t) g8_19;
 1120|  2.84k|    int64_t f3g9_38 = f3_2 * (int64_t) g9_19;
 1121|  2.84k|    int64_t f4g0    = f4   * (int64_t) g0;
 1122|  2.84k|    int64_t f4g1    = f4   * (int64_t) g1;
 1123|  2.84k|    int64_t f4g2    = f4   * (int64_t) g2;
 1124|  2.84k|    int64_t f4g3    = f4   * (int64_t) g3;
 1125|  2.84k|    int64_t f4g4    = f4   * (int64_t) g4;
 1126|  2.84k|    int64_t f4g5    = f4   * (int64_t) g5;
 1127|  2.84k|    int64_t f4g6_19 = f4   * (int64_t) g6_19;
 1128|  2.84k|    int64_t f4g7_19 = f4   * (int64_t) g7_19;
 1129|  2.84k|    int64_t f4g8_19 = f4   * (int64_t) g8_19;
 1130|  2.84k|    int64_t f4g9_19 = f4   * (int64_t) g9_19;
 1131|  2.84k|    int64_t f5g0    = f5   * (int64_t) g0;
 1132|  2.84k|    int64_t f5g1_2  = f5_2 * (int64_t) g1;
 1133|  2.84k|    int64_t f5g2    = f5   * (int64_t) g2;
 1134|  2.84k|    int64_t f5g3_2  = f5_2 * (int64_t) g3;
 1135|  2.84k|    int64_t f5g4    = f5   * (int64_t) g4;
 1136|  2.84k|    int64_t f5g5_38 = f5_2 * (int64_t) g5_19;
 1137|  2.84k|    int64_t f5g6_19 = f5   * (int64_t) g6_19;
 1138|  2.84k|    int64_t f5g7_38 = f5_2 * (int64_t) g7_19;
 1139|  2.84k|    int64_t f5g8_19 = f5   * (int64_t) g8_19;
 1140|  2.84k|    int64_t f5g9_38 = f5_2 * (int64_t) g9_19;
 1141|  2.84k|    int64_t f6g0    = f6   * (int64_t) g0;
 1142|  2.84k|    int64_t f6g1    = f6   * (int64_t) g1;
 1143|  2.84k|    int64_t f6g2    = f6   * (int64_t) g2;
 1144|  2.84k|    int64_t f6g3    = f6   * (int64_t) g3;
 1145|  2.84k|    int64_t f6g4_19 = f6   * (int64_t) g4_19;
 1146|  2.84k|    int64_t f6g5_19 = f6   * (int64_t) g5_19;
 1147|  2.84k|    int64_t f6g6_19 = f6   * (int64_t) g6_19;
 1148|  2.84k|    int64_t f6g7_19 = f6   * (int64_t) g7_19;
 1149|  2.84k|    int64_t f6g8_19 = f6   * (int64_t) g8_19;
 1150|  2.84k|    int64_t f6g9_19 = f6   * (int64_t) g9_19;
 1151|  2.84k|    int64_t f7g0    = f7   * (int64_t) g0;
 1152|  2.84k|    int64_t f7g1_2  = f7_2 * (int64_t) g1;
 1153|  2.84k|    int64_t f7g2    = f7   * (int64_t) g2;
 1154|  2.84k|    int64_t f7g3_38 = f7_2 * (int64_t) g3_19;
 1155|  2.84k|    int64_t f7g4_19 = f7   * (int64_t) g4_19;
 1156|  2.84k|    int64_t f7g5_38 = f7_2 * (int64_t) g5_19;
 1157|  2.84k|    int64_t f7g6_19 = f7   * (int64_t) g6_19;
 1158|  2.84k|    int64_t f7g7_38 = f7_2 * (int64_t) g7_19;
 1159|  2.84k|    int64_t f7g8_19 = f7   * (int64_t) g8_19;
 1160|  2.84k|    int64_t f7g9_38 = f7_2 * (int64_t) g9_19;
 1161|  2.84k|    int64_t f8g0    = f8   * (int64_t) g0;
 1162|  2.84k|    int64_t f8g1    = f8   * (int64_t) g1;
 1163|  2.84k|    int64_t f8g2_19 = f8   * (int64_t) g2_19;
 1164|  2.84k|    int64_t f8g3_19 = f8   * (int64_t) g3_19;
 1165|  2.84k|    int64_t f8g4_19 = f8   * (int64_t) g4_19;
 1166|  2.84k|    int64_t f8g5_19 = f8   * (int64_t) g5_19;
 1167|  2.84k|    int64_t f8g6_19 = f8   * (int64_t) g6_19;
 1168|  2.84k|    int64_t f8g7_19 = f8   * (int64_t) g7_19;
 1169|  2.84k|    int64_t f8g8_19 = f8   * (int64_t) g8_19;
 1170|  2.84k|    int64_t f8g9_19 = f8   * (int64_t) g9_19;
 1171|  2.84k|    int64_t f9g0    = f9   * (int64_t) g0;
 1172|  2.84k|    int64_t f9g1_38 = f9_2 * (int64_t) g1_19;
 1173|  2.84k|    int64_t f9g2_19 = f9   * (int64_t) g2_19;
 1174|  2.84k|    int64_t f9g3_38 = f9_2 * (int64_t) g3_19;
 1175|  2.84k|    int64_t f9g4_19 = f9   * (int64_t) g4_19;
 1176|  2.84k|    int64_t f9g5_38 = f9_2 * (int64_t) g5_19;
 1177|  2.84k|    int64_t f9g6_19 = f9   * (int64_t) g6_19;
 1178|  2.84k|    int64_t f9g7_38 = f9_2 * (int64_t) g7_19;
 1179|  2.84k|    int64_t f9g8_19 = f9   * (int64_t) g8_19;
 1180|  2.84k|    int64_t f9g9_38 = f9_2 * (int64_t) g9_19;
 1181|  2.84k|    int64_t h0 = f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38;
 1182|  2.84k|    int64_t h1 = f0g1 + f1g0    + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + f7g4_19 + f8g3_19 + f9g2_19;
 1183|  2.84k|    int64_t h2 = f0g2 + f1g1_2  + f2g0    + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + f7g5_38 + f8g4_19 + f9g3_38;
 1184|  2.84k|    int64_t h3 = f0g3 + f1g2    + f2g1    + f3g0    + f4g9_19 + f5g8_19 + f6g7_19 + f7g6_19 + f8g5_19 + f9g4_19;
 1185|  2.84k|    int64_t h4 = f0g4 + f1g3_2  + f2g2    + f3g1_2  + f4g0    + f5g9_38 + f6g8_19 + f7g7_38 + f8g6_19 + f9g5_38;
 1186|  2.84k|    int64_t h5 = f0g5 + f1g4    + f2g3    + f3g2    + f4g1    + f5g0    + f6g9_19 + f7g8_19 + f8g7_19 + f9g6_19;
 1187|  2.84k|    int64_t h6 = f0g6 + f1g5_2  + f2g4    + f3g3_2  + f4g2    + f5g1_2  + f6g0    + f7g9_38 + f8g8_19 + f9g7_38;
 1188|  2.84k|    int64_t h7 = f0g7 + f1g6    + f2g5    + f3g4    + f4g3    + f5g2    + f6g1    + f7g0    + f8g9_19 + f9g8_19;
 1189|  2.84k|    int64_t h8 = f0g8 + f1g7_2  + f2g6    + f3g5_2  + f4g4    + f5g3_2  + f6g2    + f7g1_2  + f8g0    + f9g9_38;
 1190|  2.84k|    int64_t h9 = f0g9 + f1g8    + f2g7    + f3g6    + f4g5    + f5g4    + f6g3    + f7g2    + f8g1    + f9g0   ;
 1191|  2.84k|    int64_t carry0;
 1192|  2.84k|    int64_t carry1;
 1193|  2.84k|    int64_t carry2;
 1194|  2.84k|    int64_t carry3;
 1195|  2.84k|    int64_t carry4;
 1196|  2.84k|    int64_t carry5;
 1197|  2.84k|    int64_t carry6;
 1198|  2.84k|    int64_t carry7;
 1199|  2.84k|    int64_t carry8;
 1200|  2.84k|    int64_t carry9;
 1201|       |
 1202|       |    /* |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38))
 1203|       |     *   i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8
 1204|       |     * |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19))
 1205|       |     *   i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9 */
 1206|       |
 1207|  2.84k|    carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
 1208|  2.84k|    carry4 = h4 + (1 << 25); h5 += carry4 >> 26; h4 -= carry4 & kTop38Bits;
 1209|       |    /* |h0| <= 2^25 */
 1210|       |    /* |h4| <= 2^25 */
 1211|       |    /* |h1| <= 1.71*2^59 */
 1212|       |    /* |h5| <= 1.71*2^59 */
 1213|       |
 1214|  2.84k|    carry1 = h1 + (1 << 24); h2 += carry1 >> 25; h1 -= carry1 & kTop39Bits;
 1215|  2.84k|    carry5 = h5 + (1 << 24); h6 += carry5 >> 25; h5 -= carry5 & kTop39Bits;
 1216|       |    /* |h1| <= 2^24; from now on fits into int32 */
 1217|       |    /* |h5| <= 2^24; from now on fits into int32 */
 1218|       |    /* |h2| <= 1.41*2^60 */
 1219|       |    /* |h6| <= 1.41*2^60 */
 1220|       |
 1221|  2.84k|    carry2 = h2 + (1 << 25); h3 += carry2 >> 26; h2 -= carry2 & kTop38Bits;
 1222|  2.84k|    carry6 = h6 + (1 << 25); h7 += carry6 >> 26; h6 -= carry6 & kTop38Bits;
 1223|       |    /* |h2| <= 2^25; from now on fits into int32 unchanged */
 1224|       |    /* |h6| <= 2^25; from now on fits into int32 unchanged */
 1225|       |    /* |h3| <= 1.71*2^59 */
 1226|       |    /* |h7| <= 1.71*2^59 */
 1227|       |
 1228|  2.84k|    carry3 = h3 + (1 << 24); h4 += carry3 >> 25; h3 -= carry3 & kTop39Bits;
 1229|  2.84k|    carry7 = h7 + (1 << 24); h8 += carry7 >> 25; h7 -= carry7 & kTop39Bits;
 1230|       |    /* |h3| <= 2^24; from now on fits into int32 unchanged */
 1231|       |    /* |h7| <= 2^24; from now on fits into int32 unchanged */
 1232|       |    /* |h4| <= 1.72*2^34 */
 1233|       |    /* |h8| <= 1.41*2^60 */
 1234|       |
 1235|  2.84k|    carry4 = h4 + (1 << 25); h5 += carry4 >> 26; h4 -= carry4 & kTop38Bits;
 1236|  2.84k|    carry8 = h8 + (1 << 25); h9 += carry8 >> 26; h8 -= carry8 & kTop38Bits;
 1237|       |    /* |h4| <= 2^25; from now on fits into int32 unchanged */
 1238|       |    /* |h8| <= 2^25; from now on fits into int32 unchanged */
 1239|       |    /* |h5| <= 1.01*2^24 */
 1240|       |    /* |h9| <= 1.71*2^59 */
 1241|       |
 1242|  2.84k|    carry9 = h9 + (1 << 24); h0 += (carry9 >> 25) * 19; h9 -= carry9 & kTop39Bits;
 1243|       |    /* |h9| <= 2^24; from now on fits into int32 unchanged */
 1244|       |    /* |h0| <= 1.1*2^39 */
 1245|       |
 1246|  2.84k|    carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
 1247|       |    /* |h0| <= 2^25; from now on fits into int32 unchanged */
 1248|       |    /* |h1| <= 1.01*2^24 */
 1249|       |
 1250|  2.84k|    h[0] = (int32_t)h0;
 1251|  2.84k|    h[1] = (int32_t)h1;
 1252|  2.84k|    h[2] = (int32_t)h2;
 1253|  2.84k|    h[3] = (int32_t)h3;
 1254|  2.84k|    h[4] = (int32_t)h4;
 1255|  2.84k|    h[5] = (int32_t)h5;
 1256|  2.84k|    h[6] = (int32_t)h6;
 1257|  2.84k|    h[7] = (int32_t)h7;
 1258|  2.84k|    h[8] = (int32_t)h8;
 1259|  2.84k|    h[9] = (int32_t)h9;
 1260|  2.84k|}
curve25519.c:fe_tobytes:
  873|     10|{
  874|     10|    int32_t h0 = h[0];
  875|     10|    int32_t h1 = h[1];
  876|     10|    int32_t h2 = h[2];
  877|     10|    int32_t h3 = h[3];
  878|     10|    int32_t h4 = h[4];
  879|     10|    int32_t h5 = h[5];
  880|     10|    int32_t h6 = h[6];
  881|     10|    int32_t h7 = h[7];
  882|     10|    int32_t h8 = h[8];
  883|     10|    int32_t h9 = h[9];
  884|     10|    int32_t q;
  885|       |
  886|     10|    q = (19 * h9 + (((int32_t) 1) << 24)) >> 25;
  887|     10|    q = (h0 + q) >> 26;
  888|     10|    q = (h1 + q) >> 25;
  889|     10|    q = (h2 + q) >> 26;
  890|     10|    q = (h3 + q) >> 25;
  891|     10|    q = (h4 + q) >> 26;
  892|     10|    q = (h5 + q) >> 25;
  893|     10|    q = (h6 + q) >> 26;
  894|     10|    q = (h7 + q) >> 25;
  895|     10|    q = (h8 + q) >> 26;
  896|     10|    q = (h9 + q) >> 25;
  897|       |
  898|       |    /* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
  899|     10|    h0 += 19 * q;
  900|       |    /* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
  901|       |
  902|     10|    h1 += h0 >> 26; h0 &= kBottom26Bits;
  903|     10|    h2 += h1 >> 25; h1 &= kBottom25Bits;
  904|     10|    h3 += h2 >> 26; h2 &= kBottom26Bits;
  905|     10|    h4 += h3 >> 25; h3 &= kBottom25Bits;
  906|     10|    h5 += h4 >> 26; h4 &= kBottom26Bits;
  907|     10|    h6 += h5 >> 25; h5 &= kBottom25Bits;
  908|     10|    h7 += h6 >> 26; h6 &= kBottom26Bits;
  909|     10|    h8 += h7 >> 25; h7 &= kBottom25Bits;
  910|     10|    h9 += h8 >> 26; h8 &= kBottom26Bits;
  911|     10|                    h9 &= kBottom25Bits;
  912|       |    /* h10 = carry9 */
  913|       |
  914|       |    /*
  915|       |     * Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
  916|       |     * Have h0+...+2^230 h9 between 0 and 2^255-1;
  917|       |     * evidently 2^255 h10-2^255 q = 0.
  918|       |     * Goal: Output h0+...+2^230 h9.
  919|       |     */
  920|     10|    s[ 0] = (uint8_t) (h0 >>  0);
  921|     10|    s[ 1] = (uint8_t) (h0 >>  8);
  922|     10|    s[ 2] = (uint8_t) (h0 >> 16);
  923|     10|    s[ 3] = (uint8_t)((h0 >> 24) | ((uint32_t)(h1) << 2));
  924|     10|    s[ 4] = (uint8_t) (h1 >>  6);
  925|     10|    s[ 5] = (uint8_t) (h1 >> 14);
  926|     10|    s[ 6] = (uint8_t)((h1 >> 22) | ((uint32_t)(h2) << 3));
  927|     10|    s[ 7] = (uint8_t) (h2 >>  5);
  928|     10|    s[ 8] = (uint8_t) (h2 >> 13);
  929|     10|    s[ 9] = (uint8_t)((h2 >> 21) | ((uint32_t)(h3) << 5));
  930|     10|    s[10] = (uint8_t) (h3 >>  3);
  931|     10|    s[11] = (uint8_t) (h3 >> 11);
  932|     10|    s[12] = (uint8_t)((h3 >> 19) | ((uint32_t)(h4) << 6));
  933|     10|    s[13] = (uint8_t) (h4 >>  2);
  934|     10|    s[14] = (uint8_t) (h4 >> 10);
  935|     10|    s[15] = (uint8_t) (h4 >> 18);
  936|     10|    s[16] = (uint8_t) (h5 >>  0);
  937|     10|    s[17] = (uint8_t) (h5 >>  8);
  938|     10|    s[18] = (uint8_t) (h5 >> 16);
  939|     10|    s[19] = (uint8_t)((h5 >> 24) | ((uint32_t)(h6) << 1));
  940|     10|    s[20] = (uint8_t) (h6 >>  7);
  941|     10|    s[21] = (uint8_t) (h6 >> 15);
  942|     10|    s[22] = (uint8_t)((h6 >> 23) | ((uint32_t)(h7) << 3));
  943|     10|    s[23] = (uint8_t) (h7 >>  5);
  944|     10|    s[24] = (uint8_t) (h7 >> 13);
  945|     10|    s[25] = (uint8_t)((h7 >> 21) | ((uint32_t)(h8) << 4));
  946|     10|    s[26] = (uint8_t) (h8 >>  4);
  947|     10|    s[27] = (uint8_t) (h8 >> 12);
  948|     10|    s[28] = (uint8_t)((h8 >> 20) | ((uint32_t)(h9) << 6));
  949|     10|    s[29] = (uint8_t) (h9 >>  2);
  950|     10|    s[30] = (uint8_t) (h9 >> 10);
  951|     10|    s[31] = (uint8_t) (h9 >> 18);
  952|     10|}

f_impl64.c:widemul:
   23|   389k|{
   24|   389k|    return ((uint128_t) a) * b;
   25|   389k|}

curve448.c:gf_sub_RAW:
   32|  2.54k|{
   33|  2.54k|    uint64_t co1 = ((1ULL << 56) - 1) * 2, co2 = co1 - 2;
   34|  2.54k|    unsigned int i;
   35|       |
   36|  22.8k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |   21|  22.8k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (36:17): [True: 20.3k, False: 2.54k]
  ------------------
   37|  20.3k|        out->limb[i] = a->limb[i] - b->limb[i] + ((i == NLIMBS / 2) ? co2 : co1);
  ------------------
  |  |   21|  20.3k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (37:51): [True: 2.54k, False: 17.8k]
  ------------------
   38|       |
   39|  2.54k|    gf_weak_reduce(out);
   40|  2.54k|}
curve448.c:gf_bias:
   43|  2.54k|{
   44|  2.54k|}
curve448.c:gf_weak_reduce:
   47|  5.08k|{
   48|  5.08k|    uint64_t mask = (1ULL << 56) - 1;
   49|  5.08k|    uint64_t tmp = a->limb[NLIMBS - 1] >> 56;
  ------------------
  |  |   21|  5.08k|# define NLIMBS (64/sizeof(word_t))
  ------------------
   50|  5.08k|    unsigned int i;
   51|       |
   52|  5.08k|    a->limb[NLIMBS / 2] += tmp;
  ------------------
  |  |   21|  5.08k|# define NLIMBS (64/sizeof(word_t))
  ------------------
   53|  40.7k|    for (i = NLIMBS - 1; i > 0; i--)
  ------------------
  |  |   21|  5.08k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (53:26): [True: 35.6k, False: 5.08k]
  ------------------
   54|  35.6k|        a->limb[i] = (a->limb[i] & mask) + (a->limb[i - 1] >> 56);
   55|  5.08k|    a->limb[0] = (a->limb[0] & mask) + tmp;
   56|  5.08k|}
curve448.c:gf_add_RAW:
   22|  2.54k|{
   23|  2.54k|    unsigned int i;
   24|       |
   25|  22.8k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |   21|  22.8k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (25:17): [True: 20.3k, False: 2.54k]
  ------------------
   26|  20.3k|        out->limb[i] = a->limb[i] + b->limb[i];
   27|       |
   28|  2.54k|    gf_weak_reduce(out);
   29|  2.54k|}
f_generic.c:gf_weak_reduce:
   47|  1.53k|{
   48|  1.53k|    uint64_t mask = (1ULL << 56) - 1;
   49|  1.53k|    uint64_t tmp = a->limb[NLIMBS - 1] >> 56;
  ------------------
  |  |   21|  1.53k|# define NLIMBS (64/sizeof(word_t))
  ------------------
   50|  1.53k|    unsigned int i;
   51|       |
   52|  1.53k|    a->limb[NLIMBS / 2] += tmp;
  ------------------
  |  |   21|  1.53k|# define NLIMBS (64/sizeof(word_t))
  ------------------
   53|  12.2k|    for (i = NLIMBS - 1; i > 0; i--)
  ------------------
  |  |   21|  1.53k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (53:26): [True: 10.7k, False: 1.53k]
  ------------------
   54|  10.7k|        a->limb[i] = (a->limb[i] & mask) + (a->limb[i - 1] >> 56);
   55|  1.53k|    a->limb[0] = (a->limb[0] & mask) + tmp;
   56|  1.53k|}
f_generic.c:gf_sub_RAW:
   32|    742|{
   33|    742|    uint64_t co1 = ((1ULL << 56) - 1) * 2, co2 = co1 - 2;
   34|    742|    unsigned int i;
   35|       |
   36|  6.67k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |   21|  6.67k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (36:17): [True: 5.93k, False: 742]
  ------------------
   37|  5.93k|        out->limb[i] = a->limb[i] - b->limb[i] + ((i == NLIMBS / 2) ? co2 : co1);
  ------------------
  |  |   21|  5.93k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (37:51): [True: 742, False: 5.19k]
  ------------------
   38|       |
   39|    742|    gf_weak_reduce(out);
   40|    742|}
f_generic.c:gf_bias:
   43|    742|{
   44|    742|}
f_generic.c:gf_add_RAW:
   22|     14|{
   23|     14|    unsigned int i;
   24|       |
   25|    126|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |   21|    126|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (25:17): [True: 112, False: 14]
  ------------------
   26|    112|        out->limb[i] = a->limb[i] + b->limb[i];
   27|       |
   28|     14|    gf_weak_reduce(out);
   29|     14|}

ossl_gf_mul:
   25|  5.52k|{
   26|  5.52k|    const uint64_t *a = as->limb, *b = bs->limb;
   27|  5.52k|    uint64_t *c = cs->limb;
   28|  5.52k|    uint128_t accum0 = 0, accum1 = 0, accum2;
   29|  5.52k|    uint64_t mask = (1ULL << 56) - 1;
   30|  5.52k|    uint64_t aa[4], bb[4], bbb[4];
   31|  5.52k|    unsigned int i, j;
   32|       |
   33|  27.6k|    for (i = 0; i < 4; i++) {
  ------------------
  |  Branch (33:17): [True: 22.1k, False: 5.52k]
  ------------------
   34|  22.1k|        aa[i] = a[i] + a[i + 4];
   35|  22.1k|        bb[i] = b[i] + b[i + 4];
   36|  22.1k|        bbb[i] = bb[i] + b[i + 4];
   37|  22.1k|    }
   38|       |
   39|  27.6k|    for (i = 0; i < 4; i++) {
  ------------------
  |  Branch (39:17): [True: 22.1k, False: 5.52k]
  ------------------
   40|  22.1k|        accum2 = 0;
   41|       |
   42|  77.3k|        for (j = 0; j <= i; j++) {
  ------------------
  |  Branch (42:21): [True: 55.2k, False: 22.1k]
  ------------------
   43|  55.2k|            accum2 += widemul(a[j], b[i - j]);
   44|  55.2k|            accum1 += widemul(aa[j], bb[i - j]);
   45|  55.2k|            accum0 += widemul(a[j + 4], b[i - j + 4]);
   46|  55.2k|        }
   47|  55.2k|        for (; j < 4; j++) {
  ------------------
  |  Branch (47:16): [True: 33.1k, False: 22.1k]
  ------------------
   48|  33.1k|            accum2 += widemul(a[j], b[i - j + 8]);
   49|  33.1k|            accum1 += widemul(aa[j], bbb[i - j + 4]);
   50|  33.1k|            accum0 += widemul(a[j + 4], bb[i - j + 4]);
   51|  33.1k|        }
   52|       |
   53|  22.1k|        accum1 -= accum2;
   54|  22.1k|        accum0 += accum2;
   55|       |
   56|  22.1k|        c[i] = ((uint64_t)(accum0)) & mask;
   57|  22.1k|        c[i + 4] = ((uint64_t)(accum1)) & mask;
   58|       |
   59|  22.1k|        accum0 >>= 56;
   60|  22.1k|        accum1 >>= 56;
   61|  22.1k|    }
   62|       |
   63|  5.52k|    accum0 += accum1;
   64|  5.52k|    accum0 += c[4];
   65|  5.52k|    accum1 += c[0];
   66|  5.52k|    c[4] = ((uint64_t)(accum0)) & mask;
   67|  5.52k|    c[0] = ((uint64_t)(accum1)) & mask;
   68|       |
   69|  5.52k|    accum0 >>= 56;
   70|  5.52k|    accum1 >>= 56;
   71|       |
   72|  5.52k|    c[5] += ((uint64_t)(accum0));
   73|  5.52k|    c[1] += ((uint64_t)(accum1));
   74|  5.52k|}
ossl_gf_sqr:
  103|  4.14k|{
  104|  4.14k|    const uint64_t *a = as->limb;
  105|  4.14k|    uint64_t *c = cs->limb;
  106|  4.14k|    uint128_t accum0 = 0, accum1 = 0, accum2;
  107|  4.14k|    uint64_t mask = (1ULL << 56) - 1;
  108|  4.14k|    uint64_t aa[4];
  109|  4.14k|    unsigned int i;
  110|       |
  111|       |    /* For some reason clang doesn't vectorize this without prompting? */
  112|  20.7k|    for (i = 0; i < 4; i++)
  ------------------
  |  Branch (112:17): [True: 16.5k, False: 4.14k]
  ------------------
  113|  16.5k|        aa[i] = a[i] + a[i + 4];
  114|       |
  115|  4.14k|    accum2 = widemul(a[0], a[3]);
  116|  4.14k|    accum0 = widemul(aa[0], aa[3]);
  117|  4.14k|    accum1 = widemul(a[4], a[7]);
  118|       |
  119|  4.14k|    accum2 += widemul(a[1], a[2]);
  120|  4.14k|    accum0 += widemul(aa[1], aa[2]);
  121|  4.14k|    accum1 += widemul(a[5], a[6]);
  122|       |
  123|  4.14k|    accum0 -= accum2;
  124|  4.14k|    accum1 += accum2;
  125|       |
  126|  4.14k|    c[3] = ((uint64_t)(accum1)) << 1 & mask;
  127|  4.14k|    c[7] = ((uint64_t)(accum0)) << 1 & mask;
  128|       |
  129|  4.14k|    accum0 >>= 55;
  130|  4.14k|    accum1 >>= 55;
  131|       |
  132|  4.14k|    accum0 += widemul(2 * aa[1], aa[3]);
  133|  4.14k|    accum1 += widemul(2 * a[5], a[7]);
  134|  4.14k|    accum0 += widemul(aa[2], aa[2]);
  135|  4.14k|    accum1 += accum0;
  136|       |
  137|  4.14k|    accum0 -= widemul(2 * a[1], a[3]);
  138|  4.14k|    accum1 += widemul(a[6], a[6]);
  139|       |
  140|  4.14k|    accum2 = widemul(a[0], a[0]);
  141|  4.14k|    accum1 -= accum2;
  142|  4.14k|    accum0 += accum2;
  143|       |
  144|  4.14k|    accum0 -= widemul(a[2], a[2]);
  145|  4.14k|    accum1 += widemul(aa[0], aa[0]);
  146|  4.14k|    accum0 += widemul(a[4], a[4]);
  147|       |
  148|  4.14k|    c[0] = ((uint64_t)(accum0)) & mask;
  149|  4.14k|    c[4] = ((uint64_t)(accum1)) & mask;
  150|       |
  151|  4.14k|    accum0 >>= 56;
  152|  4.14k|    accum1 >>= 56;
  153|       |
  154|  4.14k|    accum2 = widemul(2 * aa[2], aa[3]);
  155|  4.14k|    accum0 -= widemul(2 * a[2], a[3]);
  156|  4.14k|    accum1 += widemul(2 * a[6], a[7]);
  157|       |
  158|  4.14k|    accum1 += accum2;
  159|  4.14k|    accum0 += accum2;
  160|       |
  161|  4.14k|    accum2 = widemul(2 * a[0], a[1]);
  162|  4.14k|    accum1 += widemul(2 * aa[0], aa[1]);
  163|  4.14k|    accum0 += widemul(2 * a[4], a[5]);
  164|       |
  165|  4.14k|    accum1 -= accum2;
  166|  4.14k|    accum0 += accum2;
  167|       |
  168|  4.14k|    c[1] = ((uint64_t)(accum0)) & mask;
  169|  4.14k|    c[5] = ((uint64_t)(accum1)) & mask;
  170|       |
  171|  4.14k|    accum0 >>= 56;
  172|  4.14k|    accum1 >>= 56;
  173|       |
  174|  4.14k|    accum2 = widemul(aa[3], aa[3]);
  175|  4.14k|    accum0 -= widemul(a[3], a[3]);
  176|  4.14k|    accum1 += widemul(a[7], a[7]);
  177|       |
  178|  4.14k|    accum1 += accum2;
  179|  4.14k|    accum0 += accum2;
  180|       |
  181|  4.14k|    accum2 = widemul(2 * a[0], a[2]);
  182|  4.14k|    accum1 += widemul(2 * aa[0], aa[2]);
  183|  4.14k|    accum0 += widemul(2 * a[4], a[6]);
  184|       |
  185|  4.14k|    accum2 += widemul(a[1], a[1]);
  186|  4.14k|    accum1 += widemul(aa[1], aa[1]);
  187|  4.14k|    accum0 += widemul(a[5], a[5]);
  188|       |
  189|  4.14k|    accum1 -= accum2;
  190|  4.14k|    accum0 += accum2;
  191|       |
  192|  4.14k|    c[2] = ((uint64_t)(accum0)) & mask;
  193|  4.14k|    c[6] = ((uint64_t)(accum1)) & mask;
  194|       |
  195|  4.14k|    accum0 >>= 56;
  196|  4.14k|    accum1 >>= 56;
  197|       |
  198|  4.14k|    accum0 += c[3];
  199|  4.14k|    accum1 += c[7];
  200|  4.14k|    c[3] = ((uint64_t)(accum0)) & mask;
  201|  4.14k|    c[7] = ((uint64_t)(accum1)) & mask;
  202|       |
  203|       |    /* we could almost stop here, but it wouldn't be stable, so... */
  204|       |
  205|  4.14k|    accum0 >>= 56;
  206|  4.14k|    accum1 >>= 56;
  207|  4.14k|    c[4] += ((uint64_t)(accum0)) + ((uint64_t)(accum1));
  208|  4.14k|    c[0] += ((uint64_t)(accum1));
  209|  4.14k|}

ossl_curve448_precomputed_scalarmul:
  234|      8|{
  235|      8|    unsigned int i, j, k;
  236|      8|    const unsigned int n = COMBS_N, t = COMBS_T, s = COMBS_S;
  ------------------
  |  |   20|      8|#define COMBS_N 5
  ------------------
                  const unsigned int n = COMBS_N, t = COMBS_T, s = COMBS_S;
  ------------------
  |  |   21|      8|#define COMBS_T 5
  ------------------
                  const unsigned int n = COMBS_N, t = COMBS_T, s = COMBS_S;
  ------------------
  |  |   22|      8|#define COMBS_S 18
  ------------------
  237|      8|    niels_t ni;
  238|      8|    curve448_scalar_t scalar1x;
  239|       |
  240|      8|    ossl_curve448_scalar_add(scalar1x, scalar, precomputed_scalarmul_adjustment);
  241|      8|    ossl_curve448_scalar_halve(scalar1x, scalar1x);
  242|       |
  243|    152|    for (i = s; i > 0; i--) {
  ------------------
  |  Branch (243:17): [True: 144, False: 8]
  ------------------
  244|    144|        if (i != s)
  ------------------
  |  Branch (244:13): [True: 136, False: 8]
  ------------------
  245|    136|            point_double_internal(out, out, 0);
  246|       |
  247|    864|        for (j = 0; j < n; j++) {
  ------------------
  |  Branch (247:21): [True: 720, False: 144]
  ------------------
  248|    720|            int tab = 0;
  249|    720|            mask_t invert;
  250|       |
  251|  4.32k|            for (k = 0; k < t; k++) {
  ------------------
  |  Branch (251:25): [True: 3.60k, False: 720]
  ------------------
  252|  3.60k|                unsigned int bit = (i - 1) + s * (k + j * t);
  253|       |
  254|  3.60k|                if (bit < C448_SCALAR_BITS)
  ------------------
  |  |   41|  3.60k|# define C448_SCALAR_BITS 446
  ------------------
  |  Branch (254:21): [True: 3.56k, False: 32]
  ------------------
  255|  3.56k|                    tab |=
  256|  3.56k|                        (scalar1x->limb[bit / WBITS] >> (bit % WBITS) & 1) << k;
  ------------------
  |  |   39|  3.56k|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|  3.56k|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
                                      (scalar1x->limb[bit / WBITS] >> (bit % WBITS) & 1) << k;
  ------------------
  |  |   39|  3.56k|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|  3.56k|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  257|  3.60k|            }
  258|       |
  259|    720|            invert = (tab >> (t - 1)) - 1;
  260|    720|            tab ^= invert;
  261|    720|            tab &= (1 << (t - 1)) - 1;
  262|       |
  263|    720|            constant_time_lookup_niels(ni, &table->table[j << (t - 1)],
  264|    720|                                       1 << (t - 1), tab);
  265|       |
  266|    720|            cond_neg_niels(ni, invert);
  267|    720|            if ((i != s) || j != 0)
  ------------------
  |  Branch (267:17): [True: 680, False: 40]
  |  Branch (267:29): [True: 32, False: 8]
  ------------------
  268|    712|                add_niels_to_pt(out, ni, j == n - 1 && i != 1);
  ------------------
  |  Branch (268:42): [True: 144, False: 568]
  |  Branch (268:56): [True: 136, False: 8]
  ------------------
  269|      8|            else
  270|      8|                niels_to_pt(out, ni);
  271|    720|        }
  272|    144|    }
  273|       |
  274|      8|    OPENSSL_cleanse(ni, sizeof(ni));
  275|      8|    OPENSSL_cleanse(scalar1x, sizeof(scalar1x));
  276|      8|}
ossl_curve448_point_mul_by_ratio_and_encode_like_eddsa:
  282|      2|{
  283|      2|    gf x, y, z, t;
  284|      2|    curve448_point_t q;
  285|       |
  286|       |    /* The point is now on the twisted curve.  Move it to untwisted. */
  287|      2|    curve448_point_copy(q, p);
  288|       |
  289|      2|    {
  290|       |        /* 4-isogeny: 2xy/(y^+x^2), (y^2-x^2)/(2z^2-y^2+x^2) */
  291|      2|        gf u;
  292|       |
  293|      2|        ossl_gf_sqr(x, q->x);
  294|      2|        ossl_gf_sqr(t, q->y);
  295|      2|        gf_add(u, x, t);
  296|      2|        gf_add(z, q->y, q->x);
  297|      2|        ossl_gf_sqr(y, z);
  298|      2|        gf_sub(y, y, u);
  299|      2|        gf_sub(z, t, x);
  300|      2|        ossl_gf_sqr(x, q->z);
  301|      2|        gf_add(t, x, x);
  302|      2|        gf_sub(t, t, z);
  303|      2|        ossl_gf_mul(x, t, y);
  304|      2|        ossl_gf_mul(y, z, u);
  305|      2|        ossl_gf_mul(z, u, t);
  306|      2|        OPENSSL_cleanse(u, sizeof(u));
  307|      2|    }
  308|       |
  309|       |    /* Affinize */
  310|      2|    gf_invert(z, z, 1);
  311|      2|    ossl_gf_mul(t, x, z);
  312|      2|    ossl_gf_mul(x, y, z);
  313|       |
  314|       |    /* Encode */
  315|      2|    enc[EDDSA_448_PRIVATE_BYTES - 1] = 0;
  ------------------
  |  |   22|      2|# define EDDSA_448_PRIVATE_BYTES EDDSA_448_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   19|      2|# define EDDSA_448_PUBLIC_BYTES 57
  |  |  ------------------
  ------------------
  316|      2|    gf_serialize(enc, x, 1);
  317|      2|    enc[EDDSA_448_PRIVATE_BYTES - 1] |= 0x80 & gf_lobit(t);
  ------------------
  |  |   22|      2|# define EDDSA_448_PRIVATE_BYTES EDDSA_448_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   19|      2|# define EDDSA_448_PUBLIC_BYTES 57
  |  |  ------------------
  ------------------
  318|       |
  319|      2|    OPENSSL_cleanse(x, sizeof(x));
  320|      2|    OPENSSL_cleanse(y, sizeof(y));
  321|      2|    OPENSSL_cleanse(z, sizeof(z));
  322|      2|    OPENSSL_cleanse(t, sizeof(t));
  323|      2|    ossl_curve448_point_destroy(q);
  324|      2|}
ossl_curve448_point_mul_by_ratio_and_encode_like_x448:
  469|      6|{
  470|      6|    curve448_point_t q;
  471|       |
  472|      6|    curve448_point_copy(q, p);
  473|      6|    gf_invert(q->t, q->x, 0);   /* 1/x */
  474|      6|    ossl_gf_mul(q->z, q->t, q->y);   /* y/x */
  475|      6|    ossl_gf_sqr(q->y, q->z);         /* (y/x)^2 */
  476|      6|    gf_serialize(out, q->y, 1);
  477|      6|    ossl_curve448_point_destroy(q);
  478|      6|}
ossl_x448_derive_public_key:
  482|      6|{
  483|       |    /* Scalar conditioning */
  484|      6|    uint8_t scalar2[X_PRIVATE_BYTES];
  485|      6|    curve448_scalar_t the_scalar;
  486|      6|    curve448_point_t p;
  487|      6|    unsigned int i;
  488|       |
  489|      6|    memcpy(scalar2, scalar, sizeof(scalar2));
  490|      6|    scalar2[0] &= -(uint8_t)COFACTOR;
  ------------------
  |  |   21|      6|#define COFACTOR 4
  ------------------
  491|       |
  492|      6|    scalar2[X_PRIVATE_BYTES - 1] &= ~((0u - 1u) << ((X_PRIVATE_BITS + 7) % 8));
  ------------------
  |  |   41|      6|# define X_PRIVATE_BYTES X_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   40|      6|# define X_PUBLIC_BYTES  X_SER_BYTES
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|      6|# define X_SER_BYTES 56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  scalar2[X_PRIVATE_BYTES - 1] &= ~((0u - 1u) << ((X_PRIVATE_BITS + 7) % 8));
  ------------------
  |  |   42|      6|# define X_PRIVATE_BITS  448
  ------------------
  493|      6|    scalar2[X_PRIVATE_BYTES - 1] |= 1 << ((X_PRIVATE_BITS + 7) % 8);
  ------------------
  |  |   41|      6|# define X_PRIVATE_BYTES X_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   40|      6|# define X_PUBLIC_BYTES  X_SER_BYTES
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|      6|# define X_SER_BYTES 56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  scalar2[X_PRIVATE_BYTES - 1] |= 1 << ((X_PRIVATE_BITS + 7) % 8);
  ------------------
  |  |   42|      6|# define X_PRIVATE_BITS  448
  ------------------
  494|       |
  495|      6|    ossl_curve448_scalar_decode_long(the_scalar, scalar2, sizeof(scalar2));
  496|       |
  497|       |    /* Compensate for the encoding ratio */
  498|     12|    for (i = 1; i < X448_ENCODE_RATIO; i <<= 1)
  ------------------
  |  |   47|     12|# define X448_ENCODE_RATIO 2
  ------------------
  |  Branch (498:17): [True: 6, False: 6]
  ------------------
  499|      6|        ossl_curve448_scalar_halve(the_scalar, the_scalar);
  500|       |
  501|      6|    ossl_curve448_precomputed_scalarmul(p, ossl_curve448_precomputed_base,
  502|      6|                                        the_scalar);
  503|      6|    ossl_curve448_point_mul_by_ratio_and_encode_like_x448(out, p);
  504|      6|    ossl_curve448_point_destroy(p);
  505|      6|}
ossl_curve448_point_destroy:
  730|     16|{
  731|     16|    OPENSSL_cleanse(point, sizeof(curve448_point_t));
  732|     16|}
ossl_x448_public_from_private:
  743|      6|{
  744|      6|    ossl_x448_derive_public_key(out_public_value, private_key);
  745|      6|}
curve448.c:point_double_internal:
   63|    136|{
   64|    136|    gf a, b, c, d;
   65|       |
   66|    136|    ossl_gf_sqr(c, q->x);
   67|    136|    ossl_gf_sqr(a, q->y);
   68|    136|    gf_add_nr(d, c, a);         /* 2+e */
  ------------------
  |  |  101|    136|# define gf_add_nr gf_add_RAW
  ------------------
   69|    136|    gf_add_nr(p->t, q->y, q->x); /* 2+e */
  ------------------
  |  |  101|    136|# define gf_add_nr gf_add_RAW
  ------------------
   70|    136|    ossl_gf_sqr(b, p->t);
   71|    136|    gf_subx_nr(b, b, d, 3);     /* 4+e */
   72|    136|    gf_sub_nr(p->t, a, c);      /* 3+e */
   73|    136|    ossl_gf_sqr(p->x, q->z);
   74|    136|    gf_add_nr(p->z, p->x, p->x); /* 2+e */
  ------------------
  |  |  101|    136|# define gf_add_nr gf_add_RAW
  ------------------
   75|    136|    gf_subx_nr(a, p->z, p->t, 4); /* 6+e */
   76|    136|    if (GF_HEADROOM == 5)
  ------------------
  |  |   16|    136|# define GF_HEADROOM 9999        /* Everything is reduced anyway */
  ------------------
  |  Branch (76:9): [Folded - Ignored]
  ------------------
   77|      0|        gf_weak_reduce(a);      /* or 1+e */
   78|    136|    ossl_gf_mul(p->x, a, b);
   79|    136|    ossl_gf_mul(p->z, p->t, a);
   80|    136|    ossl_gf_mul(p->y, p->t, d);
   81|    136|    if (!before_double)
  ------------------
  |  Branch (81:9): [True: 136, False: 0]
  ------------------
   82|    136|        ossl_gf_mul(p->t, b, d);
   83|    136|}
curve448.c:constant_time_lookup_niels:
  226|    720|{
  227|    720|    constant_time_lookup(ni, table, sizeof(niels_s), nelts, idx);
  228|    720|}
curve448.c:cond_neg_niels:
   92|    720|{
   93|    720|    gf_cond_swap(n->a, n->b, neg);
   94|    720|    gf_cond_neg(n->c, neg);
   95|    720|}
curve448.c:add_niels_to_pt:
  127|    712|{
  128|    712|    gf a, b, c;
  129|       |
  130|    712|    gf_sub_nr(b, d->y, d->x);   /* 3+e */
  131|    712|    ossl_gf_mul(a, e->a, b);
  132|    712|    gf_add_nr(b, d->x, d->y);   /* 2+e */
  ------------------
  |  |  101|    712|# define gf_add_nr gf_add_RAW
  ------------------
  133|    712|    ossl_gf_mul(d->y, e->b, b);
  134|    712|    ossl_gf_mul(d->x, e->c, d->t);
  135|    712|    gf_add_nr(c, a, d->y);      /* 2+e */
  ------------------
  |  |  101|    712|# define gf_add_nr gf_add_RAW
  ------------------
  136|    712|    gf_sub_nr(b, d->y, a);      /* 3+e */
  137|    712|    gf_sub_nr(d->y, d->z, d->x); /* 3+e */
  138|    712|    gf_add_nr(a, d->x, d->z);   /* 2+e */
  ------------------
  |  |  101|    712|# define gf_add_nr gf_add_RAW
  ------------------
  139|    712|    ossl_gf_mul(d->z, a, d->y);
  140|    712|    ossl_gf_mul(d->x, d->y, b);
  141|    712|    ossl_gf_mul(d->y, a, c);
  142|    712|    if (!before_double)
  ------------------
  |  Branch (142:9): [True: 576, False: 136]
  ------------------
  143|    576|        ossl_gf_mul(d->t, b, c);
  144|    712|}
curve448.c:niels_to_pt:
  118|      8|{
  119|      8|    gf_add(e->y, n->b, n->a);
  120|      8|    gf_sub(e->x, n->b, n->a);
  121|      8|    ossl_gf_mul(e->t, e->y, e->x);
  122|      8|    gf_copy(e->z, ONE);
  123|      8|}
curve448.c:gf_invert:
   43|      8|{
   44|      8|    mask_t ret;
   45|      8|    gf t1, t2;
   46|       |
   47|      8|    ossl_gf_sqr(t1, x);              /* o^2 */
   48|      8|    ret = gf_isr(t2, t1);       /* +-1/sqrt(o^2) = +-1/o */
   49|      8|    (void)ret;
   50|      8|    if (assert_nonzero)
  ------------------
  |  Branch (50:9): [True: 2, False: 6]
  ------------------
   51|      2|        assert(ret);
   52|      8|    ossl_gf_sqr(t1, t2);
   53|      8|    ossl_gf_mul(t2, t1, x);          /* not direct to y in case of alias. */
   54|      8|    gf_copy(y, t2);
   55|      8|}

scalar.c:c448_succeed_if:
   78|      2|{
   79|      2|    return (c448_error_t) x;
   80|      2|}

ossl_c448_ed448_derive_public_key:
  112|      2|{
  113|       |    /* only this much used for keygen */
  114|      2|    uint8_t secret_scalar_ser[EDDSA_448_PRIVATE_BYTES];
  115|      2|    curve448_scalar_t secret_scalar;
  116|      2|    unsigned int c;
  117|      2|    curve448_point_t p;
  118|       |
  119|      2|    if (!oneshot_hash(ctx, secret_scalar_ser, sizeof(secret_scalar_ser),
  ------------------
  |  Branch (119:9): [True: 0, False: 2]
  ------------------
  120|      2|                      privkey,
  121|      2|                      EDDSA_448_PRIVATE_BYTES,
  ------------------
  |  |   22|      2|# define EDDSA_448_PRIVATE_BYTES EDDSA_448_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   19|      2|# define EDDSA_448_PUBLIC_BYTES 57
  |  |  ------------------
  ------------------
  122|      2|                      propq))
  123|      0|        return C448_FAILURE;
  124|       |
  125|      2|    clamp(secret_scalar_ser);
  126|       |
  127|      2|    ossl_curve448_scalar_decode_long(secret_scalar, secret_scalar_ser,
  128|      2|                                     sizeof(secret_scalar_ser));
  129|       |
  130|       |    /*
  131|       |     * Since we are going to mul_by_cofactor during encoding, divide by it
  132|       |     * here. However, the EdDSA base point is not the same as the decaf base
  133|       |     * point if the sigma isogeny is in use: the EdDSA base point is on
  134|       |     * Etwist_d/(1-d) and the decaf base point is on Etwist_d, and when
  135|       |     * converted it effectively picks up a factor of 2 from the isogenies.  So
  136|       |     * we might start at 2 instead of 1.
  137|       |     */
  138|      6|    for (c = 1; c < C448_EDDSA_ENCODE_RATIO; c <<= 1)
  ------------------
  |  |   29|      6|# define C448_EDDSA_ENCODE_RATIO 4
  ------------------
  |  Branch (138:17): [True: 4, False: 2]
  ------------------
  139|      4|        ossl_curve448_scalar_halve(secret_scalar, secret_scalar);
  140|       |
  141|      2|    ossl_curve448_precomputed_scalarmul(p, ossl_curve448_precomputed_base,
  142|      2|                                        secret_scalar);
  143|       |
  144|      2|    ossl_curve448_point_mul_by_ratio_and_encode_like_eddsa(pubkey, p);
  145|       |
  146|       |    /* Cleanup */
  147|      2|    ossl_curve448_scalar_destroy(secret_scalar);
  148|      2|    ossl_curve448_point_destroy(p);
  149|      2|    OPENSSL_cleanse(secret_scalar_ser, sizeof(secret_scalar_ser));
  150|       |
  151|      2|    return C448_SUCCESS;
  152|      2|}
ossl_ed448_public_from_private:
  398|      2|{
  399|      2|    return ossl_c448_ed448_derive_public_key(ctx, out_public_key, private_key,
  400|      2|                                             propq) == C448_SUCCESS;
  401|      2|}
eddsa.c:oneshot_hash:
   26|      2|{
   27|      2|    EVP_MD_CTX *hashctx = EVP_MD_CTX_new();
   28|      2|    EVP_MD *shake256 = NULL;
   29|      2|    c448_error_t ret = C448_FAILURE;
   30|       |
   31|      2|    if (hashctx == NULL)
  ------------------
  |  Branch (31:9): [True: 0, False: 2]
  ------------------
   32|      0|        return C448_FAILURE;
   33|       |
   34|      2|    shake256 = EVP_MD_fetch(ctx, "SHAKE256", propq);
   35|      2|    if (shake256 == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 2]
  ------------------
   36|      0|        goto err;
   37|       |
   38|      2|    if (!EVP_DigestInit_ex(hashctx, shake256, NULL)
  ------------------
  |  Branch (38:9): [True: 0, False: 2]
  ------------------
   39|      2|            || !EVP_DigestUpdate(hashctx, in, inlen)
  ------------------
  |  Branch (39:16): [True: 0, False: 2]
  ------------------
   40|      2|            || !EVP_DigestFinalXOF(hashctx, out, outlen))
  ------------------
  |  Branch (40:16): [True: 0, False: 2]
  ------------------
   41|      0|        goto err;
   42|       |
   43|      2|    ret = C448_SUCCESS;
   44|      2| err:
   45|      2|    EVP_MD_CTX_free(hashctx);
   46|      2|    EVP_MD_free(shake256);
   47|      2|    return ret;
   48|      2|}
eddsa.c:clamp:
   51|      2|{
   52|      2|    secret_scalar_ser[0] &= -COFACTOR;
  ------------------
  |  |   21|      2|#define COFACTOR 4
  ------------------
   53|      2|    secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 1] = 0;
  ------------------
  |  |   22|      2|# define EDDSA_448_PRIVATE_BYTES EDDSA_448_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   19|      2|# define EDDSA_448_PUBLIC_BYTES 57
  |  |  ------------------
  ------------------
   54|      2|    secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 2] |= 0x80;
  ------------------
  |  |   22|      2|# define EDDSA_448_PRIVATE_BYTES EDDSA_448_PUBLIC_BYTES
  |  |  ------------------
  |  |  |  |   19|      2|# define EDDSA_448_PUBLIC_BYTES 57
  |  |  ------------------
  ------------------
   55|      2|}

gf_serialize:
   22|      8|{
   23|      8|    unsigned int j = 0, fill = 0;
   24|      8|    dword_t buffer = 0;
   25|      8|    int i;
   26|      8|    gf red;
   27|       |
   28|      8|    gf_copy(red, x);
   29|      8|    gf_strong_reduce(red);
   30|      8|    if (!with_hibit)
  ------------------
  |  Branch (30:9): [True: 0, False: 8]
  ------------------
   31|      0|        assert(gf_hibit(red) == 0);
   32|       |
   33|    456|    for (i = 0; i < (with_hibit ? X_SER_BYTES : SER_BYTES); i++) {
  ------------------
  |  |   22|    456|# define X_SER_BYTES 56
  ------------------
                  for (i = 0; i < (with_hibit ? X_SER_BYTES : SER_BYTES); i++) {
  ------------------
  |  |   23|      0|# define SER_BYTES 56
  ------------------
  |  Branch (33:17): [True: 448, False: 8]
  |  Branch (33:22): [True: 456, False: 0]
  ------------------
   34|    448|        if (fill < 8 && j < NLIMBS) {
  ------------------
  |  |   21|     64|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (34:13): [True: 64, False: 384]
  |  Branch (34:25): [True: 64, False: 0]
  ------------------
   35|     64|            buffer |= ((dword_t) red->limb[LIMBPERM(j)]) << fill;
  ------------------
  |  |   70|     64|# define LIMBPERM(i) (i)
  ------------------
   36|     64|            fill += LIMB_PLACE_VALUE(LIMBPERM(j));
  ------------------
  |  |   19|     64|# define LIMB_PLACE_VALUE(i) 56
  ------------------
   37|     64|            j++;
   38|     64|        }
   39|    448|        serial[i] = (uint8_t)buffer;
   40|    448|        fill -= 8;
   41|    448|        buffer >>= 8;
   42|    448|    }
   43|      8|}
gf_lobit:
   57|      2|{
   58|      2|    gf y;
   59|       |
   60|      2|    gf_copy(y, x);
   61|      2|    gf_strong_reduce(y);
   62|      2|    return 0 - (y->limb[0] & 1);
   63|      2|}
gf_strong_reduce:
  101|     18|{
  102|     18|    dsword_t scarry;
  103|     18|    word_t scarry_0;
  104|     18|    dword_t carry = 0;
  105|     18|    unsigned int i;
  106|       |
  107|       |    /* first, clear high */
  108|     18|    gf_weak_reduce(a);          /* Determined to have negligible perf impact. */
  109|       |
  110|       |    /* now the total is less than 2p */
  111|       |
  112|       |    /* compute total_value - p.  No need to reduce mod p. */
  113|     18|    scarry = 0;
  114|    162|    for (i = 0; i < NLIMBS; i++) {
  ------------------
  |  |   21|    162|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (114:17): [True: 144, False: 18]
  ------------------
  115|    144|        scarry = scarry + a->limb[LIMBPERM(i)] - MODULUS->limb[LIMBPERM(i)];
  ------------------
  |  |   70|    144|# define LIMBPERM(i) (i)
  ------------------
                      scarry = scarry + a->limb[LIMBPERM(i)] - MODULUS->limb[LIMBPERM(i)];
  ------------------
  |  |   70|    144|# define LIMBPERM(i) (i)
  ------------------
  116|    144|        a->limb[LIMBPERM(i)] = scarry & LIMB_MASK(LIMBPERM(i));
  ------------------
  |  |   70|    144|# define LIMBPERM(i) (i)
  ------------------
                      a->limb[LIMBPERM(i)] = scarry & LIMB_MASK(LIMBPERM(i));
  ------------------
  |  |   76|    144|#  define LIMB_MASK(i) (((1ULL)<<LIMB_PLACE_VALUE(i))-1)
  |  |  ------------------
  |  |  |  |   19|    144|# define LIMB_PLACE_VALUE(i) 56
  |  |  ------------------
  ------------------
  117|    144|        scarry >>= LIMB_PLACE_VALUE(LIMBPERM(i));
  ------------------
  |  |   19|    144|# define LIMB_PLACE_VALUE(i) 56
  ------------------
  118|    144|    }
  119|       |
  120|       |    /*
  121|       |     * uncommon case: it was >= p, so now scarry = 0 and this = x common case:
  122|       |     * it was < p, so now scarry = -1 and this = x - p + 2^255 so let's add
  123|       |     * back in p.  will carry back off the top for 2^255.
  124|       |     */
  125|     18|    assert(scarry == 0 || scarry == -1);
  126|       |
  127|     18|    scarry_0 = (word_t)scarry;
  128|       |
  129|       |    /* add it back */
  130|    162|    for (i = 0; i < NLIMBS; i++) {
  ------------------
  |  |   21|    162|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (130:17): [True: 144, False: 18]
  ------------------
  131|    144|        carry =
  132|    144|            carry + a->limb[LIMBPERM(i)] +
  ------------------
  |  |   70|    144|# define LIMBPERM(i) (i)
  ------------------
  133|    144|            (scarry_0 & MODULUS->limb[LIMBPERM(i)]);
  ------------------
  |  |   70|    144|# define LIMBPERM(i) (i)
  ------------------
  134|    144|        a->limb[LIMBPERM(i)] = carry & LIMB_MASK(LIMBPERM(i));
  ------------------
  |  |   70|    144|# define LIMBPERM(i) (i)
  ------------------
                      a->limb[LIMBPERM(i)] = carry & LIMB_MASK(LIMBPERM(i));
  ------------------
  |  |   76|    144|#  define LIMB_MASK(i) (((1ULL)<<LIMB_PLACE_VALUE(i))-1)
  |  |  ------------------
  |  |  |  |   19|    144|# define LIMB_PLACE_VALUE(i) 56
  |  |  ------------------
  ------------------
  135|    144|        carry >>= LIMB_PLACE_VALUE(LIMBPERM(i));
  ------------------
  |  |   19|    144|# define LIMB_PLACE_VALUE(i) 56
  ------------------
  136|    144|    }
  137|       |
  138|     18|    assert(carry < 2 && ((word_t)carry + scarry_0) == 0);
  139|     18|}
gf_sub:
  143|    742|{
  144|    742|    gf_sub_RAW(d, a, b);
  145|    742|    gf_bias(d, 2);
  146|    742|    gf_weak_reduce(d);
  147|    742|}
gf_add:
  151|     14|{
  152|     14|    gf_add_RAW(d, a, b);
  153|     14|    gf_weak_reduce(d);
  154|     14|}
gf_eq:
  158|      8|{
  159|      8|    gf c;
  160|      8|    mask_t ret = 0;
  161|      8|    unsigned int i;
  162|       |
  163|      8|    gf_sub(c, a, b);
  164|      8|    gf_strong_reduce(c);
  165|       |
  166|     72|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |   21|     72|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (166:17): [True: 64, False: 8]
  ------------------
  167|     64|        ret |= c->limb[LIMBPERM(i)];
  ------------------
  |  |   70|     64|# define LIMBPERM(i) (i)
  ------------------
  168|       |
  169|      8|    return word_is_zero(ret);
  ------------------
  |  |   20|      8|# define word_is_zero(a)     constant_time_is_zero_64(a)
  ------------------
  170|      8|}
gf_isr:
  173|      8|{
  174|      8|    gf L0, L1, L2;
  175|       |
  176|      8|    ossl_gf_sqr(L1, x);
  177|      8|    ossl_gf_mul(L2, x, L1);
  178|      8|    ossl_gf_sqr(L1, L2);
  179|      8|    ossl_gf_mul(L2, x, L1);
  180|      8|    gf_sqrn(L1, L2, 3);
  181|      8|    ossl_gf_mul(L0, L2, L1);
  182|      8|    gf_sqrn(L1, L0, 3);
  183|      8|    ossl_gf_mul(L0, L2, L1);
  184|      8|    gf_sqrn(L2, L0, 9);
  185|      8|    ossl_gf_mul(L1, L0, L2);
  186|      8|    ossl_gf_sqr(L0, L1);
  187|      8|    ossl_gf_mul(L2, x, L0);
  188|      8|    gf_sqrn(L0, L2, 18);
  189|      8|    ossl_gf_mul(L2, L1, L0);
  190|      8|    gf_sqrn(L0, L2, 37);
  191|      8|    ossl_gf_mul(L1, L2, L0);
  192|      8|    gf_sqrn(L0, L1, 37);
  193|      8|    ossl_gf_mul(L1, L2, L0);
  194|      8|    gf_sqrn(L0, L1, 111);
  195|      8|    ossl_gf_mul(L2, L1, L0);
  196|      8|    ossl_gf_sqr(L0, L2);
  197|      8|    ossl_gf_mul(L1, x, L0);
  198|      8|    gf_sqrn(L0, L1, 223);
  199|      8|    ossl_gf_mul(L1, L2, L0);
  200|      8|    ossl_gf_sqr(L2, L1);
  201|      8|    ossl_gf_mul(L0, L2, x);
  202|      8|    gf_copy(a, L1);
  203|      8|    return gf_eq(L0, ONE);
  204|      8|}

curve448.c:gf_subx_nr:
  114|    272|{
  115|    272|    gf_sub_RAW(c, a, b);
  116|    272|    gf_bias(c, amt);
  117|    272|    if (GF_HEADROOM < amt + 1)
  ------------------
  |  |   16|    272|# define GF_HEADROOM 9999        /* Everything is reduced anyway */
  ------------------
  |  Branch (117:9): [True: 0, False: 272]
  ------------------
  118|      0|        gf_weak_reduce(c);
  119|    272|}
curve448.c:gf_cond_neg:
  151|    720|{
  152|    720|    gf y;
  153|       |
  154|    720|    gf_sub(y, ZERO, x);
  155|    720|    gf_cond_sel(x, x, y, neg);
  156|    720|}
curve448.c:gf_cond_sel:
  134|    720|{
  135|    720|    size_t i;
  136|       |
  137|  6.48k|    for (i = 0; i < NLIMBS; i++) {
  ------------------
  |  |   21|  6.48k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (137:17): [True: 5.76k, False: 720]
  ------------------
  138|       |#if ARCH_WORD_BITS == 32
  139|       |        x[0].limb[i] = constant_time_select_32(is_z, z[0].limb[i],
  140|       |                                               y[0].limb[i]);
  141|       |#else
  142|       |        /* Must be 64 bit */
  143|  5.76k|        x[0].limb[i] = constant_time_select_64(is_z, z[0].limb[i],
  144|  5.76k|                                               y[0].limb[i]);
  145|  5.76k|#endif
  146|  5.76k|    }
  147|    720|}
curve448.c:gf_copy:
   45|     16|{
   46|     16|    *out = *a;
   47|     16|}
curve448.c:gf_cond_swap:
  160|    720|{
  161|    720|    size_t i;
  162|       |
  163|  6.48k|    for (i = 0; i < NLIMBS; i++) {
  ------------------
  |  |   21|  6.48k|# define NLIMBS (64/sizeof(word_t))
  ------------------
  |  Branch (163:17): [True: 5.76k, False: 720]
  ------------------
  164|       |#if ARCH_WORD_BITS == 32
  165|       |        constant_time_cond_swap_32(swap, &(x[0].limb[i]), &(y->limb[i]));
  166|       |#else
  167|       |        /* Must be 64 bit */
  168|  5.76k|        constant_time_cond_swap_64(swap, &(x[0].limb[i]), &(y->limb[i]));
  169|  5.76k|#endif
  170|  5.76k|    }
  171|    720|}
curve448.c:gf_sub_nr:
  105|  2.27k|{
  106|  2.27k|    gf_sub_RAW(c, a, b);
  107|  2.27k|    gf_bias(c, 2);
  108|  2.27k|    if (GF_HEADROOM < 3)
  ------------------
  |  |   16|  2.27k|# define GF_HEADROOM 9999        /* Everything is reduced anyway */
  ------------------
  |  Branch (108:9): [Folded - Ignored]
  ------------------
  109|      0|        gf_weak_reduce(c);
  110|  2.27k|}
f_generic.c:gf_copy:
   45|     18|{
   46|     18|    *out = *a;
   47|     18|}
f_generic.c:gf_sqrn:
   83|     64|{
   84|     64|    gf tmp;
   85|       |
   86|     64|    assert(n > 0);
   87|     64|    if (n & 1) {
  ------------------
  |  Branch (87:9): [True: 56, False: 8]
  ------------------
   88|     56|        ossl_gf_sqr(y, x);
   89|     56|        n--;
   90|     56|    } else {
   91|      8|        ossl_gf_sqr(tmp, x);
   92|      8|        ossl_gf_sqr(y, tmp);
   93|      8|        n -= 2;
   94|      8|    }
   95|  1.79k|    for (; n; n -= 2) {
  ------------------
  |  Branch (95:12): [True: 1.72k, False: 64]
  ------------------
   96|  1.72k|        ossl_gf_sqr(tmp, y);
   97|  1.72k|        ossl_gf_sqr(y, tmp);
   98|  1.72k|    }
   99|     64|}

curve448.c:curve448_point_copy:
  183|      8|{
  184|      8|    *a = *b;
  185|      8|}
scalar.c:curve448_scalar_copy:
  170|      2|{
  171|      2|    *out = *a;
  172|      2|}

ossl_curve448_scalar_mul:
  111|      8|{
  112|      8|    sc_montmul(out, a, b);
  113|      8|    sc_montmul(out, out, sc_r2);
  114|      8|}
ossl_curve448_scalar_add:
  126|     10|{
  127|     10|    c448_dword_t chain = 0;
  128|     10|    unsigned int i;
  129|       |
  130|     80|    for (i = 0; i < C448_SCALAR_LIMBS; i++) {
  ------------------
  |  |   38|     80|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|     80|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (130:17): [True: 70, False: 10]
  ------------------
  131|     70|        chain = (chain + a->limb[i]) + b->limb[i];
  132|     70|        out->limb[i] = (c448_word_t)chain;
  133|     70|        chain >>= WBITS;
  ------------------
  |  |   39|     70|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|     70|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  134|     70|    }
  135|     10|    sc_subx(out, out->limb, sc_p, sc_p, (c448_word_t)chain);
  136|     10|}
ossl_curve448_scalar_decode:
  156|      2|{
  157|      2|    unsigned int i;
  158|      2|    c448_dsword_t accum = 0;
  159|       |
  160|      2|    scalar_decode_short(s, ser, C448_SCALAR_BYTES);
  ------------------
  |  |   44|      2|# define C448_SCALAR_BYTES 56
  ------------------
  161|     16|    for (i = 0; i < C448_SCALAR_LIMBS; i++)
  ------------------
  |  |   38|     16|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|     16|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (161:17): [True: 14, False: 2]
  ------------------
  162|     14|        accum = (accum + s->limb[i] - sc_p->limb[i]) >> WBITS;
  ------------------
  |  |   39|     14|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|     14|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  163|       |    /* Here accum == 0 or -1 */
  164|       |
  165|      2|    ossl_curve448_scalar_mul(s, s, ossl_curve448_scalar_one); /* ham-handed reduce */
  166|       |
  167|      2|    return c448_succeed_if(~word_is_zero((uint32_t)accum));
  ------------------
  |  |   20|      2|# define word_is_zero(a)     constant_time_is_zero_64(a)
  ------------------
  168|      2|}
ossl_curve448_scalar_destroy:
  171|     12|{
  172|     12|    OPENSSL_cleanse(scalar, sizeof(curve448_scalar_t));
  173|     12|}
ossl_curve448_scalar_decode_long:
  178|      8|{
  179|      8|    size_t i;
  180|      8|    curve448_scalar_t t1, t2;
  181|       |
  182|      8|    if (ser_len == 0) {
  ------------------
  |  Branch (182:9): [True: 0, False: 8]
  ------------------
  183|      0|        curve448_scalar_copy(s, ossl_curve448_scalar_zero);
  184|      0|        return;
  185|      0|    }
  186|       |
  187|      8|    i = ser_len - (ser_len % C448_SCALAR_BYTES);
  ------------------
  |  |   44|      8|# define C448_SCALAR_BYTES 56
  ------------------
  188|      8|    if (i == ser_len)
  ------------------
  |  Branch (188:9): [True: 6, False: 2]
  ------------------
  189|      6|        i -= C448_SCALAR_BYTES;
  ------------------
  |  |   44|      6|# define C448_SCALAR_BYTES 56
  ------------------
  190|       |
  191|      8|    scalar_decode_short(t1, &ser[i], ser_len - i);
  192|       |
  193|      8|    if (ser_len == sizeof(curve448_scalar_t)) {
  ------------------
  |  Branch (193:9): [True: 6, False: 2]
  ------------------
  194|      6|        assert(i == 0);
  195|       |        /* ham-handed reduce */
  196|      6|        ossl_curve448_scalar_mul(s, t1, ossl_curve448_scalar_one);
  197|      6|        ossl_curve448_scalar_destroy(t1);
  198|      6|        return;
  199|      6|    }
  200|       |
  201|      4|    while (i) {
  ------------------
  |  Branch (201:12): [True: 2, False: 2]
  ------------------
  202|      2|        i -= C448_SCALAR_BYTES;
  ------------------
  |  |   44|      2|# define C448_SCALAR_BYTES 56
  ------------------
  203|      2|        sc_montmul(t1, t1, sc_r2);
  204|      2|        (void)ossl_curve448_scalar_decode(t2, ser + i);
  205|      2|        ossl_curve448_scalar_add(t1, t1, t2);
  206|      2|    }
  207|       |
  208|      2|    curve448_scalar_copy(s, t1);
  209|      2|    ossl_curve448_scalar_destroy(t1);
  210|      2|    ossl_curve448_scalar_destroy(t2);
  211|      2|}
ossl_curve448_scalar_halve:
  227|     18|{
  228|     18|    c448_word_t mask = 0 - (a->limb[0] & 1);
  229|     18|    c448_dword_t chain = 0;
  230|     18|    unsigned int i;
  231|       |
  232|    144|    for (i = 0; i < C448_SCALAR_LIMBS; i++) {
  ------------------
  |  |   38|    144|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|    144|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (232:17): [True: 126, False: 18]
  ------------------
  233|    126|        chain = (chain + a->limb[i]) + (sc_p->limb[i] & mask);
  234|    126|        out->limb[i] = (c448_word_t)chain;
  235|    126|        chain >>= C448_WORD_BITS;
  ------------------
  |  |   32|    126|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  ------------------
  236|    126|    }
  237|    126|    for (i = 0; i < C448_SCALAR_LIMBS - 1; i++)
  ------------------
  |  |   38|    126|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|    126|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (237:17): [True: 108, False: 18]
  ------------------
  238|    108|        out->limb[i] = out->limb[i] >> 1 | out->limb[i + 1] << (WBITS - 1);
  ------------------
  |  |   39|    108|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|    108|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  239|     18|    out->limb[i] = out->limb[i] >> 1 | (c448_word_t)(chain << (WBITS - 1));
  ------------------
  |  |   39|     18|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|     18|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  240|     18|}
scalar.c:sc_montmul:
   74|     18|{
   75|     18|    unsigned int i, j;
   76|     18|    c448_word_t accum[C448_SCALAR_LIMBS + 1] = { 0 };
   77|     18|    c448_word_t hi_carry = 0;
   78|       |
   79|    144|    for (i = 0; i < C448_SCALAR_LIMBS; i++) {
  ------------------
  |  |   38|    144|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|    144|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (79:17): [True: 126, False: 18]
  ------------------
   80|    126|        c448_word_t mand = a->limb[i];
   81|    126|        const c448_word_t *mier = b->limb;
   82|       |
   83|    126|        c448_dword_t chain = 0;
   84|  1.00k|        for (j = 0; j < C448_SCALAR_LIMBS; j++) {
  ------------------
  |  |   38|  1.00k|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|  1.00k|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (84:21): [True: 882, False: 126]
  ------------------
   85|    882|            chain += ((c448_dword_t) mand) * mier[j] + accum[j];
   86|    882|            accum[j] = (c448_word_t)chain;
   87|    882|            chain >>= WBITS;
  ------------------
  |  |   39|    882|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|    882|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
   88|    882|        }
   89|    126|        accum[j] = (c448_word_t)chain;
   90|       |
   91|    126|        mand = accum[0] * MONTGOMERY_FACTOR;
   92|    126|        chain = 0;
   93|    126|        mier = sc_p->limb;
   94|  1.00k|        for (j = 0; j < C448_SCALAR_LIMBS; j++) {
  ------------------
  |  |   38|  1.00k|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|  1.00k|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (94:21): [True: 882, False: 126]
  ------------------
   95|    882|            chain += (c448_dword_t) mand *mier[j] + accum[j];
   96|    882|            if (j)
  ------------------
  |  Branch (96:17): [True: 756, False: 126]
  ------------------
   97|    756|                accum[j - 1] = (c448_word_t)chain;
   98|    882|            chain >>= WBITS;
  ------------------
  |  |   39|    882|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|    882|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
   99|    882|        }
  100|    126|        chain += accum[j];
  101|    126|        chain += hi_carry;
  102|    126|        accum[j - 1] = (c448_word_t)chain;
  103|    126|        hi_carry = chain >> WBITS;
  ------------------
  |  |   39|    126|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|    126|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  104|    126|    }
  105|       |
  106|     18|    sc_subx(out, accum, sc_p, sc_p, hi_carry);
  107|     18|}
scalar.c:sc_subx:
   52|     28|{
   53|     28|    c448_dsword_t chain = 0;
   54|     28|    unsigned int i;
   55|     28|    c448_word_t borrow;
   56|       |
   57|    224|    for (i = 0; i < C448_SCALAR_LIMBS; i++) {
  ------------------
  |  |   38|    224|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|    224|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (57:17): [True: 196, False: 28]
  ------------------
   58|    196|        chain = (chain + accum[i]) - sub->limb[i];
   59|    196|        out->limb[i] = (c448_word_t)chain;
   60|    196|        chain >>= WBITS;
  ------------------
  |  |   39|    196|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|    196|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
   61|    196|    }
   62|     28|    borrow = (c448_word_t)chain + extra;     /* = 0 or -1 */
   63|       |
   64|     28|    chain = 0;
   65|    224|    for (i = 0; i < C448_SCALAR_LIMBS; i++) {
  ------------------
  |  |   38|    224|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|    224|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (65:17): [True: 196, False: 28]
  ------------------
   66|    196|        chain = (chain + out->limb[i]) + (p->limb[i] & borrow);
   67|    196|        out->limb[i] = (c448_word_t)chain;
   68|    196|        chain >>= WBITS;
  ------------------
  |  |   39|    196|#define WBITS C448_WORD_BITS   /* NB this may be different from ARCH_WORD_BITS */
  |  |  ------------------
  |  |  |  |   32|    196|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
   69|    196|    }
   70|     28|}
scalar.c:scalar_decode_short:
  141|     10|{
  142|     10|    size_t i, j, k = 0;
  143|       |
  144|     80|    for (i = 0; i < C448_SCALAR_LIMBS; i++) {
  ------------------
  |  |   38|     80|# define C448_SCALAR_LIMBS ((446-1)/C448_WORD_BITS+1)
  |  |  ------------------
  |  |  |  |   32|     80|#   define C448_WORD_BITS 64      /* The number of bits in a word */
  |  |  ------------------
  ------------------
  |  Branch (144:17): [True: 70, False: 10]
  ------------------
  145|     70|        c448_word_t out = 0;
  146|       |
  147|    520|        for (j = 0; j < sizeof(c448_word_t) && k < nbytes; j++, k++)
  ------------------
  |  Branch (147:21): [True: 464, False: 56]
  |  Branch (147:48): [True: 450, False: 14]
  ------------------
  148|    450|            out |= ((c448_word_t) ser[k]) << (8 * j);
  149|     70|        s->limb[i] = out;
  150|     70|    }
  151|     10|}

ossl_ec_GF2m_simple_set_compressed_coordinates:
   43|  6.54k|{
   44|  6.54k|    BIGNUM *tmp, *x, *y, *z;
   45|  6.54k|    int ret = 0, z0;
   46|  6.54k|#ifndef FIPS_MODULE
   47|  6.54k|    BN_CTX *new_ctx = NULL;
   48|       |
   49|  6.54k|    if (ctx == NULL) {
  ------------------
  |  Branch (49:9): [True: 0, False: 6.54k]
  ------------------
   50|      0|        ctx = new_ctx = BN_CTX_new();
   51|      0|        if (ctx == NULL)
  ------------------
  |  Branch (51:13): [True: 0, False: 0]
  ------------------
   52|      0|            return 0;
   53|      0|    }
   54|  6.54k|#endif
   55|       |
   56|  6.54k|    y_bit = (y_bit != 0) ? 1 : 0;
  ------------------
  |  Branch (56:13): [True: 5.29k, False: 1.25k]
  ------------------
   57|       |
   58|  6.54k|    BN_CTX_start(ctx);
   59|  6.54k|    tmp = BN_CTX_get(ctx);
   60|  6.54k|    x = BN_CTX_get(ctx);
   61|  6.54k|    y = BN_CTX_get(ctx);
   62|  6.54k|    z = BN_CTX_get(ctx);
   63|  6.54k|    if (z == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 6.54k]
  ------------------
   64|      0|        goto err;
   65|       |
   66|  6.54k|    if (!BN_GF2m_mod_arr(x, x_, group->poly))
  ------------------
  |  Branch (66:9): [True: 0, False: 6.54k]
  ------------------
   67|      0|        goto err;
   68|  6.54k|    if (BN_is_zero(x)) {
  ------------------
  |  Branch (68:9): [True: 427, False: 6.11k]
  ------------------
   69|    427|        if (!BN_GF2m_mod_sqrt_arr(y, group->b, group->poly, ctx))
  ------------------
  |  Branch (69:13): [True: 0, False: 427]
  ------------------
   70|      0|            goto err;
   71|  6.11k|    } else {
   72|  6.11k|        if (!group->meth->field_sqr(group, tmp, x, ctx))
  ------------------
  |  Branch (72:13): [True: 0, False: 6.11k]
  ------------------
   73|      0|            goto err;
   74|  6.11k|        if (!group->meth->field_div(group, tmp, group->b, tmp, ctx))
  ------------------
  |  Branch (74:13): [True: 0, False: 6.11k]
  ------------------
   75|      0|            goto err;
   76|  6.11k|        if (!BN_GF2m_add(tmp, group->a, tmp))
  ------------------
  |  Branch (76:13): [True: 0, False: 6.11k]
  ------------------
   77|      0|            goto err;
   78|  6.11k|        if (!BN_GF2m_add(tmp, x, tmp))
  ------------------
  |  Branch (78:13): [True: 0, False: 6.11k]
  ------------------
   79|      0|            goto err;
   80|  6.11k|        ERR_set_mark();
   81|  6.11k|        if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx)) {
  ------------------
  |  Branch (81:13): [True: 1.76k, False: 4.34k]
  ------------------
   82|  1.76k|#ifndef FIPS_MODULE
   83|  1.76k|            unsigned long err = ERR_peek_last_error();
   84|       |
   85|  1.76k|            if (ERR_GET_LIB(err) == ERR_LIB_BN
  ------------------
  |  |   73|  3.53k|# define ERR_LIB_BN              3
  ------------------
  |  Branch (85:17): [True: 1.76k, False: 0]
  ------------------
   86|  1.76k|                && ERR_GET_REASON(err) == BN_R_NO_SOLUTION) {
  ------------------
  |  |   40|  1.76k|# define BN_R_NO_SOLUTION                                 116
  ------------------
  |  Branch (86:20): [True: 928, False: 841]
  ------------------
   87|    928|                ERR_pop_to_mark();
   88|    928|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT);
  ------------------
  |  |  401|    928|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    928|    (ERR_new(),                                                 \
  |  |  |  |  404|    928|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    928|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    928|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    928|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    928|     ERR_set_error)
  |  |  ------------------
  ------------------
   89|    928|            } else
   90|    841|#endif
   91|    841|            {
   92|    841|                ERR_clear_last_mark();
   93|    841|                ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|    841|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    841|    (ERR_new(),                                                 \
  |  |  |  |  404|    841|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    841|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    841|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    841|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    841|     ERR_set_error)
  |  |  ------------------
  ------------------
   94|    841|            }
   95|  1.76k|            goto err;
   96|  1.76k|        }
   97|  4.34k|        ERR_clear_last_mark();
   98|  4.34k|        z0 = (BN_is_odd(z)) ? 1 : 0;
  ------------------
  |  Branch (98:14): [True: 439, False: 3.90k]
  ------------------
   99|  4.34k|        if (!group->meth->field_mul(group, y, x, z, ctx))
  ------------------
  |  Branch (99:13): [True: 0, False: 4.34k]
  ------------------
  100|      0|            goto err;
  101|  4.34k|        if (z0 != y_bit) {
  ------------------
  |  Branch (101:13): [True: 3.49k, False: 852]
  ------------------
  102|  3.49k|            if (!BN_GF2m_add(y, y, x))
  ------------------
  |  Branch (102:17): [True: 0, False: 3.49k]
  ------------------
  103|      0|                goto err;
  104|  3.49k|        }
  105|  4.34k|    }
  106|       |
  107|  4.77k|    if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (107:9): [True: 0, False: 4.77k]
  ------------------
  108|      0|        goto err;
  109|       |
  110|  4.77k|    ret = 1;
  111|       |
  112|  6.54k| err:
  113|  6.54k|    BN_CTX_end(ctx);
  114|  6.54k|#ifndef FIPS_MODULE
  115|  6.54k|    BN_CTX_free(new_ctx);
  116|  6.54k|#endif
  117|  6.54k|    return ret;
  118|  4.77k|}
ossl_ec_GF2m_simple_point2oct:
  129|    609|{
  130|    609|    size_t ret;
  131|    609|    int used_ctx = 0;
  132|    609|    BIGNUM *x, *y, *yxi;
  133|    609|    size_t field_len, i, skip;
  134|    609|#ifndef FIPS_MODULE
  135|    609|    BN_CTX *new_ctx = NULL;
  136|    609|#endif
  137|       |
  138|    609|    if ((form != POINT_CONVERSION_COMPRESSED)
  ------------------
  |  Branch (138:9): [True: 609, False: 0]
  ------------------
  139|    609|        && (form != POINT_CONVERSION_UNCOMPRESSED)
  ------------------
  |  Branch (139:12): [True: 5, False: 604]
  ------------------
  140|    609|        && (form != POINT_CONVERSION_HYBRID)) {
  ------------------
  |  Branch (140:12): [True: 5, False: 0]
  ------------------
  141|      5|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FORM);
  ------------------
  |  |  401|      5|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      5|    (ERR_new(),                                                 \
  |  |  |  |  404|      5|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      5|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      5|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      5|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      5|     ERR_set_error)
  |  |  ------------------
  ------------------
  142|      5|        goto err;
  143|      5|    }
  144|       |
  145|    604|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (145:9): [True: 80, False: 524]
  ------------------
  146|       |        /* encodes to a single 0 octet */
  147|     80|        if (buf != NULL) {
  ------------------
  |  Branch (147:13): [True: 40, False: 40]
  ------------------
  148|     40|            if (len < 1) {
  ------------------
  |  Branch (148:17): [True: 0, False: 40]
  ------------------
  149|      0|                ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  150|      0|                return 0;
  151|      0|            }
  152|     40|            buf[0] = 0;
  153|     40|        }
  154|     80|        return 1;
  155|     80|    }
  156|       |
  157|       |    /* ret := required output buffer length */
  158|    524|    field_len = (EC_GROUP_get_degree(group) + 7) / 8;
  159|    524|    ret =
  160|    524|        (form ==
  ------------------
  |  Branch (160:9): [True: 0, False: 524]
  ------------------
  161|    524|         POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
  162|       |
  163|       |    /* if 'buf' is NULL, just return required length */
  164|    524|    if (buf != NULL) {
  ------------------
  |  Branch (164:9): [True: 262, False: 262]
  ------------------
  165|    262|        if (len < ret) {
  ------------------
  |  Branch (165:13): [True: 0, False: 262]
  ------------------
  166|      0|            ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  167|      0|            goto err;
  168|      0|        }
  169|       |
  170|    262|#ifndef FIPS_MODULE
  171|    262|        if (ctx == NULL) {
  ------------------
  |  Branch (171:13): [True: 262, False: 0]
  ------------------
  172|    262|            ctx = new_ctx = BN_CTX_new();
  173|    262|            if (ctx == NULL)
  ------------------
  |  Branch (173:17): [True: 0, False: 262]
  ------------------
  174|      0|                return 0;
  175|    262|        }
  176|    262|#endif
  177|       |
  178|    262|        BN_CTX_start(ctx);
  179|    262|        used_ctx = 1;
  180|    262|        x = BN_CTX_get(ctx);
  181|    262|        y = BN_CTX_get(ctx);
  182|    262|        yxi = BN_CTX_get(ctx);
  183|    262|        if (yxi == NULL)
  ------------------
  |  Branch (183:13): [True: 0, False: 262]
  ------------------
  184|      0|            goto err;
  185|       |
  186|    262|        if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (186:13): [True: 0, False: 262]
  ------------------
  187|      0|            goto err;
  188|       |
  189|    262|        buf[0] = form;
  190|    262|        if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) {
  ------------------
  |  Branch (190:13): [True: 0, False: 262]
  |  Branch (190:56): [True: 0, False: 0]
  ------------------
  191|      0|            if (!group->meth->field_div(group, yxi, y, x, ctx))
  ------------------
  |  Branch (191:17): [True: 0, False: 0]
  ------------------
  192|      0|                goto err;
  193|      0|            if (BN_is_odd(yxi))
  ------------------
  |  Branch (193:17): [True: 0, False: 0]
  ------------------
  194|      0|                buf[0]++;
  195|      0|        }
  196|       |
  197|    262|        i = 1;
  198|       |
  199|    262|        skip = field_len - BN_num_bytes(x);
  ------------------
  |  |  189|    262|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  200|    262|        if (skip > field_len) {
  ------------------
  |  Branch (200:13): [True: 0, False: 262]
  ------------------
  201|      0|            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  202|      0|            goto err;
  203|      0|        }
  204|    338|        while (skip > 0) {
  ------------------
  |  Branch (204:16): [True: 76, False: 262]
  ------------------
  205|     76|            buf[i++] = 0;
  206|     76|            skip--;
  207|     76|        }
  208|    262|        skip = BN_bn2bin(x, buf + i);
  209|    262|        i += skip;
  210|    262|        if (i != 1 + field_len) {
  ------------------
  |  Branch (210:13): [True: 0, False: 262]
  ------------------
  211|      0|            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  212|      0|            goto err;
  213|      0|        }
  214|       |
  215|    262|        if (form == POINT_CONVERSION_UNCOMPRESSED
  ------------------
  |  Branch (215:13): [True: 262, False: 0]
  ------------------
  216|    262|            || form == POINT_CONVERSION_HYBRID) {
  ------------------
  |  Branch (216:16): [True: 0, False: 0]
  ------------------
  217|    262|            skip = field_len - BN_num_bytes(y);
  ------------------
  |  |  189|    262|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  218|    262|            if (skip > field_len) {
  ------------------
  |  Branch (218:17): [True: 0, False: 262]
  ------------------
  219|      0|                ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  220|      0|                goto err;
  221|      0|            }
  222|    343|            while (skip > 0) {
  ------------------
  |  Branch (222:20): [True: 81, False: 262]
  ------------------
  223|     81|                buf[i++] = 0;
  224|     81|                skip--;
  225|     81|            }
  226|    262|            skip = BN_bn2bin(y, buf + i);
  227|    262|            i += skip;
  228|    262|        }
  229|       |
  230|    262|        if (i != ret) {
  ------------------
  |  Branch (230:13): [True: 0, False: 262]
  ------------------
  231|      0|            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  232|      0|            goto err;
  233|      0|        }
  234|    262|    }
  235|       |
  236|    524|    if (used_ctx)
  ------------------
  |  Branch (236:9): [True: 262, False: 262]
  ------------------
  237|    262|        BN_CTX_end(ctx);
  238|    524|#ifndef FIPS_MODULE
  239|    524|    BN_CTX_free(new_ctx);
  240|    524|#endif
  241|    524|    return ret;
  242|       |
  243|      5| err:
  244|      5|    if (used_ctx)
  ------------------
  |  Branch (244:9): [True: 0, False: 5]
  ------------------
  245|      0|        BN_CTX_end(ctx);
  246|      5|#ifndef FIPS_MODULE
  247|      5|    BN_CTX_free(new_ctx);
  248|      5|#endif
  249|      5|    return 0;
  250|    524|}
ossl_ec_GF2m_simple_oct2point:
  259|  9.10k|{
  260|  9.10k|    point_conversion_form_t form;
  261|  9.10k|    int y_bit, m;
  262|  9.10k|    BIGNUM *x, *y, *yxi;
  263|  9.10k|    size_t field_len, enc_len;
  264|  9.10k|    int ret = 0;
  265|  9.10k|#ifndef FIPS_MODULE
  266|  9.10k|    BN_CTX *new_ctx = NULL;
  267|  9.10k|#endif
  268|       |
  269|  9.10k|    if (len == 0) {
  ------------------
  |  Branch (269:9): [True: 33, False: 9.07k]
  ------------------
  270|     33|        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|     33|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     33|    (ERR_new(),                                                 \
  |  |  |  |  404|     33|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     33|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     33|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     33|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     33|     ERR_set_error)
  |  |  ------------------
  ------------------
  271|     33|        return 0;
  272|     33|    }
  273|       |
  274|       |    /*
  275|       |     * The first octet is the point conversion octet PC, see X9.62, page 4
  276|       |     * and section 4.4.2.  It must be:
  277|       |     *     0x00          for the point at infinity
  278|       |     *     0x02 or 0x03  for compressed form
  279|       |     *     0x04          for uncompressed form
  280|       |     *     0x06 or 0x07  for hybrid form.
  281|       |     * For compressed or hybrid forms, we store the last bit of buf[0] as
  282|       |     * y_bit and clear it from buf[0] so as to obtain a POINT_CONVERSION_*.
  283|       |     * We error if buf[0] contains any but the above values.
  284|       |     */
  285|  9.07k|    y_bit = buf[0] & 1;
  286|  9.07k|    form = buf[0] & ~1U;
  287|       |
  288|  9.07k|    if ((form != 0) && (form != POINT_CONVERSION_COMPRESSED)
  ------------------
  |  Branch (288:9): [True: 7.83k, False: 1.24k]
  |  Branch (288:24): [True: 1.16k, False: 6.66k]
  ------------------
  289|  9.07k|        && (form != POINT_CONVERSION_UNCOMPRESSED)
  ------------------
  |  Branch (289:12): [True: 1.09k, False: 67]
  ------------------
  290|  9.07k|        && (form != POINT_CONVERSION_HYBRID)) {
  ------------------
  |  Branch (290:12): [True: 684, False: 413]
  ------------------
  291|    684|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|    684|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    684|    (ERR_new(),                                                 \
  |  |  |  |  404|    684|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    684|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    684|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    684|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    684|     ERR_set_error)
  |  |  ------------------
  ------------------
  292|    684|        return 0;
  293|    684|    }
  294|  8.39k|    if ((form == 0 || form == POINT_CONVERSION_UNCOMPRESSED) && y_bit) {
  ------------------
  |  Branch (294:10): [True: 1.24k, False: 7.14k]
  |  Branch (294:23): [True: 67, False: 7.08k]
  |  Branch (294:65): [True: 55, False: 1.25k]
  ------------------
  295|     55|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     55|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     55|    (ERR_new(),                                                 \
  |  |  |  |  404|     55|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     55|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     55|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     55|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     55|     ERR_set_error)
  |  |  ------------------
  ------------------
  296|     55|        return 0;
  297|     55|    }
  298|       |
  299|       |    /* The point at infinity is represented by a single zero octet. */
  300|  8.33k|    if (form == 0) {
  ------------------
  |  Branch (300:9): [True: 1.19k, False: 7.14k]
  ------------------
  301|  1.19k|        if (len != 1) {
  ------------------
  |  Branch (301:13): [True: 83, False: 1.10k]
  ------------------
  302|     83|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     83|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     83|    (ERR_new(),                                                 \
  |  |  |  |  404|     83|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     83|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     83|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     83|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     83|     ERR_set_error)
  |  |  ------------------
  ------------------
  303|     83|            return 0;
  304|     83|        }
  305|       |
  306|  1.10k|        return EC_POINT_set_to_infinity(group, point);
  307|  1.19k|    }
  308|       |
  309|  7.14k|    m = EC_GROUP_get_degree(group);
  310|  7.14k|    field_len = (m + 7) / 8;
  311|  7.14k|    enc_len =
  312|  7.14k|        (form ==
  ------------------
  |  Branch (312:9): [True: 6.66k, False: 476]
  ------------------
  313|  7.14k|         POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
  314|       |
  315|  7.14k|    if (len != enc_len) {
  ------------------
  |  Branch (315:9): [True: 70, False: 7.07k]
  ------------------
  316|     70|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     70|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     70|    (ERR_new(),                                                 \
  |  |  |  |  404|     70|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     70|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     70|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     70|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     70|     ERR_set_error)
  |  |  ------------------
  ------------------
  317|     70|        return 0;
  318|     70|    }
  319|       |
  320|  7.07k|#ifndef FIPS_MODULE
  321|  7.07k|    if (ctx == NULL) {
  ------------------
  |  Branch (321:9): [True: 7.07k, False: 0]
  ------------------
  322|  7.07k|        ctx = new_ctx = BN_CTX_new();
  323|  7.07k|        if (ctx == NULL)
  ------------------
  |  Branch (323:13): [True: 0, False: 7.07k]
  ------------------
  324|      0|            return 0;
  325|  7.07k|    }
  326|  7.07k|#endif
  327|       |
  328|  7.07k|    BN_CTX_start(ctx);
  329|  7.07k|    x = BN_CTX_get(ctx);
  330|  7.07k|    y = BN_CTX_get(ctx);
  331|  7.07k|    yxi = BN_CTX_get(ctx);
  332|  7.07k|    if (yxi == NULL)
  ------------------
  |  Branch (332:9): [True: 0, False: 7.07k]
  ------------------
  333|      0|        goto err;
  334|       |
  335|  7.07k|    if (!BN_bin2bn(buf + 1, field_len, x))
  ------------------
  |  Branch (335:9): [True: 0, False: 7.07k]
  ------------------
  336|      0|        goto err;
  337|  7.07k|    if (BN_num_bits(x) > m) {
  ------------------
  |  Branch (337:9): [True: 85, False: 6.98k]
  ------------------
  338|     85|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     85|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     85|    (ERR_new(),                                                 \
  |  |  |  |  404|     85|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     85|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     85|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     85|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     85|     ERR_set_error)
  |  |  ------------------
  ------------------
  339|     85|        goto err;
  340|     85|    }
  341|       |
  342|  6.98k|    if (form == POINT_CONVERSION_COMPRESSED) {
  ------------------
  |  Branch (342:9): [True: 6.54k, False: 445]
  ------------------
  343|  6.54k|        if (!EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx))
  ------------------
  |  Branch (343:13): [True: 1.76k, False: 4.77k]
  ------------------
  344|  1.76k|            goto err;
  345|  6.54k|    } else {
  346|    445|        if (!BN_bin2bn(buf + 1 + field_len, field_len, y))
  ------------------
  |  Branch (346:13): [True: 0, False: 445]
  ------------------
  347|      0|            goto err;
  348|    445|        if (BN_num_bits(y) > m) {
  ------------------
  |  Branch (348:13): [True: 18, False: 427]
  ------------------
  349|     18|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     18|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     18|    (ERR_new(),                                                 \
  |  |  |  |  404|     18|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     18|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     18|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     18|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     18|     ERR_set_error)
  |  |  ------------------
  ------------------
  350|     18|            goto err;
  351|     18|        }
  352|    427|        if (form == POINT_CONVERSION_HYBRID) {
  ------------------
  |  Branch (352:13): [True: 369, False: 58]
  ------------------
  353|       |            /*
  354|       |             * Check that the form in the encoding was set correctly
  355|       |             * according to X9.62 4.4.2.a, 4(c), see also first paragraph
  356|       |             * of X9.62, 4.4.1.b.
  357|       |             */
  358|    369|            if (BN_is_zero(x)) {
  ------------------
  |  Branch (358:17): [True: 71, False: 298]
  ------------------
  359|     71|                if (y_bit != 0) {
  ------------------
  |  Branch (359:21): [True: 24, False: 47]
  ------------------
  360|     24|                    ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     24|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     24|    (ERR_new(),                                                 \
  |  |  |  |  404|     24|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     24|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     24|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     24|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     24|     ERR_set_error)
  |  |  ------------------
  ------------------
  361|     24|                    goto err;
  362|     24|                }
  363|    298|            } else {
  364|    298|                if (!group->meth->field_div(group, yxi, y, x, ctx))
  ------------------
  |  Branch (364:21): [True: 0, False: 298]
  ------------------
  365|      0|                    goto err;
  366|    298|                if (y_bit != BN_is_odd(yxi)) {
  ------------------
  |  Branch (366:21): [True: 154, False: 144]
  ------------------
  367|    154|                    ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|    154|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    154|    (ERR_new(),                                                 \
  |  |  |  |  404|    154|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    154|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    154|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    154|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    154|     ERR_set_error)
  |  |  ------------------
  ------------------
  368|    154|                    goto err;
  369|    154|                }
  370|    298|            }
  371|    369|        }
  372|       |
  373|       |        /*
  374|       |         * EC_POINT_set_affine_coordinates is responsible for checking that
  375|       |         * the point is on the curve.
  376|       |         */
  377|    249|        if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (377:13): [True: 248, False: 1]
  ------------------
  378|    248|            goto err;
  379|    249|    }
  380|       |
  381|  4.77k|    ret = 1;
  382|       |
  383|  7.07k| err:
  384|  7.07k|    BN_CTX_end(ctx);
  385|  7.07k|#ifndef FIPS_MODULE
  386|  7.07k|    BN_CTX_free(new_ctx);
  387|  7.07k|#endif
  388|  7.07k|    return ret;
  389|  4.77k|}

ossl_ec_GF2m_simple_group_init:
   29|  18.8k|{
   30|  18.8k|    group->field = BN_new();
   31|  18.8k|    group->a = BN_new();
   32|  18.8k|    group->b = BN_new();
   33|       |
   34|  18.8k|    if (group->field == NULL || group->a == NULL || group->b == NULL) {
  ------------------
  |  Branch (34:9): [True: 0, False: 18.8k]
  |  Branch (34:33): [True: 0, False: 18.8k]
  |  Branch (34:53): [True: 0, False: 18.8k]
  ------------------
   35|      0|        BN_free(group->field);
   36|      0|        BN_free(group->a);
   37|      0|        BN_free(group->b);
   38|      0|        return 0;
   39|      0|    }
   40|  18.8k|    return 1;
   41|  18.8k|}
ossl_ec_GF2m_simple_group_finish:
   48|  18.8k|{
   49|  18.8k|    BN_free(group->field);
   50|  18.8k|    BN_free(group->a);
   51|  18.8k|    BN_free(group->b);
   52|  18.8k|}
ossl_ec_GF2m_simple_group_copy:
   76|  9.09k|{
   77|  9.09k|    if (!BN_copy(dest->field, src->field))
  ------------------
  |  Branch (77:9): [True: 0, False: 9.09k]
  ------------------
   78|      0|        return 0;
   79|  9.09k|    if (!BN_copy(dest->a, src->a))
  ------------------
  |  Branch (79:9): [True: 0, False: 9.09k]
  ------------------
   80|      0|        return 0;
   81|  9.09k|    if (!BN_copy(dest->b, src->b))
  ------------------
  |  Branch (81:9): [True: 0, False: 9.09k]
  ------------------
   82|      0|        return 0;
   83|  9.09k|    dest->poly[0] = src->poly[0];
   84|  9.09k|    dest->poly[1] = src->poly[1];
   85|  9.09k|    dest->poly[2] = src->poly[2];
   86|  9.09k|    dest->poly[3] = src->poly[3];
   87|  9.09k|    dest->poly[4] = src->poly[4];
   88|  9.09k|    dest->poly[5] = src->poly[5];
   89|  9.09k|    if (bn_wexpand(dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) ==
  ------------------
  |  |   54|  9.09k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.09k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  if (bn_wexpand(dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) ==
  ------------------
  |  |   54|  9.09k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.09k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (89:9): [True: 0, False: 9.09k]
  ------------------
   90|  9.09k|        NULL)
   91|      0|        return 0;
   92|  9.09k|    if (bn_wexpand(dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) ==
  ------------------
  |  |   54|  9.09k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.09k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  if (bn_wexpand(dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) ==
  ------------------
  |  |   54|  9.09k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.09k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (92:9): [True: 0, False: 9.09k]
  ------------------
   93|  9.09k|        NULL)
   94|      0|        return 0;
   95|  9.09k|    bn_set_all_zero(dest->a);
   96|  9.09k|    bn_set_all_zero(dest->b);
   97|  9.09k|    return 1;
   98|  9.09k|}
ossl_ec_GF2m_simple_group_set_curve:
  104|  9.70k|{
  105|  9.70k|    int ret = 0, i;
  106|       |
  107|       |    /* group->field */
  108|  9.70k|    if (!BN_copy(group->field, p))
  ------------------
  |  Branch (108:9): [True: 0, False: 9.70k]
  ------------------
  109|      0|        goto err;
  110|  9.70k|    i = BN_GF2m_poly2arr(group->field, group->poly, 6) - 1;
  111|  9.70k|    if ((i != 5) && (i != 3)) {
  ------------------
  |  Branch (111:9): [True: 5.21k, False: 4.49k]
  |  Branch (111:21): [True: 0, False: 5.21k]
  ------------------
  112|      0|        ERR_raise(ERR_LIB_EC, EC_R_UNSUPPORTED_FIELD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  113|      0|        goto err;
  114|      0|    }
  115|       |
  116|       |    /* group->a */
  117|  9.70k|    if (!BN_GF2m_mod_arr(group->a, a, group->poly))
  ------------------
  |  Branch (117:9): [True: 0, False: 9.70k]
  ------------------
  118|      0|        goto err;
  119|  9.70k|    if (bn_wexpand(group->a, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2)
  ------------------
  |  |   54|  9.70k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.70k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  if (bn_wexpand(group->a, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2)
  ------------------
  |  |   54|  9.70k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.70k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (119:9): [True: 0, False: 9.70k]
  ------------------
  120|  9.70k|        == NULL)
  121|      0|        goto err;
  122|  9.70k|    bn_set_all_zero(group->a);
  123|       |
  124|       |    /* group->b */
  125|  9.70k|    if (!BN_GF2m_mod_arr(group->b, b, group->poly))
  ------------------
  |  Branch (125:9): [True: 0, False: 9.70k]
  ------------------
  126|      0|        goto err;
  127|  9.70k|    if (bn_wexpand(group->b, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2)
  ------------------
  |  |   54|  9.70k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.70k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  if (bn_wexpand(group->b, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2)
  ------------------
  |  |   54|  9.70k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  9.70k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (127:9): [True: 0, False: 9.70k]
  ------------------
  128|  9.70k|        == NULL)
  129|      0|        goto err;
  130|  9.70k|    bn_set_all_zero(group->b);
  131|       |
  132|  9.70k|    ret = 1;
  133|  9.70k| err:
  134|  9.70k|    return ret;
  135|  9.70k|}
ossl_ec_GF2m_simple_group_get_degree:
  172|  13.7k|{
  173|  13.7k|    return BN_num_bits(group->field) - 1;
  174|  13.7k|}
ossl_ec_GF2m_simple_point_init:
  223|  39.2k|{
  224|  39.2k|    point->X = BN_new();
  225|  39.2k|    point->Y = BN_new();
  226|  39.2k|    point->Z = BN_new();
  227|       |
  228|  39.2k|    if (point->X == NULL || point->Y == NULL || point->Z == NULL) {
  ------------------
  |  Branch (228:9): [True: 0, False: 39.2k]
  |  Branch (228:29): [True: 0, False: 39.2k]
  |  Branch (228:49): [True: 0, False: 39.2k]
  ------------------
  229|      0|        BN_free(point->X);
  230|      0|        BN_free(point->Y);
  231|      0|        BN_free(point->Z);
  232|      0|        return 0;
  233|      0|    }
  234|  39.2k|    return 1;
  235|  39.2k|}
ossl_ec_GF2m_simple_point_finish:
  239|  38.6k|{
  240|  38.6k|    BN_free(point->X);
  241|  38.6k|    BN_free(point->Y);
  242|  38.6k|    BN_free(point->Z);
  243|  38.6k|}
ossl_ec_GF2m_simple_point_clear_finish:
  247|    541|{
  248|    541|    BN_clear_free(point->X);
  249|    541|    BN_clear_free(point->Y);
  250|    541|    BN_clear_free(point->Z);
  251|    541|    point->Z_is_one = 0;
  252|    541|}
ossl_ec_GF2m_simple_point_copy:
  259|  19.3k|{
  260|  19.3k|    if (!BN_copy(dest->X, src->X))
  ------------------
  |  Branch (260:9): [True: 0, False: 19.3k]
  ------------------
  261|      0|        return 0;
  262|  19.3k|    if (!BN_copy(dest->Y, src->Y))
  ------------------
  |  Branch (262:9): [True: 0, False: 19.3k]
  ------------------
  263|      0|        return 0;
  264|  19.3k|    if (!BN_copy(dest->Z, src->Z))
  ------------------
  |  Branch (264:9): [True: 0, False: 19.3k]
  ------------------
  265|      0|        return 0;
  266|  19.3k|    dest->Z_is_one = src->Z_is_one;
  267|  19.3k|    dest->curve_name = src->curve_name;
  268|       |
  269|  19.3k|    return 1;
  270|  19.3k|}
ossl_ec_GF2m_simple_point_set_to_infinity:
  278|  1.16k|{
  279|  1.16k|    point->Z_is_one = 0;
  280|  1.16k|    BN_zero(point->Z);
  ------------------
  |  |  202|  1.16k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  281|  1.16k|    return 1;
  282|  1.16k|}
ossl_ec_GF2m_simple_point_set_affine_coordinates:
  293|  14.7k|{
  294|  14.7k|    int ret = 0;
  295|  14.7k|    if (x == NULL || y == NULL) {
  ------------------
  |  Branch (295:9): [True: 0, False: 14.7k]
  |  Branch (295:22): [True: 0, False: 14.7k]
  ------------------
  296|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  297|      0|        return 0;
  298|      0|    }
  299|       |
  300|  14.7k|    if (!BN_copy(point->X, x))
  ------------------
  |  Branch (300:9): [True: 0, False: 14.7k]
  ------------------
  301|      0|        goto err;
  302|  14.7k|    BN_set_negative(point->X, 0);
  303|  14.7k|    if (!BN_copy(point->Y, y))
  ------------------
  |  Branch (303:9): [True: 0, False: 14.7k]
  ------------------
  304|      0|        goto err;
  305|  14.7k|    BN_set_negative(point->Y, 0);
  306|  14.7k|    if (!BN_copy(point->Z, BN_value_one()))
  ------------------
  |  Branch (306:9): [True: 0, False: 14.7k]
  ------------------
  307|      0|        goto err;
  308|  14.7k|    BN_set_negative(point->Z, 0);
  309|  14.7k|    point->Z_is_one = 1;
  310|  14.7k|    ret = 1;
  311|       |
  312|  14.7k| err:
  313|  14.7k|    return ret;
  314|  14.7k|}
ossl_ec_GF2m_simple_point_get_affine_coordinates:
  324|    262|{
  325|    262|    int ret = 0;
  326|       |
  327|    262|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (327:9): [True: 0, False: 262]
  ------------------
  328|      0|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  329|      0|        return 0;
  330|      0|    }
  331|       |
  332|    262|    if (BN_cmp(point->Z, BN_value_one())) {
  ------------------
  |  Branch (332:9): [True: 0, False: 262]
  ------------------
  333|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  334|      0|        return 0;
  335|      0|    }
  336|    262|    if (x != NULL) {
  ------------------
  |  Branch (336:9): [True: 262, False: 0]
  ------------------
  337|    262|        if (!BN_copy(x, point->X))
  ------------------
  |  Branch (337:13): [True: 0, False: 262]
  ------------------
  338|      0|            goto err;
  339|    262|        BN_set_negative(x, 0);
  340|    262|    }
  341|    262|    if (y != NULL) {
  ------------------
  |  Branch (341:9): [True: 262, False: 0]
  ------------------
  342|    262|        if (!BN_copy(y, point->Y))
  ------------------
  |  Branch (342:13): [True: 0, False: 262]
  ------------------
  343|      0|            goto err;
  344|    262|        BN_set_negative(y, 0);
  345|    262|    }
  346|    262|    ret = 1;
  347|       |
  348|    262| err:
  349|    262|    return ret;
  350|    262|}
ossl_ec_GF2m_simple_is_at_infinity:
  499|  15.8k|{
  500|  15.8k|    return BN_is_zero(point->Z);
  501|  15.8k|}
ossl_ec_GF2m_simple_is_on_curve:
  510|  14.7k|{
  511|  14.7k|    int ret = -1;
  512|  14.7k|    BIGNUM *lh, *y2;
  513|  14.7k|    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,
  514|  14.7k|                      const BIGNUM *, BN_CTX *);
  515|  14.7k|    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
  516|  14.7k|#ifndef FIPS_MODULE
  517|  14.7k|    BN_CTX *new_ctx = NULL;
  518|  14.7k|#endif
  519|       |
  520|  14.7k|    if (EC_POINT_is_at_infinity(group, point))
  ------------------
  |  Branch (520:9): [True: 0, False: 14.7k]
  ------------------
  521|      0|        return 1;
  522|       |
  523|  14.7k|    field_mul = group->meth->field_mul;
  524|  14.7k|    field_sqr = group->meth->field_sqr;
  525|       |
  526|       |    /* only support affine coordinates */
  527|  14.7k|    if (!point->Z_is_one)
  ------------------
  |  Branch (527:9): [True: 0, False: 14.7k]
  ------------------
  528|      0|        return -1;
  529|       |
  530|  14.7k|#ifndef FIPS_MODULE
  531|  14.7k|    if (ctx == NULL) {
  ------------------
  |  Branch (531:9): [True: 0, False: 14.7k]
  ------------------
  532|      0|        ctx = new_ctx = BN_CTX_new();
  533|      0|        if (ctx == NULL)
  ------------------
  |  Branch (533:13): [True: 0, False: 0]
  ------------------
  534|      0|            return -1;
  535|      0|    }
  536|  14.7k|#endif
  537|       |
  538|  14.7k|    BN_CTX_start(ctx);
  539|  14.7k|    y2 = BN_CTX_get(ctx);
  540|  14.7k|    lh = BN_CTX_get(ctx);
  541|  14.7k|    if (lh == NULL)
  ------------------
  |  Branch (541:9): [True: 0, False: 14.7k]
  ------------------
  542|      0|        goto err;
  543|       |
  544|       |    /*-
  545|       |     * We have a curve defined by a Weierstrass equation
  546|       |     *      y^2 + x*y = x^3 + a*x^2 + b.
  547|       |     *  <=> x^3 + a*x^2 + x*y + b + y^2 = 0
  548|       |     *  <=> ((x + a) * x + y) * x + b + y^2 = 0
  549|       |     */
  550|  14.7k|    if (!BN_GF2m_add(lh, point->X, group->a))
  ------------------
  |  Branch (550:9): [True: 0, False: 14.7k]
  ------------------
  551|      0|        goto err;
  552|  14.7k|    if (!field_mul(group, lh, lh, point->X, ctx))
  ------------------
  |  Branch (552:9): [True: 0, False: 14.7k]
  ------------------
  553|      0|        goto err;
  554|  14.7k|    if (!BN_GF2m_add(lh, lh, point->Y))
  ------------------
  |  Branch (554:9): [True: 0, False: 14.7k]
  ------------------
  555|      0|        goto err;
  556|  14.7k|    if (!field_mul(group, lh, lh, point->X, ctx))
  ------------------
  |  Branch (556:9): [True: 0, False: 14.7k]
  ------------------
  557|      0|        goto err;
  558|  14.7k|    if (!BN_GF2m_add(lh, lh, group->b))
  ------------------
  |  Branch (558:9): [True: 0, False: 14.7k]
  ------------------
  559|      0|        goto err;
  560|  14.7k|    if (!field_sqr(group, y2, point->Y, ctx))
  ------------------
  |  Branch (560:9): [True: 0, False: 14.7k]
  ------------------
  561|      0|        goto err;
  562|  14.7k|    if (!BN_GF2m_add(lh, lh, y2))
  ------------------
  |  Branch (562:9): [True: 0, False: 14.7k]
  ------------------
  563|      0|        goto err;
  564|  14.7k|    ret = BN_is_zero(lh);
  565|       |
  566|  14.7k| err:
  567|  14.7k|    BN_CTX_end(ctx);
  568|  14.7k|#ifndef FIPS_MODULE
  569|  14.7k|    BN_CTX_free(new_ctx);
  570|  14.7k|#endif
  571|  14.7k|    return ret;
  572|  14.7k|}
ossl_ec_GF2m_simple_field_mul:
  697|   684k|{
  698|   684k|    return BN_GF2m_mod_mul_arr(r, a, b, group->poly, ctx);
  699|   684k|}
ossl_ec_GF2m_simple_field_sqr:
  704|   558k|{
  705|   558k|    return BN_GF2m_mod_sqr_arr(r, a, group->poly, ctx);
  706|   558k|}
ossl_ec_GF2m_simple_field_div:
  711|  6.41k|{
  712|  6.41k|    return BN_GF2m_mod_div(r, a, b, group->field, ctx);
  713|  6.41k|}
EC_GF2m_simple_method:
  940|  9.70k|{
  941|  9.70k|    static const EC_METHOD ret = {
  942|  9.70k|        EC_FLAGS_DEFAULT_OCT,
  ------------------
  |  |   26|  9.70k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  943|  9.70k|        NID_X9_62_characteristic_two_field,
  ------------------
  |  |  156|  9.70k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  944|  9.70k|        ossl_ec_GF2m_simple_group_init,
  945|  9.70k|        ossl_ec_GF2m_simple_group_finish,
  946|  9.70k|        ossl_ec_GF2m_simple_group_clear_finish,
  947|  9.70k|        ossl_ec_GF2m_simple_group_copy,
  948|  9.70k|        ossl_ec_GF2m_simple_group_set_curve,
  949|  9.70k|        ossl_ec_GF2m_simple_group_get_curve,
  950|  9.70k|        ossl_ec_GF2m_simple_group_get_degree,
  951|  9.70k|        ossl_ec_group_simple_order_bits,
  952|  9.70k|        ossl_ec_GF2m_simple_group_check_discriminant,
  953|  9.70k|        ossl_ec_GF2m_simple_point_init,
  954|  9.70k|        ossl_ec_GF2m_simple_point_finish,
  955|  9.70k|        ossl_ec_GF2m_simple_point_clear_finish,
  956|  9.70k|        ossl_ec_GF2m_simple_point_copy,
  957|  9.70k|        ossl_ec_GF2m_simple_point_set_to_infinity,
  958|  9.70k|        ossl_ec_GF2m_simple_point_set_affine_coordinates,
  959|  9.70k|        ossl_ec_GF2m_simple_point_get_affine_coordinates,
  960|  9.70k|        0, /* point_set_compressed_coordinates */
  961|  9.70k|        0, /* point2oct */
  962|  9.70k|        0, /* oct2point */
  963|  9.70k|        ossl_ec_GF2m_simple_add,
  964|  9.70k|        ossl_ec_GF2m_simple_dbl,
  965|  9.70k|        ossl_ec_GF2m_simple_invert,
  966|  9.70k|        ossl_ec_GF2m_simple_is_at_infinity,
  967|  9.70k|        ossl_ec_GF2m_simple_is_on_curve,
  968|  9.70k|        ossl_ec_GF2m_simple_cmp,
  969|  9.70k|        ossl_ec_GF2m_simple_make_affine,
  970|  9.70k|        ossl_ec_GF2m_simple_points_make_affine,
  971|  9.70k|        ec_GF2m_simple_points_mul,
  972|  9.70k|        0, /* precompute_mult */
  973|  9.70k|        0, /* have_precompute_mult */
  974|  9.70k|        ossl_ec_GF2m_simple_field_mul,
  975|  9.70k|        ossl_ec_GF2m_simple_field_sqr,
  976|  9.70k|        ossl_ec_GF2m_simple_field_div,
  977|  9.70k|        ec_GF2m_simple_field_inv,
  978|  9.70k|        0, /* field_encode */
  979|  9.70k|        0, /* field_decode */
  980|  9.70k|        0, /* field_set_to_one */
  981|  9.70k|        ossl_ec_key_simple_priv2oct,
  982|  9.70k|        ossl_ec_key_simple_oct2priv,
  983|  9.70k|        0, /* set private */
  984|  9.70k|        ossl_ec_key_simple_generate_key,
  985|  9.70k|        ossl_ec_key_simple_check_key,
  986|  9.70k|        ossl_ec_key_simple_generate_public_key,
  987|  9.70k|        0, /* keycopy */
  988|  9.70k|        0, /* keyfinish */
  989|  9.70k|        ossl_ecdh_simple_compute_key,
  990|  9.70k|        ossl_ecdsa_simple_sign_setup,
  991|  9.70k|        ossl_ecdsa_simple_sign_sig,
  992|  9.70k|        ossl_ecdsa_simple_verify_sig,
  993|  9.70k|        0, /* field_inverse_mod_ord */
  994|  9.70k|        0, /* blind_coordinates */
  995|  9.70k|        ec_GF2m_simple_ladder_pre,
  996|  9.70k|        ec_GF2m_simple_ladder_step,
  997|  9.70k|        ec_GF2m_simple_ladder_post
  998|  9.70k|    };
  999|       |
 1000|  9.70k|    return &ret;
 1001|  9.70k|}
ec2_smpl.c:ec_GF2m_simple_points_mul:
  873|    541|{
  874|    541|    int ret = 0;
  875|    541|    EC_POINT *t = NULL;
  876|       |
  877|       |    /*-
  878|       |     * We limit use of the ladder only to the following cases:
  879|       |     * - r := scalar * G
  880|       |     *   Fixed point mul: scalar != NULL && num == 0;
  881|       |     * - r := scalars[0] * points[0]
  882|       |     *   Variable point mul: scalar == NULL && num == 1;
  883|       |     * - r := scalar * G + scalars[0] * points[0]
  884|       |     *   used, e.g., in ECDSA verification: scalar != NULL && num == 1
  885|       |     *
  886|       |     * In any other case (num > 1) we use the default wNAF implementation.
  887|       |     *
  888|       |     * We also let the default implementation handle degenerate cases like group
  889|       |     * order or cofactor set to 0.
  890|       |     */
  891|    541|    if (num > 1 || BN_is_zero(group->order) || BN_is_zero(group->cofactor))
  ------------------
  |  Branch (891:9): [True: 0, False: 541]
  |  Branch (891:20): [True: 0, False: 541]
  |  Branch (891:48): [True: 0, False: 541]
  ------------------
  892|      0|        return ossl_ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
  893|       |
  894|    541|    if (scalar != NULL && num == 0)
  ------------------
  |  Branch (894:9): [True: 541, False: 0]
  |  Branch (894:27): [True: 541, False: 0]
  ------------------
  895|       |        /* Fixed point multiplication */
  896|    541|        return ossl_ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
  897|       |
  898|      0|    if (scalar == NULL && num == 1)
  ------------------
  |  Branch (898:9): [True: 0, False: 0]
  |  Branch (898:27): [True: 0, False: 0]
  ------------------
  899|       |        /* Variable point multiplication */
  900|      0|        return ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx);
  901|       |
  902|       |    /*-
  903|       |     * Double point multiplication:
  904|       |     *  r := scalar * G + scalars[0] * points[0]
  905|       |     */
  906|       |
  907|      0|    if ((t = EC_POINT_new(group)) == NULL) {
  ------------------
  |  Branch (907:9): [True: 0, False: 0]
  ------------------
  908|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  909|      0|        return 0;
  910|      0|    }
  911|       |
  912|      0|    if (!ossl_ec_scalar_mul_ladder(group, t, scalar, NULL, ctx)
  ------------------
  |  Branch (912:9): [True: 0, False: 0]
  ------------------
  913|      0|        || !ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx)
  ------------------
  |  Branch (913:12): [True: 0, False: 0]
  ------------------
  914|      0|        || !EC_POINT_add(group, r, t, r, ctx))
  ------------------
  |  Branch (914:12): [True: 0, False: 0]
  ------------------
  915|      0|        goto err;
  916|       |
  917|      0|    ret = 1;
  918|       |
  919|      0| err:
  920|      0|    EC_POINT_free(t);
  921|      0|    return ret;
  922|      0|}
ec2_smpl.c:ec_GF2m_simple_field_inv:
  931|    484|{
  932|    484|    int ret;
  933|       |
  934|    484|    if (!(ret = BN_GF2m_mod_inv(r, a, group->field, ctx)))
  ------------------
  |  Branch (934:9): [True: 0, False: 484]
  ------------------
  935|    484|        ERR_raise(ERR_LIB_EC, EC_R_CANNOT_INVERT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  936|    484|    return ret;
  937|    484|}
ec2_smpl.c:ec_GF2m_simple_ladder_pre:
  725|    541|{
  726|       |    /* if p is not affine, something is wrong */
  727|    541|    if (p->Z_is_one == 0)
  ------------------
  |  Branch (727:9): [True: 0, False: 541]
  ------------------
  728|      0|        return 0;
  729|       |
  730|       |    /* s blinding: make sure lambda (s->Z here) is not zero */
  731|    541|    do {
  732|    541|        if (!BN_priv_rand_ex(s->Z, BN_num_bits(group->field) - 1,
  ------------------
  |  Branch (732:13): [True: 0, False: 541]
  ------------------
  733|    541|                             BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx)) {
  ------------------
  |  |   80|    541|#define BN_RAND_TOP_ANY    -1
  ------------------
                                           BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx)) {
  ------------------
  |  |   85|    541|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  734|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  735|      0|            return 0;
  736|      0|        }
  737|    541|    } while (BN_is_zero(s->Z));
  ------------------
  |  Branch (737:14): [True: 0, False: 541]
  ------------------
  738|       |
  739|       |    /* if field_encode defined convert between representations */
  740|    541|    if ((group->meth->field_encode != NULL
  ------------------
  |  Branch (740:10): [True: 0, False: 541]
  ------------------
  741|    541|         && !group->meth->field_encode(group, s->Z, s->Z, ctx))
  ------------------
  |  Branch (741:13): [True: 0, False: 0]
  ------------------
  742|    541|        || !group->meth->field_mul(group, s->X, p->X, s->Z, ctx))
  ------------------
  |  Branch (742:12): [True: 0, False: 541]
  ------------------
  743|      0|        return 0;
  744|       |
  745|       |    /* r blinding: make sure lambda (r->Y here for storage) is not zero */
  746|    541|    do {
  747|    541|        if (!BN_priv_rand_ex(r->Y, BN_num_bits(group->field) - 1,
  ------------------
  |  Branch (747:13): [True: 0, False: 541]
  ------------------
  748|    541|                             BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx)) {
  ------------------
  |  |   80|    541|#define BN_RAND_TOP_ANY    -1
  ------------------
                                           BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, 0, ctx)) {
  ------------------
  |  |   85|    541|#define BN_RAND_BOTTOM_ANY  0
  ------------------
  749|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  750|      0|            return 0;
  751|      0|        }
  752|    541|    } while (BN_is_zero(r->Y));
  ------------------
  |  Branch (752:14): [True: 0, False: 541]
  ------------------
  753|       |
  754|    541|    if ((group->meth->field_encode != NULL
  ------------------
  |  Branch (754:10): [True: 0, False: 541]
  ------------------
  755|    541|         && !group->meth->field_encode(group, r->Y, r->Y, ctx))
  ------------------
  |  Branch (755:13): [True: 0, False: 0]
  ------------------
  756|    541|        || !group->meth->field_sqr(group, r->Z, p->X, ctx)
  ------------------
  |  Branch (756:12): [True: 0, False: 541]
  ------------------
  757|    541|        || !group->meth->field_sqr(group, r->X, r->Z, ctx)
  ------------------
  |  Branch (757:12): [True: 0, False: 541]
  ------------------
  758|    541|        || !BN_GF2m_add(r->X, r->X, group->b)
  ------------------
  |  Branch (758:12): [True: 0, False: 541]
  ------------------
  759|    541|        || !group->meth->field_mul(group, r->Z, r->Z, r->Y, ctx)
  ------------------
  |  Branch (759:12): [True: 0, False: 541]
  ------------------
  760|    541|        || !group->meth->field_mul(group, r->X, r->X, r->Y, ctx))
  ------------------
  |  Branch (760:12): [True: 0, False: 541]
  ------------------
  761|      0|        return 0;
  762|       |
  763|    541|    s->Z_is_one = 0;
  764|    541|    r->Z_is_one = 0;
  765|       |
  766|    541|    return 1;
  767|    541|}
ec2_smpl.c:ec_GF2m_simple_ladder_step:
  778|   107k|{
  779|   107k|    if (!group->meth->field_mul(group, r->Y, r->Z, s->X, ctx)
  ------------------
  |  Branch (779:9): [True: 0, False: 107k]
  ------------------
  780|   107k|        || !group->meth->field_mul(group, s->X, r->X, s->Z, ctx)
  ------------------
  |  Branch (780:12): [True: 0, False: 107k]
  ------------------
  781|   107k|        || !group->meth->field_sqr(group, s->Y, r->Z, ctx)
  ------------------
  |  Branch (781:12): [True: 0, False: 107k]
  ------------------
  782|   107k|        || !group->meth->field_sqr(group, r->Z, r->X, ctx)
  ------------------
  |  Branch (782:12): [True: 0, False: 107k]
  ------------------
  783|   107k|        || !BN_GF2m_add(s->Z, r->Y, s->X)
  ------------------
  |  Branch (783:12): [True: 0, False: 107k]
  ------------------
  784|   107k|        || !group->meth->field_sqr(group, s->Z, s->Z, ctx)
  ------------------
  |  Branch (784:12): [True: 0, False: 107k]
  ------------------
  785|   107k|        || !group->meth->field_mul(group, s->X, r->Y, s->X, ctx)
  ------------------
  |  Branch (785:12): [True: 0, False: 107k]
  ------------------
  786|   107k|        || !group->meth->field_mul(group, r->Y, s->Z, p->X, ctx)
  ------------------
  |  Branch (786:12): [True: 0, False: 107k]
  ------------------
  787|   107k|        || !BN_GF2m_add(s->X, s->X, r->Y)
  ------------------
  |  Branch (787:12): [True: 0, False: 107k]
  ------------------
  788|   107k|        || !group->meth->field_sqr(group, r->Y, r->Z, ctx)
  ------------------
  |  Branch (788:12): [True: 0, False: 107k]
  ------------------
  789|   107k|        || !group->meth->field_mul(group, r->Z, r->Z, s->Y, ctx)
  ------------------
  |  Branch (789:12): [True: 0, False: 107k]
  ------------------
  790|   107k|        || !group->meth->field_sqr(group, s->Y, s->Y, ctx)
  ------------------
  |  Branch (790:12): [True: 0, False: 107k]
  ------------------
  791|   107k|        || !group->meth->field_mul(group, s->Y, s->Y, group->b, ctx)
  ------------------
  |  Branch (791:12): [True: 0, False: 107k]
  ------------------
  792|   107k|        || !BN_GF2m_add(r->X, r->Y, s->Y))
  ------------------
  |  Branch (792:12): [True: 0, False: 107k]
  ------------------
  793|      0|        return 0;
  794|       |
  795|   107k|    return 1;
  796|   107k|}
ec2_smpl.c:ec_GF2m_simple_ladder_post:
  808|    541|{
  809|    541|    int ret = 0;
  810|    541|    BIGNUM *t0, *t1, *t2 = NULL;
  811|       |
  812|    541|    if (BN_is_zero(r->Z))
  ------------------
  |  Branch (812:9): [True: 57, False: 484]
  ------------------
  813|     57|        return EC_POINT_set_to_infinity(group, r);
  814|       |
  815|    484|    if (BN_is_zero(s->Z)) {
  ------------------
  |  Branch (815:9): [True: 0, False: 484]
  ------------------
  816|      0|        if (!EC_POINT_copy(r, p)
  ------------------
  |  Branch (816:13): [True: 0, False: 0]
  ------------------
  817|      0|            || !EC_POINT_invert(group, r, ctx)) {
  ------------------
  |  Branch (817:16): [True: 0, False: 0]
  ------------------
  818|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  819|      0|            return 0;
  820|      0|        }
  821|      0|        return 1;
  822|      0|    }
  823|       |
  824|    484|    BN_CTX_start(ctx);
  825|    484|    t0 = BN_CTX_get(ctx);
  826|    484|    t1 = BN_CTX_get(ctx);
  827|    484|    t2 = BN_CTX_get(ctx);
  828|    484|    if (t2 == NULL) {
  ------------------
  |  Branch (828:9): [True: 0, False: 484]
  ------------------
  829|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  830|      0|        goto err;
  831|      0|    }
  832|       |
  833|    484|    if (!group->meth->field_mul(group, t0, r->Z, s->Z, ctx)
  ------------------
  |  Branch (833:9): [True: 0, False: 484]
  ------------------
  834|    484|        || !group->meth->field_mul(group, t1, p->X, r->Z, ctx)
  ------------------
  |  Branch (834:12): [True: 0, False: 484]
  ------------------
  835|    484|        || !BN_GF2m_add(t1, r->X, t1)
  ------------------
  |  Branch (835:12): [True: 0, False: 484]
  ------------------
  836|    484|        || !group->meth->field_mul(group, t2, p->X, s->Z, ctx)
  ------------------
  |  Branch (836:12): [True: 0, False: 484]
  ------------------
  837|    484|        || !group->meth->field_mul(group, r->Z, r->X, t2, ctx)
  ------------------
  |  Branch (837:12): [True: 0, False: 484]
  ------------------
  838|    484|        || !BN_GF2m_add(t2, t2, s->X)
  ------------------
  |  Branch (838:12): [True: 0, False: 484]
  ------------------
  839|    484|        || !group->meth->field_mul(group, t1, t1, t2, ctx)
  ------------------
  |  Branch (839:12): [True: 0, False: 484]
  ------------------
  840|    484|        || !group->meth->field_sqr(group, t2, p->X, ctx)
  ------------------
  |  Branch (840:12): [True: 0, False: 484]
  ------------------
  841|    484|        || !BN_GF2m_add(t2, p->Y, t2)
  ------------------
  |  Branch (841:12): [True: 0, False: 484]
  ------------------
  842|    484|        || !group->meth->field_mul(group, t2, t2, t0, ctx)
  ------------------
  |  Branch (842:12): [True: 0, False: 484]
  ------------------
  843|    484|        || !BN_GF2m_add(t1, t2, t1)
  ------------------
  |  Branch (843:12): [True: 0, False: 484]
  ------------------
  844|    484|        || !group->meth->field_mul(group, t2, p->X, t0, ctx)
  ------------------
  |  Branch (844:12): [True: 0, False: 484]
  ------------------
  845|    484|        || !group->meth->field_inv(group, t2, t2, ctx)
  ------------------
  |  Branch (845:12): [True: 0, False: 484]
  ------------------
  846|    484|        || !group->meth->field_mul(group, t1, t1, t2, ctx)
  ------------------
  |  Branch (846:12): [True: 0, False: 484]
  ------------------
  847|    484|        || !group->meth->field_mul(group, r->X, r->Z, t2, ctx)
  ------------------
  |  Branch (847:12): [True: 0, False: 484]
  ------------------
  848|    484|        || !BN_GF2m_add(t2, p->X, r->X)
  ------------------
  |  Branch (848:12): [True: 0, False: 484]
  ------------------
  849|    484|        || !group->meth->field_mul(group, t2, t2, t1, ctx)
  ------------------
  |  Branch (849:12): [True: 0, False: 484]
  ------------------
  850|    484|        || !BN_GF2m_add(r->Y, p->Y, t2)
  ------------------
  |  Branch (850:12): [True: 0, False: 484]
  ------------------
  851|    484|        || !BN_one(r->Z))
  ------------------
  |  |  197|    484|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (851:12): [True: 0, False: 484]
  ------------------
  852|      0|        goto err;
  853|       |
  854|    484|    r->Z_is_one = 1;
  855|       |
  856|       |    /* GF(2^m) field elements should always have BIGNUM::neg = 0 */
  857|    484|    BN_set_negative(r->X, 0);
  858|    484|    BN_set_negative(r->Y, 0);
  859|       |
  860|    484|    ret = 1;
  861|       |
  862|    484| err:
  863|    484|    BN_CTX_end(ctx);
  864|    484|    return ret;
  865|    484|}

EC_KEY_print:
  711|    587|{
  712|    587|    int private = EC_KEY_get0_private_key(x) != NULL;
  713|       |
  714|    587|    return do_EC_KEY_print(bp, x, off,
  715|    587|                private ? EC_KEY_PRINT_PRIVATE : EC_KEY_PRINT_PUBLIC);
  ------------------
  |  Branch (715:17): [True: 587, False: 0]
  ------------------
  716|    587|}
ECParameters_print:
  719|     72|{
  720|     72|    return do_EC_KEY_print(bp, x, 4, EC_KEY_PRINT_PARAM);
  721|     72|}
ec_ameth.c:eckey_pub_decode:
  101|  17.1k|{
  102|  17.1k|    const unsigned char *p = NULL;
  103|  17.1k|    int pklen;
  104|  17.1k|    EC_KEY *eckey = NULL;
  105|  17.1k|    X509_ALGOR *palg;
  106|  17.1k|    OSSL_LIB_CTX *libctx = NULL;
  107|  17.1k|    const char *propq = NULL;
  108|       |
  109|  17.1k|    if (!ossl_x509_PUBKEY_get0_libctx(&libctx, &propq, pubkey)
  ------------------
  |  Branch (109:9): [True: 0, False: 17.1k]
  ------------------
  110|  17.1k|        || !X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  ------------------
  |  Branch (110:12): [True: 0, False: 17.1k]
  ------------------
  111|      0|        return 0;
  112|  17.1k|    eckey = ossl_ec_key_param_from_x509_algor(palg, libctx, propq);
  113|       |
  114|  17.1k|    if (!eckey)
  ------------------
  |  Branch (114:9): [True: 1.17k, False: 15.9k]
  ------------------
  115|  1.17k|        return 0;
  116|       |
  117|       |    /* We have parameters now set public key */
  118|  15.9k|    if (!o2i_ECPublicKey(&eckey, &p, pklen)) {
  ------------------
  |  Branch (118:9): [True: 6.11k, False: 9.85k]
  ------------------
  119|  6.11k|        ERR_raise(ERR_LIB_EC, EC_R_DECODE_ERROR);
  ------------------
  |  |  401|  6.11k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  6.11k|    (ERR_new(),                                                 \
  |  |  |  |  404|  6.11k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  6.11k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  6.11k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  6.11k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  6.11k|     ERR_set_error)
  |  |  ------------------
  ------------------
  120|  6.11k|        goto ecerr;
  121|  6.11k|    }
  122|       |
  123|  9.85k|    EVP_PKEY_assign_EC_KEY(pkey, eckey);
  ------------------
  |  |  514|  9.85k|        EVP_PKEY_assign((pkey), EVP_PKEY_EC, (eckey))
  |  |  ------------------
  |  |  |  |   69|  9.85k|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  9.85k|#define NID_X9_62_id_ecPublicKey                408
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  124|  9.85k|    return 1;
  125|       |
  126|  6.11k| ecerr:
  127|  6.11k|    EC_KEY_free(eckey);
  128|  6.11k|    return 0;
  129|  15.9k|}
ec_ameth.c:eckey_priv_print:
  376|      3|{
  377|      3|    return do_EC_KEY_print(bp, pkey->pkey.ec, indent, EC_KEY_PRINT_PRIVATE);
  378|      3|}
ec_ameth.c:int_ec_free:
  273|  17.5k|{
  274|  17.5k|    EC_KEY_free(pkey->pkey.ec);
  275|  17.5k|}
ec_ameth.c:old_ec_priv_decode:
  382|    385|{
  383|    385|    EC_KEY *ec;
  384|       |
  385|    385|    if ((ec = d2i_ECPrivateKey(NULL, pder, derlen)) == NULL)
  ------------------
  |  Branch (385:9): [True: 384, False: 1]
  ------------------
  386|    384|        return 0;
  387|      1|    EVP_PKEY_assign_EC_KEY(pkey, ec);
  ------------------
  |  |  514|      1|        EVP_PKEY_assign((pkey), EVP_PKEY_EC, (eckey))
  |  |  ------------------
  |  |  |  |   69|      1|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  |  |  ------------------
  |  |  |  |  |  |  178|      1|#define NID_X9_62_id_ecPublicKey                408
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  388|      1|    return 1;
  389|    385|}
ec_ameth.c:old_ec_priv_encode:
  392|      3|{
  393|      3|    return i2d_ECPrivateKey(pkey->pkey.ec, pder);
  394|      3|}
ec_ameth.c:eckey_priv_decode_ex:
  150|     25|{
  151|     25|    int ret = 0;
  152|     25|    EC_KEY *eckey = ossl_ec_key_from_pkcs8(p8, libctx, propq);
  153|       |
  154|     25|    if (eckey != NULL) {
  ------------------
  |  Branch (154:9): [True: 2, False: 23]
  ------------------
  155|      2|        ret = 1;
  156|      2|        EVP_PKEY_assign_EC_KEY(pkey, eckey);
  ------------------
  |  |  514|      2|        EVP_PKEY_assign((pkey), EVP_PKEY_EC, (eckey))
  |  |  ------------------
  |  |  |  |   69|      2|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  |  |  ------------------
  |  |  |  |  |  |  178|      2|#define NID_X9_62_id_ecPublicKey                408
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  157|      2|    }
  158|       |
  159|     25|    return ret;
  160|     25|}
ec_ameth.c:do_EC_KEY_print:
  284|    662|{
  285|    662|    const char *ecstr;
  286|    662|    unsigned char *priv = NULL, *pub = NULL;
  287|    662|    size_t privlen = 0, publen = 0;
  288|    662|    int ret = 0;
  289|    662|    const EC_GROUP *group;
  290|       |
  291|    662|    if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL) {
  ------------------
  |  Branch (291:9): [True: 0, False: 662]
  |  Branch (291:22): [True: 0, False: 662]
  ------------------
  292|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  293|      0|        return 0;
  294|      0|    }
  295|       |
  296|    662|    if (ktype != EC_KEY_PRINT_PARAM && EC_KEY_get0_public_key(x) != NULL) {
  ------------------
  |  Branch (296:9): [True: 590, False: 72]
  |  Branch (296:40): [True: 590, False: 0]
  ------------------
  297|    590|        publen = EC_KEY_key2buf(x, EC_KEY_get_conv_form(x), &pub, NULL);
  298|    590|        if (publen == 0)
  ------------------
  |  Branch (298:13): [True: 3, False: 587]
  ------------------
  299|      3|            goto err;
  300|    590|    }
  301|       |
  302|    659|    if (ktype == EC_KEY_PRINT_PRIVATE && EC_KEY_get0_private_key(x) != NULL) {
  ------------------
  |  Branch (302:9): [True: 587, False: 72]
  |  Branch (302:42): [True: 587, False: 0]
  ------------------
  303|    587|        privlen = EC_KEY_priv2buf(x, &priv);
  304|    587|        if (privlen == 0)
  ------------------
  |  Branch (304:13): [True: 145, False: 442]
  ------------------
  305|    145|            goto err;
  306|    587|    }
  307|       |
  308|    514|    if (ktype == EC_KEY_PRINT_PRIVATE)
  ------------------
  |  Branch (308:9): [True: 442, False: 72]
  ------------------
  309|    442|        ecstr = "Private-Key";
  310|     72|    else if (ktype == EC_KEY_PRINT_PUBLIC)
  ------------------
  |  Branch (310:14): [True: 0, False: 72]
  ------------------
  311|      0|        ecstr = "Public-Key";
  312|     72|    else
  313|     72|        ecstr = "ECDSA-Parameters";
  314|       |
  315|    514|    if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (315:9): [True: 0, False: 514]
  ------------------
  316|      0|        goto err;
  317|    514|    if (BIO_printf(bp, "%s: (%d bit)\n", ecstr,
  ------------------
  |  Branch (317:9): [True: 0, False: 514]
  ------------------
  318|    514|                   EC_GROUP_order_bits(group)) <= 0)
  319|      0|        goto err;
  320|       |
  321|    514|    if (privlen != 0) {
  ------------------
  |  Branch (321:9): [True: 442, False: 72]
  ------------------
  322|    442|        if (BIO_printf(bp, "%*spriv:\n", off, "") <= 0)
  ------------------
  |  Branch (322:13): [True: 0, False: 442]
  ------------------
  323|      0|            goto err;
  324|    442|        if (ASN1_buf_print(bp, priv, privlen, off + 4) == 0)
  ------------------
  |  Branch (324:13): [True: 0, False: 442]
  ------------------
  325|      0|            goto err;
  326|    442|    }
  327|       |
  328|    514|    if (publen != 0) {
  ------------------
  |  Branch (328:9): [True: 442, False: 72]
  ------------------
  329|    442|        if (BIO_printf(bp, "%*spub:\n", off, "") <= 0)
  ------------------
  |  Branch (329:13): [True: 0, False: 442]
  ------------------
  330|      0|            goto err;
  331|    442|        if (ASN1_buf_print(bp, pub, publen, off + 4) == 0)
  ------------------
  |  Branch (331:13): [True: 0, False: 442]
  ------------------
  332|      0|            goto err;
  333|    442|    }
  334|       |
  335|    514|    if (!ECPKParameters_print(bp, group, off))
  ------------------
  |  Branch (335:9): [True: 0, False: 514]
  ------------------
  336|      0|        goto err;
  337|    514|    ret = 1;
  338|    662| err:
  339|    662|    if (!ret)
  ------------------
  |  Branch (339:9): [True: 148, False: 514]
  ------------------
  340|    662|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|    148|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    148|    (ERR_new(),                                                 \
  |  |  |  |  404|    148|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    148|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    148|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    148|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    148|     ERR_set_error)
  |  |  ------------------
  ------------------
  341|    662|    OPENSSL_clear_free(priv, privlen);
  ------------------
  |  |  105|    662|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    662|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    662|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  342|    662|    OPENSSL_free(pub);
  ------------------
  |  |  107|    662|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    662|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    662|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  343|    662|    return ret;
  344|    514|}

EC_GROUP_get_ecparameters:
  383|    225|{
  384|    225|    size_t len = 0;
  385|    225|    ECPARAMETERS *ret = NULL;
  386|    225|    const BIGNUM *tmp;
  387|    225|    unsigned char *buffer = NULL;
  388|    225|    const EC_POINT *point = NULL;
  389|    225|    point_conversion_form_t form;
  390|    225|    ASN1_INTEGER *orig;
  391|       |
  392|    225|    if (params == NULL) {
  ------------------
  |  Branch (392:9): [True: 225, False: 0]
  ------------------
  393|    225|        if ((ret = ECPARAMETERS_new()) == NULL) {
  ------------------
  |  Branch (393:13): [True: 0, False: 225]
  ------------------
  394|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  395|      0|            goto err;
  396|      0|        }
  397|    225|    } else
  398|      0|        ret = params;
  399|       |
  400|       |    /* set the version (always one) */
  401|    225|    ret->version = (long)0x1;
  402|       |
  403|       |    /* set the fieldID */
  404|    225|    if (!ec_asn1_group2fieldid(group, ret->fieldID)) {
  ------------------
  |  Branch (404:9): [True: 0, False: 225]
  ------------------
  405|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  406|      0|        goto err;
  407|      0|    }
  408|       |
  409|       |    /* set the curve */
  410|    225|    if (!ec_asn1_group2curve(group, ret->curve)) {
  ------------------
  |  Branch (410:9): [True: 0, False: 225]
  ------------------
  411|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  412|      0|        goto err;
  413|      0|    }
  414|       |
  415|       |    /* set the base point */
  416|    225|    if ((point = EC_GROUP_get0_generator(group)) == NULL) {
  ------------------
  |  Branch (416:9): [True: 0, False: 225]
  ------------------
  417|      0|        ERR_raise(ERR_LIB_EC, EC_R_UNDEFINED_GENERATOR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  418|      0|        goto err;
  419|      0|    }
  420|       |
  421|    225|    form = EC_GROUP_get_point_conversion_form(group);
  422|       |
  423|    225|    len = EC_POINT_point2buf(group, point, form, &buffer, NULL);
  424|    225|    if (len == 0) {
  ------------------
  |  Branch (424:9): [True: 0, False: 225]
  ------------------
  425|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  426|      0|        goto err;
  427|      0|    }
  428|    225|    if (ret->base == NULL && (ret->base = ASN1_OCTET_STRING_new()) == NULL) {
  ------------------
  |  Branch (428:9): [True: 0, False: 225]
  |  Branch (428:30): [True: 0, False: 0]
  ------------------
  429|      0|        OPENSSL_free(buffer);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  430|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  431|      0|        goto err;
  432|      0|    }
  433|    225|    ASN1_STRING_set0(ret->base, buffer, len);
  434|       |
  435|       |    /* set the order */
  436|    225|    tmp = EC_GROUP_get0_order(group);
  437|    225|    if (tmp == NULL) {
  ------------------
  |  Branch (437:9): [True: 0, False: 225]
  ------------------
  438|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  439|      0|        goto err;
  440|      0|    }
  441|    225|    ret->order = BN_to_ASN1_INTEGER(tmp, orig = ret->order);
  442|    225|    if (ret->order == NULL) {
  ------------------
  |  Branch (442:9): [True: 0, False: 225]
  ------------------
  443|      0|        ret->order = orig;
  444|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  445|      0|        goto err;
  446|      0|    }
  447|       |
  448|       |    /* set the cofactor (optional) */
  449|    225|    tmp = EC_GROUP_get0_cofactor(group);
  450|    225|    if (tmp != NULL) {
  ------------------
  |  Branch (450:9): [True: 225, False: 0]
  ------------------
  451|    225|        ret->cofactor = BN_to_ASN1_INTEGER(tmp, orig = ret->cofactor);
  452|    225|        if (ret->cofactor == NULL) {
  ------------------
  |  Branch (452:13): [True: 0, False: 225]
  ------------------
  453|      0|            ret->cofactor = orig;
  454|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  455|      0|            goto err;
  456|      0|        }
  457|    225|    }
  458|       |
  459|    225|    return ret;
  460|       |
  461|      0| err:
  462|      0|    if (params == NULL)
  ------------------
  |  Branch (462:9): [True: 0, False: 0]
  ------------------
  463|      0|        ECPARAMETERS_free(ret);
  464|      0|    return NULL;
  465|    225|}
EC_GROUP_get_ecpkparameters:
  469|  1.05k|{
  470|  1.05k|    int ok = 1, tmp;
  471|  1.05k|    ECPKPARAMETERS *ret = params;
  472|       |
  473|  1.05k|    if (ret == NULL) {
  ------------------
  |  Branch (473:9): [True: 1.05k, False: 0]
  ------------------
  474|  1.05k|        if ((ret = ECPKPARAMETERS_new()) == NULL) {
  ------------------
  |  Branch (474:13): [True: 0, False: 1.05k]
  ------------------
  475|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  476|      0|            return NULL;
  477|      0|        }
  478|  1.05k|    } else {
  479|      0|        if (ret->type == ECPKPARAMETERS_TYPE_NAMED)
  ------------------
  |  Branch (479:13): [True: 0, False: 0]
  ------------------
  480|      0|            ASN1_OBJECT_free(ret->value.named_curve);
  481|      0|        else if (ret->type == ECPKPARAMETERS_TYPE_EXPLICIT
  ------------------
  |  Branch (481:18): [True: 0, False: 0]
  ------------------
  482|      0|                 && ret->value.parameters != NULL)
  ------------------
  |  Branch (482:21): [True: 0, False: 0]
  ------------------
  483|      0|            ECPARAMETERS_free(ret->value.parameters);
  484|      0|    }
  485|       |
  486|  1.05k|    if (EC_GROUP_get_asn1_flag(group) == OPENSSL_EC_NAMED_CURVE) {
  ------------------
  |  |   31|  1.05k|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  |  Branch (486:9): [True: 830, False: 225]
  ------------------
  487|       |        /*
  488|       |         * use the asn1 OID to describe the elliptic curve parameters
  489|       |         */
  490|    830|        tmp = EC_GROUP_get_curve_name(group);
  491|    830|        if (tmp) {
  ------------------
  |  Branch (491:13): [True: 830, False: 0]
  ------------------
  492|    830|            ASN1_OBJECT *asn1obj = OBJ_nid2obj(tmp);
  493|       |
  494|    830|            if (asn1obj == NULL || OBJ_length(asn1obj) == 0) {
  ------------------
  |  Branch (494:17): [True: 0, False: 830]
  |  Branch (494:36): [True: 0, False: 830]
  ------------------
  495|      0|                ASN1_OBJECT_free(asn1obj);
  496|      0|                ERR_raise(ERR_LIB_EC, EC_R_MISSING_OID);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  497|      0|                ok = 0;
  498|    830|            } else {
  499|    830|                ret->type = ECPKPARAMETERS_TYPE_NAMED;
  500|    830|                ret->value.named_curve = asn1obj;
  501|    830|            }
  502|    830|        } else
  503|       |            /* we don't know the nid => ERROR */
  504|      0|            ok = 0;
  505|    830|    } else {
  506|       |        /* use the ECPARAMETERS structure */
  507|    225|        ret->type = ECPKPARAMETERS_TYPE_EXPLICIT;
  508|    225|        if ((ret->value.parameters =
  ------------------
  |  Branch (508:13): [True: 0, False: 225]
  ------------------
  509|    225|             EC_GROUP_get_ecparameters(group, NULL)) == NULL)
  510|      0|            ok = 0;
  511|    225|    }
  512|       |
  513|  1.05k|    if (!ok) {
  ------------------
  |  Branch (513:9): [True: 0, False: 1.05k]
  ------------------
  514|      0|        ECPKPARAMETERS_free(ret);
  515|      0|        return NULL;
  516|      0|    }
  517|  1.05k|    return ret;
  518|  1.05k|}
EC_GROUP_new_from_ecparameters:
  521|  3.25k|{
  522|  3.25k|    int ok = 0, tmp;
  523|  3.25k|    EC_GROUP *ret = NULL, *dup = NULL;
  524|  3.25k|    BIGNUM *p = NULL, *a = NULL, *b = NULL;
  525|  3.25k|    EC_POINT *point = NULL;
  526|  3.25k|    long field_bits;
  527|  3.25k|    int curve_name = NID_undef;
  ------------------
  |  |   18|  3.25k|#define NID_undef                       0
  ------------------
  528|  3.25k|    BN_CTX *ctx = NULL;
  529|       |
  530|  3.25k|    if (params->fieldID == NULL
  ------------------
  |  Branch (530:9): [True: 0, False: 3.25k]
  ------------------
  531|  3.25k|            || params->fieldID->fieldType == NULL
  ------------------
  |  Branch (531:16): [True: 0, False: 3.25k]
  ------------------
  532|  3.25k|            || params->fieldID->p.ptr == NULL) {
  ------------------
  |  Branch (532:16): [True: 0, False: 3.25k]
  ------------------
  533|      0|        ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  534|      0|        goto err;
  535|      0|    }
  536|       |
  537|       |    /*
  538|       |     * Now extract the curve parameters a and b. Note that, although SEC 1
  539|       |     * specifies the length of their encodings, historical versions of OpenSSL
  540|       |     * encoded them incorrectly, so we must accept any length for backwards
  541|       |     * compatibility.
  542|       |     */
  543|  3.25k|    if (params->curve == NULL
  ------------------
  |  Branch (543:9): [True: 0, False: 3.25k]
  ------------------
  544|  3.25k|            || params->curve->a == NULL || params->curve->a->data == NULL
  ------------------
  |  Branch (544:16): [True: 0, False: 3.25k]
  |  Branch (544:44): [True: 0, False: 3.25k]
  ------------------
  545|  3.25k|            || params->curve->b == NULL || params->curve->b->data == NULL) {
  ------------------
  |  Branch (545:16): [True: 0, False: 3.25k]
  |  Branch (545:44): [True: 0, False: 3.25k]
  ------------------
  546|      0|        ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  547|      0|        goto err;
  548|      0|    }
  549|  3.25k|    a = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);
  550|  3.25k|    if (a == NULL) {
  ------------------
  |  Branch (550:9): [True: 0, False: 3.25k]
  ------------------
  551|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  552|      0|        goto err;
  553|      0|    }
  554|  3.25k|    b = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);
  555|  3.25k|    if (b == NULL) {
  ------------------
  |  Branch (555:9): [True: 0, False: 3.25k]
  ------------------
  556|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  557|      0|        goto err;
  558|      0|    }
  559|       |
  560|       |    /* get the field parameters */
  561|  3.25k|    tmp = OBJ_obj2nid(params->fieldID->fieldType);
  562|  3.25k|    if (tmp == NID_X9_62_characteristic_two_field)
  ------------------
  |  |  156|  3.25k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (562:9): [True: 0, False: 3.25k]
  ------------------
  563|       |#ifdef OPENSSL_NO_EC2M
  564|       |    {
  565|       |        ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
  566|       |        goto err;
  567|       |    }
  568|       |#else
  569|      0|    {
  570|      0|        X9_62_CHARACTERISTIC_TWO *char_two;
  571|       |
  572|      0|        char_two = params->fieldID->p.char_two;
  573|       |
  574|      0|        field_bits = char_two->m;
  575|      0|        if (field_bits > OPENSSL_ECC_MAX_FIELD_BITS) {
  ------------------
  |  |  103|      0|#   define OPENSSL_ECC_MAX_FIELD_BITS 661
  ------------------
  |  Branch (575:13): [True: 0, False: 0]
  ------------------
  576|      0|            ERR_raise(ERR_LIB_EC, EC_R_FIELD_TOO_LARGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  577|      0|            goto err;
  578|      0|        }
  579|       |
  580|      0|        if ((p = BN_new()) == NULL) {
  ------------------
  |  Branch (580:13): [True: 0, False: 0]
  ------------------
  581|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  582|      0|            goto err;
  583|      0|        }
  584|       |
  585|       |        /* get the base type */
  586|      0|        tmp = OBJ_obj2nid(char_two->type);
  587|       |
  588|      0|        if (tmp == NID_X9_62_tpBasis) {
  ------------------
  |  |  168|      0|#define NID_X9_62_tpBasis               682
  ------------------
  |  Branch (588:13): [True: 0, False: 0]
  ------------------
  589|      0|            long tmp_long;
  590|       |
  591|      0|            if (!char_two->p.tpBasis) {
  ------------------
  |  Branch (591:17): [True: 0, False: 0]
  ------------------
  592|      0|                ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  593|      0|                goto err;
  594|      0|            }
  595|       |
  596|      0|            tmp_long = ASN1_INTEGER_get(char_two->p.tpBasis);
  597|       |
  598|      0|            if (!(char_two->m > tmp_long && tmp_long > 0)) {
  ------------------
  |  Branch (598:19): [True: 0, False: 0]
  |  Branch (598:45): [True: 0, False: 0]
  ------------------
  599|      0|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_TRINOMIAL_BASIS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  600|      0|                goto err;
  601|      0|            }
  602|       |
  603|       |            /* create the polynomial */
  604|      0|            if (!BN_set_bit(p, (int)char_two->m))
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|                goto err;
  606|      0|            if (!BN_set_bit(p, (int)tmp_long))
  ------------------
  |  Branch (606:17): [True: 0, False: 0]
  ------------------
  607|      0|                goto err;
  608|      0|            if (!BN_set_bit(p, 0))
  ------------------
  |  Branch (608:17): [True: 0, False: 0]
  ------------------
  609|      0|                goto err;
  610|      0|        } else if (tmp == NID_X9_62_ppBasis) {
  ------------------
  |  |  172|      0|#define NID_X9_62_ppBasis               683
  ------------------
  |  Branch (610:20): [True: 0, False: 0]
  ------------------
  611|      0|            X9_62_PENTANOMIAL *penta;
  612|       |
  613|      0|            penta = char_two->p.ppBasis;
  614|      0|            if (penta == NULL) {
  ------------------
  |  Branch (614:17): [True: 0, False: 0]
  ------------------
  615|      0|                ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  616|      0|                goto err;
  617|      0|            }
  618|       |
  619|      0|            if (!
  620|      0|                (char_two->m > penta->k3 && penta->k3 > penta->k2
  ------------------
  |  Branch (620:18): [True: 0, False: 0]
  |  Branch (620:45): [True: 0, False: 0]
  ------------------
  621|      0|                 && penta->k2 > penta->k1 && penta->k1 > 0)) {
  ------------------
  |  Branch (621:21): [True: 0, False: 0]
  |  Branch (621:46): [True: 0, False: 0]
  ------------------
  622|      0|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_PENTANOMIAL_BASIS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  623|      0|                goto err;
  624|      0|            }
  625|       |
  626|       |            /* create the polynomial */
  627|      0|            if (!BN_set_bit(p, (int)char_two->m))
  ------------------
  |  Branch (627:17): [True: 0, False: 0]
  ------------------
  628|      0|                goto err;
  629|      0|            if (!BN_set_bit(p, (int)penta->k1))
  ------------------
  |  Branch (629:17): [True: 0, False: 0]
  ------------------
  630|      0|                goto err;
  631|      0|            if (!BN_set_bit(p, (int)penta->k2))
  ------------------
  |  Branch (631:17): [True: 0, False: 0]
  ------------------
  632|      0|                goto err;
  633|      0|            if (!BN_set_bit(p, (int)penta->k3))
  ------------------
  |  Branch (633:17): [True: 0, False: 0]
  ------------------
  634|      0|                goto err;
  635|      0|            if (!BN_set_bit(p, 0))
  ------------------
  |  Branch (635:17): [True: 0, False: 0]
  ------------------
  636|      0|                goto err;
  637|      0|        } else if (tmp == NID_X9_62_onBasis) {
  ------------------
  |  |  164|      0|#define NID_X9_62_onBasis               681
  ------------------
  |  Branch (637:20): [True: 0, False: 0]
  ------------------
  638|      0|            ERR_raise(ERR_LIB_EC, EC_R_NOT_IMPLEMENTED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  639|      0|            goto err;
  640|      0|        } else {                /* error */
  641|       |
  642|      0|            ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  643|      0|            goto err;
  644|      0|        }
  645|       |
  646|       |        /* create the EC_GROUP structure */
  647|      0|        ret = EC_GROUP_new_curve_GF2m(p, a, b, NULL);
  648|      0|    }
  649|  3.25k|#endif
  650|  3.25k|    else if (tmp == NID_X9_62_prime_field) {
  ------------------
  |  |  152|  3.25k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (650:14): [True: 3.21k, False: 36]
  ------------------
  651|       |        /* we have a curve over a prime field */
  652|       |        /* extract the prime number */
  653|  3.21k|        if (params->fieldID->p.prime == NULL) {
  ------------------
  |  Branch (653:13): [True: 0, False: 3.21k]
  ------------------
  654|      0|            ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  655|      0|            goto err;
  656|      0|        }
  657|  3.21k|        p = ASN1_INTEGER_to_BN(params->fieldID->p.prime, NULL);
  658|  3.21k|        if (p == NULL) {
  ------------------
  |  Branch (658:13): [True: 0, False: 3.21k]
  ------------------
  659|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  660|      0|            goto err;
  661|      0|        }
  662|       |
  663|  3.21k|        if (BN_is_negative(p) || BN_is_zero(p)) {
  ------------------
  |  Branch (663:13): [True: 66, False: 3.15k]
  |  Branch (663:34): [True: 6, False: 3.14k]
  ------------------
  664|     72|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_FIELD);
  ------------------
  |  |  401|     72|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     72|    (ERR_new(),                                                 \
  |  |  |  |  404|     72|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     72|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     72|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     72|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     72|     ERR_set_error)
  |  |  ------------------
  ------------------
  665|     72|            goto err;
  666|     72|        }
  667|       |
  668|  3.14k|        field_bits = BN_num_bits(p);
  669|  3.14k|        if (field_bits > OPENSSL_ECC_MAX_FIELD_BITS) {
  ------------------
  |  |  103|  3.14k|#   define OPENSSL_ECC_MAX_FIELD_BITS 661
  ------------------
  |  Branch (669:13): [True: 0, False: 3.14k]
  ------------------
  670|      0|            ERR_raise(ERR_LIB_EC, EC_R_FIELD_TOO_LARGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  671|      0|            goto err;
  672|      0|        }
  673|       |
  674|       |        /* create the EC_GROUP structure */
  675|  3.14k|        ret = EC_GROUP_new_curve_GFp(p, a, b, NULL);
  676|  3.14k|    } else {
  677|     36|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FIELD);
  ------------------
  |  |  401|     36|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     36|    (ERR_new(),                                                 \
  |  |  |  |  404|     36|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     36|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     36|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     36|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     36|     ERR_set_error)
  |  |  ------------------
  ------------------
  678|     36|        goto err;
  679|     36|    }
  680|       |
  681|  3.14k|    if (ret == NULL) {
  ------------------
  |  Branch (681:9): [True: 315, False: 2.82k]
  ------------------
  682|    315|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|    315|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    315|    (ERR_new(),                                                 \
  |  |  |  |  404|    315|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    315|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    315|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    315|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    315|     ERR_set_error)
  |  |  ------------------
  ------------------
  683|    315|        goto err;
  684|    315|    }
  685|       |
  686|       |    /* extract seed (optional) */
  687|  2.82k|    if (params->curve->seed != NULL) {
  ------------------
  |  Branch (687:9): [True: 2.43k, False: 396]
  ------------------
  688|       |        /*
  689|       |         * This happens for instance with
  690|       |         * fuzz/corpora/asn1/65cf44e85614c62f10cf3b7a7184c26293a19e4a
  691|       |         * and causes the OPENSSL_malloc below to choke on the
  692|       |         * zero length allocation request.
  693|       |         */
  694|  2.43k|        if (params->curve->seed->length == 0) {
  ------------------
  |  Branch (694:13): [True: 7, False: 2.42k]
  ------------------
  695|      7|            ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      7|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      7|    (ERR_new(),                                                 \
  |  |  |  |  404|      7|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      7|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      7|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      7|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      7|     ERR_set_error)
  |  |  ------------------
  ------------------
  696|      7|            goto err;
  697|      7|        }
  698|  2.42k|        OPENSSL_free(ret->seed);
  ------------------
  |  |  107|  2.42k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.42k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.42k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  699|  2.42k|        if ((ret->seed = OPENSSL_malloc(params->curve->seed->length)) == NULL)
  ------------------
  |  |   97|  2.42k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.42k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.42k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (699:13): [True: 0, False: 2.42k]
  ------------------
  700|      0|            goto err;
  701|  2.42k|        memcpy(ret->seed, params->curve->seed->data,
  702|  2.42k|               params->curve->seed->length);
  703|  2.42k|        ret->seed_len = params->curve->seed->length;
  704|  2.42k|    }
  705|       |
  706|  2.82k|    if (params->order == NULL
  ------------------
  |  Branch (706:9): [True: 0, False: 2.82k]
  ------------------
  707|  2.82k|            || params->base == NULL
  ------------------
  |  Branch (707:16): [True: 0, False: 2.82k]
  ------------------
  708|  2.82k|            || params->base->data == NULL
  ------------------
  |  Branch (708:16): [True: 0, False: 2.82k]
  ------------------
  709|  2.82k|            || params->base->length == 0) {
  ------------------
  |  Branch (709:16): [True: 8, False: 2.81k]
  ------------------
  710|      8|        ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      8|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      8|    (ERR_new(),                                                 \
  |  |  |  |  404|      8|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      8|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      8|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      8|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      8|     ERR_set_error)
  |  |  ------------------
  ------------------
  711|      8|        goto err;
  712|      8|    }
  713|       |
  714|  2.81k|    if ((point = EC_POINT_new(ret)) == NULL)
  ------------------
  |  Branch (714:9): [True: 0, False: 2.81k]
  ------------------
  715|      0|        goto err;
  716|       |
  717|       |    /* set the point conversion form */
  718|  2.81k|    EC_GROUP_set_point_conversion_form(ret, (point_conversion_form_t)
  719|  2.81k|                                       (params->base->data[0] & ~0x01));
  720|       |
  721|       |    /* extract the ec point */
  722|  2.81k|    if (!EC_POINT_oct2point(ret, point, params->base->data,
  ------------------
  |  Branch (722:9): [True: 723, False: 2.09k]
  ------------------
  723|  2.81k|                            params->base->length, NULL)) {
  724|    723|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|    723|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    723|    (ERR_new(),                                                 \
  |  |  |  |  404|    723|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    723|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    723|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    723|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    723|     ERR_set_error)
  |  |  ------------------
  ------------------
  725|    723|        goto err;
  726|    723|    }
  727|       |
  728|       |    /* extract the order */
  729|  2.09k|    if (ASN1_INTEGER_to_BN(params->order, a) == NULL) {
  ------------------
  |  Branch (729:9): [True: 0, False: 2.09k]
  ------------------
  730|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  731|      0|        goto err;
  732|      0|    }
  733|  2.09k|    if (BN_is_negative(a) || BN_is_zero(a)) {
  ------------------
  |  Branch (733:9): [True: 28, False: 2.06k]
  |  Branch (733:30): [True: 7, False: 2.05k]
  ------------------
  734|     35|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER);
  ------------------
  |  |  401|     35|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     35|    (ERR_new(),                                                 \
  |  |  |  |  404|     35|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     35|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     35|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     35|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     35|     ERR_set_error)
  |  |  ------------------
  ------------------
  735|     35|        goto err;
  736|     35|    }
  737|  2.05k|    if (BN_num_bits(a) > (int)field_bits + 1) { /* Hasse bound */
  ------------------
  |  Branch (737:9): [True: 44, False: 2.01k]
  ------------------
  738|     44|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER);
  ------------------
  |  |  401|     44|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     44|    (ERR_new(),                                                 \
  |  |  |  |  404|     44|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     44|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     44|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     44|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     44|     ERR_set_error)
  |  |  ------------------
  ------------------
  739|     44|        goto err;
  740|     44|    }
  741|       |
  742|       |    /* extract the cofactor (optional) */
  743|  2.01k|    if (params->cofactor == NULL) {
  ------------------
  |  Branch (743:9): [True: 306, False: 1.70k]
  ------------------
  744|    306|        BN_free(b);
  745|    306|        b = NULL;
  746|  1.70k|    } else if (ASN1_INTEGER_to_BN(params->cofactor, b) == NULL) {
  ------------------
  |  Branch (746:16): [True: 0, False: 1.70k]
  ------------------
  747|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  748|      0|        goto err;
  749|      0|    }
  750|       |    /* set the generator, order and cofactor (if present) */
  751|  2.01k|    if (!EC_GROUP_set_generator(ret, point, a, b)) {
  ------------------
  |  Branch (751:9): [True: 10, False: 2.00k]
  ------------------
  752|     10|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|     10|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     10|    (ERR_new(),                                                 \
  |  |  |  |  404|     10|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     10|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     10|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     10|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     10|     ERR_set_error)
  |  |  ------------------
  ------------------
  753|     10|        goto err;
  754|     10|    }
  755|       |
  756|       |    /*
  757|       |     * Check if the explicit parameters group just created matches one of the
  758|       |     * built-in curves.
  759|       |     *
  760|       |     * We create a copy of the group just built, so that we can remove optional
  761|       |     * fields for the lookup: we do this to avoid the possibility that one of
  762|       |     * the optional parameters is used to force the library into using a less
  763|       |     * performant and less secure EC_METHOD instead of the specialized one.
  764|       |     * In any case, `seed` is not really used in any computation, while a
  765|       |     * cofactor different from the one in the built-in table is just
  766|       |     * mathematically wrong anyway and should not be used.
  767|       |     */
  768|  2.00k|    if ((ctx = BN_CTX_new()) == NULL) {
  ------------------
  |  Branch (768:9): [True: 0, False: 2.00k]
  ------------------
  769|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  770|      0|        goto err;
  771|      0|    }
  772|  2.00k|    if ((dup = EC_GROUP_dup(ret)) == NULL
  ------------------
  |  Branch (772:9): [True: 0, False: 2.00k]
  ------------------
  773|  2.00k|            || EC_GROUP_set_seed(dup, NULL, 0) != 1
  ------------------
  |  Branch (773:16): [True: 0, False: 2.00k]
  ------------------
  774|  2.00k|            || !EC_GROUP_set_generator(dup, point, a, NULL)) {
  ------------------
  |  Branch (774:16): [True: 0, False: 2.00k]
  ------------------
  775|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  776|      0|        goto err;
  777|      0|    }
  778|  2.00k|    if ((curve_name = ossl_ec_curve_nid_from_params(dup, ctx)) != NID_undef) {
  ------------------
  |  |   18|  2.00k|#define NID_undef                       0
  ------------------
  |  Branch (778:9): [True: 27, False: 1.97k]
  ------------------
  779|       |        /*
  780|       |         * The input explicit parameters successfully matched one of the
  781|       |         * built-in curves: often for built-in curves we have specialized
  782|       |         * methods with better performance and hardening.
  783|       |         *
  784|       |         * In this case we replace the `EC_GROUP` created through explicit
  785|       |         * parameters with one created from a named group.
  786|       |         */
  787|     27|        EC_GROUP *named_group = NULL;
  788|       |
  789|     27|#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
  790|       |        /*
  791|       |         * NID_wap_wsg_idm_ecid_wtls12 and NID_secp224r1 are both aliases for
  792|       |         * the same curve, we prefer the SECP nid when matching explicit
  793|       |         * parameters as that is associated with a specialized EC_METHOD.
  794|       |         */
  795|     27|        if (curve_name == NID_wap_wsg_idm_ecid_wtls12)
  ------------------
  |  |  494|     27|#define NID_wap_wsg_idm_ecid_wtls12             745
  ------------------
  |  Branch (795:13): [True: 0, False: 27]
  ------------------
  796|      0|            curve_name = NID_secp224r1;
  ------------------
  |  |  364|      0|#define NID_secp224r1           713
  ------------------
  797|     27|#endif /* !def(OPENSSL_NO_EC_NISTP_64_GCC_128) */
  798|       |
  799|     27|        if ((named_group = EC_GROUP_new_by_curve_name(curve_name)) == NULL) {
  ------------------
  |  Branch (799:13): [True: 12, False: 15]
  ------------------
  800|     12|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|     12|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     12|    (ERR_new(),                                                 \
  |  |  |  |  404|     12|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     12|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     12|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     12|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     12|     ERR_set_error)
  |  |  ------------------
  ------------------
  801|     12|            goto err;
  802|     12|        }
  803|     15|        EC_GROUP_free(ret);
  804|     15|        ret = named_group;
  805|       |
  806|       |        /*
  807|       |         * Set the flag so that EC_GROUPs created from explicit parameters are
  808|       |         * serialized using explicit parameters by default.
  809|       |         */
  810|     15|        EC_GROUP_set_asn1_flag(ret, OPENSSL_EC_EXPLICIT_CURVE);
  ------------------
  |  |   30|     15|# define OPENSSL_EC_EXPLICIT_CURVE  0x000
  ------------------
  811|       |
  812|       |        /*
  813|       |         * If the input params do not contain the optional seed field we make
  814|       |         * sure it is not added to the returned group.
  815|       |         *
  816|       |         * The seed field is not really used inside libcrypto anyway, and
  817|       |         * adding it to parsed explicit parameter keys would alter their DER
  818|       |         * encoding output (because of the extra field) which could impact
  819|       |         * applications fingerprinting keys by their DER encoding.
  820|       |         */
  821|     15|        if (params->curve->seed == NULL) {
  ------------------
  |  Branch (821:13): [True: 2, False: 13]
  ------------------
  822|      2|            if (EC_GROUP_set_seed(ret, NULL, 0) != 1)
  ------------------
  |  Branch (822:17): [True: 0, False: 2]
  ------------------
  823|      0|                goto err;
  824|      2|        }
  825|     15|    }
  826|       |
  827|  1.99k|    ok = 1;
  828|       |
  829|  3.25k| err:
  830|  3.25k|    if (!ok) {
  ------------------
  |  Branch (830:9): [True: 1.26k, False: 1.99k]
  ------------------
  831|  1.26k|        EC_GROUP_free(ret);
  832|  1.26k|        ret = NULL;
  833|  1.26k|    }
  834|  3.25k|    EC_GROUP_free(dup);
  835|       |
  836|  3.25k|    BN_free(p);
  837|  3.25k|    BN_free(a);
  838|  3.25k|    BN_free(b);
  839|  3.25k|    EC_POINT_free(point);
  840|       |
  841|  3.25k|    BN_CTX_free(ctx);
  842|       |
  843|  3.25k|    return ret;
  844|  1.99k|}
EC_GROUP_new_from_ecpkparameters:
  847|  5.39k|{
  848|  5.39k|    EC_GROUP *ret = NULL;
  849|  5.39k|    int tmp = 0;
  850|       |
  851|  5.39k|    if (params == NULL) {
  ------------------
  |  Branch (851:9): [True: 0, False: 5.39k]
  ------------------
  852|      0|        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  853|      0|        return NULL;
  854|      0|    }
  855|       |
  856|  5.39k|    if (params->type == ECPKPARAMETERS_TYPE_NAMED) {
  ------------------
  |  Branch (856:9): [True: 2.13k, False: 3.26k]
  ------------------
  857|       |        /* the curve is given by an OID */
  858|  2.13k|        tmp = OBJ_obj2nid(params->value.named_curve);
  859|  2.13k|        if ((ret = EC_GROUP_new_by_curve_name(tmp)) == NULL) {
  ------------------
  |  Branch (859:13): [True: 436, False: 1.69k]
  ------------------
  860|    436|            ERR_raise(ERR_LIB_EC, EC_R_EC_GROUP_NEW_BY_NAME_FAILURE);
  ------------------
  |  |  401|    436|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    436|    (ERR_new(),                                                 \
  |  |  |  |  404|    436|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    436|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    436|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    436|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    436|     ERR_set_error)
  |  |  ------------------
  ------------------
  861|    436|            return NULL;
  862|    436|        }
  863|  1.69k|        EC_GROUP_set_asn1_flag(ret, OPENSSL_EC_NAMED_CURVE);
  ------------------
  |  |   31|  1.69k|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  864|  3.26k|    } else if (params->type == ECPKPARAMETERS_TYPE_EXPLICIT) {
  ------------------
  |  Branch (864:16): [True: 3.25k, False: 8]
  ------------------
  865|       |        /* the parameters are given by an ECPARAMETERS structure */
  866|  3.25k|        ret = EC_GROUP_new_from_ecparameters(params->value.parameters);
  867|  3.25k|        if (!ret) {
  ------------------
  |  Branch (867:13): [True: 1.26k, False: 1.99k]
  ------------------
  868|  1.26k|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|  1.26k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.26k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.26k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.26k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.26k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.26k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.26k|     ERR_set_error)
  |  |  ------------------
  ------------------
  869|  1.26k|            return NULL;
  870|  1.26k|        }
  871|  1.99k|        EC_GROUP_set_asn1_flag(ret, OPENSSL_EC_EXPLICIT_CURVE);
  ------------------
  |  |   30|  1.99k|# define OPENSSL_EC_EXPLICIT_CURVE  0x000
  ------------------
  872|  1.99k|    } else if (params->type == ECPKPARAMETERS_TYPE_IMPLICIT) {
  ------------------
  |  Branch (872:16): [True: 8, False: 0]
  ------------------
  873|       |        /* implicit parameters inherited from CA - unsupported */
  874|      8|        return NULL;
  875|      8|    } else {
  876|      0|        ERR_raise(ERR_LIB_EC, EC_R_ASN1_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  877|      0|        return NULL;
  878|      0|    }
  879|       |
  880|  3.68k|    return ret;
  881|  5.39k|}
d2i_ECPKParameters:
  886|  26.9k|{
  887|  26.9k|    EC_GROUP *group = NULL;
  888|  26.9k|    ECPKPARAMETERS *params = NULL;
  889|  26.9k|    const unsigned char *p = *in;
  890|       |
  891|  26.9k|    if ((params = d2i_ECPKPARAMETERS(NULL, &p, len)) == NULL) {
  ------------------
  |  Branch (891:9): [True: 23.7k, False: 3.19k]
  ------------------
  892|  23.7k|        ECPKPARAMETERS_free(params);
  893|  23.7k|        return NULL;
  894|  23.7k|    }
  895|       |
  896|  3.19k|    if ((group = EC_GROUP_new_from_ecpkparameters(params)) == NULL) {
  ------------------
  |  Branch (896:9): [True: 1.46k, False: 1.73k]
  ------------------
  897|  1.46k|        ECPKPARAMETERS_free(params);
  898|  1.46k|        return NULL;
  899|  1.46k|    }
  900|       |
  901|  1.73k|    if (params->type == ECPKPARAMETERS_TYPE_EXPLICIT)
  ------------------
  |  Branch (901:9): [True: 1.63k, False: 104]
  ------------------
  902|  1.63k|        group->decoded_from_explicit_params = 1;
  903|       |
  904|  1.73k|    if (a) {
  ------------------
  |  Branch (904:9): [True: 868, False: 870]
  ------------------
  905|    868|        EC_GROUP_free(*a);
  906|    868|        *a = group;
  907|    868|    }
  908|       |
  909|  1.73k|    ECPKPARAMETERS_free(params);
  910|  1.73k|    *in = p;
  911|  1.73k|    return group;
  912|  3.19k|}
i2d_ECPKParameters:
  915|    197|{
  916|    197|    int ret = 0;
  917|    197|    ECPKPARAMETERS *tmp = EC_GROUP_get_ecpkparameters(a, NULL);
  918|    197|    if (tmp == NULL) {
  ------------------
  |  Branch (918:9): [True: 0, False: 197]
  ------------------
  919|      0|        ERR_raise(ERR_LIB_EC, EC_R_GROUP2PKPARAMETERS_FAILURE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  920|      0|        return 0;
  921|      0|    }
  922|    197|    if ((ret = i2d_ECPKPARAMETERS(tmp, out)) == 0) {
  ------------------
  |  Branch (922:9): [True: 0, False: 197]
  ------------------
  923|      0|        ERR_raise(ERR_LIB_EC, EC_R_I2D_ECPKPARAMETERS_FAILURE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  924|      0|        ECPKPARAMETERS_free(tmp);
  925|      0|        return 0;
  926|      0|    }
  927|    197|    ECPKPARAMETERS_free(tmp);
  928|    197|    return ret;
  929|    197|}
d2i_ECPrivateKey:
  934|  34.4k|{
  935|  34.4k|    EC_KEY *ret = NULL;
  936|  34.4k|    EC_PRIVATEKEY *priv_key = NULL;
  937|  34.4k|    const unsigned char *p = *in;
  938|       |
  939|  34.4k|    if ((priv_key = d2i_EC_PRIVATEKEY(NULL, &p, len)) == NULL)
  ------------------
  |  Branch (939:9): [True: 32.2k, False: 2.26k]
  ------------------
  940|  32.2k|        return NULL;
  941|       |
  942|  2.26k|    if (a == NULL || *a == NULL) {
  ------------------
  |  Branch (942:9): [True: 2.21k, False: 50]
  |  Branch (942:22): [True: 0, False: 50]
  ------------------
  943|  2.21k|        if ((ret = EC_KEY_new()) == NULL) {
  ------------------
  |  Branch (943:13): [True: 0, False: 2.21k]
  ------------------
  944|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  945|      0|            goto err;
  946|      0|        }
  947|  2.21k|    } else
  948|     50|        ret = *a;
  949|       |
  950|  2.26k|    if (priv_key->parameters) {
  ------------------
  |  Branch (950:9): [True: 2.19k, False: 72]
  ------------------
  951|  2.19k|        EC_GROUP_free(ret->group);
  952|  2.19k|        ret->group = EC_GROUP_new_from_ecpkparameters(priv_key->parameters);
  953|  2.19k|        if (ret->group != NULL
  ------------------
  |  Branch (953:13): [True: 1.95k, False: 246]
  ------------------
  954|  2.19k|            && priv_key->parameters->type == ECPKPARAMETERS_TYPE_EXPLICIT)
  ------------------
  |  Branch (954:16): [True: 356, False: 1.59k]
  ------------------
  955|    356|            ret->group->decoded_from_explicit_params = 1;
  956|  2.19k|    }
  957|       |
  958|  2.26k|    if (ret->group == NULL) {
  ------------------
  |  Branch (958:9): [True: 270, False: 1.99k]
  ------------------
  959|    270|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|    270|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    270|    (ERR_new(),                                                 \
  |  |  |  |  404|    270|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    270|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    270|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    270|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    270|     ERR_set_error)
  |  |  ------------------
  ------------------
  960|    270|        goto err;
  961|    270|    }
  962|       |
  963|  1.99k|    ret->version = priv_key->version;
  964|       |
  965|  1.99k|    if (priv_key->privateKey) {
  ------------------
  |  Branch (965:9): [True: 1.99k, False: 0]
  ------------------
  966|  1.99k|        ASN1_OCTET_STRING *pkey = priv_key->privateKey;
  967|  1.99k|        if (EC_KEY_oct2priv(ret, ASN1_STRING_get0_data(pkey),
  ------------------
  |  Branch (967:13): [True: 0, False: 1.99k]
  ------------------
  968|  1.99k|                            ASN1_STRING_length(pkey)) == 0)
  969|      0|            goto err;
  970|  1.99k|    } else {
  971|      0|        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  972|      0|        goto err;
  973|      0|    }
  974|       |
  975|  1.99k|    if (EC_GROUP_get_curve_name(ret->group) == NID_sm2)
  ------------------
  |  | 1228|  1.99k|#define NID_sm2         1172
  ------------------
  |  Branch (975:9): [True: 14, False: 1.98k]
  ------------------
  976|     14|        EC_KEY_set_flags(ret, EC_FLAG_SM2_RANGE);
  ------------------
  |  |  962|     14|#  define EC_FLAG_SM2_RANGE              0x0004
  ------------------
  977|       |
  978|  1.99k|    EC_POINT_clear_free(ret->pub_key);
  979|  1.99k|    ret->pub_key = EC_POINT_new(ret->group);
  980|  1.99k|    if (ret->pub_key == NULL) {
  ------------------
  |  Branch (980:9): [True: 0, False: 1.99k]
  ------------------
  981|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  982|      0|        goto err;
  983|      0|    }
  984|       |
  985|  1.99k|    if (priv_key->publicKey) {
  ------------------
  |  Branch (985:9): [True: 744, False: 1.25k]
  ------------------
  986|    744|        const unsigned char *pub_oct;
  987|    744|        int pub_oct_len;
  988|       |
  989|    744|        pub_oct = ASN1_STRING_get0_data(priv_key->publicKey);
  990|    744|        pub_oct_len = ASN1_STRING_length(priv_key->publicKey);
  991|    744|        if (!EC_KEY_oct2key(ret, pub_oct, pub_oct_len, NULL)) {
  ------------------
  |  Branch (991:13): [True: 323, False: 421]
  ------------------
  992|    323|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|    323|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    323|    (ERR_new(),                                                 \
  |  |  |  |  404|    323|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    323|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    323|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    323|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    323|     ERR_set_error)
  |  |  ------------------
  ------------------
  993|    323|            goto err;
  994|    323|        }
  995|  1.25k|    } else {
  996|  1.25k|        if (ret->group->meth->keygenpub == NULL
  ------------------
  |  Branch (996:13): [True: 0, False: 1.25k]
  ------------------
  997|  1.25k|            || ret->group->meth->keygenpub(ret) == 0)
  ------------------
  |  Branch (997:16): [True: 0, False: 1.25k]
  ------------------
  998|      0|                goto err;
  999|       |        /* Remember the original private-key-only encoding. */
 1000|  1.25k|        ret->enc_flag |= EC_PKEY_NO_PUBKEY;
  ------------------
  |  |  959|  1.25k|#  define EC_PKEY_NO_PUBKEY       0x002
  ------------------
 1001|  1.25k|    }
 1002|       |
 1003|  1.67k|    if (a)
  ------------------
  |  Branch (1003:9): [True: 31, False: 1.64k]
  ------------------
 1004|     31|        *a = ret;
 1005|  1.67k|    EC_PRIVATEKEY_free(priv_key);
 1006|  1.67k|    *in = p;
 1007|  1.67k|    ret->dirty_cnt++;
 1008|  1.67k|    return ret;
 1009|       |
 1010|    593| err:
 1011|    593|    if (a == NULL || *a != ret)
  ------------------
  |  Branch (1011:9): [True: 574, False: 19]
  |  Branch (1011:22): [True: 0, False: 19]
  ------------------
 1012|    574|        EC_KEY_free(ret);
 1013|    593|    EC_PRIVATEKEY_free(priv_key);
 1014|    593|    return NULL;
 1015|  1.99k|}
i2d_ECPrivateKey:
 1018|  1.30k|{
 1019|  1.30k|    int ret = 0, ok = 0;
 1020|  1.30k|    unsigned char *priv= NULL, *pub= NULL;
 1021|  1.30k|    size_t privlen = 0, publen = 0;
 1022|       |
 1023|  1.30k|    EC_PRIVATEKEY *priv_key = NULL;
 1024|       |
 1025|  1.30k|    if (a == NULL || a->group == NULL ||
  ------------------
  |  Branch (1025:9): [True: 0, False: 1.30k]
  |  Branch (1025:22): [True: 0, False: 1.30k]
  ------------------
 1026|  1.30k|        (!(a->enc_flag & EC_PKEY_NO_PUBKEY) && a->pub_key == NULL)) {
  ------------------
  |  |  959|  1.30k|#  define EC_PKEY_NO_PUBKEY       0x002
  ------------------
  |  Branch (1026:10): [True: 291, False: 1.00k]
  |  Branch (1026:48): [True: 0, False: 291]
  ------------------
 1027|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1028|      0|        goto err;
 1029|      0|    }
 1030|       |
 1031|  1.30k|    if ((priv_key = EC_PRIVATEKEY_new()) == NULL) {
  ------------------
  |  Branch (1031:9): [True: 0, False: 1.30k]
  ------------------
 1032|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1033|      0|        goto err;
 1034|      0|    }
 1035|       |
 1036|  1.30k|    priv_key->version = a->version;
 1037|       |
 1038|  1.30k|    privlen = EC_KEY_priv2buf(a, &priv);
 1039|       |
 1040|  1.30k|    if (privlen == 0) {
  ------------------
  |  Branch (1040:9): [True: 439, False: 861]
  ------------------
 1041|    439|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|    439|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    439|    (ERR_new(),                                                 \
  |  |  |  |  404|    439|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    439|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    439|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    439|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    439|     ERR_set_error)
  |  |  ------------------
  ------------------
 1042|    439|        goto err;
 1043|    439|    }
 1044|       |
 1045|    861|    ASN1_STRING_set0(priv_key->privateKey, priv, privlen);
 1046|    861|    priv = NULL;
 1047|       |
 1048|    861|    if (!(a->enc_flag & EC_PKEY_NO_PARAMETERS)) {
  ------------------
  |  |  958|    861|#  define EC_PKEY_NO_PARAMETERS   0x001
  ------------------
  |  Branch (1048:9): [True: 858, False: 3]
  ------------------
 1049|    858|        if ((priv_key->parameters =
  ------------------
  |  Branch (1049:13): [True: 0, False: 858]
  ------------------
 1050|    858|             EC_GROUP_get_ecpkparameters(a->group,
 1051|    858|                                        priv_key->parameters)) == NULL) {
 1052|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1053|      0|            goto err;
 1054|      0|        }
 1055|    858|    }
 1056|       |
 1057|    861|    if (!(a->enc_flag & EC_PKEY_NO_PUBKEY)) {
  ------------------
  |  |  959|    861|#  define EC_PKEY_NO_PUBKEY       0x002
  ------------------
  |  Branch (1057:9): [True: 280, False: 581]
  ------------------
 1058|    280|        priv_key->publicKey = ASN1_BIT_STRING_new();
 1059|    280|        if (priv_key->publicKey == NULL) {
  ------------------
  |  Branch (1059:13): [True: 0, False: 280]
  ------------------
 1060|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1061|      0|            goto err;
 1062|      0|        }
 1063|       |
 1064|    280|        publen = EC_KEY_key2buf(a, a->conv_form, &pub, NULL);
 1065|       |
 1066|    280|        if (publen == 0) {
  ------------------
  |  Branch (1066:13): [True: 9, False: 271]
  ------------------
 1067|      9|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      9|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      9|    (ERR_new(),                                                 \
  |  |  |  |  404|      9|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      9|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      9|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      9|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      9|     ERR_set_error)
  |  |  ------------------
  ------------------
 1068|      9|            goto err;
 1069|      9|        }
 1070|       |
 1071|    271|        ossl_asn1_string_set_bits_left(priv_key->publicKey, 0);
 1072|    271|        ASN1_STRING_set0(priv_key->publicKey, pub, publen);
 1073|    271|        pub = NULL;
 1074|    271|    }
 1075|       |
 1076|    852|    if ((ret = i2d_EC_PRIVATEKEY(priv_key, out)) == 0) {
  ------------------
  |  Branch (1076:9): [True: 0, False: 852]
  ------------------
 1077|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1078|      0|        goto err;
 1079|      0|    }
 1080|    852|    ok = 1;
 1081|  1.30k| err:
 1082|  1.30k|    OPENSSL_clear_free(priv, privlen);
  ------------------
  |  |  105|  1.30k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.30k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.30k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1083|  1.30k|    OPENSSL_free(pub);
  ------------------
  |  |  107|  1.30k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.30k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.30k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1084|  1.30k|    EC_PRIVATEKEY_free(priv_key);
 1085|  1.30k|    return (ok ? ret : 0);
  ------------------
  |  Branch (1085:13): [True: 852, False: 448]
  ------------------
 1086|    852|}
i2d_ECParameters:
 1089|    125|{
 1090|    125|    if (a == NULL) {
  ------------------
  |  Branch (1090:9): [True: 0, False: 125]
  ------------------
 1091|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1092|      0|        return 0;
 1093|      0|    }
 1094|    125|    return i2d_ECPKParameters(a->group, out);
 1095|    125|}
d2i_ECParameters:
 1098|  13.4k|{
 1099|  13.4k|    EC_KEY *ret;
 1100|       |
 1101|  13.4k|    if (in == NULL || *in == NULL) {
  ------------------
  |  Branch (1101:9): [True: 0, False: 13.4k]
  |  Branch (1101:23): [True: 0, False: 13.4k]
  ------------------
 1102|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1103|      0|        return NULL;
 1104|      0|    }
 1105|       |
 1106|  13.4k|    if (a == NULL || *a == NULL) {
  ------------------
  |  Branch (1106:9): [True: 11.7k, False: 1.72k]
  |  Branch (1106:22): [True: 0, False: 1.72k]
  ------------------
 1107|  11.7k|        if ((ret = EC_KEY_new()) == NULL) {
  ------------------
  |  Branch (1107:13): [True: 0, False: 11.7k]
  ------------------
 1108|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1109|      0|            return NULL;
 1110|      0|        }
 1111|  11.7k|    } else
 1112|  1.72k|        ret = *a;
 1113|       |
 1114|  13.4k|    if (!d2i_ECPKParameters(&ret->group, in, len)) {
  ------------------
  |  Branch (1114:9): [True: 12.5k, False: 868]
  ------------------
 1115|  12.5k|        if (a == NULL || *a != ret)
  ------------------
  |  Branch (1115:13): [True: 11.6k, False: 930]
  |  Branch (1115:26): [True: 0, False: 930]
  ------------------
 1116|  11.6k|             EC_KEY_free(ret);
 1117|    930|        else
 1118|    930|            ret->dirty_cnt++;
 1119|  12.5k|        return NULL;
 1120|  12.5k|    }
 1121|       |
 1122|    868|    if (EC_GROUP_get_curve_name(ret->group) == NID_sm2)
  ------------------
  |  | 1228|    868|#define NID_sm2         1172
  ------------------
  |  Branch (1122:9): [True: 1, False: 867]
  ------------------
 1123|      1|        EC_KEY_set_flags(ret, EC_FLAG_SM2_RANGE);
  ------------------
  |  |  962|      1|#  define EC_FLAG_SM2_RANGE              0x0004
  ------------------
 1124|       |
 1125|    868|    ret->dirty_cnt++;
 1126|       |
 1127|    868|    if (a)
  ------------------
  |  Branch (1127:9): [True: 796, False: 72]
  ------------------
 1128|    796|        *a = ret;
 1129|       |
 1130|    868|    return ret;
 1131|  13.4k|}
o2i_ECPublicKey:
 1134|  15.9k|{
 1135|  15.9k|    EC_KEY *ret = NULL;
 1136|       |
 1137|  15.9k|    if (a == NULL || (*a) == NULL || (*a)->group == NULL) {
  ------------------
  |  Branch (1137:9): [True: 0, False: 15.9k]
  |  Branch (1137:22): [True: 0, False: 15.9k]
  |  Branch (1137:38): [True: 0, False: 15.9k]
  ------------------
 1138|       |        /*
 1139|       |         * sorry, but a EC_GROUP-structure is necessary to set the public key
 1140|       |         */
 1141|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1142|      0|        return 0;
 1143|      0|    }
 1144|  15.9k|    ret = *a;
 1145|       |    /* EC_KEY_opt2key updates dirty_cnt */
 1146|  15.9k|    if (!EC_KEY_oct2key(ret, *in, len, NULL)) {
  ------------------
  |  Branch (1146:9): [True: 6.11k, False: 9.85k]
  ------------------
 1147|  6.11k|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|  6.11k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  6.11k|    (ERR_new(),                                                 \
  |  |  |  |  404|  6.11k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  6.11k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  6.11k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  6.11k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  6.11k|     ERR_set_error)
  |  |  ------------------
  ------------------
 1148|  6.11k|        return 0;
 1149|  6.11k|    }
 1150|  9.85k|    *in += len;
 1151|  9.85k|    return ret;
 1152|  15.9k|}
ECDSA_SIG_new:
 1196|  11.7k|{
 1197|  11.7k|    ECDSA_SIG *sig = OPENSSL_zalloc(sizeof(*sig));
  ------------------
  |  |   99|  11.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  11.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  11.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1198|       |
 1199|  11.7k|    return sig;
 1200|  11.7k|}
ECDSA_SIG_free:
 1203|  11.7k|{
 1204|  11.7k|    if (sig == NULL)
  ------------------
  |  Branch (1204:9): [True: 0, False: 11.7k]
  ------------------
 1205|      0|        return;
 1206|  11.7k|    BN_clear_free(sig->r);
 1207|  11.7k|    BN_clear_free(sig->s);
 1208|  11.7k|    OPENSSL_free(sig);
  ------------------
  |  |  107|  11.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  11.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  11.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1209|  11.7k|}
d2i_ECDSA_SIG:
 1212|  11.7k|{
 1213|  11.7k|    ECDSA_SIG *sig;
 1214|       |
 1215|  11.7k|    if (len < 0)
  ------------------
  |  Branch (1215:9): [True: 0, False: 11.7k]
  ------------------
 1216|      0|        return NULL;
 1217|  11.7k|    if (psig != NULL && *psig != NULL) {
  ------------------
  |  Branch (1217:9): [True: 0, False: 11.7k]
  |  Branch (1217:25): [True: 0, False: 0]
  ------------------
 1218|      0|        sig = *psig;
 1219|  11.7k|    } else {
 1220|  11.7k|        sig = ECDSA_SIG_new();
 1221|  11.7k|        if (sig == NULL)
  ------------------
  |  Branch (1221:13): [True: 0, False: 11.7k]
  ------------------
 1222|      0|            return NULL;
 1223|  11.7k|    }
 1224|  11.7k|    if (sig->r == NULL)
  ------------------
  |  Branch (1224:9): [True: 11.7k, False: 0]
  ------------------
 1225|  11.7k|        sig->r = BN_new();
 1226|  11.7k|    if (sig->s == NULL)
  ------------------
  |  Branch (1226:9): [True: 11.7k, False: 0]
  ------------------
 1227|  11.7k|        sig->s = BN_new();
 1228|  11.7k|    if (sig->r == NULL || sig->s == NULL
  ------------------
  |  Branch (1228:9): [True: 0, False: 11.7k]
  |  Branch (1228:27): [True: 0, False: 11.7k]
  ------------------
 1229|  11.7k|        || ossl_decode_der_dsa_sig(sig->r, sig->s, ppin, (size_t)len) == 0) {
  ------------------
  |  Branch (1229:12): [True: 11.7k, False: 16]
  ------------------
 1230|  11.7k|        if (psig == NULL || *psig == NULL)
  ------------------
  |  Branch (1230:13): [True: 11.7k, False: 0]
  |  Branch (1230:29): [True: 0, False: 0]
  ------------------
 1231|  11.7k|            ECDSA_SIG_free(sig);
 1232|  11.7k|        return NULL;
 1233|  11.7k|    }
 1234|     16|    if (psig != NULL && *psig == NULL)
  ------------------
  |  Branch (1234:9): [True: 0, False: 16]
  |  Branch (1234:25): [True: 0, False: 0]
  ------------------
 1235|      0|        *psig = sig;
 1236|     16|    return sig;
 1237|  11.7k|}
i2d_ECDSA_SIG:
 1240|  10.4k|{
 1241|  10.4k|    BUF_MEM *buf = NULL;
 1242|  10.4k|    size_t encoded_len;
 1243|  10.4k|    WPACKET pkt;
 1244|       |
 1245|  10.4k|    if (ppout == NULL) {
  ------------------
  |  Branch (1245:9): [True: 10.4k, False: 16]
  ------------------
 1246|  10.4k|        if (!WPACKET_init_null(&pkt, 0))
  ------------------
  |  Branch (1246:13): [True: 0, False: 10.4k]
  ------------------
 1247|      0|            return -1;
 1248|  10.4k|    } else if (*ppout == NULL) {
  ------------------
  |  Branch (1248:16): [True: 16, False: 0]
  ------------------
 1249|     16|        if ((buf = BUF_MEM_new()) == NULL
  ------------------
  |  Branch (1249:13): [True: 0, False: 16]
  ------------------
 1250|     16|                || !WPACKET_init_len(&pkt, buf, 0)) {
  ------------------
  |  Branch (1250:20): [True: 0, False: 16]
  ------------------
 1251|      0|            BUF_MEM_free(buf);
 1252|      0|            return -1;
 1253|      0|        }
 1254|     16|    } else {
 1255|      0|        if (!WPACKET_init_static_len(&pkt, *ppout, SIZE_MAX, 0))
  ------------------
  |  Branch (1255:13): [True: 0, False: 0]
  ------------------
 1256|      0|            return -1;
 1257|      0|    }
 1258|       |
 1259|  10.4k|    if (!ossl_encode_der_dsa_sig(&pkt, sig->r, sig->s)
  ------------------
  |  Branch (1259:9): [True: 0, False: 10.4k]
  ------------------
 1260|  10.4k|            || !WPACKET_get_total_written(&pkt, &encoded_len)
  ------------------
  |  Branch (1260:16): [True: 0, False: 10.4k]
  ------------------
 1261|  10.4k|            || !WPACKET_finish(&pkt)) {
  ------------------
  |  Branch (1261:16): [True: 0, False: 10.4k]
  ------------------
 1262|      0|        BUF_MEM_free(buf);
 1263|      0|        WPACKET_cleanup(&pkt);
 1264|      0|        return -1;
 1265|      0|    }
 1266|       |
 1267|  10.4k|    if (ppout != NULL) {
  ------------------
  |  Branch (1267:9): [True: 16, False: 10.4k]
  ------------------
 1268|     16|        if (*ppout == NULL) {
  ------------------
  |  Branch (1268:13): [True: 16, False: 0]
  ------------------
 1269|     16|            *ppout = (unsigned char *)buf->data;
 1270|     16|            buf->data = NULL;
 1271|     16|            BUF_MEM_free(buf);
 1272|     16|        } else {
 1273|      0|            *ppout += encoded_len;
 1274|      0|        }
 1275|     16|    }
 1276|       |
 1277|  10.4k|    return (int)encoded_len;
 1278|  10.4k|}
ECDSA_size:
 1310|  10.4k|{
 1311|  10.4k|    int ret;
 1312|  10.4k|    ECDSA_SIG sig;
 1313|  10.4k|    const EC_GROUP *group;
 1314|  10.4k|    const BIGNUM *bn;
 1315|       |
 1316|  10.4k|    if (ec == NULL)
  ------------------
  |  Branch (1316:9): [True: 0, False: 10.4k]
  ------------------
 1317|      0|        return 0;
 1318|  10.4k|    group = EC_KEY_get0_group(ec);
 1319|  10.4k|    if (group == NULL)
  ------------------
  |  Branch (1319:9): [True: 0, False: 10.4k]
  ------------------
 1320|      0|        return 0;
 1321|       |
 1322|  10.4k|    bn = EC_GROUP_get0_order(group);
 1323|  10.4k|    if (bn == NULL)
  ------------------
  |  Branch (1323:9): [True: 0, False: 10.4k]
  ------------------
 1324|      0|        return 0;
 1325|       |
 1326|  10.4k|    sig.r = sig.s = (BIGNUM *)bn;
 1327|  10.4k|    ret = i2d_ECDSA_SIG(&sig, NULL);
 1328|       |
 1329|  10.4k|    if (ret < 0)
  ------------------
  |  Branch (1329:9): [True: 0, False: 10.4k]
  ------------------
 1330|      0|        ret = 0;
 1331|  10.4k|    return ret;
 1332|  10.4k|}
ec_asn1.c:ec_asn1_group2fieldid:
  189|    225|{
  190|    225|    int ok = 0, nid;
  191|    225|    BIGNUM *tmp = NULL;
  192|       |
  193|    225|    if (group == NULL || field == NULL)
  ------------------
  |  Branch (193:9): [True: 0, False: 225]
  |  Branch (193:26): [True: 0, False: 225]
  ------------------
  194|      0|        return 0;
  195|       |
  196|       |    /* clear the old values (if necessary) */
  197|    225|    ASN1_OBJECT_free(field->fieldType);
  198|    225|    ASN1_TYPE_free(field->p.other);
  199|       |
  200|    225|    nid = EC_GROUP_get_field_type(group);
  201|       |    /* set OID for the field */
  202|    225|    if ((field->fieldType = OBJ_nid2obj(nid)) == NULL) {
  ------------------
  |  Branch (202:9): [True: 0, False: 225]
  ------------------
  203|      0|        ERR_raise(ERR_LIB_EC, ERR_R_OBJ_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  204|      0|        goto err;
  205|      0|    }
  206|       |
  207|    225|    if (nid == NID_X9_62_prime_field) {
  ------------------
  |  |  152|    225|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (207:9): [True: 225, False: 0]
  ------------------
  208|    225|        if ((tmp = BN_new()) == NULL) {
  ------------------
  |  Branch (208:13): [True: 0, False: 225]
  ------------------
  209|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  210|      0|            goto err;
  211|      0|        }
  212|       |        /* the parameters are specified by the prime number p */
  213|    225|        if (!EC_GROUP_get_curve(group, tmp, NULL, NULL, NULL)) {
  ------------------
  |  Branch (213:13): [True: 0, False: 225]
  ------------------
  214|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  215|      0|            goto err;
  216|      0|        }
  217|       |        /* set the prime number */
  218|    225|        field->p.prime = BN_to_ASN1_INTEGER(tmp, NULL);
  219|    225|        if (field->p.prime == NULL) {
  ------------------
  |  Branch (219:13): [True: 0, False: 225]
  ------------------
  220|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  221|      0|            goto err;
  222|      0|        }
  223|    225|    } else if (nid == NID_X9_62_characteristic_two_field)
  ------------------
  |  |  156|      0|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (223:16): [True: 0, False: 0]
  ------------------
  224|       |#ifdef OPENSSL_NO_EC2M
  225|       |    {
  226|       |        ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
  227|       |        goto err;
  228|       |    }
  229|       |#else
  230|      0|    {
  231|      0|        int field_type;
  232|      0|        X9_62_CHARACTERISTIC_TWO *char_two;
  233|       |
  234|      0|        field->p.char_two = X9_62_CHARACTERISTIC_TWO_new();
  235|      0|        char_two = field->p.char_two;
  236|       |
  237|      0|        if (char_two == NULL) {
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  239|      0|            goto err;
  240|      0|        }
  241|       |
  242|      0|        char_two->m = (long)EC_GROUP_get_degree(group);
  243|       |
  244|      0|        field_type = EC_GROUP_get_basis_type(group);
  245|       |
  246|      0|        if (field_type == 0) {
  ------------------
  |  Branch (246:13): [True: 0, False: 0]
  ------------------
  247|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  248|      0|            goto err;
  249|      0|        }
  250|       |        /* set base type OID */
  251|      0|        if ((char_two->type = OBJ_nid2obj(field_type)) == NULL) {
  ------------------
  |  Branch (251:13): [True: 0, False: 0]
  ------------------
  252|      0|            ERR_raise(ERR_LIB_EC, ERR_R_OBJ_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  253|      0|            goto err;
  254|      0|        }
  255|       |
  256|      0|        if (field_type == NID_X9_62_tpBasis) {
  ------------------
  |  |  168|      0|#define NID_X9_62_tpBasis               682
  ------------------
  |  Branch (256:13): [True: 0, False: 0]
  ------------------
  257|      0|            unsigned int k;
  258|       |
  259|      0|            if (!EC_GROUP_get_trinomial_basis(group, &k))
  ------------------
  |  Branch (259:17): [True: 0, False: 0]
  ------------------
  260|      0|                goto err;
  261|       |
  262|      0|            char_two->p.tpBasis = ASN1_INTEGER_new();
  263|      0|            if (char_two->p.tpBasis == NULL) {
  ------------------
  |  Branch (263:17): [True: 0, False: 0]
  ------------------
  264|      0|                ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  265|      0|                goto err;
  266|      0|            }
  267|      0|            if (!ASN1_INTEGER_set(char_two->p.tpBasis, (long)k)) {
  ------------------
  |  Branch (267:17): [True: 0, False: 0]
  ------------------
  268|      0|                ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  269|      0|                goto err;
  270|      0|            }
  271|      0|        } else if (field_type == NID_X9_62_ppBasis) {
  ------------------
  |  |  172|      0|#define NID_X9_62_ppBasis               683
  ------------------
  |  Branch (271:20): [True: 0, False: 0]
  ------------------
  272|      0|            unsigned int k1, k2, k3;
  273|       |
  274|      0|            if (!EC_GROUP_get_pentanomial_basis(group, &k1, &k2, &k3))
  ------------------
  |  Branch (274:17): [True: 0, False: 0]
  ------------------
  275|      0|                goto err;
  276|       |
  277|      0|            char_two->p.ppBasis = X9_62_PENTANOMIAL_new();
  278|      0|            if (char_two->p.ppBasis == NULL) {
  ------------------
  |  Branch (278:17): [True: 0, False: 0]
  ------------------
  279|      0|                ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  280|      0|                goto err;
  281|      0|            }
  282|       |
  283|       |            /* set k? values */
  284|      0|            char_two->p.ppBasis->k1 = (long)k1;
  285|      0|            char_two->p.ppBasis->k2 = (long)k2;
  286|      0|            char_two->p.ppBasis->k3 = (long)k3;
  287|      0|        } else {                /* field_type == NID_X9_62_onBasis */
  288|       |
  289|       |            /* for ONB the parameters are (asn1) NULL */
  290|      0|            char_two->p.onBasis = ASN1_NULL_new();
  291|      0|            if (char_two->p.onBasis == NULL) {
  ------------------
  |  Branch (291:17): [True: 0, False: 0]
  ------------------
  292|      0|                ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  293|      0|                goto err;
  294|      0|            }
  295|      0|        }
  296|      0|    }
  297|      0|#endif
  298|      0|    else {
  299|      0|        ERR_raise(ERR_LIB_EC, EC_R_UNSUPPORTED_FIELD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  300|      0|        goto err;
  301|      0|    }
  302|       |
  303|    225|    ok = 1;
  304|       |
  305|    225| err:
  306|    225|    BN_free(tmp);
  307|    225|    return ok;
  308|    225|}
ec_asn1.c:ec_asn1_group2curve:
  311|    225|{
  312|    225|    int ok = 0;
  313|    225|    BIGNUM *tmp_1 = NULL, *tmp_2 = NULL;
  314|    225|    unsigned char *a_buf = NULL, *b_buf = NULL;
  315|    225|    size_t len;
  316|       |
  317|    225|    if (!group || !curve || !curve->a || !curve->b)
  ------------------
  |  Branch (317:9): [True: 0, False: 225]
  |  Branch (317:19): [True: 0, False: 225]
  |  Branch (317:29): [True: 0, False: 225]
  |  Branch (317:42): [True: 0, False: 225]
  ------------------
  318|      0|        return 0;
  319|       |
  320|    225|    if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL) {
  ------------------
  |  Branch (320:9): [True: 0, False: 225]
  |  Branch (320:39): [True: 0, False: 225]
  ------------------
  321|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  322|      0|        goto err;
  323|      0|    }
  324|       |
  325|       |    /* get a and b */
  326|    225|    if (!EC_GROUP_get_curve(group, NULL, tmp_1, tmp_2, NULL)) {
  ------------------
  |  Branch (326:9): [True: 0, False: 225]
  ------------------
  327|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  328|      0|        goto err;
  329|      0|    }
  330|       |
  331|       |    /*
  332|       |     * Per SEC 1, the curve coefficients must be padded up to size. See C.2's
  333|       |     * definition of Curve, C.1's definition of FieldElement, and 2.3.5's
  334|       |     * definition of how to encode the field elements.
  335|       |     */
  336|    225|    len = ((size_t)EC_GROUP_get_degree(group) + 7) / 8;
  337|    225|    if ((a_buf = OPENSSL_malloc(len)) == NULL
  ------------------
  |  |   97|    225|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    225|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    225|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (337:9): [True: 0, False: 225]
  ------------------
  338|    225|        || (b_buf = OPENSSL_malloc(len)) == NULL)
  ------------------
  |  |   97|    225|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    225|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    225|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (338:12): [True: 0, False: 225]
  ------------------
  339|      0|        goto err;
  340|    225|    if (BN_bn2binpad(tmp_1, a_buf, len) < 0
  ------------------
  |  Branch (340:9): [True: 0, False: 225]
  ------------------
  341|    225|        || BN_bn2binpad(tmp_2, b_buf, len) < 0) {
  ------------------
  |  Branch (341:12): [True: 0, False: 225]
  ------------------
  342|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  343|      0|        goto err;
  344|      0|    }
  345|       |
  346|       |    /* set a and b */
  347|    225|    if (!ASN1_OCTET_STRING_set(curve->a, a_buf, len)
  ------------------
  |  Branch (347:9): [True: 0, False: 225]
  ------------------
  348|    225|        || !ASN1_OCTET_STRING_set(curve->b, b_buf, len)) {
  ------------------
  |  Branch (348:12): [True: 0, False: 225]
  ------------------
  349|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  350|      0|        goto err;
  351|      0|    }
  352|       |
  353|       |    /* set the seed (optional) */
  354|    225|    if (group->seed) {
  ------------------
  |  Branch (354:9): [True: 83, False: 142]
  ------------------
  355|     83|        if (!curve->seed)
  ------------------
  |  Branch (355:13): [True: 83, False: 0]
  ------------------
  356|     83|            if ((curve->seed = ASN1_BIT_STRING_new()) == NULL) {
  ------------------
  |  Branch (356:17): [True: 0, False: 83]
  ------------------
  357|      0|                ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  358|      0|                goto err;
  359|      0|            }
  360|     83|        ossl_asn1_string_set_bits_left(curve->seed, 0);
  361|     83|        if (!ASN1_BIT_STRING_set(curve->seed, group->seed,
  ------------------
  |  Branch (361:13): [True: 0, False: 83]
  ------------------
  362|     83|                                 (int)group->seed_len)) {
  363|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  364|      0|            goto err;
  365|      0|        }
  366|    142|    } else {
  367|    142|        ASN1_BIT_STRING_free(curve->seed);
  368|    142|        curve->seed = NULL;
  369|    142|    }
  370|       |
  371|    225|    ok = 1;
  372|       |
  373|    225| err:
  374|    225|    OPENSSL_free(a_buf);
  ------------------
  |  |  107|    225|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    225|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    225|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  375|    225|    OPENSSL_free(b_buf);
  ------------------
  |  |  107|    225|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    225|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    225|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  376|    225|    BN_free(tmp_1);
  377|    225|    BN_free(tmp_2);
  378|    225|    return ok;
  379|    225|}

ossl_ec_check_group_type_id2name:
   76|  10.4k|{
   77|  10.4k|    size_t i, sz;
   78|       |
   79|  10.4k|    for (i = 0, sz = OSSL_NELEM(check_group_type_nameid_map); i < sz; i++) {
  ------------------
  |  |   14|  10.4k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (79:63): [True: 10.4k, False: 0]
  ------------------
   80|  10.4k|        if (id == (int)check_group_type_nameid_map[i].id)
  ------------------
  |  Branch (80:13): [True: 10.4k, False: 0]
  ------------------
   81|  10.4k|            return check_group_type_nameid_map[i].ptr;
   82|  10.4k|    }
   83|      0|    return NULL;
   84|  10.4k|}
ossl_ec_pt_format_id2name:
  147|  20.8k|{
  148|  20.8k|    size_t i, sz;
  149|       |
  150|  34.0k|    for (i = 0, sz = OSSL_NELEM(format_nameid_map); i < sz; i++) {
  ------------------
  |  |   14|  20.8k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (150:53): [True: 32.4k, False: 1.53k]
  ------------------
  151|  32.4k|        if (id == (int)format_nameid_map[i].id)
  ------------------
  |  Branch (151:13): [True: 19.2k, False: 13.1k]
  ------------------
  152|  19.2k|            return format_nameid_map[i].ptr;
  153|  32.4k|    }
  154|  1.53k|    return NULL;
  155|  20.8k|}
ossl_ec_group_todata:
  293|  10.4k|{
  294|  10.4k|    int ret = 0, curve_nid, encoding_flag;
  295|  10.4k|    const char *encoding_name, *pt_form_name;
  296|  10.4k|    point_conversion_form_t genform;
  297|       |
  298|  10.4k|    if (group == NULL) {
  ------------------
  |  Branch (298:9): [True: 0, False: 10.4k]
  ------------------
  299|      0|        ERR_raise(ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  300|      0|        return 0;
  301|      0|    }
  302|       |
  303|  10.4k|    genform = EC_GROUP_get_point_conversion_form(group);
  304|  10.4k|    pt_form_name = ossl_ec_pt_format_id2name(genform);
  305|  10.4k|    if (pt_form_name == NULL
  ------------------
  |  Branch (305:9): [True: 0, False: 10.4k]
  ------------------
  306|  10.4k|        || !ossl_param_build_set_utf8_string(
  ------------------
  |  Branch (306:12): [True: 0, False: 10.4k]
  ------------------
  307|  10.4k|                tmpl, params,
  308|  10.4k|                OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT, pt_form_name)) {
  ------------------
  |  |  342|  10.4k|# define OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT "point-format"
  ------------------
  309|      0|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FORM);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  310|      0|        return 0;
  311|      0|    }
  312|  10.4k|    encoding_flag = EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE;
  ------------------
  |  |   31|  10.4k|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  313|  10.4k|    encoding_name = ec_param_encoding_id2name(encoding_flag);
  314|  10.4k|    if (encoding_name == NULL
  ------------------
  |  Branch (314:9): [True: 0, False: 10.4k]
  ------------------
  315|  10.4k|        || !ossl_param_build_set_utf8_string(tmpl, params,
  ------------------
  |  Branch (315:12): [True: 0, False: 10.4k]
  ------------------
  316|  10.4k|                                             OSSL_PKEY_PARAM_EC_ENCODING,
  ------------------
  |  |  335|  10.4k|# define OSSL_PKEY_PARAM_EC_ENCODING "encoding"
  ------------------
  317|  10.4k|                                             encoding_name)) {
  318|      0|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  319|      0|        return 0;
  320|      0|    }
  321|       |
  322|  10.4k|    if (!ossl_param_build_set_int(tmpl, params,
  ------------------
  |  Branch (322:9): [True: 0, False: 10.4k]
  ------------------
  323|  10.4k|                                  OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS,
  ------------------
  |  |  334|  10.4k|# define OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS "decoded-from-explicit"
  ------------------
  324|  10.4k|                                  group->decoded_from_explicit_params))
  325|      0|        return 0;
  326|       |
  327|  10.4k|    curve_nid = EC_GROUP_get_curve_name(group);
  328|       |
  329|       |    /*
  330|       |     * Get the explicit parameters in these two cases:
  331|       |     * - We do not have a template, i.e. specific parameters are requested
  332|       |     * - The curve is not a named curve
  333|       |     */
  334|  10.4k|    if (tmpl == NULL || curve_nid == NID_undef)
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (334:9): [True: 10.4k, False: 0]
  |  Branch (334:25): [True: 0, False: 0]
  ------------------
  335|  10.4k|        if (!ec_group_explicit_todata(group, tmpl, params, bnctx, genbuf))
  ------------------
  |  Branch (335:13): [True: 0, False: 10.4k]
  ------------------
  336|      0|            goto err;
  337|       |
  338|  10.4k|    if (curve_nid != NID_undef) {
  ------------------
  |  |   18|  10.4k|#define NID_undef                       0
  ------------------
  |  Branch (338:9): [True: 10.3k, False: 113]
  ------------------
  339|       |        /* Named curve */
  340|  10.3k|        const char *curve_name = OSSL_EC_curve_nid2name(curve_nid);
  341|       |
  342|  10.3k|        if (curve_name == NULL
  ------------------
  |  Branch (342:13): [True: 0, False: 10.3k]
  ------------------
  343|  10.3k|            || !ossl_param_build_set_utf8_string(tmpl, params,
  ------------------
  |  Branch (343:16): [True: 0, False: 10.3k]
  ------------------
  344|  10.3k|                                                 OSSL_PKEY_PARAM_GROUP_NAME,
  ------------------
  |  |  364|  10.3k|# define OSSL_PKEY_PARAM_GROUP_NAME "group"
  ------------------
  345|  10.3k|                                                 curve_name)) {
  346|      0|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_CURVE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  347|      0|            goto err;
  348|      0|        }
  349|  10.3k|    }
  350|  10.4k|    ret = 1;
  351|  10.4k|err:
  352|  10.4k|    return ret;
  353|  10.4k|}
ossl_ec_key_is_foreign:
  589|  9.85k|{
  590|  9.85k|#ifndef FIPS_MODULE
  591|  9.85k|    if (ec->engine != NULL || EC_KEY_get_method(ec) != EC_KEY_OpenSSL())
  ------------------
  |  Branch (591:9): [True: 0, False: 9.85k]
  |  Branch (591:31): [True: 0, False: 9.85k]
  ------------------
  592|      0|        return 1;
  593|  9.85k|#endif
  594|  9.85k|    return 0;
  595|       |
  596|  9.85k|}
ossl_x509_algor_is_sm2:
  739|  17.6k|{
  740|  17.6k|    int ptype = 0;
  741|  17.6k|    const void *pval = NULL;
  742|       |
  743|  17.6k|    X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  744|       |
  745|  17.6k|    if (ptype == V_ASN1_OBJECT)
  ------------------
  |  |   68|  17.6k|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (745:9): [True: 15.7k, False: 1.86k]
  ------------------
  746|  15.7k|        return OBJ_obj2nid((ASN1_OBJECT *)pval) == NID_sm2;
  ------------------
  |  | 1228|  15.7k|#define NID_sm2         1172
  ------------------
  747|       |
  748|  1.86k|    if (ptype == V_ASN1_SEQUENCE) {
  ------------------
  |  |   74|  1.86k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (748:9): [True: 1.74k, False: 119]
  ------------------
  749|  1.74k|        const ASN1_STRING *str = pval;
  750|  1.74k|        const unsigned char *der = str->data;
  751|  1.74k|        int derlen = str->length;
  752|  1.74k|        EC_GROUP *group;
  753|  1.74k|        int ret;
  754|       |
  755|  1.74k|        if ((group = d2i_ECPKParameters(NULL, &der, derlen)) == NULL)
  ------------------
  |  Branch (755:13): [True: 947, False: 798]
  ------------------
  756|    947|            ret = 0;
  757|    798|        else
  758|    798|            ret = (EC_GROUP_get_curve_name(group) == NID_sm2);
  ------------------
  |  | 1228|    798|#define NID_sm2         1172
  ------------------
  759|       |
  760|  1.74k|        EC_GROUP_free(group);
  761|  1.74k|        return ret;
  762|  1.74k|    }
  763|       |
  764|    119|    return 0;
  765|  1.86k|}
ossl_ec_key_param_from_x509_algor:
  769|  17.2k|{
  770|  17.2k|    int ptype = 0;
  771|  17.2k|    const void *pval = NULL;
  772|  17.2k|    EC_KEY *eckey = NULL;
  773|  17.2k|    EC_GROUP *group = NULL;
  774|       |
  775|  17.2k|    X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  776|  17.2k|    if ((eckey = EC_KEY_new_ex(libctx, propq)) == NULL) {
  ------------------
  |  Branch (776:9): [True: 0, False: 17.2k]
  ------------------
  777|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  778|      0|        goto ecerr;
  779|      0|    }
  780|       |
  781|  17.2k|    if (ptype == V_ASN1_SEQUENCE) {
  ------------------
  |  |   74|  17.2k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (781:9): [True: 1.72k, False: 15.4k]
  ------------------
  782|  1.72k|        const ASN1_STRING *pstr = pval;
  783|  1.72k|        const unsigned char *pm = pstr->data;
  784|  1.72k|        int pmlen = pstr->length;
  785|       |
  786|       |
  787|  1.72k|        if (d2i_ECParameters(&eckey, &pm, pmlen) == NULL) {
  ------------------
  |  Branch (787:13): [True: 930, False: 796]
  ------------------
  788|    930|            ERR_raise(ERR_LIB_EC, EC_R_DECODE_ERROR);
  ------------------
  |  |  401|    930|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    930|    (ERR_new(),                                                 \
  |  |  |  |  404|    930|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    930|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    930|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    930|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    930|     ERR_set_error)
  |  |  ------------------
  ------------------
  789|    930|            goto ecerr;
  790|    930|        }
  791|  15.4k|    } else if (ptype == V_ASN1_OBJECT) {
  ------------------
  |  |   68|  15.4k|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (791:16): [True: 15.3k, False: 95]
  ------------------
  792|  15.3k|        const ASN1_OBJECT *poid = pval;
  793|       |
  794|       |        /*
  795|       |         * type == V_ASN1_OBJECT => the parameters are given by an asn1 OID
  796|       |         */
  797|       |
  798|  15.3k|        group = EC_GROUP_new_by_curve_name_ex(libctx, propq, OBJ_obj2nid(poid));
  799|  15.3k|        if (group == NULL)
  ------------------
  |  Branch (799:13): [True: 161, False: 15.2k]
  ------------------
  800|    161|            goto ecerr;
  801|  15.2k|        EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
  ------------------
  |  |   31|  15.2k|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  802|  15.2k|        if (EC_KEY_set_group(eckey, group) == 0)
  ------------------
  |  Branch (802:13): [True: 0, False: 15.2k]
  ------------------
  803|      0|            goto ecerr;
  804|  15.2k|        EC_GROUP_free(group);
  805|  15.2k|    } else {
  806|     95|        ERR_raise(ERR_LIB_EC, EC_R_DECODE_ERROR);
  ------------------
  |  |  401|     95|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     95|    (ERR_new(),                                                 \
  |  |  |  |  404|     95|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     95|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     95|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     95|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     95|     ERR_set_error)
  |  |  ------------------
  ------------------
  807|     95|        goto ecerr;
  808|     95|    }
  809|       |
  810|  16.0k|    return eckey;
  811|       |
  812|  1.18k| ecerr:
  813|  1.18k|    EC_KEY_free(eckey);
  814|  1.18k|    EC_GROUP_free(group);
  815|  1.18k|    return NULL;
  816|  17.2k|}
ossl_ec_key_from_pkcs8:
  820|     77|{
  821|     77|    const unsigned char *p = NULL;
  822|     77|    int pklen;
  823|     77|    EC_KEY *eckey = NULL;
  824|     77|    const X509_ALGOR *palg;
  825|       |
  826|     77|    if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8inf))
  ------------------
  |  Branch (826:9): [True: 0, False: 77]
  ------------------
  827|      0|        return 0;
  828|     77|    eckey = ossl_ec_key_param_from_x509_algor(palg, libctx, propq);
  829|     77|    if (eckey == NULL)
  ------------------
  |  Branch (829:9): [True: 12, False: 65]
  ------------------
  830|     12|        goto err;
  831|       |
  832|       |    /* We have parameters now set private key */
  833|     65|    if (!d2i_ECPrivateKey(&eckey, &p, pklen)) {
  ------------------
  |  Branch (833:9): [True: 34, False: 31]
  ------------------
  834|     34|        ERR_raise(ERR_LIB_EC, EC_R_DECODE_ERROR);
  ------------------
  |  |  401|     34|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     34|    (ERR_new(),                                                 \
  |  |  |  |  404|     34|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     34|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     34|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     34|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     34|     ERR_set_error)
  |  |  ------------------
  ------------------
  835|     34|        goto err;
  836|     34|    }
  837|       |
  838|     31|    return eckey;
  839|     46| err:
  840|     46|    EC_KEY_free(eckey);
  841|     46|    return NULL;
  842|     65|}
ec_backend.c:ec_param_encoding_id2name:
   65|  10.4k|{
   66|  10.4k|    size_t i, sz;
   67|       |
   68|  20.7k|    for (i = 0, sz = OSSL_NELEM(encoding_nameid_map); i < sz; i++) {
  ------------------
  |  |   14|  10.4k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (68:55): [True: 20.7k, False: 0]
  ------------------
   69|  20.7k|        if (id == (int)encoding_nameid_map[i].id)
  ------------------
  |  Branch (69:13): [True: 10.4k, False: 10.3k]
  ------------------
   70|  10.4k|            return encoding_nameid_map[i].ptr;
   71|  20.7k|    }
   72|      0|    return NULL;
   73|  10.4k|}
ec_backend.c:ec_group_explicit_todata:
  160|  10.4k|{
  161|  10.4k|    int ret = 0, fid;
  162|  10.4k|    const char *field_type;
  163|  10.4k|    const OSSL_PARAM *param = NULL;
  164|  10.4k|    const OSSL_PARAM *param_p = NULL;
  165|  10.4k|    const OSSL_PARAM *param_a = NULL;
  166|  10.4k|    const OSSL_PARAM *param_b = NULL;
  167|       |
  168|  10.4k|    fid = EC_GROUP_get_field_type(group);
  169|       |
  170|  10.4k|    if (fid == NID_X9_62_prime_field) {
  ------------------
  |  |  152|  10.4k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (170:9): [True: 4.35k, False: 6.06k]
  ------------------
  171|  4.35k|        field_type = SN_X9_62_prime_field;
  ------------------
  |  |  151|  4.35k|#define SN_X9_62_prime_field            "prime-field"
  ------------------
  172|  6.06k|    } else if (fid == NID_X9_62_characteristic_two_field) {
  ------------------
  |  |  156|  6.06k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (172:16): [True: 6.06k, False: 0]
  ------------------
  173|       |#ifdef OPENSSL_NO_EC2M
  174|       |        ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
  175|       |        goto err;
  176|       |#else
  177|  6.06k|        field_type = SN_X9_62_characteristic_two_field;
  ------------------
  |  |  155|  6.06k|#define SN_X9_62_characteristic_two_field               "characteristic-two-field"
  ------------------
  178|  6.06k|#endif
  179|  6.06k|    } else {
  180|      0|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FIELD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  181|      0|        return 0;
  182|      0|    }
  183|       |
  184|  10.4k|    param_p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_P);
  ------------------
  |  |  341|  10.4k|# define OSSL_PKEY_PARAM_EC_P "p"
  ------------------
  185|  10.4k|    param_a = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_A);
  ------------------
  |  |  325|  10.4k|# define OSSL_PKEY_PARAM_EC_A "a"
  ------------------
  186|  10.4k|    param_b = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_B);
  ------------------
  |  |  326|  10.4k|# define OSSL_PKEY_PARAM_EC_B "b"
  ------------------
  187|  10.4k|    if (tmpl != NULL || param_p != NULL || param_a != NULL || param_b != NULL)
  ------------------
  |  Branch (187:9): [True: 0, False: 10.4k]
  |  Branch (187:25): [True: 0, False: 10.4k]
  |  Branch (187:44): [True: 0, False: 10.4k]
  |  Branch (187:63): [True: 0, False: 10.4k]
  ------------------
  188|      0|    {
  189|      0|        BIGNUM *p = BN_CTX_get(bnctx);
  190|      0|        BIGNUM *a = BN_CTX_get(bnctx);
  191|      0|        BIGNUM *b = BN_CTX_get(bnctx);
  192|       |
  193|      0|        if (b == NULL) {
  ------------------
  |  Branch (193:13): [True: 0, False: 0]
  ------------------
  194|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  195|      0|            goto err;
  196|      0|        }
  197|       |
  198|      0|        if (!EC_GROUP_get_curve(group, p, a, b, bnctx)) {
  ------------------
  |  Branch (198:13): [True: 0, False: 0]
  ------------------
  199|      0|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_CURVE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  200|      0|            goto err;
  201|      0|        }
  202|      0|        if (!ossl_param_build_set_bn(tmpl, params, OSSL_PKEY_PARAM_EC_P, p)
  ------------------
  |  |  341|      0|# define OSSL_PKEY_PARAM_EC_P "p"
  ------------------
  |  Branch (202:13): [True: 0, False: 0]
  ------------------
  203|      0|            || !ossl_param_build_set_bn(tmpl, params, OSSL_PKEY_PARAM_EC_A, a)
  ------------------
  |  |  325|      0|# define OSSL_PKEY_PARAM_EC_A "a"
  ------------------
  |  Branch (203:16): [True: 0, False: 0]
  ------------------
  204|      0|            || !ossl_param_build_set_bn(tmpl, params, OSSL_PKEY_PARAM_EC_B, b)) {
  ------------------
  |  |  326|      0|# define OSSL_PKEY_PARAM_EC_B "b"
  ------------------
  |  Branch (204:16): [True: 0, False: 0]
  ------------------
  205|      0|            ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  206|      0|            goto err;
  207|      0|        }
  208|      0|    }
  209|       |
  210|  10.4k|    param = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_ORDER);
  ------------------
  |  |  340|  10.4k|# define OSSL_PKEY_PARAM_EC_ORDER "order"
  ------------------
  211|  10.4k|    if (tmpl != NULL || param != NULL) {
  ------------------
  |  Branch (211:9): [True: 0, False: 10.4k]
  |  Branch (211:25): [True: 0, False: 10.4k]
  ------------------
  212|      0|        const BIGNUM *order = EC_GROUP_get0_order(group);
  213|       |
  214|      0|        if (order == NULL) {
  ------------------
  |  Branch (214:13): [True: 0, False: 0]
  ------------------
  215|      0|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  216|      0|            goto err;
  217|      0|        }
  218|      0|        if (!ossl_param_build_set_bn(tmpl, params, OSSL_PKEY_PARAM_EC_ORDER,
  ------------------
  |  |  340|      0|# define OSSL_PKEY_PARAM_EC_ORDER "order"
  ------------------
  |  Branch (218:13): [True: 0, False: 0]
  ------------------
  219|      0|                                    order)) {
  220|      0|            ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  221|      0|            goto err;
  222|      0|        }
  223|      0|    }
  224|       |
  225|  10.4k|    param = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_FIELD_TYPE);
  ------------------
  |  |  336|  10.4k|# define OSSL_PKEY_PARAM_EC_FIELD_TYPE "field-type"
  ------------------
  226|  10.4k|    if (tmpl != NULL || param != NULL) {
  ------------------
  |  Branch (226:9): [True: 0, False: 10.4k]
  |  Branch (226:25): [True: 0, False: 10.4k]
  ------------------
  227|      0|        if (!ossl_param_build_set_utf8_string(tmpl, params,
  ------------------
  |  Branch (227:13): [True: 0, False: 0]
  ------------------
  228|      0|                                              OSSL_PKEY_PARAM_EC_FIELD_TYPE,
  ------------------
  |  |  336|      0|# define OSSL_PKEY_PARAM_EC_FIELD_TYPE "field-type"
  ------------------
  229|      0|                                              field_type)) {
  230|      0|            ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  231|      0|            goto err;
  232|      0|        }
  233|      0|    }
  234|       |
  235|  10.4k|    param = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_GENERATOR);
  ------------------
  |  |  337|  10.4k|# define OSSL_PKEY_PARAM_EC_GENERATOR "generator"
  ------------------
  236|  10.4k|    if (tmpl != NULL || param != NULL) {
  ------------------
  |  Branch (236:9): [True: 0, False: 10.4k]
  |  Branch (236:25): [True: 0, False: 10.4k]
  ------------------
  237|      0|        size_t genbuf_len;
  238|      0|        const EC_POINT *genpt = EC_GROUP_get0_generator(group);
  239|      0|        point_conversion_form_t genform = EC_GROUP_get_point_conversion_form(group);
  240|       |
  241|      0|        if (genpt == NULL) {
  ------------------
  |  Branch (241:13): [True: 0, False: 0]
  ------------------
  242|      0|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_GENERATOR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  243|      0|            goto err;
  244|      0|        }
  245|      0|        genbuf_len = EC_POINT_point2buf(group, genpt, genform, genbuf, bnctx);
  246|      0|        if (genbuf_len == 0) {
  ------------------
  |  Branch (246:13): [True: 0, False: 0]
  ------------------
  247|      0|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_GENERATOR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  248|      0|            goto err;
  249|      0|        }
  250|      0|        if (!ossl_param_build_set_octet_string(tmpl, params,
  ------------------
  |  Branch (250:13): [True: 0, False: 0]
  ------------------
  251|      0|                                               OSSL_PKEY_PARAM_EC_GENERATOR,
  ------------------
  |  |  337|      0|# define OSSL_PKEY_PARAM_EC_GENERATOR "generator"
  ------------------
  252|      0|                                               *genbuf, genbuf_len)) {
  253|      0|            ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  254|      0|            goto err;
  255|      0|        }
  256|      0|    }
  257|       |
  258|  10.4k|    param = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_COFACTOR);
  ------------------
  |  |  333|  10.4k|# define OSSL_PKEY_PARAM_EC_COFACTOR "cofactor"
  ------------------
  259|  10.4k|    if (tmpl != NULL || param != NULL) {
  ------------------
  |  Branch (259:9): [True: 0, False: 10.4k]
  |  Branch (259:25): [True: 0, False: 10.4k]
  ------------------
  260|      0|        const BIGNUM *cofactor = EC_GROUP_get0_cofactor(group);
  261|       |
  262|      0|        if (cofactor != NULL
  ------------------
  |  Branch (262:13): [True: 0, False: 0]
  ------------------
  263|      0|            && !ossl_param_build_set_bn(tmpl, params,
  ------------------
  |  Branch (263:16): [True: 0, False: 0]
  ------------------
  264|      0|                                        OSSL_PKEY_PARAM_EC_COFACTOR, cofactor)) {
  ------------------
  |  |  333|      0|# define OSSL_PKEY_PARAM_EC_COFACTOR "cofactor"
  ------------------
  265|      0|            ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  266|      0|            goto err;
  267|      0|        }
  268|      0|    }
  269|       |
  270|  10.4k|    param = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_SEED);
  ------------------
  |  |  345|  10.4k|# define OSSL_PKEY_PARAM_EC_SEED "seed"
  ------------------
  271|  10.4k|    if (tmpl != NULL || param != NULL) {
  ------------------
  |  Branch (271:9): [True: 0, False: 10.4k]
  |  Branch (271:25): [True: 0, False: 10.4k]
  ------------------
  272|      0|        unsigned char *seed = EC_GROUP_get0_seed(group);
  273|      0|        size_t seed_len = EC_GROUP_get_seed_len(group);
  274|       |
  275|      0|        if (seed != NULL
  ------------------
  |  Branch (275:13): [True: 0, False: 0]
  ------------------
  276|      0|            && seed_len > 0
  ------------------
  |  Branch (276:16): [True: 0, False: 0]
  ------------------
  277|      0|            && !ossl_param_build_set_octet_string(tmpl, params,
  ------------------
  |  Branch (277:16): [True: 0, False: 0]
  ------------------
  278|      0|                                                  OSSL_PKEY_PARAM_EC_SEED,
  ------------------
  |  |  345|      0|# define OSSL_PKEY_PARAM_EC_SEED "seed"
  ------------------
  279|      0|                                                  seed, seed_len)) {
  280|      0|            ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  281|      0|            goto err;
  282|      0|        }
  283|      0|    }
  284|  10.4k|    ret = 1;
  285|  10.4k|err:
  286|  10.4k|    return ret;
  287|  10.4k|}

EC_GROUP_new_by_curve_name_ex:
 3291|  17.5k|{
 3292|  17.5k|    EC_GROUP *ret = NULL;
 3293|  17.5k|    const ec_list_element *curve;
 3294|       |
 3295|  17.5k|    if ((curve = ec_curve_nid2curve(nid)) == NULL
  ------------------
  |  Branch (3295:9): [True: 609, False: 16.9k]
  ------------------
 3296|  17.5k|        || (ret = ec_group_new_from_data(libctx, propq, *curve)) == NULL) {
  ------------------
  |  Branch (3296:12): [True: 0, False: 16.9k]
  ------------------
 3297|    609|#ifndef FIPS_MODULE
 3298|    609|        ERR_raise_data(ERR_LIB_EC, EC_R_UNKNOWN_GROUP,
  ------------------
  |  |  403|    609|    (ERR_new(),                                                 \
  |  |  404|    609|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|    609|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|    609|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|    609|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|    609|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_EC, EC_R_UNKNOWN_GROUP,
  ------------------
  |  |   86|    609|# define ERR_LIB_EC              16
  ------------------
                      ERR_raise_data(ERR_LIB_EC, EC_R_UNKNOWN_GROUP,
  ------------------
  |  |   97|    609|#  define EC_R_UNKNOWN_GROUP                               129
  ------------------
 3299|    609|                       "name=%s", OBJ_nid2sn(nid));
 3300|       |#else
 3301|       |        ERR_raise(ERR_LIB_EC, EC_R_UNKNOWN_GROUP);
 3302|       |#endif
 3303|    609|        return NULL;
 3304|    609|    }
 3305|       |
 3306|  16.9k|    return ret;
 3307|  17.5k|}
EC_GROUP_new_by_curve_name:
 3311|  2.16k|{
 3312|  2.16k|    return EC_GROUP_new_by_curve_name_ex(NULL, NULL, nid);
 3313|  2.16k|}
EC_curve_nid2nist:
 3334|    824|{
 3335|    824|    return ossl_ec_curve_nid2nist_int(nid);
 3336|    824|}
ossl_ec_curve_nid_from_params:
 3353|  2.00k|{
 3354|  2.00k|    int ret = -1, nid, len, field_type, param_len;
 3355|  2.00k|    size_t i, seed_len;
 3356|  2.00k|    const unsigned char *seed, *params_seed, *params;
 3357|  2.00k|    unsigned char *param_bytes = NULL;
 3358|  2.00k|    const EC_CURVE_DATA *data;
 3359|  2.00k|    const EC_POINT *generator = NULL;
 3360|  2.00k|    const BIGNUM *cofactor = NULL;
 3361|       |    /* An array of BIGNUMs for (p, a, b, x, y, order) */
 3362|  2.00k|    BIGNUM *bn[NUM_BN_FIELDS] = {NULL, NULL, NULL, NULL, NULL, NULL};
 3363|       |
 3364|       |    /* Use the optional named curve nid as a search field */
 3365|  2.00k|    nid = EC_GROUP_get_curve_name(group);
 3366|  2.00k|    field_type = EC_GROUP_get_field_type(group);
 3367|  2.00k|    seed_len = EC_GROUP_get_seed_len(group);
 3368|  2.00k|    seed = EC_GROUP_get0_seed(group);
 3369|  2.00k|    cofactor = EC_GROUP_get0_cofactor(group);
 3370|       |
 3371|  2.00k|    BN_CTX_start(ctx);
 3372|       |
 3373|       |    /*
 3374|       |     * The built-in curves contains data fields (p, a, b, x, y, order) that are
 3375|       |     * all zero-padded to be the same size. The size of the padding is
 3376|       |     * determined by either the number of bytes in the field modulus (p) or the
 3377|       |     * EC group order, whichever is larger.
 3378|       |     */
 3379|  2.00k|    param_len = BN_num_bytes(group->order);
  ------------------
  |  |  189|  2.00k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
 3380|  2.00k|    len = BN_num_bytes(group->field);
  ------------------
  |  |  189|  2.00k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
 3381|  2.00k|    if (len > param_len)
  ------------------
  |  Branch (3381:9): [True: 359, False: 1.64k]
  ------------------
 3382|    359|        param_len = len;
 3383|       |
 3384|       |    /* Allocate space to store the padded data for (p, a, b, x, y, order)  */
 3385|  2.00k|    param_bytes = OPENSSL_malloc(param_len * NUM_BN_FIELDS);
  ------------------
  |  |   97|  2.00k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.00k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.00k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 3386|  2.00k|    if (param_bytes == NULL)
  ------------------
  |  Branch (3386:9): [True: 0, False: 2.00k]
  ------------------
 3387|      0|        goto end;
 3388|       |
 3389|       |    /* Create the bignums */
 3390|  14.0k|    for (i = 0; i < NUM_BN_FIELDS; ++i) {
  ------------------
  |  | 3343|  14.0k|#define NUM_BN_FIELDS 6
  ------------------
  |  Branch (3390:17): [True: 12.0k, False: 2.00k]
  ------------------
 3391|  12.0k|        if ((bn[i] = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (3391:13): [True: 0, False: 12.0k]
  ------------------
 3392|      0|            goto end;
 3393|  12.0k|    }
 3394|       |    /*
 3395|       |     * Fill in the bn array with the same values as the internal curves
 3396|       |     * i.e. the values are p, a, b, x, y, order.
 3397|       |     */
 3398|       |    /* Get p, a & b */
 3399|  2.00k|    if (!(EC_GROUP_get_curve(group, bn[0], bn[1], bn[2], ctx)
  ------------------
  |  Branch (3399:11): [True: 2.00k, False: 0]
  ------------------
 3400|  2.00k|        && ((generator = EC_GROUP_get0_generator(group)) != NULL)
  ------------------
  |  Branch (3400:12): [True: 2.00k, False: 0]
  ------------------
 3401|       |        /* Get x & y */
 3402|  2.00k|        && EC_POINT_get_affine_coordinates(group, generator, bn[3], bn[4], ctx)
  ------------------
  |  Branch (3402:12): [True: 1.99k, False: 12]
  ------------------
 3403|       |        /* Get order */
 3404|  2.00k|        && EC_GROUP_get_order(group, bn[5], ctx)))
  ------------------
  |  Branch (3404:12): [True: 1.99k, False: 0]
  ------------------
 3405|     12|        goto end;
 3406|       |
 3407|       |   /*
 3408|       |     * Convert the bignum array to bytes that are joined together to form
 3409|       |     * a single buffer that contains data for all fields.
 3410|       |     * (p, a, b, x, y, order) are all zero padded to be the same size.
 3411|       |     */
 3412|  13.9k|    for (i = 0; i < NUM_BN_FIELDS; ++i) {
  ------------------
  |  | 3343|  13.9k|#define NUM_BN_FIELDS 6
  ------------------
  |  Branch (3412:17): [True: 11.9k, False: 1.99k]
  ------------------
 3413|  11.9k|        if (BN_bn2binpad(bn[i], &param_bytes[i*param_len], param_len) <= 0)
  ------------------
  |  Branch (3413:13): [True: 0, False: 11.9k]
  ------------------
 3414|      0|            goto end;
 3415|  11.9k|    }
 3416|       |
 3417|   164k|    for (i = 0; i < curve_list_length; i++) {
  ------------------
  |  | 3126|   164k|#define curve_list_length OSSL_NELEM(curve_list)
  |  |  ------------------
  |  |  |  |   14|   164k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
  |  Branch (3417:17): [True: 162k, False: 1.97k]
  ------------------
 3418|   162k|        const ec_list_element curve = curve_list[i];
 3419|       |
 3420|   162k|        data = curve.data;
 3421|       |        /* Get the raw order byte data */
 3422|   162k|        params_seed = (const unsigned char *)(data + 1); /* skip header */
 3423|   162k|        params = params_seed + data->seed_len;
 3424|       |
 3425|       |        /* Look for unique fields in the fixed curve data */
 3426|   162k|        if (data->field_type == field_type
  ------------------
  |  Branch (3426:13): [True: 79.2k, False: 83.0k]
  ------------------
 3427|   162k|            && param_len == data->param_len
  ------------------
  |  Branch (3427:16): [True: 7.77k, False: 71.4k]
  ------------------
 3428|   162k|            && (nid <= 0 || nid == curve.nid)
  ------------------
  |  Branch (3428:17): [True: 7.77k, False: 0]
  |  Branch (3428:29): [True: 0, False: 0]
  ------------------
 3429|       |            /* check the optional cofactor (ignore if its zero) */
 3430|   162k|            && (BN_is_zero(cofactor)
  ------------------
  |  Branch (3430:17): [True: 1.20k, False: 6.56k]
  ------------------
 3431|  7.77k|                || BN_is_word(cofactor, (const BN_ULONG)curve.data->cofactor))
  ------------------
  |  Branch (3431:20): [True: 6.17k, False: 396]
  ------------------
 3432|       |            /* Check the optional seed (ignore if its not set) */
 3433|   162k|            && (data->seed_len == 0 || seed_len == 0
  ------------------
  |  Branch (3433:17): [True: 5.53k, False: 1.84k]
  |  Branch (3433:40): [True: 1.84k, False: 0]
  ------------------
 3434|  7.37k|                || ((size_t)data->seed_len == seed_len
  ------------------
  |  Branch (3434:21): [True: 0, False: 0]
  ------------------
 3435|      0|                     && memcmp(params_seed, seed, seed_len) == 0))
  ------------------
  |  Branch (3435:25): [True: 0, False: 0]
  ------------------
 3436|       |            /* Check that the groups params match the built-in curve params */
 3437|   162k|            && memcmp(param_bytes, params, param_len * NUM_BN_FIELDS)
  ------------------
  |  | 3343|  7.37k|#define NUM_BN_FIELDS 6
  ------------------
  |  Branch (3437:16): [True: 15, False: 7.36k]
  ------------------
 3438|  7.37k|                             == 0) {
 3439|     15|            ret = curve.nid;
 3440|     15|            goto end;
 3441|     15|        }
 3442|   162k|    }
 3443|       |    /* Gets here if the group was not found */
 3444|  1.97k|    ret = NID_undef;
  ------------------
  |  |   18|  1.97k|#define NID_undef                       0
  ------------------
 3445|  2.00k|end:
 3446|  2.00k|    OPENSSL_free(param_bytes);
  ------------------
  |  |  107|  2.00k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.00k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.00k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 3447|  2.00k|    BN_CTX_end(ctx);
 3448|  2.00k|    return ret;
 3449|  1.97k|}
ec_curve.c:ec_curve_nid2curve:
 3129|  17.5k|{
 3130|  17.5k|    size_t i;
 3131|       |
 3132|  17.5k|    if (nid <= 0)
  ------------------
  |  Branch (3132:9): [True: 560, False: 17.0k]
  ------------------
 3133|    560|        return NULL;
 3134|       |
 3135|   575k|    for (i = 0; i < curve_list_length; i++) {
  ------------------
  |  | 3126|   575k|#define curve_list_length OSSL_NELEM(curve_list)
  |  |  ------------------
  |  |  |  |   14|   575k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
  |  Branch (3135:17): [True: 575k, False: 49]
  ------------------
 3136|   575k|        if (curve_list[i].nid == nid)
  ------------------
  |  Branch (3136:13): [True: 16.9k, False: 558k]
  ------------------
 3137|  16.9k|            return &curve_list[i];
 3138|   575k|    }
 3139|     49|    return NULL;
 3140|  17.0k|}
ec_curve.c:ec_group_new_from_data:
 3145|  16.9k|{
 3146|  16.9k|    EC_GROUP *group = NULL;
 3147|  16.9k|    EC_POINT *P = NULL;
 3148|  16.9k|    BN_CTX *ctx = NULL;
 3149|  16.9k|    BIGNUM *p = NULL, *a = NULL, *b = NULL, *x = NULL, *y = NULL, *order =
 3150|  16.9k|        NULL;
 3151|  16.9k|    int ok = 0;
 3152|  16.9k|    int seed_len, param_len;
 3153|  16.9k|    const EC_METHOD *meth;
 3154|  16.9k|    const EC_CURVE_DATA *data;
 3155|  16.9k|    const unsigned char *params;
 3156|       |
 3157|       |    /* If no curve data curve method must handle everything */
 3158|  16.9k|    if (curve.data == NULL)
  ------------------
  |  Branch (3158:9): [True: 0, False: 16.9k]
  ------------------
 3159|      0|        return ossl_ec_group_new_ex(libctx, propq,
 3160|      0|                                    curve.meth != NULL ? curve.meth() : NULL);
  ------------------
  |  Branch (3160:37): [True: 0, False: 0]
  ------------------
 3161|       |
 3162|  16.9k|    if ((ctx = BN_CTX_new_ex(libctx)) == NULL) {
  ------------------
  |  Branch (3162:9): [True: 0, False: 16.9k]
  ------------------
 3163|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3164|      0|        goto err;
 3165|      0|    }
 3166|       |
 3167|  16.9k|    data = curve.data;
 3168|  16.9k|    seed_len = data->seed_len;
 3169|  16.9k|    param_len = data->param_len;
 3170|  16.9k|    params = (const unsigned char *)(data + 1); /* skip header */
 3171|  16.9k|    params += seed_len;         /* skip seed */
 3172|       |
 3173|  16.9k|    if ((p = BN_bin2bn(params + 0 * param_len, param_len, NULL)) == NULL
  ------------------
  |  Branch (3173:9): [True: 0, False: 16.9k]
  ------------------
 3174|  16.9k|        || (a = BN_bin2bn(params + 1 * param_len, param_len, NULL)) == NULL
  ------------------
  |  Branch (3174:12): [True: 0, False: 16.9k]
  ------------------
 3175|  16.9k|        || (b = BN_bin2bn(params + 2 * param_len, param_len, NULL)) == NULL) {
  ------------------
  |  Branch (3175:12): [True: 0, False: 16.9k]
  ------------------
 3176|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3177|      0|        goto err;
 3178|      0|    }
 3179|       |
 3180|  16.9k|    if (curve.meth != 0) {
  ------------------
  |  Branch (3180:9): [True: 4.56k, False: 12.3k]
  ------------------
 3181|  4.56k|        meth = curve.meth();
 3182|  4.56k|        if (((group = ossl_ec_group_new_ex(libctx, propq, meth)) == NULL) ||
  ------------------
  |  Branch (3182:13): [True: 0, False: 4.56k]
  ------------------
 3183|  4.56k|            (!(group->meth->group_set_curve(group, p, a, b, ctx)))) {
  ------------------
  |  Branch (3183:13): [True: 0, False: 4.56k]
  ------------------
 3184|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3185|      0|            goto err;
 3186|      0|        }
 3187|  12.3k|    } else if (data->field_type == NID_X9_62_prime_field) {
  ------------------
  |  |  152|  12.3k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (3187:16): [True: 2.68k, False: 9.70k]
  ------------------
 3188|  2.68k|        if ((group = EC_GROUP_new_curve_GFp(p, a, b, ctx)) == NULL) {
  ------------------
  |  Branch (3188:13): [True: 0, False: 2.68k]
  ------------------
 3189|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3190|      0|            goto err;
 3191|      0|        }
 3192|  2.68k|    }
 3193|  9.70k|#ifndef OPENSSL_NO_EC2M
 3194|  9.70k|    else {                      /* field_type ==
 3195|       |                                 * NID_X9_62_characteristic_two_field */
 3196|       |
 3197|  9.70k|        if ((group = EC_GROUP_new_curve_GF2m(p, a, b, ctx)) == NULL) {
  ------------------
  |  Branch (3197:13): [True: 0, False: 9.70k]
  ------------------
 3198|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3199|      0|            goto err;
 3200|      0|        }
 3201|  9.70k|    }
 3202|  16.9k|#endif
 3203|       |
 3204|  16.9k|    EC_GROUP_set_curve_name(group, curve.nid);
 3205|       |
 3206|  16.9k|    if ((P = EC_POINT_new(group)) == NULL) {
  ------------------
  |  Branch (3206:9): [True: 0, False: 16.9k]
  ------------------
 3207|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3208|      0|        goto err;
 3209|      0|    }
 3210|       |
 3211|  16.9k|    if ((x = BN_bin2bn(params + 3 * param_len, param_len, NULL)) == NULL
  ------------------
  |  Branch (3211:9): [True: 0, False: 16.9k]
  ------------------
 3212|  16.9k|        || (y = BN_bin2bn(params + 4 * param_len, param_len, NULL)) == NULL) {
  ------------------
  |  Branch (3212:12): [True: 0, False: 16.9k]
  ------------------
 3213|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3214|      0|        goto err;
 3215|      0|    }
 3216|  16.9k|    if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) {
  ------------------
  |  Branch (3216:9): [True: 0, False: 16.9k]
  ------------------
 3217|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3218|      0|        goto err;
 3219|      0|    }
 3220|  16.9k|    if ((order = BN_bin2bn(params + 5 * param_len, param_len, NULL)) == NULL
  ------------------
  |  Branch (3220:9): [True: 0, False: 16.9k]
  ------------------
 3221|  16.9k|        || !BN_set_word(x, (BN_ULONG)data->cofactor)) {
  ------------------
  |  Branch (3221:12): [True: 0, False: 16.9k]
  ------------------
 3222|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3223|      0|        goto err;
 3224|      0|    }
 3225|  16.9k|    if (!EC_GROUP_set_generator(group, P, order, x)) {
  ------------------
  |  Branch (3225:9): [True: 0, False: 16.9k]
  ------------------
 3226|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3227|      0|        goto err;
 3228|      0|    }
 3229|  16.9k|    if (seed_len) {
  ------------------
  |  Branch (3229:9): [True: 7.25k, False: 9.69k]
  ------------------
 3230|  7.25k|        if (!EC_GROUP_set_seed(group, params - seed_len, seed_len)) {
  ------------------
  |  Branch (3230:13): [True: 0, False: 7.25k]
  ------------------
 3231|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3232|      0|            goto err;
 3233|      0|        }
 3234|  7.25k|    }
 3235|       |
 3236|  16.9k|#ifndef FIPS_MODULE
 3237|  16.9k|    if (EC_GROUP_get_asn1_flag(group) == OPENSSL_EC_NAMED_CURVE) {
  ------------------
  |  |   31|  16.9k|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  |  Branch (3237:9): [True: 16.9k, False: 0]
  ------------------
 3238|       |        /*
 3239|       |         * Some curves don't have an associated OID: for those we should not
 3240|       |         * default to `OPENSSL_EC_NAMED_CURVE` encoding of parameters and
 3241|       |         * instead set the ASN1 flag to `OPENSSL_EC_EXPLICIT_CURVE`.
 3242|       |         *
 3243|       |         * Note that `OPENSSL_EC_NAMED_CURVE` is set as the default ASN1 flag on
 3244|       |         * `EC_GROUP_new()`, when we don't have enough elements to determine if
 3245|       |         * an OID for the curve name actually exists.
 3246|       |         * We could implement this check on `EC_GROUP_set_curve_name()` but
 3247|       |         * overloading the simple setter with this lookup could have a negative
 3248|       |         * performance impact and unexpected consequences.
 3249|       |         */
 3250|  16.9k|        ASN1_OBJECT *asn1obj = OBJ_nid2obj(curve.nid);
 3251|       |
 3252|  16.9k|        if (asn1obj == NULL) {
  ------------------
  |  Branch (3252:13): [True: 0, False: 16.9k]
  ------------------
 3253|      0|            ERR_raise(ERR_LIB_EC, ERR_R_OBJ_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 3254|      0|            goto err;
 3255|      0|        }
 3256|  16.9k|        if (OBJ_length(asn1obj) == 0)
  ------------------
  |  Branch (3256:13): [True: 0, False: 16.9k]
  ------------------
 3257|      0|            EC_GROUP_set_asn1_flag(group, OPENSSL_EC_EXPLICIT_CURVE);
  ------------------
  |  |   30|      0|# define OPENSSL_EC_EXPLICIT_CURVE  0x000
  ------------------
 3258|       |
 3259|  16.9k|        ASN1_OBJECT_free(asn1obj);
 3260|  16.9k|    }
 3261|       |#else
 3262|       |    /*
 3263|       |     * Inside the FIPS module we do not support explicit curves anyway
 3264|       |     * so the above check is not necessary.
 3265|       |     *
 3266|       |     * Skipping it is also necessary because `OBJ_length()` and
 3267|       |     * `ASN1_OBJECT_free()` are not available within the FIPS module
 3268|       |     * boundaries.
 3269|       |     */
 3270|       |#endif
 3271|       |
 3272|  16.9k|    ok = 1;
 3273|  16.9k| err:
 3274|  16.9k|    if (!ok) {
  ------------------
  |  Branch (3274:9): [True: 0, False: 16.9k]
  ------------------
 3275|      0|        EC_GROUP_free(group);
 3276|      0|        group = NULL;
 3277|      0|    }
 3278|  16.9k|    EC_POINT_free(P);
 3279|  16.9k|    BN_CTX_free(ctx);
 3280|  16.9k|    BN_free(p);
 3281|  16.9k|    BN_free(a);
 3282|  16.9k|    BN_free(b);
 3283|  16.9k|    BN_free(order);
 3284|  16.9k|    BN_free(x);
 3285|  16.9k|    BN_free(y);
 3286|  16.9k|    return group;
 3287|  16.9k|}

EC_GROUP_new_curve_GFp:
   23|  5.82k|{
   24|  5.82k|    const EC_METHOD *meth;
   25|  5.82k|    EC_GROUP *ret;
   26|       |
   27|  5.82k|#if defined(OPENSSL_BN_ASM_MONT)
   28|       |    /*
   29|       |     * This might appear controversial, but the fact is that generic
   30|       |     * prime method was observed to deliver better performance even
   31|       |     * for NIST primes on a range of platforms, e.g.: 60%-15%
   32|       |     * improvement on IA-64, ~25% on ARM, 30%-90% on P4, 20%-25%
   33|       |     * in 32-bit build and 35%--12% in 64-bit build on Core2...
   34|       |     * Coefficients are relative to optimized bn_nist.c for most
   35|       |     * intensive ECDSA verify and ECDH operations for 192- and 521-
   36|       |     * bit keys respectively. Choice of these boundary values is
   37|       |     * arguable, because the dependency of improvement coefficient
   38|       |     * from key length is not a "monotone" curve. For example while
   39|       |     * 571-bit result is 23% on ARM, 384-bit one is -1%. But it's
   40|       |     * generally faster, sometimes "respectfully" faster, sometimes
   41|       |     * "tolerably" slower... What effectively happens is that loop
   42|       |     * with bn_mul_add_words is put against bn_mul_mont, and the
   43|       |     * latter "wins" on short vectors. Correct solution should be
   44|       |     * implementing dedicated NxN multiplication subroutines for
   45|       |     * small N. But till it materializes, let's stick to generic
   46|       |     * prime method...
   47|       |     *                                              <appro>
   48|       |     */
   49|  5.82k|    meth = EC_GFp_mont_method();
   50|       |#else
   51|       |    if (BN_nist_mod_func(p))
   52|       |        meth = EC_GFp_nist_method();
   53|       |    else
   54|       |        meth = EC_GFp_mont_method();
   55|       |#endif
   56|       |
   57|  5.82k|    ret = ossl_ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth);
   58|  5.82k|    if (ret == NULL)
  ------------------
  |  Branch (58:9): [True: 0, False: 5.82k]
  ------------------
   59|      0|        return NULL;
   60|       |
   61|  5.82k|    if (!EC_GROUP_set_curve(ret, p, a, b, ctx)) {
  ------------------
  |  Branch (61:9): [True: 315, False: 5.51k]
  ------------------
   62|    315|        EC_GROUP_free(ret);
   63|    315|        return NULL;
   64|    315|    }
   65|       |
   66|  5.51k|    return ret;
   67|  5.82k|}
EC_GROUP_new_curve_GF2m:
   72|  9.70k|{
   73|  9.70k|    const EC_METHOD *meth;
   74|  9.70k|    EC_GROUP *ret;
   75|       |
   76|  9.70k|    meth = EC_GF2m_simple_method();
   77|       |
   78|  9.70k|    ret = ossl_ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth);
   79|  9.70k|    if (ret == NULL)
  ------------------
  |  Branch (79:9): [True: 0, False: 9.70k]
  ------------------
   80|      0|        return NULL;
   81|       |
   82|  9.70k|    if (!EC_GROUP_set_curve(ret, p, a, b, ctx)) {
  ------------------
  |  Branch (82:9): [True: 0, False: 9.70k]
  ------------------
   83|      0|        EC_GROUP_free(ret);
   84|      0|        return NULL;
   85|      0|    }
   86|       |
   87|  9.70k|    return ret;
   88|  9.70k|}

ossl_err_load_EC_strings:
  127|      2|{
  128|      2|# ifndef OPENSSL_NO_ERR
  129|      2|    if (ERR_reason_error_string(EC_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (129:9): [True: 2, False: 0]
  ------------------
  130|      2|        ERR_load_strings_const(EC_str_reasons);
  131|      2|# endif
  132|      2|    return 1;
  133|      2|}

EC_KEY_new:
   35|  13.9k|{
   36|  13.9k|    return ossl_ec_key_new_method_int(NULL, NULL, NULL);
   37|  13.9k|}
EC_KEY_new_ex:
   41|  17.2k|{
   42|  17.2k|    return ossl_ec_key_new_method_int(ctx, propq, NULL);
   43|  17.2k|}
EC_KEY_free:
   72|   117k|{
   73|   117k|    int i;
   74|       |
   75|   117k|    if (r == NULL)
  ------------------
  |  Branch (75:9): [True: 76.2k, False: 41.0k]
  ------------------
   76|  76.2k|        return;
   77|       |
   78|  41.0k|    CRYPTO_DOWN_REF(&r->references, &i);
   79|  41.0k|    REF_PRINT_COUNT("EC_KEY", r);
  ------------------
  |  |  289|  41.0k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  41.0k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  41.0k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  41.0k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   80|  41.0k|    if (i > 0)
  ------------------
  |  Branch (80:9): [True: 9.85k, False: 31.1k]
  ------------------
   81|  9.85k|        return;
   82|  31.1k|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|  31.1k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 31.1k]
  |  |  ------------------
  ------------------
   83|       |
   84|  31.1k|    if (r->meth != NULL && r->meth->finish != NULL)
  ------------------
  |  Branch (84:9): [True: 31.1k, False: 0]
  |  Branch (84:28): [True: 0, False: 31.1k]
  ------------------
   85|      0|        r->meth->finish(r);
   86|       |
   87|  31.1k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
   88|  31.1k|    ENGINE_finish(r->engine);
   89|  31.1k|#endif
   90|       |
   91|  31.1k|    if (r->group && r->group->meth->keyfinish)
  ------------------
  |  Branch (91:9): [True: 18.0k, False: 13.1k]
  |  Branch (91:21): [True: 0, False: 18.0k]
  ------------------
   92|      0|        r->group->meth->keyfinish(r);
   93|       |
   94|  31.1k|#ifndef FIPS_MODULE
   95|  31.1k|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_EC_KEY, r, &r->ex_data);
  ------------------
  |  |  226|  31.1k|# define CRYPTO_EX_INDEX_EC_KEY           8
  ------------------
   96|  31.1k|#endif
   97|  31.1k|    CRYPTO_FREE_REF(&r->references);
   98|  31.1k|    EC_GROUP_free(r->group);
   99|  31.1k|    EC_POINT_free(r->pub_key);
  100|  31.1k|    BN_clear_free(r->priv_key);
  101|  31.1k|    OPENSSL_free(r->propq);
  ------------------
  |  |  107|  31.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  31.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  31.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  102|       |
  103|  31.1k|    OPENSSL_clear_free((void *)r, sizeof(EC_KEY));
  ------------------
  |  |  105|  31.1k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  31.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  31.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  104|  31.1k|}
EC_KEY_up_ref:
  194|  9.85k|{
  195|  9.85k|    int i;
  196|       |
  197|  9.85k|    if (CRYPTO_UP_REF(&r->references, &i) <= 0)
  ------------------
  |  Branch (197:9): [True: 0, False: 9.85k]
  ------------------
  198|      0|        return 0;
  199|       |
  200|  9.85k|    REF_PRINT_COUNT("EC_KEY", r);
  ------------------
  |  |  289|  9.85k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  9.85k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  9.85k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  9.85k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  201|  9.85k|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|  9.85k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 9.85k]
  |  |  ------------------
  ------------------
  202|  9.85k|    return ((i > 1) ? 1 : 0);
  ------------------
  |  Branch (202:13): [True: 9.85k, False: 0]
  ------------------
  203|  9.85k|}
ossl_ec_key_simple_generate_public_key:
  448|  1.25k|{
  449|  1.25k|    int ret;
  450|  1.25k|    BN_CTX *ctx = BN_CTX_new_ex(eckey->libctx);
  451|       |
  452|  1.25k|    if (ctx == NULL)
  ------------------
  |  Branch (452:9): [True: 0, False: 1.25k]
  ------------------
  453|      0|        return 0;
  454|       |
  455|       |    /*
  456|       |     * See SP800-56AR3 5.6.1.2.2: Step (8)
  457|       |     * pub_key = priv_key * G (where G is a point on the curve)
  458|       |     */
  459|  1.25k|    ret = EC_POINT_mul(eckey->group, eckey->pub_key, eckey->priv_key, NULL,
  460|  1.25k|                       NULL, ctx);
  461|       |
  462|  1.25k|    BN_CTX_free(ctx);
  463|  1.25k|    if (ret == 1)
  ------------------
  |  Branch (463:9): [True: 1.25k, False: 0]
  ------------------
  464|  1.25k|        eckey->dirty_cnt++;
  465|       |
  466|  1.25k|    return ret;
  467|  1.25k|}
ossl_ec_key_get_libctx:
  746|  21.2k|{
  747|  21.2k|    return key->libctx;
  748|  21.2k|}
ossl_ec_key_get0_propq:
  751|  10.4k|{
  752|  10.4k|    return key->propq;
  753|  10.4k|}
ossl_ec_key_set0_libctx:
  756|  10.4k|{
  757|  10.4k|    key->libctx = libctx;
  758|       |    /* Do we need to propagate this to the group? */
  759|  10.4k|}
EC_KEY_get0_group:
  762|  52.9k|{
  763|  52.9k|    return key->group;
  764|  52.9k|}
EC_KEY_set_group:
  767|  15.2k|{
  768|  15.2k|    if (key->meth->set_group != NULL && key->meth->set_group(key, group) == 0)
  ------------------
  |  Branch (768:9): [True: 0, False: 15.2k]
  |  Branch (768:41): [True: 0, False: 0]
  ------------------
  769|      0|        return 0;
  770|  15.2k|    EC_GROUP_free(key->group);
  771|  15.2k|    key->group = EC_GROUP_dup(group);
  772|  15.2k|    if (key->group != NULL && EC_GROUP_get_curve_name(key->group) == NID_sm2)
  ------------------
  |  | 1228|  15.2k|#define NID_sm2         1172
  ------------------
  |  Branch (772:9): [True: 15.2k, False: 0]
  |  Branch (772:31): [True: 10, False: 15.2k]
  ------------------
  773|     10|        EC_KEY_set_flags(key, EC_FLAG_SM2_RANGE);
  ------------------
  |  |  962|     10|#  define EC_FLAG_SM2_RANGE              0x0004
  ------------------
  774|       |
  775|  15.2k|    key->dirty_cnt++;
  776|  15.2k|    return (key->group == NULL) ? 0 : 1;
  ------------------
  |  Branch (776:12): [True: 0, False: 15.2k]
  ------------------
  777|  15.2k|}
EC_KEY_get0_private_key:
  780|  12.7k|{
  781|  12.7k|    return key->priv_key;
  782|  12.7k|}
EC_KEY_get0_public_key:
  880|  11.4k|{
  881|  11.4k|    return key->pub_key;
  882|  11.4k|}
EC_KEY_get_enc_flags:
  896|  10.5k|{
  897|  10.5k|    return key->enc_flag;
  898|  10.5k|}
EC_KEY_set_enc_flags:
  901|    300|{
  902|    300|    key->enc_flag = flags;
  903|    300|}
EC_KEY_get_conv_form:
  906|  11.4k|{
  907|  11.4k|    return key->conv_form;
  908|  11.4k|}
EC_KEY_get_flags:
  933|  31.7k|{
  934|  31.7k|    return key->flags;
  935|  31.7k|}
EC_KEY_set_flags:
  938|     25|{
  939|     25|    key->flags |= flags;
  940|     25|    key->dirty_cnt++;
  941|     25|}
EC_KEY_key2buf:
  958|  1.28k|{
  959|  1.28k|    if (key == NULL || key->pub_key == NULL || key->group == NULL)
  ------------------
  |  Branch (959:9): [True: 0, False: 1.28k]
  |  Branch (959:24): [True: 0, False: 1.28k]
  |  Branch (959:48): [True: 0, False: 1.28k]
  ------------------
  960|      0|        return 0;
  961|  1.28k|    return EC_POINT_point2buf(key->group, key->pub_key, form, pbuf, ctx);
  962|  1.28k|}
EC_KEY_oct2key:
  966|  16.7k|{
  967|  16.7k|    if (key == NULL || key->group == NULL)
  ------------------
  |  Branch (967:9): [True: 0, False: 16.7k]
  |  Branch (967:24): [True: 0, False: 16.7k]
  ------------------
  968|      0|        return 0;
  969|  16.7k|    if (key->pub_key == NULL)
  ------------------
  |  Branch (969:9): [True: 15.9k, False: 744]
  ------------------
  970|  15.9k|        key->pub_key = EC_POINT_new(key->group);
  971|  16.7k|    if (key->pub_key == NULL)
  ------------------
  |  Branch (971:9): [True: 0, False: 16.7k]
  ------------------
  972|      0|        return 0;
  973|  16.7k|    if (EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx) == 0)
  ------------------
  |  Branch (973:9): [True: 6.43k, False: 10.2k]
  ------------------
  974|  6.43k|        return 0;
  975|  10.2k|    key->dirty_cnt++;
  976|       |    /*
  977|       |     * Save the point conversion form.
  978|       |     * For non-custom curves the first octet of the buffer (excluding
  979|       |     * the last significant bit) contains the point conversion form.
  980|       |     * EC_POINT_oct2point() has already performed sanity checking of
  981|       |     * the buffer so we know it is valid.
  982|       |     */
  983|  10.2k|    if ((key->group->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0)
  ------------------
  |  |   29|  10.2k|#define EC_FLAGS_CUSTOM_CURVE   0x2
  ------------------
  |  Branch (983:9): [True: 10.2k, False: 0]
  ------------------
  984|  10.2k|        key->conv_form = (point_conversion_form_t)(buf[0] & ~0x01);
  985|  10.2k|    return 1;
  986|  16.7k|}
EC_KEY_priv2oct:
  990|  4.89k|{
  991|  4.89k|    if (eckey->group == NULL || eckey->group->meth == NULL)
  ------------------
  |  Branch (991:9): [True: 0, False: 4.89k]
  |  Branch (991:33): [True: 0, False: 4.89k]
  ------------------
  992|      0|        return 0;
  993|  4.89k|    if (eckey->group->meth->priv2oct == NULL) {
  ------------------
  |  Branch (993:9): [True: 0, False: 4.89k]
  ------------------
  994|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  995|      0|        return 0;
  996|      0|    }
  997|       |
  998|  4.89k|    return eckey->group->meth->priv2oct(eckey, buf, len);
  999|  4.89k|}
ossl_ec_key_simple_priv2oct:
 1003|  4.89k|{
 1004|  4.89k|    size_t buf_len;
 1005|       |
 1006|  4.89k|    buf_len = (EC_GROUP_order_bits(eckey->group) + 7) / 8;
 1007|  4.89k|    if (eckey->priv_key == NULL)
  ------------------
  |  Branch (1007:9): [True: 0, False: 4.89k]
  ------------------
 1008|      0|        return 0;
 1009|  4.89k|    if (buf == NULL)
  ------------------
  |  Branch (1009:9): [True: 2.44k, False: 2.44k]
  ------------------
 1010|  2.44k|        return buf_len;
 1011|  2.44k|    else if (len < buf_len)
  ------------------
  |  Branch (1011:14): [True: 0, False: 2.44k]
  ------------------
 1012|      0|        return 0;
 1013|       |
 1014|       |    /* Octetstring may need leading zeros if BN is to short */
 1015|       |
 1016|  2.44k|    if (BN_bn2binpad(eckey->priv_key, buf, buf_len) == -1) {
  ------------------
  |  Branch (1016:9): [True: 731, False: 1.71k]
  ------------------
 1017|    731|        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|    731|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    731|    (ERR_new(),                                                 \
  |  |  |  |  404|    731|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    731|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    731|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    731|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    731|     ERR_set_error)
  |  |  ------------------
  ------------------
 1018|    731|        return 0;
 1019|    731|    }
 1020|       |
 1021|  1.71k|    return buf_len;
 1022|  2.44k|}
EC_KEY_oct2priv:
 1025|  1.99k|{
 1026|  1.99k|    int ret;
 1027|       |
 1028|  1.99k|    if (eckey->group == NULL || eckey->group->meth == NULL)
  ------------------
  |  Branch (1028:9): [True: 0, False: 1.99k]
  |  Branch (1028:33): [True: 0, False: 1.99k]
  ------------------
 1029|      0|        return 0;
 1030|  1.99k|    if (eckey->group->meth->oct2priv == NULL) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 1.99k]
  ------------------
 1031|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1032|      0|        return 0;
 1033|      0|    }
 1034|  1.99k|    ret = eckey->group->meth->oct2priv(eckey, buf, len);
 1035|  1.99k|    if (ret == 1)
  ------------------
  |  Branch (1035:9): [True: 1.99k, False: 0]
  ------------------
 1036|  1.99k|        eckey->dirty_cnt++;
 1037|  1.99k|    return ret;
 1038|  1.99k|}
ossl_ec_key_simple_oct2priv:
 1042|  1.99k|{
 1043|  1.99k|    if (eckey->priv_key == NULL)
  ------------------
  |  Branch (1043:9): [True: 1.99k, False: 0]
  ------------------
 1044|  1.99k|        eckey->priv_key = BN_secure_new();
 1045|  1.99k|    if (eckey->priv_key == NULL) {
  ------------------
  |  Branch (1045:9): [True: 0, False: 1.99k]
  ------------------
 1046|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1047|      0|        return 0;
 1048|      0|    }
 1049|  1.99k|    if (BN_bin2bn(buf, len, eckey->priv_key) == NULL) {
  ------------------
  |  Branch (1049:9): [True: 0, False: 1.99k]
  ------------------
 1050|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1051|      0|        return 0;
 1052|      0|    }
 1053|  1.99k|    eckey->dirty_cnt++;
 1054|  1.99k|    return 1;
 1055|  1.99k|}
EC_KEY_priv2buf:
 1058|  2.44k|{
 1059|  2.44k|    size_t len;
 1060|  2.44k|    unsigned char *buf;
 1061|       |
 1062|  2.44k|    len = EC_KEY_priv2oct(eckey, NULL, 0);
 1063|  2.44k|    if (len == 0)
  ------------------
  |  Branch (1063:9): [True: 0, False: 2.44k]
  ------------------
 1064|      0|        return 0;
 1065|  2.44k|    if ((buf = OPENSSL_malloc(len)) == NULL)
  ------------------
  |  |   97|  2.44k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.44k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.44k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (1065:9): [True: 0, False: 2.44k]
  ------------------
 1066|      0|        return 0;
 1067|  2.44k|    len = EC_KEY_priv2oct(eckey, buf, len);
 1068|  2.44k|    if (len == 0) {
  ------------------
  |  Branch (1068:9): [True: 731, False: 1.71k]
  ------------------
 1069|    731|        OPENSSL_free(buf);
  ------------------
  |  |  107|    731|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    731|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    731|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1070|    731|        return 0;
 1071|    731|    }
 1072|  1.71k|    *pbuf = buf;
 1073|  1.71k|    return len;
 1074|  2.44k|}

EC_KEY_OpenSSL:
   41|  9.85k|{
   42|  9.85k|    return &openssl_ec_key_method;
   43|  9.85k|}
EC_KEY_get_default_method:
   46|  31.1k|{
   47|  31.1k|    return default_ec_key_meth;
   48|  31.1k|}
EC_KEY_get_method:
   59|  9.85k|{
   60|  9.85k|    return key->meth;
   61|  9.85k|}
ossl_ec_key_new_method_int:
   83|  31.1k|{
   84|  31.1k|    EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  31.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  31.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  31.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   85|       |
   86|  31.1k|    if (ret == NULL)
  ------------------
  |  Branch (86:9): [True: 0, False: 31.1k]
  ------------------
   87|      0|        return NULL;
   88|       |
   89|  31.1k|    if (!CRYPTO_NEW_REF(&ret->references, 1)) {
  ------------------
  |  Branch (89:9): [True: 0, False: 31.1k]
  ------------------
   90|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   91|      0|        return NULL;
   92|      0|    }
   93|       |
   94|  31.1k|    ret->libctx = libctx;
   95|  31.1k|    if (propq != NULL) {
  ------------------
  |  Branch (95:9): [True: 52, False: 31.1k]
  ------------------
   96|     52|        ret->propq = OPENSSL_strdup(propq);
  ------------------
  |  |  111|     52|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     52|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     52|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   97|     52|        if (ret->propq == NULL)
  ------------------
  |  Branch (97:13): [True: 0, False: 52]
  ------------------
   98|      0|            goto err;
   99|     52|    }
  100|       |
  101|  31.1k|    ret->meth = EC_KEY_get_default_method();
  102|  31.1k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  103|  31.1k|    if (engine != NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 31.1k]
  ------------------
  104|      0|        if (!ENGINE_init(engine)) {
  ------------------
  |  Branch (104:13): [True: 0, False: 0]
  ------------------
  105|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  106|      0|            goto err;
  107|      0|        }
  108|      0|        ret->engine = engine;
  109|      0|    } else
  110|  31.1k|        ret->engine = ENGINE_get_default_EC();
  111|  31.1k|    if (ret->engine != NULL) {
  ------------------
  |  Branch (111:9): [True: 0, False: 31.1k]
  ------------------
  112|      0|        ret->meth = ENGINE_get_EC(ret->engine);
  113|      0|        if (ret->meth == NULL) {
  ------------------
  |  Branch (113:13): [True: 0, False: 0]
  ------------------
  114|      0|            ERR_raise(ERR_LIB_EC, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  115|      0|            goto err;
  116|      0|        }
  117|      0|    }
  118|  31.1k|#endif
  119|       |
  120|  31.1k|    ret->version = 1;
  121|  31.1k|    ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
  122|       |
  123|       |/* No ex_data inside the FIPS provider */
  124|  31.1k|#ifndef FIPS_MODULE
  125|  31.1k|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EC_KEY, ret, &ret->ex_data)) {
  ------------------
  |  |  226|  31.1k|# define CRYPTO_EX_INDEX_EC_KEY           8
  ------------------
  |  Branch (125:9): [True: 0, False: 31.1k]
  ------------------
  126|      0|        ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  127|      0|        goto err;
  128|      0|    }
  129|  31.1k|#endif
  130|       |
  131|  31.1k|    if (ret->meth->init != NULL && ret->meth->init(ret) == 0) {
  ------------------
  |  Branch (131:9): [True: 0, False: 31.1k]
  |  Branch (131:36): [True: 0, False: 0]
  ------------------
  132|      0|        ERR_raise(ERR_LIB_EC, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  133|      0|        goto err;
  134|      0|    }
  135|  31.1k|    return ret;
  136|       |
  137|      0| err:
  138|      0|    EC_KEY_free(ret);
  139|      0|    return NULL;
  140|  31.1k|}

ossl_ec_group_new_ex:
   31|  37.3k|{
   32|  37.3k|    EC_GROUP *ret;
   33|       |
   34|  37.3k|    if (meth == NULL) {
  ------------------
  |  Branch (34:9): [True: 0, False: 37.3k]
  ------------------
   35|      0|        ERR_raise(ERR_LIB_EC, EC_R_SLOT_FULL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   36|      0|        return NULL;
   37|      0|    }
   38|  37.3k|    if (meth->group_init == 0) {
  ------------------
  |  Branch (38:9): [True: 0, False: 37.3k]
  ------------------
   39|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   40|      0|        return NULL;
   41|      0|    }
   42|       |
   43|  37.3k|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  37.3k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  37.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  37.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   44|  37.3k|    if (ret == NULL)
  ------------------
  |  Branch (44:9): [True: 0, False: 37.3k]
  ------------------
   45|      0|        return NULL;
   46|       |
   47|  37.3k|    ret->libctx = libctx;
   48|  37.3k|    if (propq != NULL) {
  ------------------
  |  Branch (48:9): [True: 30, False: 37.3k]
  ------------------
   49|     30|        ret->propq = OPENSSL_strdup(propq);
  ------------------
  |  |  111|     30|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     30|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     30|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   50|     30|        if (ret->propq == NULL)
  ------------------
  |  Branch (50:13): [True: 0, False: 30]
  ------------------
   51|      0|            goto err;
   52|     30|    }
   53|  37.3k|    ret->meth = meth;
   54|  37.3k|    if ((ret->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) {
  ------------------
  |  |   29|  37.3k|#define EC_FLAGS_CUSTOM_CURVE   0x2
  ------------------
  |  Branch (54:9): [True: 37.3k, False: 0]
  ------------------
   55|  37.3k|        ret->order = BN_new();
   56|  37.3k|        if (ret->order == NULL)
  ------------------
  |  Branch (56:13): [True: 0, False: 37.3k]
  ------------------
   57|      0|            goto err;
   58|  37.3k|        ret->cofactor = BN_new();
   59|  37.3k|        if (ret->cofactor == NULL)
  ------------------
  |  Branch (59:13): [True: 0, False: 37.3k]
  ------------------
   60|      0|            goto err;
   61|  37.3k|    }
   62|  37.3k|    ret->asn1_flag = OPENSSL_EC_EXPLICIT_CURVE;
  ------------------
  |  |   30|  37.3k|# define OPENSSL_EC_EXPLICIT_CURVE  0x000
  ------------------
   63|  37.3k|    ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED;
   64|  37.3k|    if (!meth->group_init(ret))
  ------------------
  |  Branch (64:9): [True: 0, False: 37.3k]
  ------------------
   65|      0|        goto err;
   66|  37.3k|    return ret;
   67|       |
   68|      0| err:
   69|      0|    BN_free(ret->order);
   70|      0|    BN_free(ret->cofactor);
   71|      0|    OPENSSL_free(ret->propq);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   72|      0|    OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   73|      0|    return NULL;
   74|  37.3k|}
EC_pre_comp_free:
   86|  37.3k|{
   87|  37.3k|    switch (group->pre_comp_type) {
  ------------------
  |  Branch (87:13): [True: 0, False: 37.3k]
  ------------------
   88|  37.3k|    case PCT_none:
  ------------------
  |  Branch (88:5): [True: 37.3k, False: 0]
  ------------------
   89|  37.3k|        break;
   90|      0|    case PCT_nistz256:
  ------------------
  |  Branch (90:5): [True: 0, False: 37.3k]
  ------------------
   91|      0|#ifdef ECP_NISTZ256_ASM
   92|      0|        EC_nistz256_pre_comp_free(group->pre_comp.nistz256);
   93|      0|#endif
   94|      0|        break;
   95|      0|#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
   96|      0|    case PCT_nistp224:
  ------------------
  |  Branch (96:5): [True: 0, False: 37.3k]
  ------------------
   97|      0|        EC_nistp224_pre_comp_free(group->pre_comp.nistp224);
   98|      0|        break;
   99|      0|    case PCT_nistp256:
  ------------------
  |  Branch (99:5): [True: 0, False: 37.3k]
  ------------------
  100|      0|        EC_nistp256_pre_comp_free(group->pre_comp.nistp256);
  101|      0|        break;
  102|      0|    case PCT_nistp384:
  ------------------
  |  Branch (102:5): [True: 0, False: 37.3k]
  ------------------
  103|      0|        ossl_ec_nistp384_pre_comp_free(group->pre_comp.nistp384);
  104|      0|        break;
  105|      0|    case PCT_nistp521:
  ------------------
  |  Branch (105:5): [True: 0, False: 37.3k]
  ------------------
  106|      0|        EC_nistp521_pre_comp_free(group->pre_comp.nistp521);
  107|      0|        break;
  108|       |#else
  109|       |    case PCT_nistp224:
  110|       |    case PCT_nistp256:
  111|       |    case PCT_nistp384:
  112|       |    case PCT_nistp521:
  113|       |        break;
  114|       |#endif
  115|      0|    case PCT_ec:
  ------------------
  |  Branch (115:5): [True: 0, False: 37.3k]
  ------------------
  116|      0|        EC_ec_pre_comp_free(group->pre_comp.ec);
  117|      0|        break;
  118|  37.3k|    }
  119|  37.3k|    group->pre_comp.ec = NULL;
  120|  37.3k|}
EC_GROUP_free:
  123|  72.5k|{
  124|  72.5k|    if (!group)
  ------------------
  |  Branch (124:9): [True: 35.2k, False: 37.3k]
  ------------------
  125|  35.2k|        return;
  126|       |
  127|  37.3k|    if (group->meth->group_finish != 0)
  ------------------
  |  Branch (127:9): [True: 37.3k, False: 0]
  ------------------
  128|  37.3k|        group->meth->group_finish(group);
  129|       |
  130|  37.3k|    EC_pre_comp_free(group);
  131|  37.3k|    BN_MONT_CTX_free(group->mont_data);
  132|  37.3k|    EC_POINT_free(group->generator);
  133|  37.3k|    BN_free(group->order);
  134|  37.3k|    BN_free(group->cofactor);
  135|  37.3k|    OPENSSL_free(group->seed);
  ------------------
  |  |  107|  37.3k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  37.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  37.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  136|  37.3k|    OPENSSL_free(group->propq);
  ------------------
  |  |  107|  37.3k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  37.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  37.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  137|  37.3k|    OPENSSL_free(group);
  ------------------
  |  |  107|  37.3k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  37.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  37.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  138|  37.3k|}
EC_GROUP_copy:
  162|  17.2k|{
  163|  17.2k|    if (dest->meth->group_copy == 0) {
  ------------------
  |  Branch (163:9): [True: 0, False: 17.2k]
  ------------------
  164|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  165|      0|        return 0;
  166|      0|    }
  167|  17.2k|    if (dest->meth != src->meth) {
  ------------------
  |  Branch (167:9): [True: 0, False: 17.2k]
  ------------------
  168|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  169|      0|        return 0;
  170|      0|    }
  171|  17.2k|    if (dest == src)
  ------------------
  |  Branch (171:9): [True: 0, False: 17.2k]
  ------------------
  172|      0|        return 1;
  173|       |
  174|  17.2k|    dest->libctx = src->libctx;
  175|  17.2k|    dest->curve_name = src->curve_name;
  176|       |
  177|       |    /* Copy precomputed */
  178|  17.2k|    dest->pre_comp_type = src->pre_comp_type;
  179|  17.2k|    switch (src->pre_comp_type) {
  ------------------
  |  Branch (179:13): [True: 0, False: 17.2k]
  ------------------
  180|  17.2k|    case PCT_none:
  ------------------
  |  Branch (180:5): [True: 17.2k, False: 0]
  ------------------
  181|  17.2k|        dest->pre_comp.ec = NULL;
  182|  17.2k|        break;
  183|      0|    case PCT_nistz256:
  ------------------
  |  Branch (183:5): [True: 0, False: 17.2k]
  ------------------
  184|      0|#ifdef ECP_NISTZ256_ASM
  185|      0|        dest->pre_comp.nistz256 = EC_nistz256_pre_comp_dup(src->pre_comp.nistz256);
  186|      0|#endif
  187|      0|        break;
  188|      0|#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
  189|      0|    case PCT_nistp224:
  ------------------
  |  Branch (189:5): [True: 0, False: 17.2k]
  ------------------
  190|      0|        dest->pre_comp.nistp224 = EC_nistp224_pre_comp_dup(src->pre_comp.nistp224);
  191|      0|        break;
  192|      0|    case PCT_nistp256:
  ------------------
  |  Branch (192:5): [True: 0, False: 17.2k]
  ------------------
  193|      0|        dest->pre_comp.nistp256 = EC_nistp256_pre_comp_dup(src->pre_comp.nistp256);
  194|      0|        break;
  195|      0|    case PCT_nistp384:
  ------------------
  |  Branch (195:5): [True: 0, False: 17.2k]
  ------------------
  196|      0|        dest->pre_comp.nistp384 = ossl_ec_nistp384_pre_comp_dup(src->pre_comp.nistp384);
  197|      0|        break;
  198|      0|    case PCT_nistp521:
  ------------------
  |  Branch (198:5): [True: 0, False: 17.2k]
  ------------------
  199|      0|        dest->pre_comp.nistp521 = EC_nistp521_pre_comp_dup(src->pre_comp.nistp521);
  200|      0|        break;
  201|       |#else
  202|       |    case PCT_nistp224:
  203|       |    case PCT_nistp256:
  204|       |    case PCT_nistp384:
  205|       |    case PCT_nistp521:
  206|       |        break;
  207|       |#endif
  208|      0|    case PCT_ec:
  ------------------
  |  Branch (208:5): [True: 0, False: 17.2k]
  ------------------
  209|      0|        dest->pre_comp.ec = EC_ec_pre_comp_dup(src->pre_comp.ec);
  210|      0|        break;
  211|  17.2k|    }
  212|       |
  213|  17.2k|    if (src->mont_data != NULL) {
  ------------------
  |  Branch (213:9): [True: 15.3k, False: 1.85k]
  ------------------
  214|  15.3k|        if (dest->mont_data == NULL) {
  ------------------
  |  Branch (214:13): [True: 15.3k, False: 0]
  ------------------
  215|  15.3k|            dest->mont_data = BN_MONT_CTX_new();
  216|  15.3k|            if (dest->mont_data == NULL)
  ------------------
  |  Branch (216:17): [True: 0, False: 15.3k]
  ------------------
  217|      0|                return 0;
  218|  15.3k|        }
  219|  15.3k|        if (!BN_MONT_CTX_copy(dest->mont_data, src->mont_data))
  ------------------
  |  Branch (219:13): [True: 0, False: 15.3k]
  ------------------
  220|      0|            return 0;
  221|  15.3k|    } else {
  222|       |        /* src->generator == NULL */
  223|  1.85k|        BN_MONT_CTX_free(dest->mont_data);
  224|  1.85k|        dest->mont_data = NULL;
  225|  1.85k|    }
  226|       |
  227|  17.2k|    if (src->generator != NULL) {
  ------------------
  |  Branch (227:9): [True: 17.2k, False: 0]
  ------------------
  228|  17.2k|        if (dest->generator == NULL) {
  ------------------
  |  Branch (228:13): [True: 17.2k, False: 0]
  ------------------
  229|  17.2k|            dest->generator = EC_POINT_new(dest);
  230|  17.2k|            if (dest->generator == NULL)
  ------------------
  |  Branch (230:17): [True: 0, False: 17.2k]
  ------------------
  231|      0|                return 0;
  232|  17.2k|        }
  233|  17.2k|        if (!EC_POINT_copy(dest->generator, src->generator))
  ------------------
  |  Branch (233:13): [True: 0, False: 17.2k]
  ------------------
  234|      0|            return 0;
  235|  17.2k|    } else {
  236|       |        /* src->generator == NULL */
  237|      0|        EC_POINT_clear_free(dest->generator);
  238|      0|        dest->generator = NULL;
  239|      0|    }
  240|       |
  241|  17.2k|    if ((src->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) {
  ------------------
  |  |   29|  17.2k|#define EC_FLAGS_CUSTOM_CURVE   0x2
  ------------------
  |  Branch (241:9): [True: 17.2k, False: 0]
  ------------------
  242|  17.2k|        if (!BN_copy(dest->order, src->order))
  ------------------
  |  Branch (242:13): [True: 0, False: 17.2k]
  ------------------
  243|      0|            return 0;
  244|  17.2k|        if (!BN_copy(dest->cofactor, src->cofactor))
  ------------------
  |  Branch (244:13): [True: 0, False: 17.2k]
  ------------------
  245|      0|            return 0;
  246|  17.2k|    }
  247|       |
  248|  17.2k|    dest->asn1_flag = src->asn1_flag;
  249|  17.2k|    dest->asn1_form = src->asn1_form;
  250|  17.2k|    dest->decoded_from_explicit_params = src->decoded_from_explicit_params;
  251|       |
  252|  17.2k|    if (src->seed) {
  ------------------
  |  Branch (252:9): [True: 8.09k, False: 9.14k]
  ------------------
  253|  8.09k|        OPENSSL_free(dest->seed);
  ------------------
  |  |  107|  8.09k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.09k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.09k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  254|  8.09k|        if ((dest->seed = OPENSSL_malloc(src->seed_len)) == NULL)
  ------------------
  |  |   97|  8.09k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  8.09k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  8.09k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (254:13): [True: 0, False: 8.09k]
  ------------------
  255|      0|            return 0;
  256|  8.09k|        if (!memcpy(dest->seed, src->seed, src->seed_len))
  ------------------
  |  Branch (256:13): [True: 0, False: 8.09k]
  ------------------
  257|      0|            return 0;
  258|  8.09k|        dest->seed_len = src->seed_len;
  259|  9.14k|    } else {
  260|  9.14k|        OPENSSL_free(dest->seed);
  ------------------
  |  |  107|  9.14k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.14k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.14k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  261|  9.14k|        dest->seed = NULL;
  262|  9.14k|        dest->seed_len = 0;
  263|  9.14k|    }
  264|       |
  265|  17.2k|    return dest->meth->group_copy(dest, src);
  266|  17.2k|}
EC_GROUP_dup:
  269|  17.2k|{
  270|  17.2k|    EC_GROUP *t = NULL;
  271|  17.2k|    int ok = 0;
  272|       |
  273|  17.2k|    if (a == NULL)
  ------------------
  |  Branch (273:9): [True: 0, False: 17.2k]
  ------------------
  274|      0|        return NULL;
  275|       |
  276|  17.2k|    if ((t = ossl_ec_group_new_ex(a->libctx, a->propq, a->meth)) == NULL)
  ------------------
  |  Branch (276:9): [True: 0, False: 17.2k]
  ------------------
  277|      0|        return NULL;
  278|  17.2k|    if (!EC_GROUP_copy(t, a))
  ------------------
  |  Branch (278:9): [True: 0, False: 17.2k]
  ------------------
  279|      0|        goto err;
  280|       |
  281|  17.2k|    ok = 1;
  282|       |
  283|  17.2k| err:
  284|  17.2k|    if (!ok) {
  ------------------
  |  Branch (284:9): [True: 0, False: 17.2k]
  ------------------
  285|      0|        EC_GROUP_free(t);
  286|      0|        return NULL;
  287|      0|    }
  288|  17.2k|        return t;
  289|  17.2k|}
EC_GROUP_set_generator:
  368|  20.9k|{
  369|  20.9k|    if (generator == NULL) {
  ------------------
  |  Branch (369:9): [True: 0, False: 20.9k]
  ------------------
  370|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  371|      0|        return 0;
  372|      0|    }
  373|       |
  374|       |    /* require group->field >= 1 */
  375|  20.9k|    if (group->field == NULL || BN_is_zero(group->field)
  ------------------
  |  Branch (375:9): [True: 0, False: 20.9k]
  |  Branch (375:33): [True: 0, False: 20.9k]
  ------------------
  376|  20.9k|        || BN_is_negative(group->field)) {
  ------------------
  |  Branch (376:12): [True: 0, False: 20.9k]
  ------------------
  377|      0|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FIELD);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  378|      0|        return 0;
  379|      0|    }
  380|       |
  381|       |    /*-
  382|       |     * - require order >= 1
  383|       |     * - enforce upper bound due to Hasse thm: order can be no more than one bit
  384|       |     *   longer than field cardinality
  385|       |     */
  386|  20.9k|    if (order == NULL || BN_is_zero(order) || BN_is_negative(order)
  ------------------
  |  Branch (386:9): [True: 0, False: 20.9k]
  |  Branch (386:26): [True: 0, False: 20.9k]
  |  Branch (386:47): [True: 0, False: 20.9k]
  ------------------
  387|  20.9k|        || BN_num_bits(order) > BN_num_bits(group->field) + 1) {
  ------------------
  |  Branch (387:12): [True: 0, False: 20.9k]
  ------------------
  388|      0|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  389|      0|        return 0;
  390|      0|    }
  391|       |
  392|       |    /*-
  393|       |     * Unfortunately the cofactor is an optional field in many standards.
  394|       |     * Internally, the lib uses 0 cofactor as a marker for "unknown cofactor".
  395|       |     * So accept cofactor == NULL or cofactor >= 0.
  396|       |     */
  397|  20.9k|    if (cofactor != NULL && BN_is_negative(cofactor)) {
  ------------------
  |  Branch (397:9): [True: 18.6k, False: 2.30k]
  |  Branch (397:29): [True: 10, False: 18.6k]
  ------------------
  398|     10|        ERR_raise(ERR_LIB_EC, EC_R_UNKNOWN_COFACTOR);
  ------------------
  |  |  401|     10|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     10|    (ERR_new(),                                                 \
  |  |  |  |  404|     10|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     10|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     10|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     10|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     10|     ERR_set_error)
  |  |  ------------------
  ------------------
  399|     10|        return 0;
  400|     10|    }
  401|       |
  402|  20.9k|    if (group->generator == NULL) {
  ------------------
  |  Branch (402:9): [True: 18.9k, False: 2.00k]
  ------------------
  403|  18.9k|        group->generator = EC_POINT_new(group);
  404|  18.9k|        if (group->generator == NULL)
  ------------------
  |  Branch (404:13): [True: 0, False: 18.9k]
  ------------------
  405|      0|            return 0;
  406|  18.9k|    }
  407|  20.9k|    if (!EC_POINT_copy(group->generator, generator))
  ------------------
  |  Branch (407:9): [True: 0, False: 20.9k]
  ------------------
  408|      0|        return 0;
  409|       |
  410|  20.9k|    if (!BN_copy(group->order, order))
  ------------------
  |  Branch (410:9): [True: 0, False: 20.9k]
  ------------------
  411|      0|        return 0;
  412|       |
  413|       |    /* Either take the provided positive cofactor, or try to compute it */
  414|  20.9k|    if (cofactor != NULL && !BN_is_zero(cofactor)) {
  ------------------
  |  Branch (414:9): [True: 18.6k, False: 2.30k]
  |  Branch (414:29): [True: 18.6k, False: 19]
  ------------------
  415|  18.6k|        if (!BN_copy(group->cofactor, cofactor))
  ------------------
  |  Branch (415:13): [True: 0, False: 18.6k]
  ------------------
  416|      0|            return 0;
  417|  18.6k|    } else if (!ec_guess_cofactor(group)) {
  ------------------
  |  Branch (417:16): [True: 0, False: 2.32k]
  ------------------
  418|      0|        BN_zero(group->cofactor);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  419|      0|        return 0;
  420|      0|    }
  421|       |
  422|       |    /*
  423|       |     * Some groups have an order with
  424|       |     * factors of two, which makes the Montgomery setup fail.
  425|       |     * |group->mont_data| will be NULL in this case.
  426|       |     */
  427|  20.9k|    if (BN_is_odd(group->order)) {
  ------------------
  |  Branch (427:9): [True: 17.2k, False: 3.70k]
  ------------------
  428|  17.2k|        return ec_precompute_mont_data(group);
  429|  17.2k|    }
  430|       |
  431|  3.70k|    BN_MONT_CTX_free(group->mont_data);
  432|  3.70k|    group->mont_data = NULL;
  433|  3.70k|    return 1;
  434|  20.9k|}
EC_GROUP_get0_generator:
  437|  2.61k|{
  438|  2.61k|    return group->generator;
  439|  2.61k|}
EC_GROUP_get_order:
  447|  1.99k|{
  448|  1.99k|    if (group->order == NULL)
  ------------------
  |  Branch (448:9): [True: 0, False: 1.99k]
  ------------------
  449|      0|        return 0;
  450|  1.99k|    if (!BN_copy(order, group->order))
  ------------------
  |  Branch (450:9): [True: 0, False: 1.99k]
  ------------------
  451|      0|        return 0;
  452|       |
  453|  1.99k|    return !BN_is_zero(order);
  454|  1.99k|}
EC_GROUP_get0_order:
  457|  10.8k|{
  458|  10.8k|    return group->order;
  459|  10.8k|}
EC_GROUP_order_bits:
  462|  27.2k|{
  463|  27.2k|    return group->meth->group_order_bits(group);
  464|  27.2k|}
EC_GROUP_get0_cofactor:
  479|  2.39k|{
  480|  2.39k|    return group->cofactor;
  481|  2.39k|}
EC_GROUP_set_curve_name:
  484|  16.9k|{
  485|  16.9k|    group->curve_name = nid;
  486|  16.9k|    group->asn1_flag =
  487|  16.9k|        (nid != NID_undef)
  ------------------
  |  |   18|  16.9k|#define NID_undef                       0
  ------------------
  |  Branch (487:9): [True: 16.9k, False: 0]
  ------------------
  488|  16.9k|        ? OPENSSL_EC_NAMED_CURVE
  ------------------
  |  |   31|  16.9k|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  489|  16.9k|        : OPENSSL_EC_EXPLICIT_CURVE;
  ------------------
  |  |   30|  16.9k|# define OPENSSL_EC_EXPLICIT_CURVE  0x000
  ------------------
  490|  16.9k|}
EC_GROUP_get_curve_name:
  493|  53.4k|{
  494|  53.4k|    return group->curve_name;
  495|  53.4k|}
EC_GROUP_get_field_type:
  503|  35.4k|{
  504|  35.4k|    return group->meth->field_type;
  505|  35.4k|}
EC_GROUP_set_asn1_flag:
  508|  18.9k|{
  509|  18.9k|    group->asn1_flag = flag;
  510|  18.9k|}
EC_GROUP_get_asn1_flag:
  513|  29.5k|{
  514|  29.5k|    return group->asn1_flag;
  515|  29.5k|}
EC_GROUP_set_point_conversion_form:
  519|  2.81k|{
  520|  2.81k|    group->asn1_form = form;
  521|  2.81k|}
EC_GROUP_get_point_conversion_form:
  525|  10.8k|{
  526|  10.8k|    return group->asn1_form;
  527|  10.8k|}
EC_GROUP_set_seed:
  530|  9.25k|{
  531|  9.25k|    OPENSSL_free(group->seed);
  ------------------
  |  |  107|  9.25k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.25k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.25k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  532|  9.25k|    group->seed = NULL;
  533|  9.25k|    group->seed_len = 0;
  534|       |
  535|  9.25k|    if (!len || !p)
  ------------------
  |  Branch (535:9): [True: 2.00k, False: 7.25k]
  |  Branch (535:17): [True: 0, False: 7.25k]
  ------------------
  536|  2.00k|        return 1;
  537|       |
  538|  7.25k|    if ((group->seed = OPENSSL_malloc(len)) == NULL)
  ------------------
  |  |   97|  7.25k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  7.25k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  7.25k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (538:9): [True: 0, False: 7.25k]
  ------------------
  539|      0|        return 0;
  540|  7.25k|    memcpy(group->seed, p, len);
  541|  7.25k|    group->seed_len = len;
  542|       |
  543|  7.25k|    return len;
  544|  7.25k|}
EC_GROUP_get0_seed:
  547|  2.17k|{
  548|  2.17k|    return group->seed;
  549|  2.17k|}
EC_GROUP_get_seed_len:
  552|  2.04k|{
  553|  2.04k|    return group->seed_len;
  554|  2.04k|}
EC_GROUP_set_curve:
  558|  15.5k|{
  559|  15.5k|    if (group->meth->group_set_curve == 0) {
  ------------------
  |  Branch (559:9): [True: 0, False: 15.5k]
  ------------------
  560|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  561|      0|        return 0;
  562|      0|    }
  563|  15.5k|    return group->meth->group_set_curve(group, p, a, b, ctx);
  564|  15.5k|}
EC_GROUP_get_curve:
  568|  2.62k|{
  569|  2.62k|    if (group->meth->group_get_curve == NULL) {
  ------------------
  |  Branch (569:9): [True: 0, False: 2.62k]
  ------------------
  570|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  571|      0|        return 0;
  572|      0|    }
  573|  2.62k|    return group->meth->group_get_curve(group, p, a, b, ctx);
  574|  2.62k|}
EC_GROUP_get_degree:
  605|  13.9k|{
  606|  13.9k|    if (group->meth->group_get_degree == 0) {
  ------------------
  |  Branch (606:9): [True: 0, False: 13.9k]
  ------------------
  607|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  608|      0|        return 0;
  609|      0|    }
  610|  13.9k|    return group->meth->group_get_degree(group);
  611|  13.9k|}
EC_POINT_new:
  717|  77.1k|{
  718|  77.1k|    EC_POINT *ret;
  719|       |
  720|  77.1k|    if (group == NULL) {
  ------------------
  |  Branch (720:9): [True: 0, False: 77.1k]
  ------------------
  721|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  722|      0|        return NULL;
  723|      0|    }
  724|  77.1k|    if (group->meth->point_init == NULL) {
  ------------------
  |  Branch (724:9): [True: 0, False: 77.1k]
  ------------------
  725|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  726|      0|        return NULL;
  727|      0|    }
  728|       |
  729|  77.1k|    ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  77.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  77.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  77.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  730|  77.1k|    if (ret == NULL)
  ------------------
  |  Branch (730:9): [True: 0, False: 77.1k]
  ------------------
  731|      0|        return NULL;
  732|       |
  733|  77.1k|    ret->meth = group->meth;
  734|  77.1k|    ret->curve_name = group->curve_name;
  735|       |
  736|  77.1k|    if (!ret->meth->point_init(ret)) {
  ------------------
  |  Branch (736:9): [True: 0, False: 77.1k]
  ------------------
  737|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  738|      0|        return NULL;
  739|      0|    }
  740|       |
  741|  77.1k|    return ret;
  742|  77.1k|}
EC_POINT_free:
  745|  89.9k|{
  746|  89.9k|    if (point == NULL)
  ------------------
  |  Branch (746:9): [True: 14.7k, False: 75.1k]
  ------------------
  747|  14.7k|        return;
  748|       |
  749|  75.1k|    if (point->meth->point_finish != 0)
  ------------------
  |  Branch (749:9): [True: 75.1k, False: 0]
  ------------------
  750|  75.1k|        point->meth->point_finish(point);
  751|  75.1k|    OPENSSL_free(point);
  ------------------
  |  |  107|  75.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  75.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  75.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  752|  75.1k|}
EC_POINT_clear_free:
  755|  3.95k|{
  756|  3.95k|    if (point == NULL)
  ------------------
  |  Branch (756:9): [True: 1.99k, False: 1.95k]
  ------------------
  757|  1.99k|        return;
  758|       |
  759|  1.95k|    if (point->meth->point_clear_finish != 0)
  ------------------
  |  Branch (759:9): [True: 1.95k, False: 0]
  ------------------
  760|  1.95k|        point->meth->point_clear_finish(point);
  761|      0|    else if (point->meth->point_finish != 0)
  ------------------
  |  Branch (761:14): [True: 0, False: 0]
  ------------------
  762|      0|        point->meth->point_finish(point);
  763|  1.95k|    OPENSSL_clear_free(point, sizeof(*point));
  ------------------
  |  |  105|  1.95k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.95k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.95k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  764|  1.95k|}
EC_POINT_copy:
  767|  41.8k|{
  768|  41.8k|    if (dest->meth->point_copy == 0) {
  ------------------
  |  Branch (768:9): [True: 0, False: 41.8k]
  ------------------
  769|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  770|      0|        return 0;
  771|      0|    }
  772|  41.8k|    if (dest->meth != src->meth
  ------------------
  |  Branch (772:9): [True: 0, False: 41.8k]
  ------------------
  773|  41.8k|            || (dest->curve_name != src->curve_name
  ------------------
  |  Branch (773:17): [True: 0, False: 41.8k]
  ------------------
  774|  41.8k|                 && dest->curve_name != 0
  ------------------
  |  Branch (774:21): [True: 0, False: 0]
  ------------------
  775|  41.8k|                 && src->curve_name != 0)) {
  ------------------
  |  Branch (775:21): [True: 0, False: 0]
  ------------------
  776|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  777|      0|        return 0;
  778|      0|    }
  779|  41.8k|    if (dest == src)
  ------------------
  |  Branch (779:9): [True: 0, False: 41.8k]
  ------------------
  780|      0|        return 1;
  781|  41.8k|    return dest->meth->point_copy(dest, src);
  782|  41.8k|}
EC_POINT_set_to_infinity:
  811|  1.68k|{
  812|  1.68k|    if (group->meth->point_set_to_infinity == 0) {
  ------------------
  |  Branch (812:9): [True: 0, False: 1.68k]
  ------------------
  813|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  814|      0|        return 0;
  815|      0|    }
  816|  1.68k|    if (group->meth != point->meth) {
  ------------------
  |  Branch (816:9): [True: 0, False: 1.68k]
  ------------------
  817|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  818|      0|        return 0;
  819|      0|    }
  820|  1.68k|    return group->meth->point_set_to_infinity(group, point);
  821|  1.68k|}
EC_POINT_set_Jprojective_coordinates_GFp:
  828|  14.5k|{
  829|  14.5k|    if (group->meth->field_type != NID_X9_62_prime_field) {
  ------------------
  |  |  152|  14.5k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (829:9): [True: 0, False: 14.5k]
  ------------------
  830|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  831|      0|        return 0;
  832|      0|    }
  833|  14.5k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (833:9): [True: 0, False: 14.5k]
  ------------------
  834|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  835|      0|        return 0;
  836|      0|    }
  837|  14.5k|    return ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point,
  838|  14.5k|                                                              x, y, z, ctx);
  839|  14.5k|}
EC_POINT_set_affine_coordinates:
  862|  29.2k|{
  863|  29.2k|    if (group->meth->point_set_affine_coordinates == NULL) {
  ------------------
  |  Branch (863:9): [True: 0, False: 29.2k]
  ------------------
  864|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  865|      0|        return 0;
  866|      0|    }
  867|  29.2k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (867:9): [True: 0, False: 29.2k]
  ------------------
  868|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  869|      0|        return 0;
  870|      0|    }
  871|  29.2k|    if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (871:9): [True: 0, False: 29.2k]
  ------------------
  872|      0|        return 0;
  873|       |
  874|  29.2k|    if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
  ------------------
  |  Branch (874:9): [True: 1.49k, False: 27.7k]
  ------------------
  875|  1.49k|        ERR_raise(ERR_LIB_EC, EC_R_POINT_IS_NOT_ON_CURVE);
  ------------------
  |  |  401|  1.49k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.49k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.49k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.49k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.49k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.49k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.49k|     ERR_set_error)
  |  |  ------------------
  ------------------
  876|  1.49k|        return 0;
  877|  1.49k|    }
  878|  27.7k|    return 1;
  879|  29.2k|}
EC_POINT_get_affine_coordinates:
  902|  3.56k|{
  903|  3.56k|    if (group->meth->point_get_affine_coordinates == NULL) {
  ------------------
  |  Branch (903:9): [True: 0, False: 3.56k]
  ------------------
  904|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  905|      0|        return 0;
  906|      0|    }
  907|  3.56k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (907:9): [True: 0, False: 3.56k]
  ------------------
  908|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  909|      0|        return 0;
  910|      0|    }
  911|  3.56k|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (911:9): [True: 12, False: 3.55k]
  ------------------
  912|     12|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|     12|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     12|    (ERR_new(),                                                 \
  |  |  |  |  404|     12|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     12|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     12|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     12|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     12|     ERR_set_error)
  |  |  ------------------
  ------------------
  913|     12|        return 0;
  914|     12|    }
  915|  3.55k|    return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
  916|  3.56k|}
EC_POINT_add:
  938|  7.13k|{
  939|  7.13k|    if (group->meth->add == 0) {
  ------------------
  |  Branch (939:9): [True: 0, False: 7.13k]
  ------------------
  940|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  941|      0|        return 0;
  942|      0|    }
  943|  7.13k|    if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group)
  ------------------
  |  Branch (943:9): [True: 0, False: 7.13k]
  |  Branch (943:42): [True: 0, False: 7.13k]
  ------------------
  944|  7.13k|        || !ec_point_is_compat(b, group)) {
  ------------------
  |  Branch (944:12): [True: 0, False: 7.13k]
  ------------------
  945|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  946|      0|        return 0;
  947|      0|    }
  948|  7.13k|    return group->meth->add(group, r, a, b, ctx);
  949|  7.13k|}
EC_POINT_dbl:
  953|  53.7k|{
  954|  53.7k|    if (group->meth->dbl == 0) {
  ------------------
  |  Branch (954:9): [True: 0, False: 53.7k]
  ------------------
  955|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  956|      0|        return 0;
  957|      0|    }
  958|  53.7k|    if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group)) {
  ------------------
  |  Branch (958:9): [True: 0, False: 53.7k]
  |  Branch (958:42): [True: 0, False: 53.7k]
  ------------------
  959|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  960|      0|        return 0;
  961|      0|    }
  962|  53.7k|    return group->meth->dbl(group, r, a, ctx);
  963|  53.7k|}
EC_POINT_invert:
  966|  2.69k|{
  967|  2.69k|    if (group->meth->invert == 0) {
  ------------------
  |  Branch (967:9): [True: 0, False: 2.69k]
  ------------------
  968|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  969|      0|        return 0;
  970|      0|    }
  971|  2.69k|    if (!ec_point_is_compat(a, group)) {
  ------------------
  |  Branch (971:9): [True: 0, False: 2.69k]
  ------------------
  972|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  973|      0|        return 0;
  974|      0|    }
  975|  2.69k|    return group->meth->invert(group, a, ctx);
  976|  2.69k|}
EC_POINT_is_at_infinity:
  979|   108k|{
  980|   108k|    if (group->meth->is_at_infinity == 0) {
  ------------------
  |  Branch (980:9): [True: 0, False: 108k]
  ------------------
  981|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  982|      0|        return 0;
  983|      0|    }
  984|   108k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (984:9): [True: 0, False: 108k]
  ------------------
  985|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  986|      0|        return 0;
  987|      0|    }
  988|   108k|    return group->meth->is_at_infinity(group, point);
  989|   108k|}
EC_POINT_is_on_curve:
 1000|  29.2k|{
 1001|  29.2k|    if (group->meth->is_on_curve == 0) {
  ------------------
  |  Branch (1001:9): [True: 0, False: 29.2k]
  ------------------
 1002|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1003|      0|        return 0;
 1004|      0|    }
 1005|  29.2k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (1005:9): [True: 0, False: 29.2k]
  ------------------
 1006|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1007|      0|        return 0;
 1008|      0|    }
 1009|  29.2k|    return group->meth->is_on_curve(group, point, ctx);
 1010|  29.2k|}
EC_POINT_cmp:
 1014|     73|{
 1015|     73|    if (group->meth->point_cmp == 0) {
  ------------------
  |  Branch (1015:9): [True: 0, False: 73]
  ------------------
 1016|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1017|      0|        return -1;
 1018|      0|    }
 1019|     73|    if (!ec_point_is_compat(a, group) || !ec_point_is_compat(b, group)) {
  ------------------
  |  Branch (1019:9): [True: 0, False: 73]
  |  Branch (1019:42): [True: 0, False: 73]
  ------------------
 1020|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1021|      0|        return -1;
 1022|      0|    }
 1023|     73|    return group->meth->point_cmp(group, a, b, ctx);
 1024|     73|}
EC_POINT_mul:
 1115|  1.25k|{
 1116|  1.25k|    int ret = 0;
 1117|  1.25k|    size_t num;
 1118|  1.25k|#ifndef FIPS_MODULE
 1119|  1.25k|    BN_CTX *new_ctx = NULL;
 1120|  1.25k|#endif
 1121|       |
 1122|  1.25k|    if (!ec_point_is_compat(r, group)
  ------------------
  |  Branch (1122:9): [True: 0, False: 1.25k]
  ------------------
 1123|  1.25k|        || (point != NULL && !ec_point_is_compat(point, group))) {
  ------------------
  |  Branch (1123:13): [True: 0, False: 1.25k]
  |  Branch (1123:30): [True: 0, False: 0]
  ------------------
 1124|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1125|      0|        return 0;
 1126|      0|    }
 1127|       |
 1128|  1.25k|    if (g_scalar == NULL && p_scalar == NULL)
  ------------------
  |  Branch (1128:9): [True: 0, False: 1.25k]
  |  Branch (1128:29): [True: 0, False: 0]
  ------------------
 1129|      0|        return EC_POINT_set_to_infinity(group, r);
 1130|       |
 1131|  1.25k|#ifndef FIPS_MODULE
 1132|  1.25k|    if (ctx == NULL)
  ------------------
  |  Branch (1132:9): [True: 0, False: 1.25k]
  ------------------
 1133|      0|        ctx = new_ctx = BN_CTX_secure_new();
 1134|  1.25k|#endif
 1135|  1.25k|    if (ctx == NULL) {
  ------------------
  |  Branch (1135:9): [True: 0, False: 1.25k]
  ------------------
 1136|      0|        ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1137|      0|        return 0;
 1138|      0|    }
 1139|       |
 1140|  1.25k|    num = (point != NULL && p_scalar != NULL) ? 1 : 0;
  ------------------
  |  Branch (1140:12): [True: 0, False: 1.25k]
  |  Branch (1140:29): [True: 0, False: 0]
  ------------------
 1141|  1.25k|    if (group->meth->mul != NULL)
  ------------------
  |  Branch (1141:9): [True: 626, False: 629]
  ------------------
 1142|    626|        ret = group->meth->mul(group, r, g_scalar, num, &point, &p_scalar, ctx);
 1143|    629|    else
 1144|       |        /* use default */
 1145|    629|        ret = ossl_ec_wNAF_mul(group, r, g_scalar, num, &point, &p_scalar, ctx);
 1146|       |
 1147|  1.25k|#ifndef FIPS_MODULE
 1148|  1.25k|    BN_CTX_free(new_ctx);
 1149|  1.25k|#endif
 1150|  1.25k|    return ret;
 1151|  1.25k|}
ossl_ec_group_simple_order_bits:
 1226|  27.2k|{
 1227|  27.2k|    if (group->order == NULL)
  ------------------
  |  Branch (1227:9): [True: 0, False: 27.2k]
  ------------------
 1228|      0|        return 0;
 1229|  27.2k|    return BN_num_bits(group->order);
 1230|  27.2k|}
ossl_ec_point_blind_coordinates:
 1314|    197|{
 1315|    197|    if (group->meth->blind_coordinates == NULL)
  ------------------
  |  Branch (1315:9): [True: 0, False: 197]
  ------------------
 1316|      0|        return 1; /* ignore if not implemented */
 1317|       |
 1318|    197|    return group->meth->blind_coordinates(group, p, ctx);
 1319|    197|}
EC_GROUP_get_basis_type:
 1322|  6.06k|{
 1323|  6.06k|    int i;
 1324|       |
 1325|  6.06k|    if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field)
  ------------------
  |  |  156|  6.06k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (1325:9): [True: 0, False: 6.06k]
  ------------------
 1326|       |        /* everything else is currently not supported */
 1327|      0|        return 0;
 1328|       |
 1329|       |    /* Find the last non-zero element of group->poly[] */
 1330|  6.06k|    for (i = 0;
 1331|  23.0k|         i < (int)OSSL_NELEM(group->poly) && group->poly[i] != 0;
  ------------------
  |  |   14|  46.1k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (1331:10): [True: 23.0k, False: 0]
  |  Branch (1331:46): [True: 17.0k, False: 6.06k]
  ------------------
 1332|  17.0k|         i++)
 1333|  17.0k|        continue;
 1334|       |
 1335|  6.06k|    if (i == 4)
  ------------------
  |  Branch (1335:9): [True: 2.45k, False: 3.61k]
  ------------------
 1336|  2.45k|        return NID_X9_62_ppBasis;
  ------------------
  |  |  172|  2.45k|#define NID_X9_62_ppBasis               683
  ------------------
 1337|  3.61k|    else if (i == 2)
  ------------------
  |  Branch (1337:14): [True: 3.61k, False: 0]
  ------------------
 1338|  3.61k|        return NID_X9_62_tpBasis;
  ------------------
  |  |  168|  3.61k|#define NID_X9_62_tpBasis               682
  ------------------
 1339|      0|    else
 1340|       |        /* everything else is currently not supported */
 1341|      0|        return 0;
 1342|  6.06k|}
EC_GROUP_get_trinomial_basis:
 1346|  3.61k|{
 1347|  3.61k|    if (group == NULL)
  ------------------
  |  Branch (1347:9): [True: 0, False: 3.61k]
  ------------------
 1348|      0|        return 0;
 1349|       |
 1350|  3.61k|    if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field
  ------------------
  |  |  156|  7.23k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (1350:9): [True: 0, False: 3.61k]
  ------------------
 1351|  3.61k|        || !((group->poly[0] != 0) && (group->poly[1] != 0)
  ------------------
  |  Branch (1351:14): [True: 3.61k, False: 0]
  |  Branch (1351:39): [True: 3.61k, False: 0]
  ------------------
 1352|  3.61k|             && (group->poly[2] == 0))) {
  ------------------
  |  Branch (1352:17): [True: 3.61k, False: 0]
  ------------------
 1353|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1354|      0|        return 0;
 1355|      0|    }
 1356|       |
 1357|  3.61k|    if (k)
  ------------------
  |  Branch (1357:9): [True: 3.61k, False: 0]
  ------------------
 1358|  3.61k|        *k = group->poly[1];
 1359|       |
 1360|  3.61k|    return 1;
 1361|  3.61k|}
EC_GROUP_get_pentanomial_basis:
 1365|  2.45k|{
 1366|  2.45k|    if (group == NULL)
  ------------------
  |  Branch (1366:9): [True: 0, False: 2.45k]
  ------------------
 1367|      0|        return 0;
 1368|       |
 1369|  2.45k|    if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field
  ------------------
  |  |  156|  4.90k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (1369:9): [True: 0, False: 2.45k]
  ------------------
 1370|  2.45k|        || !((group->poly[0] != 0) && (group->poly[1] != 0)
  ------------------
  |  Branch (1370:14): [True: 2.45k, False: 0]
  |  Branch (1370:39): [True: 2.45k, False: 0]
  ------------------
 1371|  2.45k|             && (group->poly[2] != 0) && (group->poly[3] != 0)
  ------------------
  |  Branch (1371:17): [True: 2.45k, False: 0]
  |  Branch (1371:42): [True: 2.45k, False: 0]
  ------------------
 1372|  2.45k|             && (group->poly[4] == 0))) {
  ------------------
  |  Branch (1372:17): [True: 2.45k, False: 0]
  ------------------
 1373|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1374|      0|        return 0;
 1375|      0|    }
 1376|       |
 1377|  2.45k|    if (k1)
  ------------------
  |  Branch (1377:9): [True: 2.45k, False: 0]
  ------------------
 1378|  2.45k|        *k1 = group->poly[3];
 1379|  2.45k|    if (k2)
  ------------------
  |  Branch (1379:9): [True: 2.45k, False: 0]
  ------------------
 1380|  2.45k|        *k2 = group->poly[2];
 1381|  2.45k|    if (k3)
  ------------------
  |  Branch (1381:9): [True: 2.45k, False: 0]
  ------------------
 1382|  2.45k|        *k3 = group->poly[1];
 1383|       |
 1384|  2.45k|    return 1;
 1385|  2.45k|}
ec_lib.c:ec_guess_cofactor:
  318|  2.32k|static int ec_guess_cofactor(EC_GROUP *group) {
  319|  2.32k|    int ret = 0;
  320|  2.32k|    BN_CTX *ctx = NULL;
  321|  2.32k|    BIGNUM *q = NULL;
  322|       |
  323|       |    /*-
  324|       |     * If the cofactor is too large, we cannot guess it.
  325|       |     * The RHS of below is a strict overestimate of lg(4 * sqrt(q))
  326|       |     */
  327|  2.32k|    if (BN_num_bits(group->order) <= (BN_num_bits(group->field) + 1) / 2 + 3) {
  ------------------
  |  Branch (327:9): [True: 533, False: 1.79k]
  ------------------
  328|       |        /* default to 0 */
  329|    533|        BN_zero(group->cofactor);
  ------------------
  |  |  202|    533|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  330|       |        /* return success */
  331|    533|        return 1;
  332|    533|    }
  333|       |
  334|  1.79k|    if ((ctx = BN_CTX_new_ex(group->libctx)) == NULL)
  ------------------
  |  Branch (334:9): [True: 0, False: 1.79k]
  ------------------
  335|      0|        return 0;
  336|       |
  337|  1.79k|    BN_CTX_start(ctx);
  338|  1.79k|    if ((q = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (338:9): [True: 0, False: 1.79k]
  ------------------
  339|      0|        goto err;
  340|       |
  341|       |    /* set q = 2**m for binary fields; q = p otherwise */
  342|  1.79k|    if (group->meth->field_type == NID_X9_62_characteristic_two_field) {
  ------------------
  |  |  156|  1.79k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (342:9): [True: 0, False: 1.79k]
  ------------------
  343|      0|        BN_zero(q);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  344|      0|        if (!BN_set_bit(q, BN_num_bits(group->field) - 1))
  ------------------
  |  Branch (344:13): [True: 0, False: 0]
  ------------------
  345|      0|            goto err;
  346|  1.79k|    } else {
  347|  1.79k|        if (!BN_copy(q, group->field))
  ------------------
  |  Branch (347:13): [True: 0, False: 1.79k]
  ------------------
  348|      0|            goto err;
  349|  1.79k|    }
  350|       |
  351|       |    /* compute h = \lfloor (q + 1)/n \rceil = \lfloor (q + 1 + n/2)/n \rfloor */
  352|  1.79k|    if (!BN_rshift1(group->cofactor, group->order) /* n/2 */
  ------------------
  |  Branch (352:9): [True: 0, False: 1.79k]
  ------------------
  353|  1.79k|        || !BN_add(group->cofactor, group->cofactor, q) /* q + n/2 */
  ------------------
  |  Branch (353:12): [True: 0, False: 1.79k]
  ------------------
  354|       |        /* q + 1 + n/2 */
  355|  1.79k|        || !BN_add(group->cofactor, group->cofactor, BN_value_one())
  ------------------
  |  Branch (355:12): [True: 0, False: 1.79k]
  ------------------
  356|       |        /* (q + 1 + n/2)/n */
  357|  1.79k|        || !BN_div(group->cofactor, NULL, group->cofactor, group->order, ctx))
  ------------------
  |  Branch (357:12): [True: 0, False: 1.79k]
  ------------------
  358|      0|        goto err;
  359|  1.79k|    ret = 1;
  360|  1.79k| err:
  361|  1.79k|    BN_CTX_end(ctx);
  362|  1.79k|    BN_CTX_free(ctx);
  363|  1.79k|    return ret;
  364|  1.79k|}
ec_lib.c:ec_precompute_mont_data:
 1185|  17.2k|{
 1186|  17.2k|    BN_CTX *ctx = BN_CTX_new_ex(group->libctx);
 1187|  17.2k|    int ret = 0;
 1188|       |
 1189|  17.2k|    BN_MONT_CTX_free(group->mont_data);
 1190|  17.2k|    group->mont_data = NULL;
 1191|       |
 1192|  17.2k|    if (ctx == NULL)
  ------------------
  |  Branch (1192:9): [True: 0, False: 17.2k]
  ------------------
 1193|      0|        goto err;
 1194|       |
 1195|  17.2k|    group->mont_data = BN_MONT_CTX_new();
 1196|  17.2k|    if (group->mont_data == NULL)
  ------------------
  |  Branch (1196:9): [True: 0, False: 17.2k]
  ------------------
 1197|      0|        goto err;
 1198|       |
 1199|  17.2k|    if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
  ------------------
  |  Branch (1199:9): [True: 0, False: 17.2k]
  ------------------
 1200|      0|        BN_MONT_CTX_free(group->mont_data);
 1201|      0|        group->mont_data = NULL;
 1202|      0|        goto err;
 1203|      0|    }
 1204|       |
 1205|  17.2k|    ret = 1;
 1206|       |
 1207|  17.2k| err:
 1208|       |
 1209|  17.2k|    BN_CTX_free(ctx);
 1210|  17.2k|    return ret;
 1211|  17.2k|}

ec_lib.c:ec_point_is_compat:
  328|   317k|{
  329|   317k|    return group->meth == point->meth
  ------------------
  |  Branch (329:12): [True: 317k, False: 0]
  ------------------
  330|   317k|           && (group->curve_name == 0
  ------------------
  |  Branch (330:16): [True: 222k, False: 95.4k]
  ------------------
  331|   317k|               || point->curve_name == 0
  ------------------
  |  Branch (331:19): [True: 0, False: 95.4k]
  ------------------
  332|   317k|               || group->curve_name == point->curve_name);
  ------------------
  |  Branch (332:19): [True: 95.4k, False: 0]
  ------------------
  333|   317k|}
ec_mult.c:ec_point_ladder_pre:
  768|    969|{
  769|    969|    if (group->meth->ladder_pre != NULL)
  ------------------
  |  Branch (769:9): [True: 969, False: 0]
  ------------------
  770|    969|        return group->meth->ladder_pre(group, r, s, p, ctx);
  771|       |
  772|      0|    if (!EC_POINT_copy(s, p)
  ------------------
  |  Branch (772:9): [True: 0, False: 0]
  ------------------
  773|      0|        || !EC_POINT_dbl(group, r, s, ctx))
  ------------------
  |  Branch (773:12): [True: 0, False: 0]
  ------------------
  774|      0|        return 0;
  775|       |
  776|      0|    return 1;
  777|      0|}
ec_mult.c:ec_point_ladder_step:
  782|   338k|{
  783|   338k|    if (group->meth->ladder_step != NULL)
  ------------------
  |  Branch (783:9): [True: 338k, False: 0]
  ------------------
  784|   338k|        return group->meth->ladder_step(group, r, s, p, ctx);
  785|       |
  786|      0|    if (!EC_POINT_add(group, s, r, s, ctx)
  ------------------
  |  Branch (786:9): [True: 0, False: 0]
  ------------------
  787|      0|        || !EC_POINT_dbl(group, r, r, ctx))
  ------------------
  |  Branch (787:12): [True: 0, False: 0]
  ------------------
  788|      0|        return 0;
  789|       |
  790|      0|    return 1;
  791|       |
  792|      0|}
ec_mult.c:ec_point_ladder_post:
  797|    969|{
  798|    969|    if (group->meth->ladder_post != NULL)
  ------------------
  |  Branch (798:9): [True: 969, False: 0]
  ------------------
  799|    969|        return group->meth->ladder_post(group, r, s, p, ctx);
  800|       |
  801|      0|    return 1;
  802|    969|}
ec_oct.c:ec_point_is_compat:
  328|  35.4k|{
  329|  35.4k|    return group->meth == point->meth
  ------------------
  |  Branch (329:12): [True: 35.4k, False: 0]
  ------------------
  330|  35.4k|           && (group->curve_name == 0
  ------------------
  |  Branch (330:16): [True: 5.44k, False: 29.9k]
  ------------------
  331|  35.4k|               || point->curve_name == 0
  ------------------
  |  Branch (331:19): [True: 0, False: 29.9k]
  ------------------
  332|  35.4k|               || group->curve_name == point->curve_name);
  ------------------
  |  Branch (332:19): [True: 29.9k, False: 0]
  ------------------
  333|  35.4k|}

ossl_ec_scalar_mul_ladder:
  142|    969|{
  143|    969|    int i, cardinality_bits, group_top, kbit, pbit, Z_is_one;
  144|    969|    EC_POINT *p = NULL;
  145|    969|    EC_POINT *s = NULL;
  146|    969|    BIGNUM *k = NULL;
  147|    969|    BIGNUM *lambda = NULL;
  148|    969|    BIGNUM *cardinality = NULL;
  149|    969|    int ret = 0;
  150|       |
  151|       |    /* early exit if the input point is the point at infinity */
  152|    969|    if (point != NULL && EC_POINT_is_at_infinity(group, point))
  ------------------
  |  Branch (152:9): [True: 0, False: 969]
  |  Branch (152:26): [True: 0, False: 0]
  ------------------
  153|      0|        return EC_POINT_set_to_infinity(group, r);
  154|       |
  155|    969|    if (BN_is_zero(group->order)) {
  ------------------
  |  Branch (155:9): [True: 0, False: 969]
  ------------------
  156|      0|        ERR_raise(ERR_LIB_EC, EC_R_UNKNOWN_ORDER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  157|      0|        return 0;
  158|      0|    }
  159|    969|    if (BN_is_zero(group->cofactor)) {
  ------------------
  |  Branch (159:9): [True: 0, False: 969]
  ------------------
  160|      0|        ERR_raise(ERR_LIB_EC, EC_R_UNKNOWN_COFACTOR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  161|      0|        return 0;
  162|      0|    }
  163|       |
  164|    969|    BN_CTX_start(ctx);
  165|       |
  166|    969|    if (((p = EC_POINT_new(group)) == NULL)
  ------------------
  |  Branch (166:9): [True: 0, False: 969]
  ------------------
  167|    969|        || ((s = EC_POINT_new(group)) == NULL)) {
  ------------------
  |  Branch (167:12): [True: 0, False: 969]
  ------------------
  168|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  169|      0|        goto err;
  170|      0|    }
  171|       |
  172|    969|    if (point == NULL) {
  ------------------
  |  Branch (172:9): [True: 969, False: 0]
  ------------------
  173|    969|        if (!EC_POINT_copy(p, group->generator)) {
  ------------------
  |  Branch (173:13): [True: 0, False: 969]
  ------------------
  174|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  175|      0|            goto err;
  176|      0|        }
  177|    969|    } else {
  178|      0|        if (!EC_POINT_copy(p, point)) {
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  ------------------
  179|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  180|      0|            goto err;
  181|      0|        }
  182|      0|    }
  183|       |
  184|    969|    EC_POINT_BN_set_flags(p, BN_FLG_CONSTTIME);
  ------------------
  |  |  104|    969|#define EC_POINT_BN_set_flags(P, flags) do { \
  |  |  105|    969|    BN_set_flags((P)->X, (flags)); \
  |  |  106|    969|    BN_set_flags((P)->Y, (flags)); \
  |  |  107|    969|    BN_set_flags((P)->Z, (flags)); \
  |  |  108|    969|} while(0)
  |  |  ------------------
  |  |  |  Branch (108:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|    969|    EC_POINT_BN_set_flags(r, BN_FLG_CONSTTIME);
  ------------------
  |  |  104|    969|#define EC_POINT_BN_set_flags(P, flags) do { \
  |  |  105|    969|    BN_set_flags((P)->X, (flags)); \
  |  |  106|    969|    BN_set_flags((P)->Y, (flags)); \
  |  |  107|    969|    BN_set_flags((P)->Z, (flags)); \
  |  |  108|    969|} while(0)
  |  |  ------------------
  |  |  |  Branch (108:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|    969|    EC_POINT_BN_set_flags(s, BN_FLG_CONSTTIME);
  ------------------
  |  |  104|    969|#define EC_POINT_BN_set_flags(P, flags) do { \
  |  |  105|    969|    BN_set_flags((P)->X, (flags)); \
  |  |  106|    969|    BN_set_flags((P)->Y, (flags)); \
  |  |  107|    969|    BN_set_flags((P)->Z, (flags)); \
  |  |  108|    969|} while(0)
  |  |  ------------------
  |  |  |  Branch (108:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  187|       |
  188|    969|    cardinality = BN_CTX_get(ctx);
  189|    969|    lambda = BN_CTX_get(ctx);
  190|    969|    k = BN_CTX_get(ctx);
  191|    969|    if (k == NULL) {
  ------------------
  |  Branch (191:9): [True: 0, False: 969]
  ------------------
  192|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  193|      0|        goto err;
  194|      0|    }
  195|       |
  196|    969|    if (!BN_mul(cardinality, group->order, group->cofactor, ctx)) {
  ------------------
  |  Branch (196:9): [True: 0, False: 969]
  ------------------
  197|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  198|      0|        goto err;
  199|      0|    }
  200|       |
  201|       |    /*
  202|       |     * Group cardinalities are often on a word boundary.
  203|       |     * So when we pad the scalar, some timing diff might
  204|       |     * pop if it needs to be expanded due to carries.
  205|       |     * So expand ahead of time.
  206|       |     */
  207|    969|    cardinality_bits = BN_num_bits(cardinality);
  208|    969|    group_top = bn_get_top(cardinality);
  209|    969|    if ((bn_wexpand(k, group_top + 2) == NULL)
  ------------------
  |  Branch (209:9): [True: 0, False: 969]
  ------------------
  210|    969|        || (bn_wexpand(lambda, group_top + 2) == NULL)) {
  ------------------
  |  Branch (210:12): [True: 0, False: 969]
  ------------------
  211|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  212|      0|        goto err;
  213|      0|    }
  214|       |
  215|    969|    if (!BN_copy(k, scalar)) {
  ------------------
  |  Branch (215:9): [True: 0, False: 969]
  ------------------
  216|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  217|      0|        goto err;
  218|      0|    }
  219|       |
  220|    969|    BN_set_flags(k, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|    969|# define BN_FLG_CONSTTIME        0x04
  ------------------
  221|       |
  222|    969|    if ((BN_num_bits(k) > cardinality_bits) || (BN_is_negative(k))) {
  ------------------
  |  Branch (222:9): [True: 252, False: 717]
  |  Branch (222:48): [True: 0, False: 717]
  ------------------
  223|       |        /*-
  224|       |         * this is an unusual input, and we don't guarantee
  225|       |         * constant-timeness
  226|       |         */
  227|    252|        if (!BN_nnmod(k, k, cardinality, ctx)) {
  ------------------
  |  Branch (227:13): [True: 0, False: 252]
  ------------------
  228|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  229|      0|            goto err;
  230|      0|        }
  231|    252|    }
  232|       |
  233|    969|    if (!BN_add(lambda, k, cardinality)) {
  ------------------
  |  Branch (233:9): [True: 0, False: 969]
  ------------------
  234|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  235|      0|        goto err;
  236|      0|    }
  237|    969|    BN_set_flags(lambda, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|    969|# define BN_FLG_CONSTTIME        0x04
  ------------------
  238|    969|    if (!BN_add(k, lambda, cardinality)) {
  ------------------
  |  Branch (238:9): [True: 0, False: 969]
  ------------------
  239|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  240|      0|        goto err;
  241|      0|    }
  242|       |    /*
  243|       |     * lambda := scalar + cardinality
  244|       |     * k := scalar + 2*cardinality
  245|       |     */
  246|    969|    kbit = BN_is_bit_set(lambda, cardinality_bits);
  247|    969|    BN_consttime_swap(kbit, k, lambda, group_top + 2);
  248|       |
  249|    969|    group_top = bn_get_top(group->field);
  250|    969|    if ((bn_wexpand(s->X, group_top) == NULL)
  ------------------
  |  Branch (250:9): [True: 0, False: 969]
  ------------------
  251|    969|        || (bn_wexpand(s->Y, group_top) == NULL)
  ------------------
  |  Branch (251:12): [True: 0, False: 969]
  ------------------
  252|    969|        || (bn_wexpand(s->Z, group_top) == NULL)
  ------------------
  |  Branch (252:12): [True: 0, False: 969]
  ------------------
  253|    969|        || (bn_wexpand(r->X, group_top) == NULL)
  ------------------
  |  Branch (253:12): [True: 0, False: 969]
  ------------------
  254|    969|        || (bn_wexpand(r->Y, group_top) == NULL)
  ------------------
  |  Branch (254:12): [True: 0, False: 969]
  ------------------
  255|    969|        || (bn_wexpand(r->Z, group_top) == NULL)
  ------------------
  |  Branch (255:12): [True: 0, False: 969]
  ------------------
  256|    969|        || (bn_wexpand(p->X, group_top) == NULL)
  ------------------
  |  Branch (256:12): [True: 0, False: 969]
  ------------------
  257|    969|        || (bn_wexpand(p->Y, group_top) == NULL)
  ------------------
  |  Branch (257:12): [True: 0, False: 969]
  ------------------
  258|    969|        || (bn_wexpand(p->Z, group_top) == NULL)) {
  ------------------
  |  Branch (258:12): [True: 0, False: 969]
  ------------------
  259|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  260|      0|        goto err;
  261|      0|    }
  262|       |
  263|       |    /* ensure input point is in affine coords for ladder step efficiency */
  264|    969|    if (!p->Z_is_one && (group->meth->make_affine == NULL
  ------------------
  |  Branch (264:9): [True: 0, False: 969]
  |  Branch (264:26): [True: 0, False: 0]
  ------------------
  265|      0|                         || !group->meth->make_affine(group, p, ctx))) {
  ------------------
  |  Branch (265:29): [True: 0, False: 0]
  ------------------
  266|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  267|      0|            goto err;
  268|      0|    }
  269|       |
  270|       |    /* Initialize the Montgomery ladder */
  271|    969|    if (!ec_point_ladder_pre(group, r, s, p, ctx)) {
  ------------------
  |  Branch (271:9): [True: 0, False: 969]
  ------------------
  272|      0|        ERR_raise(ERR_LIB_EC, EC_R_LADDER_PRE_FAILURE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  273|      0|        goto err;
  274|      0|    }
  275|       |
  276|       |    /* top bit is a 1, in a fixed pos */
  277|    969|    pbit = 1;
  278|       |
  279|    969|#define EC_POINT_CSWAP(c, a, b, w, t) do {         \
  280|    969|        BN_consttime_swap(c, (a)->X, (b)->X, w);   \
  281|    969|        BN_consttime_swap(c, (a)->Y, (b)->Y, w);   \
  282|    969|        BN_consttime_swap(c, (a)->Z, (b)->Z, w);   \
  283|    969|        t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \
  284|    969|        (a)->Z_is_one ^= (t);                      \
  285|    969|        (b)->Z_is_one ^= (t);                      \
  286|    969|} while(0)
  287|       |
  288|       |    /*-
  289|       |     * The ladder step, with branches, is
  290|       |     *
  291|       |     * k[i] == 0: S = add(R, S), R = dbl(R)
  292|       |     * k[i] == 1: R = add(S, R), S = dbl(S)
  293|       |     *
  294|       |     * Swapping R, S conditionally on k[i] leaves you with state
  295|       |     *
  296|       |     * k[i] == 0: T, U = R, S
  297|       |     * k[i] == 1: T, U = S, R
  298|       |     *
  299|       |     * Then perform the ECC ops.
  300|       |     *
  301|       |     * U = add(T, U)
  302|       |     * T = dbl(T)
  303|       |     *
  304|       |     * Which leaves you with state
  305|       |     *
  306|       |     * k[i] == 0: U = add(R, S), T = dbl(R)
  307|       |     * k[i] == 1: U = add(S, R), T = dbl(S)
  308|       |     *
  309|       |     * Swapping T, U conditionally on k[i] leaves you with state
  310|       |     *
  311|       |     * k[i] == 0: R, S = T, U
  312|       |     * k[i] == 1: R, S = U, T
  313|       |     *
  314|       |     * Which leaves you with state
  315|       |     *
  316|       |     * k[i] == 0: S = add(R, S), R = dbl(R)
  317|       |     * k[i] == 1: R = add(S, R), S = dbl(S)
  318|       |     *
  319|       |     * So we get the same logic, but instead of a branch it's a
  320|       |     * conditional swap, followed by ECC ops, then another conditional swap.
  321|       |     *
  322|       |     * Optimization: The end of iteration i and start of i-1 looks like
  323|       |     *
  324|       |     * ...
  325|       |     * CSWAP(k[i], R, S)
  326|       |     * ECC
  327|       |     * CSWAP(k[i], R, S)
  328|       |     * (next iteration)
  329|       |     * CSWAP(k[i-1], R, S)
  330|       |     * ECC
  331|       |     * CSWAP(k[i-1], R, S)
  332|       |     * ...
  333|       |     *
  334|       |     * So instead of two contiguous swaps, you can merge the condition
  335|       |     * bits and do a single swap.
  336|       |     *
  337|       |     * k[i]   k[i-1]    Outcome
  338|       |     * 0      0         No Swap
  339|       |     * 0      1         Swap
  340|       |     * 1      0         Swap
  341|       |     * 1      1         No Swap
  342|       |     *
  343|       |     * This is XOR. pbit tracks the previous bit of k.
  344|       |     */
  345|       |
  346|   339k|    for (i = cardinality_bits - 1; i >= 0; i--) {
  ------------------
  |  Branch (346:36): [True: 338k, False: 969]
  ------------------
  347|   338k|        kbit = BN_is_bit_set(k, i) ^ pbit;
  348|   338k|        EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one);
  ------------------
  |  |  279|   338k|#define EC_POINT_CSWAP(c, a, b, w, t) do {         \
  |  |  280|   338k|        BN_consttime_swap(c, (a)->X, (b)->X, w);   \
  |  |  281|   338k|        BN_consttime_swap(c, (a)->Y, (b)->Y, w);   \
  |  |  282|   338k|        BN_consttime_swap(c, (a)->Z, (b)->Z, w);   \
  |  |  283|   338k|        t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \
  |  |  284|   338k|        (a)->Z_is_one ^= (t);                      \
  |  |  285|   338k|        (b)->Z_is_one ^= (t);                      \
  |  |  286|   338k|} while(0)
  |  |  ------------------
  |  |  |  Branch (286:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  349|       |
  350|       |        /* Perform a single step of the Montgomery ladder */
  351|   338k|        if (!ec_point_ladder_step(group, r, s, p, ctx)) {
  ------------------
  |  Branch (351:13): [True: 0, False: 338k]
  ------------------
  352|      0|            ERR_raise(ERR_LIB_EC, EC_R_LADDER_STEP_FAILURE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  353|      0|            goto err;
  354|      0|        }
  355|       |        /*
  356|       |         * pbit logic merges this cswap with that of the
  357|       |         * next iteration
  358|       |         */
  359|   338k|        pbit ^= kbit;
  360|   338k|    }
  361|       |    /* one final cswap to move the right value into r */
  362|    969|    EC_POINT_CSWAP(pbit, r, s, group_top, Z_is_one);
  ------------------
  |  |  279|    969|#define EC_POINT_CSWAP(c, a, b, w, t) do {         \
  |  |  280|    969|        BN_consttime_swap(c, (a)->X, (b)->X, w);   \
  |  |  281|    969|        BN_consttime_swap(c, (a)->Y, (b)->Y, w);   \
  |  |  282|    969|        BN_consttime_swap(c, (a)->Z, (b)->Z, w);   \
  |  |  283|    969|        t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \
  |  |  284|    969|        (a)->Z_is_one ^= (t);                      \
  |  |  285|    969|        (b)->Z_is_one ^= (t);                      \
  |  |  286|    969|} while(0)
  |  |  ------------------
  |  |  |  Branch (286:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  363|    969|#undef EC_POINT_CSWAP
  364|       |
  365|       |    /* Finalize ladder (and recover full point coordinates) */
  366|    969|    if (!ec_point_ladder_post(group, r, s, p, ctx)) {
  ------------------
  |  Branch (366:9): [True: 0, False: 969]
  ------------------
  367|      0|        ERR_raise(ERR_LIB_EC, EC_R_LADDER_POST_FAILURE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  368|      0|        goto err;
  369|      0|    }
  370|       |
  371|    969|    ret = 1;
  372|       |
  373|    969| err:
  374|    969|    EC_POINT_free(p);
  375|    969|    EC_POINT_clear_free(s);
  376|    969|    BN_CTX_end(ctx);
  377|       |
  378|    969|    return ret;
  379|    969|}
ossl_ec_wNAF_mul:
  407|    629|{
  408|    629|    const EC_POINT *generator = NULL;
  409|    629|    EC_POINT *tmp = NULL;
  410|    629|    size_t totalnum;
  411|    629|    size_t blocksize = 0, numblocks = 0; /* for wNAF splitting */
  412|    629|    size_t pre_points_per_block = 0;
  413|    629|    size_t i, j;
  414|    629|    int k;
  415|    629|    int r_is_inverted = 0;
  416|    629|    int r_is_at_infinity = 1;
  417|    629|    size_t *wsize = NULL;       /* individual window sizes */
  418|    629|    signed char **wNAF = NULL;  /* individual wNAFs */
  419|    629|    size_t *wNAF_len = NULL;
  420|    629|    size_t max_len = 0;
  421|    629|    size_t num_val;
  422|    629|    EC_POINT **val = NULL;      /* precomputation */
  423|    629|    EC_POINT **v;
  424|    629|    EC_POINT ***val_sub = NULL; /* pointers to sub-arrays of 'val' or
  425|       |                                 * 'pre_comp->points' */
  426|    629|    const EC_PRE_COMP *pre_comp = NULL;
  427|    629|    int num_scalar = 0;         /* flag: will be set to 1 if 'scalar' must be
  428|       |                                 * treated like other scalars, i.e.
  429|       |                                 * precomputation is not available */
  430|    629|    int ret = 0;
  431|       |
  432|    629|    if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) {
  ------------------
  |  Branch (432:9): [True: 629, False: 0]
  |  Branch (432:38): [True: 428, False: 201]
  ------------------
  433|       |        /*-
  434|       |         * Handle the common cases where the scalar is secret, enforcing a
  435|       |         * scalar multiplication implementation based on a Montgomery ladder,
  436|       |         * with various timing attack defenses.
  437|       |         */
  438|    428|        if ((scalar != group->order) && (scalar != NULL) && (num == 0)) {
  ------------------
  |  Branch (438:13): [True: 428, False: 0]
  |  Branch (438:41): [True: 428, False: 0]
  |  Branch (438:61): [True: 428, False: 0]
  ------------------
  439|       |            /*-
  440|       |             * In this case we want to compute scalar * GeneratorPoint: this
  441|       |             * codepath is reached most prominently by (ephemeral) key
  442|       |             * generation of EC cryptosystems (i.e. ECDSA keygen and sign setup,
  443|       |             * ECDH keygen/first half), where the scalar is always secret. This
  444|       |             * is why we ignore if BN_FLG_CONSTTIME is actually set and we
  445|       |             * always call the ladder version.
  446|       |             */
  447|    428|            return ossl_ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
  448|    428|        }
  449|      0|        if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) {
  ------------------
  |  Branch (449:13): [True: 0, False: 0]
  |  Branch (449:33): [True: 0, False: 0]
  |  Branch (449:47): [True: 0, False: 0]
  ------------------
  450|       |            /*-
  451|       |             * In this case we want to compute scalar * VariablePoint: this
  452|       |             * codepath is reached most prominently by the second half of ECDH,
  453|       |             * where the secret scalar is multiplied by the peer's public point.
  454|       |             * To protect the secret scalar, we ignore if BN_FLG_CONSTTIME is
  455|       |             * actually set and we always call the ladder version.
  456|       |             */
  457|      0|            return ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0],
  458|      0|                                             ctx);
  459|      0|        }
  460|      0|    }
  461|       |
  462|    201|    if (scalar != NULL) {
  ------------------
  |  Branch (462:9): [True: 201, False: 0]
  ------------------
  463|    201|        generator = EC_GROUP_get0_generator(group);
  464|    201|        if (generator == NULL) {
  ------------------
  |  Branch (464:13): [True: 0, False: 201]
  ------------------
  465|      0|            ERR_raise(ERR_LIB_EC, EC_R_UNDEFINED_GENERATOR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  466|      0|            goto err;
  467|      0|        }
  468|       |
  469|       |        /* look if we can use precomputed multiples of generator */
  470|       |
  471|    201|        pre_comp = group->pre_comp.ec;
  472|    201|        if (pre_comp && pre_comp->numblocks
  ------------------
  |  Branch (472:13): [True: 0, False: 201]
  |  Branch (472:25): [True: 0, False: 0]
  ------------------
  473|    201|            && (EC_POINT_cmp(group, generator, pre_comp->points[0], ctx) ==
  ------------------
  |  Branch (473:16): [True: 0, False: 0]
  ------------------
  474|      0|                0)) {
  475|      0|            blocksize = pre_comp->blocksize;
  476|       |
  477|       |            /*
  478|       |             * determine maximum number of blocks that wNAF splitting may
  479|       |             * yield (NB: maximum wNAF length is bit length plus one)
  480|       |             */
  481|      0|            numblocks = (BN_num_bits(scalar) / blocksize) + 1;
  482|       |
  483|       |            /*
  484|       |             * we cannot use more blocks than we have precomputation for
  485|       |             */
  486|      0|            if (numblocks > pre_comp->numblocks)
  ------------------
  |  Branch (486:17): [True: 0, False: 0]
  ------------------
  487|      0|                numblocks = pre_comp->numblocks;
  488|       |
  489|      0|            pre_points_per_block = (size_t)1 << (pre_comp->w - 1);
  490|       |
  491|       |            /* check that pre_comp looks sane */
  492|      0|            if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) {
  ------------------
  |  Branch (492:17): [True: 0, False: 0]
  ------------------
  493|      0|                ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  494|      0|                goto err;
  495|      0|            }
  496|    201|        } else {
  497|       |            /* can't use precomputation */
  498|    201|            pre_comp = NULL;
  499|    201|            numblocks = 1;
  500|    201|            num_scalar = 1;     /* treat 'scalar' like 'num'-th element of
  501|       |                                 * 'scalars' */
  502|    201|        }
  503|    201|    }
  504|       |
  505|    201|    totalnum = num + numblocks;
  506|       |
  507|    201|    wsize = OPENSSL_malloc(totalnum * sizeof(wsize[0]));
  ------------------
  |  |   97|    201|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  508|    201|    wNAF_len = OPENSSL_malloc(totalnum * sizeof(wNAF_len[0]));
  ------------------
  |  |   97|    201|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  509|       |    /* include space for pivot */
  510|    201|    wNAF = OPENSSL_malloc((totalnum + 1) * sizeof(wNAF[0]));
  ------------------
  |  |   97|    201|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  511|    201|    val_sub = OPENSSL_malloc(totalnum * sizeof(val_sub[0]));
  ------------------
  |  |   97|    201|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  512|       |
  513|       |    /* Ensure wNAF is initialised in case we end up going to err */
  514|    201|    if (wNAF != NULL)
  ------------------
  |  Branch (514:9): [True: 201, False: 0]
  ------------------
  515|    201|        wNAF[0] = NULL;         /* preliminary pivot */
  516|       |
  517|    201|    if (wsize == NULL || wNAF_len == NULL || wNAF == NULL || val_sub == NULL)
  ------------------
  |  Branch (517:9): [True: 0, False: 201]
  |  Branch (517:26): [True: 0, False: 201]
  |  Branch (517:46): [True: 0, False: 201]
  |  Branch (517:62): [True: 0, False: 201]
  ------------------
  518|      0|        goto err;
  519|       |
  520|       |    /*
  521|       |     * num_val will be the total number of temporarily precomputed points
  522|       |     */
  523|    201|    num_val = 0;
  524|       |
  525|    402|    for (i = 0; i < num + num_scalar; i++) {
  ------------------
  |  Branch (525:17): [True: 201, False: 201]
  ------------------
  526|    201|        size_t bits;
  527|       |
  528|    201|        bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar);
  ------------------
  |  Branch (528:16): [True: 0, False: 201]
  ------------------
  529|    201|        wsize[i] = EC_window_bits_for_scalar_size(bits);
  ------------------
  |  |  389|    201|                ((size_t) \
  |  |  390|    201|                 ((b) >= 2000 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (390:19): [True: 6, False: 195]
  |  |  ------------------
  |  |  391|    201|                  (b) >=  800 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (391:19): [True: 15, False: 180]
  |  |  ------------------
  |  |  392|    195|                  (b) >=  300 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (392:19): [True: 41, False: 139]
  |  |  ------------------
  |  |  393|    180|                  (b) >=   70 ? 3 : \
  |  |  ------------------
  |  |  |  Branch (393:19): [True: 15, False: 124]
  |  |  ------------------
  |  |  394|    139|                  (b) >=   20 ? 2 : \
  |  |  ------------------
  |  |  |  Branch (394:19): [True: 42, False: 82]
  |  |  ------------------
  |  |  395|    124|                  1))
  ------------------
  530|    201|        num_val += (size_t)1 << (wsize[i] - 1);
  531|    201|        wNAF[i + 1] = NULL;     /* make sure we always have a pivot */
  532|    201|        wNAF[i] =
  533|    201|            bn_compute_wNAF((i < num ? scalars[i] : scalar), wsize[i],
  ------------------
  |  Branch (533:30): [True: 0, False: 201]
  ------------------
  534|    201|                            &wNAF_len[i]);
  535|    201|        if (wNAF[i] == NULL)
  ------------------
  |  Branch (535:13): [True: 0, False: 201]
  ------------------
  536|      0|            goto err;
  537|    201|        if (wNAF_len[i] > max_len)
  ------------------
  |  Branch (537:13): [True: 201, False: 0]
  ------------------
  538|    201|            max_len = wNAF_len[i];
  539|    201|    }
  540|       |
  541|    201|    if (numblocks) {
  ------------------
  |  Branch (541:9): [True: 201, False: 0]
  ------------------
  542|       |        /* we go here iff scalar != NULL */
  543|       |
  544|    201|        if (pre_comp == NULL) {
  ------------------
  |  Branch (544:13): [True: 201, False: 0]
  ------------------
  545|    201|            if (num_scalar != 1) {
  ------------------
  |  Branch (545:17): [True: 0, False: 201]
  ------------------
  546|      0|                ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  547|      0|                goto err;
  548|      0|            }
  549|       |            /* we have already generated a wNAF for 'scalar' */
  550|    201|        } else {
  551|      0|            signed char *tmp_wNAF = NULL;
  552|      0|            size_t tmp_len = 0;
  553|       |
  554|      0|            if (num_scalar != 0) {
  ------------------
  |  Branch (554:17): [True: 0, False: 0]
  ------------------
  555|      0|                ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  556|      0|                goto err;
  557|      0|            }
  558|       |
  559|       |            /*
  560|       |             * use the window size for which we have precomputation
  561|       |             */
  562|      0|            wsize[num] = pre_comp->w;
  563|      0|            tmp_wNAF = bn_compute_wNAF(scalar, wsize[num], &tmp_len);
  564|      0|            if (!tmp_wNAF)
  ------------------
  |  Branch (564:17): [True: 0, False: 0]
  ------------------
  565|      0|                goto err;
  566|       |
  567|      0|            if (tmp_len <= max_len) {
  ------------------
  |  Branch (567:17): [True: 0, False: 0]
  ------------------
  568|       |                /*
  569|       |                 * One of the other wNAFs is at least as long as the wNAF
  570|       |                 * belonging to the generator, so wNAF splitting will not buy
  571|       |                 * us anything.
  572|       |                 */
  573|       |
  574|      0|                numblocks = 1;
  575|      0|                totalnum = num + 1; /* don't use wNAF splitting */
  576|      0|                wNAF[num] = tmp_wNAF;
  577|      0|                wNAF[num + 1] = NULL;
  578|      0|                wNAF_len[num] = tmp_len;
  579|       |                /*
  580|       |                 * pre_comp->points starts with the points that we need here:
  581|       |                 */
  582|      0|                val_sub[num] = pre_comp->points;
  583|      0|            } else {
  584|       |                /*
  585|       |                 * don't include tmp_wNAF directly into wNAF array - use wNAF
  586|       |                 * splitting and include the blocks
  587|       |                 */
  588|       |
  589|      0|                signed char *pp;
  590|      0|                EC_POINT **tmp_points;
  591|       |
  592|      0|                if (tmp_len < numblocks * blocksize) {
  ------------------
  |  Branch (592:21): [True: 0, False: 0]
  ------------------
  593|       |                    /*
  594|       |                     * possibly we can do with fewer blocks than estimated
  595|       |                     */
  596|      0|                    numblocks = (tmp_len + blocksize - 1) / blocksize;
  597|      0|                    if (numblocks > pre_comp->numblocks) {
  ------------------
  |  Branch (597:25): [True: 0, False: 0]
  ------------------
  598|      0|                        ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  599|      0|                        OPENSSL_free(tmp_wNAF);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  600|      0|                        goto err;
  601|      0|                    }
  602|      0|                    totalnum = num + numblocks;
  603|      0|                }
  604|       |
  605|       |                /* split wNAF in 'numblocks' parts */
  606|      0|                pp = tmp_wNAF;
  607|      0|                tmp_points = pre_comp->points;
  608|       |
  609|      0|                for (i = num; i < totalnum; i++) {
  ------------------
  |  Branch (609:31): [True: 0, False: 0]
  ------------------
  610|      0|                    if (i < totalnum - 1) {
  ------------------
  |  Branch (610:25): [True: 0, False: 0]
  ------------------
  611|      0|                        wNAF_len[i] = blocksize;
  612|      0|                        if (tmp_len < blocksize) {
  ------------------
  |  Branch (612:29): [True: 0, False: 0]
  ------------------
  613|      0|                            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  614|      0|                            OPENSSL_free(tmp_wNAF);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  615|      0|                            goto err;
  616|      0|                        }
  617|      0|                        tmp_len -= blocksize;
  618|      0|                    } else
  619|       |                        /*
  620|       |                         * last block gets whatever is left (this could be
  621|       |                         * more or less than 'blocksize'!)
  622|       |                         */
  623|      0|                        wNAF_len[i] = tmp_len;
  624|       |
  625|      0|                    wNAF[i + 1] = NULL;
  626|      0|                    wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  627|      0|                    if (wNAF[i] == NULL) {
  ------------------
  |  Branch (627:25): [True: 0, False: 0]
  ------------------
  628|      0|                        OPENSSL_free(tmp_wNAF);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  629|      0|                        goto err;
  630|      0|                    }
  631|      0|                    memcpy(wNAF[i], pp, wNAF_len[i]);
  632|      0|                    if (wNAF_len[i] > max_len)
  ------------------
  |  Branch (632:25): [True: 0, False: 0]
  ------------------
  633|      0|                        max_len = wNAF_len[i];
  634|       |
  635|      0|                    if (*tmp_points == NULL) {
  ------------------
  |  Branch (635:25): [True: 0, False: 0]
  ------------------
  636|      0|                        ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  637|      0|                        OPENSSL_free(tmp_wNAF);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  638|      0|                        goto err;
  639|      0|                    }
  640|      0|                    val_sub[i] = tmp_points;
  641|      0|                    tmp_points += pre_points_per_block;
  642|      0|                    pp += blocksize;
  643|      0|                }
  644|      0|                OPENSSL_free(tmp_wNAF);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  645|      0|            }
  646|      0|        }
  647|    201|    }
  648|       |
  649|       |    /*
  650|       |     * All points we precompute now go into a single array 'val'.
  651|       |     * 'val_sub[i]' is a pointer to the subarray for the i-th point, or to a
  652|       |     * subarray of 'pre_comp->points' if we already have precomputation.
  653|       |     */
  654|    201|    val = OPENSSL_malloc((num_val + 1) * sizeof(val[0]));
  ------------------
  |  |   97|    201|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  655|    201|    if (val == NULL)
  ------------------
  |  Branch (655:9): [True: 0, False: 201]
  ------------------
  656|      0|        goto err;
  657|    201|    val[num_val] = NULL;        /* pivot element */
  658|       |
  659|       |    /* allocate points for precomputation */
  660|    201|    v = val;
  661|    402|    for (i = 0; i < num + num_scalar; i++) {
  ------------------
  |  Branch (661:17): [True: 201, False: 201]
  ------------------
  662|    201|        val_sub[i] = v;
  663|  1.18k|        for (j = 0; j < ((size_t)1 << (wsize[i] - 1)); j++) {
  ------------------
  |  Branch (663:21): [True: 986, False: 201]
  ------------------
  664|    986|            *v = EC_POINT_new(group);
  665|    986|            if (*v == NULL)
  ------------------
  |  Branch (665:17): [True: 0, False: 986]
  ------------------
  666|      0|                goto err;
  667|    986|            v++;
  668|    986|        }
  669|    201|    }
  670|    201|    if (!(v == val + num_val)) {
  ------------------
  |  Branch (670:9): [True: 0, False: 201]
  ------------------
  671|      0|        ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  672|      0|        goto err;
  673|      0|    }
  674|       |
  675|    201|    if ((tmp = EC_POINT_new(group)) == NULL)
  ------------------
  |  Branch (675:9): [True: 0, False: 201]
  ------------------
  676|      0|        goto err;
  677|       |
  678|       |    /*-
  679|       |     * prepare precomputed values:
  680|       |     *    val_sub[i][0] :=     points[i]
  681|       |     *    val_sub[i][1] := 3 * points[i]
  682|       |     *    val_sub[i][2] := 5 * points[i]
  683|       |     *    ...
  684|       |     */
  685|    402|    for (i = 0; i < num + num_scalar; i++) {
  ------------------
  |  Branch (685:17): [True: 201, False: 201]
  ------------------
  686|    201|        if (i < num) {
  ------------------
  |  Branch (686:13): [True: 0, False: 201]
  ------------------
  687|      0|            if (!EC_POINT_copy(val_sub[i][0], points[i]))
  ------------------
  |  Branch (687:17): [True: 0, False: 0]
  ------------------
  688|      0|                goto err;
  689|    201|        } else {
  690|    201|            if (!EC_POINT_copy(val_sub[i][0], generator))
  ------------------
  |  Branch (690:17): [True: 0, False: 201]
  ------------------
  691|      0|                goto err;
  692|    201|        }
  693|       |
  694|    201|        if (wsize[i] > 1) {
  ------------------
  |  Branch (694:13): [True: 119, False: 82]
  ------------------
  695|    119|            if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx))
  ------------------
  |  Branch (695:17): [True: 0, False: 119]
  ------------------
  696|      0|                goto err;
  697|    904|            for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) {
  ------------------
  |  Branch (697:25): [True: 785, False: 119]
  ------------------
  698|    785|                if (!EC_POINT_add
  ------------------
  |  Branch (698:21): [True: 0, False: 785]
  ------------------
  699|    785|                    (group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx))
  700|      0|                    goto err;
  701|    785|            }
  702|    119|        }
  703|    201|    }
  704|       |
  705|    201|    if (group->meth->points_make_affine == NULL
  ------------------
  |  Branch (705:9): [True: 0, False: 201]
  ------------------
  706|    201|        || !group->meth->points_make_affine(group, num_val, val, ctx))
  ------------------
  |  Branch (706:12): [True: 0, False: 201]
  ------------------
  707|      0|        goto err;
  708|       |
  709|    201|    r_is_at_infinity = 1;
  710|       |
  711|  54.0k|    for (k = max_len - 1; k >= 0; k--) {
  ------------------
  |  Branch (711:27): [True: 53.8k, False: 201]
  ------------------
  712|  53.8k|        if (!r_is_at_infinity) {
  ------------------
  |  Branch (712:13): [True: 53.6k, False: 201]
  ------------------
  713|  53.6k|            if (!EC_POINT_dbl(group, r, r, ctx))
  ------------------
  |  Branch (713:17): [True: 0, False: 53.6k]
  ------------------
  714|      0|                goto err;
  715|  53.6k|        }
  716|       |
  717|   107k|        for (i = 0; i < totalnum; i++) {
  ------------------
  |  Branch (717:21): [True: 53.8k, False: 53.8k]
  ------------------
  718|  53.8k|            if (wNAF_len[i] > (size_t)k) {
  ------------------
  |  Branch (718:17): [True: 53.8k, False: 0]
  ------------------
  719|  53.8k|                int digit = wNAF[i][k];
  720|  53.8k|                int is_neg;
  721|       |
  722|  53.8k|                if (digit) {
  ------------------
  |  Branch (722:21): [True: 6.54k, False: 47.2k]
  ------------------
  723|  6.54k|                    is_neg = digit < 0;
  724|       |
  725|  6.54k|                    if (is_neg)
  ------------------
  |  Branch (725:25): [True: 2.67k, False: 3.86k]
  ------------------
  726|  2.67k|                        digit = -digit;
  727|       |
  728|  6.54k|                    if (is_neg != r_is_inverted) {
  ------------------
  |  Branch (728:25): [True: 2.62k, False: 3.92k]
  ------------------
  729|  2.62k|                        if (!r_is_at_infinity) {
  ------------------
  |  Branch (729:29): [True: 2.62k, False: 0]
  ------------------
  730|  2.62k|                            if (!EC_POINT_invert(group, r, ctx))
  ------------------
  |  Branch (730:33): [True: 0, False: 2.62k]
  ------------------
  731|      0|                                goto err;
  732|  2.62k|                        }
  733|  2.62k|                        r_is_inverted = !r_is_inverted;
  734|  2.62k|                    }
  735|       |
  736|       |                    /* digit > 0 */
  737|       |
  738|  6.54k|                    if (r_is_at_infinity) {
  ------------------
  |  Branch (738:25): [True: 197, False: 6.34k]
  ------------------
  739|    197|                        if (!EC_POINT_copy(r, val_sub[i][digit >> 1]))
  ------------------
  |  Branch (739:29): [True: 0, False: 197]
  ------------------
  740|      0|                            goto err;
  741|       |
  742|       |                        /*-
  743|       |                         * Apply coordinate blinding for EC_POINT.
  744|       |                         *
  745|       |                         * The underlying EC_METHOD can optionally implement this function:
  746|       |                         * ossl_ec_point_blind_coordinates() returns 0 in case of errors or 1 on
  747|       |                         * success or if coordinate blinding is not implemented for this
  748|       |                         * group.
  749|       |                         */
  750|    197|                        if (!ossl_ec_point_blind_coordinates(group, r, ctx)) {
  ------------------
  |  Branch (750:29): [True: 0, False: 197]
  ------------------
  751|      0|                            ERR_raise(ERR_LIB_EC, EC_R_POINT_COORDINATES_BLIND_FAILURE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  752|      0|                            goto err;
  753|      0|                        }
  754|       |
  755|    197|                        r_is_at_infinity = 0;
  756|  6.34k|                    } else {
  757|  6.34k|                        if (!EC_POINT_add
  ------------------
  |  Branch (757:29): [True: 0, False: 6.34k]
  ------------------
  758|  6.34k|                            (group, r, r, val_sub[i][digit >> 1], ctx))
  759|      0|                            goto err;
  760|  6.34k|                    }
  761|  6.54k|                }
  762|  53.8k|            }
  763|  53.8k|        }
  764|  53.8k|    }
  765|       |
  766|    201|    if (r_is_at_infinity) {
  ------------------
  |  Branch (766:9): [True: 4, False: 197]
  ------------------
  767|      4|        if (!EC_POINT_set_to_infinity(group, r))
  ------------------
  |  Branch (767:13): [True: 0, False: 4]
  ------------------
  768|      0|            goto err;
  769|    197|    } else {
  770|    197|        if (r_is_inverted)
  ------------------
  |  Branch (770:13): [True: 72, False: 125]
  ------------------
  771|     72|            if (!EC_POINT_invert(group, r, ctx))
  ------------------
  |  Branch (771:17): [True: 0, False: 72]
  ------------------
  772|      0|                goto err;
  773|    197|    }
  774|       |
  775|    201|    ret = 1;
  776|       |
  777|    201| err:
  778|    201|    EC_POINT_free(tmp);
  779|    201|    OPENSSL_free(wsize);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  780|    201|    OPENSSL_free(wNAF_len);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  781|    201|    if (wNAF != NULL) {
  ------------------
  |  Branch (781:9): [True: 201, False: 0]
  ------------------
  782|    201|        signed char **w;
  783|       |
  784|    402|        for (w = wNAF; *w != NULL; w++)
  ------------------
  |  Branch (784:24): [True: 201, False: 201]
  ------------------
  785|    201|            OPENSSL_free(*w);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  786|       |
  787|    201|        OPENSSL_free(wNAF);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  788|    201|    }
  789|    201|    if (val != NULL) {
  ------------------
  |  Branch (789:9): [True: 201, False: 0]
  ------------------
  790|  1.18k|        for (v = val; *v != NULL; v++)
  ------------------
  |  Branch (790:23): [True: 986, False: 201]
  ------------------
  791|    986|            EC_POINT_clear_free(*v);
  792|       |
  793|    201|        OPENSSL_free(val);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  794|    201|    }
  795|    201|    OPENSSL_free(val_sub);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  796|    201|    return ret;
  797|    201|}

EC_POINT_set_compressed_coordinates:
   26|  12.5k|{
   27|  12.5k|    if (group->meth->point_set_compressed_coordinates == NULL
  ------------------
  |  Branch (27:9): [True: 12.5k, False: 0]
  ------------------
   28|  12.5k|        && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
  ------------------
  |  |   26|  12.5k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  |  Branch (28:12): [True: 0, False: 12.5k]
  ------------------
   29|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   30|      0|        return 0;
   31|      0|    }
   32|  12.5k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (32:9): [True: 0, False: 12.5k]
  ------------------
   33|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   34|      0|        return 0;
   35|      0|    }
   36|  12.5k|    if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
  ------------------
  |  |   26|  12.5k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  |  Branch (36:9): [True: 12.5k, False: 0]
  ------------------
   37|  12.5k|        if (group->meth->field_type == NID_X9_62_prime_field)
  ------------------
  |  |  152|  12.5k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (37:13): [True: 5.99k, False: 6.54k]
  ------------------
   38|  5.99k|            return ossl_ec_GFp_simple_set_compressed_coordinates(group, point, x,
   39|  5.99k|                                                                 y_bit, ctx);
   40|  6.54k|        else
   41|       |#ifdef OPENSSL_NO_EC2M
   42|       |        {
   43|       |            ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
   44|       |            return 0;
   45|       |        }
   46|       |#else
   47|  6.54k|            return ossl_ec_GF2m_simple_set_compressed_coordinates(group, point,
   48|  6.54k|                                                                  x, y_bit, ctx);
   49|  12.5k|#endif
   50|  12.5k|    }
   51|      0|    return group->meth->point_set_compressed_coordinates(group, point, x,
   52|      0|                                                         y_bit, ctx);
   53|  12.5k|}
EC_POINT_point2oct:
   76|  3.34k|{
   77|  3.34k|    if (group->meth->point2oct == 0
  ------------------
  |  Branch (77:9): [True: 3.34k, False: 0]
  ------------------
   78|  3.34k|        && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
  ------------------
  |  |   26|  3.34k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  |  Branch (78:12): [True: 0, False: 3.34k]
  ------------------
   79|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   80|      0|        return 0;
   81|      0|    }
   82|  3.34k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.34k]
  ------------------
   83|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   84|      0|        return 0;
   85|      0|    }
   86|  3.34k|    if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
  ------------------
  |  |   26|  3.34k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  |  Branch (86:9): [True: 3.34k, False: 0]
  ------------------
   87|  3.34k|        if (group->meth->field_type == NID_X9_62_prime_field)
  ------------------
  |  |  152|  3.34k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (87:13): [True: 2.73k, False: 609]
  ------------------
   88|  2.73k|            return ossl_ec_GFp_simple_point2oct(group, point, form, buf, len,
   89|  2.73k|                                                ctx);
   90|    609|        else
   91|       |#ifdef OPENSSL_NO_EC2M
   92|       |        {
   93|       |            ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
   94|       |            return 0;
   95|       |        }
   96|       |#else
   97|    609|            return ossl_ec_GF2m_simple_point2oct(group, point,
   98|    609|                                                 form, buf, len, ctx);
   99|  3.34k|#endif
  100|  3.34k|    }
  101|       |
  102|      0|    return group->meth->point2oct(group, point, form, buf, len, ctx);
  103|  3.34k|}
EC_POINT_oct2point:
  107|  19.5k|{
  108|  19.5k|    if (group->meth->oct2point == 0
  ------------------
  |  Branch (108:9): [True: 19.5k, False: 0]
  ------------------
  109|  19.5k|        && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
  ------------------
  |  |   26|  19.5k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  |  Branch (109:12): [True: 0, False: 19.5k]
  ------------------
  110|      0|        ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  111|      0|        return 0;
  112|      0|    }
  113|  19.5k|    if (!ec_point_is_compat(point, group)) {
  ------------------
  |  Branch (113:9): [True: 0, False: 19.5k]
  ------------------
  114|      0|        ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  115|      0|        return 0;
  116|      0|    }
  117|  19.5k|    if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
  ------------------
  |  |   26|  19.5k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  |  Branch (117:9): [True: 19.5k, False: 0]
  ------------------
  118|  19.5k|        if (group->meth->field_type == NID_X9_62_prime_field)
  ------------------
  |  |  152|  19.5k|#define NID_X9_62_prime_field           406
  ------------------
  |  Branch (118:13): [True: 10.4k, False: 9.10k]
  ------------------
  119|  10.4k|            return ossl_ec_GFp_simple_oct2point(group, point, buf, len, ctx);
  120|  9.10k|        else
  121|       |#ifdef OPENSSL_NO_EC2M
  122|       |        {
  123|       |            ERR_raise(ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED);
  124|       |            return 0;
  125|       |        }
  126|       |#else
  127|  9.10k|            return ossl_ec_GF2m_simple_oct2point(group, point, buf, len, ctx);
  128|  19.5k|#endif
  129|  19.5k|    }
  130|      0|    return group->meth->oct2point(group, point, buf, len, ctx);
  131|  19.5k|}
EC_POINT_point2buf:
  136|  1.68k|{
  137|  1.68k|    size_t len;
  138|  1.68k|    unsigned char *buf;
  139|       |
  140|  1.68k|    len = EC_POINT_point2oct(group, point, form, NULL, 0, NULL);
  141|  1.68k|    if (len == 0)
  ------------------
  |  Branch (141:9): [True: 15, False: 1.66k]
  ------------------
  142|     15|        return 0;
  143|  1.66k|    if ((buf = OPENSSL_malloc(len)) == NULL)
  ------------------
  |  |   97|  1.66k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.66k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.66k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (143:9): [True: 0, False: 1.66k]
  ------------------
  144|      0|        return 0;
  145|  1.66k|    len = EC_POINT_point2oct(group, point, form, buf, len, ctx);
  146|  1.66k|    if (len == 0) {
  ------------------
  |  Branch (146:9): [True: 0, False: 1.66k]
  ------------------
  147|      0|        OPENSSL_free(buf);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  148|      0|        return 0;
  149|      0|    }
  150|  1.66k|    *pbuf = buf;
  151|  1.66k|    return len;
  152|  1.66k|}

ECPKParameters_print:
   71|    586|{
   72|    586|    int ret = 0, reason = ERR_R_BIO_LIB;
  ------------------
  |  |  330|    586|# define ERR_R_BIO_LIB          (ERR_LIB_BIO/* 32 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   93|    586|# define ERR_LIB_BIO             32
  |  |  ------------------
  |  |               # define ERR_R_BIO_LIB          (ERR_LIB_BIO/* 32 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|    586|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|    586|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   73|    586|    BN_CTX *ctx = NULL;
   74|    586|    const EC_POINT *point = NULL;
   75|    586|    BIGNUM *p = NULL, *a = NULL, *b = NULL;
   76|    586|    unsigned char *gen_buf = NULL;
   77|    586|    const BIGNUM *order = NULL, *cofactor = NULL;
   78|    586|    const unsigned char *seed;
   79|    586|    size_t seed_len = 0, gen_buf_len = 0;
   80|       |
   81|    586|    static const char *gen_compressed = "Generator (compressed):";
   82|    586|    static const char *gen_uncompressed = "Generator (uncompressed):";
   83|    586|    static const char *gen_hybrid = "Generator (hybrid):";
   84|       |
   85|    586|    if (!x) {
  ------------------
  |  Branch (85:9): [True: 0, False: 586]
  ------------------
   86|      0|        reason = ERR_R_PASSED_NULL_PARAMETER;
  ------------------
  |  |  353|      0|# define ERR_R_PASSED_NULL_PARAMETER             (258|ERR_R_FATAL)
  |  |  ------------------
  |  |  |  |  350|      0|# define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  236|      0|# define ERR_RFLAG_FATAL                (0x1 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   87|      0|        goto err;
   88|      0|    }
   89|       |
   90|    586|    ctx = BN_CTX_new();
   91|    586|    if (ctx == NULL) {
  ------------------
  |  Branch (91:9): [True: 0, False: 586]
  ------------------
   92|      0|        reason = ERR_R_BN_LIB;
  ------------------
  |  |  316|      0|# define ERR_R_BN_LIB           (ERR_LIB_BN/* 3 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   73|      0|# define ERR_LIB_BN              3
  |  |  ------------------
  |  |               # define ERR_R_BN_LIB           (ERR_LIB_BN/* 3 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   93|      0|        goto err;
   94|      0|    }
   95|       |
   96|    586|    if (EC_GROUP_get_asn1_flag(x)) {
  ------------------
  |  Branch (96:9): [True: 472, False: 114]
  ------------------
   97|       |        /* the curve parameter are given by an asn1 OID */
   98|    472|        int nid;
   99|    472|        const char *nname;
  100|       |
  101|    472|        if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (101:13): [True: 0, False: 472]
  ------------------
  102|      0|            goto err;
  103|       |
  104|    472|        nid = EC_GROUP_get_curve_name(x);
  105|    472|        if (nid == 0)
  ------------------
  |  Branch (105:13): [True: 0, False: 472]
  ------------------
  106|      0|            goto err;
  107|    472|        if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0)
  ------------------
  |  Branch (107:13): [True: 0, False: 472]
  ------------------
  108|      0|            goto err;
  109|    472|        if (BIO_printf(bp, "\n") <= 0)
  ------------------
  |  Branch (109:13): [True: 0, False: 472]
  ------------------
  110|      0|            goto err;
  111|    472|        nname = EC_curve_nid2nist(nid);
  112|    472|        if (nname) {
  ------------------
  |  Branch (112:13): [True: 189, False: 283]
  ------------------
  113|    189|            if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (113:17): [True: 0, False: 189]
  ------------------
  114|      0|                goto err;
  115|    189|            if (BIO_printf(bp, "NIST CURVE: %s\n", nname) <= 0)
  ------------------
  |  Branch (115:17): [True: 0, False: 189]
  ------------------
  116|      0|                goto err;
  117|    189|        }
  118|    472|    } else {
  119|    114|        const char *form_str;
  120|       |        /* explicit parameters */
  121|    114|        int is_char_two = 0;
  122|    114|        point_conversion_form_t form;
  123|    114|        int tmp_nid = EC_GROUP_get_field_type(x);
  124|       |
  125|    114|        if (tmp_nid == NID_X9_62_characteristic_two_field)
  ------------------
  |  |  156|    114|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (125:13): [True: 0, False: 114]
  ------------------
  126|      0|            is_char_two = 1;
  127|       |
  128|    114|        if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||
  ------------------
  |  Branch (128:13): [True: 0, False: 114]
  |  Branch (128:39): [True: 0, False: 114]
  ------------------
  129|    114|            (b = BN_new()) == NULL) {
  ------------------
  |  Branch (129:13): [True: 0, False: 114]
  ------------------
  130|      0|            reason = ERR_R_BN_LIB;
  ------------------
  |  |  316|      0|# define ERR_R_BN_LIB           (ERR_LIB_BN/* 3 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   73|      0|# define ERR_LIB_BN              3
  |  |  ------------------
  |  |               # define ERR_R_BN_LIB           (ERR_LIB_BN/* 3 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  131|      0|            goto err;
  132|      0|        }
  133|       |
  134|    114|        if (!EC_GROUP_get_curve(x, p, a, b, ctx)) {
  ------------------
  |  Branch (134:13): [True: 0, False: 114]
  ------------------
  135|      0|            reason = ERR_R_EC_LIB;
  ------------------
  |  |  328|      0|# define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   86|      0|# define ERR_LIB_EC              16
  |  |  ------------------
  |  |               # define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|      0|            goto err;
  137|      0|        }
  138|       |
  139|    114|        if ((point = EC_GROUP_get0_generator(x)) == NULL) {
  ------------------
  |  Branch (139:13): [True: 0, False: 114]
  ------------------
  140|      0|            reason = ERR_R_EC_LIB;
  ------------------
  |  |  328|      0|# define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   86|      0|# define ERR_LIB_EC              16
  |  |  ------------------
  |  |               # define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  141|      0|            goto err;
  142|      0|        }
  143|    114|        order = EC_GROUP_get0_order(x);
  144|    114|        cofactor = EC_GROUP_get0_cofactor(x);
  145|    114|        if (order == NULL) {
  ------------------
  |  Branch (145:13): [True: 0, False: 114]
  ------------------
  146|      0|            reason = ERR_R_EC_LIB;
  ------------------
  |  |  328|      0|# define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   86|      0|# define ERR_LIB_EC              16
  |  |  ------------------
  |  |               # define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  147|      0|            goto err;
  148|      0|        }
  149|       |
  150|    114|        form = EC_GROUP_get_point_conversion_form(x);
  151|       |
  152|    114|        gen_buf_len = EC_POINT_point2buf(x, point, form, &gen_buf, ctx);
  153|    114|        if (gen_buf_len == 0) {
  ------------------
  |  Branch (153:13): [True: 0, False: 114]
  ------------------
  154|      0|            reason = ERR_R_EC_LIB;
  ------------------
  |  |  328|      0|# define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   86|      0|# define ERR_LIB_EC              16
  |  |  ------------------
  |  |               # define ERR_R_EC_LIB           (ERR_LIB_EC/* 16 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  155|      0|            goto err;
  156|      0|        }
  157|       |
  158|    114|        if ((seed = EC_GROUP_get0_seed(x)) != NULL)
  ------------------
  |  Branch (158:13): [True: 31, False: 83]
  ------------------
  159|     31|            seed_len = EC_GROUP_get_seed_len(x);
  160|       |
  161|    114|        if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (161:13): [True: 0, False: 114]
  ------------------
  162|      0|            goto err;
  163|       |
  164|       |        /* print the 'short name' of the field type */
  165|    114|        if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
  ------------------
  |  Branch (165:13): [True: 0, False: 114]
  ------------------
  166|    114|            <= 0)
  167|      0|            goto err;
  168|       |
  169|    114|        if (is_char_two) {
  ------------------
  |  Branch (169:13): [True: 0, False: 114]
  ------------------
  170|       |            /* print the 'short name' of the base type OID */
  171|      0|            int basis_type = EC_GROUP_get_basis_type(x);
  172|      0|            if (basis_type == 0)
  ------------------
  |  Branch (172:17): [True: 0, False: 0]
  ------------------
  173|      0|                goto err;
  174|       |
  175|      0|            if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (175:17): [True: 0, False: 0]
  ------------------
  176|      0|                goto err;
  177|       |
  178|      0|            if (BIO_printf(bp, "Basis Type: %s\n",
  ------------------
  |  Branch (178:17): [True: 0, False: 0]
  ------------------
  179|      0|                           OBJ_nid2sn(basis_type)) <= 0)
  180|      0|                goto err;
  181|       |
  182|       |            /* print the polynomial */
  183|      0|            if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, NULL,
  ------------------
  |  Branch (183:17): [True: 0, False: 0]
  |  Branch (183:32): [True: 0, False: 0]
  ------------------
  184|      0|                                              off))
  185|      0|                goto err;
  186|    114|        } else {
  187|    114|            if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, NULL, off))
  ------------------
  |  Branch (187:17): [True: 114, False: 0]
  |  Branch (187:32): [True: 0, False: 114]
  ------------------
  188|      0|                goto err;
  189|    114|        }
  190|    114|        if ((a != NULL) && !ASN1_bn_print(bp, "A:   ", a, NULL, off))
  ------------------
  |  Branch (190:13): [True: 114, False: 0]
  |  Branch (190:28): [True: 0, False: 114]
  ------------------
  191|      0|            goto err;
  192|    114|        if ((b != NULL) && !ASN1_bn_print(bp, "B:   ", b, NULL, off))
  ------------------
  |  Branch (192:13): [True: 114, False: 0]
  |  Branch (192:28): [True: 0, False: 114]
  ------------------
  193|      0|            goto err;
  194|       |
  195|    114|        if (form == POINT_CONVERSION_COMPRESSED)
  ------------------
  |  Branch (195:13): [True: 106, False: 8]
  ------------------
  196|    106|            form_str = gen_compressed;
  197|      8|        else if (form == POINT_CONVERSION_UNCOMPRESSED)
  ------------------
  |  Branch (197:18): [True: 4, False: 4]
  ------------------
  198|      4|            form_str = gen_uncompressed;
  199|      4|        else
  200|      4|            form_str = gen_hybrid;
  201|    114|        if (gen_buf != NULL
  ------------------
  |  Branch (201:13): [True: 114, False: 0]
  ------------------
  202|    114|            && !print_bin(bp, form_str, gen_buf, gen_buf_len, off))
  ------------------
  |  Branch (202:16): [True: 0, False: 114]
  ------------------
  203|      0|            goto err;
  204|       |
  205|    114|        if ((order != NULL) && !ASN1_bn_print(bp, "Order: ", order, NULL, off))
  ------------------
  |  Branch (205:13): [True: 114, False: 0]
  |  Branch (205:32): [True: 0, False: 114]
  ------------------
  206|      0|            goto err;
  207|    114|        if ((cofactor != NULL) && !ASN1_bn_print(bp, "Cofactor: ", cofactor,
  ------------------
  |  Branch (207:13): [True: 114, False: 0]
  |  Branch (207:35): [True: 0, False: 114]
  ------------------
  208|    114|                                                 NULL, off))
  209|      0|            goto err;
  210|    114|        if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))
  ------------------
  |  Branch (210:13): [True: 31, False: 83]
  |  Branch (210:21): [True: 0, False: 31]
  ------------------
  211|      0|            goto err;
  212|    114|    }
  213|    586|    ret = 1;
  214|    586| err:
  215|    586|    if (!ret)
  ------------------
  |  Branch (215:9): [True: 0, False: 586]
  ------------------
  216|    586|        ERR_raise(ERR_LIB_EC, reason);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  217|    586|    BN_free(p);
  218|    586|    BN_free(a);
  219|    586|    BN_free(b);
  220|    586|    OPENSSL_clear_free(gen_buf, gen_buf_len);
  ------------------
  |  |  105|    586|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    586|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    586|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  221|    586|    BN_CTX_free(ctx);
  222|    586|    return ret;
  223|    586|}
eck_prn.c:print_bin:
  227|    145|{
  228|    145|    size_t i;
  229|    145|    char str[128 + 1 + 4];
  230|       |
  231|    145|    if (buf == NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 145]
  ------------------
  232|      0|        return 1;
  233|    145|    if (off > 0) {
  ------------------
  |  Branch (233:9): [True: 29, False: 116]
  ------------------
  234|     29|        if (off > 128)
  ------------------
  |  Branch (234:13): [True: 0, False: 29]
  ------------------
  235|      0|            off = 128;
  236|     29|        memset(str, ' ', off);
  237|     29|        if (BIO_write(fp, str, off) <= 0)
  ------------------
  |  Branch (237:13): [True: 0, False: 29]
  ------------------
  238|      0|            return 0;
  239|    116|    } else {
  240|    116|        off = 0;
  241|    116|    }
  242|       |
  243|    145|    if (BIO_printf(fp, "%s", name) <= 0)
  ------------------
  |  Branch (243:9): [True: 0, False: 145]
  ------------------
  244|      0|        return 0;
  245|       |
  246|  4.07k|    for (i = 0; i < len; i++) {
  ------------------
  |  Branch (246:17): [True: 3.93k, False: 145]
  ------------------
  247|  3.93k|        if ((i % 15) == 0) {
  ------------------
  |  Branch (247:13): [True: 294, False: 3.64k]
  ------------------
  248|    294|            str[0] = '\n';
  249|    294|            memset(&(str[1]), ' ', off + 4);
  250|    294|            if (BIO_write(fp, str, off + 1 + 4) <= 0)
  ------------------
  |  Branch (250:17): [True: 0, False: 294]
  ------------------
  251|      0|                return 0;
  252|    294|        }
  253|  3.93k|        if (BIO_printf(fp, "%02x%s", buf[i], ((i + 1) == len) ? "" : ":") <=
  ------------------
  |  Branch (253:13): [True: 0, False: 3.93k]
  |  Branch (253:46): [True: 145, False: 3.78k]
  ------------------
  254|  3.93k|            0)
  255|      0|            return 0;
  256|  3.93k|    }
  257|    145|    if (BIO_write(fp, "\n", 1) <= 0)
  ------------------
  |  Branch (257:9): [True: 0, False: 145]
  ------------------
  258|      0|        return 0;
  259|       |
  260|    145|    return 1;
  261|    145|}

EC_GFp_mont_method:
   22|  5.82k|{
   23|  5.82k|    static const EC_METHOD ret = {
   24|  5.82k|        EC_FLAGS_DEFAULT_OCT,
  ------------------
  |  |   26|  5.82k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
   25|  5.82k|        NID_X9_62_prime_field,
  ------------------
  |  |  152|  5.82k|#define NID_X9_62_prime_field           406
  ------------------
   26|  5.82k|        ossl_ec_GFp_mont_group_init,
   27|  5.82k|        ossl_ec_GFp_mont_group_finish,
   28|  5.82k|        ossl_ec_GFp_mont_group_clear_finish,
   29|  5.82k|        ossl_ec_GFp_mont_group_copy,
   30|  5.82k|        ossl_ec_GFp_mont_group_set_curve,
   31|  5.82k|        ossl_ec_GFp_simple_group_get_curve,
   32|  5.82k|        ossl_ec_GFp_simple_group_get_degree,
   33|  5.82k|        ossl_ec_group_simple_order_bits,
   34|  5.82k|        ossl_ec_GFp_simple_group_check_discriminant,
   35|  5.82k|        ossl_ec_GFp_simple_point_init,
   36|  5.82k|        ossl_ec_GFp_simple_point_finish,
   37|  5.82k|        ossl_ec_GFp_simple_point_clear_finish,
   38|  5.82k|        ossl_ec_GFp_simple_point_copy,
   39|  5.82k|        ossl_ec_GFp_simple_point_set_to_infinity,
   40|  5.82k|        ossl_ec_GFp_simple_point_set_affine_coordinates,
   41|  5.82k|        ossl_ec_GFp_simple_point_get_affine_coordinates,
   42|  5.82k|        0, 0, 0,
   43|  5.82k|        ossl_ec_GFp_simple_add,
   44|  5.82k|        ossl_ec_GFp_simple_dbl,
   45|  5.82k|        ossl_ec_GFp_simple_invert,
   46|  5.82k|        ossl_ec_GFp_simple_is_at_infinity,
   47|  5.82k|        ossl_ec_GFp_simple_is_on_curve,
   48|  5.82k|        ossl_ec_GFp_simple_cmp,
   49|  5.82k|        ossl_ec_GFp_simple_make_affine,
   50|  5.82k|        ossl_ec_GFp_simple_points_make_affine,
   51|  5.82k|        0 /* mul */ ,
   52|  5.82k|        0 /* precompute_mult */ ,
   53|  5.82k|        0 /* have_precompute_mult */ ,
   54|  5.82k|        ossl_ec_GFp_mont_field_mul,
   55|  5.82k|        ossl_ec_GFp_mont_field_sqr,
   56|  5.82k|        0 /* field_div */ ,
   57|  5.82k|        ossl_ec_GFp_mont_field_inv,
   58|  5.82k|        ossl_ec_GFp_mont_field_encode,
   59|  5.82k|        ossl_ec_GFp_mont_field_decode,
   60|  5.82k|        ossl_ec_GFp_mont_field_set_to_one,
   61|  5.82k|        ossl_ec_key_simple_priv2oct,
   62|  5.82k|        ossl_ec_key_simple_oct2priv,
   63|  5.82k|        0, /* set private */
   64|  5.82k|        ossl_ec_key_simple_generate_key,
   65|  5.82k|        ossl_ec_key_simple_check_key,
   66|  5.82k|        ossl_ec_key_simple_generate_public_key,
   67|  5.82k|        0, /* keycopy */
   68|  5.82k|        0, /* keyfinish */
   69|  5.82k|        ossl_ecdh_simple_compute_key,
   70|  5.82k|        ossl_ecdsa_simple_sign_setup,
   71|  5.82k|        ossl_ecdsa_simple_sign_sig,
   72|  5.82k|        ossl_ecdsa_simple_verify_sig,
   73|  5.82k|        0, /* field_inverse_mod_ord */
   74|  5.82k|        ossl_ec_GFp_simple_blind_coordinates,
   75|  5.82k|        ossl_ec_GFp_simple_ladder_pre,
   76|  5.82k|        ossl_ec_GFp_simple_ladder_step,
   77|  5.82k|        ossl_ec_GFp_simple_ladder_post
   78|  5.82k|    };
   79|       |
   80|  5.82k|    return &ret;
   81|  5.82k|}
ossl_ec_GFp_mont_group_init:
   84|  10.0k|{
   85|  10.0k|    int ok;
   86|       |
   87|  10.0k|    ok = ossl_ec_GFp_simple_group_init(group);
   88|  10.0k|    group->field_data1 = NULL;
   89|  10.0k|    group->field_data2 = NULL;
   90|  10.0k|    return ok;
   91|  10.0k|}
ossl_ec_GFp_mont_group_finish:
   94|  10.0k|{
   95|  10.0k|    BN_MONT_CTX_free(group->field_data1);
   96|  10.0k|    group->field_data1 = NULL;
   97|  10.0k|    BN_free(group->field_data2);
   98|  10.0k|    group->field_data2 = NULL;
   99|  10.0k|    ossl_ec_GFp_simple_group_finish(group);
  100|  10.0k|}
ossl_ec_GFp_mont_group_copy:
  112|  4.09k|{
  113|  4.09k|    BN_MONT_CTX_free(dest->field_data1);
  114|  4.09k|    dest->field_data1 = NULL;
  115|  4.09k|    BN_clear_free(dest->field_data2);
  116|  4.09k|    dest->field_data2 = NULL;
  117|       |
  118|  4.09k|    if (!ossl_ec_GFp_simple_group_copy(dest, src))
  ------------------
  |  Branch (118:9): [True: 0, False: 4.09k]
  ------------------
  119|      0|        return 0;
  120|       |
  121|  4.09k|    if (src->field_data1 != NULL) {
  ------------------
  |  Branch (121:9): [True: 4.09k, False: 0]
  ------------------
  122|  4.09k|        dest->field_data1 = BN_MONT_CTX_new();
  123|  4.09k|        if (dest->field_data1 == NULL)
  ------------------
  |  Branch (123:13): [True: 0, False: 4.09k]
  ------------------
  124|      0|            return 0;
  125|  4.09k|        if (!BN_MONT_CTX_copy(dest->field_data1, src->field_data1))
  ------------------
  |  Branch (125:13): [True: 0, False: 4.09k]
  ------------------
  126|      0|            goto err;
  127|  4.09k|    }
  128|  4.09k|    if (src->field_data2 != NULL) {
  ------------------
  |  Branch (128:9): [True: 4.09k, False: 0]
  ------------------
  129|  4.09k|        dest->field_data2 = BN_dup(src->field_data2);
  130|  4.09k|        if (dest->field_data2 == NULL)
  ------------------
  |  Branch (130:13): [True: 0, False: 4.09k]
  ------------------
  131|      0|            goto err;
  132|  4.09k|    }
  133|       |
  134|  4.09k|    return 1;
  135|       |
  136|      0| err:
  137|      0|    BN_MONT_CTX_free(dest->field_data1);
  138|      0|    dest->field_data1 = NULL;
  139|      0|    return 0;
  140|  4.09k|}
ossl_ec_GFp_mont_group_set_curve:
  145|  5.95k|{
  146|  5.95k|    BN_CTX *new_ctx = NULL;
  147|  5.95k|    BN_MONT_CTX *mont = NULL;
  148|  5.95k|    BIGNUM *one = NULL;
  149|  5.95k|    int ret = 0;
  150|       |
  151|  5.95k|    BN_MONT_CTX_free(group->field_data1);
  152|  5.95k|    group->field_data1 = NULL;
  153|  5.95k|    BN_free(group->field_data2);
  154|  5.95k|    group->field_data2 = NULL;
  155|       |
  156|  5.95k|    if (ctx == NULL) {
  ------------------
  |  Branch (156:9): [True: 3.14k, False: 2.81k]
  ------------------
  157|  3.14k|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  158|  3.14k|        if (ctx == NULL)
  ------------------
  |  Branch (158:13): [True: 0, False: 3.14k]
  ------------------
  159|      0|            return 0;
  160|  3.14k|    }
  161|       |
  162|  5.95k|    mont = BN_MONT_CTX_new();
  163|  5.95k|    if (mont == NULL)
  ------------------
  |  Branch (163:9): [True: 0, False: 5.95k]
  ------------------
  164|      0|        goto err;
  165|  5.95k|    if (!BN_MONT_CTX_set(mont, p, ctx)) {
  ------------------
  |  Branch (165:9): [True: 313, False: 5.64k]
  ------------------
  166|    313|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|    313|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    313|    (ERR_new(),                                                 \
  |  |  |  |  404|    313|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    313|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    313|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    313|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    313|     ERR_set_error)
  |  |  ------------------
  ------------------
  167|    313|        goto err;
  168|    313|    }
  169|  5.64k|    one = BN_new();
  170|  5.64k|    if (one == NULL)
  ------------------
  |  Branch (170:9): [True: 0, False: 5.64k]
  ------------------
  171|      0|        goto err;
  172|  5.64k|    if (!BN_to_montgomery(one, BN_value_one(), mont, ctx))
  ------------------
  |  Branch (172:9): [True: 0, False: 5.64k]
  ------------------
  173|      0|        goto err;
  174|       |
  175|  5.64k|    group->field_data1 = mont;
  176|  5.64k|    mont = NULL;
  177|  5.64k|    group->field_data2 = one;
  178|  5.64k|    one = NULL;
  179|       |
  180|  5.64k|    ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
  181|       |
  182|  5.64k|    if (!ret) {
  ------------------
  |  Branch (182:9): [True: 2, False: 5.64k]
  ------------------
  183|      2|        BN_MONT_CTX_free(group->field_data1);
  184|      2|        group->field_data1 = NULL;
  185|      2|        BN_free(group->field_data2);
  186|      2|        group->field_data2 = NULL;
  187|      2|    }
  188|       |
  189|  5.95k| err:
  190|  5.95k|    BN_free(one);
  191|  5.95k|    BN_CTX_free(new_ctx);
  192|  5.95k|    BN_MONT_CTX_free(mont);
  193|  5.95k|    return ret;
  194|  5.64k|}
ossl_ec_GFp_mont_field_mul:
  198|  3.21M|{
  199|  3.21M|    if (group->field_data1 == NULL) {
  ------------------
  |  Branch (199:9): [True: 0, False: 3.21M]
  ------------------
  200|      0|        ERR_raise(ERR_LIB_EC, EC_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  201|      0|        return 0;
  202|      0|    }
  203|       |
  204|  3.21M|    return BN_mod_mul_montgomery(r, a, b, group->field_data1, ctx);
  205|  3.21M|}
ossl_ec_GFp_mont_field_sqr:
  209|  1.86M|{
  210|  1.86M|    if (group->field_data1 == NULL) {
  ------------------
  |  Branch (210:9): [True: 0, False: 1.86M]
  ------------------
  211|      0|        ERR_raise(ERR_LIB_EC, EC_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  212|      0|        return 0;
  213|      0|    }
  214|       |
  215|  1.86M|    return BN_mod_mul_montgomery(r, a, a, group->field_data1, ctx);
  216|  1.86M|}
ossl_ec_GFp_mont_field_inv:
  225|    653|{
  226|    653|    BIGNUM *e = NULL;
  227|    653|    BN_CTX *new_ctx = NULL;
  228|    653|    int ret = 0;
  229|       |
  230|    653|    if (group->field_data1 == NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 653]
  ------------------
  231|      0|        return 0;
  232|       |
  233|    653|    if (ctx == NULL
  ------------------
  |  Branch (233:9): [True: 0, False: 653]
  ------------------
  234|    653|            && (ctx = new_ctx = BN_CTX_secure_new_ex(group->libctx)) == NULL)
  ------------------
  |  Branch (234:16): [True: 0, False: 0]
  ------------------
  235|      0|        return 0;
  236|       |
  237|    653|    BN_CTX_start(ctx);
  238|    653|    if ((e = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (238:9): [True: 0, False: 653]
  ------------------
  239|      0|        goto err;
  240|       |
  241|       |    /* Inverse in constant time with Fermats Little Theorem */
  242|    653|    if (!BN_set_word(e, 2))
  ------------------
  |  Branch (242:9): [True: 0, False: 653]
  ------------------
  243|      0|        goto err;
  244|    653|    if (!BN_sub(e, group->field, e))
  ------------------
  |  Branch (244:9): [True: 0, False: 653]
  ------------------
  245|      0|        goto err;
  246|       |    /*-
  247|       |     * Exponent e is public.
  248|       |     * No need for scatter-gather or BN_FLG_CONSTTIME.
  249|       |     */
  250|    653|    if (!BN_mod_exp_mont(r, a, e, group->field, ctx, group->field_data1))
  ------------------
  |  Branch (250:9): [True: 0, False: 653]
  ------------------
  251|      0|        goto err;
  252|       |
  253|       |    /* throw an error on zero */
  254|    653|    if (BN_is_zero(r)) {
  ------------------
  |  Branch (254:9): [True: 0, False: 653]
  ------------------
  255|      0|        ERR_raise(ERR_LIB_EC, EC_R_CANNOT_INVERT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  256|      0|        goto err;
  257|      0|    }
  258|       |
  259|    653|    ret = 1;
  260|       |
  261|    653|  err:
  262|    653|    BN_CTX_end(ctx);
  263|    653|    BN_CTX_free(new_ctx);
  264|    653|    return ret;
  265|    653|}
ossl_ec_GFp_mont_field_encode:
  269|  26.2k|{
  270|  26.2k|    if (group->field_data1 == NULL) {
  ------------------
  |  Branch (270:9): [True: 0, False: 26.2k]
  ------------------
  271|      0|        ERR_raise(ERR_LIB_EC, EC_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|        return 0;
  273|      0|    }
  274|       |
  275|  26.2k|    return BN_to_montgomery(r, a, (BN_MONT_CTX *)group->field_data1, ctx);
  276|  26.2k|}
ossl_ec_GFp_mont_field_decode:
  280|  17.1k|{
  281|  17.1k|    if (group->field_data1 == NULL) {
  ------------------
  |  Branch (281:9): [True: 0, False: 17.1k]
  ------------------
  282|      0|        ERR_raise(ERR_LIB_EC, EC_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  283|      0|        return 0;
  284|      0|    }
  285|       |
  286|  17.1k|    return BN_from_montgomery(r, a, group->field_data1, ctx);
  287|  17.1k|}
ossl_ec_GFp_mont_field_set_to_one:
  291|  7.94k|{
  292|  7.94k|    if (group->field_data2 == NULL) {
  ------------------
  |  Branch (292:9): [True: 0, False: 7.94k]
  ------------------
  293|      0|        ERR_raise(ERR_LIB_EC, EC_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  294|      0|        return 0;
  295|      0|    }
  296|       |
  297|  7.94k|    if (!BN_copy(r, group->field_data2))
  ------------------
  |  Branch (297:9): [True: 0, False: 7.94k]
  ------------------
  298|      0|        return 0;
  299|  7.94k|    return 1;
  300|  7.94k|}

ossl_ec_GFp_nist_group_copy:
   86|  4.04k|{
   87|  4.04k|    dest->field_mod_func = src->field_mod_func;
   88|       |
   89|  4.04k|    return ossl_ec_GFp_simple_group_copy(dest, src);
   90|  4.04k|}
ossl_ec_GFp_nist_field_mul:
  130|  12.0k|{
  131|  12.0k|    int ret = 0;
  132|  12.0k|    BN_CTX *ctx_new = NULL;
  133|       |
  134|  12.0k|    if (!group || !r || !a || !b) {
  ------------------
  |  Branch (134:9): [True: 0, False: 12.0k]
  |  Branch (134:19): [True: 0, False: 12.0k]
  |  Branch (134:25): [True: 0, False: 12.0k]
  |  Branch (134:31): [True: 0, False: 12.0k]
  ------------------
  135|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  136|      0|        goto err;
  137|      0|    }
  138|  12.0k|    if (!ctx)
  ------------------
  |  Branch (138:9): [True: 0, False: 12.0k]
  ------------------
  139|      0|        if ((ctx_new = ctx = BN_CTX_new_ex(group->libctx)) == NULL)
  ------------------
  |  Branch (139:13): [True: 0, False: 0]
  ------------------
  140|      0|            goto err;
  141|       |
  142|  12.0k|    if (!BN_mul(r, a, b, ctx))
  ------------------
  |  Branch (142:9): [True: 0, False: 12.0k]
  ------------------
  143|      0|        goto err;
  144|  12.0k|    if (!group->field_mod_func(r, r, group->field, ctx))
  ------------------
  |  Branch (144:9): [True: 0, False: 12.0k]
  ------------------
  145|      0|        goto err;
  146|       |
  147|  12.0k|    ret = 1;
  148|  12.0k| err:
  149|  12.0k|    BN_CTX_free(ctx_new);
  150|  12.0k|    return ret;
  151|  12.0k|}
ossl_ec_GFp_nist_field_sqr:
  155|  19.9k|{
  156|  19.9k|    int ret = 0;
  157|  19.9k|    BN_CTX *ctx_new = NULL;
  158|       |
  159|  19.9k|    if (!group || !r || !a) {
  ------------------
  |  Branch (159:9): [True: 0, False: 19.9k]
  |  Branch (159:19): [True: 0, False: 19.9k]
  |  Branch (159:25): [True: 0, False: 19.9k]
  ------------------
  160|      0|        ERR_raise(ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  161|      0|        goto err;
  162|      0|    }
  163|  19.9k|    if (!ctx)
  ------------------
  |  Branch (163:9): [True: 0, False: 19.9k]
  ------------------
  164|      0|        if ((ctx_new = ctx = BN_CTX_new_ex(group->libctx)) == NULL)
  ------------------
  |  Branch (164:13): [True: 0, False: 0]
  ------------------
  165|      0|            goto err;
  166|       |
  167|  19.9k|    if (!BN_sqr(r, a, ctx))
  ------------------
  |  Branch (167:9): [True: 0, False: 19.9k]
  ------------------
  168|      0|        goto err;
  169|  19.9k|    if (!group->field_mod_func(r, r, group->field, ctx))
  ------------------
  |  Branch (169:9): [True: 0, False: 19.9k]
  ------------------
  170|      0|        goto err;
  171|       |
  172|  19.9k|    ret = 1;
  173|  19.9k| err:
  174|  19.9k|    BN_CTX_free(ctx_new);
  175|  19.9k|    return ret;
  176|  19.9k|}

EC_GFp_nistp224_method:
  244|  1.86k|{
  245|  1.86k|    static const EC_METHOD ret = {
  246|  1.86k|        EC_FLAGS_DEFAULT_OCT,
  ------------------
  |  |   26|  1.86k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
  247|  1.86k|        NID_X9_62_prime_field,
  ------------------
  |  |  152|  1.86k|#define NID_X9_62_prime_field           406
  ------------------
  248|  1.86k|        ossl_ec_GFp_nistp224_group_init,
  249|  1.86k|        ossl_ec_GFp_simple_group_finish,
  250|  1.86k|        ossl_ec_GFp_simple_group_clear_finish,
  251|  1.86k|        ossl_ec_GFp_nist_group_copy,
  252|  1.86k|        ossl_ec_GFp_nistp224_group_set_curve,
  253|  1.86k|        ossl_ec_GFp_simple_group_get_curve,
  254|  1.86k|        ossl_ec_GFp_simple_group_get_degree,
  255|  1.86k|        ossl_ec_group_simple_order_bits,
  256|  1.86k|        ossl_ec_GFp_simple_group_check_discriminant,
  257|  1.86k|        ossl_ec_GFp_simple_point_init,
  258|  1.86k|        ossl_ec_GFp_simple_point_finish,
  259|  1.86k|        ossl_ec_GFp_simple_point_clear_finish,
  260|  1.86k|        ossl_ec_GFp_simple_point_copy,
  261|  1.86k|        ossl_ec_GFp_simple_point_set_to_infinity,
  262|  1.86k|        ossl_ec_GFp_simple_point_set_affine_coordinates,
  263|  1.86k|        ossl_ec_GFp_nistp224_point_get_affine_coordinates,
  264|  1.86k|        0 /* point_set_compressed_coordinates */ ,
  265|  1.86k|        0 /* point2oct */ ,
  266|  1.86k|        0 /* oct2point */ ,
  267|  1.86k|        ossl_ec_GFp_simple_add,
  268|  1.86k|        ossl_ec_GFp_simple_dbl,
  269|  1.86k|        ossl_ec_GFp_simple_invert,
  270|  1.86k|        ossl_ec_GFp_simple_is_at_infinity,
  271|  1.86k|        ossl_ec_GFp_simple_is_on_curve,
  272|  1.86k|        ossl_ec_GFp_simple_cmp,
  273|  1.86k|        ossl_ec_GFp_simple_make_affine,
  274|  1.86k|        ossl_ec_GFp_simple_points_make_affine,
  275|  1.86k|        ossl_ec_GFp_nistp224_points_mul,
  276|  1.86k|        ossl_ec_GFp_nistp224_precompute_mult,
  277|  1.86k|        ossl_ec_GFp_nistp224_have_precompute_mult,
  278|  1.86k|        ossl_ec_GFp_nist_field_mul,
  279|  1.86k|        ossl_ec_GFp_nist_field_sqr,
  280|  1.86k|        0 /* field_div */ ,
  281|  1.86k|        ossl_ec_GFp_simple_field_inv,
  282|  1.86k|        0 /* field_encode */ ,
  283|  1.86k|        0 /* field_decode */ ,
  284|  1.86k|        0,                      /* field_set_to_one */
  285|  1.86k|        ossl_ec_key_simple_priv2oct,
  286|  1.86k|        ossl_ec_key_simple_oct2priv,
  287|  1.86k|        0, /* set private */
  288|  1.86k|        ossl_ec_key_simple_generate_key,
  289|  1.86k|        ossl_ec_key_simple_check_key,
  290|  1.86k|        ossl_ec_key_simple_generate_public_key,
  291|  1.86k|        0, /* keycopy */
  292|  1.86k|        0, /* keyfinish */
  293|  1.86k|        ossl_ecdh_simple_compute_key,
  294|  1.86k|        ossl_ecdsa_simple_sign_setup,
  295|  1.86k|        ossl_ecdsa_simple_sign_sig,
  296|  1.86k|        ossl_ecdsa_simple_verify_sig,
  297|  1.86k|        0, /* field_inverse_mod_ord */
  298|  1.86k|        0, /* blind_coordinates */
  299|  1.86k|        0, /* ladder_pre */
  300|  1.86k|        0, /* ladder_step */
  301|  1.86k|        0  /* ladder_post */
  302|  1.86k|    };
  303|       |
  304|  1.86k|    return &ret;
  305|  1.86k|}
ossl_ec_GFp_nistp224_group_init:
 1282|  3.41k|{
 1283|  3.41k|    int ret;
 1284|  3.41k|    ret = ossl_ec_GFp_simple_group_init(group);
 1285|  3.41k|    group->a_is_minus3 = 1;
 1286|  3.41k|    return ret;
 1287|  3.41k|}
ossl_ec_GFp_nistp224_group_set_curve:
 1292|  1.86k|{
 1293|  1.86k|    int ret = 0;
 1294|  1.86k|    BIGNUM *curve_p, *curve_a, *curve_b;
 1295|  1.86k|#ifndef FIPS_MODULE
 1296|  1.86k|    BN_CTX *new_ctx = NULL;
 1297|       |
 1298|  1.86k|    if (ctx == NULL)
  ------------------
  |  Branch (1298:9): [True: 0, False: 1.86k]
  ------------------
 1299|      0|        ctx = new_ctx = BN_CTX_new();
 1300|  1.86k|#endif
 1301|  1.86k|    if (ctx == NULL)
  ------------------
  |  Branch (1301:9): [True: 0, False: 1.86k]
  ------------------
 1302|      0|        return 0;
 1303|       |
 1304|  1.86k|    BN_CTX_start(ctx);
 1305|  1.86k|    curve_p = BN_CTX_get(ctx);
 1306|  1.86k|    curve_a = BN_CTX_get(ctx);
 1307|  1.86k|    curve_b = BN_CTX_get(ctx);
 1308|  1.86k|    if (curve_b == NULL)
  ------------------
  |  Branch (1308:9): [True: 0, False: 1.86k]
  ------------------
 1309|      0|        goto err;
 1310|  1.86k|    BN_bin2bn(nistp224_curve_params[0], sizeof(felem_bytearray), curve_p);
 1311|  1.86k|    BN_bin2bn(nistp224_curve_params[1], sizeof(felem_bytearray), curve_a);
 1312|  1.86k|    BN_bin2bn(nistp224_curve_params[2], sizeof(felem_bytearray), curve_b);
 1313|  1.86k|    if ((BN_cmp(curve_p, p)) || (BN_cmp(curve_a, a)) || (BN_cmp(curve_b, b))) {
  ------------------
  |  Branch (1313:9): [True: 0, False: 1.86k]
  |  Branch (1313:33): [True: 0, False: 1.86k]
  |  Branch (1313:57): [True: 0, False: 1.86k]
  ------------------
 1314|      0|        ERR_raise(ERR_LIB_EC, EC_R_WRONG_CURVE_PARAMETERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1315|      0|        goto err;
 1316|      0|    }
 1317|  1.86k|    group->field_mod_func = BN_nist_mod_224;
 1318|  1.86k|    ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
 1319|  1.86k| err:
 1320|  1.86k|    BN_CTX_end(ctx);
 1321|  1.86k|#ifndef FIPS_MODULE
 1322|  1.86k|    BN_CTX_free(new_ctx);
 1323|  1.86k|#endif
 1324|  1.86k|    return ret;
 1325|  1.86k|}
ossl_ec_GFp_nistp224_point_get_affine_coordinates:
 1335|    270|{
 1336|    270|    felem z1, z2, x_in, y_in, x_out, y_out;
 1337|    270|    widefelem tmp;
 1338|       |
 1339|    270|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (1339:9): [True: 0, False: 270]
  ------------------
 1340|      0|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1341|      0|        return 0;
 1342|      0|    }
 1343|    270|    if ((!BN_to_felem(x_in, point->X)) || (!BN_to_felem(y_in, point->Y)) ||
  ------------------
  |  Branch (1343:9): [True: 0, False: 270]
  |  Branch (1343:43): [True: 0, False: 270]
  ------------------
 1344|    270|        (!BN_to_felem(z1, point->Z)))
  ------------------
  |  Branch (1344:9): [True: 0, False: 270]
  ------------------
 1345|      0|        return 0;
 1346|    270|    felem_inv(z2, z1);
 1347|    270|    felem_square(tmp, z2);
 1348|    270|    felem_reduce(z1, tmp);
 1349|    270|    felem_mul(tmp, x_in, z1);
 1350|    270|    felem_reduce(x_in, tmp);
 1351|    270|    felem_contract(x_out, x_in);
 1352|    270|    if (x != NULL) {
  ------------------
  |  Branch (1352:9): [True: 270, False: 0]
  ------------------
 1353|    270|        if (!felem_to_BN(x, x_out)) {
  ------------------
  |  Branch (1353:13): [True: 0, False: 270]
  ------------------
 1354|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1355|      0|            return 0;
 1356|      0|        }
 1357|    270|    }
 1358|    270|    felem_mul(tmp, z1, z2);
 1359|    270|    felem_reduce(z1, tmp);
 1360|    270|    felem_mul(tmp, y_in, z1);
 1361|    270|    felem_reduce(y_in, tmp);
 1362|    270|    felem_contract(y_out, y_in);
 1363|    270|    if (y != NULL) {
  ------------------
  |  Branch (1363:9): [True: 270, False: 0]
  ------------------
 1364|    270|        if (!felem_to_BN(y, y_out)) {
  ------------------
  |  Branch (1364:13): [True: 0, False: 270]
  ------------------
 1365|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1366|      0|            return 0;
 1367|      0|        }
 1368|    270|    }
 1369|    270|    return 1;
 1370|    270|}
ossl_ec_GFp_nistp224_points_mul:
 1409|     19|{
 1410|     19|    int ret = 0;
 1411|     19|    int j;
 1412|     19|    unsigned i;
 1413|     19|    int mixed = 0;
 1414|     19|    BIGNUM *x, *y, *z, *tmp_scalar;
 1415|     19|    felem_bytearray g_secret;
 1416|     19|    felem_bytearray *secrets = NULL;
 1417|     19|    felem (*pre_comp)[17][3] = NULL;
 1418|     19|    felem *tmp_felems = NULL;
 1419|     19|    int num_bytes;
 1420|     19|    int have_pre_comp = 0;
 1421|     19|    size_t num_points = num;
 1422|     19|    felem x_in, y_in, z_in, x_out, y_out, z_out;
 1423|     19|    NISTP224_PRE_COMP *pre = NULL;
 1424|     19|    const felem(*g_pre_comp)[16][3] = NULL;
 1425|     19|    EC_POINT *generator = NULL;
 1426|     19|    const EC_POINT *p = NULL;
 1427|     19|    const BIGNUM *p_scalar = NULL;
 1428|       |
 1429|     19|    BN_CTX_start(ctx);
 1430|     19|    x = BN_CTX_get(ctx);
 1431|     19|    y = BN_CTX_get(ctx);
 1432|     19|    z = BN_CTX_get(ctx);
 1433|     19|    tmp_scalar = BN_CTX_get(ctx);
 1434|     19|    if (tmp_scalar == NULL)
  ------------------
  |  Branch (1434:9): [True: 0, False: 19]
  ------------------
 1435|      0|        goto err;
 1436|       |
 1437|     19|    if (scalar != NULL) {
  ------------------
  |  Branch (1437:9): [True: 19, False: 0]
  ------------------
 1438|     19|        pre = group->pre_comp.nistp224;
 1439|     19|        if (pre)
  ------------------
  |  Branch (1439:13): [True: 0, False: 19]
  ------------------
 1440|       |            /* we have precomputation, try to use it */
 1441|      0|            g_pre_comp = (const felem(*)[16][3])pre->g_pre_comp;
 1442|     19|        else
 1443|       |            /* try to use the standard precomputation */
 1444|     19|            g_pre_comp = &gmul[0];
 1445|     19|        generator = EC_POINT_new(group);
 1446|     19|        if (generator == NULL)
  ------------------
  |  Branch (1446:13): [True: 0, False: 19]
  ------------------
 1447|      0|            goto err;
 1448|       |        /* get the generator from precomputation */
 1449|     19|        if (!felem_to_BN(x, g_pre_comp[0][1][0]) ||
  ------------------
  |  Branch (1449:13): [True: 0, False: 19]
  ------------------
 1450|     19|            !felem_to_BN(y, g_pre_comp[0][1][1]) ||
  ------------------
  |  Branch (1450:13): [True: 0, False: 19]
  ------------------
 1451|     19|            !felem_to_BN(z, g_pre_comp[0][1][2])) {
  ------------------
  |  Branch (1451:13): [True: 0, False: 19]
  ------------------
 1452|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1453|      0|            goto err;
 1454|      0|        }
 1455|     19|        if (!ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group,
  ------------------
  |  Branch (1455:13): [True: 0, False: 19]
  ------------------
 1456|     19|                                                                generator,
 1457|     19|                                                                x, y, z, ctx))
 1458|      0|            goto err;
 1459|     19|        if (0 == EC_POINT_cmp(group, generator, group->generator, ctx))
  ------------------
  |  Branch (1459:13): [True: 19, False: 0]
  ------------------
 1460|       |            /* precomputation matches generator */
 1461|     19|            have_pre_comp = 1;
 1462|      0|        else
 1463|       |            /*
 1464|       |             * we don't have valid precomputation: treat the generator as a
 1465|       |             * random point
 1466|       |             */
 1467|      0|            num_points = num_points + 1;
 1468|     19|    }
 1469|       |
 1470|     19|    if (num_points > 0) {
  ------------------
  |  Branch (1470:9): [True: 0, False: 19]
  ------------------
 1471|      0|        if (num_points >= 3) {
  ------------------
  |  Branch (1471:13): [True: 0, False: 0]
  ------------------
 1472|       |            /*
 1473|       |             * unless we precompute multiples for just one or two points,
 1474|       |             * converting those into affine form is time well spent
 1475|       |             */
 1476|      0|            mixed = 1;
 1477|      0|        }
 1478|      0|        secrets = OPENSSL_zalloc(sizeof(*secrets) * num_points);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1479|      0|        pre_comp = OPENSSL_zalloc(sizeof(*pre_comp) * num_points);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1480|      0|        if (mixed)
  ------------------
  |  Branch (1480:13): [True: 0, False: 0]
  ------------------
 1481|      0|            tmp_felems =
 1482|      0|                OPENSSL_malloc(sizeof(felem) * (num_points * 17 + 1));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1483|      0|        if ((secrets == NULL) || (pre_comp == NULL)
  ------------------
  |  Branch (1483:13): [True: 0, False: 0]
  |  Branch (1483:34): [True: 0, False: 0]
  ------------------
 1484|      0|            || (mixed && (tmp_felems == NULL)))
  ------------------
  |  Branch (1484:17): [True: 0, False: 0]
  |  Branch (1484:26): [True: 0, False: 0]
  ------------------
 1485|      0|            goto err;
 1486|       |
 1487|       |        /*
 1488|       |         * we treat NULL scalars as 0, and NULL points as points at infinity,
 1489|       |         * i.e., they contribute nothing to the linear combination
 1490|       |         */
 1491|      0|        for (i = 0; i < num_points; ++i) {
  ------------------
  |  Branch (1491:21): [True: 0, False: 0]
  ------------------
 1492|      0|            if (i == num) {
  ------------------
  |  Branch (1492:17): [True: 0, False: 0]
  ------------------
 1493|       |                /* the generator */
 1494|      0|                p = EC_GROUP_get0_generator(group);
 1495|      0|                p_scalar = scalar;
 1496|      0|            } else {
 1497|       |                /* the i^th point */
 1498|      0|                p = points[i];
 1499|      0|                p_scalar = scalars[i];
 1500|      0|            }
 1501|      0|            if ((p_scalar != NULL) && (p != NULL)) {
  ------------------
  |  Branch (1501:17): [True: 0, False: 0]
  |  Branch (1501:39): [True: 0, False: 0]
  ------------------
 1502|       |                /* reduce scalar to 0 <= scalar < 2^224 */
 1503|      0|                if ((BN_num_bits(p_scalar) > 224)
  ------------------
  |  Branch (1503:21): [True: 0, False: 0]
  ------------------
 1504|      0|                    || (BN_is_negative(p_scalar))) {
  ------------------
  |  Branch (1504:24): [True: 0, False: 0]
  ------------------
 1505|       |                    /*
 1506|       |                     * this is an unusual input, and we don't guarantee
 1507|       |                     * constant-timeness
 1508|       |                     */
 1509|      0|                    if (!BN_nnmod(tmp_scalar, p_scalar, group->order, ctx)) {
  ------------------
  |  Branch (1509:25): [True: 0, False: 0]
  ------------------
 1510|      0|                        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1511|      0|                        goto err;
 1512|      0|                    }
 1513|      0|                    num_bytes = BN_bn2lebinpad(tmp_scalar,
 1514|      0|                                               secrets[i], sizeof(secrets[i]));
 1515|      0|                } else {
 1516|      0|                    num_bytes = BN_bn2lebinpad(p_scalar,
 1517|      0|                                               secrets[i], sizeof(secrets[i]));
 1518|      0|                }
 1519|      0|                if (num_bytes < 0) {
  ------------------
  |  Branch (1519:21): [True: 0, False: 0]
  ------------------
 1520|      0|                    ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1521|      0|                    goto err;
 1522|      0|                }
 1523|       |                /* precompute multiples */
 1524|      0|                if ((!BN_to_felem(x_out, p->X)) ||
  ------------------
  |  Branch (1524:21): [True: 0, False: 0]
  ------------------
 1525|      0|                    (!BN_to_felem(y_out, p->Y)) ||
  ------------------
  |  Branch (1525:21): [True: 0, False: 0]
  ------------------
 1526|      0|                    (!BN_to_felem(z_out, p->Z)))
  ------------------
  |  Branch (1526:21): [True: 0, False: 0]
  ------------------
 1527|      0|                    goto err;
 1528|      0|                felem_assign(pre_comp[i][1][0], x_out);
 1529|      0|                felem_assign(pre_comp[i][1][1], y_out);
 1530|      0|                felem_assign(pre_comp[i][1][2], z_out);
 1531|      0|                for (j = 2; j <= 16; ++j) {
  ------------------
  |  Branch (1531:29): [True: 0, False: 0]
  ------------------
 1532|      0|                    if (j & 1) {
  ------------------
  |  Branch (1532:25): [True: 0, False: 0]
  ------------------
 1533|      0|                        point_add(pre_comp[i][j][0], pre_comp[i][j][1],
 1534|      0|                                  pre_comp[i][j][2], pre_comp[i][1][0],
 1535|      0|                                  pre_comp[i][1][1], pre_comp[i][1][2], 0,
 1536|      0|                                  pre_comp[i][j - 1][0],
 1537|      0|                                  pre_comp[i][j - 1][1],
 1538|      0|                                  pre_comp[i][j - 1][2]);
 1539|      0|                    } else {
 1540|      0|                        point_double(pre_comp[i][j][0], pre_comp[i][j][1],
 1541|      0|                                     pre_comp[i][j][2], pre_comp[i][j / 2][0],
 1542|      0|                                     pre_comp[i][j / 2][1],
 1543|      0|                                     pre_comp[i][j / 2][2]);
 1544|      0|                    }
 1545|      0|                }
 1546|      0|            }
 1547|      0|        }
 1548|      0|        if (mixed)
  ------------------
  |  Branch (1548:13): [True: 0, False: 0]
  ------------------
 1549|      0|            make_points_affine(num_points * 17, pre_comp[0], tmp_felems);
 1550|      0|    }
 1551|       |
 1552|       |    /* the scalar for the generator */
 1553|     19|    if ((scalar != NULL) && (have_pre_comp)) {
  ------------------
  |  Branch (1553:9): [True: 19, False: 0]
  |  Branch (1553:29): [True: 19, False: 0]
  ------------------
 1554|     19|        memset(g_secret, 0, sizeof(g_secret));
 1555|       |        /* reduce scalar to 0 <= scalar < 2^224 */
 1556|     19|        if ((BN_num_bits(scalar) > 224) || (BN_is_negative(scalar))) {
  ------------------
  |  Branch (1556:13): [True: 4, False: 15]
  |  Branch (1556:44): [True: 0, False: 15]
  ------------------
 1557|       |            /*
 1558|       |             * this is an unusual input, and we don't guarantee
 1559|       |             * constant-timeness
 1560|       |             */
 1561|      4|            if (!BN_nnmod(tmp_scalar, scalar, group->order, ctx)) {
  ------------------
  |  Branch (1561:17): [True: 0, False: 4]
  ------------------
 1562|      0|                ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1563|      0|                goto err;
 1564|      0|            }
 1565|      4|            num_bytes = BN_bn2lebinpad(tmp_scalar, g_secret, sizeof(g_secret));
 1566|     15|        } else {
 1567|     15|            num_bytes = BN_bn2lebinpad(scalar, g_secret, sizeof(g_secret));
 1568|     15|        }
 1569|       |        /* do the multiplication with generator precomputation */
 1570|     19|        batch_mul(x_out, y_out, z_out,
 1571|     19|                  (const felem_bytearray(*))secrets, num_points,
 1572|     19|                  g_secret,
 1573|     19|                  mixed, (const felem(*)[17][3])pre_comp, g_pre_comp);
 1574|     19|    } else {
 1575|       |        /* do the multiplication without generator precomputation */
 1576|      0|        batch_mul(x_out, y_out, z_out,
 1577|      0|                  (const felem_bytearray(*))secrets, num_points,
 1578|      0|                  NULL, mixed, (const felem(*)[17][3])pre_comp, NULL);
 1579|      0|    }
 1580|       |    /* reduce the output to its unique minimal representation */
 1581|     19|    felem_contract(x_in, x_out);
 1582|     19|    felem_contract(y_in, y_out);
 1583|     19|    felem_contract(z_in, z_out);
 1584|     19|    if ((!felem_to_BN(x, x_in)) || (!felem_to_BN(y, y_in)) ||
  ------------------
  |  Branch (1584:9): [True: 0, False: 19]
  |  Branch (1584:36): [True: 0, False: 19]
  ------------------
 1585|     19|        (!felem_to_BN(z, z_in))) {
  ------------------
  |  Branch (1585:9): [True: 0, False: 19]
  ------------------
 1586|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1587|      0|        goto err;
 1588|      0|    }
 1589|     19|    ret = ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, r, x, y, z,
 1590|     19|                                                             ctx);
 1591|       |
 1592|     19| err:
 1593|     19|    BN_CTX_end(ctx);
 1594|     19|    EC_POINT_free(generator);
 1595|     19|    OPENSSL_free(secrets);
  ------------------
  |  |  107|     19|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     19|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     19|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1596|     19|    OPENSSL_free(pre_comp);
  ------------------
  |  |  107|     19|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     19|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     19|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1597|     19|    OPENSSL_free(tmp_felems);
  ------------------
  |  |  107|     19|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     19|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     19|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1598|     19|    return ret;
 1599|     19|}
ecp_nistp224.c:BN_to_felem:
  331|    810|{
  332|    810|    felem_bytearray b_out;
  333|    810|    int num_bytes;
  334|       |
  335|    810|    if (BN_is_negative(bn)) {
  ------------------
  |  Branch (335:9): [True: 0, False: 810]
  ------------------
  336|      0|        ERR_raise(ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  337|      0|        return 0;
  338|      0|    }
  339|    810|    num_bytes = BN_bn2lebinpad(bn, b_out, sizeof(b_out));
  340|    810|    if (num_bytes < 0) {
  ------------------
  |  Branch (340:9): [True: 0, False: 810]
  ------------------
  341|      0|        ERR_raise(ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  342|      0|        return 0;
  343|      0|    }
  344|    810|    bin28_to_felem(out, b_out);
  345|    810|    return 1;
  346|    810|}
ecp_nistp224.c:bin28_to_felem:
  311|    810|{
  312|    810|    out[0] = *((const limb *)(in)) & 0x00ffffffffffffff;
  313|    810|    out[1] = (*((const limb_aX *)(in + 7))) & 0x00ffffffffffffff;
  314|    810|    out[2] = (*((const limb_aX *)(in + 14))) & 0x00ffffffffffffff;
  315|    810|    out[3] = (*((const limb_aX *)(in + 20))) >> 8;
  316|    810|}
ecp_nistp224.c:felem_inv:
  702|    270|{
  703|    270|    felem ftmp, ftmp2, ftmp3, ftmp4;
  704|    270|    widefelem tmp;
  705|    270|    unsigned i;
  706|       |
  707|    270|    felem_square(tmp, in);
  708|    270|    felem_reduce(ftmp, tmp);    /* 2 */
  709|    270|    felem_mul(tmp, in, ftmp);
  710|    270|    felem_reduce(ftmp, tmp);    /* 2^2 - 1 */
  711|    270|    felem_square(tmp, ftmp);
  712|    270|    felem_reduce(ftmp, tmp);    /* 2^3 - 2 */
  713|    270|    felem_mul(tmp, in, ftmp);
  714|    270|    felem_reduce(ftmp, tmp);    /* 2^3 - 1 */
  715|    270|    felem_square(tmp, ftmp);
  716|    270|    felem_reduce(ftmp2, tmp);   /* 2^4 - 2 */
  717|    270|    felem_square(tmp, ftmp2);
  718|    270|    felem_reduce(ftmp2, tmp);   /* 2^5 - 4 */
  719|    270|    felem_square(tmp, ftmp2);
  720|    270|    felem_reduce(ftmp2, tmp);   /* 2^6 - 8 */
  721|    270|    felem_mul(tmp, ftmp2, ftmp);
  722|    270|    felem_reduce(ftmp, tmp);    /* 2^6 - 1 */
  723|    270|    felem_square(tmp, ftmp);
  724|    270|    felem_reduce(ftmp2, tmp);   /* 2^7 - 2 */
  725|  1.62k|    for (i = 0; i < 5; ++i) {   /* 2^12 - 2^6 */
  ------------------
  |  Branch (725:17): [True: 1.35k, False: 270]
  ------------------
  726|  1.35k|        felem_square(tmp, ftmp2);
  727|  1.35k|        felem_reduce(ftmp2, tmp);
  728|  1.35k|    }
  729|    270|    felem_mul(tmp, ftmp2, ftmp);
  730|    270|    felem_reduce(ftmp2, tmp);   /* 2^12 - 1 */
  731|    270|    felem_square(tmp, ftmp2);
  732|    270|    felem_reduce(ftmp3, tmp);   /* 2^13 - 2 */
  733|  3.24k|    for (i = 0; i < 11; ++i) {  /* 2^24 - 2^12 */
  ------------------
  |  Branch (733:17): [True: 2.97k, False: 270]
  ------------------
  734|  2.97k|        felem_square(tmp, ftmp3);
  735|  2.97k|        felem_reduce(ftmp3, tmp);
  736|  2.97k|    }
  737|    270|    felem_mul(tmp, ftmp3, ftmp2);
  738|    270|    felem_reduce(ftmp2, tmp);   /* 2^24 - 1 */
  739|    270|    felem_square(tmp, ftmp2);
  740|    270|    felem_reduce(ftmp3, tmp);   /* 2^25 - 2 */
  741|  6.48k|    for (i = 0; i < 23; ++i) {  /* 2^48 - 2^24 */
  ------------------
  |  Branch (741:17): [True: 6.21k, False: 270]
  ------------------
  742|  6.21k|        felem_square(tmp, ftmp3);
  743|  6.21k|        felem_reduce(ftmp3, tmp);
  744|  6.21k|    }
  745|    270|    felem_mul(tmp, ftmp3, ftmp2);
  746|    270|    felem_reduce(ftmp3, tmp);   /* 2^48 - 1 */
  747|    270|    felem_square(tmp, ftmp3);
  748|    270|    felem_reduce(ftmp4, tmp);   /* 2^49 - 2 */
  749|  12.9k|    for (i = 0; i < 47; ++i) {  /* 2^96 - 2^48 */
  ------------------
  |  Branch (749:17): [True: 12.6k, False: 270]
  ------------------
  750|  12.6k|        felem_square(tmp, ftmp4);
  751|  12.6k|        felem_reduce(ftmp4, tmp);
  752|  12.6k|    }
  753|    270|    felem_mul(tmp, ftmp3, ftmp4);
  754|    270|    felem_reduce(ftmp3, tmp);   /* 2^96 - 1 */
  755|    270|    felem_square(tmp, ftmp3);
  756|    270|    felem_reduce(ftmp4, tmp);   /* 2^97 - 2 */
  757|  6.48k|    for (i = 0; i < 23; ++i) {  /* 2^120 - 2^24 */
  ------------------
  |  Branch (757:17): [True: 6.21k, False: 270]
  ------------------
  758|  6.21k|        felem_square(tmp, ftmp4);
  759|  6.21k|        felem_reduce(ftmp4, tmp);
  760|  6.21k|    }
  761|    270|    felem_mul(tmp, ftmp2, ftmp4);
  762|    270|    felem_reduce(ftmp2, tmp);   /* 2^120 - 1 */
  763|  1.89k|    for (i = 0; i < 6; ++i) {   /* 2^126 - 2^6 */
  ------------------
  |  Branch (763:17): [True: 1.62k, False: 270]
  ------------------
  764|  1.62k|        felem_square(tmp, ftmp2);
  765|  1.62k|        felem_reduce(ftmp2, tmp);
  766|  1.62k|    }
  767|    270|    felem_mul(tmp, ftmp2, ftmp);
  768|    270|    felem_reduce(ftmp, tmp);    /* 2^126 - 1 */
  769|    270|    felem_square(tmp, ftmp);
  770|    270|    felem_reduce(ftmp, tmp);    /* 2^127 - 2 */
  771|    270|    felem_mul(tmp, ftmp, in);
  772|    270|    felem_reduce(ftmp, tmp);    /* 2^127 - 1 */
  773|  26.4k|    for (i = 0; i < 97; ++i) {  /* 2^224 - 2^97 */
  ------------------
  |  Branch (773:17): [True: 26.1k, False: 270]
  ------------------
  774|  26.1k|        felem_square(tmp, ftmp);
  775|  26.1k|        felem_reduce(ftmp, tmp);
  776|  26.1k|    }
  777|    270|    felem_mul(tmp, ftmp, ftmp3);
  778|    270|    felem_reduce(out, tmp);     /* 2^224 - 2^96 - 1 */
  779|    270|}
ecp_nistp224.c:felem_square:
  493|  66.1k|{
  494|  66.1k|    limb tmp0, tmp1, tmp2;
  495|  66.1k|    tmp0 = 2 * in[0];
  496|  66.1k|    tmp1 = 2 * in[1];
  497|  66.1k|    tmp2 = 2 * in[2];
  498|  66.1k|    out[0] = ((widelimb) in[0]) * in[0];
  499|  66.1k|    out[1] = ((widelimb) in[0]) * tmp1;
  500|  66.1k|    out[2] = ((widelimb) in[0]) * tmp2 + ((widelimb) in[1]) * in[1];
  501|  66.1k|    out[3] = ((widelimb) in[3]) * tmp0 + ((widelimb) in[1]) * tmp2;
  502|  66.1k|    out[4] = ((widelimb) in[3]) * tmp1 + ((widelimb) in[2]) * in[2];
  503|  66.1k|    out[5] = ((widelimb) in[3]) * tmp2;
  504|  66.1k|    out[6] = ((widelimb) in[3]) * in[3];
  505|  66.1k|}
ecp_nistp224.c:felem_reduce:
  527|  78.3k|{
  528|  78.3k|    static const widelimb two127p15 = (((widelimb) 1) << 127) +
  529|  78.3k|        (((widelimb) 1) << 15);
  530|  78.3k|    static const widelimb two127m71 = (((widelimb) 1) << 127) -
  531|  78.3k|        (((widelimb) 1) << 71);
  532|  78.3k|    static const widelimb two127m71m55 = (((widelimb) 1) << 127) -
  533|  78.3k|        (((widelimb) 1) << 71) - (((widelimb) 1) << 55);
  534|  78.3k|    widelimb output[5];
  535|       |
  536|       |    /* Add 0 mod 2^224-2^96+1 to ensure all differences are positive */
  537|  78.3k|    output[0] = in[0] + two127p15;
  538|  78.3k|    output[1] = in[1] + two127m71m55;
  539|  78.3k|    output[2] = in[2] + two127m71;
  540|  78.3k|    output[3] = in[3];
  541|  78.3k|    output[4] = in[4];
  542|       |
  543|       |    /* Eliminate in[4], in[5], in[6] */
  544|  78.3k|    output[4] += in[6] >> 16;
  545|  78.3k|    output[3] += (in[6] & 0xffff) << 40;
  546|  78.3k|    output[2] -= in[6];
  547|       |
  548|  78.3k|    output[3] += in[5] >> 16;
  549|  78.3k|    output[2] += (in[5] & 0xffff) << 40;
  550|  78.3k|    output[1] -= in[5];
  551|       |
  552|  78.3k|    output[2] += output[4] >> 16;
  553|  78.3k|    output[1] += (output[4] & 0xffff) << 40;
  554|  78.3k|    output[0] -= output[4];
  555|       |
  556|       |    /* Carry 2 -> 3 -> 4 */
  557|  78.3k|    output[3] += output[2] >> 56;
  558|  78.3k|    output[2] &= 0x00ffffffffffffff;
  559|       |
  560|  78.3k|    output[4] = output[3] >> 56;
  561|  78.3k|    output[3] &= 0x00ffffffffffffff;
  562|       |
  563|       |    /* Now output[2] < 2^56, output[3] < 2^56, output[4] < 2^72 */
  564|       |
  565|       |    /* Eliminate output[4] */
  566|  78.3k|    output[2] += output[4] >> 16;
  567|       |    /* output[2] < 2^56 + 2^56 = 2^57 */
  568|  78.3k|    output[1] += (output[4] & 0xffff) << 40;
  569|  78.3k|    output[0] -= output[4];
  570|       |
  571|       |    /* Carry 0 -> 1 -> 2 -> 3 */
  572|  78.3k|    output[1] += output[0] >> 56;
  573|  78.3k|    out[0] = output[0] & 0x00ffffffffffffff;
  574|       |
  575|  78.3k|    output[2] += output[1] >> 56;
  576|       |    /* output[2] < 2^57 + 2^72 */
  577|  78.3k|    out[1] = output[1] & 0x00ffffffffffffff;
  578|  78.3k|    output[3] += output[2] >> 56;
  579|       |    /* output[3] <= 2^56 + 2^16 */
  580|  78.3k|    out[2] = output[2] & 0x00ffffffffffffff;
  581|       |
  582|       |    /*-
  583|       |     * out[0] < 2^56, out[1] < 2^56, out[2] < 2^56,
  584|       |     * out[3] <= 2^56 + 2^16 (due to final carry),
  585|       |     * so out < 2*p
  586|       |     */
  587|  78.3k|    out[3] = output[3];
  588|  78.3k|}
ecp_nistp224.c:felem_mul:
  509|  13.6k|{
  510|  13.6k|    out[0] = ((widelimb) in1[0]) * in2[0];
  511|  13.6k|    out[1] = ((widelimb) in1[0]) * in2[1] + ((widelimb) in1[1]) * in2[0];
  512|  13.6k|    out[2] = ((widelimb) in1[0]) * in2[2] + ((widelimb) in1[1]) * in2[1] +
  513|  13.6k|             ((widelimb) in1[2]) * in2[0];
  514|  13.6k|    out[3] = ((widelimb) in1[0]) * in2[3] + ((widelimb) in1[1]) * in2[2] +
  515|  13.6k|             ((widelimb) in1[2]) * in2[1] + ((widelimb) in1[3]) * in2[0];
  516|  13.6k|    out[4] = ((widelimb) in1[1]) * in2[3] + ((widelimb) in1[2]) * in2[2] +
  517|  13.6k|             ((widelimb) in1[3]) * in2[1];
  518|  13.6k|    out[5] = ((widelimb) in1[2]) * in2[3] + ((widelimb) in1[3]) * in2[2];
  519|  13.6k|    out[6] = ((widelimb) in1[3]) * in2[3];
  520|  13.6k|}
ecp_nistp224.c:felem_contract:
  609|    597|{
  610|    597|    static const int64_t two56 = ((limb) 1) << 56;
  611|       |    /* 0 <= in < 2*p, p = 2^224 - 2^96 + 1 */
  612|       |    /* if in > p , reduce in = in - 2^224 + 2^96 - 1 */
  613|    597|    int64_t tmp[4], a;
  614|    597|    tmp[0] = in[0];
  615|    597|    tmp[1] = in[1];
  616|    597|    tmp[2] = in[2];
  617|    597|    tmp[3] = in[3];
  618|       |    /* Case 1: a = 1 iff in >= 2^224 */
  619|    597|    a = (in[3] >> 56);
  620|    597|    tmp[0] -= a;
  621|    597|    tmp[1] += a << 40;
  622|    597|    tmp[3] &= 0x00ffffffffffffff;
  623|       |    /*
  624|       |     * Case 2: a = 0 iff p <= in < 2^224, i.e., the high 128 bits are all 1
  625|       |     * and the lower part is non-zero
  626|       |     */
  627|    597|    a = ((in[3] & in[2] & (in[1] | 0x000000ffffffffff)) + 1) |
  628|    597|        (((int64_t) (in[0] + (in[1] & 0x000000ffffffffff)) - 1) >> 63);
  629|    597|    a &= 0x00ffffffffffffff;
  630|       |    /* turn a into an all-one mask (if a = 0) or an all-zero mask */
  631|    597|    a = (a - 1) >> 63;
  632|       |    /* subtract 2^224 - 2^96 + 1 if a is all-one */
  633|    597|    tmp[3] &= a ^ 0xffffffffffffffff;
  634|    597|    tmp[2] &= a ^ 0xffffffffffffffff;
  635|    597|    tmp[1] &= (a ^ 0xffffffffffffffff) | 0x000000ffffffffff;
  636|    597|    tmp[0] -= 1 & a;
  637|       |
  638|       |    /*
  639|       |     * eliminate negative coefficients: if tmp[0] is negative, tmp[1] must be
  640|       |     * non-zero, so we only need one step
  641|       |     */
  642|    597|    a = tmp[0] >> 63;
  643|    597|    tmp[0] += two56 & a;
  644|    597|    tmp[1] -= 1 & a;
  645|       |
  646|       |    /* carry 1 -> 2 -> 3 */
  647|    597|    tmp[2] += tmp[1] >> 56;
  648|    597|    tmp[1] &= 0x00ffffffffffffff;
  649|       |
  650|    597|    tmp[3] += tmp[2] >> 56;
  651|    597|    tmp[2] &= 0x00ffffffffffffff;
  652|       |
  653|       |    /* Now 0 <= out < p */
  654|    597|    out[0] = tmp[0];
  655|    597|    out[1] = tmp[1];
  656|    597|    out[2] = tmp[2];
  657|    597|    out[3] = tmp[3];
  658|    597|}
ecp_nistp224.c:felem_to_BN:
  350|    654|{
  351|    654|    felem_bytearray b_out;
  352|    654|    felem_to_bin28(b_out, in);
  353|    654|    return BN_lebin2bn(b_out, sizeof(b_out), out);
  354|    654|}
ecp_nistp224.c:felem_to_bin28:
  319|    654|{
  320|    654|    unsigned i;
  321|  5.23k|    for (i = 0; i < 7; ++i) {
  ------------------
  |  Branch (321:17): [True: 4.57k, False: 654]
  ------------------
  322|  4.57k|        out[i] = in[0] >> (8 * i);
  323|  4.57k|        out[i + 7] = in[1] >> (8 * i);
  324|  4.57k|        out[i + 14] = in[2] >> (8 * i);
  325|  4.57k|        out[i + 21] = in[3] >> (8 * i);
  326|  4.57k|    }
  327|    654|}
ecp_nistp224.c:felem_assign:
  376|  10.4k|{
  377|  10.4k|    out[0] = in[0];
  378|  10.4k|    out[1] = in[1];
  379|  10.4k|    out[2] = in[2];
  380|  10.4k|    out[3] = in[3];
  381|  10.4k|}
ecp_nistp224.c:point_add:
  910|  1.04k|{
  911|  1.04k|    felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, x_out, y_out, z_out;
  912|  1.04k|    widefelem tmp, tmp2;
  913|  1.04k|    limb z1_is_zero, z2_is_zero, x_equal, y_equal;
  914|  1.04k|    limb points_equal;
  915|       |
  916|  1.04k|    if (!mixed) {
  ------------------
  |  Branch (916:9): [True: 0, False: 1.04k]
  ------------------
  917|       |        /* ftmp2 = z2^2 */
  918|      0|        felem_square(tmp, z2);
  919|      0|        felem_reduce(ftmp2, tmp);
  920|       |
  921|       |        /* ftmp4 = z2^3 */
  922|      0|        felem_mul(tmp, ftmp2, z2);
  923|      0|        felem_reduce(ftmp4, tmp);
  924|       |
  925|       |        /* ftmp4 = z2^3*y1 */
  926|      0|        felem_mul(tmp2, ftmp4, y1);
  927|      0|        felem_reduce(ftmp4, tmp2);
  928|       |
  929|       |        /* ftmp2 = z2^2*x1 */
  930|      0|        felem_mul(tmp2, ftmp2, x1);
  931|      0|        felem_reduce(ftmp2, tmp2);
  932|  1.04k|    } else {
  933|       |        /*
  934|       |         * We'll assume z2 = 1 (special case z2 = 0 is handled later)
  935|       |         */
  936|       |
  937|       |        /* ftmp4 = z2^3*y1 */
  938|  1.04k|        felem_assign(ftmp4, y1);
  939|       |
  940|       |        /* ftmp2 = z2^2*x1 */
  941|  1.04k|        felem_assign(ftmp2, x1);
  942|  1.04k|    }
  943|       |
  944|       |    /* ftmp = z1^2 */
  945|  1.04k|    felem_square(tmp, z1);
  946|  1.04k|    felem_reduce(ftmp, tmp);
  947|       |
  948|       |    /* ftmp3 = z1^3 */
  949|  1.04k|    felem_mul(tmp, ftmp, z1);
  950|  1.04k|    felem_reduce(ftmp3, tmp);
  951|       |
  952|       |    /* tmp = z1^3*y2 */
  953|  1.04k|    felem_mul(tmp, ftmp3, y2);
  954|       |    /* tmp[i] < 4 * 2^57 * 2^57 = 2^116 */
  955|       |
  956|       |    /* ftmp3 = z1^3*y2 - z2^3*y1 */
  957|  1.04k|    felem_diff_128_64(tmp, ftmp4);
  958|       |    /* tmp[i] < 2^116 + 2^64 + 8 < 2^117 */
  959|  1.04k|    felem_reduce(ftmp3, tmp);
  960|       |
  961|       |    /* tmp = z1^2*x2 */
  962|  1.04k|    felem_mul(tmp, ftmp, x2);
  963|       |    /* tmp[i] < 4 * 2^57 * 2^57 = 2^116 */
  964|       |
  965|       |    /* ftmp = z1^2*x2 - z2^2*x1 */
  966|  1.04k|    felem_diff_128_64(tmp, ftmp2);
  967|       |    /* tmp[i] < 2^116 + 2^64 + 8 < 2^117 */
  968|  1.04k|    felem_reduce(ftmp, tmp);
  969|       |
  970|       |    /*
  971|       |     * The formulae are incorrect if the points are equal, in affine coordinates
  972|       |     * (X_1, Y_1) == (X_2, Y_2), so we check for this and do doubling if this
  973|       |     * happens.
  974|       |     *
  975|       |     * We use bitwise operations to avoid potential side-channels introduced by
  976|       |     * the short-circuiting behaviour of boolean operators.
  977|       |     */
  978|  1.04k|    x_equal = felem_is_zero(ftmp);
  979|  1.04k|    y_equal = felem_is_zero(ftmp3);
  980|       |    /*
  981|       |     * The special case of either point being the point at infinity (z1 and/or
  982|       |     * z2 are zero), is handled separately later on in this function, so we
  983|       |     * avoid jumping to point_double here in those special cases.
  984|       |     */
  985|  1.04k|    z1_is_zero = felem_is_zero(z1);
  986|  1.04k|    z2_is_zero = felem_is_zero(z2);
  987|       |
  988|       |    /*
  989|       |     * Compared to `ecp_nistp256.c` and `ecp_nistp521.c`, in this
  990|       |     * specific implementation `felem_is_zero()` returns truth as `0x1`
  991|       |     * (rather than `0xff..ff`).
  992|       |     *
  993|       |     * This implies that `~true` in this implementation becomes
  994|       |     * `0xff..fe` (rather than `0x0`): for this reason, to be used in
  995|       |     * the if expression, we mask out only the last bit in the next
  996|       |     * line.
  997|       |     */
  998|  1.04k|    points_equal = (x_equal & y_equal & (~z1_is_zero) & (~z2_is_zero)) & 1;
  999|       |
 1000|  1.04k|    if (points_equal) {
  ------------------
  |  Branch (1000:9): [True: 0, False: 1.04k]
  ------------------
 1001|       |        /*
 1002|       |         * This is obviously not constant-time but, as mentioned before, this
 1003|       |         * case never happens during single point multiplication, so there is no
 1004|       |         * timing leak for ECDH or ECDSA signing.
 1005|       |         */
 1006|      0|        point_double(x3, y3, z3, x1, y1, z1);
 1007|      0|        return;
 1008|      0|    }
 1009|       |
 1010|       |    /* ftmp5 = z1*z2 */
 1011|  1.04k|    if (!mixed) {
  ------------------
  |  Branch (1011:9): [True: 0, False: 1.04k]
  ------------------
 1012|      0|        felem_mul(tmp, z1, z2);
 1013|      0|        felem_reduce(ftmp5, tmp);
 1014|  1.04k|    } else {
 1015|       |        /* special case z2 = 0 is handled later */
 1016|  1.04k|        felem_assign(ftmp5, z1);
 1017|  1.04k|    }
 1018|       |
 1019|       |    /* z_out = (z1^2*x2 - z2^2*x1)*(z1*z2) */
 1020|  1.04k|    felem_mul(tmp, ftmp, ftmp5);
 1021|  1.04k|    felem_reduce(z_out, tmp);
 1022|       |
 1023|       |    /* ftmp = (z1^2*x2 - z2^2*x1)^2 */
 1024|  1.04k|    felem_assign(ftmp5, ftmp);
 1025|  1.04k|    felem_square(tmp, ftmp);
 1026|  1.04k|    felem_reduce(ftmp, tmp);
 1027|       |
 1028|       |    /* ftmp5 = (z1^2*x2 - z2^2*x1)^3 */
 1029|  1.04k|    felem_mul(tmp, ftmp, ftmp5);
 1030|  1.04k|    felem_reduce(ftmp5, tmp);
 1031|       |
 1032|       |    /* ftmp2 = z2^2*x1*(z1^2*x2 - z2^2*x1)^2 */
 1033|  1.04k|    felem_mul(tmp, ftmp2, ftmp);
 1034|  1.04k|    felem_reduce(ftmp2, tmp);
 1035|       |
 1036|       |    /* tmp = z2^3*y1*(z1^2*x2 - z2^2*x1)^3 */
 1037|  1.04k|    felem_mul(tmp, ftmp4, ftmp5);
 1038|       |    /* tmp[i] < 4 * 2^57 * 2^57 = 2^116 */
 1039|       |
 1040|       |    /* tmp2 = (z1^3*y2 - z2^3*y1)^2 */
 1041|  1.04k|    felem_square(tmp2, ftmp3);
 1042|       |    /* tmp2[i] < 4 * 2^57 * 2^57 < 2^116 */
 1043|       |
 1044|       |    /* tmp2 = (z1^3*y2 - z2^3*y1)^2 - (z1^2*x2 - z2^2*x1)^3 */
 1045|  1.04k|    felem_diff_128_64(tmp2, ftmp5);
 1046|       |    /* tmp2[i] < 2^116 + 2^64 + 8 < 2^117 */
 1047|       |
 1048|       |    /* ftmp5 = 2*z2^2*x1*(z1^2*x2 - z2^2*x1)^2 */
 1049|  1.04k|    felem_assign(ftmp5, ftmp2);
 1050|  1.04k|    felem_scalar(ftmp5, 2);
 1051|       |    /* ftmp5[i] < 2 * 2^57 = 2^58 */
 1052|       |
 1053|       |    /*-
 1054|       |     * x_out = (z1^3*y2 - z2^3*y1)^2 - (z1^2*x2 - z2^2*x1)^3 -
 1055|       |     *  2*z2^2*x1*(z1^2*x2 - z2^2*x1)^2
 1056|       |     */
 1057|  1.04k|    felem_diff_128_64(tmp2, ftmp5);
 1058|       |    /* tmp2[i] < 2^117 + 2^64 + 8 < 2^118 */
 1059|  1.04k|    felem_reduce(x_out, tmp2);
 1060|       |
 1061|       |    /* ftmp2 = z2^2*x1*(z1^2*x2 - z2^2*x1)^2 - x_out */
 1062|  1.04k|    felem_diff(ftmp2, x_out);
 1063|       |    /* ftmp2[i] < 2^57 + 2^58 + 2 < 2^59 */
 1064|       |
 1065|       |    /*
 1066|       |     * tmp2 = (z1^3*y2 - z2^3*y1)*(z2^2*x1*(z1^2*x2 - z2^2*x1)^2 - x_out)
 1067|       |     */
 1068|  1.04k|    felem_mul(tmp2, ftmp3, ftmp2);
 1069|       |    /* tmp2[i] < 4 * 2^57 * 2^59 = 2^118 */
 1070|       |
 1071|       |    /*-
 1072|       |     * y_out = (z1^3*y2 - z2^3*y1)*(z2^2*x1*(z1^2*x2 - z2^2*x1)^2 - x_out) -
 1073|       |     *  z2^3*y1*(z1^2*x2 - z2^2*x1)^3
 1074|       |     */
 1075|  1.04k|    widefelem_diff(tmp2, tmp);
 1076|       |    /* tmp2[i] < 2^118 + 2^120 < 2^121 */
 1077|  1.04k|    felem_reduce(y_out, tmp2);
 1078|       |
 1079|       |    /*
 1080|       |     * the result (x_out, y_out, z_out) is incorrect if one of the inputs is
 1081|       |     * the point at infinity, so we need to check for this separately
 1082|       |     */
 1083|       |
 1084|       |    /*
 1085|       |     * if point 1 is at infinity, copy point 2 to output, and vice versa
 1086|       |     */
 1087|  1.04k|    copy_conditional(x_out, x2, z1_is_zero);
 1088|  1.04k|    copy_conditional(x_out, x1, z2_is_zero);
 1089|  1.04k|    copy_conditional(y_out, y2, z1_is_zero);
 1090|  1.04k|    copy_conditional(y_out, y1, z2_is_zero);
 1091|  1.04k|    copy_conditional(z_out, z2, z1_is_zero);
 1092|  1.04k|    copy_conditional(z_out, z1, z2_is_zero);
 1093|  1.04k|    felem_assign(x3, x_out);
 1094|  1.04k|    felem_assign(y3, y_out);
 1095|  1.04k|    felem_assign(z3, z_out);
 1096|  1.04k|}
ecp_nistp224.c:felem_diff_128_64:
  444|  5.20k|{
  445|  5.20k|    static const widelimb two64p8 = (((widelimb) 1) << 64) +
  446|  5.20k|        (((widelimb) 1) << 8);
  447|  5.20k|    static const widelimb two64m8 = (((widelimb) 1) << 64) -
  448|  5.20k|        (((widelimb) 1) << 8);
  449|  5.20k|    static const widelimb two64m48m8 = (((widelimb) 1) << 64) -
  450|  5.20k|        (((widelimb) 1) << 48) - (((widelimb) 1) << 8);
  451|       |
  452|       |    /* Add 0 mod 2^224-2^96+1 to ensure out > in */
  453|  5.20k|    out[0] += two64p8;
  454|  5.20k|    out[1] += two64m48m8;
  455|  5.20k|    out[2] += two64m8;
  456|  5.20k|    out[3] += two64m8;
  457|       |
  458|  5.20k|    out[0] -= in[0];
  459|  5.20k|    out[1] -= in[1];
  460|  5.20k|    out[2] -= in[2];
  461|  5.20k|    out[3] -= in[3];
  462|  5.20k|}
ecp_nistp224.c:felem_is_zero:
  680|  4.18k|{
  681|  4.18k|    limb zero, two224m96p1, two225m97p2;
  682|       |
  683|  4.18k|    zero = in[0] | in[1] | in[2] | in[3];
  684|  4.18k|    zero = (((int64_t) (zero) - 1) >> 63) & 1;
  685|  4.18k|    two224m96p1 = (in[0] ^ 1) | (in[1] ^ 0x00ffff0000000000)
  686|  4.18k|        | (in[2] ^ 0x00ffffffffffffff) | (in[3] ^ 0x00ffffffffffffff);
  687|  4.18k|    two224m96p1 = (((int64_t) (two224m96p1) - 1) >> 63) & 1;
  688|  4.18k|    two225m97p2 = (in[0] ^ 2) | (in[1] ^ 0x00fffe0000000000)
  689|  4.18k|        | (in[2] ^ 0x00ffffffffffffff) | (in[3] ^ 0x01ffffffffffffff);
  690|  4.18k|    two225m97p2 = (((int64_t) (two225m97p2) - 1) >> 63) & 1;
  691|  4.18k|    return (zero | two224m96p1 | two225m97p2);
  692|  4.18k|}
ecp_nistp224.c:felem_scalar:
  469|  2.58k|{
  470|  2.58k|    out[0] *= scalar;
  471|  2.58k|    out[1] *= scalar;
  472|  2.58k|    out[2] *= scalar;
  473|  2.58k|    out[3] *= scalar;
  474|  2.58k|}
ecp_nistp224.c:felem_diff:
  395|  2.07k|{
  396|  2.07k|    static const limb two58p2 = (((limb) 1) << 58) + (((limb) 1) << 2);
  397|  2.07k|    static const limb two58m2 = (((limb) 1) << 58) - (((limb) 1) << 2);
  398|  2.07k|    static const limb two58m42m2 = (((limb) 1) << 58) -
  399|  2.07k|        (((limb) 1) << 42) - (((limb) 1) << 2);
  400|       |
  401|       |    /* Add 0 mod 2^224-2^96+1 to ensure out > in */
  402|  2.07k|    out[0] += two58p2;
  403|  2.07k|    out[1] += two58m42m2;
  404|  2.07k|    out[2] += two58m2;
  405|  2.07k|    out[3] += two58m2;
  406|       |
  407|  2.07k|    out[0] -= in[0];
  408|  2.07k|    out[1] -= in[1];
  409|  2.07k|    out[2] -= in[2];
  410|  2.07k|    out[3] -= in[3];
  411|  2.07k|}
ecp_nistp224.c:widefelem_diff:
  416|  1.55k|{
  417|  1.55k|    static const widelimb two120 = ((widelimb) 1) << 120;
  418|  1.55k|    static const widelimb two120m64 = (((widelimb) 1) << 120) -
  419|  1.55k|        (((widelimb) 1) << 64);
  420|  1.55k|    static const widelimb two120m104m64 = (((widelimb) 1) << 120) -
  421|  1.55k|        (((widelimb) 1) << 104) - (((widelimb) 1) << 64);
  422|       |
  423|       |    /* Add 0 mod 2^224-2^96+1 to ensure out > in */
  424|  1.55k|    out[0] += two120;
  425|  1.55k|    out[1] += two120m64;
  426|  1.55k|    out[2] += two120m64;
  427|  1.55k|    out[3] += two120;
  428|  1.55k|    out[4] += two120m104m64;
  429|  1.55k|    out[5] += two120m64;
  430|  1.55k|    out[6] += two120m64;
  431|       |
  432|  1.55k|    out[0] -= in[0];
  433|  1.55k|    out[1] -= in[1];
  434|  1.55k|    out[2] -= in[2];
  435|  1.55k|    out[3] -= in[3];
  436|  1.55k|    out[4] -= in[4];
  437|  1.55k|    out[5] -= in[5];
  438|  1.55k|    out[6] -= in[6];
  439|  1.55k|}
ecp_nistp224.c:copy_conditional:
  786|  6.27k|{
  787|  6.27k|    unsigned i;
  788|       |    /*
  789|       |     * icopy is a (64-bit) 0 or 1, so copy is either all-zero or all-one
  790|       |     */
  791|  6.27k|    const limb copy = -icopy;
  792|  31.3k|    for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (792:17): [True: 25.0k, False: 6.27k]
  ------------------
  793|  25.0k|        const limb tmp = copy & (in[i] ^ out[i]);
  794|  25.0k|        out[i] ^= tmp;
  795|  25.0k|    }
  796|  6.27k|}
ecp_nistp224.c:point_double:
  820|    513|{
  821|    513|    widefelem tmp, tmp2;
  822|    513|    felem delta, gamma, beta, alpha, ftmp, ftmp2;
  823|       |
  824|    513|    felem_assign(ftmp, x_in);
  825|    513|    felem_assign(ftmp2, x_in);
  826|       |
  827|       |    /* delta = z^2 */
  828|    513|    felem_square(tmp, z_in);
  829|    513|    felem_reduce(delta, tmp);
  830|       |
  831|       |    /* gamma = y^2 */
  832|    513|    felem_square(tmp, y_in);
  833|    513|    felem_reduce(gamma, tmp);
  834|       |
  835|       |    /* beta = x*gamma */
  836|    513|    felem_mul(tmp, x_in, gamma);
  837|    513|    felem_reduce(beta, tmp);
  838|       |
  839|       |    /* alpha = 3*(x-delta)*(x+delta) */
  840|    513|    felem_diff(ftmp, delta);
  841|       |    /* ftmp[i] < 2^57 + 2^58 + 2 < 2^59 */
  842|    513|    felem_sum(ftmp2, delta);
  843|       |    /* ftmp2[i] < 2^57 + 2^57 = 2^58 */
  844|    513|    felem_scalar(ftmp2, 3);
  845|       |    /* ftmp2[i] < 3 * 2^58 < 2^60 */
  846|    513|    felem_mul(tmp, ftmp, ftmp2);
  847|       |    /* tmp[i] < 2^60 * 2^59 * 4 = 2^121 */
  848|    513|    felem_reduce(alpha, tmp);
  849|       |
  850|       |    /* x' = alpha^2 - 8*beta */
  851|    513|    felem_square(tmp, alpha);
  852|       |    /* tmp[i] < 4 * 2^57 * 2^57 = 2^116 */
  853|    513|    felem_assign(ftmp, beta);
  854|    513|    felem_scalar(ftmp, 8);
  855|       |    /* ftmp[i] < 8 * 2^57 = 2^60 */
  856|    513|    felem_diff_128_64(tmp, ftmp);
  857|       |    /* tmp[i] < 2^116 + 2^64 + 8 < 2^117 */
  858|    513|    felem_reduce(x_out, tmp);
  859|       |
  860|       |    /* z' = (y + z)^2 - gamma - delta */
  861|    513|    felem_sum(delta, gamma);
  862|       |    /* delta[i] < 2^57 + 2^57 = 2^58 */
  863|    513|    felem_assign(ftmp, y_in);
  864|    513|    felem_sum(ftmp, z_in);
  865|       |    /* ftmp[i] < 2^57 + 2^57 = 2^58 */
  866|    513|    felem_square(tmp, ftmp);
  867|       |    /* tmp[i] < 4 * 2^58 * 2^58 = 2^118 */
  868|    513|    felem_diff_128_64(tmp, delta);
  869|       |    /* tmp[i] < 2^118 + 2^64 + 8 < 2^119 */
  870|    513|    felem_reduce(z_out, tmp);
  871|       |
  872|       |    /* y' = alpha*(4*beta - x') - 8*gamma^2 */
  873|    513|    felem_scalar(beta, 4);
  874|       |    /* beta[i] < 4 * 2^57 = 2^59 */
  875|    513|    felem_diff(beta, x_out);
  876|       |    /* beta[i] < 2^59 + 2^58 + 2 < 2^60 */
  877|    513|    felem_mul(tmp, alpha, beta);
  878|       |    /* tmp[i] < 4 * 2^57 * 2^60 = 2^119 */
  879|    513|    felem_square(tmp2, gamma);
  880|       |    /* tmp2[i] < 4 * 2^57 * 2^57 = 2^116 */
  881|    513|    widefelem_scalar(tmp2, 8);
  882|       |    /* tmp2[i] < 8 * 2^116 = 2^119 */
  883|    513|    widefelem_diff(tmp, tmp2);
  884|       |    /* tmp[i] < 2^119 + 2^120 < 2^121 */
  885|    513|    felem_reduce(y_out, tmp);
  886|    513|}
ecp_nistp224.c:felem_sum:
  385|  1.53k|{
  386|  1.53k|    out[0] += in[0];
  387|  1.53k|    out[1] += in[1];
  388|  1.53k|    out[2] += in[2];
  389|  1.53k|    out[3] += in[3];
  390|  1.53k|}
ecp_nistp224.c:widefelem_scalar:
  481|    513|{
  482|    513|    out[0] *= scalar;
  483|    513|    out[1] *= scalar;
  484|    513|    out[2] *= scalar;
  485|    513|    out[3] *= scalar;
  486|    513|    out[4] *= scalar;
  487|    513|    out[5] *= scalar;
  488|    513|    out[6] *= scalar;
  489|    513|}
ecp_nistp224.c:batch_mul:
 1143|     19|{
 1144|     19|    int i, skip;
 1145|     19|    unsigned num;
 1146|     19|    unsigned gen_mul = (g_scalar != NULL);
 1147|     19|    felem nq[3], tmp[4];
 1148|     19|    u64 bits;
 1149|     19|    u8 sign, digit;
 1150|       |
 1151|       |    /* set nq to the point at infinity */
 1152|     19|    memset(nq, 0, sizeof(nq));
 1153|       |
 1154|       |    /*
 1155|       |     * Loop over all scalars msb-to-lsb, interleaving additions of multiples
 1156|       |     * of the generator (two in each of the last 28 rounds) and additions of
 1157|       |     * other points multiples (every 5th round).
 1158|       |     */
 1159|     19|    skip = 1;                   /* save two point operations in the first
 1160|       |                                 * round */
 1161|    551|    for (i = (num_points ? 220 : 27); i >= 0; --i) {
  ------------------
  |  Branch (1161:15): [True: 0, False: 19]
  |  Branch (1161:39): [True: 532, False: 19]
  ------------------
 1162|       |        /* double */
 1163|    532|        if (!skip)
  ------------------
  |  Branch (1163:13): [True: 513, False: 19]
  ------------------
 1164|    513|            point_double(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2]);
 1165|       |
 1166|       |        /* add multiples of the generator */
 1167|    532|        if (gen_mul && (i <= 27)) {
  ------------------
  |  Branch (1167:13): [True: 532, False: 0]
  |  Branch (1167:24): [True: 532, False: 0]
  ------------------
 1168|       |            /* first, look 28 bits upwards */
 1169|    532|            bits = get_bit(g_scalar, i + 196) << 3;
 1170|    532|            bits |= get_bit(g_scalar, i + 140) << 2;
 1171|    532|            bits |= get_bit(g_scalar, i + 84) << 1;
 1172|    532|            bits |= get_bit(g_scalar, i + 28);
 1173|       |            /* select the point to add, in constant time */
 1174|    532|            select_point(bits, 16, g_pre_comp[1], tmp);
 1175|       |
 1176|    532|            if (!skip) {
  ------------------
  |  Branch (1176:17): [True: 513, False: 19]
  ------------------
 1177|       |                /* value 1 below is argument for "mixed" */
 1178|    513|                point_add(nq[0], nq[1], nq[2],
 1179|    513|                          nq[0], nq[1], nq[2], 1, tmp[0], tmp[1], tmp[2]);
 1180|    513|            } else {
 1181|     19|                memcpy(nq, tmp, 3 * sizeof(felem));
 1182|     19|                skip = 0;
 1183|     19|            }
 1184|       |
 1185|       |            /* second, look at the current position */
 1186|    532|            bits = get_bit(g_scalar, i + 168) << 3;
 1187|    532|            bits |= get_bit(g_scalar, i + 112) << 2;
 1188|    532|            bits |= get_bit(g_scalar, i + 56) << 1;
 1189|    532|            bits |= get_bit(g_scalar, i);
 1190|       |            /* select the point to add, in constant time */
 1191|    532|            select_point(bits, 16, g_pre_comp[0], tmp);
 1192|    532|            point_add(nq[0], nq[1], nq[2],
 1193|    532|                      nq[0], nq[1], nq[2],
 1194|    532|                      1 /* mixed */ , tmp[0], tmp[1], tmp[2]);
 1195|    532|        }
 1196|       |
 1197|       |        /* do other additions every 5 doublings */
 1198|    532|        if (num_points && (i % 5 == 0)) {
  ------------------
  |  Branch (1198:13): [True: 0, False: 532]
  |  Branch (1198:27): [True: 0, False: 0]
  ------------------
 1199|       |            /* loop over all scalars */
 1200|      0|            for (num = 0; num < num_points; ++num) {
  ------------------
  |  Branch (1200:27): [True: 0, False: 0]
  ------------------
 1201|      0|                bits = get_bit(scalars[num], i + 4) << 5;
 1202|      0|                bits |= get_bit(scalars[num], i + 3) << 4;
 1203|      0|                bits |= get_bit(scalars[num], i + 2) << 3;
 1204|      0|                bits |= get_bit(scalars[num], i + 1) << 2;
 1205|      0|                bits |= get_bit(scalars[num], i) << 1;
 1206|      0|                bits |= get_bit(scalars[num], i - 1);
 1207|      0|                ossl_ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
 1208|       |
 1209|       |                /* select the point to add or subtract */
 1210|      0|                select_point(digit, 17, pre_comp[num], tmp);
 1211|      0|                felem_neg(tmp[3], tmp[1]); /* (X, -Y, Z) is the negative
 1212|       |                                            * point */
 1213|      0|                copy_conditional(tmp[1], tmp[3], sign);
 1214|       |
 1215|      0|                if (!skip) {
  ------------------
  |  Branch (1215:21): [True: 0, False: 0]
  ------------------
 1216|      0|                    point_add(nq[0], nq[1], nq[2],
 1217|      0|                              nq[0], nq[1], nq[2],
 1218|      0|                              mixed, tmp[0], tmp[1], tmp[2]);
 1219|      0|                } else {
 1220|      0|                    memcpy(nq, tmp, 3 * sizeof(felem));
 1221|      0|                    skip = 0;
 1222|      0|                }
 1223|      0|            }
 1224|      0|        }
 1225|    532|    }
 1226|     19|    felem_assign(x_out, nq[0]);
 1227|     19|    felem_assign(y_out, nq[1]);
 1228|     19|    felem_assign(z_out, nq[2]);
 1229|     19|}
ecp_nistp224.c:get_bit:
 1125|  4.25k|{
 1126|  4.25k|    if (i >= 224)
  ------------------
  |  Branch (1126:9): [True: 0, False: 4.25k]
  ------------------
 1127|      0|        return 0;
 1128|  4.25k|    return (in[i >> 3] >> (i & 7)) & 1;
 1129|  4.25k|}
ecp_nistp224.c:select_point:
 1105|  1.06k|{
 1106|  1.06k|    unsigned i, j;
 1107|  1.06k|    limb *outlimbs = &out[0][0];
 1108|       |
 1109|  1.06k|    memset(out, 0, sizeof(*out) * 3);
 1110|  18.0k|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (1110:17): [True: 17.0k, False: 1.06k]
  ------------------
 1111|  17.0k|        const limb *inlimbs = &pre_comp[i][0][0];
 1112|  17.0k|        u64 mask = i ^ idx;
 1113|  17.0k|        mask |= mask >> 4;
 1114|  17.0k|        mask |= mask >> 2;
 1115|  17.0k|        mask |= mask >> 1;
 1116|  17.0k|        mask &= 1;
 1117|  17.0k|        mask--;
 1118|   221k|        for (j = 0; j < 4 * 3; j++)
  ------------------
  |  Branch (1118:21): [True: 204k, False: 17.0k]
  ------------------
 1119|   204k|            outlimbs[j] |= inlimbs[j] & mask;
 1120|  17.0k|    }
 1121|  1.06k|}

ossl_ec_GFp_nistp384_method:
 1464|  1.43k|{
 1465|  1.43k|    static const EC_METHOD ret = {
 1466|  1.43k|        EC_FLAGS_DEFAULT_OCT,
  ------------------
  |  |   26|  1.43k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
 1467|  1.43k|        NID_X9_62_prime_field,
  ------------------
  |  |  152|  1.43k|#define NID_X9_62_prime_field           406
  ------------------
 1468|  1.43k|        ossl_ec_GFp_nistp384_group_init,
 1469|  1.43k|        ossl_ec_GFp_simple_group_finish,
 1470|  1.43k|        ossl_ec_GFp_simple_group_clear_finish,
 1471|  1.43k|        ossl_ec_GFp_nist_group_copy,
 1472|  1.43k|        ossl_ec_GFp_nistp384_group_set_curve,
 1473|  1.43k|        ossl_ec_GFp_simple_group_get_curve,
 1474|  1.43k|        ossl_ec_GFp_simple_group_get_degree,
 1475|  1.43k|        ossl_ec_group_simple_order_bits,
 1476|  1.43k|        ossl_ec_GFp_simple_group_check_discriminant,
 1477|  1.43k|        ossl_ec_GFp_simple_point_init,
 1478|  1.43k|        ossl_ec_GFp_simple_point_finish,
 1479|  1.43k|        ossl_ec_GFp_simple_point_clear_finish,
 1480|  1.43k|        ossl_ec_GFp_simple_point_copy,
 1481|  1.43k|        ossl_ec_GFp_simple_point_set_to_infinity,
 1482|  1.43k|        ossl_ec_GFp_simple_point_set_affine_coordinates,
 1483|  1.43k|        ossl_ec_GFp_nistp384_point_get_affine_coordinates,
 1484|  1.43k|        0, /* point_set_compressed_coordinates */
 1485|  1.43k|        0, /* point2oct */
 1486|  1.43k|        0, /* oct2point */
 1487|  1.43k|        ossl_ec_GFp_simple_add,
 1488|  1.43k|        ossl_ec_GFp_simple_dbl,
 1489|  1.43k|        ossl_ec_GFp_simple_invert,
 1490|  1.43k|        ossl_ec_GFp_simple_is_at_infinity,
 1491|  1.43k|        ossl_ec_GFp_simple_is_on_curve,
 1492|  1.43k|        ossl_ec_GFp_simple_cmp,
 1493|  1.43k|        ossl_ec_GFp_simple_make_affine,
 1494|  1.43k|        ossl_ec_GFp_simple_points_make_affine,
 1495|  1.43k|        ossl_ec_GFp_nistp384_points_mul,
 1496|  1.43k|        ossl_ec_GFp_nistp384_precompute_mult,
 1497|  1.43k|        ossl_ec_GFp_nistp384_have_precompute_mult,
 1498|  1.43k|        ossl_ec_GFp_nist_field_mul,
 1499|  1.43k|        ossl_ec_GFp_nist_field_sqr,
 1500|  1.43k|        0, /* field_div */
 1501|  1.43k|        ossl_ec_GFp_simple_field_inv,
 1502|  1.43k|        0, /* field_encode */
 1503|  1.43k|        0, /* field_decode */
 1504|  1.43k|        0, /* field_set_to_one */
 1505|  1.43k|        ossl_ec_key_simple_priv2oct,
 1506|  1.43k|        ossl_ec_key_simple_oct2priv,
 1507|  1.43k|        0, /* set private */
 1508|  1.43k|        ossl_ec_key_simple_generate_key,
 1509|  1.43k|        ossl_ec_key_simple_check_key,
 1510|  1.43k|        ossl_ec_key_simple_generate_public_key,
 1511|  1.43k|        0, /* keycopy */
 1512|  1.43k|        0, /* keyfinish */
 1513|  1.43k|        ossl_ecdh_simple_compute_key,
 1514|  1.43k|        ossl_ecdsa_simple_sign_setup,
 1515|  1.43k|        ossl_ecdsa_simple_sign_sig,
 1516|  1.43k|        ossl_ecdsa_simple_verify_sig,
 1517|  1.43k|        0, /* field_inverse_mod_ord */
 1518|  1.43k|        0, /* blind_coordinates */
 1519|  1.43k|        0, /* ladder_pre */
 1520|  1.43k|        0, /* ladder_step */
 1521|  1.43k|        0  /* ladder_post */
 1522|  1.43k|    };
 1523|       |
 1524|  1.43k|    return &ret;
 1525|  1.43k|}
ossl_ec_GFp_nistp384_group_init:
 1578|  2.84k|{
 1579|  2.84k|    int ret;
 1580|       |
 1581|  2.84k|    ret = ossl_ec_GFp_simple_group_init(group);
 1582|  2.84k|    group->a_is_minus3 = 1;
 1583|  2.84k|    return ret;
 1584|  2.84k|}
ossl_ec_GFp_nistp384_group_set_curve:
 1589|  1.43k|{
 1590|  1.43k|    int ret = 0;
 1591|  1.43k|    BIGNUM *curve_p, *curve_a, *curve_b;
 1592|  1.43k|#ifndef FIPS_MODULE
 1593|  1.43k|    BN_CTX *new_ctx = NULL;
 1594|       |
 1595|  1.43k|    if (ctx == NULL)
  ------------------
  |  Branch (1595:9): [True: 0, False: 1.43k]
  ------------------
 1596|      0|        ctx = new_ctx = BN_CTX_new();
 1597|  1.43k|#endif
 1598|  1.43k|    if (ctx == NULL)
  ------------------
  |  Branch (1598:9): [True: 0, False: 1.43k]
  ------------------
 1599|      0|        return 0;
 1600|       |
 1601|  1.43k|    BN_CTX_start(ctx);
 1602|  1.43k|    curve_p = BN_CTX_get(ctx);
 1603|  1.43k|    curve_a = BN_CTX_get(ctx);
 1604|  1.43k|    curve_b = BN_CTX_get(ctx);
 1605|  1.43k|    if (curve_b == NULL)
  ------------------
  |  Branch (1605:9): [True: 0, False: 1.43k]
  ------------------
 1606|      0|        goto err;
 1607|  1.43k|    BN_bin2bn(nistp384_curve_params[0], sizeof(felem_bytearray), curve_p);
 1608|  1.43k|    BN_bin2bn(nistp384_curve_params[1], sizeof(felem_bytearray), curve_a);
 1609|  1.43k|    BN_bin2bn(nistp384_curve_params[2], sizeof(felem_bytearray), curve_b);
 1610|  1.43k|    if ((BN_cmp(curve_p, p)) || (BN_cmp(curve_a, a)) || (BN_cmp(curve_b, b))) {
  ------------------
  |  Branch (1610:9): [True: 0, False: 1.43k]
  |  Branch (1610:33): [True: 0, False: 1.43k]
  |  Branch (1610:57): [True: 0, False: 1.43k]
  ------------------
 1611|      0|        ERR_raise(ERR_LIB_EC, EC_R_WRONG_CURVE_PARAMETERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1612|      0|        goto err;
 1613|      0|    }
 1614|  1.43k|    group->field_mod_func = BN_nist_mod_384;
 1615|  1.43k|    ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
 1616|  1.43k| err:
 1617|  1.43k|    BN_CTX_end(ctx);
 1618|  1.43k|#ifndef FIPS_MODULE
 1619|  1.43k|    BN_CTX_free(new_ctx);
 1620|  1.43k|#endif
 1621|  1.43k|    return ret;
 1622|  1.43k|}
ossl_ec_GFp_nistp384_point_get_affine_coordinates:
 1632|      6|{
 1633|      6|    felem z1, z2, x_in, y_in, x_out, y_out;
 1634|      6|    widefelem tmp;
 1635|       |
 1636|      6|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (1636:9): [True: 0, False: 6]
  ------------------
 1637|      0|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1638|      0|        return 0;
 1639|      0|    }
 1640|      6|    if ((!BN_to_felem(x_in, point->X)) || (!BN_to_felem(y_in, point->Y)) ||
  ------------------
  |  Branch (1640:9): [True: 0, False: 6]
  |  Branch (1640:43): [True: 0, False: 6]
  ------------------
 1641|      6|        (!BN_to_felem(z1, point->Z)))
  ------------------
  |  Branch (1641:9): [True: 0, False: 6]
  ------------------
 1642|      0|        return 0;
 1643|      6|    felem_inv(z2, z1);
 1644|      6|    felem_square(tmp, z2);
  ------------------
  |  |  723|      6|# define felem_square felem_square_ref
  ------------------
 1645|      6|    felem_reduce(z1, tmp);
 1646|      6|    felem_mul(tmp, x_in, z1);
  ------------------
  |  |  724|      6|# define felem_mul felem_mul_ref
  ------------------
 1647|      6|    felem_reduce(x_in, tmp);
 1648|      6|    felem_contract(x_out, x_in);
 1649|      6|    if (x != NULL) {
  ------------------
  |  Branch (1649:9): [True: 6, False: 0]
  ------------------
 1650|      6|        if (!felem_to_BN(x, x_out)) {
  ------------------
  |  Branch (1650:13): [True: 0, False: 6]
  ------------------
 1651|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1652|      0|            return 0;
 1653|      0|        }
 1654|      6|    }
 1655|      6|    felem_mul(tmp, z1, z2);
  ------------------
  |  |  724|      6|# define felem_mul felem_mul_ref
  ------------------
 1656|      6|    felem_reduce(z1, tmp);
 1657|      6|    felem_mul(tmp, y_in, z1);
  ------------------
  |  |  724|      6|# define felem_mul felem_mul_ref
  ------------------
 1658|      6|    felem_reduce(y_in, tmp);
 1659|      6|    felem_contract(y_out, y_in);
 1660|      6|    if (y != NULL) {
  ------------------
  |  Branch (1660:9): [True: 6, False: 0]
  ------------------
 1661|      6|        if (!felem_to_BN(y, y_out)) {
  ------------------
  |  Branch (1661:13): [True: 0, False: 6]
  ------------------
 1662|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1663|      0|            return 0;
 1664|      0|        }
 1665|      6|    }
 1666|      6|    return 1;
 1667|      6|}
ossl_ec_GFp_nistp384_points_mul:
 1703|     15|{
 1704|     15|    int ret = 0;
 1705|     15|    int j;
 1706|     15|    int mixed = 0;
 1707|     15|    BIGNUM *x, *y, *z, *tmp_scalar;
 1708|     15|    felem_bytearray g_secret;
 1709|     15|    felem_bytearray *secrets = NULL;
 1710|     15|    felem (*pre_comp)[17][3] = NULL;
 1711|     15|    felem *tmp_felems = NULL;
 1712|     15|    unsigned int i;
 1713|     15|    int num_bytes;
 1714|     15|    int have_pre_comp = 0;
 1715|     15|    size_t num_points = num;
 1716|     15|    felem x_in, y_in, z_in, x_out, y_out, z_out;
 1717|     15|    NISTP384_PRE_COMP *pre = NULL;
 1718|     15|    felem(*g_pre_comp)[3] = NULL;
 1719|     15|    EC_POINT *generator = NULL;
 1720|     15|    const EC_POINT *p = NULL;
 1721|     15|    const BIGNUM *p_scalar = NULL;
 1722|       |
 1723|     15|    BN_CTX_start(ctx);
 1724|     15|    x = BN_CTX_get(ctx);
 1725|     15|    y = BN_CTX_get(ctx);
 1726|     15|    z = BN_CTX_get(ctx);
 1727|     15|    tmp_scalar = BN_CTX_get(ctx);
 1728|     15|    if (tmp_scalar == NULL)
  ------------------
  |  Branch (1728:9): [True: 0, False: 15]
  ------------------
 1729|      0|        goto err;
 1730|       |
 1731|     15|    if (scalar != NULL) {
  ------------------
  |  Branch (1731:9): [True: 15, False: 0]
  ------------------
 1732|     15|        pre = group->pre_comp.nistp384;
 1733|     15|        if (pre)
  ------------------
  |  Branch (1733:13): [True: 0, False: 15]
  ------------------
 1734|       |            /* we have precomputation, try to use it */
 1735|      0|            g_pre_comp = &pre->g_pre_comp[0];
 1736|     15|        else
 1737|       |            /* try to use the standard precomputation */
 1738|     15|            g_pre_comp = (felem(*)[3]) gmul;
 1739|     15|        generator = EC_POINT_new(group);
 1740|     15|        if (generator == NULL)
  ------------------
  |  Branch (1740:13): [True: 0, False: 15]
  ------------------
 1741|      0|            goto err;
 1742|       |        /* get the generator from precomputation */
 1743|     15|        if (!felem_to_BN(x, g_pre_comp[1][0]) ||
  ------------------
  |  Branch (1743:13): [True: 0, False: 15]
  ------------------
 1744|     15|            !felem_to_BN(y, g_pre_comp[1][1]) ||
  ------------------
  |  Branch (1744:13): [True: 0, False: 15]
  ------------------
 1745|     15|            !felem_to_BN(z, g_pre_comp[1][2])) {
  ------------------
  |  Branch (1745:13): [True: 0, False: 15]
  ------------------
 1746|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1747|      0|            goto err;
 1748|      0|        }
 1749|     15|        if (!ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group,
  ------------------
  |  Branch (1749:13): [True: 0, False: 15]
  ------------------
 1750|     15|                                                                generator,
 1751|     15|                                                                x, y, z, ctx))
 1752|      0|            goto err;
 1753|     15|        if (0 == EC_POINT_cmp(group, generator, group->generator, ctx))
  ------------------
  |  Branch (1753:13): [True: 15, False: 0]
  ------------------
 1754|       |            /* precomputation matches generator */
 1755|     15|            have_pre_comp = 1;
 1756|      0|        else
 1757|       |            /*
 1758|       |             * we don't have valid precomputation: treat the generator as a
 1759|       |             * random point
 1760|       |             */
 1761|      0|            num_points++;
 1762|     15|    }
 1763|       |
 1764|     15|    if (num_points > 0) {
  ------------------
  |  Branch (1764:9): [True: 0, False: 15]
  ------------------
 1765|      0|        if (num_points >= 2) {
  ------------------
  |  Branch (1765:13): [True: 0, False: 0]
  ------------------
 1766|       |            /*
 1767|       |             * unless we precompute multiples for just one point, converting
 1768|       |             * those into affine form is time well spent
 1769|       |             */
 1770|      0|            mixed = 1;
 1771|      0|        }
 1772|      0|        secrets = OPENSSL_zalloc(sizeof(*secrets) * num_points);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1773|      0|        pre_comp = OPENSSL_zalloc(sizeof(*pre_comp) * num_points);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1774|      0|        if (mixed)
  ------------------
  |  Branch (1774:13): [True: 0, False: 0]
  ------------------
 1775|      0|            tmp_felems =
 1776|      0|                OPENSSL_malloc(sizeof(*tmp_felems) * (num_points * 17 + 1));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1777|      0|        if ((secrets == NULL) || (pre_comp == NULL)
  ------------------
  |  Branch (1777:13): [True: 0, False: 0]
  |  Branch (1777:34): [True: 0, False: 0]
  ------------------
 1778|      0|            || (mixed && (tmp_felems == NULL)))
  ------------------
  |  Branch (1778:17): [True: 0, False: 0]
  |  Branch (1778:26): [True: 0, False: 0]
  ------------------
 1779|      0|            goto err;
 1780|       |
 1781|       |        /*
 1782|       |         * we treat NULL scalars as 0, and NULL points as points at infinity,
 1783|       |         * i.e., they contribute nothing to the linear combination
 1784|       |         */
 1785|      0|        for (i = 0; i < num_points; ++i) {
  ------------------
  |  Branch (1785:21): [True: 0, False: 0]
  ------------------
 1786|      0|            if (i == num) {
  ------------------
  |  Branch (1786:17): [True: 0, False: 0]
  ------------------
 1787|       |                /*
 1788|       |                 * we didn't have a valid precomputation, so we pick the
 1789|       |                 * generator
 1790|       |                 */
 1791|      0|                p = EC_GROUP_get0_generator(group);
 1792|      0|                p_scalar = scalar;
 1793|      0|            } else {
 1794|       |                /* the i^th point */
 1795|      0|                p = points[i];
 1796|      0|                p_scalar = scalars[i];
 1797|      0|            }
 1798|      0|            if (p_scalar != NULL && p != NULL) {
  ------------------
  |  Branch (1798:17): [True: 0, False: 0]
  |  Branch (1798:37): [True: 0, False: 0]
  ------------------
 1799|       |                /* reduce scalar to 0 <= scalar < 2^384 */
 1800|      0|                if ((BN_num_bits(p_scalar) > 384)
  ------------------
  |  Branch (1800:21): [True: 0, False: 0]
  ------------------
 1801|      0|                    || (BN_is_negative(p_scalar))) {
  ------------------
  |  Branch (1801:24): [True: 0, False: 0]
  ------------------
 1802|       |                    /*
 1803|       |                     * this is an unusual input, and we don't guarantee
 1804|       |                     * constant-timeness
 1805|       |                     */
 1806|      0|                    if (!BN_nnmod(tmp_scalar, p_scalar, group->order, ctx)) {
  ------------------
  |  Branch (1806:25): [True: 0, False: 0]
  ------------------
 1807|      0|                        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1808|      0|                        goto err;
 1809|      0|                    }
 1810|      0|                    num_bytes = BN_bn2lebinpad(tmp_scalar,
 1811|      0|                                               secrets[i], sizeof(secrets[i]));
 1812|      0|                } else {
 1813|      0|                    num_bytes = BN_bn2lebinpad(p_scalar,
 1814|      0|                                               secrets[i], sizeof(secrets[i]));
 1815|      0|                }
 1816|      0|                if (num_bytes < 0) {
  ------------------
  |  Branch (1816:21): [True: 0, False: 0]
  ------------------
 1817|      0|                    ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1818|      0|                    goto err;
 1819|      0|                }
 1820|       |                /* precompute multiples */
 1821|      0|                if ((!BN_to_felem(x_out, p->X)) ||
  ------------------
  |  Branch (1821:21): [True: 0, False: 0]
  ------------------
 1822|      0|                    (!BN_to_felem(y_out, p->Y)) ||
  ------------------
  |  Branch (1822:21): [True: 0, False: 0]
  ------------------
 1823|      0|                    (!BN_to_felem(z_out, p->Z)))
  ------------------
  |  Branch (1823:21): [True: 0, False: 0]
  ------------------
 1824|      0|                    goto err;
 1825|      0|                memcpy(pre_comp[i][1][0], x_out, sizeof(felem));
 1826|      0|                memcpy(pre_comp[i][1][1], y_out, sizeof(felem));
 1827|      0|                memcpy(pre_comp[i][1][2], z_out, sizeof(felem));
 1828|      0|                for (j = 2; j <= 16; ++j) {
  ------------------
  |  Branch (1828:29): [True: 0, False: 0]
  ------------------
 1829|      0|                    if (j & 1) {
  ------------------
  |  Branch (1829:25): [True: 0, False: 0]
  ------------------
 1830|      0|                        point_add(pre_comp[i][j][0],     pre_comp[i][j][1],     pre_comp[i][j][2],
 1831|      0|                                  pre_comp[i][1][0],     pre_comp[i][1][1],     pre_comp[i][1][2], 0,
 1832|      0|                                  pre_comp[i][j - 1][0], pre_comp[i][j - 1][1], pre_comp[i][j - 1][2]);
 1833|      0|                    } else {
 1834|      0|                        point_double(pre_comp[i][j][0],     pre_comp[i][j][1],     pre_comp[i][j][2],
 1835|      0|                                     pre_comp[i][j / 2][0], pre_comp[i][j / 2][1], pre_comp[i][j / 2][2]);
 1836|      0|                    }
 1837|      0|                }
 1838|      0|            }
 1839|      0|        }
 1840|      0|        if (mixed)
  ------------------
  |  Branch (1840:13): [True: 0, False: 0]
  ------------------
 1841|      0|            make_points_affine(num_points * 17, pre_comp[0], tmp_felems);
 1842|      0|    }
 1843|       |
 1844|       |    /* the scalar for the generator */
 1845|     15|    if (scalar != NULL && have_pre_comp) {
  ------------------
  |  Branch (1845:9): [True: 15, False: 0]
  |  Branch (1845:27): [True: 15, False: 0]
  ------------------
 1846|     15|        memset(g_secret, 0, sizeof(g_secret));
 1847|       |        /* reduce scalar to 0 <= scalar < 2^384 */
 1848|     15|        if ((BN_num_bits(scalar) > 384) || (BN_is_negative(scalar))) {
  ------------------
  |  Branch (1848:13): [True: 6, False: 9]
  |  Branch (1848:44): [True: 0, False: 9]
  ------------------
 1849|       |            /*
 1850|       |             * this is an unusual input, and we don't guarantee
 1851|       |             * constant-timeness
 1852|       |             */
 1853|      6|            if (!BN_nnmod(tmp_scalar, scalar, group->order, ctx)) {
  ------------------
  |  Branch (1853:17): [True: 0, False: 6]
  ------------------
 1854|      0|                ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1855|      0|                goto err;
 1856|      0|            }
 1857|      6|            num_bytes = BN_bn2lebinpad(tmp_scalar, g_secret, sizeof(g_secret));
 1858|      9|        } else {
 1859|      9|            num_bytes = BN_bn2lebinpad(scalar, g_secret, sizeof(g_secret));
 1860|      9|        }
 1861|       |        /* do the multiplication with generator precomputation */
 1862|     15|        batch_mul(x_out, y_out, z_out,
 1863|     15|                  (const felem_bytearray(*))secrets, num_points,
 1864|     15|                  g_secret,
 1865|     15|                  mixed, (const felem(*)[17][3])pre_comp,
 1866|     15|                  (const felem(*)[3])g_pre_comp);
 1867|     15|    } else {
 1868|       |        /* do the multiplication without generator precomputation */
 1869|      0|        batch_mul(x_out, y_out, z_out,
 1870|      0|                  (const felem_bytearray(*))secrets, num_points,
 1871|      0|                  NULL, mixed, (const felem(*)[17][3])pre_comp, NULL);
 1872|      0|    }
 1873|       |    /* reduce the output to its unique minimal representation */
 1874|     15|    felem_contract(x_in, x_out);
 1875|     15|    felem_contract(y_in, y_out);
 1876|     15|    felem_contract(z_in, z_out);
 1877|     15|    if ((!felem_to_BN(x, x_in)) || (!felem_to_BN(y, y_in)) ||
  ------------------
  |  Branch (1877:9): [True: 0, False: 15]
  |  Branch (1877:36): [True: 0, False: 15]
  ------------------
 1878|     15|        (!felem_to_BN(z, z_in))) {
  ------------------
  |  Branch (1878:9): [True: 0, False: 15]
  ------------------
 1879|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1880|      0|        goto err;
 1881|      0|    }
 1882|     15|    ret = ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, r, x, y, z,
 1883|     15|                                                             ctx);
 1884|       |
 1885|     15| err:
 1886|     15|    BN_CTX_end(ctx);
 1887|     15|    EC_POINT_free(generator);
 1888|     15|    OPENSSL_free(secrets);
  ------------------
  |  |  107|     15|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     15|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     15|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1889|     15|    OPENSSL_free(pre_comp);
  ------------------
  |  |  107|     15|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     15|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     15|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1890|     15|    OPENSSL_free(tmp_felems);
  ------------------
  |  |  107|     15|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     15|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     15|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1891|     15|    return ret;
 1892|     15|}
ecp_nistp384.c:BN_to_felem:
  142|     18|{
  143|     18|    felem_bytearray b_out;
  144|     18|    int num_bytes;
  145|       |
  146|     18|    if (BN_is_negative(bn)) {
  ------------------
  |  Branch (146:9): [True: 0, False: 18]
  ------------------
  147|      0|        ERR_raise(ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  148|      0|        return 0;
  149|      0|    }
  150|     18|    num_bytes = BN_bn2lebinpad(bn, b_out, sizeof(b_out));
  151|     18|    if (num_bytes < 0) {
  ------------------
  |  Branch (151:9): [True: 0, False: 18]
  ------------------
  152|      0|        ERR_raise(ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  153|      0|        return 0;
  154|      0|    }
  155|     18|    bin48_to_felem(out, b_out);
  156|     18|    return 1;
  157|     18|}
ecp_nistp384.c:bin48_to_felem:
  117|     18|{
  118|     18|    memset(out, 0, 56);
  119|     18|    out[0] = (*((limb *) & in[0])) & bottom56bits;
  120|     18|    out[1] = (*((limb_aX *) & in[7])) & bottom56bits;
  121|     18|    out[2] = (*((limb_aX *) & in[14])) & bottom56bits;
  122|     18|    out[3] = (*((limb_aX *) & in[21])) & bottom56bits;
  123|     18|    out[4] = (*((limb_aX *) & in[28])) & bottom56bits;
  124|     18|    out[5] = (*((limb_aX *) & in[35])) & bottom56bits;
  125|     18|    memmove(&out[6], &in[42], 6);
  126|     18|}
ecp_nistp384.c:felem_inv:
  752|      6|{
  753|      6|    felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, ftmp6;
  754|      6|    unsigned int i = 0;
  755|       |
  756|      6|    felem_square_reduce(ftmp, in);      /* 2^1 */
  757|      6|    felem_mul_reduce(ftmp, ftmp, in);   /* 2^1 + 2^0 */
  758|      6|    felem_assign(ftmp2, ftmp);
  759|       |
  760|      6|    felem_square_reduce(ftmp, ftmp);    /* 2^2 + 2^1 */
  761|      6|    felem_mul_reduce(ftmp, ftmp, in);   /* 2^2 + 2^1 * 2^0 */
  762|      6|    felem_assign(ftmp3, ftmp);
  763|       |
  764|     24|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (764:17): [True: 18, False: 6]
  ------------------
  765|     18|        felem_square_reduce(ftmp, ftmp); /* 2^5 + 2^4 + 2^3 */
  766|      6|    felem_mul_reduce(ftmp, ftmp3, ftmp); /* 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 2^0 */
  767|      6|    felem_assign(ftmp4, ftmp);
  768|       |
  769|     42|    for (i = 0; i < 6; i++)
  ------------------
  |  Branch (769:17): [True: 36, False: 6]
  ------------------
  770|     36|        felem_square_reduce(ftmp, ftmp); /* 2^11 + ... + 2^6 */
  771|      6|    felem_mul_reduce(ftmp, ftmp4, ftmp); /* 2^11 + ... + 2^0 */
  772|       |
  773|     24|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (773:17): [True: 18, False: 6]
  ------------------
  774|     18|        felem_square_reduce(ftmp, ftmp); /* 2^14 + ... + 2^3 */
  775|      6|    felem_mul_reduce(ftmp, ftmp3, ftmp); /* 2^14 + ... + 2^0 */
  776|      6|    felem_assign(ftmp5, ftmp);
  777|       |
  778|     96|    for (i = 0; i < 15; i++)
  ------------------
  |  Branch (778:17): [True: 90, False: 6]
  ------------------
  779|     90|        felem_square_reduce(ftmp, ftmp); /* 2^29 + ... + 2^15 */
  780|      6|    felem_mul_reduce(ftmp, ftmp5, ftmp); /* 2^29 + ... + 2^0 */
  781|      6|    felem_assign(ftmp6, ftmp);
  782|       |
  783|    186|    for (i = 0; i < 30; i++)
  ------------------
  |  Branch (783:17): [True: 180, False: 6]
  ------------------
  784|    180|        felem_square_reduce(ftmp, ftmp); /* 2^59 + ... + 2^30 */
  785|      6|    felem_mul_reduce(ftmp, ftmp6, ftmp); /* 2^59 + ... + 2^0 */
  786|      6|    felem_assign(ftmp4, ftmp);
  787|       |
  788|    366|    for (i = 0; i < 60; i++)
  ------------------
  |  Branch (788:17): [True: 360, False: 6]
  ------------------
  789|    360|        felem_square_reduce(ftmp, ftmp); /* 2^119 + ... + 2^60 */
  790|      6|    felem_mul_reduce(ftmp, ftmp4, ftmp); /* 2^119 + ... + 2^0 */
  791|      6|    felem_assign(ftmp4, ftmp);
  792|       |
  793|    726|    for (i = 0; i < 120; i++)
  ------------------
  |  Branch (793:17): [True: 720, False: 6]
  ------------------
  794|    720|      felem_square_reduce(ftmp, ftmp);   /* 2^239 + ... + 2^120 */
  795|      6|    felem_mul_reduce(ftmp, ftmp4, ftmp); /* 2^239 + ... + 2^0 */
  796|       |
  797|     96|    for (i = 0; i < 15; i++)
  ------------------
  |  Branch (797:17): [True: 90, False: 6]
  ------------------
  798|     90|        felem_square_reduce(ftmp, ftmp); /* 2^254 + ... + 2^15 */
  799|      6|    felem_mul_reduce(ftmp, ftmp5, ftmp); /* 2^254 + ... + 2^0 */
  800|       |
  801|    192|    for (i = 0; i < 31; i++)
  ------------------
  |  Branch (801:17): [True: 186, False: 6]
  ------------------
  802|    186|        felem_square_reduce(ftmp, ftmp); /* 2^285 + ... + 2^31 */
  803|      6|    felem_mul_reduce(ftmp, ftmp6, ftmp); /* 2^285 + ... + 2^31 + 2^29 + ... + 2^0 */
  804|       |
  805|     18|    for (i = 0; i < 2; i++)
  ------------------
  |  Branch (805:17): [True: 12, False: 6]
  ------------------
  806|     12|        felem_square_reduce(ftmp, ftmp); /* 2^287 + ... + 2^33 + 2^31 + ... + 2^2 */
  807|      6|    felem_mul_reduce(ftmp, ftmp2, ftmp); /* 2^287 + ... + 2^33 + 2^31 + ... + 2^0 */
  808|       |
  809|    570|    for (i = 0; i < 94; i++)
  ------------------
  |  Branch (809:17): [True: 564, False: 6]
  ------------------
  810|    564|        felem_square_reduce(ftmp, ftmp); /* 2^381 + ... + 2^127 + 2^125 + ... + 2^94 */
  811|      6|    felem_mul_reduce(ftmp, ftmp6, ftmp); /* 2^381 + ... + 2^127 + 2^125 + ... + 2^94 + 2^29 + ... + 2^0 */
  812|       |
  813|     18|    for (i = 0; i < 2; i++)
  ------------------
  |  Branch (813:17): [True: 12, False: 6]
  ------------------
  814|     12|        felem_square_reduce(ftmp, ftmp); /* 2^383 + ... + 2^129 + 2^127 + ... + 2^96 + 2^31 + ... + 2^2 */
  815|      6|    felem_mul_reduce(ftmp, in, ftmp);    /* 2^383 + ... + 2^129 + 2^127 + ... + 2^96 + 2^31 + ... + 2^2 + 2^0 */
  816|       |
  817|      6|    memcpy(out, ftmp, sizeof(felem));
  818|      6|}
ecp_nistp384.c:felem_square_reduce:
  728|  8.17k|{
  729|  8.17k|    widefelem tmp;
  730|       |
  731|  8.17k|    felem_square(tmp, in);
  ------------------
  |  |  723|  8.17k|# define felem_square felem_square_ref
  ------------------
  732|  8.17k|    felem_reduce(out, tmp);
  733|  8.17k|}
ecp_nistp384.c:felem_mul_reduce:
  736|  8.90k|{
  737|  8.90k|    widefelem tmp;
  738|       |
  739|  8.90k|    felem_mul(tmp, in1, in2);
  ------------------
  |  |  724|  8.90k|# define felem_mul felem_mul_ref
  ------------------
  740|  8.90k|    felem_reduce(out, tmp);
  741|  8.90k|}
ecp_nistp384.c:felem_assign:
  180|  16.2k|{
  181|  16.2k|    memcpy(out, in, sizeof(felem));
  182|  16.2k|}
ecp_nistp384.c:felem_square_ref:
  374|  14.0k|{
  375|  14.0k|    felem inx2;
  376|  14.0k|    felem_scalar(inx2, in, 2);
  377|       |
  378|  14.0k|    out[0] = ((uint128_t) in[0]) * in[0];
  379|       |
  380|  14.0k|    out[1] = ((uint128_t) in[0]) * inx2[1];
  381|       |
  382|  14.0k|    out[2] = ((uint128_t) in[0]) * inx2[2]
  383|  14.0k|           + ((uint128_t) in[1]) * in[1];
  384|       |
  385|  14.0k|    out[3] = ((uint128_t) in[0]) * inx2[3]
  386|  14.0k|           + ((uint128_t) in[1]) * inx2[2];
  387|       |
  388|  14.0k|    out[4] = ((uint128_t) in[0]) * inx2[4]
  389|  14.0k|           + ((uint128_t) in[1]) * inx2[3]
  390|  14.0k|           + ((uint128_t) in[2]) * in[2];
  391|       |
  392|  14.0k|    out[5] = ((uint128_t) in[0]) * inx2[5]
  393|  14.0k|           + ((uint128_t) in[1]) * inx2[4]
  394|  14.0k|           + ((uint128_t) in[2]) * inx2[3];
  395|       |
  396|  14.0k|    out[6] = ((uint128_t) in[0]) * inx2[6]
  397|  14.0k|           + ((uint128_t) in[1]) * inx2[5]
  398|  14.0k|           + ((uint128_t) in[2]) * inx2[4]
  399|  14.0k|           + ((uint128_t) in[3]) * in[3];
  400|       |
  401|  14.0k|    out[7] = ((uint128_t) in[1]) * inx2[6]
  402|  14.0k|           + ((uint128_t) in[2]) * inx2[5]
  403|  14.0k|           + ((uint128_t) in[3]) * inx2[4];
  404|       |
  405|  14.0k|    out[8] = ((uint128_t) in[2]) * inx2[6]
  406|  14.0k|           + ((uint128_t) in[3]) * inx2[5]
  407|  14.0k|           + ((uint128_t) in[4]) * in[4];
  408|       |
  409|  14.0k|    out[9] = ((uint128_t) in[3]) * inx2[6]
  410|  14.0k|           + ((uint128_t) in[4]) * inx2[5];
  411|       |
  412|  14.0k|    out[10] = ((uint128_t) in[4]) * inx2[6]
  413|  14.0k|            + ((uint128_t) in[5]) * in[5];
  414|       |
  415|  14.0k|    out[11] = ((uint128_t) in[5]) * inx2[6];
  416|       |
  417|  14.0k|    out[12] = ((uint128_t) in[6]) * in[6];
  418|  14.0k|}
ecp_nistp384.c:felem_scalar:
  195|  15.5k|{
  196|  15.5k|    unsigned int i;
  197|       |
  198|   124k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |  105|   124k|#define NLIMBS 7
  ------------------
  |  Branch (198:17): [True: 108k, False: 15.5k]
  ------------------
  199|   108k|        out[i] = in[i] * scalar;
  200|  15.5k|}
ecp_nistp384.c:felem_reduce:
  507|  27.3k|{
  508|       |    /*
  509|       |     * In order to prevent underflow, we add a multiple of p before subtracting.
  510|       |     * Use telescopic sums to represent 2^76 * p redundantly with each limb
  511|       |     * of the form 2^124 + ...
  512|       |     */
  513|  27.3k|    static const widelimb two124m68 = (((widelimb) 1) << 124)
  514|  27.3k|                                    - (((widelimb) 1) << 68);
  515|  27.3k|    static const widelimb two124m116m68 = (((widelimb) 1) << 124)
  516|  27.3k|                                        - (((widelimb) 1) << 116)
  517|  27.3k|                                        - (((widelimb) 1) << 68);
  518|  27.3k|    static const widelimb two124p108m76 = (((widelimb) 1) << 124)
  519|  27.3k|                                        + (((widelimb) 1) << 108)
  520|  27.3k|                                        - (((widelimb) 1) << 76);
  521|  27.3k|    static const widelimb two124m92m68 = (((widelimb) 1) << 124)
  522|  27.3k|                                       - (((widelimb) 1) << 92)
  523|  27.3k|                                       - (((widelimb) 1) << 68);
  524|  27.3k|    widelimb temp, acc[9];
  525|  27.3k|    unsigned int i;
  526|       |
  527|  27.3k|    memcpy(acc, in, sizeof(widelimb) * 9);
  528|       |
  529|  27.3k|    acc[0] += two124p108m76;
  530|  27.3k|    acc[1] += two124m116m68;
  531|  27.3k|    acc[2] += two124m92m68;
  532|  27.3k|    acc[3] += two124m68;
  533|  27.3k|    acc[4] += two124m68;
  534|  27.3k|    acc[5] += two124m68;
  535|  27.3k|    acc[6] += two124m68;
  536|       |
  537|       |    /* [1]: Eliminate in[9], ..., in[12] */
  538|  27.3k|    acc[8] += in[12] >> 32;
  539|  27.3k|    acc[7] += (in[12] & 0xffffffff) << 24;
  540|  27.3k|    acc[7] += in[12] >> 8;
  541|  27.3k|    acc[6] += (in[12] & 0xff) << 48;
  542|  27.3k|    acc[6] -= in[12] >> 16;
  543|  27.3k|    acc[5] -= (in[12] & 0xffff) << 40;
  544|  27.3k|    acc[6] += in[12] >> 48;
  545|  27.3k|    acc[5] += (in[12] & 0xffffffffffff) << 8;
  546|       |
  547|  27.3k|    acc[7] += in[11] >> 32;
  548|  27.3k|    acc[6] += (in[11] & 0xffffffff) << 24;
  549|  27.3k|    acc[6] += in[11] >> 8;
  550|  27.3k|    acc[5] += (in[11] & 0xff) << 48;
  551|  27.3k|    acc[5] -= in[11] >> 16;
  552|  27.3k|    acc[4] -= (in[11] & 0xffff) << 40;
  553|  27.3k|    acc[5] += in[11] >> 48;
  554|  27.3k|    acc[4] += (in[11] & 0xffffffffffff) << 8;
  555|       |
  556|  27.3k|    acc[6] += in[10] >> 32;
  557|  27.3k|    acc[5] += (in[10] & 0xffffffff) << 24;
  558|  27.3k|    acc[5] += in[10] >> 8;
  559|  27.3k|    acc[4] += (in[10] & 0xff) << 48;
  560|  27.3k|    acc[4] -= in[10] >> 16;
  561|  27.3k|    acc[3] -= (in[10] & 0xffff) << 40;
  562|  27.3k|    acc[4] += in[10] >> 48;
  563|  27.3k|    acc[3] += (in[10] & 0xffffffffffff) << 8;
  564|       |
  565|  27.3k|    acc[5] += in[9] >> 32;
  566|  27.3k|    acc[4] += (in[9] & 0xffffffff) << 24;
  567|  27.3k|    acc[4] += in[9] >> 8;
  568|  27.3k|    acc[3] += (in[9] & 0xff) << 48;
  569|  27.3k|    acc[3] -= in[9] >> 16;
  570|  27.3k|    acc[2] -= (in[9] & 0xffff) << 40;
  571|  27.3k|    acc[3] += in[9] >> 48;
  572|  27.3k|    acc[2] += (in[9] & 0xffffffffffff) << 8;
  573|       |
  574|       |    /*
  575|       |     * [2]: Eliminate acc[7], acc[8], that is the 7 and eighth limbs, as
  576|       |     * well as the contributions made from eliminating higher limbs.
  577|       |     * acc[7] < in[7] + 2^120 + 2^56 < in[7] + 2^121
  578|       |     * acc[8] < in[8] + 2^96
  579|       |     */
  580|  27.3k|    acc[4] += acc[8] >> 32;
  581|  27.3k|    acc[3] += (acc[8] & 0xffffffff) << 24;
  582|  27.3k|    acc[3] += acc[8] >> 8;
  583|  27.3k|    acc[2] += (acc[8] & 0xff) << 48;
  584|  27.3k|    acc[2] -= acc[8] >> 16;
  585|  27.3k|    acc[1] -= (acc[8] & 0xffff) << 40;
  586|  27.3k|    acc[2] += acc[8] >> 48;
  587|  27.3k|    acc[1] += (acc[8] & 0xffffffffffff) << 8;
  588|       |
  589|  27.3k|    acc[3] += acc[7] >> 32;
  590|  27.3k|    acc[2] += (acc[7] & 0xffffffff) << 24;
  591|  27.3k|    acc[2] += acc[7] >> 8;
  592|  27.3k|    acc[1] += (acc[7] & 0xff) << 48;
  593|  27.3k|    acc[1] -= acc[7] >> 16;
  594|  27.3k|    acc[0] -= (acc[7] & 0xffff) << 40;
  595|  27.3k|    acc[1] += acc[7] >> 48;
  596|  27.3k|    acc[0] += (acc[7] & 0xffffffffffff) << 8;
  597|       |
  598|       |    /*-
  599|       |     * acc[k] < in[k] + 2^124 + 2^121 
  600|       |     *        < in[k] + 2^125
  601|       |     *        < 2^128, for k <= 6
  602|       |     */
  603|       |
  604|       |    /*
  605|       |     * Carry 4 -> 5 -> 6
  606|       |     * This has the effect of ensuring that these more significant limbs
  607|       |     * will be small in value after eliminating high bits from acc[6].
  608|       |     */
  609|  27.3k|    acc[5] += acc[4] >> 56;
  610|  27.3k|    acc[4] &= 0x00ffffffffffffff;
  611|       |
  612|  27.3k|    acc[6] += acc[5] >> 56;
  613|  27.3k|    acc[5] &= 0x00ffffffffffffff;
  614|       |
  615|       |    /*-
  616|       |     * acc[6] < in[6] + 2^124 + 2^121 + 2^72 + 2^16
  617|       |     *        < in[6] + 2^125
  618|       |     *        < 2^128
  619|       |     */
  620|       |
  621|       |    /* [3]: Eliminate high bits of acc[6] */
  622|  27.3k|    temp = acc[6] >> 48;
  623|  27.3k|    acc[6] &= 0x0000ffffffffffff;
  624|       |    
  625|       |    /* temp < 2^80 */
  626|       |
  627|  27.3k|    acc[3] += temp >> 40;
  628|  27.3k|    acc[2] += (temp & 0xffffffffff) << 16;
  629|  27.3k|    acc[2] += temp >> 16;
  630|  27.3k|    acc[1] += (temp & 0xffff) << 40;
  631|  27.3k|    acc[1] -= temp >> 24;
  632|  27.3k|    acc[0] -= (temp & 0xffffff) << 32;
  633|  27.3k|    acc[0] += temp;
  634|       |
  635|       |    /*-
  636|       |     * acc[k] < acc_old[k] + 2^64 + 2^56
  637|       |     *        < in[k] + 2^124 + 2^121 + 2^72 + 2^64 + 2^56 + 2^16 , k < 4
  638|       |     */
  639|       |
  640|       |    /* Carry 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 */
  641|  27.3k|    acc[1] += acc[0] >> 56;   /* acc[1] < acc_old[1] + 2^72 */
  642|  27.3k|    acc[0] &= 0x00ffffffffffffff;
  643|       |
  644|  27.3k|    acc[2] += acc[1] >> 56;   /* acc[2] < acc_old[2] + 2^72 + 2^16 */
  645|  27.3k|    acc[1] &= 0x00ffffffffffffff;
  646|       |
  647|  27.3k|    acc[3] += acc[2] >> 56;   /* acc[3] < acc_old[3] + 2^72 + 2^16 */
  648|  27.3k|    acc[2] &= 0x00ffffffffffffff;
  649|       |
  650|       |    /*-
  651|       |     * acc[k] < acc_old[k] + 2^72 + 2^16
  652|       |     *        < in[k] + 2^124 + 2^121 + 2^73 + 2^64 + 2^56 + 2^17
  653|       |     *        < in[k] + 2^125
  654|       |     *        < 2^128 , k < 4
  655|       |     */
  656|       |
  657|  27.3k|    acc[4] += acc[3] >> 56;   /*-
  658|       |                               * acc[4] < acc_old[4] + 2^72 + 2^16
  659|       |                               *        < 2^72 + 2^56 + 2^16
  660|       |                               */
  661|  27.3k|    acc[3] &= 0x00ffffffffffffff;
  662|       |
  663|  27.3k|    acc[5] += acc[4] >> 56;   /*-
  664|       |                               * acc[5] < acc_old[5] + 2^16 + 1
  665|       |                               *        < 2^56 + 2^16 + 1
  666|       |                               */
  667|  27.3k|    acc[4] &= 0x00ffffffffffffff;
  668|       |
  669|  27.3k|    acc[6] += acc[5] >> 56;   /* acc[6] < 2^48 + 1 <= 2^48 */
  670|  27.3k|    acc[5] &= 0x00ffffffffffffff;
  671|       |
  672|   219k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |  105|   219k|#define NLIMBS 7
  ------------------
  |  Branch (672:17): [True: 191k, False: 27.3k]
  ------------------
  673|   191k|        out[i] = acc[i];
  674|  27.3k|}
ecp_nistp384.c:felem_mul_ref:
  421|  16.2k|{
  422|  16.2k|    out[0] = ((uint128_t) in1[0]) * in2[0];
  423|       |
  424|  16.2k|    out[1] = ((uint128_t) in1[0]) * in2[1]
  425|  16.2k|           + ((uint128_t) in1[1]) * in2[0];
  426|       |
  427|  16.2k|    out[2] = ((uint128_t) in1[0]) * in2[2]
  428|  16.2k|           + ((uint128_t) in1[1]) * in2[1]
  429|  16.2k|           + ((uint128_t) in1[2]) * in2[0];
  430|       |
  431|  16.2k|    out[3] = ((uint128_t) in1[0]) * in2[3]
  432|  16.2k|           + ((uint128_t) in1[1]) * in2[2]
  433|  16.2k|           + ((uint128_t) in1[2]) * in2[1]
  434|  16.2k|           + ((uint128_t) in1[3]) * in2[0];
  435|       |
  436|  16.2k|    out[4] = ((uint128_t) in1[0]) * in2[4]
  437|  16.2k|           + ((uint128_t) in1[1]) * in2[3]
  438|  16.2k|           + ((uint128_t) in1[2]) * in2[2]
  439|  16.2k|           + ((uint128_t) in1[3]) * in2[1]
  440|  16.2k|           + ((uint128_t) in1[4]) * in2[0];
  441|       |
  442|  16.2k|    out[5] = ((uint128_t) in1[0]) * in2[5]
  443|  16.2k|           + ((uint128_t) in1[1]) * in2[4]
  444|  16.2k|           + ((uint128_t) in1[2]) * in2[3]
  445|  16.2k|           + ((uint128_t) in1[3]) * in2[2]
  446|  16.2k|           + ((uint128_t) in1[4]) * in2[1]
  447|  16.2k|           + ((uint128_t) in1[5]) * in2[0];
  448|       |
  449|  16.2k|    out[6] = ((uint128_t) in1[0]) * in2[6]
  450|  16.2k|           + ((uint128_t) in1[1]) * in2[5]
  451|  16.2k|           + ((uint128_t) in1[2]) * in2[4]
  452|  16.2k|           + ((uint128_t) in1[3]) * in2[3]
  453|  16.2k|           + ((uint128_t) in1[4]) * in2[2]
  454|  16.2k|           + ((uint128_t) in1[5]) * in2[1]
  455|  16.2k|           + ((uint128_t) in1[6]) * in2[0];
  456|       |
  457|  16.2k|    out[7] = ((uint128_t) in1[1]) * in2[6]
  458|  16.2k|           + ((uint128_t) in1[2]) * in2[5]
  459|  16.2k|           + ((uint128_t) in1[3]) * in2[4]
  460|  16.2k|           + ((uint128_t) in1[4]) * in2[3]
  461|  16.2k|           + ((uint128_t) in1[5]) * in2[2]
  462|  16.2k|           + ((uint128_t) in1[6]) * in2[1];
  463|       |
  464|  16.2k|    out[8] = ((uint128_t) in1[2]) * in2[6]
  465|  16.2k|           + ((uint128_t) in1[3]) * in2[5]
  466|  16.2k|           + ((uint128_t) in1[4]) * in2[4]
  467|  16.2k|           + ((uint128_t) in1[5]) * in2[3]
  468|  16.2k|           + ((uint128_t) in1[6]) * in2[2];
  469|       |
  470|  16.2k|    out[9] = ((uint128_t) in1[3]) * in2[6]
  471|  16.2k|           + ((uint128_t) in1[4]) * in2[5]
  472|  16.2k|           + ((uint128_t) in1[5]) * in2[4]
  473|  16.2k|           + ((uint128_t) in1[6]) * in2[3];
  474|       |
  475|  16.2k|    out[10] = ((uint128_t) in1[4]) * in2[6]
  476|  16.2k|            + ((uint128_t) in1[5]) * in2[5]
  477|  16.2k|            + ((uint128_t) in1[6]) * in2[4];
  478|       |
  479|  16.2k|    out[11] = ((uint128_t) in1[5]) * in2[6]
  480|  16.2k|            + ((uint128_t) in1[6]) * in2[5];
  481|       |
  482|  16.2k|    out[12] = ((uint128_t) in1[6]) * in2[6];
  483|  16.2k|}
ecp_nistp384.c:felem_contract:
  856|     57|{
  857|     57|    static const int64_t two56 = ((limb) 1) << 56;
  858|       |
  859|       |    /*
  860|       |     * We know for a fact that 0 <= |in| < 2*p, for p = 2^384 - 2^128 - 2^96 + 2^32 - 1
  861|       |     * Perform two successive, idempotent subtractions to reduce if |in| >= p.
  862|       |     */
  863|       |
  864|     57|    int64_t tmp[NLIMBS], cond[5], a;
  865|     57|    unsigned int i;
  866|       |
  867|     57|    memcpy(tmp, in, sizeof(felem));
  868|       | 
  869|       |    /* Case 1: a = 1 iff |in| >= 2^384 */
  870|     57|    a = (in[6] >> 48);
  871|     57|    tmp[0] += a;
  872|     57|    tmp[0] -= a << 32;
  873|     57|    tmp[1] += a << 40;
  874|     57|    tmp[2] += a << 16;
  875|     57|    tmp[6] &= 0x0000ffffffffffff;
  876|       |
  877|       |    /*
  878|       |     * eliminate negative coefficients: if tmp[0] is negative, tmp[1] must be
  879|       |     * non-zero, so we only need one step
  880|       |     */
  881|       |
  882|     57|    a = tmp[0] >> 63;
  883|     57|    tmp[0] += a & two56;
  884|     57|    tmp[1] -= a & 1;
  885|       |
  886|       |    /* Carry 1 -> 2 -> 3 -> 4 -> 5 -> 6 */
  887|     57|    tmp[2] += tmp[1] >> 56;
  888|     57|    tmp[1] &= 0x00ffffffffffffff;
  889|       |
  890|     57|    tmp[3] += tmp[2] >> 56;
  891|     57|    tmp[2] &= 0x00ffffffffffffff;
  892|       |
  893|     57|    tmp[4] += tmp[3] >> 56;
  894|     57|    tmp[3] &= 0x00ffffffffffffff;
  895|       |
  896|     57|    tmp[5] += tmp[4] >> 56;
  897|     57|    tmp[4] &= 0x00ffffffffffffff;
  898|       |
  899|     57|    tmp[6] += tmp[5] >> 56; /* tmp[6] < 2^48 */
  900|     57|    tmp[5] &= 0x00ffffffffffffff;
  901|       |
  902|       |    /*
  903|       |     * Case 2: a = all ones if p <= |in| < 2^384, 0 otherwise
  904|       |     */
  905|       |
  906|       |    /* 0 iff (2^129..2^383) are all one */
  907|     57|    cond[0] = ((tmp[6] | 0xff000000000000) & tmp[5] & tmp[4] & tmp[3] & (tmp[2] | 0x0000000001ffff)) + 1;
  908|       |    /* 0 iff 2^128 bit is one */
  909|     57|    cond[1] = (tmp[2] | ~0x00000000010000) + 1;
  910|       |    /* 0 iff (2^96..2^127) bits are all one */
  911|     57|    cond[2] = ((tmp[2] | 0xffffffffff0000) & (tmp[1] | 0x0000ffffffffff)) + 1;
  912|       |    /* 0 iff (2^32..2^95) bits are all zero */
  913|     57|    cond[3] = (tmp[1] & ~0xffff0000000000) | (tmp[0] & ~((int64_t) 0x000000ffffffff));
  914|       |    /* 0 iff (2^0..2^31) bits are all one */
  915|     57|    cond[4] = (tmp[0] | 0xffffff00000000) + 1;
  916|       |
  917|       |    /*
  918|       |     * In effect, invert our conditions, so that 0 values become all 1's,
  919|       |     * any non-zero value in the low-order 56 bits becomes all 0's
  920|       |     */
  921|    342|    for (i = 0; i < 5; i++)
  ------------------
  |  Branch (921:17): [True: 285, False: 57]
  ------------------
  922|    285|       cond[i] = ((cond[i] & 0x00ffffffffffffff) - 1) >> 63;
  923|       |
  924|       |    /*
  925|       |     * The condition for determining whether in is greater than our
  926|       |     * prime is given by the following condition.
  927|       |     */
  928|       |
  929|       |    /* First subtract 2^384 - 2^129 cheaply */
  930|     57|    a = cond[0] & (cond[1] | (cond[2] & (~cond[3] | cond[4])));
  931|     57|    tmp[6] &= ~a;
  932|     57|    tmp[5] &= ~a;
  933|     57|    tmp[4] &= ~a;
  934|     57|    tmp[3] &= ~a;
  935|     57|    tmp[2] &= ~a | 0x0000000001ffff;
  936|       |
  937|       |    /*
  938|       |     * Subtract 2^128 - 2^96 by
  939|       |     * means of disjoint cases.
  940|       |     */
  941|       |
  942|       |    /* subtract 2^128 if that bit is present, and add 2^96 */
  943|     57|    a = cond[0] & cond[1];
  944|     57|    tmp[2] &= ~a | 0xfffffffffeffff;
  945|     57|    tmp[1] += a & ((int64_t) 1 << 40);
  946|       |
  947|       |    /* otherwise, clear bits 2^127 .. 2^96  */
  948|     57|    a = cond[0] & ~cond[1] & (cond[2] & (~cond[3] | cond[4]));
  949|     57|    tmp[2] &= ~a | 0xffffffffff0000;
  950|     57|    tmp[1] &= ~a | 0x0000ffffffffff;
  951|       |
  952|       |    /* finally, subtract the last 2^32 - 1 */
  953|     57|    a = cond[0] & (cond[1] | (cond[2] & (~cond[3] | cond[4])));
  954|     57|    tmp[0] += a & (-((int64_t) 1 << 32) + 1);
  955|       |
  956|       |    /*
  957|       |     * eliminate negative coefficients: if tmp[0] is negative, tmp[1] must be
  958|       |     * non-zero, so we only need one step
  959|       |     */
  960|     57|    a = tmp[0] >> 63;
  961|     57|    tmp[0] += a & two56;
  962|     57|    tmp[1] -= a & 1;
  963|       |
  964|       |    /* Carry 1 -> 2 -> 3 -> 4 -> 5 -> 6 */
  965|     57|    tmp[2] += tmp[1] >> 56;
  966|     57|    tmp[1] &= 0x00ffffffffffffff;
  967|       |
  968|     57|    tmp[3] += tmp[2] >> 56;
  969|     57|    tmp[2] &= 0x00ffffffffffffff;
  970|       |
  971|     57|    tmp[4] += tmp[3] >> 56;
  972|     57|    tmp[3] &= 0x00ffffffffffffff;
  973|       |
  974|     57|    tmp[5] += tmp[4] >> 56;
  975|     57|    tmp[4] &= 0x00ffffffffffffff;
  976|       |
  977|     57|    tmp[6] += tmp[5] >> 56;
  978|     57|    tmp[5] &= 0x00ffffffffffffff;
  979|       |
  980|     57|    memcpy(out, tmp, sizeof(felem));
  981|     57|}
ecp_nistp384.c:felem_to_BN:
  161|    102|{
  162|    102|    felem_bytearray b_out;
  163|       |
  164|    102|    felem_to_bin48(b_out, in);
  165|    102|    return BN_lebin2bn(b_out, sizeof(b_out), out);
  166|    102|}
ecp_nistp384.c:felem_to_bin48:
  129|    102|{
  130|    102|    memset(out, 0, 48);
  131|    102|    (*((limb *) & out[0]))     |= (in[0] & bottom56bits);
  132|    102|    (*((limb_aX *) & out[7]))  |= (in[1] & bottom56bits);
  133|    102|    (*((limb_aX *) & out[14])) |= (in[2] & bottom56bits);
  134|    102|    (*((limb_aX *) & out[21])) |= (in[3] & bottom56bits);
  135|    102|    (*((limb_aX *) & out[28])) |= (in[4] & bottom56bits);
  136|    102|    (*((limb_aX *) & out[35])) |= (in[5] & bottom56bits);
  137|    102|    memmove(&out[42], &in[6], 6);
  138|    102|}
ecp_nistp384.c:point_add:
 1075|  1.47k|{
 1076|  1.47k|    felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, ftmp6, x_out, y_out, z_out;
 1077|  1.47k|    widefelem tmp, tmp2;
 1078|  1.47k|    limb x_equal, y_equal, z1_is_zero, z2_is_zero;
 1079|  1.47k|    limb points_equal;
 1080|       |
 1081|  1.47k|    z1_is_zero = felem_is_zero(z1);
 1082|  1.47k|    z2_is_zero = felem_is_zero(z2);
 1083|       |
 1084|       |    /* ftmp = z1z1 = z1**2 */
 1085|  1.47k|    felem_square_reduce(ftmp, z1);      /* ftmp[i] < 2^56 */
 1086|       |
 1087|  1.47k|    if (!mixed) {
  ------------------
  |  Branch (1087:9): [True: 0, False: 1.47k]
  ------------------
 1088|       |        /* ftmp2 = z2z2 = z2**2 */
 1089|      0|        felem_square_reduce(ftmp2, z2); /* ftmp2[i] < 2^56 */
 1090|       |
 1091|       |        /* u1 = ftmp3 = x1*z2z2 */
 1092|      0|        felem_mul_reduce(ftmp3, x1, ftmp2); /* ftmp3[i] < 2^56 */
 1093|       |
 1094|       |        /* ftmp5 = z1 + z2 */
 1095|      0|        felem_assign(ftmp5, z1);       /* ftmp5[i] < 2^56 */
 1096|      0|        felem_sum64(ftmp5, z2);        /* ftmp5[i] < 2^57 */
 1097|       |
 1098|       |        /* ftmp5 = (z1 + z2)**2 - z1z1 - z2z2 = 2*z1z2 */
 1099|      0|        felem_square(tmp, ftmp5);      /* tmp[i] < 2^117 */
  ------------------
  |  |  723|      0|# define felem_square felem_square_ref
  ------------------
 1100|      0|        felem_diff_128_64(tmp, ftmp);  /* tmp[i] < 2^117 + 2^64 + 2^48 */
 1101|      0|        felem_diff_128_64(tmp, ftmp2); /* tmp[i] < 2^117 + 2^65 + 2^49 */
 1102|      0|        felem_reduce(ftmp5, tmp);      /* ftmp5[i] < 2^56 */
 1103|       |
 1104|       |        /* ftmp2 = z2 * z2z2 */
 1105|      0|        felem_mul_reduce(ftmp2, ftmp2, z2); /* ftmp2[i] < 2^56 */
 1106|       |
 1107|       |        /* s1 = ftmp6 = y1 * z2**3 */
 1108|      0|        felem_mul_reduce(ftmp6, y1, ftmp2); /* ftmp6[i] < 2^56 */
 1109|  1.47k|    } else {
 1110|       |        /*
 1111|       |         * We'll assume z2 = 1 (special case z2 = 0 is handled later)
 1112|       |         */
 1113|       |
 1114|       |        /* u1 = ftmp3 = x1*z2z2 */
 1115|  1.47k|        felem_assign(ftmp3, x1);     /* ftmp3[i] < 2^56 */
 1116|       |
 1117|       |        /* ftmp5 = 2*z1z2 */
 1118|  1.47k|        felem_scalar(ftmp5, z1, 2);  /* ftmp5[i] < 2^57 */
 1119|       |
 1120|       |        /* s1 = ftmp6 = y1 * z2**3 */
 1121|  1.47k|        felem_assign(ftmp6, y1);     /* ftmp6[i] < 2^56 */
 1122|  1.47k|    }
 1123|       |    /* ftmp3[i] < 2^56, ftmp5[i] < 2^57, ftmp6[i] < 2^56 */
 1124|       |
 1125|       |    /* u2 = x2*z1z1 */
 1126|  1.47k|    felem_mul(tmp, x2, ftmp);        /* tmp[i] < 2^115 */
  ------------------
  |  |  724|  1.47k|# define felem_mul felem_mul_ref
  ------------------
 1127|       |
 1128|       |    /* h = ftmp4 = u2 - u1 */
 1129|  1.47k|    felem_diff_128_64(tmp, ftmp3);   /* tmp[i] < 2^115 + 2^64 + 2^48 */
 1130|  1.47k|    felem_reduce(ftmp4, tmp);        /* ftmp[4] < 2^56 */
 1131|       |
 1132|  1.47k|    x_equal = felem_is_zero(ftmp4);
 1133|       |
 1134|       |    /* z_out = ftmp5 * h */
 1135|  1.47k|    felem_mul_reduce(z_out, ftmp5, ftmp4);  /* z_out[i] < 2^56 */
 1136|       |
 1137|       |    /* ftmp = z1 * z1z1 */
 1138|  1.47k|    felem_mul_reduce(ftmp, ftmp, z1);  /* ftmp[i] < 2^56 */
 1139|       |
 1140|       |    /* s2 = tmp = y2 * z1**3 */
 1141|  1.47k|    felem_mul(tmp, y2, ftmp);      /* tmp[i] < 2^115 */
  ------------------
  |  |  724|  1.47k|# define felem_mul felem_mul_ref
  ------------------
 1142|       |
 1143|       |    /* r = ftmp5 = (s2 - s1)*2 */
 1144|  1.47k|    felem_diff_128_64(tmp, ftmp6); /* tmp[i] < 2^115 + 2^64 + 2^48 */
 1145|  1.47k|    felem_reduce(ftmp5, tmp);      /* ftmp5[i] < 2^56 */
 1146|  1.47k|    y_equal = felem_is_zero(ftmp5);
 1147|  1.47k|    felem_scalar64(ftmp5, 2);      /* ftmp5[i] < 2^57 */
 1148|       |
 1149|       |    /*
 1150|       |     * The formulae are incorrect if the points are equal, in affine coordinates
 1151|       |     * (X_1, Y_1) == (X_2, Y_2), so we check for this and do doubling if this
 1152|       |     * happens.
 1153|       |     *
 1154|       |     * We use bitwise operations to avoid potential side-channels introduced by
 1155|       |     * the short-circuiting behaviour of boolean operators.
 1156|       |     *
 1157|       |     * The special case of either point being the point at infinity (z1 and/or
 1158|       |     * z2 are zero), is handled separately later on in this function, so we
 1159|       |     * avoid jumping to point_double here in those special cases.
 1160|       |     *
 1161|       |     * Notice the comment below on the implications of this branching for timing
 1162|       |     * leaks and why it is considered practically irrelevant.
 1163|       |     */
 1164|  1.47k|    points_equal = (x_equal & y_equal & (~z1_is_zero) & (~z2_is_zero));
 1165|       |
 1166|  1.47k|    if (points_equal) {
  ------------------
  |  Branch (1166:9): [True: 0, False: 1.47k]
  ------------------
 1167|       |        /*
 1168|       |         * This is obviously not constant-time but it will almost-never happen
 1169|       |         * for ECDH / ECDSA.
 1170|       |         */
 1171|      0|        point_double(x3, y3, z3, x1, y1, z1);
 1172|      0|        return;
 1173|      0|    }
 1174|       |
 1175|       |    /* I = ftmp = (2h)**2 */
 1176|  1.47k|    felem_assign(ftmp, ftmp4);        /* ftmp[i] < 2^56 */
 1177|  1.47k|    felem_scalar64(ftmp, 2);          /* ftmp[i] < 2^57 */
 1178|  1.47k|    felem_square_reduce(ftmp, ftmp);  /* ftmp[i] < 2^56 */
 1179|       |
 1180|       |    /* J = ftmp2 = h * I */
 1181|  1.47k|    felem_mul_reduce(ftmp2, ftmp4, ftmp); /* ftmp2[i] < 2^56 */
 1182|       |
 1183|       |    /* V = ftmp4 = U1 * I */
 1184|  1.47k|    felem_mul_reduce(ftmp4, ftmp3, ftmp); /* ftmp4[i] < 2^56 */
 1185|       |
 1186|       |    /* x_out = r**2 - J - 2V */
 1187|  1.47k|    felem_square(tmp, ftmp5);      /* tmp[i] < 2^117 */
  ------------------
  |  |  723|  1.47k|# define felem_square felem_square_ref
  ------------------
 1188|  1.47k|    felem_diff_128_64(tmp, ftmp2); /* tmp[i] < 2^117 + 2^64 + 2^48 */
 1189|  1.47k|    felem_assign(ftmp3, ftmp4);    /* ftmp3[i] < 2^56 */
 1190|  1.47k|    felem_scalar64(ftmp4, 2);      /* ftmp4[i] < 2^57 */
 1191|  1.47k|    felem_diff_128_64(tmp, ftmp4); /* tmp[i] < 2^117 + 2^65 + 2^49 */
 1192|  1.47k|    felem_reduce(x_out, tmp);      /* x_out[i] < 2^56 */
 1193|       |
 1194|       |    /* y_out = r(V-x_out) - 2 * s1 * J */
 1195|  1.47k|    felem_diff64(ftmp3, x_out);    /* ftmp3[i] < 2^60 + 2^56 + 2^44 */
 1196|  1.47k|    felem_mul(tmp, ftmp5, ftmp3);  /* tmp[i] < 2^116 */
  ------------------
  |  |  724|  1.47k|# define felem_mul felem_mul_ref
  ------------------
 1197|  1.47k|    felem_mul(tmp2, ftmp6, ftmp2); /* tmp2[i] < 2^115 */
  ------------------
  |  |  724|  1.47k|# define felem_mul felem_mul_ref
  ------------------
 1198|  1.47k|    felem_scalar128(tmp2, 2);      /* tmp2[i] < 2^116 */
 1199|  1.47k|    felem_diff128(tmp, tmp2);      /* tmp[i] < 2^127 + 2^116 + 2^111 */
 1200|  1.47k|    felem_reduce(y_out, tmp);      /* y_out[i] < 2^56 */
 1201|       |
 1202|  1.47k|    copy_conditional(x_out, x2, z1_is_zero);
 1203|  1.47k|    copy_conditional(x_out, x1, z2_is_zero);
 1204|  1.47k|    copy_conditional(y_out, y2, z1_is_zero);
 1205|  1.47k|    copy_conditional(y_out, y1, z2_is_zero);
 1206|  1.47k|    copy_conditional(z_out, z2, z1_is_zero);
 1207|  1.47k|    copy_conditional(z_out, z1, z2_is_zero);
 1208|  1.47k|    felem_assign(x3, x_out);
 1209|  1.47k|    felem_assign(y3, y_out);
 1210|  1.47k|    felem_assign(z3, z_out);
 1211|  1.47k|}
ecp_nistp384.c:felem_is_zero:
  829|  5.88k|{
  830|  5.88k|    limb zero, p384;
  831|       |
  832|  5.88k|    zero = in[0] | in[1] | in[2] | in[3] | in[4] | in[5] | in[6];
  833|  5.88k|    zero = ((int64_t) (zero) - 1) >> 63;
  834|  5.88k|    p384 = (in[0] ^ 0x000000ffffffff) | (in[1] ^ 0xffff0000000000)
  835|  5.88k|         | (in[2] ^ 0xfffffffffeffff) | (in[3] ^ 0xffffffffffffff)
  836|  5.88k|         | (in[4] ^ 0xffffffffffffff) | (in[5] ^ 0xffffffffffffff)
  837|  5.88k|         | (in[6] ^ 0xffffffffffff);
  838|  5.88k|    p384 = ((int64_t) (p384) - 1) >> 63;
  839|       |
  840|  5.88k|    return (zero | p384);
  841|  5.88k|}
ecp_nistp384.c:felem_sum64:
  186|  4.41k|{
  187|  4.41k|    unsigned int i;
  188|       |
  189|  35.2k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |  105|  35.2k|#define NLIMBS 7
  ------------------
  |  Branch (189:17): [True: 30.8k, False: 4.41k]
  ------------------
  190|  30.8k|        out[i] += in[i];
  191|  4.41k|}
ecp_nistp384.c:felem_diff_128_64:
  296|  8.82k|{
  297|       |    /*
  298|       |     * In order to prevent underflow, we add a multiple of p before subtracting.
  299|       |     * Use telescopic sums to represent 2^16 * p redundantly with each limb
  300|       |     * of the form 2^64 + ...
  301|       |     */
  302|       |
  303|  8.82k|    static const widelimb two64m56m8 = (((widelimb) 1) << 64)
  304|  8.82k|                                     - (((widelimb) 1) << 56)
  305|  8.82k|                                     - (((widelimb) 1) << 8);
  306|  8.82k|    static const widelimb two64m32m8 = (((widelimb) 1) << 64)
  307|  8.82k|                                     - (((widelimb) 1) << 32)
  308|  8.82k|                                     - (((widelimb) 1) << 8);
  309|  8.82k|    static const widelimb two64m8 = (((widelimb) 1) << 64)
  310|  8.82k|                                  - (((widelimb) 1) << 8);
  311|  8.82k|    static const widelimb two64p48m16 = (((widelimb) 1) << 64)
  312|  8.82k|                                      + (((widelimb) 1) << 48)
  313|  8.82k|                                      - (((widelimb) 1) << 16);
  314|  8.82k|    unsigned int i;
  315|       |
  316|  8.82k|    out[0] += two64p48m16;
  317|  8.82k|    out[1] += two64m56m8;
  318|  8.82k|    out[2] += two64m32m8;
  319|  8.82k|    out[3] += two64m8;
  320|  8.82k|    out[4] += two64m8;
  321|  8.82k|    out[5] += two64m8;
  322|  8.82k|    out[6] += two64m8;
  323|       |
  324|  70.5k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |  105|  70.5k|#define NLIMBS 7
  ------------------
  |  Branch (324:17): [True: 61.7k, False: 8.82k]
  ------------------
  325|  61.7k|        out[i] -= in[i];
  326|  8.82k|}
ecp_nistp384.c:felem_scalar64:
  204|  8.82k|{
  205|  8.82k|    unsigned int i;
  206|       |
  207|  70.5k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |  105|  70.5k|#define NLIMBS 7
  ------------------
  |  Branch (207:17): [True: 61.7k, False: 8.82k]
  ------------------
  208|  61.7k|        out[i] *= scalar;
  209|  8.82k|}
ecp_nistp384.c:felem_diff64:
  263|  4.41k|{
  264|       |    /*
  265|       |     * In order to prevent underflow, we add a multiple of p before subtracting.
  266|       |     * Use telescopic sums to represent 2^12 * p redundantly with each limb
  267|       |     * of the form 2^60 + ...
  268|       |     */
  269|       |
  270|  4.41k|    static const limb two60m52m4 = (((limb) 1) << 60)
  271|  4.41k|                                 - (((limb) 1) << 52)
  272|  4.41k|                                 - (((limb) 1) << 4);
  273|  4.41k|    static const limb two60p44m12 = (((limb) 1) << 60)
  274|  4.41k|                                  + (((limb) 1) << 44)
  275|  4.41k|                                  - (((limb) 1) << 12);
  276|  4.41k|    static const limb two60m28m4 = (((limb) 1) << 60)
  277|  4.41k|                                 - (((limb) 1) << 28)
  278|  4.41k|                                 - (((limb) 1) << 4);
  279|  4.41k|    static const limb two60m4 = (((limb) 1) << 60)
  280|  4.41k|                              - (((limb) 1) << 4);
  281|       |
  282|  4.41k|    out[0] += two60p44m12 - in[0];
  283|  4.41k|    out[1] += two60m52m4 - in[1];
  284|  4.41k|    out[2] += two60m28m4 - in[2];
  285|  4.41k|    out[3] += two60m4 - in[3];
  286|  4.41k|    out[4] += two60m4 - in[4];
  287|  4.41k|    out[5] += two60m4 - in[5];
  288|  4.41k|    out[6] += two60m4 - in[6];
  289|  4.41k|}
ecp_nistp384.c:felem_scalar128:
  213|  2.94k|{
  214|  2.94k|    unsigned int i;
  215|       |
  216|  41.1k|    for (i = 0; i < 2*NLIMBS-1; i++)
  ------------------
  |  |  105|  41.1k|#define NLIMBS 7
  ------------------
  |  Branch (216:17): [True: 38.2k, False: 2.94k]
  ------------------
  217|  38.2k|        out[i] *= scalar;
  218|  2.94k|}
ecp_nistp384.c:felem_diff128:
  333|  2.94k|{
  334|       |    /*
  335|       |     * In order to prevent underflow, we add a multiple of p before subtracting.
  336|       |     * Use telescopic sums to represent 2^415 * p redundantly with each limb
  337|       |     * of the form 2^127 + ...
  338|       |     */
  339|       |
  340|  2.94k|    static const widelimb two127 = ((widelimb) 1) << 127;
  341|  2.94k|    static const widelimb two127m71 = (((widelimb) 1) << 127)
  342|  2.94k|                                    - (((widelimb) 1) << 71);
  343|  2.94k|    static const widelimb two127p111m79m71 = (((widelimb) 1) << 127)
  344|  2.94k|                                           + (((widelimb) 1) << 111)
  345|  2.94k|                                           - (((widelimb) 1) << 79)
  346|  2.94k|                                           - (((widelimb) 1) << 71);
  347|  2.94k|    static const widelimb two127m119m71 = (((widelimb) 1) << 127)
  348|  2.94k|                                        - (((widelimb) 1) << 119)
  349|  2.94k|                                        - (((widelimb) 1) << 71);
  350|  2.94k|    static const widelimb two127m95m71 = (((widelimb) 1) << 127)
  351|  2.94k|                                       - (((widelimb) 1) << 95)
  352|  2.94k|                                       - (((widelimb) 1) << 71);
  353|  2.94k|    unsigned int i;
  354|       |
  355|  2.94k|    out[0]  += two127;
  356|  2.94k|    out[1]  += two127m71;
  357|  2.94k|    out[2]  += two127m71;
  358|  2.94k|    out[3]  += two127m71;
  359|  2.94k|    out[4]  += two127m71;
  360|  2.94k|    out[5]  += two127m71;
  361|  2.94k|    out[6]  += two127p111m79m71;
  362|  2.94k|    out[7]  += two127m119m71;
  363|  2.94k|    out[8]  += two127m95m71;
  364|  2.94k|    out[9]  += two127m71;
  365|  2.94k|    out[10] += two127m71;
  366|  2.94k|    out[11] += two127m71;
  367|  2.94k|    out[12] += two127m71;
  368|       |
  369|  41.1k|    for (i = 0; i < 2*NLIMBS-1; i++)
  ------------------
  |  |  105|  41.1k|#define NLIMBS 7
  ------------------
  |  Branch (369:17): [True: 38.2k, False: 2.94k]
  ------------------
  370|  38.2k|        out[i] -= in[i];
  371|  2.94k|}
ecp_nistp384.c:copy_conditional:
 1053|  8.82k|{
 1054|  8.82k|    unsigned int i;
 1055|       |
 1056|  70.5k|    for (i = 0; i < NLIMBS; i++)
  ------------------
  |  |  105|  70.5k|#define NLIMBS 7
  ------------------
  |  Branch (1056:17): [True: 61.7k, False: 8.82k]
  ------------------
 1057|  61.7k|        out[i] ^= mask & (in[i] ^ out[i]);
 1058|  8.82k|}
ecp_nistp384.c:point_double:
 1004|  1.47k|{
 1005|  1.47k|    widefelem tmp, tmp2;
 1006|  1.47k|    felem delta, gamma, beta, alpha, ftmp, ftmp2;
 1007|       |
 1008|  1.47k|    felem_assign(ftmp, x_in);
 1009|  1.47k|    felem_assign(ftmp2, x_in);
 1010|       |
 1011|       |    /* delta = z^2 */
 1012|  1.47k|    felem_square_reduce(delta, z_in);     /* delta[i] < 2^56 */
 1013|       |
 1014|       |    /* gamma = y^2 */
 1015|  1.47k|    felem_square_reduce(gamma, y_in);     /* gamma[i] < 2^56 */
 1016|       |
 1017|       |    /* beta = x*gamma */
 1018|  1.47k|    felem_mul_reduce(beta, x_in, gamma);  /* beta[i] < 2^56 */
 1019|       |
 1020|       |    /* alpha = 3*(x-delta)*(x+delta) */
 1021|  1.47k|    felem_diff64(ftmp, delta);            /* ftmp[i] < 2^60 + 2^58 + 2^44 */
 1022|  1.47k|    felem_sum64(ftmp2, delta);            /* ftmp2[i] < 2^59 */
 1023|  1.47k|    felem_scalar64(ftmp2, 3);             /* ftmp2[i] < 2^61 */
 1024|  1.47k|    felem_mul_reduce(alpha, ftmp, ftmp2); /* alpha[i] < 2^56 */
 1025|       |
 1026|       |    /* x' = alpha^2 - 8*beta */
 1027|  1.47k|    felem_square(tmp, alpha);             /* tmp[i] < 2^115 */
  ------------------
  |  |  723|  1.47k|# define felem_square felem_square_ref
  ------------------
 1028|  1.47k|    felem_assign(ftmp, beta);             /* ftmp[i] < 2^56 */
 1029|  1.47k|    felem_scalar64(ftmp, 8);              /* ftmp[i] < 2^59 */
 1030|  1.47k|    felem_diff_128_64(tmp, ftmp);         /* tmp[i] < 2^115 + 2^64 + 2^48 */
 1031|  1.47k|    felem_reduce(x_out, tmp);             /* x_out[i] < 2^56 */
 1032|       |
 1033|       |    /* z' = (y + z)^2 - gamma - delta */
 1034|  1.47k|    felem_sum64(delta, gamma);     /* delta[i] < 2^57 */
 1035|  1.47k|    felem_assign(ftmp, y_in);      /* ftmp[i] < 2^56 */
 1036|  1.47k|    felem_sum64(ftmp, z_in);       /* ftmp[i] < 2^56 */
 1037|  1.47k|    felem_square(tmp, ftmp);       /* tmp[i] < 2^115 */
  ------------------
  |  |  723|  1.47k|# define felem_square felem_square_ref
  ------------------
 1038|  1.47k|    felem_diff_128_64(tmp, delta); /* tmp[i] < 2^115 + 2^64 + 2^48 */
 1039|  1.47k|    felem_reduce(z_out, tmp);      /* z_out[i] < 2^56 */
 1040|       |
 1041|       |    /* y' = alpha*(4*beta - x') - 8*gamma^2 */
 1042|  1.47k|    felem_scalar64(beta, 4);       /* beta[i] < 2^58 */
 1043|  1.47k|    felem_diff64(beta, x_out);     /* beta[i] < 2^60 + 2^58 + 2^44 */
 1044|  1.47k|    felem_mul(tmp, alpha, beta);   /* tmp[i] < 2^119 */
  ------------------
  |  |  724|  1.47k|# define felem_mul felem_mul_ref
  ------------------
 1045|  1.47k|    felem_square(tmp2, gamma);     /* tmp2[i] < 2^115 */
  ------------------
  |  |  723|  1.47k|# define felem_square felem_square_ref
  ------------------
 1046|  1.47k|    felem_scalar128(tmp2, 8);      /* tmp2[i] < 2^118 */
 1047|  1.47k|    felem_diff128(tmp, tmp2);      /* tmp[i] < 2^127 + 2^119 + 2^111 */
 1048|  1.47k|    felem_reduce(y_out, tmp);      /* tmp[i] < 2^56 */
 1049|  1.47k|}
ecp_nistp384.c:batch_mul:
 1378|     15|{
 1379|     15|    int i, skip;
 1380|     15|    unsigned int num, gen_mul = (g_scalar != NULL);
 1381|     15|    felem nq[3], tmp[4];
 1382|     15|    limb bits;
 1383|     15|    u8 sign, digit;
 1384|       |
 1385|       |    /* set nq to the point at infinity */
 1386|     15|    memset(nq, 0, sizeof(nq));
 1387|       |
 1388|       |    /*
 1389|       |     * Loop over all scalars msb-to-lsb, interleaving additions of multiples
 1390|       |     * of the generator (last quarter of rounds) and additions of other
 1391|       |     * points multiples (every 5th round).
 1392|       |     */
 1393|     15|    skip = 1;                   /* save two point operations in the first
 1394|       |                                 * round */
 1395|  1.50k|    for (i = (num_points ? 380 : 98); i >= 0; --i) {
  ------------------
  |  Branch (1395:15): [True: 0, False: 15]
  |  Branch (1395:39): [True: 1.48k, False: 15]
  ------------------
 1396|       |        /* double */
 1397|  1.48k|        if (!skip)
  ------------------
  |  Branch (1397:13): [True: 1.47k, False: 15]
  ------------------
 1398|  1.47k|            point_double(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2]);
 1399|       |
 1400|       |        /* add multiples of the generator */
 1401|  1.48k|        if (gen_mul && (i <= 98)) {
  ------------------
  |  Branch (1401:13): [True: 1.48k, False: 0]
  |  Branch (1401:24): [True: 1.48k, False: 0]
  ------------------
 1402|  1.48k|            bits = get_bit(g_scalar, i + 285) << 3;
 1403|  1.48k|            if (i < 95) {
  ------------------
  |  Branch (1403:17): [True: 1.42k, False: 60]
  ------------------
 1404|  1.42k|                bits |= get_bit(g_scalar, i + 190) << 2;
 1405|  1.42k|                bits |= get_bit(g_scalar, i + 95) << 1;
 1406|  1.42k|                bits |= get_bit(g_scalar, i);
 1407|  1.42k|            }
 1408|       |            /* select the point to add, in constant time */
 1409|  1.48k|            select_point(bits, 16, g_pre_comp, tmp);
 1410|  1.48k|            if (!skip) {
  ------------------
  |  Branch (1410:17): [True: 1.47k, False: 15]
  ------------------
 1411|       |                /* The 1 argument below is for "mixed" */
 1412|  1.47k|                point_add(nq[0],  nq[1],  nq[2],
 1413|  1.47k|                          nq[0],  nq[1],  nq[2], 1,
 1414|  1.47k|                          tmp[0], tmp[1], tmp[2]);
 1415|  1.47k|            } else {
 1416|     15|                memcpy(nq, tmp, 3 * sizeof(felem));
 1417|     15|                skip = 0;
 1418|     15|            }
 1419|  1.48k|        }
 1420|       |
 1421|       |        /* do other additions every 5 doublings */
 1422|  1.48k|        if (num_points && (i % 5 == 0)) {
  ------------------
  |  Branch (1422:13): [True: 0, False: 1.48k]
  |  Branch (1422:27): [True: 0, False: 0]
  ------------------
 1423|       |            /* loop over all scalars */
 1424|      0|            for (num = 0; num < num_points; ++num) {
  ------------------
  |  Branch (1424:27): [True: 0, False: 0]
  ------------------
 1425|      0|                bits = get_bit(scalars[num], i + 4) << 5;
 1426|      0|                bits |= get_bit(scalars[num], i + 3) << 4;
 1427|      0|                bits |= get_bit(scalars[num], i + 2) << 3;
 1428|      0|                bits |= get_bit(scalars[num], i + 1) << 2;
 1429|      0|                bits |= get_bit(scalars[num], i) << 1;
 1430|      0|                bits |= get_bit(scalars[num], i - 1);
 1431|      0|                ossl_ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
 1432|       |
 1433|       |                /*
 1434|       |                 * select the point to add or subtract, in constant time
 1435|       |                 */
 1436|      0|                select_point(digit, 17, pre_comp[num], tmp);
 1437|      0|                felem_neg(tmp[3], tmp[1]); /* (X, -Y, Z) is the negative
 1438|       |                                            * point */
 1439|      0|                copy_conditional(tmp[1], tmp[3], (-(limb) sign));
 1440|       |
 1441|      0|                if (!skip) {
  ------------------
  |  Branch (1441:21): [True: 0, False: 0]
  ------------------
 1442|      0|                    point_add(nq[0],  nq[1],  nq[2],
 1443|      0|                              nq[0],  nq[1],  nq[2], mixed,
 1444|      0|                              tmp[0], tmp[1], tmp[2]);
 1445|      0|                } else {
 1446|      0|                    memcpy(nq, tmp, 3 * sizeof(felem));
 1447|      0|                    skip = 0;
 1448|      0|                }
 1449|      0|            }
 1450|      0|        }
 1451|  1.48k|    }
 1452|     15|    felem_assign(x_out, nq[0]);
 1453|     15|    felem_assign(y_out, nq[1]);
 1454|     15|    felem_assign(z_out, nq[2]);
 1455|     15|}
ecp_nistp384.c:get_bit:
 1360|  5.76k|{
 1361|  5.76k|    if (i < 0 || i >= 384)
  ------------------
  |  Branch (1361:9): [True: 0, False: 5.76k]
  |  Branch (1361:18): [True: 0, False: 5.76k]
  ------------------
 1362|      0|        return 0;
 1363|  5.76k|    return (in[i >> 3] >> (i & 7)) & 1;
 1364|  5.76k|}
ecp_nistp384.c:select_point:
 1338|  1.48k|{
 1339|  1.48k|    unsigned int i, j;
 1340|  1.48k|    limb *outlimbs = &out[0][0];
 1341|       |
 1342|  1.48k|    memset(out, 0, sizeof(*out) * 3);
 1343|       |
 1344|  25.2k|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (1344:17): [True: 23.7k, False: 1.48k]
  ------------------
 1345|  23.7k|        const limb *inlimbs = &pre_comp[i][0][0];
 1346|  23.7k|        limb mask = i ^ idx;
 1347|       |
 1348|  23.7k|        mask |= mask >> 4;
 1349|  23.7k|        mask |= mask >> 2;
 1350|  23.7k|        mask |= mask >> 1;
 1351|  23.7k|        mask &= 1;
 1352|  23.7k|        mask--;
 1353|   522k|        for (j = 0; j < NLIMBS * 3; j++)
  ------------------
  |  |  105|   522k|#define NLIMBS 7
  ------------------
  |  Branch (1353:21): [True: 498k, False: 23.7k]
  ------------------
 1354|   498k|            outlimbs[j] |= inlimbs[j] & mask;
 1355|  23.7k|    }
 1356|  1.48k|}

EC_GFp_nistp521_method:
 1671|  1.13k|{
 1672|  1.13k|    static const EC_METHOD ret = {
 1673|  1.13k|        EC_FLAGS_DEFAULT_OCT,
  ------------------
  |  |   26|  1.13k|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
 1674|  1.13k|        NID_X9_62_prime_field,
  ------------------
  |  |  152|  1.13k|#define NID_X9_62_prime_field           406
  ------------------
 1675|  1.13k|        ossl_ec_GFp_nistp521_group_init,
 1676|  1.13k|        ossl_ec_GFp_simple_group_finish,
 1677|  1.13k|        ossl_ec_GFp_simple_group_clear_finish,
 1678|  1.13k|        ossl_ec_GFp_nist_group_copy,
 1679|  1.13k|        ossl_ec_GFp_nistp521_group_set_curve,
 1680|  1.13k|        ossl_ec_GFp_simple_group_get_curve,
 1681|  1.13k|        ossl_ec_GFp_simple_group_get_degree,
 1682|  1.13k|        ossl_ec_group_simple_order_bits,
 1683|  1.13k|        ossl_ec_GFp_simple_group_check_discriminant,
 1684|  1.13k|        ossl_ec_GFp_simple_point_init,
 1685|  1.13k|        ossl_ec_GFp_simple_point_finish,
 1686|  1.13k|        ossl_ec_GFp_simple_point_clear_finish,
 1687|  1.13k|        ossl_ec_GFp_simple_point_copy,
 1688|  1.13k|        ossl_ec_GFp_simple_point_set_to_infinity,
 1689|  1.13k|        ossl_ec_GFp_simple_point_set_affine_coordinates,
 1690|  1.13k|        ossl_ec_GFp_nistp521_point_get_affine_coordinates,
 1691|  1.13k|        0 /* point_set_compressed_coordinates */ ,
 1692|  1.13k|        0 /* point2oct */ ,
 1693|  1.13k|        0 /* oct2point */ ,
 1694|  1.13k|        ossl_ec_GFp_simple_add,
 1695|  1.13k|        ossl_ec_GFp_simple_dbl,
 1696|  1.13k|        ossl_ec_GFp_simple_invert,
 1697|  1.13k|        ossl_ec_GFp_simple_is_at_infinity,
 1698|  1.13k|        ossl_ec_GFp_simple_is_on_curve,
 1699|  1.13k|        ossl_ec_GFp_simple_cmp,
 1700|  1.13k|        ossl_ec_GFp_simple_make_affine,
 1701|  1.13k|        ossl_ec_GFp_simple_points_make_affine,
 1702|  1.13k|        ossl_ec_GFp_nistp521_points_mul,
 1703|  1.13k|        ossl_ec_GFp_nistp521_precompute_mult,
 1704|  1.13k|        ossl_ec_GFp_nistp521_have_precompute_mult,
 1705|  1.13k|        ossl_ec_GFp_nist_field_mul,
 1706|  1.13k|        ossl_ec_GFp_nist_field_sqr,
 1707|  1.13k|        0 /* field_div */ ,
 1708|  1.13k|        ossl_ec_GFp_simple_field_inv,
 1709|  1.13k|        0 /* field_encode */ ,
 1710|  1.13k|        0 /* field_decode */ ,
 1711|  1.13k|        0,                      /* field_set_to_one */
 1712|  1.13k|        ossl_ec_key_simple_priv2oct,
 1713|  1.13k|        ossl_ec_key_simple_oct2priv,
 1714|  1.13k|        0, /* set private */
 1715|  1.13k|        ossl_ec_key_simple_generate_key,
 1716|  1.13k|        ossl_ec_key_simple_check_key,
 1717|  1.13k|        ossl_ec_key_simple_generate_public_key,
 1718|  1.13k|        0, /* keycopy */
 1719|  1.13k|        0, /* keyfinish */
 1720|  1.13k|        ossl_ecdh_simple_compute_key,
 1721|  1.13k|        ossl_ecdsa_simple_sign_setup,
 1722|  1.13k|        ossl_ecdsa_simple_sign_sig,
 1723|  1.13k|        ossl_ecdsa_simple_verify_sig,
 1724|  1.13k|        0, /* field_inverse_mod_ord */
 1725|  1.13k|        0, /* blind_coordinates */
 1726|  1.13k|        0, /* ladder_pre */
 1727|  1.13k|        0, /* ladder_step */
 1728|  1.13k|        0  /* ladder_post */
 1729|  1.13k|    };
 1730|       |
 1731|  1.13k|    return &ret;
 1732|  1.13k|}
ossl_ec_GFp_nistp521_group_init:
 1784|  2.22k|{
 1785|  2.22k|    int ret;
 1786|  2.22k|    ret = ossl_ec_GFp_simple_group_init(group);
 1787|  2.22k|    group->a_is_minus3 = 1;
 1788|  2.22k|    return ret;
 1789|  2.22k|}
ossl_ec_GFp_nistp521_group_set_curve:
 1794|  1.13k|{
 1795|  1.13k|    int ret = 0;
 1796|  1.13k|    BIGNUM *curve_p, *curve_a, *curve_b;
 1797|  1.13k|#ifndef FIPS_MODULE
 1798|  1.13k|    BN_CTX *new_ctx = NULL;
 1799|       |
 1800|  1.13k|    if (ctx == NULL)
  ------------------
  |  Branch (1800:9): [True: 0, False: 1.13k]
  ------------------
 1801|      0|        ctx = new_ctx = BN_CTX_new();
 1802|  1.13k|#endif
 1803|  1.13k|    if (ctx == NULL)
  ------------------
  |  Branch (1803:9): [True: 0, False: 1.13k]
  ------------------
 1804|      0|        return 0;
 1805|       |
 1806|  1.13k|    BN_CTX_start(ctx);
 1807|  1.13k|    curve_p = BN_CTX_get(ctx);
 1808|  1.13k|    curve_a = BN_CTX_get(ctx);
 1809|  1.13k|    curve_b = BN_CTX_get(ctx);
 1810|  1.13k|    if (curve_b == NULL)
  ------------------
  |  Branch (1810:9): [True: 0, False: 1.13k]
  ------------------
 1811|      0|        goto err;
 1812|  1.13k|    BN_bin2bn(nistp521_curve_params[0], sizeof(felem_bytearray), curve_p);
 1813|  1.13k|    BN_bin2bn(nistp521_curve_params[1], sizeof(felem_bytearray), curve_a);
 1814|  1.13k|    BN_bin2bn(nistp521_curve_params[2], sizeof(felem_bytearray), curve_b);
 1815|  1.13k|    if ((BN_cmp(curve_p, p)) || (BN_cmp(curve_a, a)) || (BN_cmp(curve_b, b))) {
  ------------------
  |  Branch (1815:9): [True: 0, False: 1.13k]
  |  Branch (1815:33): [True: 0, False: 1.13k]
  |  Branch (1815:57): [True: 0, False: 1.13k]
  ------------------
 1816|      0|        ERR_raise(ERR_LIB_EC, EC_R_WRONG_CURVE_PARAMETERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1817|      0|        goto err;
 1818|      0|    }
 1819|  1.13k|    group->field_mod_func = BN_nist_mod_521;
 1820|  1.13k|    ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
 1821|  1.13k| err:
 1822|  1.13k|    BN_CTX_end(ctx);
 1823|  1.13k|#ifndef FIPS_MODULE
 1824|  1.13k|    BN_CTX_free(new_ctx);
 1825|  1.13k|#endif
 1826|  1.13k|    return ret;
 1827|  1.13k|}
ossl_ec_GFp_nistp521_point_get_affine_coordinates:
 1837|     22|{
 1838|     22|    felem z1, z2, x_in, y_in, x_out, y_out;
 1839|     22|    largefelem tmp;
 1840|       |
 1841|     22|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (1841:9): [True: 0, False: 22]
  ------------------
 1842|      0|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1843|      0|        return 0;
 1844|      0|    }
 1845|     22|    if ((!BN_to_felem(x_in, point->X)) || (!BN_to_felem(y_in, point->Y)) ||
  ------------------
  |  Branch (1845:9): [True: 0, False: 22]
  |  Branch (1845:43): [True: 0, False: 22]
  ------------------
 1846|     22|        (!BN_to_felem(z1, point->Z)))
  ------------------
  |  Branch (1846:9): [True: 0, False: 22]
  ------------------
 1847|      0|        return 0;
 1848|     22|    felem_inv(z2, z1);
 1849|     22|    felem_square(tmp, z2);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
 1850|     22|    felem_reduce(z1, tmp);
 1851|     22|    felem_mul(tmp, x_in, z1);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
 1852|     22|    felem_reduce(x_in, tmp);
 1853|     22|    felem_contract(x_out, x_in);
 1854|     22|    if (x != NULL) {
  ------------------
  |  Branch (1854:9): [True: 22, False: 0]
  ------------------
 1855|     22|        if (!felem_to_BN(x, x_out)) {
  ------------------
  |  Branch (1855:13): [True: 0, False: 22]
  ------------------
 1856|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1857|      0|            return 0;
 1858|      0|        }
 1859|     22|    }
 1860|     22|    felem_mul(tmp, z1, z2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
 1861|     22|    felem_reduce(z1, tmp);
 1862|     22|    felem_mul(tmp, y_in, z1);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
 1863|     22|    felem_reduce(y_in, tmp);
 1864|     22|    felem_contract(y_out, y_in);
 1865|     22|    if (y != NULL) {
  ------------------
  |  Branch (1865:9): [True: 22, False: 0]
  ------------------
 1866|     22|        if (!felem_to_BN(y, y_out)) {
  ------------------
  |  Branch (1866:13): [True: 0, False: 22]
  ------------------
 1867|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1868|      0|            return 0;
 1869|      0|        }
 1870|     22|    }
 1871|     22|    return 1;
 1872|     22|}
ossl_ec_GFp_nistp521_points_mul:
 1912|     39|{
 1913|     39|    int ret = 0;
 1914|     39|    int j;
 1915|     39|    int mixed = 0;
 1916|     39|    BIGNUM *x, *y, *z, *tmp_scalar;
 1917|     39|    felem_bytearray g_secret;
 1918|     39|    felem_bytearray *secrets = NULL;
 1919|     39|    felem (*pre_comp)[17][3] = NULL;
 1920|     39|    felem *tmp_felems = NULL;
 1921|     39|    unsigned i;
 1922|     39|    int num_bytes;
 1923|     39|    int have_pre_comp = 0;
 1924|     39|    size_t num_points = num;
 1925|     39|    felem x_in, y_in, z_in, x_out, y_out, z_out;
 1926|     39|    NISTP521_PRE_COMP *pre = NULL;
 1927|     39|    felem(*g_pre_comp)[3] = NULL;
 1928|     39|    EC_POINT *generator = NULL;
 1929|     39|    const EC_POINT *p = NULL;
 1930|     39|    const BIGNUM *p_scalar = NULL;
 1931|       |
 1932|     39|    BN_CTX_start(ctx);
 1933|     39|    x = BN_CTX_get(ctx);
 1934|     39|    y = BN_CTX_get(ctx);
 1935|     39|    z = BN_CTX_get(ctx);
 1936|     39|    tmp_scalar = BN_CTX_get(ctx);
 1937|     39|    if (tmp_scalar == NULL)
  ------------------
  |  Branch (1937:9): [True: 0, False: 39]
  ------------------
 1938|      0|        goto err;
 1939|       |
 1940|     39|    if (scalar != NULL) {
  ------------------
  |  Branch (1940:9): [True: 39, False: 0]
  ------------------
 1941|     39|        pre = group->pre_comp.nistp521;
 1942|     39|        if (pre)
  ------------------
  |  Branch (1942:13): [True: 0, False: 39]
  ------------------
 1943|       |            /* we have precomputation, try to use it */
 1944|      0|            g_pre_comp = &pre->g_pre_comp[0];
 1945|     39|        else
 1946|       |            /* try to use the standard precomputation */
 1947|     39|            g_pre_comp = (felem(*)[3]) gmul;
 1948|     39|        generator = EC_POINT_new(group);
 1949|     39|        if (generator == NULL)
  ------------------
  |  Branch (1949:13): [True: 0, False: 39]
  ------------------
 1950|      0|            goto err;
 1951|       |        /* get the generator from precomputation */
 1952|     39|        if (!felem_to_BN(x, g_pre_comp[1][0]) ||
  ------------------
  |  Branch (1952:13): [True: 0, False: 39]
  ------------------
 1953|     39|            !felem_to_BN(y, g_pre_comp[1][1]) ||
  ------------------
  |  Branch (1953:13): [True: 0, False: 39]
  ------------------
 1954|     39|            !felem_to_BN(z, g_pre_comp[1][2])) {
  ------------------
  |  Branch (1954:13): [True: 0, False: 39]
  ------------------
 1955|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1956|      0|            goto err;
 1957|      0|        }
 1958|     39|        if (!ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group,
  ------------------
  |  Branch (1958:13): [True: 0, False: 39]
  ------------------
 1959|     39|                                                                generator,
 1960|     39|                                                                x, y, z, ctx))
 1961|      0|            goto err;
 1962|     39|        if (0 == EC_POINT_cmp(group, generator, group->generator, ctx))
  ------------------
  |  Branch (1962:13): [True: 39, False: 0]
  ------------------
 1963|       |            /* precomputation matches generator */
 1964|     39|            have_pre_comp = 1;
 1965|      0|        else
 1966|       |            /*
 1967|       |             * we don't have valid precomputation: treat the generator as a
 1968|       |             * random point
 1969|       |             */
 1970|      0|            num_points++;
 1971|     39|    }
 1972|       |
 1973|     39|    if (num_points > 0) {
  ------------------
  |  Branch (1973:9): [True: 0, False: 39]
  ------------------
 1974|      0|        if (num_points >= 2) {
  ------------------
  |  Branch (1974:13): [True: 0, False: 0]
  ------------------
 1975|       |            /*
 1976|       |             * unless we precompute multiples for just one point, converting
 1977|       |             * those into affine form is time well spent
 1978|       |             */
 1979|      0|            mixed = 1;
 1980|      0|        }
 1981|      0|        secrets = OPENSSL_zalloc(sizeof(*secrets) * num_points);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1982|      0|        pre_comp = OPENSSL_zalloc(sizeof(*pre_comp) * num_points);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1983|      0|        if (mixed)
  ------------------
  |  Branch (1983:13): [True: 0, False: 0]
  ------------------
 1984|      0|            tmp_felems =
 1985|      0|                OPENSSL_malloc(sizeof(*tmp_felems) * (num_points * 17 + 1));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1986|      0|        if ((secrets == NULL) || (pre_comp == NULL)
  ------------------
  |  Branch (1986:13): [True: 0, False: 0]
  |  Branch (1986:34): [True: 0, False: 0]
  ------------------
 1987|      0|            || (mixed && (tmp_felems == NULL)))
  ------------------
  |  Branch (1987:17): [True: 0, False: 0]
  |  Branch (1987:26): [True: 0, False: 0]
  ------------------
 1988|      0|            goto err;
 1989|       |
 1990|       |        /*
 1991|       |         * we treat NULL scalars as 0, and NULL points as points at infinity,
 1992|       |         * i.e., they contribute nothing to the linear combination
 1993|       |         */
 1994|      0|        for (i = 0; i < num_points; ++i) {
  ------------------
  |  Branch (1994:21): [True: 0, False: 0]
  ------------------
 1995|      0|            if (i == num) {
  ------------------
  |  Branch (1995:17): [True: 0, False: 0]
  ------------------
 1996|       |                /*
 1997|       |                 * we didn't have a valid precomputation, so we pick the
 1998|       |                 * generator
 1999|       |                 */
 2000|      0|                p = EC_GROUP_get0_generator(group);
 2001|      0|                p_scalar = scalar;
 2002|      0|            } else {
 2003|       |                /* the i^th point */
 2004|      0|                p = points[i];
 2005|      0|                p_scalar = scalars[i];
 2006|      0|            }
 2007|      0|            if ((p_scalar != NULL) && (p != NULL)) {
  ------------------
  |  Branch (2007:17): [True: 0, False: 0]
  |  Branch (2007:39): [True: 0, False: 0]
  ------------------
 2008|       |                /* reduce scalar to 0 <= scalar < 2^521 */
 2009|      0|                if ((BN_num_bits(p_scalar) > 521)
  ------------------
  |  Branch (2009:21): [True: 0, False: 0]
  ------------------
 2010|      0|                    || (BN_is_negative(p_scalar))) {
  ------------------
  |  Branch (2010:24): [True: 0, False: 0]
  ------------------
 2011|       |                    /*
 2012|       |                     * this is an unusual input, and we don't guarantee
 2013|       |                     * constant-timeness
 2014|       |                     */
 2015|      0|                    if (!BN_nnmod(tmp_scalar, p_scalar, group->order, ctx)) {
  ------------------
  |  Branch (2015:25): [True: 0, False: 0]
  ------------------
 2016|      0|                        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2017|      0|                        goto err;
 2018|      0|                    }
 2019|      0|                    num_bytes = BN_bn2lebinpad(tmp_scalar,
 2020|      0|                                               secrets[i], sizeof(secrets[i]));
 2021|      0|                } else {
 2022|      0|                    num_bytes = BN_bn2lebinpad(p_scalar,
 2023|      0|                                               secrets[i], sizeof(secrets[i]));
 2024|      0|                }
 2025|      0|                if (num_bytes < 0) {
  ------------------
  |  Branch (2025:21): [True: 0, False: 0]
  ------------------
 2026|      0|                    ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2027|      0|                    goto err;
 2028|      0|                }
 2029|       |                /* precompute multiples */
 2030|      0|                if ((!BN_to_felem(x_out, p->X)) ||
  ------------------
  |  Branch (2030:21): [True: 0, False: 0]
  ------------------
 2031|      0|                    (!BN_to_felem(y_out, p->Y)) ||
  ------------------
  |  Branch (2031:21): [True: 0, False: 0]
  ------------------
 2032|      0|                    (!BN_to_felem(z_out, p->Z)))
  ------------------
  |  Branch (2032:21): [True: 0, False: 0]
  ------------------
 2033|      0|                    goto err;
 2034|      0|                memcpy(pre_comp[i][1][0], x_out, sizeof(felem));
 2035|      0|                memcpy(pre_comp[i][1][1], y_out, sizeof(felem));
 2036|      0|                memcpy(pre_comp[i][1][2], z_out, sizeof(felem));
 2037|      0|                for (j = 2; j <= 16; ++j) {
  ------------------
  |  Branch (2037:29): [True: 0, False: 0]
  ------------------
 2038|      0|                    if (j & 1) {
  ------------------
  |  Branch (2038:25): [True: 0, False: 0]
  ------------------
 2039|      0|                        point_add(pre_comp[i][j][0], pre_comp[i][j][1],
 2040|      0|                                  pre_comp[i][j][2], pre_comp[i][1][0],
 2041|      0|                                  pre_comp[i][1][1], pre_comp[i][1][2], 0,
 2042|      0|                                  pre_comp[i][j - 1][0],
 2043|      0|                                  pre_comp[i][j - 1][1],
 2044|      0|                                  pre_comp[i][j - 1][2]);
 2045|      0|                    } else {
 2046|      0|                        point_double(pre_comp[i][j][0], pre_comp[i][j][1],
 2047|      0|                                     pre_comp[i][j][2], pre_comp[i][j / 2][0],
 2048|      0|                                     pre_comp[i][j / 2][1],
 2049|      0|                                     pre_comp[i][j / 2][2]);
 2050|      0|                    }
 2051|      0|                }
 2052|      0|            }
 2053|      0|        }
 2054|      0|        if (mixed)
  ------------------
  |  Branch (2054:13): [True: 0, False: 0]
  ------------------
 2055|      0|            make_points_affine(num_points * 17, pre_comp[0], tmp_felems);
 2056|      0|    }
 2057|       |
 2058|       |    /* the scalar for the generator */
 2059|     39|    if ((scalar != NULL) && (have_pre_comp)) {
  ------------------
  |  Branch (2059:9): [True: 39, False: 0]
  |  Branch (2059:29): [True: 39, False: 0]
  ------------------
 2060|     39|        memset(g_secret, 0, sizeof(g_secret));
 2061|       |        /* reduce scalar to 0 <= scalar < 2^521 */
 2062|     39|        if ((BN_num_bits(scalar) > 521) || (BN_is_negative(scalar))) {
  ------------------
  |  Branch (2062:13): [True: 7, False: 32]
  |  Branch (2062:44): [True: 0, False: 32]
  ------------------
 2063|       |            /*
 2064|       |             * this is an unusual input, and we don't guarantee
 2065|       |             * constant-timeness
 2066|       |             */
 2067|      7|            if (!BN_nnmod(tmp_scalar, scalar, group->order, ctx)) {
  ------------------
  |  Branch (2067:17): [True: 0, False: 7]
  ------------------
 2068|      0|                ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2069|      0|                goto err;
 2070|      0|            }
 2071|      7|            num_bytes = BN_bn2lebinpad(tmp_scalar, g_secret, sizeof(g_secret));
 2072|     32|        } else {
 2073|     32|            num_bytes = BN_bn2lebinpad(scalar, g_secret, sizeof(g_secret));
 2074|     32|        }
 2075|       |        /* do the multiplication with generator precomputation */
 2076|     39|        batch_mul(x_out, y_out, z_out,
 2077|     39|                  (const felem_bytearray(*))secrets, num_points,
 2078|     39|                  g_secret,
 2079|     39|                  mixed, (const felem(*)[17][3])pre_comp,
 2080|     39|                  (const felem(*)[3])g_pre_comp);
 2081|     39|    } else {
 2082|       |        /* do the multiplication without generator precomputation */
 2083|      0|        batch_mul(x_out, y_out, z_out,
 2084|      0|                  (const felem_bytearray(*))secrets, num_points,
 2085|      0|                  NULL, mixed, (const felem(*)[17][3])pre_comp, NULL);
 2086|      0|    }
 2087|       |    /* reduce the output to its unique minimal representation */
 2088|     39|    felem_contract(x_in, x_out);
 2089|     39|    felem_contract(y_in, y_out);
 2090|     39|    felem_contract(z_in, z_out);
 2091|     39|    if ((!felem_to_BN(x, x_in)) || (!felem_to_BN(y, y_in)) ||
  ------------------
  |  Branch (2091:9): [True: 0, False: 39]
  |  Branch (2091:36): [True: 0, False: 39]
  ------------------
 2092|     39|        (!felem_to_BN(z, z_in))) {
  ------------------
  |  Branch (2092:9): [True: 0, False: 39]
  ------------------
 2093|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 2094|      0|        goto err;
 2095|      0|    }
 2096|     39|    ret = ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, r, x, y, z,
 2097|     39|                                                             ctx);
 2098|       |
 2099|     39| err:
 2100|     39|    BN_CTX_end(ctx);
 2101|     39|    EC_POINT_free(generator);
 2102|     39|    OPENSSL_free(secrets);
  ------------------
  |  |  107|     39|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     39|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     39|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 2103|     39|    OPENSSL_free(pre_comp);
  ------------------
  |  |  107|     39|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     39|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     39|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 2104|     39|    OPENSSL_free(tmp_felems);
  ------------------
  |  |  107|     39|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     39|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     39|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 2105|     39|    return ret;
 2106|     39|}
ecp_nistp521.c:BN_to_felem:
  176|     66|{
  177|     66|    felem_bytearray b_out;
  178|     66|    int num_bytes;
  179|       |
  180|     66|    if (BN_is_negative(bn)) {
  ------------------
  |  Branch (180:9): [True: 0, False: 66]
  ------------------
  181|      0|        ERR_raise(ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  182|      0|        return 0;
  183|      0|    }
  184|     66|    num_bytes = BN_bn2lebinpad(bn, b_out, sizeof(b_out));
  185|     66|    if (num_bytes < 0) {
  ------------------
  |  Branch (185:9): [True: 0, False: 66]
  ------------------
  186|      0|        ERR_raise(ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  187|      0|        return 0;
  188|      0|    }
  189|     66|    bin66_to_felem(out, b_out);
  190|     66|    return 1;
  191|     66|}
ecp_nistp521.c:bin66_to_felem:
  144|     66|{
  145|     66|    out[0] = (*((limb *) & in[0])) & bottom58bits;
  146|     66|    out[1] = (*((limb_aX *) & in[7]) >> 2) & bottom58bits;
  147|     66|    out[2] = (*((limb_aX *) & in[14]) >> 4) & bottom58bits;
  148|     66|    out[3] = (*((limb_aX *) & in[21]) >> 6) & bottom58bits;
  149|     66|    out[4] = (*((limb_aX *) & in[29])) & bottom58bits;
  150|     66|    out[5] = (*((limb_aX *) & in[36]) >> 2) & bottom58bits;
  151|     66|    out[6] = (*((limb_aX *) & in[43]) >> 4) & bottom58bits;
  152|     66|    out[7] = (*((limb_aX *) & in[50]) >> 6) & bottom58bits;
  153|     66|    out[8] = (*((limb_aX *) & in[58])) & bottom57bits;
  154|     66|}
ecp_nistp521.c:felem_inv:
  752|     22|{
  753|     22|    felem ftmp, ftmp2, ftmp3, ftmp4;
  754|     22|    largefelem tmp;
  755|     22|    unsigned i;
  756|       |
  757|     22|    felem_square(tmp, in);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  758|     22|    felem_reduce(ftmp, tmp);    /* 2^1 */
  759|     22|    felem_mul(tmp, in, ftmp);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  760|     22|    felem_reduce(ftmp, tmp);    /* 2^2 - 2^0 */
  761|     22|    felem_assign(ftmp2, ftmp);
  762|     22|    felem_square(tmp, ftmp);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  763|     22|    felem_reduce(ftmp, tmp);    /* 2^3 - 2^1 */
  764|     22|    felem_mul(tmp, in, ftmp);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  765|     22|    felem_reduce(ftmp, tmp);    /* 2^3 - 2^0 */
  766|     22|    felem_square(tmp, ftmp);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  767|     22|    felem_reduce(ftmp, tmp);    /* 2^4 - 2^1 */
  768|       |
  769|     22|    felem_square(tmp, ftmp2);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  770|     22|    felem_reduce(ftmp3, tmp);   /* 2^3 - 2^1 */
  771|     22|    felem_square(tmp, ftmp3);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  772|     22|    felem_reduce(ftmp3, tmp);   /* 2^4 - 2^2 */
  773|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  774|     22|    felem_reduce(ftmp3, tmp);   /* 2^4 - 2^0 */
  775|       |
  776|     22|    felem_assign(ftmp2, ftmp3);
  777|     22|    felem_square(tmp, ftmp3);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  778|     22|    felem_reduce(ftmp3, tmp);   /* 2^5 - 2^1 */
  779|     22|    felem_square(tmp, ftmp3);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  780|     22|    felem_reduce(ftmp3, tmp);   /* 2^6 - 2^2 */
  781|     22|    felem_square(tmp, ftmp3);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  782|     22|    felem_reduce(ftmp3, tmp);   /* 2^7 - 2^3 */
  783|     22|    felem_square(tmp, ftmp3);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  784|     22|    felem_reduce(ftmp3, tmp);   /* 2^8 - 2^4 */
  785|     22|    felem_mul(tmp, ftmp3, ftmp);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  786|     22|    felem_reduce(ftmp4, tmp);   /* 2^8 - 2^1 */
  787|     22|    felem_square(tmp, ftmp4);
  ------------------
  |  |  725|     22|# define felem_square felem_square_ref
  ------------------
  788|     22|    felem_reduce(ftmp4, tmp);   /* 2^9 - 2^2 */
  789|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  790|     22|    felem_reduce(ftmp3, tmp);   /* 2^8 - 2^0 */
  791|     22|    felem_assign(ftmp2, ftmp3);
  792|       |
  793|    198|    for (i = 0; i < 8; i++) {
  ------------------
  |  Branch (793:17): [True: 176, False: 22]
  ------------------
  794|    176|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|    176|# define felem_square felem_square_ref
  ------------------
  795|    176|        felem_reduce(ftmp3, tmp); /* 2^16 - 2^8 */
  796|    176|    }
  797|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  798|     22|    felem_reduce(ftmp3, tmp);   /* 2^16 - 2^0 */
  799|     22|    felem_assign(ftmp2, ftmp3);
  800|       |
  801|    374|    for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (801:17): [True: 352, False: 22]
  ------------------
  802|    352|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|    352|# define felem_square felem_square_ref
  ------------------
  803|    352|        felem_reduce(ftmp3, tmp); /* 2^32 - 2^16 */
  804|    352|    }
  805|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  806|     22|    felem_reduce(ftmp3, tmp);   /* 2^32 - 2^0 */
  807|     22|    felem_assign(ftmp2, ftmp3);
  808|       |
  809|    726|    for (i = 0; i < 32; i++) {
  ------------------
  |  Branch (809:17): [True: 704, False: 22]
  ------------------
  810|    704|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|    704|# define felem_square felem_square_ref
  ------------------
  811|    704|        felem_reduce(ftmp3, tmp); /* 2^64 - 2^32 */
  812|    704|    }
  813|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  814|     22|    felem_reduce(ftmp3, tmp);   /* 2^64 - 2^0 */
  815|     22|    felem_assign(ftmp2, ftmp3);
  816|       |
  817|  1.43k|    for (i = 0; i < 64; i++) {
  ------------------
  |  Branch (817:17): [True: 1.40k, False: 22]
  ------------------
  818|  1.40k|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|  1.40k|# define felem_square felem_square_ref
  ------------------
  819|  1.40k|        felem_reduce(ftmp3, tmp); /* 2^128 - 2^64 */
  820|  1.40k|    }
  821|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  822|     22|    felem_reduce(ftmp3, tmp);   /* 2^128 - 2^0 */
  823|     22|    felem_assign(ftmp2, ftmp3);
  824|       |
  825|  2.83k|    for (i = 0; i < 128; i++) {
  ------------------
  |  Branch (825:17): [True: 2.81k, False: 22]
  ------------------
  826|  2.81k|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|  2.81k|# define felem_square felem_square_ref
  ------------------
  827|  2.81k|        felem_reduce(ftmp3, tmp); /* 2^256 - 2^128 */
  828|  2.81k|    }
  829|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  830|     22|    felem_reduce(ftmp3, tmp);   /* 2^256 - 2^0 */
  831|     22|    felem_assign(ftmp2, ftmp3);
  832|       |
  833|  5.65k|    for (i = 0; i < 256; i++) {
  ------------------
  |  Branch (833:17): [True: 5.63k, False: 22]
  ------------------
  834|  5.63k|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|  5.63k|# define felem_square felem_square_ref
  ------------------
  835|  5.63k|        felem_reduce(ftmp3, tmp); /* 2^512 - 2^256 */
  836|  5.63k|    }
  837|     22|    felem_mul(tmp, ftmp3, ftmp2);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  838|     22|    felem_reduce(ftmp3, tmp);   /* 2^512 - 2^0 */
  839|       |
  840|    220|    for (i = 0; i < 9; i++) {
  ------------------
  |  Branch (840:17): [True: 198, False: 22]
  ------------------
  841|    198|        felem_square(tmp, ftmp3);
  ------------------
  |  |  725|    198|# define felem_square felem_square_ref
  ------------------
  842|    198|        felem_reduce(ftmp3, tmp); /* 2^521 - 2^9 */
  843|    198|    }
  844|     22|    felem_mul(tmp, ftmp3, ftmp4);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  845|     22|    felem_reduce(ftmp3, tmp);   /* 2^521 - 2^2 */
  846|     22|    felem_mul(tmp, ftmp3, in);
  ------------------
  |  |  726|     22|# define felem_mul felem_mul_ref
  ------------------
  847|     22|    felem_reduce(out, tmp);     /* 2^521 - 3 */
  848|     22|}
ecp_nistp521.c:felem_assign:
  220|  76.5k|{
  221|  76.5k|    out[0] = in[0];
  222|  76.5k|    out[1] = in[1];
  223|  76.5k|    out[2] = in[2];
  224|  76.5k|    out[3] = in[3];
  225|  76.5k|    out[4] = in[4];
  226|  76.5k|    out[5] = in[5];
  227|  76.5k|    out[6] = in[6];
  228|  76.5k|    out[7] = in[7];
  229|  76.5k|    out[8] = in[8];
  230|  76.5k|}
ecp_nistp521.c:felem_square_ref:
  405|  52.0k|{
  406|  52.0k|    felem inx2, inx4;
  407|  52.0k|    felem_scalar(inx2, in, 2);
  408|  52.0k|    felem_scalar(inx4, in, 4);
  409|       |
  410|       |    /*-
  411|       |     * We have many cases were we want to do
  412|       |     *   in[x] * in[y] +
  413|       |     *   in[y] * in[x]
  414|       |     * This is obviously just
  415|       |     *   2 * in[x] * in[y]
  416|       |     * However, rather than do the doubling on the 128 bit result, we
  417|       |     * double one of the inputs to the multiplication by reading from
  418|       |     * |inx2|
  419|       |     */
  420|       |
  421|  52.0k|    out[0] = ((uint128_t) in[0]) * in[0];
  422|  52.0k|    out[1] = ((uint128_t) in[0]) * inx2[1];
  423|  52.0k|    out[2] = ((uint128_t) in[0]) * inx2[2] + ((uint128_t) in[1]) * in[1];
  424|  52.0k|    out[3] = ((uint128_t) in[0]) * inx2[3] + ((uint128_t) in[1]) * inx2[2];
  425|  52.0k|    out[4] = ((uint128_t) in[0]) * inx2[4] +
  426|  52.0k|             ((uint128_t) in[1]) * inx2[3] + ((uint128_t) in[2]) * in[2];
  427|  52.0k|    out[5] = ((uint128_t) in[0]) * inx2[5] +
  428|  52.0k|             ((uint128_t) in[1]) * inx2[4] + ((uint128_t) in[2]) * inx2[3];
  429|  52.0k|    out[6] = ((uint128_t) in[0]) * inx2[6] +
  430|  52.0k|             ((uint128_t) in[1]) * inx2[5] +
  431|  52.0k|             ((uint128_t) in[2]) * inx2[4] + ((uint128_t) in[3]) * in[3];
  432|  52.0k|    out[7] = ((uint128_t) in[0]) * inx2[7] +
  433|  52.0k|             ((uint128_t) in[1]) * inx2[6] +
  434|  52.0k|             ((uint128_t) in[2]) * inx2[5] + ((uint128_t) in[3]) * inx2[4];
  435|  52.0k|    out[8] = ((uint128_t) in[0]) * inx2[8] +
  436|  52.0k|             ((uint128_t) in[1]) * inx2[7] +
  437|  52.0k|             ((uint128_t) in[2]) * inx2[6] +
  438|  52.0k|             ((uint128_t) in[3]) * inx2[5] + ((uint128_t) in[4]) * in[4];
  439|       |
  440|       |    /*
  441|       |     * The remaining limbs fall above 2^521, with the first falling at 2^522.
  442|       |     * They correspond to locations one bit up from the limbs produced above
  443|       |     * so we would have to multiply by two to align them. Again, rather than
  444|       |     * operate on the 128-bit result, we double one of the inputs to the
  445|       |     * multiplication. If we want to double for both this reason, and the
  446|       |     * reason above, then we end up multiplying by four.
  447|       |     */
  448|       |
  449|       |    /* 9 */
  450|  52.0k|    out[0] += ((uint128_t) in[1]) * inx4[8] +
  451|  52.0k|              ((uint128_t) in[2]) * inx4[7] +
  452|  52.0k|              ((uint128_t) in[3]) * inx4[6] + ((uint128_t) in[4]) * inx4[5];
  453|       |
  454|       |    /* 10 */
  455|  52.0k|    out[1] += ((uint128_t) in[2]) * inx4[8] +
  456|  52.0k|              ((uint128_t) in[3]) * inx4[7] +
  457|  52.0k|              ((uint128_t) in[4]) * inx4[6] + ((uint128_t) in[5]) * inx2[5];
  458|       |
  459|       |    /* 11 */
  460|  52.0k|    out[2] += ((uint128_t) in[3]) * inx4[8] +
  461|  52.0k|              ((uint128_t) in[4]) * inx4[7] + ((uint128_t) in[5]) * inx4[6];
  462|       |
  463|       |    /* 12 */
  464|  52.0k|    out[3] += ((uint128_t) in[4]) * inx4[8] +
  465|  52.0k|              ((uint128_t) in[5]) * inx4[7] + ((uint128_t) in[6]) * inx2[6];
  466|       |
  467|       |    /* 13 */
  468|  52.0k|    out[4] += ((uint128_t) in[5]) * inx4[8] + ((uint128_t) in[6]) * inx4[7];
  469|       |
  470|       |    /* 14 */
  471|  52.0k|    out[5] += ((uint128_t) in[6]) * inx4[8] + ((uint128_t) in[7]) * inx2[7];
  472|       |
  473|       |    /* 15 */
  474|  52.0k|    out[6] += ((uint128_t) in[7]) * inx4[8];
  475|       |
  476|       |    /* 16 */
  477|  52.0k|    out[7] += ((uint128_t) in[8]) * inx2[8];
  478|  52.0k|}
ecp_nistp521.c:felem_scalar:
  248|   165k|{
  249|   165k|    out[0] = in[0] * scalar;
  250|   165k|    out[1] = in[1] * scalar;
  251|   165k|    out[2] = in[2] * scalar;
  252|   165k|    out[3] = in[3] * scalar;
  253|   165k|    out[4] = in[4] * scalar;
  254|   165k|    out[5] = in[5] * scalar;
  255|   165k|    out[6] = in[6] * scalar;
  256|   165k|    out[7] = in[7] * scalar;
  257|   165k|    out[8] = in[8] * scalar;
  258|   165k|}
ecp_nistp521.c:felem_reduce:
  604|  98.0k|{
  605|  98.0k|    u64 overflow1, overflow2;
  606|       |
  607|  98.0k|    out[0] = ((limb) in[0]) & bottom58bits;
  608|  98.0k|    out[1] = ((limb) in[1]) & bottom58bits;
  609|  98.0k|    out[2] = ((limb) in[2]) & bottom58bits;
  610|  98.0k|    out[3] = ((limb) in[3]) & bottom58bits;
  611|  98.0k|    out[4] = ((limb) in[4]) & bottom58bits;
  612|  98.0k|    out[5] = ((limb) in[5]) & bottom58bits;
  613|  98.0k|    out[6] = ((limb) in[6]) & bottom58bits;
  614|  98.0k|    out[7] = ((limb) in[7]) & bottom58bits;
  615|  98.0k|    out[8] = ((limb) in[8]) & bottom58bits;
  616|       |
  617|       |    /* out[i] < 2^58 */
  618|       |
  619|  98.0k|    out[1] += ((limb) in[0]) >> 58;
  620|  98.0k|    out[1] += (((limb) (in[0] >> 64)) & bottom52bits) << 6;
  621|       |    /*-
  622|       |     * out[1] < 2^58 + 2^6 + 2^58
  623|       |     *        = 2^59 + 2^6
  624|       |     */
  625|  98.0k|    out[2] += ((limb) (in[0] >> 64)) >> 52;
  626|       |
  627|  98.0k|    out[2] += ((limb) in[1]) >> 58;
  628|  98.0k|    out[2] += (((limb) (in[1] >> 64)) & bottom52bits) << 6;
  629|  98.0k|    out[3] += ((limb) (in[1] >> 64)) >> 52;
  630|       |
  631|  98.0k|    out[3] += ((limb) in[2]) >> 58;
  632|  98.0k|    out[3] += (((limb) (in[2] >> 64)) & bottom52bits) << 6;
  633|  98.0k|    out[4] += ((limb) (in[2] >> 64)) >> 52;
  634|       |
  635|  98.0k|    out[4] += ((limb) in[3]) >> 58;
  636|  98.0k|    out[4] += (((limb) (in[3] >> 64)) & bottom52bits) << 6;
  637|  98.0k|    out[5] += ((limb) (in[3] >> 64)) >> 52;
  638|       |
  639|  98.0k|    out[5] += ((limb) in[4]) >> 58;
  640|  98.0k|    out[5] += (((limb) (in[4] >> 64)) & bottom52bits) << 6;
  641|  98.0k|    out[6] += ((limb) (in[4] >> 64)) >> 52;
  642|       |
  643|  98.0k|    out[6] += ((limb) in[5]) >> 58;
  644|  98.0k|    out[6] += (((limb) (in[5] >> 64)) & bottom52bits) << 6;
  645|  98.0k|    out[7] += ((limb) (in[5] >> 64)) >> 52;
  646|       |
  647|  98.0k|    out[7] += ((limb) in[6]) >> 58;
  648|  98.0k|    out[7] += (((limb) (in[6] >> 64)) & bottom52bits) << 6;
  649|  98.0k|    out[8] += ((limb) (in[6] >> 64)) >> 52;
  650|       |
  651|  98.0k|    out[8] += ((limb) in[7]) >> 58;
  652|  98.0k|    out[8] += (((limb) (in[7] >> 64)) & bottom52bits) << 6;
  653|       |    /*-
  654|       |     * out[x > 1] < 2^58 + 2^6 + 2^58 + 2^12
  655|       |     *            < 2^59 + 2^13
  656|       |     */
  657|  98.0k|    overflow1 = ((limb) (in[7] >> 64)) >> 52;
  658|       |
  659|  98.0k|    overflow1 += ((limb) in[8]) >> 58;
  660|  98.0k|    overflow1 += (((limb) (in[8] >> 64)) & bottom52bits) << 6;
  661|  98.0k|    overflow2 = ((limb) (in[8] >> 64)) >> 52;
  662|       |
  663|  98.0k|    overflow1 <<= 1;            /* overflow1 < 2^13 + 2^7 + 2^59 */
  664|  98.0k|    overflow2 <<= 1;            /* overflow2 < 2^13 */
  665|       |
  666|  98.0k|    out[0] += overflow1;        /* out[0] < 2^60 */
  667|  98.0k|    out[1] += overflow2;        /* out[1] < 2^59 + 2^6 + 2^13 */
  668|       |
  669|  98.0k|    out[1] += out[0] >> 58;
  670|  98.0k|    out[0] &= bottom58bits;
  671|       |    /*-
  672|       |     * out[0] < 2^58
  673|       |     * out[1] < 2^59 + 2^6 + 2^13 + 2^2
  674|       |     *        < 2^59 + 2^14
  675|       |     */
  676|  98.0k|}
ecp_nistp521.c:felem_mul_ref:
  489|  56.1k|{
  490|  56.1k|    felem in2x2;
  491|  56.1k|    felem_scalar(in2x2, in2, 2);
  492|       |
  493|  56.1k|    out[0] = ((uint128_t) in1[0]) * in2[0];
  494|       |
  495|  56.1k|    out[1] = ((uint128_t) in1[0]) * in2[1] +
  496|  56.1k|             ((uint128_t) in1[1]) * in2[0];
  497|       |
  498|  56.1k|    out[2] = ((uint128_t) in1[0]) * in2[2] +
  499|  56.1k|             ((uint128_t) in1[1]) * in2[1] +
  500|  56.1k|             ((uint128_t) in1[2]) * in2[0];
  501|       |
  502|  56.1k|    out[3] = ((uint128_t) in1[0]) * in2[3] +
  503|  56.1k|             ((uint128_t) in1[1]) * in2[2] +
  504|  56.1k|             ((uint128_t) in1[2]) * in2[1] +
  505|  56.1k|             ((uint128_t) in1[3]) * in2[0];
  506|       |
  507|  56.1k|    out[4] = ((uint128_t) in1[0]) * in2[4] +
  508|  56.1k|             ((uint128_t) in1[1]) * in2[3] +
  509|  56.1k|             ((uint128_t) in1[2]) * in2[2] +
  510|  56.1k|             ((uint128_t) in1[3]) * in2[1] +
  511|  56.1k|             ((uint128_t) in1[4]) * in2[0];
  512|       |
  513|  56.1k|    out[5] = ((uint128_t) in1[0]) * in2[5] +
  514|  56.1k|             ((uint128_t) in1[1]) * in2[4] +
  515|  56.1k|             ((uint128_t) in1[2]) * in2[3] +
  516|  56.1k|             ((uint128_t) in1[3]) * in2[2] +
  517|  56.1k|             ((uint128_t) in1[4]) * in2[1] +
  518|  56.1k|             ((uint128_t) in1[5]) * in2[0];
  519|       |
  520|  56.1k|    out[6] = ((uint128_t) in1[0]) * in2[6] +
  521|  56.1k|             ((uint128_t) in1[1]) * in2[5] +
  522|  56.1k|             ((uint128_t) in1[2]) * in2[4] +
  523|  56.1k|             ((uint128_t) in1[3]) * in2[3] +
  524|  56.1k|             ((uint128_t) in1[4]) * in2[2] +
  525|  56.1k|             ((uint128_t) in1[5]) * in2[1] +
  526|  56.1k|             ((uint128_t) in1[6]) * in2[0];
  527|       |
  528|  56.1k|    out[7] = ((uint128_t) in1[0]) * in2[7] +
  529|  56.1k|             ((uint128_t) in1[1]) * in2[6] +
  530|  56.1k|             ((uint128_t) in1[2]) * in2[5] +
  531|  56.1k|             ((uint128_t) in1[3]) * in2[4] +
  532|  56.1k|             ((uint128_t) in1[4]) * in2[3] +
  533|  56.1k|             ((uint128_t) in1[5]) * in2[2] +
  534|  56.1k|             ((uint128_t) in1[6]) * in2[1] +
  535|  56.1k|             ((uint128_t) in1[7]) * in2[0];
  536|       |
  537|  56.1k|    out[8] = ((uint128_t) in1[0]) * in2[8] +
  538|  56.1k|             ((uint128_t) in1[1]) * in2[7] +
  539|  56.1k|             ((uint128_t) in1[2]) * in2[6] +
  540|  56.1k|             ((uint128_t) in1[3]) * in2[5] +
  541|  56.1k|             ((uint128_t) in1[4]) * in2[4] +
  542|  56.1k|             ((uint128_t) in1[5]) * in2[3] +
  543|  56.1k|             ((uint128_t) in1[6]) * in2[2] +
  544|  56.1k|             ((uint128_t) in1[7]) * in2[1] +
  545|  56.1k|             ((uint128_t) in1[8]) * in2[0];
  546|       |
  547|       |    /* See comment in felem_square about the use of in2x2 here */
  548|       |
  549|  56.1k|    out[0] += ((uint128_t) in1[1]) * in2x2[8] +
  550|  56.1k|              ((uint128_t) in1[2]) * in2x2[7] +
  551|  56.1k|              ((uint128_t) in1[3]) * in2x2[6] +
  552|  56.1k|              ((uint128_t) in1[4]) * in2x2[5] +
  553|  56.1k|              ((uint128_t) in1[5]) * in2x2[4] +
  554|  56.1k|              ((uint128_t) in1[6]) * in2x2[3] +
  555|  56.1k|              ((uint128_t) in1[7]) * in2x2[2] +
  556|  56.1k|              ((uint128_t) in1[8]) * in2x2[1];
  557|       |
  558|  56.1k|    out[1] += ((uint128_t) in1[2]) * in2x2[8] +
  559|  56.1k|              ((uint128_t) in1[3]) * in2x2[7] +
  560|  56.1k|              ((uint128_t) in1[4]) * in2x2[6] +
  561|  56.1k|              ((uint128_t) in1[5]) * in2x2[5] +
  562|  56.1k|              ((uint128_t) in1[6]) * in2x2[4] +
  563|  56.1k|              ((uint128_t) in1[7]) * in2x2[3] +
  564|  56.1k|              ((uint128_t) in1[8]) * in2x2[2];
  565|       |
  566|  56.1k|    out[2] += ((uint128_t) in1[3]) * in2x2[8] +
  567|  56.1k|              ((uint128_t) in1[4]) * in2x2[7] +
  568|  56.1k|              ((uint128_t) in1[5]) * in2x2[6] +
  569|  56.1k|              ((uint128_t) in1[6]) * in2x2[5] +
  570|  56.1k|              ((uint128_t) in1[7]) * in2x2[4] +
  571|  56.1k|              ((uint128_t) in1[8]) * in2x2[3];
  572|       |
  573|  56.1k|    out[3] += ((uint128_t) in1[4]) * in2x2[8] +
  574|  56.1k|              ((uint128_t) in1[5]) * in2x2[7] +
  575|  56.1k|              ((uint128_t) in1[6]) * in2x2[6] +
  576|  56.1k|              ((uint128_t) in1[7]) * in2x2[5] +
  577|  56.1k|              ((uint128_t) in1[8]) * in2x2[4];
  578|       |
  579|  56.1k|    out[4] += ((uint128_t) in1[5]) * in2x2[8] +
  580|  56.1k|              ((uint128_t) in1[6]) * in2x2[7] +
  581|  56.1k|              ((uint128_t) in1[7]) * in2x2[6] +
  582|  56.1k|              ((uint128_t) in1[8]) * in2x2[5];
  583|       |
  584|  56.1k|    out[5] += ((uint128_t) in1[6]) * in2x2[8] +
  585|  56.1k|              ((uint128_t) in1[7]) * in2x2[7] +
  586|  56.1k|              ((uint128_t) in1[8]) * in2x2[6];
  587|       |
  588|  56.1k|    out[6] += ((uint128_t) in1[7]) * in2x2[8] +
  589|  56.1k|              ((uint128_t) in1[8]) * in2x2[7];
  590|       |
  591|  56.1k|    out[7] += ((uint128_t) in1[8]) * in2x2[8];
  592|  56.1k|}
ecp_nistp521.c:felem_contract:
  942|    161|{
  943|    161|    limb is_p, is_greater, sign;
  944|    161|    static const limb two58 = ((limb) 1) << 58;
  945|       |
  946|    161|    felem_assign(out, in);
  947|       |
  948|    161|    out[0] += out[8] >> 57;
  949|    161|    out[8] &= bottom57bits;
  950|       |    /* out[8] < 2^57 */
  951|    161|    out[1] += out[0] >> 58;
  952|    161|    out[0] &= bottom58bits;
  953|    161|    out[2] += out[1] >> 58;
  954|    161|    out[1] &= bottom58bits;
  955|    161|    out[3] += out[2] >> 58;
  956|    161|    out[2] &= bottom58bits;
  957|    161|    out[4] += out[3] >> 58;
  958|    161|    out[3] &= bottom58bits;
  959|    161|    out[5] += out[4] >> 58;
  960|    161|    out[4] &= bottom58bits;
  961|    161|    out[6] += out[5] >> 58;
  962|    161|    out[5] &= bottom58bits;
  963|    161|    out[7] += out[6] >> 58;
  964|    161|    out[6] &= bottom58bits;
  965|    161|    out[8] += out[7] >> 58;
  966|    161|    out[7] &= bottom58bits;
  967|       |    /* out[8] < 2^57 + 4 */
  968|       |
  969|       |    /*
  970|       |     * If the value is greater than 2^521-1 then we have to subtract 2^521-1
  971|       |     * out. See the comments in felem_is_zero regarding why we don't test for
  972|       |     * other multiples of the prime.
  973|       |     */
  974|       |
  975|       |    /*
  976|       |     * First, if |out| is equal to 2^521-1, we subtract it out to get zero.
  977|       |     */
  978|       |
  979|    161|    is_p = out[0] ^ kPrime[0];
  980|    161|    is_p |= out[1] ^ kPrime[1];
  981|    161|    is_p |= out[2] ^ kPrime[2];
  982|    161|    is_p |= out[3] ^ kPrime[3];
  983|    161|    is_p |= out[4] ^ kPrime[4];
  984|    161|    is_p |= out[5] ^ kPrime[5];
  985|    161|    is_p |= out[6] ^ kPrime[6];
  986|    161|    is_p |= out[7] ^ kPrime[7];
  987|    161|    is_p |= out[8] ^ kPrime[8];
  988|       |
  989|    161|    is_p--;
  990|    161|    is_p &= is_p << 32;
  991|    161|    is_p &= is_p << 16;
  992|    161|    is_p &= is_p << 8;
  993|    161|    is_p &= is_p << 4;
  994|    161|    is_p &= is_p << 2;
  995|    161|    is_p &= is_p << 1;
  996|    161|    is_p = 0 - (is_p >> 63);
  997|    161|    is_p = ~is_p;
  998|       |
  999|       |    /* is_p is 0 iff |out| == 2^521-1 and all ones otherwise */
 1000|       |
 1001|    161|    out[0] &= is_p;
 1002|    161|    out[1] &= is_p;
 1003|    161|    out[2] &= is_p;
 1004|    161|    out[3] &= is_p;
 1005|    161|    out[4] &= is_p;
 1006|    161|    out[5] &= is_p;
 1007|    161|    out[6] &= is_p;
 1008|    161|    out[7] &= is_p;
 1009|    161|    out[8] &= is_p;
 1010|       |
 1011|       |    /*
 1012|       |     * In order to test that |out| >= 2^521-1 we need only test if out[8] >>
 1013|       |     * 57 is greater than zero as (2^521-1) + x >= 2^522
 1014|       |     */
 1015|    161|    is_greater = out[8] >> 57;
 1016|    161|    is_greater |= is_greater << 32;
 1017|    161|    is_greater |= is_greater << 16;
 1018|    161|    is_greater |= is_greater << 8;
 1019|    161|    is_greater |= is_greater << 4;
 1020|    161|    is_greater |= is_greater << 2;
 1021|    161|    is_greater |= is_greater << 1;
 1022|    161|    is_greater = 0 - (is_greater >> 63);
 1023|       |
 1024|    161|    out[0] -= kPrime[0] & is_greater;
 1025|    161|    out[1] -= kPrime[1] & is_greater;
 1026|    161|    out[2] -= kPrime[2] & is_greater;
 1027|    161|    out[3] -= kPrime[3] & is_greater;
 1028|    161|    out[4] -= kPrime[4] & is_greater;
 1029|    161|    out[5] -= kPrime[5] & is_greater;
 1030|    161|    out[6] -= kPrime[6] & is_greater;
 1031|    161|    out[7] -= kPrime[7] & is_greater;
 1032|    161|    out[8] -= kPrime[8] & is_greater;
 1033|       |
 1034|       |    /* Eliminate negative coefficients */
 1035|    161|    sign = -(out[0] >> 63);
 1036|    161|    out[0] += (two58 & sign);
 1037|    161|    out[1] -= (1 & sign);
 1038|    161|    sign = -(out[1] >> 63);
 1039|    161|    out[1] += (two58 & sign);
 1040|    161|    out[2] -= (1 & sign);
 1041|    161|    sign = -(out[2] >> 63);
 1042|    161|    out[2] += (two58 & sign);
 1043|    161|    out[3] -= (1 & sign);
 1044|    161|    sign = -(out[3] >> 63);
 1045|    161|    out[3] += (two58 & sign);
 1046|    161|    out[4] -= (1 & sign);
 1047|    161|    sign = -(out[4] >> 63);
 1048|    161|    out[4] += (two58 & sign);
 1049|    161|    out[5] -= (1 & sign);
 1050|    161|    sign = -(out[0] >> 63);
 1051|    161|    out[5] += (two58 & sign);
 1052|    161|    out[6] -= (1 & sign);
 1053|    161|    sign = -(out[6] >> 63);
 1054|    161|    out[6] += (two58 & sign);
 1055|    161|    out[7] -= (1 & sign);
 1056|    161|    sign = -(out[7] >> 63);
 1057|    161|    out[7] += (two58 & sign);
 1058|    161|    out[8] -= (1 & sign);
 1059|    161|    sign = -(out[5] >> 63);
 1060|    161|    out[5] += (two58 & sign);
 1061|    161|    out[6] -= (1 & sign);
 1062|    161|    sign = -(out[6] >> 63);
 1063|    161|    out[6] += (two58 & sign);
 1064|    161|    out[7] -= (1 & sign);
 1065|    161|    sign = -(out[7] >> 63);
 1066|    161|    out[7] += (two58 & sign);
 1067|    161|    out[8] -= (1 & sign);
 1068|    161|}
ecp_nistp521.c:felem_to_BN:
  195|    278|{
  196|    278|    felem_bytearray b_out;
  197|    278|    felem_to_bin66(b_out, in);
  198|    278|    return BN_lebin2bn(b_out, sizeof(b_out), out);
  199|    278|}
ecp_nistp521.c:felem_to_bin66:
  161|    278|{
  162|    278|    memset(out, 0, 66);
  163|    278|    (*((limb *) & out[0])) = in[0];
  164|    278|    (*((limb_aX *) & out[7])) |= in[1] << 2;
  165|    278|    (*((limb_aX *) & out[14])) |= in[2] << 4;
  166|    278|    (*((limb_aX *) & out[21])) |= in[3] << 6;
  167|    278|    (*((limb_aX *) & out[29])) = in[4];
  168|    278|    (*((limb_aX *) & out[36])) |= in[5] << 2;
  169|    278|    (*((limb_aX *) & out[43])) |= in[6] << 4;
  170|    278|    (*((limb_aX *) & out[50])) |= in[7] << 6;
  171|    278|    (*((limb_aX *) & out[58])) = in[8];
  172|    278|}
ecp_nistp521.c:point_add:
 1209|  5.07k|{
 1210|  5.07k|    felem ftmp, ftmp2, ftmp3, ftmp4, ftmp5, ftmp6, x_out, y_out, z_out;
 1211|  5.07k|    largefelem tmp, tmp2;
 1212|  5.07k|    limb x_equal, y_equal, z1_is_zero, z2_is_zero;
 1213|  5.07k|    limb points_equal;
 1214|       |
 1215|  5.07k|    z1_is_zero = felem_is_zero(z1);
 1216|  5.07k|    z2_is_zero = felem_is_zero(z2);
 1217|       |
 1218|       |    /* ftmp = z1z1 = z1**2 */
 1219|  5.07k|    felem_square(tmp, z1);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1220|  5.07k|    felem_reduce(ftmp, tmp);
 1221|       |
 1222|  5.07k|    if (!mixed) {
  ------------------
  |  Branch (1222:9): [True: 0, False: 5.07k]
  ------------------
 1223|       |        /* ftmp2 = z2z2 = z2**2 */
 1224|      0|        felem_square(tmp, z2);
  ------------------
  |  |  725|      0|# define felem_square felem_square_ref
  ------------------
 1225|      0|        felem_reduce(ftmp2, tmp);
 1226|       |
 1227|       |        /* u1 = ftmp3 = x1*z2z2 */
 1228|      0|        felem_mul(tmp, x1, ftmp2);
  ------------------
  |  |  726|      0|# define felem_mul felem_mul_ref
  ------------------
 1229|      0|        felem_reduce(ftmp3, tmp);
 1230|       |
 1231|       |        /* ftmp5 = z1 + z2 */
 1232|      0|        felem_assign(ftmp5, z1);
 1233|      0|        felem_sum64(ftmp5, z2);
 1234|       |        /* ftmp5[i] < 2^61 */
 1235|       |
 1236|       |        /* ftmp5 = (z1 + z2)**2 - z1z1 - z2z2 = 2*z1z2 */
 1237|      0|        felem_square(tmp, ftmp5);
  ------------------
  |  |  725|      0|# define felem_square felem_square_ref
  ------------------
 1238|       |        /* tmp[i] < 17*2^122 */
 1239|      0|        felem_diff_128_64(tmp, ftmp);
 1240|       |        /* tmp[i] < 17*2^122 + 2^63 */
 1241|      0|        felem_diff_128_64(tmp, ftmp2);
 1242|       |        /* tmp[i] < 17*2^122 + 2^64 */
 1243|      0|        felem_reduce(ftmp5, tmp);
 1244|       |
 1245|       |        /* ftmp2 = z2 * z2z2 */
 1246|      0|        felem_mul(tmp, ftmp2, z2);
  ------------------
  |  |  726|      0|# define felem_mul felem_mul_ref
  ------------------
 1247|      0|        felem_reduce(ftmp2, tmp);
 1248|       |
 1249|       |        /* s1 = ftmp6 = y1 * z2**3 */
 1250|      0|        felem_mul(tmp, y1, ftmp2);
  ------------------
  |  |  726|      0|# define felem_mul felem_mul_ref
  ------------------
 1251|      0|        felem_reduce(ftmp6, tmp);
 1252|  5.07k|    } else {
 1253|       |        /*
 1254|       |         * We'll assume z2 = 1 (special case z2 = 0 is handled later)
 1255|       |         */
 1256|       |
 1257|       |        /* u1 = ftmp3 = x1*z2z2 */
 1258|  5.07k|        felem_assign(ftmp3, x1);
 1259|       |
 1260|       |        /* ftmp5 = 2*z1z2 */
 1261|  5.07k|        felem_scalar(ftmp5, z1, 2);
 1262|       |
 1263|       |        /* s1 = ftmp6 = y1 * z2**3 */
 1264|  5.07k|        felem_assign(ftmp6, y1);
 1265|  5.07k|    }
 1266|       |
 1267|       |    /* u2 = x2*z1z1 */
 1268|  5.07k|    felem_mul(tmp, x2, ftmp);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1269|       |    /* tmp[i] < 17*2^120 */
 1270|       |
 1271|       |    /* h = ftmp4 = u2 - u1 */
 1272|  5.07k|    felem_diff_128_64(tmp, ftmp3);
 1273|       |    /* tmp[i] < 17*2^120 + 2^63 */
 1274|  5.07k|    felem_reduce(ftmp4, tmp);
 1275|       |
 1276|  5.07k|    x_equal = felem_is_zero(ftmp4);
 1277|       |
 1278|       |    /* z_out = ftmp5 * h */
 1279|  5.07k|    felem_mul(tmp, ftmp5, ftmp4);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1280|  5.07k|    felem_reduce(z_out, tmp);
 1281|       |
 1282|       |    /* ftmp = z1 * z1z1 */
 1283|  5.07k|    felem_mul(tmp, ftmp, z1);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1284|  5.07k|    felem_reduce(ftmp, tmp);
 1285|       |
 1286|       |    /* s2 = tmp = y2 * z1**3 */
 1287|  5.07k|    felem_mul(tmp, y2, ftmp);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1288|       |    /* tmp[i] < 17*2^120 */
 1289|       |
 1290|       |    /* r = ftmp5 = (s2 - s1)*2 */
 1291|  5.07k|    felem_diff_128_64(tmp, ftmp6);
 1292|       |    /* tmp[i] < 17*2^120 + 2^63 */
 1293|  5.07k|    felem_reduce(ftmp5, tmp);
 1294|  5.07k|    y_equal = felem_is_zero(ftmp5);
 1295|  5.07k|    felem_scalar64(ftmp5, 2);
 1296|       |    /* ftmp5[i] < 2^61 */
 1297|       |
 1298|       |    /*
 1299|       |     * The formulae are incorrect if the points are equal, in affine coordinates
 1300|       |     * (X_1, Y_1) == (X_2, Y_2), so we check for this and do doubling if this
 1301|       |     * happens.
 1302|       |     *
 1303|       |     * We use bitwise operations to avoid potential side-channels introduced by
 1304|       |     * the short-circuiting behaviour of boolean operators.
 1305|       |     *
 1306|       |     * The special case of either point being the point at infinity (z1 and/or
 1307|       |     * z2 are zero), is handled separately later on in this function, so we
 1308|       |     * avoid jumping to point_double here in those special cases.
 1309|       |     *
 1310|       |     * Notice the comment below on the implications of this branching for timing
 1311|       |     * leaks and why it is considered practically irrelevant.
 1312|       |     */
 1313|  5.07k|    points_equal = (x_equal & y_equal & (~z1_is_zero) & (~z2_is_zero));
 1314|       |
 1315|  5.07k|    if (points_equal) {
  ------------------
  |  Branch (1315:9): [True: 0, False: 5.07k]
  ------------------
 1316|       |        /*
 1317|       |         * This is obviously not constant-time but it will almost-never happen
 1318|       |         * for ECDH / ECDSA. The case where it can happen is during scalar-mult
 1319|       |         * where the intermediate value gets very close to the group order.
 1320|       |         * Since |ossl_ec_GFp_nistp_recode_scalar_bits| produces signed digits
 1321|       |         * for the scalar, it's possible for the intermediate value to be a small
 1322|       |         * negative multiple of the base point, and for the final signed digit
 1323|       |         * to be the same value. We believe that this only occurs for the scalar
 1324|       |         * 1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 1325|       |         * ffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb
 1326|       |         * 71e913863f7, in that case the penultimate intermediate is -9G and
 1327|       |         * the final digit is also -9G. Since this only happens for a single
 1328|       |         * scalar, the timing leak is irrelevant. (Any attacker who wanted to
 1329|       |         * check whether a secret scalar was that exact value, can already do
 1330|       |         * so.)
 1331|       |         */
 1332|      0|        point_double(x3, y3, z3, x1, y1, z1);
 1333|      0|        return;
 1334|      0|    }
 1335|       |
 1336|       |    /* I = ftmp = (2h)**2 */
 1337|  5.07k|    felem_assign(ftmp, ftmp4);
 1338|  5.07k|    felem_scalar64(ftmp, 2);
 1339|       |    /* ftmp[i] < 2^61 */
 1340|  5.07k|    felem_square(tmp, ftmp);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1341|       |    /* tmp[i] < 17*2^122 */
 1342|  5.07k|    felem_reduce(ftmp, tmp);
 1343|       |
 1344|       |    /* J = ftmp2 = h * I */
 1345|  5.07k|    felem_mul(tmp, ftmp4, ftmp);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1346|  5.07k|    felem_reduce(ftmp2, tmp);
 1347|       |
 1348|       |    /* V = ftmp4 = U1 * I */
 1349|  5.07k|    felem_mul(tmp, ftmp3, ftmp);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1350|  5.07k|    felem_reduce(ftmp4, tmp);
 1351|       |
 1352|       |    /* x_out = r**2 - J - 2V */
 1353|  5.07k|    felem_square(tmp, ftmp5);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1354|       |    /* tmp[i] < 17*2^122 */
 1355|  5.07k|    felem_diff_128_64(tmp, ftmp2);
 1356|       |    /* tmp[i] < 17*2^122 + 2^63 */
 1357|  5.07k|    felem_assign(ftmp3, ftmp4);
 1358|  5.07k|    felem_scalar64(ftmp4, 2);
 1359|       |    /* ftmp4[i] < 2^61 */
 1360|  5.07k|    felem_diff_128_64(tmp, ftmp4);
 1361|       |    /* tmp[i] < 17*2^122 + 2^64 */
 1362|  5.07k|    felem_reduce(x_out, tmp);
 1363|       |
 1364|       |    /* y_out = r(V-x_out) - 2 * s1 * J */
 1365|  5.07k|    felem_diff64(ftmp3, x_out);
 1366|       |    /*
 1367|       |     * ftmp3[i] < 2^60 + 2^60 = 2^61
 1368|       |     */
 1369|  5.07k|    felem_mul(tmp, ftmp5, ftmp3);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1370|       |    /* tmp[i] < 17*2^122 */
 1371|  5.07k|    felem_mul(tmp2, ftmp6, ftmp2);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1372|       |    /* tmp2[i] < 17*2^120 */
 1373|  5.07k|    felem_scalar128(tmp2, 2);
 1374|       |    /* tmp2[i] < 17*2^121 */
 1375|  5.07k|    felem_diff128(tmp, tmp2);
 1376|       |        /*-
 1377|       |         * tmp[i] < 2^127 - 2^69 + 17*2^122
 1378|       |         *        = 2^126 - 2^122 - 2^6 - 2^2 - 1
 1379|       |         *        < 2^127
 1380|       |         */
 1381|  5.07k|    felem_reduce(y_out, tmp);
 1382|       |
 1383|  5.07k|    copy_conditional(x_out, x2, z1_is_zero);
 1384|  5.07k|    copy_conditional(x_out, x1, z2_is_zero);
 1385|  5.07k|    copy_conditional(y_out, y2, z1_is_zero);
 1386|  5.07k|    copy_conditional(y_out, y1, z2_is_zero);
 1387|  5.07k|    copy_conditional(z_out, z2, z1_is_zero);
 1388|  5.07k|    copy_conditional(z_out, z1, z2_is_zero);
 1389|  5.07k|    felem_assign(x3, x_out);
 1390|  5.07k|    felem_assign(y3, y_out);
 1391|  5.07k|    felem_assign(z3, z_out);
 1392|  5.07k|}
ecp_nistp521.c:felem_is_zero:
  864|  20.2k|{
  865|  20.2k|    felem ftmp;
  866|  20.2k|    limb is_zero, is_p;
  867|  20.2k|    felem_assign(ftmp, in);
  868|       |
  869|  20.2k|    ftmp[0] += ftmp[8] >> 57;
  870|  20.2k|    ftmp[8] &= bottom57bits;
  871|       |    /* ftmp[8] < 2^57 */
  872|  20.2k|    ftmp[1] += ftmp[0] >> 58;
  873|  20.2k|    ftmp[0] &= bottom58bits;
  874|  20.2k|    ftmp[2] += ftmp[1] >> 58;
  875|  20.2k|    ftmp[1] &= bottom58bits;
  876|  20.2k|    ftmp[3] += ftmp[2] >> 58;
  877|  20.2k|    ftmp[2] &= bottom58bits;
  878|  20.2k|    ftmp[4] += ftmp[3] >> 58;
  879|  20.2k|    ftmp[3] &= bottom58bits;
  880|  20.2k|    ftmp[5] += ftmp[4] >> 58;
  881|  20.2k|    ftmp[4] &= bottom58bits;
  882|  20.2k|    ftmp[6] += ftmp[5] >> 58;
  883|  20.2k|    ftmp[5] &= bottom58bits;
  884|  20.2k|    ftmp[7] += ftmp[6] >> 58;
  885|  20.2k|    ftmp[6] &= bottom58bits;
  886|  20.2k|    ftmp[8] += ftmp[7] >> 58;
  887|  20.2k|    ftmp[7] &= bottom58bits;
  888|       |    /* ftmp[8] < 2^57 + 4 */
  889|       |
  890|       |    /*
  891|       |     * The ninth limb of 2*(2^521-1) is 0x03ffffffffffffff, which is greater
  892|       |     * than our bound for ftmp[8]. Therefore we only have to check if the
  893|       |     * zero is zero or 2^521-1.
  894|       |     */
  895|       |
  896|  20.2k|    is_zero = 0;
  897|  20.2k|    is_zero |= ftmp[0];
  898|  20.2k|    is_zero |= ftmp[1];
  899|  20.2k|    is_zero |= ftmp[2];
  900|  20.2k|    is_zero |= ftmp[3];
  901|  20.2k|    is_zero |= ftmp[4];
  902|  20.2k|    is_zero |= ftmp[5];
  903|  20.2k|    is_zero |= ftmp[6];
  904|  20.2k|    is_zero |= ftmp[7];
  905|  20.2k|    is_zero |= ftmp[8];
  906|       |
  907|  20.2k|    is_zero--;
  908|       |    /*
  909|       |     * We know that ftmp[i] < 2^63, therefore the only way that the top bit
  910|       |     * can be set is if is_zero was 0 before the decrement.
  911|       |     */
  912|  20.2k|    is_zero = 0 - (is_zero >> 63);
  913|       |
  914|  20.2k|    is_p = ftmp[0] ^ kPrime[0];
  915|  20.2k|    is_p |= ftmp[1] ^ kPrime[1];
  916|  20.2k|    is_p |= ftmp[2] ^ kPrime[2];
  917|  20.2k|    is_p |= ftmp[3] ^ kPrime[3];
  918|  20.2k|    is_p |= ftmp[4] ^ kPrime[4];
  919|  20.2k|    is_p |= ftmp[5] ^ kPrime[5];
  920|  20.2k|    is_p |= ftmp[6] ^ kPrime[6];
  921|  20.2k|    is_p |= ftmp[7] ^ kPrime[7];
  922|  20.2k|    is_p |= ftmp[8] ^ kPrime[8];
  923|       |
  924|  20.2k|    is_p--;
  925|  20.2k|    is_p = 0 - (is_p >> 63);
  926|       |
  927|  20.2k|    is_zero |= is_p;
  928|  20.2k|    return is_zero;
  929|  20.2k|}
ecp_nistp521.c:felem_sum64:
  234|  15.2k|{
  235|  15.2k|    out[0] += in[0];
  236|  15.2k|    out[1] += in[1];
  237|  15.2k|    out[2] += in[2];
  238|  15.2k|    out[3] += in[3];
  239|  15.2k|    out[4] += in[4];
  240|  15.2k|    out[5] += in[5];
  241|  15.2k|    out[6] += in[6];
  242|  15.2k|    out[7] += in[7];
  243|  15.2k|    out[8] += in[8];
  244|  15.2k|}
ecp_nistp521.c:felem_diff_128_64:
  346|  30.4k|{
  347|       |    /*
  348|       |     * In order to prevent underflow, we add 64p mod p (which is equivalent
  349|       |     * to 0 mod p) before subtracting. p is 2^521 - 1, i.e. in binary a 521
  350|       |     * digit number with all bits set to 1. See "The representation of field
  351|       |     * elements" comment above for a description of how limbs are used to
  352|       |     * represent a number. 64p is represented with 8 limbs containing a number
  353|       |     * with 58 bits set and one limb with a number with 57 bits set.
  354|       |     */
  355|  30.4k|    static const limb two63m6 = (((limb) 1) << 63) - (((limb) 1) << 6);
  356|  30.4k|    static const limb two63m5 = (((limb) 1) << 63) - (((limb) 1) << 5);
  357|       |
  358|  30.4k|    out[0] += two63m6 - in[0];
  359|  30.4k|    out[1] += two63m5 - in[1];
  360|  30.4k|    out[2] += two63m5 - in[2];
  361|  30.4k|    out[3] += two63m5 - in[3];
  362|  30.4k|    out[4] += two63m5 - in[4];
  363|  30.4k|    out[5] += two63m5 - in[5];
  364|  30.4k|    out[6] += two63m5 - in[6];
  365|  30.4k|    out[7] += two63m5 - in[7];
  366|  30.4k|    out[8] += two63m5 - in[8];
  367|  30.4k|}
ecp_nistp521.c:felem_scalar64:
  262|  30.4k|{
  263|  30.4k|    out[0] *= scalar;
  264|  30.4k|    out[1] *= scalar;
  265|  30.4k|    out[2] *= scalar;
  266|  30.4k|    out[3] *= scalar;
  267|  30.4k|    out[4] *= scalar;
  268|  30.4k|    out[5] *= scalar;
  269|  30.4k|    out[6] *= scalar;
  270|  30.4k|    out[7] *= scalar;
  271|  30.4k|    out[8] *= scalar;
  272|  30.4k|}
ecp_nistp521.c:felem_diff64:
  320|  15.2k|{
  321|       |    /*
  322|       |     * In order to prevent underflow, we add 0 mod p before subtracting.
  323|       |     */
  324|  15.2k|    static const limb two62m3 = (((limb) 1) << 62) - (((limb) 1) << 5);
  325|  15.2k|    static const limb two62m2 = (((limb) 1) << 62) - (((limb) 1) << 4);
  326|       |
  327|  15.2k|    out[0] += two62m3 - in[0];
  328|  15.2k|    out[1] += two62m2 - in[1];
  329|  15.2k|    out[2] += two62m2 - in[2];
  330|  15.2k|    out[3] += two62m2 - in[3];
  331|  15.2k|    out[4] += two62m2 - in[4];
  332|  15.2k|    out[5] += two62m2 - in[5];
  333|  15.2k|    out[6] += two62m2 - in[6];
  334|  15.2k|    out[7] += two62m2 - in[7];
  335|  15.2k|    out[8] += two62m2 - in[8];
  336|  15.2k|}
ecp_nistp521.c:felem_scalar128:
  276|  10.1k|{
  277|  10.1k|    out[0] *= scalar;
  278|  10.1k|    out[1] *= scalar;
  279|  10.1k|    out[2] *= scalar;
  280|  10.1k|    out[3] *= scalar;
  281|  10.1k|    out[4] *= scalar;
  282|  10.1k|    out[5] *= scalar;
  283|  10.1k|    out[6] *= scalar;
  284|  10.1k|    out[7] *= scalar;
  285|  10.1k|    out[8] *= scalar;
  286|  10.1k|}
ecp_nistp521.c:felem_diff128:
  377|  10.1k|{
  378|       |    /*
  379|       |     * In order to prevent underflow, we add 0 mod p before subtracting.
  380|       |     */
  381|  10.1k|    static const uint128_t two127m70 =
  382|  10.1k|        (((uint128_t) 1) << 127) - (((uint128_t) 1) << 70);
  383|  10.1k|    static const uint128_t two127m69 =
  384|  10.1k|        (((uint128_t) 1) << 127) - (((uint128_t) 1) << 69);
  385|       |
  386|  10.1k|    out[0] += (two127m70 - in[0]);
  387|  10.1k|    out[1] += (two127m69 - in[1]);
  388|  10.1k|    out[2] += (two127m69 - in[2]);
  389|  10.1k|    out[3] += (two127m69 - in[3]);
  390|  10.1k|    out[4] += (two127m69 - in[4]);
  391|  10.1k|    out[5] += (two127m69 - in[5]);
  392|  10.1k|    out[6] += (two127m69 - in[6]);
  393|  10.1k|    out[7] += (two127m69 - in[7]);
  394|  10.1k|    out[8] += (two127m69 - in[8]);
  395|  10.1k|}
ecp_nistp521.c:copy_conditional:
 1186|  30.4k|{
 1187|  30.4k|    unsigned i;
 1188|   304k|    for (i = 0; i < NLIMBS; ++i) {
  ------------------
  |  |  129|   304k|#define NLIMBS 9
  ------------------
  |  Branch (1188:17): [True: 273k, False: 30.4k]
  ------------------
 1189|   273k|        const limb tmp = mask & (in[i] ^ out[i]);
 1190|   273k|        out[i] ^= tmp;
 1191|   273k|    }
 1192|  30.4k|}
ecp_nistp521.c:point_double:
 1089|  5.07k|{
 1090|  5.07k|    largefelem tmp, tmp2;
 1091|  5.07k|    felem delta, gamma, beta, alpha, ftmp, ftmp2;
 1092|       |
 1093|  5.07k|    felem_assign(ftmp, x_in);
 1094|  5.07k|    felem_assign(ftmp2, x_in);
 1095|       |
 1096|       |    /* delta = z^2 */
 1097|  5.07k|    felem_square(tmp, z_in);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1098|  5.07k|    felem_reduce(delta, tmp);   /* delta[i] < 2^59 + 2^14 */
 1099|       |
 1100|       |    /* gamma = y^2 */
 1101|  5.07k|    felem_square(tmp, y_in);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1102|  5.07k|    felem_reduce(gamma, tmp);   /* gamma[i] < 2^59 + 2^14 */
 1103|       |
 1104|       |    /* beta = x*gamma */
 1105|  5.07k|    felem_mul(tmp, x_in, gamma);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1106|  5.07k|    felem_reduce(beta, tmp);    /* beta[i] < 2^59 + 2^14 */
 1107|       |
 1108|       |    /* alpha = 3*(x-delta)*(x+delta) */
 1109|  5.07k|    felem_diff64(ftmp, delta);
 1110|       |    /* ftmp[i] < 2^61 */
 1111|  5.07k|    felem_sum64(ftmp2, delta);
 1112|       |    /* ftmp2[i] < 2^60 + 2^15 */
 1113|  5.07k|    felem_scalar64(ftmp2, 3);
 1114|       |    /* ftmp2[i] < 3*2^60 + 3*2^15 */
 1115|  5.07k|    felem_mul(tmp, ftmp, ftmp2);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1116|       |    /*-
 1117|       |     * tmp[i] < 17(3*2^121 + 3*2^76)
 1118|       |     *        = 61*2^121 + 61*2^76
 1119|       |     *        < 64*2^121 + 64*2^76
 1120|       |     *        = 2^127 + 2^82
 1121|       |     *        < 2^128
 1122|       |     */
 1123|  5.07k|    felem_reduce(alpha, tmp);
 1124|       |
 1125|       |    /* x' = alpha^2 - 8*beta */
 1126|  5.07k|    felem_square(tmp, alpha);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1127|       |    /*
 1128|       |     * tmp[i] < 17*2^120 < 2^125
 1129|       |     */
 1130|  5.07k|    felem_assign(ftmp, beta);
 1131|  5.07k|    felem_scalar64(ftmp, 8);
 1132|       |    /* ftmp[i] < 2^62 + 2^17 */
 1133|  5.07k|    felem_diff_128_64(tmp, ftmp);
 1134|       |    /* tmp[i] < 2^125 + 2^63 + 2^62 + 2^17 */
 1135|  5.07k|    felem_reduce(x_out, tmp);
 1136|       |
 1137|       |    /* z' = (y + z)^2 - gamma - delta */
 1138|  5.07k|    felem_sum64(delta, gamma);
 1139|       |    /* delta[i] < 2^60 + 2^15 */
 1140|  5.07k|    felem_assign(ftmp, y_in);
 1141|  5.07k|    felem_sum64(ftmp, z_in);
 1142|       |    /* ftmp[i] < 2^60 + 2^15 */
 1143|  5.07k|    felem_square(tmp, ftmp);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1144|       |    /*
 1145|       |     * tmp[i] < 17(2^122) < 2^127
 1146|       |     */
 1147|  5.07k|    felem_diff_128_64(tmp, delta);
 1148|       |    /* tmp[i] < 2^127 + 2^63 */
 1149|  5.07k|    felem_reduce(z_out, tmp);
 1150|       |
 1151|       |    /* y' = alpha*(4*beta - x') - 8*gamma^2 */
 1152|  5.07k|    felem_scalar64(beta, 4);
 1153|       |    /* beta[i] < 2^61 + 2^16 */
 1154|  5.07k|    felem_diff64(beta, x_out);
 1155|       |    /* beta[i] < 2^61 + 2^60 + 2^16 */
 1156|  5.07k|    felem_mul(tmp, alpha, beta);
  ------------------
  |  |  726|  5.07k|# define felem_mul felem_mul_ref
  ------------------
 1157|       |    /*-
 1158|       |     * tmp[i] < 17*((2^59 + 2^14)(2^61 + 2^60 + 2^16))
 1159|       |     *        = 17*(2^120 + 2^75 + 2^119 + 2^74 + 2^75 + 2^30)
 1160|       |     *        = 17*(2^120 + 2^119 + 2^76 + 2^74 + 2^30)
 1161|       |     *        < 2^128
 1162|       |     */
 1163|  5.07k|    felem_square(tmp2, gamma);
  ------------------
  |  |  725|  5.07k|# define felem_square felem_square_ref
  ------------------
 1164|       |    /*-
 1165|       |     * tmp2[i] < 17*(2^59 + 2^14)^2
 1166|       |     *         = 17*(2^118 + 2^74 + 2^28)
 1167|       |     */
 1168|  5.07k|    felem_scalar128(tmp2, 8);
 1169|       |    /*-
 1170|       |     * tmp2[i] < 8*17*(2^118 + 2^74 + 2^28)
 1171|       |     *         = 2^125 + 2^121 + 2^81 + 2^77 + 2^35 + 2^31
 1172|       |     *         < 2^126
 1173|       |     */
 1174|  5.07k|    felem_diff128(tmp, tmp2);
 1175|       |    /*-
 1176|       |     * tmp[i] < 2^127 - 2^69 + 17(2^120 + 2^119 + 2^76 + 2^74 + 2^30)
 1177|       |     *        = 2^127 + 2^124 + 2^122 + 2^120 + 2^118 + 2^80 + 2^78 + 2^76 +
 1178|       |     *          2^74 + 2^69 + 2^34 + 2^30
 1179|       |     *        < 2^128
 1180|       |     */
 1181|  5.07k|    felem_reduce(y_out, tmp);
 1182|  5.07k|}
ecp_nistp521.c:batch_mul:
 1586|     39|{
 1587|     39|    int i, skip;
 1588|     39|    unsigned num, gen_mul = (g_scalar != NULL);
 1589|     39|    felem nq[3], tmp[4];
 1590|     39|    limb bits;
 1591|     39|    u8 sign, digit;
 1592|       |
 1593|       |    /* set nq to the point at infinity */
 1594|     39|    memset(nq, 0, sizeof(nq));
 1595|       |
 1596|       |    /*
 1597|       |     * Loop over all scalars msb-to-lsb, interleaving additions of multiples
 1598|       |     * of the generator (last quarter of rounds) and additions of other
 1599|       |     * points multiples (every 5th round).
 1600|       |     */
 1601|     39|    skip = 1;                   /* save two point operations in the first
 1602|       |                                 * round */
 1603|  5.14k|    for (i = (num_points ? 520 : 130); i >= 0; --i) {
  ------------------
  |  Branch (1603:15): [True: 0, False: 39]
  |  Branch (1603:40): [True: 5.10k, False: 39]
  ------------------
 1604|       |        /* double */
 1605|  5.10k|        if (!skip)
  ------------------
  |  Branch (1605:13): [True: 5.07k, False: 39]
  ------------------
 1606|  5.07k|            point_double(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2]);
 1607|       |
 1608|       |        /* add multiples of the generator */
 1609|  5.10k|        if (gen_mul && (i <= 130)) {
  ------------------
  |  Branch (1609:13): [True: 5.10k, False: 0]
  |  Branch (1609:24): [True: 5.10k, False: 0]
  ------------------
 1610|  5.10k|            bits = get_bit(g_scalar, i + 390) << 3;
 1611|  5.10k|            if (i < 130) {
  ------------------
  |  Branch (1611:17): [True: 5.07k, False: 39]
  ------------------
 1612|  5.07k|                bits |= get_bit(g_scalar, i + 260) << 2;
 1613|  5.07k|                bits |= get_bit(g_scalar, i + 130) << 1;
 1614|  5.07k|                bits |= get_bit(g_scalar, i);
 1615|  5.07k|            }
 1616|       |            /* select the point to add, in constant time */
 1617|  5.10k|            select_point(bits, 16, g_pre_comp, tmp);
 1618|  5.10k|            if (!skip) {
  ------------------
  |  Branch (1618:17): [True: 5.07k, False: 39]
  ------------------
 1619|       |                /* The 1 argument below is for "mixed" */
 1620|  5.07k|                point_add(nq[0], nq[1], nq[2],
 1621|  5.07k|                          nq[0], nq[1], nq[2], 1, tmp[0], tmp[1], tmp[2]);
 1622|  5.07k|            } else {
 1623|     39|                memcpy(nq, tmp, 3 * sizeof(felem));
 1624|     39|                skip = 0;
 1625|     39|            }
 1626|  5.10k|        }
 1627|       |
 1628|       |        /* do other additions every 5 doublings */
 1629|  5.10k|        if (num_points && (i % 5 == 0)) {
  ------------------
  |  Branch (1629:13): [True: 0, False: 5.10k]
  |  Branch (1629:27): [True: 0, False: 0]
  ------------------
 1630|       |            /* loop over all scalars */
 1631|      0|            for (num = 0; num < num_points; ++num) {
  ------------------
  |  Branch (1631:27): [True: 0, False: 0]
  ------------------
 1632|      0|                bits = get_bit(scalars[num], i + 4) << 5;
 1633|      0|                bits |= get_bit(scalars[num], i + 3) << 4;
 1634|      0|                bits |= get_bit(scalars[num], i + 2) << 3;
 1635|      0|                bits |= get_bit(scalars[num], i + 1) << 2;
 1636|      0|                bits |= get_bit(scalars[num], i) << 1;
 1637|      0|                bits |= get_bit(scalars[num], i - 1);
 1638|      0|                ossl_ec_GFp_nistp_recode_scalar_bits(&sign, &digit, bits);
 1639|       |
 1640|       |                /*
 1641|       |                 * select the point to add or subtract, in constant time
 1642|       |                 */
 1643|      0|                select_point(digit, 17, pre_comp[num], tmp);
 1644|      0|                felem_neg(tmp[3], tmp[1]); /* (X, -Y, Z) is the negative
 1645|       |                                            * point */
 1646|      0|                copy_conditional(tmp[1], tmp[3], (-(limb) sign));
 1647|       |
 1648|      0|                if (!skip) {
  ------------------
  |  Branch (1648:21): [True: 0, False: 0]
  ------------------
 1649|      0|                    point_add(nq[0], nq[1], nq[2],
 1650|      0|                              nq[0], nq[1], nq[2],
 1651|      0|                              mixed, tmp[0], tmp[1], tmp[2]);
 1652|      0|                } else {
 1653|      0|                    memcpy(nq, tmp, 3 * sizeof(felem));
 1654|      0|                    skip = 0;
 1655|      0|                }
 1656|      0|            }
 1657|      0|        }
 1658|  5.10k|    }
 1659|     39|    felem_assign(x_out, nq[0]);
 1660|     39|    felem_assign(y_out, nq[1]);
 1661|     39|    felem_assign(z_out, nq[2]);
 1662|     39|}
ecp_nistp521.c:get_bit:
 1568|  20.3k|{
 1569|  20.3k|    if (i < 0)
  ------------------
  |  Branch (1569:9): [True: 0, False: 20.3k]
  ------------------
 1570|      0|        return 0;
 1571|  20.3k|    return (in[i >> 3] >> (i & 7)) & 1;
 1572|  20.3k|}
ecp_nistp521.c:select_point:
 1547|  5.10k|{
 1548|  5.10k|    unsigned i, j;
 1549|  5.10k|    limb *outlimbs = &out[0][0];
 1550|       |
 1551|  5.10k|    memset(out, 0, sizeof(*out) * 3);
 1552|       |
 1553|  86.8k|    for (i = 0; i < size; i++) {
  ------------------
  |  Branch (1553:17): [True: 81.7k, False: 5.10k]
  ------------------
 1554|  81.7k|        const limb *inlimbs = &pre_comp[i][0][0];
 1555|  81.7k|        limb mask = i ^ idx;
 1556|  81.7k|        mask |= mask >> 4;
 1557|  81.7k|        mask |= mask >> 2;
 1558|  81.7k|        mask |= mask >> 1;
 1559|  81.7k|        mask &= 1;
 1560|  81.7k|        mask--;
 1561|  2.28M|        for (j = 0; j < NLIMBS * 3; j++)
  ------------------
  |  |  129|  2.28M|#define NLIMBS 9
  ------------------
  |  Branch (1561:21): [True: 2.20M, False: 81.7k]
  ------------------
 1562|  2.20M|            outlimbs[j] |= inlimbs[j] & mask;
 1563|  81.7k|    }
 1564|  5.10k|}

EC_GFp_nistz256_method:
 1449|    133|{
 1450|    133|    static const EC_METHOD ret = {
 1451|    133|        EC_FLAGS_DEFAULT_OCT,
  ------------------
  |  |   26|    133|#define EC_FLAGS_DEFAULT_OCT    0x1
  ------------------
 1452|    133|        NID_X9_62_prime_field,
  ------------------
  |  |  152|    133|#define NID_X9_62_prime_field           406
  ------------------
 1453|    133|        ossl_ec_GFp_mont_group_init,
 1454|    133|        ossl_ec_GFp_mont_group_finish,
 1455|    133|        ossl_ec_GFp_mont_group_clear_finish,
 1456|    133|        ossl_ec_GFp_mont_group_copy,
 1457|    133|        ossl_ec_GFp_mont_group_set_curve,
 1458|    133|        ossl_ec_GFp_simple_group_get_curve,
 1459|    133|        ossl_ec_GFp_simple_group_get_degree,
 1460|    133|        ossl_ec_group_simple_order_bits,
 1461|    133|        ossl_ec_GFp_simple_group_check_discriminant,
 1462|    133|        ossl_ec_GFp_simple_point_init,
 1463|    133|        ossl_ec_GFp_simple_point_finish,
 1464|    133|        ossl_ec_GFp_simple_point_clear_finish,
 1465|    133|        ossl_ec_GFp_simple_point_copy,
 1466|    133|        ossl_ec_GFp_simple_point_set_to_infinity,
 1467|    133|        ossl_ec_GFp_simple_point_set_affine_coordinates,
 1468|    133|        ecp_nistz256_get_affine,
 1469|    133|        0, 0, 0,
 1470|    133|        ossl_ec_GFp_simple_add,
 1471|    133|        ossl_ec_GFp_simple_dbl,
 1472|    133|        ossl_ec_GFp_simple_invert,
 1473|    133|        ossl_ec_GFp_simple_is_at_infinity,
 1474|    133|        ossl_ec_GFp_simple_is_on_curve,
 1475|    133|        ossl_ec_GFp_simple_cmp,
 1476|    133|        ossl_ec_GFp_simple_make_affine,
 1477|    133|        ossl_ec_GFp_simple_points_make_affine,
 1478|    133|        ecp_nistz256_points_mul,                    /* mul */
 1479|    133|        ecp_nistz256_mult_precompute,               /* precompute_mult */
 1480|    133|        ecp_nistz256_window_have_precompute_mult,   /* have_precompute_mult */
 1481|    133|        ossl_ec_GFp_mont_field_mul,
 1482|    133|        ossl_ec_GFp_mont_field_sqr,
 1483|    133|        0,                                          /* field_div */
 1484|    133|        ossl_ec_GFp_mont_field_inv,
 1485|    133|        ossl_ec_GFp_mont_field_encode,
 1486|    133|        ossl_ec_GFp_mont_field_decode,
 1487|    133|        ossl_ec_GFp_mont_field_set_to_one,
 1488|    133|        ossl_ec_key_simple_priv2oct,
 1489|    133|        ossl_ec_key_simple_oct2priv,
 1490|    133|        0, /* set private */
 1491|    133|        ossl_ec_key_simple_generate_key,
 1492|    133|        ossl_ec_key_simple_check_key,
 1493|    133|        ossl_ec_key_simple_generate_public_key,
 1494|    133|        0, /* keycopy */
 1495|    133|        0, /* keyfinish */
 1496|    133|        ossl_ecdh_simple_compute_key,
 1497|    133|        ossl_ecdsa_simple_sign_setup,
 1498|    133|        ossl_ecdsa_simple_sign_sig,
 1499|    133|        ossl_ecdsa_simple_verify_sig,
 1500|    133|        ecp_nistz256_inv_mod_ord,                   /* can be #define-d NULL */
 1501|    133|        0,                                          /* blind_coordinates */
 1502|    133|        0,                                          /* ladder_pre */
 1503|    133|        0,                                          /* ladder_step */
 1504|    133|        0                                           /* ladder_post */
 1505|    133|    };
 1506|       |
 1507|    133|    return &ret;
 1508|    133|}
ecp_nistz256.c:ecp_nistz256_get_affine:
 1162|     72|{
 1163|     72|    BN_ULONG z_inv2[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
 1164|     72|    BN_ULONG z_inv3[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
 1165|     72|    BN_ULONG x_aff[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
 1166|     72|    BN_ULONG y_aff[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
 1167|     72|    BN_ULONG point_x[P256_LIMBS], point_y[P256_LIMBS], point_z[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
 1168|     72|    BN_ULONG x_ret[P256_LIMBS], y_ret[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
 1169|       |
 1170|     72|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (1170:9): [True: 0, False: 72]
  ------------------
 1171|      0|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1172|      0|        return 0;
 1173|      0|    }
 1174|       |
 1175|     72|    if (!ecp_nistz256_bignum_to_field_elem(point_x, point->X) ||
  ------------------
  |  Branch (1175:9): [True: 0, False: 72]
  ------------------
 1176|     72|        !ecp_nistz256_bignum_to_field_elem(point_y, point->Y) ||
  ------------------
  |  Branch (1176:9): [True: 0, False: 72]
  ------------------
 1177|     72|        !ecp_nistz256_bignum_to_field_elem(point_z, point->Z)) {
  ------------------
  |  Branch (1177:9): [True: 0, False: 72]
  ------------------
 1178|      0|        ERR_raise(ERR_LIB_EC, EC_R_COORDINATES_OUT_OF_RANGE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1179|      0|        return 0;
 1180|      0|    }
 1181|       |
 1182|     72|    ecp_nistz256_mod_inverse(z_inv3, point_z);
 1183|     72|    ecp_nistz256_sqr_mont(z_inv2, z_inv3);
 1184|     72|    ecp_nistz256_mul_mont(x_aff, z_inv2, point_x);
 1185|       |
 1186|     72|    if (x != NULL) {
  ------------------
  |  Branch (1186:9): [True: 72, False: 0]
  ------------------
 1187|     72|        ecp_nistz256_from_mont(x_ret, x_aff);
 1188|     72|        if (!bn_set_words(x, x_ret, P256_LIMBS))
  ------------------
  |  |   41|     72|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     72|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     72|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1188:13): [True: 0, False: 72]
  ------------------
 1189|      0|            return 0;
 1190|     72|    }
 1191|       |
 1192|     72|    if (y != NULL) {
  ------------------
  |  Branch (1192:9): [True: 72, False: 0]
  ------------------
 1193|     72|        ecp_nistz256_mul_mont(z_inv3, z_inv3, z_inv2);
 1194|     72|        ecp_nistz256_mul_mont(y_aff, z_inv3, point_y);
 1195|     72|        ecp_nistz256_from_mont(y_ret, y_aff);
 1196|     72|        if (!bn_set_words(y, y_ret, P256_LIMBS))
  ------------------
  |  |   41|     72|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     72|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     72|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1196:13): [True: 0, False: 72]
  ------------------
 1197|      0|            return 0;
 1198|     72|    }
 1199|       |
 1200|     72|    return 1;
 1201|     72|}
ecp_nistz256.c:ecp_nistz256_bignum_to_field_elem:
  602|    216|{
  603|    216|    return bn_copy_words(out, in, P256_LIMBS);
  ------------------
  |  |   41|    216|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|    216|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|    216|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  604|    216|}
ecp_nistz256.c:ecp_nistz256_mod_inverse:
  522|     72|{
  523|       |    /*
  524|       |     * The poly is ffffffff 00000001 00000000 00000000 00000000 ffffffff
  525|       |     * ffffffff ffffffff We use FLT and used poly-2 as exponent
  526|       |     */
  527|     72|    BN_ULONG p2[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
  528|     72|    BN_ULONG p4[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
  529|     72|    BN_ULONG p8[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
  530|     72|    BN_ULONG p16[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
  531|     72|    BN_ULONG p32[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
  532|     72|    BN_ULONG res[P256_LIMBS];
  ------------------
  |  |   37|     72|#  define BN_ULONG        unsigned long
  ------------------
  533|     72|    int i;
  534|       |
  535|     72|    ecp_nistz256_sqr_mont(res, in);
  536|     72|    ecp_nistz256_mul_mont(p2, res, in);         /* 3*p */
  537|       |
  538|     72|    ecp_nistz256_sqr_mont(res, p2);
  539|     72|    ecp_nistz256_sqr_mont(res, res);
  540|     72|    ecp_nistz256_mul_mont(p4, res, p2);         /* f*p */
  541|       |
  542|     72|    ecp_nistz256_sqr_mont(res, p4);
  543|     72|    ecp_nistz256_sqr_mont(res, res);
  544|     72|    ecp_nistz256_sqr_mont(res, res);
  545|     72|    ecp_nistz256_sqr_mont(res, res);
  546|     72|    ecp_nistz256_mul_mont(p8, res, p4);         /* ff*p */
  547|       |
  548|     72|    ecp_nistz256_sqr_mont(res, p8);
  549|    576|    for (i = 0; i < 7; i++)
  ------------------
  |  Branch (549:17): [True: 504, False: 72]
  ------------------
  550|    504|        ecp_nistz256_sqr_mont(res, res);
  551|     72|    ecp_nistz256_mul_mont(p16, res, p8);        /* ffff*p */
  552|       |
  553|     72|    ecp_nistz256_sqr_mont(res, p16);
  554|  1.15k|    for (i = 0; i < 15; i++)
  ------------------
  |  Branch (554:17): [True: 1.08k, False: 72]
  ------------------
  555|  1.08k|        ecp_nistz256_sqr_mont(res, res);
  556|     72|    ecp_nistz256_mul_mont(p32, res, p16);       /* ffffffff*p */
  557|       |
  558|     72|    ecp_nistz256_sqr_mont(res, p32);
  559|  2.30k|    for (i = 0; i < 31; i++)
  ------------------
  |  Branch (559:17): [True: 2.23k, False: 72]
  ------------------
  560|  2.23k|        ecp_nistz256_sqr_mont(res, res);
  561|     72|    ecp_nistz256_mul_mont(res, res, in);
  562|       |
  563|  9.28k|    for (i = 0; i < 32 * 4; i++)
  ------------------
  |  Branch (563:17): [True: 9.21k, False: 72]
  ------------------
  564|  9.21k|        ecp_nistz256_sqr_mont(res, res);
  565|     72|    ecp_nistz256_mul_mont(res, res, p32);
  566|       |
  567|  2.37k|    for (i = 0; i < 32; i++)
  ------------------
  |  Branch (567:17): [True: 2.30k, False: 72]
  ------------------
  568|  2.30k|        ecp_nistz256_sqr_mont(res, res);
  569|     72|    ecp_nistz256_mul_mont(res, res, p32);
  570|       |
  571|  1.22k|    for (i = 0; i < 16; i++)
  ------------------
  |  Branch (571:17): [True: 1.15k, False: 72]
  ------------------
  572|  1.15k|        ecp_nistz256_sqr_mont(res, res);
  573|     72|    ecp_nistz256_mul_mont(res, res, p16);
  574|       |
  575|    648|    for (i = 0; i < 8; i++)
  ------------------
  |  Branch (575:17): [True: 576, False: 72]
  ------------------
  576|    576|        ecp_nistz256_sqr_mont(res, res);
  577|     72|    ecp_nistz256_mul_mont(res, res, p8);
  578|       |
  579|     72|    ecp_nistz256_sqr_mont(res, res);
  580|     72|    ecp_nistz256_sqr_mont(res, res);
  581|     72|    ecp_nistz256_sqr_mont(res, res);
  582|     72|    ecp_nistz256_sqr_mont(res, res);
  583|     72|    ecp_nistz256_mul_mont(res, res, p4);
  584|       |
  585|     72|    ecp_nistz256_sqr_mont(res, res);
  586|     72|    ecp_nistz256_sqr_mont(res, res);
  587|     72|    ecp_nistz256_mul_mont(res, res, p2);
  588|       |
  589|     72|    ecp_nistz256_sqr_mont(res, res);
  590|     72|    ecp_nistz256_sqr_mont(res, res);
  591|     72|    ecp_nistz256_mul_mont(res, res, in);
  592|       |
  593|     72|    memcpy(r, res, sizeof(res));
  594|     72|}
ecp_nistz256.c:ecp_nistz256_points_mul:
  945|     12|{
  946|     12|    int i = 0, ret = 0, no_precomp_for_generator = 0, p_is_infinity = 0;
  947|     12|    unsigned char p_str[33] = { 0 };
  948|     12|    const PRECOMP256_ROW *preComputedTable = NULL;
  949|     12|    const NISTZ256_PRE_COMP *pre_comp = NULL;
  950|     12|    const EC_POINT *generator = NULL;
  951|     12|    const BIGNUM **new_scalars = NULL;
  952|     12|    const EC_POINT **new_points = NULL;
  953|     12|    unsigned int idx = 0;
  954|     12|    const unsigned int window_size = 7;
  955|     12|    const unsigned int mask = (1 << (window_size + 1)) - 1;
  956|     12|    unsigned int wvalue;
  957|     12|    ALIGN32 union {
  ------------------
  |  |   30|     12|#  define ALIGN32       __attribute((aligned(32)))
  ------------------
  958|     12|        P256_POINT p;
  959|     12|        P256_POINT_AFFINE a;
  960|     12|    } t, p;
  961|     12|    BIGNUM *tmp_scalar;
  962|       |
  963|     12|    if ((num + 1) == 0 || (num + 1) > OPENSSL_MALLOC_MAX_NELEMS(void *)) {
  ------------------
  |  |  139|     12|# define OPENSSL_MALLOC_MAX_NELEMS(type)  (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
  ------------------
  |  Branch (963:9): [True: 0, False: 12]
  |  Branch (963:27): [True: 0, False: 12]
  ------------------
  964|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  965|      0|        return 0;
  966|      0|    }
  967|       |
  968|     12|    memset(&p, 0, sizeof(p));
  969|     12|    BN_CTX_start(ctx);
  970|       |
  971|     12|    if (scalar) {
  ------------------
  |  Branch (971:9): [True: 12, False: 0]
  ------------------
  972|     12|        generator = EC_GROUP_get0_generator(group);
  973|     12|        if (generator == NULL) {
  ------------------
  |  Branch (973:13): [True: 0, False: 12]
  ------------------
  974|      0|            ERR_raise(ERR_LIB_EC, EC_R_UNDEFINED_GENERATOR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  975|      0|            goto err;
  976|      0|        }
  977|       |
  978|       |        /* look if we can use precomputed multiples of generator */
  979|     12|        pre_comp = group->pre_comp.nistz256;
  980|       |
  981|     12|        if (pre_comp) {
  ------------------
  |  Branch (981:13): [True: 0, False: 12]
  ------------------
  982|       |            /*
  983|       |             * If there is a precomputed table for the generator, check that
  984|       |             * it was generated with the same generator.
  985|       |             */
  986|      0|            EC_POINT *pre_comp_generator = EC_POINT_new(group);
  987|      0|            if (pre_comp_generator == NULL)
  ------------------
  |  Branch (987:17): [True: 0, False: 0]
  ------------------
  988|      0|                goto err;
  989|       |
  990|      0|            ecp_nistz256_gather_w7(&p.a, pre_comp->precomp[0], 1);
  991|      0|            if (!ecp_nistz256_set_from_affine(pre_comp_generator,
  ------------------
  |  Branch (991:17): [True: 0, False: 0]
  ------------------
  992|      0|                                              group, &p.a, ctx)) {
  993|      0|                EC_POINT_free(pre_comp_generator);
  994|      0|                goto err;
  995|      0|            }
  996|       |
  997|      0|            if (0 == EC_POINT_cmp(group, generator, pre_comp_generator, ctx))
  ------------------
  |  Branch (997:17): [True: 0, False: 0]
  ------------------
  998|      0|                preComputedTable = (const PRECOMP256_ROW *)pre_comp->precomp;
  999|       |
 1000|      0|            EC_POINT_free(pre_comp_generator);
 1001|      0|        }
 1002|       |
 1003|     12|        if (preComputedTable == NULL && ecp_nistz256_is_affine_G(generator)) {
  ------------------
  |  Branch (1003:13): [True: 12, False: 0]
  |  Branch (1003:41): [True: 12, False: 0]
  ------------------
 1004|       |            /*
 1005|       |             * If there is no precomputed data, but the generator is the
 1006|       |             * default, a hardcoded table of precomputed data is used. This
 1007|       |             * is because applications, such as Apache, do not use
 1008|       |             * EC_KEY_precompute_mult.
 1009|       |             */
 1010|     12|            preComputedTable = ecp_nistz256_precomputed;
 1011|     12|        }
 1012|       |
 1013|     12|        if (preComputedTable) {
  ------------------
  |  Branch (1013:13): [True: 12, False: 0]
  ------------------
 1014|     12|            BN_ULONG infty;
  ------------------
  |  |   37|     12|#  define BN_ULONG        unsigned long
  ------------------
 1015|       |
 1016|     12|            if ((BN_num_bits(scalar) > 256)
  ------------------
  |  Branch (1016:17): [True: 4, False: 8]
  ------------------
 1017|     12|                || BN_is_negative(scalar)) {
  ------------------
  |  Branch (1017:20): [True: 0, False: 8]
  ------------------
 1018|      4|                if ((tmp_scalar = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (1018:21): [True: 0, False: 4]
  ------------------
 1019|      0|                    goto err;
 1020|       |
 1021|      4|                if (!BN_nnmod(tmp_scalar, scalar, group->order, ctx)) {
  ------------------
  |  Branch (1021:21): [True: 0, False: 4]
  ------------------
 1022|      0|                    ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1023|      0|                    goto err;
 1024|      0|                }
 1025|      4|                scalar = tmp_scalar;
 1026|      4|            }
 1027|       |
 1028|     32|            for (i = 0; i < bn_get_top(scalar) * BN_BYTES; i += BN_BYTES) {
  ------------------
  |  |   38|     32|#  define BN_BYTES        8
  ------------------
                          for (i = 0; i < bn_get_top(scalar) * BN_BYTES; i += BN_BYTES) {
  ------------------
  |  |   38|     20|#  define BN_BYTES        8
  ------------------
  |  Branch (1028:25): [True: 20, False: 12]
  ------------------
 1029|     20|                BN_ULONG d = bn_get_words(scalar)[i / BN_BYTES];
  ------------------
  |  |   37|     20|#  define BN_ULONG        unsigned long
  ------------------
                              BN_ULONG d = bn_get_words(scalar)[i / BN_BYTES];
  ------------------
  |  |   38|     20|#  define BN_BYTES        8
  ------------------
 1030|       |
 1031|     20|                p_str[i + 0] = (unsigned char)d;
 1032|     20|                p_str[i + 1] = (unsigned char)(d >> 8);
 1033|     20|                p_str[i + 2] = (unsigned char)(d >> 16);
 1034|     20|                p_str[i + 3] = (unsigned char)(d >>= 24);
 1035|     20|                if (BN_BYTES == 8) {
  ------------------
  |  |   38|     20|#  define BN_BYTES        8
  ------------------
  |  Branch (1035:21): [Folded - Ignored]
  ------------------
 1036|     20|                    d >>= 8;
 1037|     20|                    p_str[i + 4] = (unsigned char)d;
 1038|     20|                    p_str[i + 5] = (unsigned char)(d >> 8);
 1039|     20|                    p_str[i + 6] = (unsigned char)(d >> 16);
 1040|     20|                    p_str[i + 7] = (unsigned char)(d >> 24);
 1041|     20|                }
 1042|     20|            }
 1043|       |
 1044|    248|            for (; i < 33; i++)
  ------------------
  |  Branch (1044:20): [True: 236, False: 12]
  ------------------
 1045|    236|                p_str[i] = 0;
 1046|       |
 1047|       |            /* First window */
 1048|     12|            wvalue = (p_str[0] << 1) & mask;
 1049|     12|            idx += window_size;
 1050|       |
 1051|     12|            wvalue = _booth_recode_w7(wvalue);
 1052|       |
 1053|     12|            ecp_nistz256_gather_w7(&p.a, preComputedTable[0],
 1054|     12|                                   wvalue >> 1);
 1055|       |
 1056|     12|            ecp_nistz256_neg(p.p.Z, p.p.Y);
 1057|     12|            copy_conditional(p.p.Y, p.p.Z, wvalue & 1);
 1058|       |
 1059|       |            /*
 1060|       |             * Since affine infinity is encoded as (0,0) and
 1061|       |             * Jacobian is (,,0), we need to harmonize them
 1062|       |             * by assigning "one" or zero to Z.
 1063|       |             */
 1064|     12|            infty = (p.p.X[0] | p.p.X[1] | p.p.X[2] | p.p.X[3] |
 1065|     12|                     p.p.Y[0] | p.p.Y[1] | p.p.Y[2] | p.p.Y[3]);
 1066|     12|            if (P256_LIMBS == 8)
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1066:17): [Folded - Ignored]
  ------------------
 1067|      0|                infty |= (p.p.X[4] | p.p.X[5] | p.p.X[6] | p.p.X[7] |
 1068|      0|                          p.p.Y[4] | p.p.Y[5] | p.p.Y[6] | p.p.Y[7]);
 1069|       |
 1070|     12|            infty = 0 - is_zero(infty);
 1071|     12|            infty = ~infty;
 1072|       |
 1073|     12|            p.p.Z[0] = ONE[0] & infty;
 1074|     12|            p.p.Z[1] = ONE[1] & infty;
 1075|     12|            p.p.Z[2] = ONE[2] & infty;
 1076|     12|            p.p.Z[3] = ONE[3] & infty;
 1077|     12|            if (P256_LIMBS == 8) {
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1077:17): [Folded - Ignored]
  ------------------
 1078|      0|                p.p.Z[4] = ONE[4] & infty;
 1079|      0|                p.p.Z[5] = ONE[5] & infty;
 1080|      0|                p.p.Z[6] = ONE[6] & infty;
 1081|      0|                p.p.Z[7] = ONE[7] & infty;
 1082|      0|            }
 1083|       |
 1084|    444|            for (i = 1; i < 37; i++) {
  ------------------
  |  Branch (1084:25): [True: 432, False: 12]
  ------------------
 1085|    432|                unsigned int off = (idx - 1) / 8;
 1086|    432|                wvalue = p_str[off] | p_str[off + 1] << 8;
 1087|    432|                wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
 1088|    432|                idx += window_size;
 1089|       |
 1090|    432|                wvalue = _booth_recode_w7(wvalue);
 1091|       |
 1092|    432|                ecp_nistz256_gather_w7(&t.a,
 1093|    432|                                       preComputedTable[i], wvalue >> 1);
 1094|       |
 1095|    432|                ecp_nistz256_neg(t.p.Z, t.a.Y);
 1096|    432|                copy_conditional(t.a.Y, t.p.Z, wvalue & 1);
 1097|       |
 1098|    432|                ecp_nistz256_point_add_affine(&p.p, &p.p, &t.a);
 1099|    432|            }
 1100|     12|        } else {
 1101|      0|            p_is_infinity = 1;
 1102|      0|            no_precomp_for_generator = 1;
 1103|      0|        }
 1104|     12|    } else
 1105|      0|        p_is_infinity = 1;
 1106|       |
 1107|     12|    if (no_precomp_for_generator) {
  ------------------
  |  Branch (1107:9): [True: 0, False: 12]
  ------------------
 1108|       |        /*
 1109|       |         * Without a precomputed table for the generator, it has to be
 1110|       |         * handled like a normal point.
 1111|       |         */
 1112|      0|        new_scalars = OPENSSL_malloc((num + 1) * sizeof(BIGNUM *));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1113|      0|        if (new_scalars == NULL)
  ------------------
  |  Branch (1113:13): [True: 0, False: 0]
  ------------------
 1114|      0|            goto err;
 1115|       |
 1116|      0|        new_points = OPENSSL_malloc((num + 1) * sizeof(EC_POINT *));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1117|      0|        if (new_points == NULL)
  ------------------
  |  Branch (1117:13): [True: 0, False: 0]
  ------------------
 1118|      0|            goto err;
 1119|       |
 1120|      0|        memcpy(new_scalars, scalars, num * sizeof(BIGNUM *));
 1121|      0|        new_scalars[num] = scalar;
 1122|      0|        memcpy(new_points, points, num * sizeof(EC_POINT *));
 1123|      0|        new_points[num] = generator;
 1124|       |
 1125|      0|        scalars = new_scalars;
 1126|      0|        points = new_points;
 1127|      0|        num++;
 1128|      0|    }
 1129|       |
 1130|     12|    if (num) {
  ------------------
  |  Branch (1130:9): [True: 0, False: 12]
  ------------------
 1131|      0|        P256_POINT *out = &t.p;
 1132|      0|        if (p_is_infinity)
  ------------------
  |  Branch (1132:13): [True: 0, False: 0]
  ------------------
 1133|      0|            out = &p.p;
 1134|       |
 1135|      0|        if (!ecp_nistz256_windowed_mul(group, out, scalars, points, num, ctx))
  ------------------
  |  Branch (1135:13): [True: 0, False: 0]
  ------------------
 1136|      0|            goto err;
 1137|       |
 1138|      0|        if (!p_is_infinity)
  ------------------
  |  Branch (1138:13): [True: 0, False: 0]
  ------------------
 1139|      0|            ecp_nistz256_point_add(&p.p, &p.p, out);
 1140|      0|    }
 1141|       |
 1142|       |    /* Not constant-time, but we're only operating on the public output. */
 1143|     12|    if (!bn_set_words(r->X, p.p.X, P256_LIMBS) ||
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1143:9): [True: 0, False: 12]
  ------------------
 1144|     12|        !bn_set_words(r->Y, p.p.Y, P256_LIMBS) ||
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1144:9): [True: 0, False: 12]
  ------------------
 1145|     12|        !bn_set_words(r->Z, p.p.Z, P256_LIMBS)) {
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1145:9): [True: 0, False: 12]
  ------------------
 1146|      0|        goto err;
 1147|      0|    }
 1148|     12|    r->Z_is_one = is_one(r->Z) & 1;
 1149|       |
 1150|     12|    ret = 1;
 1151|       |
 1152|     12|err:
 1153|     12|    BN_CTX_end(ctx);
 1154|     12|    OPENSSL_free(new_points);
  ------------------
  |  |  107|     12|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     12|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     12|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1155|     12|    OPENSSL_free(new_scalars);
  ------------------
  |  |  107|     12|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     12|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     12|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1156|     12|    return ret;
 1157|     12|}
ecp_nistz256.c:ecp_nistz256_is_affine_G:
  794|     12|{
  795|     12|    return (bn_get_top(generator->X) == P256_LIMBS) &&
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (795:12): [True: 12, False: 0]
  ------------------
  796|     12|        (bn_get_top(generator->Y) == P256_LIMBS) &&
  ------------------
  |  |   41|     12|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     12|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     12|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (796:9): [True: 12, False: 0]
  ------------------
  797|     12|        is_equal(bn_get_words(generator->X), def_xG) &&
  ------------------
  |  Branch (797:9): [True: 12, False: 0]
  ------------------
  798|     12|        is_equal(bn_get_words(generator->Y), def_yG) &&
  ------------------
  |  Branch (798:9): [True: 12, False: 0]
  ------------------
  799|     12|        is_one(generator->Z);
  ------------------
  |  Branch (799:9): [True: 12, False: 0]
  ------------------
  800|     12|}
ecp_nistz256.c:is_equal:
  196|     24|{
  197|     24|    BN_ULONG res;
  ------------------
  |  |   37|     24|#  define BN_ULONG        unsigned long
  ------------------
  198|       |
  199|     24|    res = a[0] ^ b[0];
  200|     24|    res |= a[1] ^ b[1];
  201|     24|    res |= a[2] ^ b[2];
  202|     24|    res |= a[3] ^ b[3];
  203|     24|    if (P256_LIMBS == 8) {
  ------------------
  |  |   41|     24|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     24|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     24|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (203:9): [Folded - Ignored]
  ------------------
  204|      0|        res |= a[4] ^ b[4];
  205|      0|        res |= a[5] ^ b[5];
  206|      0|        res |= a[6] ^ b[6];
  207|      0|        res |= a[7] ^ b[7];
  208|      0|    }
  209|       |
  210|     24|    return is_zero(res);
  211|     24|}
ecp_nistz256.c:_booth_recode_w7:
  157|    444|{
  158|    444|    unsigned int s, d;
  159|       |
  160|    444|    s = ~((in >> 7) - 1);
  161|    444|    d = (1 << 8) - in - 1;
  162|    444|    d = (d & s) | (in & ~s);
  163|    444|    d = (d >> 1) + (d & 1);
  164|       |
  165|    444|    return (d << 1) + (s & 1);
  166|    444|}
ecp_nistz256.c:copy_conditional:
  170|    444|{
  171|    444|    BN_ULONG mask1 = 0-move;
  ------------------
  |  |   37|    444|#  define BN_ULONG        unsigned long
  ------------------
  172|    444|    BN_ULONG mask2 = ~mask1;
  ------------------
  |  |   37|    444|#  define BN_ULONG        unsigned long
  ------------------
  173|       |
  174|    444|    dst[0] = (src[0] & mask1) ^ (dst[0] & mask2);
  175|    444|    dst[1] = (src[1] & mask1) ^ (dst[1] & mask2);
  176|    444|    dst[2] = (src[2] & mask1) ^ (dst[2] & mask2);
  177|    444|    dst[3] = (src[3] & mask1) ^ (dst[3] & mask2);
  178|    444|    if (P256_LIMBS == 8) {
  ------------------
  |  |   41|    444|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|    444|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|    444|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (178:9): [Folded - Ignored]
  ------------------
  179|      0|        dst[4] = (src[4] & mask1) ^ (dst[4] & mask2);
  180|      0|        dst[5] = (src[5] & mask1) ^ (dst[5] & mask2);
  181|      0|        dst[6] = (src[6] & mask1) ^ (dst[6] & mask2);
  182|      0|        dst[7] = (src[7] & mask1) ^ (dst[7] & mask2);
  183|      0|    }
  184|    444|}
ecp_nistz256.c:is_zero:
  187|     56|{
  188|     56|    in |= (0 - in);
  189|     56|    in = ~in;
  190|     56|    in >>= BN_BITS2 - 1;
  ------------------
  |  |   54|     56|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|     56|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  191|     56|    return in;
  192|     56|}
ecp_nistz256.c:is_one:
  214|     24|{
  215|     24|    BN_ULONG res = 0;
  ------------------
  |  |   37|     24|#  define BN_ULONG        unsigned long
  ------------------
  216|     24|    BN_ULONG *a = bn_get_words(z);
  ------------------
  |  |   37|     24|#  define BN_ULONG        unsigned long
  ------------------
  217|       |
  218|     24|    if (bn_get_top(z) == (P256_LIMBS - P256_LIMBS / 8)) {
  ------------------
  |  |   41|     24|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     24|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     24|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (bn_get_top(z) == (P256_LIMBS - P256_LIMBS / 8)) {
  ------------------
  |  |   41|     24|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     24|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     24|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (218:9): [True: 20, False: 4]
  ------------------
  219|     20|        res = a[0] ^ ONE[0];
  220|     20|        res |= a[1] ^ ONE[1];
  221|     20|        res |= a[2] ^ ONE[2];
  222|     20|        res |= a[3] ^ ONE[3];
  223|     20|        if (P256_LIMBS == 8) {
  ------------------
  |  |   41|     20|#define P256_LIMBS      (256/BN_BITS2)
  |  |  ------------------
  |  |  |  |   54|     20|# define BN_BITS2       (BN_BYTES * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     20|#  define BN_BYTES        8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (223:13): [Folded - Ignored]
  ------------------
  224|      0|            res |= a[4] ^ ONE[4];
  225|      0|            res |= a[5] ^ ONE[5];
  226|      0|            res |= a[6] ^ ONE[6];
  227|       |            /*
  228|       |             * no check for a[7] (being zero) on 32-bit platforms,
  229|       |             * because value of "one" takes only 7 limbs.
  230|       |             */
  231|      0|        }
  232|     20|        res = is_zero(res);
  233|     20|    }
  234|       |
  235|     24|    return res;
  236|     24|}

ossl_ec_GFp_simple_set_compressed_coordinates:
   26|  5.99k|{
   27|  5.99k|    BN_CTX *new_ctx = NULL;
   28|  5.99k|    BIGNUM *tmp1, *tmp2, *x, *y;
   29|  5.99k|    int ret = 0;
   30|       |
   31|  5.99k|    if (ctx == NULL) {
  ------------------
  |  Branch (31:9): [True: 0, False: 5.99k]
  ------------------
   32|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
   33|      0|        if (ctx == NULL)
  ------------------
  |  Branch (33:13): [True: 0, False: 0]
  ------------------
   34|      0|            return 0;
   35|      0|    }
   36|       |
   37|  5.99k|    y_bit = (y_bit != 0);
   38|       |
   39|  5.99k|    BN_CTX_start(ctx);
   40|  5.99k|    tmp1 = BN_CTX_get(ctx);
   41|  5.99k|    tmp2 = BN_CTX_get(ctx);
   42|  5.99k|    x = BN_CTX_get(ctx);
   43|  5.99k|    y = BN_CTX_get(ctx);
   44|  5.99k|    if (y == NULL)
  ------------------
  |  Branch (44:9): [True: 0, False: 5.99k]
  ------------------
   45|      0|        goto err;
   46|       |
   47|       |    /*-
   48|       |     * Recover y.  We have a Weierstrass equation
   49|       |     *     y^2 = x^3 + a*x + b,
   50|       |     * so  y  is one of the square roots of  x^3 + a*x + b.
   51|       |     */
   52|       |
   53|       |    /* tmp1 := x^3 */
   54|  5.99k|    if (!BN_nnmod(x, x_, group->field, ctx))
  ------------------
  |  Branch (54:9): [True: 0, False: 5.99k]
  ------------------
   55|      0|        goto err;
   56|  5.99k|    if (group->meth->field_decode == 0) {
  ------------------
  |  Branch (56:9): [True: 4.10k, False: 1.88k]
  ------------------
   57|       |        /* field_{sqr,mul} work on standard representation */
   58|  4.10k|        if (!group->meth->field_sqr(group, tmp2, x_, ctx))
  ------------------
  |  Branch (58:13): [True: 0, False: 4.10k]
  ------------------
   59|      0|            goto err;
   60|  4.10k|        if (!group->meth->field_mul(group, tmp1, tmp2, x_, ctx))
  ------------------
  |  Branch (60:13): [True: 0, False: 4.10k]
  ------------------
   61|      0|            goto err;
   62|  4.10k|    } else {
   63|  1.88k|        if (!BN_mod_sqr(tmp2, x_, group->field, ctx))
  ------------------
  |  Branch (63:13): [True: 0, False: 1.88k]
  ------------------
   64|      0|            goto err;
   65|  1.88k|        if (!BN_mod_mul(tmp1, tmp2, x_, group->field, ctx))
  ------------------
  |  Branch (65:13): [True: 0, False: 1.88k]
  ------------------
   66|      0|            goto err;
   67|  1.88k|    }
   68|       |
   69|       |    /* tmp1 := tmp1 + a*x */
   70|  5.99k|    if (group->a_is_minus3) {
  ------------------
  |  Branch (70:9): [True: 4.48k, False: 1.51k]
  ------------------
   71|  4.48k|        if (!BN_mod_lshift1_quick(tmp2, x, group->field))
  ------------------
  |  Branch (71:13): [True: 0, False: 4.48k]
  ------------------
   72|      0|            goto err;
   73|  4.48k|        if (!BN_mod_add_quick(tmp2, tmp2, x, group->field))
  ------------------
  |  Branch (73:13): [True: 0, False: 4.48k]
  ------------------
   74|      0|            goto err;
   75|  4.48k|        if (!BN_mod_sub_quick(tmp1, tmp1, tmp2, group->field))
  ------------------
  |  Branch (75:13): [True: 0, False: 4.48k]
  ------------------
   76|      0|            goto err;
   77|  4.48k|    } else {
   78|  1.51k|        if (group->meth->field_decode) {
  ------------------
  |  Branch (78:13): [True: 1.51k, False: 0]
  ------------------
   79|  1.51k|            if (!group->meth->field_decode(group, tmp2, group->a, ctx))
  ------------------
  |  Branch (79:17): [True: 0, False: 1.51k]
  ------------------
   80|      0|                goto err;
   81|  1.51k|            if (!BN_mod_mul(tmp2, tmp2, x, group->field, ctx))
  ------------------
  |  Branch (81:17): [True: 0, False: 1.51k]
  ------------------
   82|      0|                goto err;
   83|  1.51k|        } else {
   84|       |            /* field_mul works on standard representation */
   85|      0|            if (!group->meth->field_mul(group, tmp2, group->a, x, ctx))
  ------------------
  |  Branch (85:17): [True: 0, False: 0]
  ------------------
   86|      0|                goto err;
   87|      0|        }
   88|       |
   89|  1.51k|        if (!BN_mod_add_quick(tmp1, tmp1, tmp2, group->field))
  ------------------
  |  Branch (89:13): [True: 0, False: 1.51k]
  ------------------
   90|      0|            goto err;
   91|  1.51k|    }
   92|       |
   93|       |    /* tmp1 := tmp1 + b */
   94|  5.99k|    if (group->meth->field_decode) {
  ------------------
  |  Branch (94:9): [True: 1.88k, False: 4.10k]
  ------------------
   95|  1.88k|        if (!group->meth->field_decode(group, tmp2, group->b, ctx))
  ------------------
  |  Branch (95:13): [True: 0, False: 1.88k]
  ------------------
   96|      0|            goto err;
   97|  1.88k|        if (!BN_mod_add_quick(tmp1, tmp1, tmp2, group->field))
  ------------------
  |  Branch (97:13): [True: 0, False: 1.88k]
  ------------------
   98|      0|            goto err;
   99|  4.10k|    } else {
  100|  4.10k|        if (!BN_mod_add_quick(tmp1, tmp1, group->b, group->field))
  ------------------
  |  Branch (100:13): [True: 0, False: 4.10k]
  ------------------
  101|      0|            goto err;
  102|  4.10k|    }
  103|       |
  104|  5.99k|    ERR_set_mark();
  105|  5.99k|    if (!BN_mod_sqrt(y, tmp1, group->field, ctx)) {
  ------------------
  |  Branch (105:9): [True: 1.60k, False: 4.38k]
  ------------------
  106|  1.60k|#ifndef FIPS_MODULE
  107|  1.60k|        unsigned long err = ERR_peek_last_error();
  108|       |
  109|  1.60k|        if (ERR_GET_LIB(err) == ERR_LIB_BN
  ------------------
  |  |   73|  3.21k|# define ERR_LIB_BN              3
  ------------------
  |  Branch (109:13): [True: 1.60k, False: 0]
  ------------------
  110|  1.60k|            && ERR_GET_REASON(err) == BN_R_NOT_A_SQUARE) {
  ------------------
  |  |   36|  1.60k|# define BN_R_NOT_A_SQUARE                                111
  ------------------
  |  Branch (110:16): [True: 1.57k, False: 37]
  ------------------
  111|  1.57k|            ERR_pop_to_mark();
  112|  1.57k|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT);
  ------------------
  |  |  401|  1.57k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  1.57k|    (ERR_new(),                                                 \
  |  |  |  |  404|  1.57k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.57k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.57k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  1.57k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  1.57k|     ERR_set_error)
  |  |  ------------------
  ------------------
  113|  1.57k|        } else
  114|     37|#endif
  115|     37|        {
  116|     37|            ERR_clear_last_mark();
  117|     37|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|     37|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     37|    (ERR_new(),                                                 \
  |  |  |  |  404|     37|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     37|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     37|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     37|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     37|     ERR_set_error)
  |  |  ------------------
  ------------------
  118|     37|        }
  119|  1.60k|        goto err;
  120|  1.60k|    }
  121|  4.38k|    ERR_clear_last_mark();
  122|       |
  123|  4.38k|    if (y_bit != BN_is_odd(y)) {
  ------------------
  |  Branch (123:9): [True: 2.13k, False: 2.25k]
  ------------------
  124|  2.13k|        if (BN_is_zero(y)) {
  ------------------
  |  Branch (124:13): [True: 6, False: 2.12k]
  ------------------
  125|      6|            int kron;
  126|       |
  127|      6|            kron = BN_kronecker(x, group->field, ctx);
  128|      6|            if (kron == -2)
  ------------------
  |  Branch (128:17): [True: 0, False: 6]
  ------------------
  129|      0|                goto err;
  130|       |
  131|      6|            if (kron == 1)
  ------------------
  |  Branch (131:17): [True: 0, False: 6]
  ------------------
  132|      6|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_COMPRESSION_BIT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  133|      6|            else
  134|       |                /*
  135|       |                 * BN_mod_sqrt() should have caught this error (not a square)
  136|       |                 */
  137|      6|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT);
  ------------------
  |  |  401|      6|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      6|    (ERR_new(),                                                 \
  |  |  |  |  404|      6|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      6|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      6|     ERR_set_error)
  |  |  ------------------
  ------------------
  138|      6|            goto err;
  139|      6|        }
  140|  2.12k|        if (!BN_usub(y, group->field, y))
  ------------------
  |  Branch (140:13): [True: 0, False: 2.12k]
  ------------------
  141|      0|            goto err;
  142|  2.12k|    }
  143|  4.38k|    if (y_bit != BN_is_odd(y)) {
  ------------------
  |  Branch (143:9): [True: 0, False: 4.38k]
  ------------------
  144|      0|        ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  145|      0|        goto err;
  146|      0|    }
  147|       |
  148|  4.38k|    if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (148:9): [True: 0, False: 4.38k]
  ------------------
  149|      0|        goto err;
  150|       |
  151|  4.38k|    ret = 1;
  152|       |
  153|  5.99k| err:
  154|  5.99k|    BN_CTX_end(ctx);
  155|  5.99k|    BN_CTX_free(new_ctx);
  156|  5.99k|    return ret;
  157|  4.38k|}
ossl_ec_GFp_simple_point2oct:
  162|  2.73k|{
  163|  2.73k|    size_t ret;
  164|  2.73k|    BN_CTX *new_ctx = NULL;
  165|  2.73k|    int used_ctx = 0;
  166|  2.73k|    BIGNUM *x, *y;
  167|  2.73k|    size_t field_len, i, skip;
  168|       |
  169|  2.73k|    if ((form != POINT_CONVERSION_COMPRESSED)
  ------------------
  |  Branch (169:9): [True: 896, False: 1.84k]
  ------------------
  170|  2.73k|        && (form != POINT_CONVERSION_UNCOMPRESSED)
  ------------------
  |  Branch (170:12): [True: 34, False: 862]
  ------------------
  171|  2.73k|        && (form != POINT_CONVERSION_HYBRID)) {
  ------------------
  |  Branch (171:12): [True: 10, False: 24]
  ------------------
  172|     10|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FORM);
  ------------------
  |  |  401|     10|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     10|    (ERR_new(),                                                 \
  |  |  |  |  404|     10|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     10|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     10|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     10|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     10|     ERR_set_error)
  |  |  ------------------
  ------------------
  173|     10|        goto err;
  174|     10|    }
  175|       |
  176|  2.72k|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (176:9): [True: 128, False: 2.59k]
  ------------------
  177|       |        /* encodes to a single 0 octet */
  178|    128|        if (buf != NULL) {
  ------------------
  |  Branch (178:13): [True: 64, False: 64]
  ------------------
  179|     64|            if (len < 1) {
  ------------------
  |  Branch (179:17): [True: 0, False: 64]
  ------------------
  180|      0|                ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  181|      0|                return 0;
  182|      0|            }
  183|     64|            buf[0] = 0;
  184|     64|        }
  185|    128|        return 1;
  186|    128|    }
  187|       |
  188|       |    /* ret := required output buffer length */
  189|  2.59k|    field_len = BN_num_bytes(group->field);
  ------------------
  |  |  189|  2.59k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  190|  2.59k|    ret =
  191|  2.59k|        (form ==
  ------------------
  |  Branch (191:9): [True: 1.84k, False: 758]
  ------------------
  192|  2.59k|         POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
  193|       |
  194|       |    /* if 'buf' is NULL, just return required length */
  195|  2.59k|    if (buf != NULL) {
  ------------------
  |  Branch (195:9): [True: 1.29k, False: 1.29k]
  ------------------
  196|  1.29k|        if (len < ret) {
  ------------------
  |  Branch (196:13): [True: 0, False: 1.29k]
  ------------------
  197|      0|            ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  198|      0|            goto err;
  199|      0|        }
  200|       |
  201|  1.29k|        if (ctx == NULL) {
  ------------------
  |  Branch (201:13): [True: 1.12k, False: 172]
  ------------------
  202|  1.12k|            ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  203|  1.12k|            if (ctx == NULL)
  ------------------
  |  Branch (203:17): [True: 0, False: 1.12k]
  ------------------
  204|      0|                return 0;
  205|  1.12k|        }
  206|       |
  207|  1.29k|        BN_CTX_start(ctx);
  208|  1.29k|        used_ctx = 1;
  209|  1.29k|        x = BN_CTX_get(ctx);
  210|  1.29k|        y = BN_CTX_get(ctx);
  211|  1.29k|        if (y == NULL)
  ------------------
  |  Branch (211:13): [True: 0, False: 1.29k]
  ------------------
  212|      0|            goto err;
  213|       |
  214|  1.29k|        if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (214:13): [True: 0, False: 1.29k]
  ------------------
  215|      0|            goto err;
  216|       |
  217|  1.29k|        if ((form == POINT_CONVERSION_COMPRESSED
  ------------------
  |  Branch (217:14): [True: 920, False: 379]
  ------------------
  218|  1.29k|             || form == POINT_CONVERSION_HYBRID) && BN_is_odd(y))
  ------------------
  |  Branch (218:17): [True: 12, False: 367]
  |  Branch (218:53): [True: 121, False: 811]
  ------------------
  219|    121|            buf[0] = form + 1;
  220|  1.17k|        else
  221|  1.17k|            buf[0] = form;
  222|       |
  223|  1.29k|        i = 1;
  224|       |
  225|  1.29k|        skip = field_len - BN_num_bytes(x);
  ------------------
  |  |  189|  1.29k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  226|  1.29k|        if (skip > field_len) {
  ------------------
  |  Branch (226:13): [True: 0, False: 1.29k]
  ------------------
  227|      0|            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  228|      0|            goto err;
  229|      0|        }
  230|  6.10k|        while (skip > 0) {
  ------------------
  |  Branch (230:16): [True: 4.80k, False: 1.29k]
  ------------------
  231|  4.80k|            buf[i++] = 0;
  232|  4.80k|            skip--;
  233|  4.80k|        }
  234|  1.29k|        skip = BN_bn2bin(x, buf + i);
  235|  1.29k|        i += skip;
  236|  1.29k|        if (i != 1 + field_len) {
  ------------------
  |  Branch (236:13): [True: 0, False: 1.29k]
  ------------------
  237|      0|            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  238|      0|            goto err;
  239|      0|        }
  240|       |
  241|  1.29k|        if (form == POINT_CONVERSION_UNCOMPRESSED
  ------------------
  |  Branch (241:13): [True: 367, False: 932]
  ------------------
  242|  1.29k|            || form == POINT_CONVERSION_HYBRID) {
  ------------------
  |  Branch (242:16): [True: 12, False: 920]
  ------------------
  243|    379|            skip = field_len - BN_num_bytes(y);
  ------------------
  |  |  189|    379|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  244|    379|            if (skip > field_len) {
  ------------------
  |  Branch (244:17): [True: 0, False: 379]
  ------------------
  245|      0|                ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  246|      0|                goto err;
  247|      0|            }
  248|    687|            while (skip > 0) {
  ------------------
  |  Branch (248:20): [True: 308, False: 379]
  ------------------
  249|    308|                buf[i++] = 0;
  250|    308|                skip--;
  251|    308|            }
  252|    379|            skip = BN_bn2bin(y, buf + i);
  253|    379|            i += skip;
  254|    379|        }
  255|       |
  256|  1.29k|        if (i != ret) {
  ------------------
  |  Branch (256:13): [True: 0, False: 1.29k]
  ------------------
  257|      0|            ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  258|      0|            goto err;
  259|      0|        }
  260|  1.29k|    }
  261|       |
  262|  2.59k|    if (used_ctx)
  ------------------
  |  Branch (262:9): [True: 1.29k, False: 1.29k]
  ------------------
  263|  1.29k|        BN_CTX_end(ctx);
  264|  2.59k|    BN_CTX_free(new_ctx);
  265|  2.59k|    return ret;
  266|       |
  267|     10| err:
  268|     10|    if (used_ctx)
  ------------------
  |  Branch (268:9): [True: 0, False: 10]
  ------------------
  269|      0|        BN_CTX_end(ctx);
  270|     10|    BN_CTX_free(new_ctx);
  271|     10|    return 0;
  272|  2.59k|}
ossl_ec_GFp_simple_oct2point:
  277|  10.4k|{
  278|  10.4k|    point_conversion_form_t form;
  279|  10.4k|    int y_bit;
  280|  10.4k|    BN_CTX *new_ctx = NULL;
  281|  10.4k|    BIGNUM *x, *y;
  282|  10.4k|    size_t field_len, enc_len;
  283|  10.4k|    int ret = 0;
  284|       |
  285|  10.4k|    if (len == 0) {
  ------------------
  |  Branch (285:9): [True: 39, False: 10.3k]
  ------------------
  286|     39|        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
  ------------------
  |  |  401|     39|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     39|    (ERR_new(),                                                 \
  |  |  |  |  404|     39|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     39|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     39|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     39|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     39|     ERR_set_error)
  |  |  ------------------
  ------------------
  287|     39|        return 0;
  288|     39|    }
  289|  10.3k|    form = buf[0];
  290|  10.3k|    y_bit = form & 1;
  291|  10.3k|    form = form & ~1U;
  292|  10.3k|    if ((form != 0) && (form != POINT_CONVERSION_COMPRESSED)
  ------------------
  |  Branch (292:9): [True: 9.82k, False: 555]
  |  Branch (292:24): [True: 3.63k, False: 6.19k]
  ------------------
  293|  10.3k|        && (form != POINT_CONVERSION_UNCOMPRESSED)
  ------------------
  |  Branch (293:12): [True: 741, False: 2.88k]
  ------------------
  294|  10.3k|        && (form != POINT_CONVERSION_HYBRID)) {
  ------------------
  |  Branch (294:12): [True: 647, False: 94]
  ------------------
  295|    647|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|    647|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    647|    (ERR_new(),                                                 \
  |  |  |  |  404|    647|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    647|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    647|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    647|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    647|     ERR_set_error)
  |  |  ------------------
  ------------------
  296|    647|        return 0;
  297|    647|    }
  298|  9.73k|    if ((form == 0 || form == POINT_CONVERSION_UNCOMPRESSED) && y_bit) {
  ------------------
  |  Branch (298:10): [True: 555, False: 9.17k]
  |  Branch (298:23): [True: 2.88k, False: 6.29k]
  |  Branch (298:65): [True: 25, False: 3.41k]
  ------------------
  299|     25|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     25|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     25|    (ERR_new(),                                                 \
  |  |  |  |  404|     25|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     25|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     25|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     25|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     25|     ERR_set_error)
  |  |  ------------------
  ------------------
  300|     25|        return 0;
  301|     25|    }
  302|       |
  303|  9.70k|    if (form == 0) {
  ------------------
  |  Branch (303:9): [True: 530, False: 9.17k]
  ------------------
  304|    530|        if (len != 1) {
  ------------------
  |  Branch (304:13): [True: 66, False: 464]
  ------------------
  305|     66|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     66|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     66|    (ERR_new(),                                                 \
  |  |  |  |  404|     66|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     66|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     66|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     66|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     66|     ERR_set_error)
  |  |  ------------------
  ------------------
  306|     66|            return 0;
  307|     66|        }
  308|       |
  309|    464|        return EC_POINT_set_to_infinity(group, point);
  310|    530|    }
  311|       |
  312|  9.17k|    field_len = BN_num_bytes(group->field);
  ------------------
  |  |  189|  9.17k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
  313|  9.17k|    enc_len =
  314|  9.17k|        (form ==
  ------------------
  |  Branch (314:9): [True: 6.19k, False: 2.98k]
  ------------------
  315|  9.17k|         POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;
  316|       |
  317|  9.17k|    if (len != enc_len) {
  ------------------
  |  Branch (317:9): [True: 226, False: 8.95k]
  ------------------
  318|    226|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|    226|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    226|    (ERR_new(),                                                 \
  |  |  |  |  404|    226|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    226|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    226|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    226|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    226|     ERR_set_error)
  |  |  ------------------
  ------------------
  319|    226|        return 0;
  320|    226|    }
  321|       |
  322|  8.95k|    if (ctx == NULL) {
  ------------------
  |  Branch (322:9): [True: 8.95k, False: 0]
  ------------------
  323|  8.95k|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  324|  8.95k|        if (ctx == NULL)
  ------------------
  |  Branch (324:13): [True: 0, False: 8.95k]
  ------------------
  325|      0|            return 0;
  326|  8.95k|    }
  327|       |
  328|  8.95k|    BN_CTX_start(ctx);
  329|  8.95k|    x = BN_CTX_get(ctx);
  330|  8.95k|    y = BN_CTX_get(ctx);
  331|  8.95k|    if (y == NULL)
  ------------------
  |  Branch (331:9): [True: 0, False: 8.95k]
  ------------------
  332|      0|        goto err;
  333|       |
  334|  8.95k|    if (!BN_bin2bn(buf + 1, field_len, x))
  ------------------
  |  Branch (334:9): [True: 0, False: 8.95k]
  ------------------
  335|      0|        goto err;
  336|  8.95k|    if (BN_ucmp(x, group->field) >= 0) {
  ------------------
  |  Branch (336:9): [True: 42, False: 8.91k]
  ------------------
  337|     42|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     42|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     42|    (ERR_new(),                                                 \
  |  |  |  |  404|     42|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     42|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     42|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     42|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     42|     ERR_set_error)
  |  |  ------------------
  ------------------
  338|     42|        goto err;
  339|     42|    }
  340|       |
  341|  8.91k|    if (form == POINT_CONVERSION_COMPRESSED) {
  ------------------
  |  Branch (341:9): [True: 5.99k, False: 2.91k]
  ------------------
  342|  5.99k|        if (!EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx))
  ------------------
  |  Branch (342:13): [True: 1.61k, False: 4.38k]
  ------------------
  343|  1.61k|            goto err;
  344|  5.99k|    } else {
  345|  2.91k|        if (!BN_bin2bn(buf + 1 + field_len, field_len, y))
  ------------------
  |  Branch (345:13): [True: 0, False: 2.91k]
  ------------------
  346|      0|            goto err;
  347|  2.91k|        if (BN_ucmp(y, group->field) >= 0) {
  ------------------
  |  Branch (347:13): [True: 14, False: 2.90k]
  ------------------
  348|     14|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     14|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     14|    (ERR_new(),                                                 \
  |  |  |  |  404|     14|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     14|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     14|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     14|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     14|     ERR_set_error)
  |  |  ------------------
  ------------------
  349|     14|            goto err;
  350|     14|        }
  351|  2.90k|        if (form == POINT_CONVERSION_HYBRID) {
  ------------------
  |  Branch (351:13): [True: 53, False: 2.84k]
  ------------------
  352|     53|            if (y_bit != BN_is_odd(y)) {
  ------------------
  |  Branch (352:17): [True: 19, False: 34]
  ------------------
  353|     19|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     19|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     19|    (ERR_new(),                                                 \
  |  |  |  |  404|     19|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     19|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     19|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     19|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     19|     ERR_set_error)
  |  |  ------------------
  ------------------
  354|     19|                goto err;
  355|     19|            }
  356|     53|        }
  357|       |
  358|       |        /*
  359|       |         * EC_POINT_set_affine_coordinates is responsible for checking that
  360|       |         * the point is on the curve.
  361|       |         */
  362|  2.88k|        if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
  ------------------
  |  Branch (362:13): [True: 1.24k, False: 1.64k]
  ------------------
  363|  1.24k|            goto err;
  364|  2.88k|    }
  365|       |
  366|  6.02k|    ret = 1;
  367|       |
  368|  8.95k| err:
  369|  8.95k|    BN_CTX_end(ctx);
  370|  8.95k|    BN_CTX_free(new_ctx);
  371|  8.95k|    return ret;
  372|  6.02k|}

ossl_ec_GFp_simple_group_init:
   99|  18.5k|{
  100|  18.5k|    group->field = BN_new();
  101|  18.5k|    group->a = BN_new();
  102|  18.5k|    group->b = BN_new();
  103|  18.5k|    if (group->field == NULL || group->a == NULL || group->b == NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 18.5k]
  |  Branch (103:33): [True: 0, False: 18.5k]
  |  Branch (103:53): [True: 0, False: 18.5k]
  ------------------
  104|      0|        BN_free(group->field);
  105|      0|        BN_free(group->a);
  106|      0|        BN_free(group->b);
  107|      0|        return 0;
  108|      0|    }
  109|  18.5k|    group->a_is_minus3 = 0;
  110|  18.5k|    return 1;
  111|  18.5k|}
ossl_ec_GFp_simple_group_finish:
  114|  18.5k|{
  115|  18.5k|    BN_free(group->field);
  116|  18.5k|    BN_free(group->a);
  117|  18.5k|    BN_free(group->b);
  118|  18.5k|}
ossl_ec_GFp_simple_group_copy:
  128|  8.14k|{
  129|  8.14k|    if (!BN_copy(dest->field, src->field))
  ------------------
  |  Branch (129:9): [True: 0, False: 8.14k]
  ------------------
  130|      0|        return 0;
  131|  8.14k|    if (!BN_copy(dest->a, src->a))
  ------------------
  |  Branch (131:9): [True: 0, False: 8.14k]
  ------------------
  132|      0|        return 0;
  133|  8.14k|    if (!BN_copy(dest->b, src->b))
  ------------------
  |  Branch (133:9): [True: 0, False: 8.14k]
  ------------------
  134|      0|        return 0;
  135|       |
  136|  8.14k|    dest->a_is_minus3 = src->a_is_minus3;
  137|       |
  138|  8.14k|    return 1;
  139|  8.14k|}
ossl_ec_GFp_simple_group_set_curve:
  144|  10.0k|{
  145|  10.0k|    int ret = 0;
  146|  10.0k|    BN_CTX *new_ctx = NULL;
  147|  10.0k|    BIGNUM *tmp_a;
  148|       |
  149|       |    /* p must be a prime > 3 */
  150|  10.0k|    if (BN_num_bits(p) <= 2 || !BN_is_odd(p)) {
  ------------------
  |  Branch (150:9): [True: 2, False: 10.0k]
  |  Branch (150:32): [True: 0, False: 10.0k]
  ------------------
  151|      2|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_FIELD);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  152|      2|        return 0;
  153|      2|    }
  154|       |
  155|  10.0k|    if (ctx == NULL) {
  ------------------
  |  Branch (155:9): [True: 0, False: 10.0k]
  ------------------
  156|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  157|      0|        if (ctx == NULL)
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  ------------------
  158|      0|            return 0;
  159|      0|    }
  160|       |
  161|  10.0k|    BN_CTX_start(ctx);
  162|  10.0k|    tmp_a = BN_CTX_get(ctx);
  163|  10.0k|    if (tmp_a == NULL)
  ------------------
  |  Branch (163:9): [True: 0, False: 10.0k]
  ------------------
  164|      0|        goto err;
  165|       |
  166|       |    /* group->field */
  167|  10.0k|    if (!BN_copy(group->field, p))
  ------------------
  |  Branch (167:9): [True: 0, False: 10.0k]
  ------------------
  168|      0|        goto err;
  169|  10.0k|    BN_set_negative(group->field, 0);
  170|       |
  171|       |    /* group->a */
  172|  10.0k|    if (!BN_nnmod(tmp_a, a, p, ctx))
  ------------------
  |  Branch (172:9): [True: 0, False: 10.0k]
  ------------------
  173|      0|        goto err;
  174|  10.0k|    if (group->meth->field_encode != NULL) {
  ------------------
  |  Branch (174:9): [True: 5.64k, False: 4.43k]
  ------------------
  175|  5.64k|        if (!group->meth->field_encode(group, group->a, tmp_a, ctx))
  ------------------
  |  Branch (175:13): [True: 0, False: 5.64k]
  ------------------
  176|      0|            goto err;
  177|  5.64k|    } else if (!BN_copy(group->a, tmp_a))
  ------------------
  |  Branch (177:16): [True: 0, False: 4.43k]
  ------------------
  178|      0|        goto err;
  179|       |
  180|       |    /* group->b */
  181|  10.0k|    if (!BN_nnmod(group->b, b, p, ctx))
  ------------------
  |  Branch (181:9): [True: 0, False: 10.0k]
  ------------------
  182|      0|        goto err;
  183|  10.0k|    if (group->meth->field_encode != NULL)
  ------------------
  |  Branch (183:9): [True: 5.64k, False: 4.43k]
  ------------------
  184|  5.64k|        if (!group->meth->field_encode(group, group->b, group->b, ctx))
  ------------------
  |  Branch (184:13): [True: 0, False: 5.64k]
  ------------------
  185|      0|            goto err;
  186|       |
  187|       |    /* group->a_is_minus3 */
  188|  10.0k|    if (!BN_add_word(tmp_a, 3))
  ------------------
  |  Branch (188:9): [True: 0, False: 10.0k]
  ------------------
  189|      0|        goto err;
  190|  10.0k|    group->a_is_minus3 = (0 == BN_cmp(tmp_a, group->field));
  191|       |
  192|  10.0k|    ret = 1;
  193|       |
  194|  10.0k| err:
  195|  10.0k|    BN_CTX_end(ctx);
  196|  10.0k|    BN_CTX_free(new_ctx);
  197|  10.0k|    return ret;
  198|  10.0k|}
ossl_ec_GFp_simple_group_get_curve:
  202|  2.62k|{
  203|  2.62k|    int ret = 0;
  204|  2.62k|    BN_CTX *new_ctx = NULL;
  205|       |
  206|  2.62k|    if (p != NULL) {
  ------------------
  |  Branch (206:9): [True: 2.39k, False: 225]
  ------------------
  207|  2.39k|        if (!BN_copy(p, group->field))
  ------------------
  |  Branch (207:13): [True: 0, False: 2.39k]
  ------------------
  208|      0|            return 0;
  209|  2.39k|    }
  210|       |
  211|  2.62k|    if (a != NULL || b != NULL) {
  ------------------
  |  Branch (211:9): [True: 2.39k, False: 225]
  |  Branch (211:22): [True: 0, False: 225]
  ------------------
  212|  2.39k|        if (group->meth->field_decode != NULL) {
  ------------------
  |  Branch (212:13): [True: 2.39k, False: 0]
  ------------------
  213|  2.39k|            if (ctx == NULL) {
  ------------------
  |  Branch (213:17): [True: 225, False: 2.17k]
  ------------------
  214|    225|                ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  215|    225|                if (ctx == NULL)
  ------------------
  |  Branch (215:21): [True: 0, False: 225]
  ------------------
  216|      0|                    return 0;
  217|    225|            }
  218|  2.39k|            if (a != NULL) {
  ------------------
  |  Branch (218:17): [True: 2.39k, False: 0]
  ------------------
  219|  2.39k|                if (!group->meth->field_decode(group, a, group->a, ctx))
  ------------------
  |  Branch (219:21): [True: 0, False: 2.39k]
  ------------------
  220|      0|                    goto err;
  221|  2.39k|            }
  222|  2.39k|            if (b != NULL) {
  ------------------
  |  Branch (222:17): [True: 2.39k, False: 0]
  ------------------
  223|  2.39k|                if (!group->meth->field_decode(group, b, group->b, ctx))
  ------------------
  |  Branch (223:21): [True: 0, False: 2.39k]
  ------------------
  224|      0|                    goto err;
  225|  2.39k|            }
  226|  2.39k|        } else {
  227|      0|            if (a != NULL) {
  ------------------
  |  Branch (227:17): [True: 0, False: 0]
  ------------------
  228|      0|                if (!BN_copy(a, group->a))
  ------------------
  |  Branch (228:21): [True: 0, False: 0]
  ------------------
  229|      0|                    goto err;
  230|      0|            }
  231|      0|            if (b != NULL) {
  ------------------
  |  Branch (231:17): [True: 0, False: 0]
  ------------------
  232|      0|                if (!BN_copy(b, group->b))
  ------------------
  |  Branch (232:21): [True: 0, False: 0]
  ------------------
  233|      0|                    goto err;
  234|      0|            }
  235|      0|        }
  236|  2.39k|    }
  237|       |
  238|  2.62k|    ret = 1;
  239|       |
  240|  2.62k| err:
  241|  2.62k|    BN_CTX_free(new_ctx);
  242|  2.62k|    return ret;
  243|  2.62k|}
ossl_ec_GFp_simple_group_get_degree:
  246|    225|{
  247|    225|    return BN_num_bits(group->field);
  248|    225|}
ossl_ec_GFp_simple_point_init:
  323|  37.8k|{
  324|  37.8k|    point->X = BN_new();
  325|  37.8k|    point->Y = BN_new();
  326|  37.8k|    point->Z = BN_new();
  327|  37.8k|    point->Z_is_one = 0;
  328|       |
  329|  37.8k|    if (point->X == NULL || point->Y == NULL || point->Z == NULL) {
  ------------------
  |  Branch (329:9): [True: 0, False: 37.8k]
  |  Branch (329:29): [True: 0, False: 37.8k]
  |  Branch (329:49): [True: 0, False: 37.8k]
  ------------------
  330|      0|        BN_free(point->X);
  331|      0|        BN_free(point->Y);
  332|      0|        BN_free(point->Z);
  333|      0|        return 0;
  334|      0|    }
  335|  37.8k|    return 1;
  336|  37.8k|}
ossl_ec_GFp_simple_point_finish:
  339|  36.4k|{
  340|  36.4k|    BN_free(point->X);
  341|  36.4k|    BN_free(point->Y);
  342|  36.4k|    BN_free(point->Z);
  343|  36.4k|}
ossl_ec_GFp_simple_point_clear_finish:
  346|  1.41k|{
  347|  1.41k|    BN_clear_free(point->X);
  348|  1.41k|    BN_clear_free(point->Y);
  349|  1.41k|    BN_clear_free(point->Z);
  350|  1.41k|    point->Z_is_one = 0;
  351|  1.41k|}
ossl_ec_GFp_simple_point_copy:
  354|  22.5k|{
  355|  22.5k|    if (!BN_copy(dest->X, src->X))
  ------------------
  |  Branch (355:9): [True: 0, False: 22.5k]
  ------------------
  356|      0|        return 0;
  357|  22.5k|    if (!BN_copy(dest->Y, src->Y))
  ------------------
  |  Branch (357:9): [True: 0, False: 22.5k]
  ------------------
  358|      0|        return 0;
  359|  22.5k|    if (!BN_copy(dest->Z, src->Z))
  ------------------
  |  Branch (359:9): [True: 0, False: 22.5k]
  ------------------
  360|      0|        return 0;
  361|  22.5k|    dest->Z_is_one = src->Z_is_one;
  362|  22.5k|    dest->curve_name = src->curve_name;
  363|       |
  364|  22.5k|    return 1;
  365|  22.5k|}
ossl_ec_GFp_simple_point_set_to_infinity:
  369|    523|{
  370|    523|    point->Z_is_one = 0;
  371|    523|    BN_zero(point->Z);
  ------------------
  |  |  202|    523|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  372|    523|    return 1;
  373|    523|}
ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp:
  381|  14.6k|{
  382|  14.6k|    BN_CTX *new_ctx = NULL;
  383|  14.6k|    int ret = 0;
  384|       |
  385|  14.6k|    if (ctx == NULL) {
  ------------------
  |  Branch (385:9): [True: 0, False: 14.6k]
  ------------------
  386|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  387|      0|        if (ctx == NULL)
  ------------------
  |  Branch (387:13): [True: 0, False: 0]
  ------------------
  388|      0|            return 0;
  389|      0|    }
  390|       |
  391|  14.6k|    if (x != NULL) {
  ------------------
  |  Branch (391:9): [True: 14.6k, False: 0]
  ------------------
  392|  14.6k|        if (!BN_nnmod(point->X, x, group->field, ctx))
  ------------------
  |  Branch (392:13): [True: 0, False: 14.6k]
  ------------------
  393|      0|            goto err;
  394|  14.6k|        if (group->meth->field_encode) {
  ------------------
  |  Branch (394:13): [True: 6.58k, False: 8.06k]
  ------------------
  395|  6.58k|            if (!group->meth->field_encode(group, point->X, point->X, ctx))
  ------------------
  |  Branch (395:17): [True: 0, False: 6.58k]
  ------------------
  396|      0|                goto err;
  397|  6.58k|        }
  398|  14.6k|    }
  399|       |
  400|  14.6k|    if (y != NULL) {
  ------------------
  |  Branch (400:9): [True: 14.6k, False: 0]
  ------------------
  401|  14.6k|        if (!BN_nnmod(point->Y, y, group->field, ctx))
  ------------------
  |  Branch (401:13): [True: 0, False: 14.6k]
  ------------------
  402|      0|            goto err;
  403|  14.6k|        if (group->meth->field_encode) {
  ------------------
  |  Branch (403:13): [True: 6.58k, False: 8.06k]
  ------------------
  404|  6.58k|            if (!group->meth->field_encode(group, point->Y, point->Y, ctx))
  ------------------
  |  Branch (404:17): [True: 0, False: 6.58k]
  ------------------
  405|      0|                goto err;
  406|  6.58k|        }
  407|  14.6k|    }
  408|       |
  409|  14.6k|    if (z != NULL) {
  ------------------
  |  Branch (409:9): [True: 14.6k, False: 0]
  ------------------
  410|  14.6k|        int Z_is_one;
  411|       |
  412|  14.6k|        if (!BN_nnmod(point->Z, z, group->field, ctx))
  ------------------
  |  Branch (412:13): [True: 0, False: 14.6k]
  ------------------
  413|      0|            goto err;
  414|  14.6k|        Z_is_one = BN_is_one(point->Z);
  415|  14.6k|        if (group->meth->field_encode) {
  ------------------
  |  Branch (415:13): [True: 6.58k, False: 8.06k]
  ------------------
  416|  6.58k|            if (Z_is_one && (group->meth->field_set_to_one != 0)) {
  ------------------
  |  Branch (416:17): [True: 6.58k, False: 0]
  |  Branch (416:29): [True: 6.58k, False: 0]
  ------------------
  417|  6.58k|                if (!group->meth->field_set_to_one(group, point->Z, ctx))
  ------------------
  |  Branch (417:21): [True: 0, False: 6.58k]
  ------------------
  418|      0|                    goto err;
  419|  6.58k|            } else {
  420|      0|                if (!group->
  ------------------
  |  Branch (420:21): [True: 0, False: 0]
  ------------------
  421|      0|                    meth->field_encode(group, point->Z, point->Z, ctx))
  422|      0|                    goto err;
  423|      0|            }
  424|  6.58k|        }
  425|  14.6k|        point->Z_is_one = Z_is_one;
  426|  14.6k|    }
  427|       |
  428|  14.6k|    ret = 1;
  429|       |
  430|  14.6k| err:
  431|  14.6k|    BN_CTX_free(new_ctx);
  432|  14.6k|    return ret;
  433|  14.6k|}
ossl_ec_GFp_simple_point_set_affine_coordinates:
  488|  14.5k|{
  489|  14.5k|    if (x == NULL || y == NULL) {
  ------------------
  |  Branch (489:9): [True: 0, False: 14.5k]
  |  Branch (489:22): [True: 0, False: 14.5k]
  ------------------
  490|       |        /*
  491|       |         * unlike for projective coordinates, we do not tolerate this
  492|       |         */
  493|      0|        ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  494|      0|        return 0;
  495|      0|    }
  496|       |
  497|  14.5k|    return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y,
  498|  14.5k|                                                    BN_value_one(), ctx);
  499|  14.5k|}
ossl_ec_GFp_simple_point_get_affine_coordinates:
  505|  2.91k|{
  506|  2.91k|    BN_CTX *new_ctx = NULL;
  507|  2.91k|    BIGNUM *Z, *Z_1, *Z_2, *Z_3;
  508|  2.91k|    const BIGNUM *Z_;
  509|  2.91k|    int ret = 0;
  510|       |
  511|  2.91k|    if (EC_POINT_is_at_infinity(group, point)) {
  ------------------
  |  Branch (511:9): [True: 0, False: 2.91k]
  ------------------
  512|      0|        ERR_raise(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  513|      0|        return 0;
  514|      0|    }
  515|       |
  516|  2.91k|    if (ctx == NULL) {
  ------------------
  |  Branch (516:9): [True: 0, False: 2.91k]
  ------------------
  517|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  518|      0|        if (ctx == NULL)
  ------------------
  |  Branch (518:13): [True: 0, False: 0]
  ------------------
  519|      0|            return 0;
  520|      0|    }
  521|       |
  522|  2.91k|    BN_CTX_start(ctx);
  523|  2.91k|    Z = BN_CTX_get(ctx);
  524|  2.91k|    Z_1 = BN_CTX_get(ctx);
  525|  2.91k|    Z_2 = BN_CTX_get(ctx);
  526|  2.91k|    Z_3 = BN_CTX_get(ctx);
  527|  2.91k|    if (Z_3 == NULL)
  ------------------
  |  Branch (527:9): [True: 0, False: 2.91k]
  ------------------
  528|      0|        goto err;
  529|       |
  530|       |    /* transform  (X, Y, Z)  into  (x, y) := (X/Z^2, Y/Z^3) */
  531|       |
  532|  2.91k|    if (group->meth->field_decode != NULL) {
  ------------------
  |  Branch (532:9): [True: 2.91k, False: 0]
  ------------------
  533|  2.91k|        if (!group->meth->field_decode(group, Z, point->Z, ctx))
  ------------------
  |  Branch (533:13): [True: 0, False: 2.91k]
  ------------------
  534|      0|            goto err;
  535|  2.91k|        Z_ = Z;
  536|  2.91k|    } else {
  537|      0|        Z_ = point->Z;
  538|      0|    }
  539|       |
  540|  2.91k|    if (BN_is_one(Z_)) {
  ------------------
  |  Branch (540:9): [True: 2.83k, False: 83]
  ------------------
  541|  2.83k|        if (group->meth->field_decode != NULL) {
  ------------------
  |  Branch (541:13): [True: 2.83k, False: 0]
  ------------------
  542|  2.83k|            if (x != NULL) {
  ------------------
  |  Branch (542:17): [True: 2.83k, False: 0]
  ------------------
  543|  2.83k|                if (!group->meth->field_decode(group, x, point->X, ctx))
  ------------------
  |  Branch (543:21): [True: 0, False: 2.83k]
  ------------------
  544|      0|                    goto err;
  545|  2.83k|            }
  546|  2.83k|            if (y != NULL) {
  ------------------
  |  Branch (546:17): [True: 2.83k, False: 0]
  ------------------
  547|  2.83k|                if (!group->meth->field_decode(group, y, point->Y, ctx))
  ------------------
  |  Branch (547:21): [True: 0, False: 2.83k]
  ------------------
  548|      0|                    goto err;
  549|  2.83k|            }
  550|  2.83k|        } else {
  551|      0|            if (x != NULL) {
  ------------------
  |  Branch (551:17): [True: 0, False: 0]
  ------------------
  552|      0|                if (!BN_copy(x, point->X))
  ------------------
  |  Branch (552:21): [True: 0, False: 0]
  ------------------
  553|      0|                    goto err;
  554|      0|            }
  555|      0|            if (y != NULL) {
  ------------------
  |  Branch (555:17): [True: 0, False: 0]
  ------------------
  556|      0|                if (!BN_copy(y, point->Y))
  ------------------
  |  Branch (556:21): [True: 0, False: 0]
  ------------------
  557|      0|                    goto err;
  558|      0|            }
  559|      0|        }
  560|  2.83k|    } else {
  561|     83|        if (!group->meth->field_inv(group, Z_1, Z_, ctx)) {
  ------------------
  |  Branch (561:13): [True: 0, False: 83]
  ------------------
  562|      0|            ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  563|      0|            goto err;
  564|      0|        }
  565|       |
  566|     83|        if (group->meth->field_encode == NULL) {
  ------------------
  |  Branch (566:13): [True: 0, False: 83]
  ------------------
  567|       |            /* field_sqr works on standard representation */
  568|      0|            if (!group->meth->field_sqr(group, Z_2, Z_1, ctx))
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|      0|                goto err;
  570|     83|        } else {
  571|     83|            if (!BN_mod_sqr(Z_2, Z_1, group->field, ctx))
  ------------------
  |  Branch (571:17): [True: 0, False: 83]
  ------------------
  572|      0|                goto err;
  573|     83|        }
  574|       |
  575|     83|        if (x != NULL) {
  ------------------
  |  Branch (575:13): [True: 83, False: 0]
  ------------------
  576|       |            /*
  577|       |             * in the Montgomery case, field_mul will cancel out Montgomery
  578|       |             * factor in X:
  579|       |             */
  580|     83|            if (!group->meth->field_mul(group, x, point->X, Z_2, ctx))
  ------------------
  |  Branch (580:17): [True: 0, False: 83]
  ------------------
  581|      0|                goto err;
  582|     83|        }
  583|       |
  584|     83|        if (y != NULL) {
  ------------------
  |  Branch (584:13): [True: 83, False: 0]
  ------------------
  585|     83|            if (group->meth->field_encode == NULL) {
  ------------------
  |  Branch (585:17): [True: 0, False: 83]
  ------------------
  586|       |                /*
  587|       |                 * field_mul works on standard representation
  588|       |                 */
  589|      0|                if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx))
  ------------------
  |  Branch (589:21): [True: 0, False: 0]
  ------------------
  590|      0|                    goto err;
  591|     83|            } else {
  592|     83|                if (!BN_mod_mul(Z_3, Z_2, Z_1, group->field, ctx))
  ------------------
  |  Branch (592:21): [True: 0, False: 83]
  ------------------
  593|      0|                    goto err;
  594|     83|            }
  595|       |
  596|       |            /*
  597|       |             * in the Montgomery case, field_mul will cancel out Montgomery
  598|       |             * factor in Y:
  599|       |             */
  600|     83|            if (!group->meth->field_mul(group, y, point->Y, Z_3, ctx))
  ------------------
  |  Branch (600:17): [True: 0, False: 83]
  ------------------
  601|      0|                goto err;
  602|     83|        }
  603|     83|    }
  604|       |
  605|  2.91k|    ret = 1;
  606|       |
  607|  2.91k| err:
  608|  2.91k|    BN_CTX_end(ctx);
  609|  2.91k|    BN_CTX_free(new_ctx);
  610|  2.91k|    return ret;
  611|  2.91k|}
ossl_ec_GFp_simple_add:
  615|  7.13k|{
  616|  7.13k|    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,
  617|  7.13k|                      const BIGNUM *, BN_CTX *);
  618|  7.13k|    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
  619|  7.13k|    const BIGNUM *p;
  620|  7.13k|    BN_CTX *new_ctx = NULL;
  621|  7.13k|    BIGNUM *n0, *n1, *n2, *n3, *n4, *n5, *n6;
  622|  7.13k|    int ret = 0;
  623|       |
  624|  7.13k|    if (a == b)
  ------------------
  |  Branch (624:9): [True: 0, False: 7.13k]
  ------------------
  625|      0|        return EC_POINT_dbl(group, r, a, ctx);
  626|  7.13k|    if (EC_POINT_is_at_infinity(group, a))
  ------------------
  |  Branch (626:9): [True: 2.02k, False: 5.10k]
  ------------------
  627|  2.02k|        return EC_POINT_copy(r, b);
  628|  5.10k|    if (EC_POINT_is_at_infinity(group, b))
  ------------------
  |  Branch (628:9): [True: 267, False: 4.83k]
  ------------------
  629|    267|        return EC_POINT_copy(r, a);
  630|       |
  631|  4.83k|    field_mul = group->meth->field_mul;
  632|  4.83k|    field_sqr = group->meth->field_sqr;
  633|  4.83k|    p = group->field;
  634|       |
  635|  4.83k|    if (ctx == NULL) {
  ------------------
  |  Branch (635:9): [True: 0, False: 4.83k]
  ------------------
  636|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  637|      0|        if (ctx == NULL)
  ------------------
  |  Branch (637:13): [True: 0, False: 0]
  ------------------
  638|      0|            return 0;
  639|      0|    }
  640|       |
  641|  4.83k|    BN_CTX_start(ctx);
  642|  4.83k|    n0 = BN_CTX_get(ctx);
  643|  4.83k|    n1 = BN_CTX_get(ctx);
  644|  4.83k|    n2 = BN_CTX_get(ctx);
  645|  4.83k|    n3 = BN_CTX_get(ctx);
  646|  4.83k|    n4 = BN_CTX_get(ctx);
  647|  4.83k|    n5 = BN_CTX_get(ctx);
  648|  4.83k|    n6 = BN_CTX_get(ctx);
  649|  4.83k|    if (n6 == NULL)
  ------------------
  |  Branch (649:9): [True: 0, False: 4.83k]
  ------------------
  650|      0|        goto end;
  651|       |
  652|       |    /*
  653|       |     * Note that in this function we must not read components of 'a' or 'b'
  654|       |     * once we have written the corresponding components of 'r'. ('r' might
  655|       |     * be one of 'a' or 'b'.)
  656|       |     */
  657|       |
  658|       |    /* n1, n2 */
  659|  4.83k|    if (b->Z_is_one) {
  ------------------
  |  Branch (659:9): [True: 4.32k, False: 518]
  ------------------
  660|  4.32k|        if (!BN_copy(n1, a->X))
  ------------------
  |  Branch (660:13): [True: 0, False: 4.32k]
  ------------------
  661|      0|            goto end;
  662|  4.32k|        if (!BN_copy(n2, a->Y))
  ------------------
  |  Branch (662:13): [True: 0, False: 4.32k]
  ------------------
  663|      0|            goto end;
  664|       |        /* n1 = X_a */
  665|       |        /* n2 = Y_a */
  666|  4.32k|    } else {
  667|    518|        if (!field_sqr(group, n0, b->Z, ctx))
  ------------------
  |  Branch (667:13): [True: 0, False: 518]
  ------------------
  668|      0|            goto end;
  669|    518|        if (!field_mul(group, n1, a->X, n0, ctx))
  ------------------
  |  Branch (669:13): [True: 0, False: 518]
  ------------------
  670|      0|            goto end;
  671|       |        /* n1 = X_a * Z_b^2 */
  672|       |
  673|    518|        if (!field_mul(group, n0, n0, b->Z, ctx))
  ------------------
  |  Branch (673:13): [True: 0, False: 518]
  ------------------
  674|      0|            goto end;
  675|    518|        if (!field_mul(group, n2, a->Y, n0, ctx))
  ------------------
  |  Branch (675:13): [True: 0, False: 518]
  ------------------
  676|      0|            goto end;
  677|       |        /* n2 = Y_a * Z_b^3 */
  678|    518|    }
  679|       |
  680|       |    /* n3, n4 */
  681|  4.83k|    if (a->Z_is_one) {
  ------------------
  |  Branch (681:9): [True: 74, False: 4.76k]
  ------------------
  682|     74|        if (!BN_copy(n3, b->X))
  ------------------
  |  Branch (682:13): [True: 0, False: 74]
  ------------------
  683|      0|            goto end;
  684|     74|        if (!BN_copy(n4, b->Y))
  ------------------
  |  Branch (684:13): [True: 0, False: 74]
  ------------------
  685|      0|            goto end;
  686|       |        /* n3 = X_b */
  687|       |        /* n4 = Y_b */
  688|  4.76k|    } else {
  689|  4.76k|        if (!field_sqr(group, n0, a->Z, ctx))
  ------------------
  |  Branch (689:13): [True: 0, False: 4.76k]
  ------------------
  690|      0|            goto end;
  691|  4.76k|        if (!field_mul(group, n3, b->X, n0, ctx))
  ------------------
  |  Branch (691:13): [True: 0, False: 4.76k]
  ------------------
  692|      0|            goto end;
  693|       |        /* n3 = X_b * Z_a^2 */
  694|       |
  695|  4.76k|        if (!field_mul(group, n0, n0, a->Z, ctx))
  ------------------
  |  Branch (695:13): [True: 0, False: 4.76k]
  ------------------
  696|      0|            goto end;
  697|  4.76k|        if (!field_mul(group, n4, b->Y, n0, ctx))
  ------------------
  |  Branch (697:13): [True: 0, False: 4.76k]
  ------------------
  698|      0|            goto end;
  699|       |        /* n4 = Y_b * Z_a^3 */
  700|  4.76k|    }
  701|       |
  702|       |    /* n5, n6 */
  703|  4.83k|    if (!BN_mod_sub_quick(n5, n1, n3, p))
  ------------------
  |  Branch (703:9): [True: 0, False: 4.83k]
  ------------------
  704|      0|        goto end;
  705|  4.83k|    if (!BN_mod_sub_quick(n6, n2, n4, p))
  ------------------
  |  Branch (705:9): [True: 0, False: 4.83k]
  ------------------
  706|      0|        goto end;
  707|       |    /* n5 = n1 - n3 */
  708|       |    /* n6 = n2 - n4 */
  709|       |
  710|  4.83k|    if (BN_is_zero(n5)) {
  ------------------
  |  Branch (710:9): [True: 0, False: 4.83k]
  ------------------
  711|      0|        if (BN_is_zero(n6)) {
  ------------------
  |  Branch (711:13): [True: 0, False: 0]
  ------------------
  712|       |            /* a is the same point as b */
  713|      0|            BN_CTX_end(ctx);
  714|      0|            ret = EC_POINT_dbl(group, r, a, ctx);
  715|      0|            ctx = NULL;
  716|      0|            goto end;
  717|      0|        } else {
  718|       |            /* a is the inverse of b */
  719|      0|            BN_zero(r->Z);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  720|      0|            r->Z_is_one = 0;
  721|      0|            ret = 1;
  722|      0|            goto end;
  723|      0|        }
  724|      0|    }
  725|       |
  726|       |    /* 'n7', 'n8' */
  727|  4.83k|    if (!BN_mod_add_quick(n1, n1, n3, p))
  ------------------
  |  Branch (727:9): [True: 0, False: 4.83k]
  ------------------
  728|      0|        goto end;
  729|  4.83k|    if (!BN_mod_add_quick(n2, n2, n4, p))
  ------------------
  |  Branch (729:9): [True: 0, False: 4.83k]
  ------------------
  730|      0|        goto end;
  731|       |    /* 'n7' = n1 + n3 */
  732|       |    /* 'n8' = n2 + n4 */
  733|       |
  734|       |    /* Z_r */
  735|  4.83k|    if (a->Z_is_one && b->Z_is_one) {
  ------------------
  |  Branch (735:9): [True: 74, False: 4.76k]
  |  Branch (735:24): [True: 0, False: 74]
  ------------------
  736|      0|        if (!BN_copy(r->Z, n5))
  ------------------
  |  Branch (736:13): [True: 0, False: 0]
  ------------------
  737|      0|            goto end;
  738|  4.83k|    } else {
  739|  4.83k|        if (a->Z_is_one) {
  ------------------
  |  Branch (739:13): [True: 74, False: 4.76k]
  ------------------
  740|     74|            if (!BN_copy(n0, b->Z))
  ------------------
  |  Branch (740:17): [True: 0, False: 74]
  ------------------
  741|      0|                goto end;
  742|  4.76k|        } else if (b->Z_is_one) {
  ------------------
  |  Branch (742:20): [True: 4.32k, False: 444]
  ------------------
  743|  4.32k|            if (!BN_copy(n0, a->Z))
  ------------------
  |  Branch (743:17): [True: 0, False: 4.32k]
  ------------------
  744|      0|                goto end;
  745|  4.32k|        } else {
  746|    444|            if (!field_mul(group, n0, a->Z, b->Z, ctx))
  ------------------
  |  Branch (746:17): [True: 0, False: 444]
  ------------------
  747|      0|                goto end;
  748|    444|        }
  749|  4.83k|        if (!field_mul(group, r->Z, n0, n5, ctx))
  ------------------
  |  Branch (749:13): [True: 0, False: 4.83k]
  ------------------
  750|      0|            goto end;
  751|  4.83k|    }
  752|  4.83k|    r->Z_is_one = 0;
  753|       |    /* Z_r = Z_a * Z_b * n5 */
  754|       |
  755|       |    /* X_r */
  756|  4.83k|    if (!field_sqr(group, n0, n6, ctx))
  ------------------
  |  Branch (756:9): [True: 0, False: 4.83k]
  ------------------
  757|      0|        goto end;
  758|  4.83k|    if (!field_sqr(group, n4, n5, ctx))
  ------------------
  |  Branch (758:9): [True: 0, False: 4.83k]
  ------------------
  759|      0|        goto end;
  760|  4.83k|    if (!field_mul(group, n3, n1, n4, ctx))
  ------------------
  |  Branch (760:9): [True: 0, False: 4.83k]
  ------------------
  761|      0|        goto end;
  762|  4.83k|    if (!BN_mod_sub_quick(r->X, n0, n3, p))
  ------------------
  |  Branch (762:9): [True: 0, False: 4.83k]
  ------------------
  763|      0|        goto end;
  764|       |    /* X_r = n6^2 - n5^2 * 'n7' */
  765|       |
  766|       |    /* 'n9' */
  767|  4.83k|    if (!BN_mod_lshift1_quick(n0, r->X, p))
  ------------------
  |  Branch (767:9): [True: 0, False: 4.83k]
  ------------------
  768|      0|        goto end;
  769|  4.83k|    if (!BN_mod_sub_quick(n0, n3, n0, p))
  ------------------
  |  Branch (769:9): [True: 0, False: 4.83k]
  ------------------
  770|      0|        goto end;
  771|       |    /* n9 = n5^2 * 'n7' - 2 * X_r */
  772|       |
  773|       |    /* Y_r */
  774|  4.83k|    if (!field_mul(group, n0, n0, n6, ctx))
  ------------------
  |  Branch (774:9): [True: 0, False: 4.83k]
  ------------------
  775|      0|        goto end;
  776|  4.83k|    if (!field_mul(group, n5, n4, n5, ctx))
  ------------------
  |  Branch (776:9): [True: 0, False: 4.83k]
  ------------------
  777|      0|        goto end;               /* now n5 is n5^3 */
  778|  4.83k|    if (!field_mul(group, n1, n2, n5, ctx))
  ------------------
  |  Branch (778:9): [True: 0, False: 4.83k]
  ------------------
  779|      0|        goto end;
  780|  4.83k|    if (!BN_mod_sub_quick(n0, n0, n1, p))
  ------------------
  |  Branch (780:9): [True: 0, False: 4.83k]
  ------------------
  781|      0|        goto end;
  782|  4.83k|    if (BN_is_odd(n0))
  ------------------
  |  Branch (782:9): [True: 2.38k, False: 2.45k]
  ------------------
  783|  2.38k|        if (!BN_add(n0, n0, p))
  ------------------
  |  Branch (783:13): [True: 0, False: 2.38k]
  ------------------
  784|      0|            goto end;
  785|       |    /* now  0 <= n0 < 2*p,  and n0 is even */
  786|  4.83k|    if (!BN_rshift1(r->Y, n0))
  ------------------
  |  Branch (786:9): [True: 0, False: 4.83k]
  ------------------
  787|      0|        goto end;
  788|       |    /* Y_r = (n6 * 'n9' - 'n8' * 'n5^3') / 2 */
  789|       |
  790|  4.83k|    ret = 1;
  791|       |
  792|  4.83k| end:
  793|  4.83k|    BN_CTX_end(ctx);
  794|  4.83k|    BN_CTX_free(new_ctx);
  795|  4.83k|    return ret;
  796|  4.83k|}
ossl_ec_GFp_simple_dbl:
  800|  53.7k|{
  801|  53.7k|    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,
  802|  53.7k|                      const BIGNUM *, BN_CTX *);
  803|  53.7k|    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
  804|  53.7k|    const BIGNUM *p;
  805|  53.7k|    BN_CTX *new_ctx = NULL;
  806|  53.7k|    BIGNUM *n0, *n1, *n2, *n3;
  807|  53.7k|    int ret = 0;
  808|       |
  809|  53.7k|    if (EC_POINT_is_at_infinity(group, a)) {
  ------------------
  |  Branch (809:9): [True: 17.0k, False: 36.6k]
  ------------------
  810|  17.0k|        BN_zero(r->Z);
  ------------------
  |  |  202|  17.0k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  811|  17.0k|        r->Z_is_one = 0;
  812|  17.0k|        return 1;
  813|  17.0k|    }
  814|       |
  815|  36.6k|    field_mul = group->meth->field_mul;
  816|  36.6k|    field_sqr = group->meth->field_sqr;
  817|  36.6k|    p = group->field;
  818|       |
  819|  36.6k|    if (ctx == NULL) {
  ------------------
  |  Branch (819:9): [True: 0, False: 36.6k]
  ------------------
  820|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  821|      0|        if (ctx == NULL)
  ------------------
  |  Branch (821:13): [True: 0, False: 0]
  ------------------
  822|      0|            return 0;
  823|      0|    }
  824|       |
  825|  36.6k|    BN_CTX_start(ctx);
  826|  36.6k|    n0 = BN_CTX_get(ctx);
  827|  36.6k|    n1 = BN_CTX_get(ctx);
  828|  36.6k|    n2 = BN_CTX_get(ctx);
  829|  36.6k|    n3 = BN_CTX_get(ctx);
  830|  36.6k|    if (n3 == NULL)
  ------------------
  |  Branch (830:9): [True: 0, False: 36.6k]
  ------------------
  831|      0|        goto err;
  832|       |
  833|       |    /*
  834|       |     * Note that in this function we must not read components of 'a' once we
  835|       |     * have written the corresponding components of 'r'. ('r' might the same
  836|       |     * as 'a'.)
  837|       |     */
  838|       |
  839|       |    /* n1 */
  840|  36.6k|    if (a->Z_is_one) {
  ------------------
  |  Branch (840:9): [True: 2.12k, False: 34.5k]
  ------------------
  841|  2.12k|        if (!field_sqr(group, n0, a->X, ctx))
  ------------------
  |  Branch (841:13): [True: 0, False: 2.12k]
  ------------------
  842|      0|            goto err;
  843|  2.12k|        if (!BN_mod_lshift1_quick(n1, n0, p))
  ------------------
  |  Branch (843:13): [True: 0, False: 2.12k]
  ------------------
  844|      0|            goto err;
  845|  2.12k|        if (!BN_mod_add_quick(n0, n0, n1, p))
  ------------------
  |  Branch (845:13): [True: 0, False: 2.12k]
  ------------------
  846|      0|            goto err;
  847|  2.12k|        if (!BN_mod_add_quick(n1, n0, group->a, p))
  ------------------
  |  Branch (847:13): [True: 0, False: 2.12k]
  ------------------
  848|      0|            goto err;
  849|       |        /* n1 = 3 * X_a^2 + a_curve */
  850|  34.5k|    } else if (group->a_is_minus3) {
  ------------------
  |  Branch (850:16): [True: 2.31k, False: 32.2k]
  ------------------
  851|  2.31k|        if (!field_sqr(group, n1, a->Z, ctx))
  ------------------
  |  Branch (851:13): [True: 0, False: 2.31k]
  ------------------
  852|      0|            goto err;
  853|  2.31k|        if (!BN_mod_add_quick(n0, a->X, n1, p))
  ------------------
  |  Branch (853:13): [True: 0, False: 2.31k]
  ------------------
  854|      0|            goto err;
  855|  2.31k|        if (!BN_mod_sub_quick(n2, a->X, n1, p))
  ------------------
  |  Branch (855:13): [True: 0, False: 2.31k]
  ------------------
  856|      0|            goto err;
  857|  2.31k|        if (!field_mul(group, n1, n0, n2, ctx))
  ------------------
  |  Branch (857:13): [True: 0, False: 2.31k]
  ------------------
  858|      0|            goto err;
  859|  2.31k|        if (!BN_mod_lshift1_quick(n0, n1, p))
  ------------------
  |  Branch (859:13): [True: 0, False: 2.31k]
  ------------------
  860|      0|            goto err;
  861|  2.31k|        if (!BN_mod_add_quick(n1, n0, n1, p))
  ------------------
  |  Branch (861:13): [True: 0, False: 2.31k]
  ------------------
  862|      0|            goto err;
  863|       |        /*-
  864|       |         * n1 = 3 * (X_a + Z_a^2) * (X_a - Z_a^2)
  865|       |         *    = 3 * X_a^2 - 3 * Z_a^4
  866|       |         */
  867|  32.2k|    } else {
  868|  32.2k|        if (!field_sqr(group, n0, a->X, ctx))
  ------------------
  |  Branch (868:13): [True: 0, False: 32.2k]
  ------------------
  869|      0|            goto err;
  870|  32.2k|        if (!BN_mod_lshift1_quick(n1, n0, p))
  ------------------
  |  Branch (870:13): [True: 0, False: 32.2k]
  ------------------
  871|      0|            goto err;
  872|  32.2k|        if (!BN_mod_add_quick(n0, n0, n1, p))
  ------------------
  |  Branch (872:13): [True: 0, False: 32.2k]
  ------------------
  873|      0|            goto err;
  874|  32.2k|        if (!field_sqr(group, n1, a->Z, ctx))
  ------------------
  |  Branch (874:13): [True: 0, False: 32.2k]
  ------------------
  875|      0|            goto err;
  876|  32.2k|        if (!field_sqr(group, n1, n1, ctx))
  ------------------
  |  Branch (876:13): [True: 0, False: 32.2k]
  ------------------
  877|      0|            goto err;
  878|  32.2k|        if (!field_mul(group, n1, n1, group->a, ctx))
  ------------------
  |  Branch (878:13): [True: 0, False: 32.2k]
  ------------------
  879|      0|            goto err;
  880|  32.2k|        if (!BN_mod_add_quick(n1, n1, n0, p))
  ------------------
  |  Branch (880:13): [True: 0, False: 32.2k]
  ------------------
  881|      0|            goto err;
  882|       |        /* n1 = 3 * X_a^2 + a_curve * Z_a^4 */
  883|  32.2k|    }
  884|       |
  885|       |    /* Z_r */
  886|  36.6k|    if (a->Z_is_one) {
  ------------------
  |  Branch (886:9): [True: 2.12k, False: 34.5k]
  ------------------
  887|  2.12k|        if (!BN_copy(n0, a->Y))
  ------------------
  |  Branch (887:13): [True: 0, False: 2.12k]
  ------------------
  888|      0|            goto err;
  889|  34.5k|    } else {
  890|  34.5k|        if (!field_mul(group, n0, a->Y, a->Z, ctx))
  ------------------
  |  Branch (890:13): [True: 0, False: 34.5k]
  ------------------
  891|      0|            goto err;
  892|  34.5k|    }
  893|  36.6k|    if (!BN_mod_lshift1_quick(r->Z, n0, p))
  ------------------
  |  Branch (893:9): [True: 0, False: 36.6k]
  ------------------
  894|      0|        goto err;
  895|  36.6k|    r->Z_is_one = 0;
  896|       |    /* Z_r = 2 * Y_a * Z_a */
  897|       |
  898|       |    /* n2 */
  899|  36.6k|    if (!field_sqr(group, n3, a->Y, ctx))
  ------------------
  |  Branch (899:9): [True: 0, False: 36.6k]
  ------------------
  900|      0|        goto err;
  901|  36.6k|    if (!field_mul(group, n2, a->X, n3, ctx))
  ------------------
  |  Branch (901:9): [True: 0, False: 36.6k]
  ------------------
  902|      0|        goto err;
  903|  36.6k|    if (!BN_mod_lshift_quick(n2, n2, 2, p))
  ------------------
  |  Branch (903:9): [True: 0, False: 36.6k]
  ------------------
  904|      0|        goto err;
  905|       |    /* n2 = 4 * X_a * Y_a^2 */
  906|       |
  907|       |    /* X_r */
  908|  36.6k|    if (!BN_mod_lshift1_quick(n0, n2, p))
  ------------------
  |  Branch (908:9): [True: 0, False: 36.6k]
  ------------------
  909|      0|        goto err;
  910|  36.6k|    if (!field_sqr(group, r->X, n1, ctx))
  ------------------
  |  Branch (910:9): [True: 0, False: 36.6k]
  ------------------
  911|      0|        goto err;
  912|  36.6k|    if (!BN_mod_sub_quick(r->X, r->X, n0, p))
  ------------------
  |  Branch (912:9): [True: 0, False: 36.6k]
  ------------------
  913|      0|        goto err;
  914|       |    /* X_r = n1^2 - 2 * n2 */
  915|       |
  916|       |    /* n3 */
  917|  36.6k|    if (!field_sqr(group, n0, n3, ctx))
  ------------------
  |  Branch (917:9): [True: 0, False: 36.6k]
  ------------------
  918|      0|        goto err;
  919|  36.6k|    if (!BN_mod_lshift_quick(n3, n0, 3, p))
  ------------------
  |  Branch (919:9): [True: 0, False: 36.6k]
  ------------------
  920|      0|        goto err;
  921|       |    /* n3 = 8 * Y_a^4 */
  922|       |
  923|       |    /* Y_r */
  924|  36.6k|    if (!BN_mod_sub_quick(n0, n2, r->X, p))
  ------------------
  |  Branch (924:9): [True: 0, False: 36.6k]
  ------------------
  925|      0|        goto err;
  926|  36.6k|    if (!field_mul(group, n0, n1, n0, ctx))
  ------------------
  |  Branch (926:9): [True: 0, False: 36.6k]
  ------------------
  927|      0|        goto err;
  928|  36.6k|    if (!BN_mod_sub_quick(r->Y, n0, n3, p))
  ------------------
  |  Branch (928:9): [True: 0, False: 36.6k]
  ------------------
  929|      0|        goto err;
  930|       |    /* Y_r = n1 * (n2 - X_r) - n3 */
  931|       |
  932|  36.6k|    ret = 1;
  933|       |
  934|  36.6k| err:
  935|  36.6k|    BN_CTX_end(ctx);
  936|  36.6k|    BN_CTX_free(new_ctx);
  937|  36.6k|    return ret;
  938|  36.6k|}
ossl_ec_GFp_simple_invert:
  942|  2.69k|{
  943|  2.69k|    if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(point->Y))
  ------------------
  |  Branch (943:9): [True: 930, False: 1.76k]
  |  Branch (943:50): [True: 16, False: 1.75k]
  ------------------
  944|       |        /* point is its own inverse */
  945|    946|        return 1;
  946|       |
  947|  1.75k|    return BN_usub(point->Y, group->field, point->Y);
  948|  2.69k|}
ossl_ec_GFp_simple_is_at_infinity:
  952|  92.6k|{
  953|  92.6k|    return BN_is_zero(point->Z);
  954|  92.6k|}
ossl_ec_GFp_simple_is_on_curve:
  958|  14.5k|{
  959|  14.5k|    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,
  960|  14.5k|                      const BIGNUM *, BN_CTX *);
  961|  14.5k|    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
  962|  14.5k|    const BIGNUM *p;
  963|  14.5k|    BN_CTX *new_ctx = NULL;
  964|  14.5k|    BIGNUM *rh, *tmp, *Z4, *Z6;
  965|  14.5k|    int ret = -1;
  966|       |
  967|  14.5k|    if (EC_POINT_is_at_infinity(group, point))
  ------------------
  |  Branch (967:9): [True: 0, False: 14.5k]
  ------------------
  968|      0|        return 1;
  969|       |
  970|  14.5k|    field_mul = group->meth->field_mul;
  971|  14.5k|    field_sqr = group->meth->field_sqr;
  972|  14.5k|    p = group->field;
  973|       |
  974|  14.5k|    if (ctx == NULL) {
  ------------------
  |  Branch (974:9): [True: 0, False: 14.5k]
  ------------------
  975|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
  976|      0|        if (ctx == NULL)
  ------------------
  |  Branch (976:13): [True: 0, False: 0]
  ------------------
  977|      0|            return -1;
  978|      0|    }
  979|       |
  980|  14.5k|    BN_CTX_start(ctx);
  981|  14.5k|    rh = BN_CTX_get(ctx);
  982|  14.5k|    tmp = BN_CTX_get(ctx);
  983|  14.5k|    Z4 = BN_CTX_get(ctx);
  984|  14.5k|    Z6 = BN_CTX_get(ctx);
  985|  14.5k|    if (Z6 == NULL)
  ------------------
  |  Branch (985:9): [True: 0, False: 14.5k]
  ------------------
  986|      0|        goto err;
  987|       |
  988|       |    /*-
  989|       |     * We have a curve defined by a Weierstrass equation
  990|       |     *      y^2 = x^3 + a*x + b.
  991|       |     * The point to consider is given in Jacobian projective coordinates
  992|       |     * where  (X, Y, Z)  represents  (x, y) = (X/Z^2, Y/Z^3).
  993|       |     * Substituting this and multiplying by  Z^6  transforms the above equation into
  994|       |     *      Y^2 = X^3 + a*X*Z^4 + b*Z^6.
  995|       |     * To test this, we add up the right-hand side in 'rh'.
  996|       |     */
  997|       |
  998|       |    /* rh := X^2 */
  999|  14.5k|    if (!field_sqr(group, rh, point->X, ctx))
  ------------------
  |  Branch (999:9): [True: 0, False: 14.5k]
  ------------------
 1000|      0|        goto err;
 1001|       |
 1002|  14.5k|    if (!point->Z_is_one) {
  ------------------
  |  Branch (1002:9): [True: 0, False: 14.5k]
  ------------------
 1003|      0|        if (!field_sqr(group, tmp, point->Z, ctx))
  ------------------
  |  Branch (1003:13): [True: 0, False: 0]
  ------------------
 1004|      0|            goto err;
 1005|      0|        if (!field_sqr(group, Z4, tmp, ctx))
  ------------------
  |  Branch (1005:13): [True: 0, False: 0]
  ------------------
 1006|      0|            goto err;
 1007|      0|        if (!field_mul(group, Z6, Z4, tmp, ctx))
  ------------------
  |  Branch (1007:13): [True: 0, False: 0]
  ------------------
 1008|      0|            goto err;
 1009|       |
 1010|       |        /* rh := (rh + a*Z^4)*X */
 1011|      0|        if (group->a_is_minus3) {
  ------------------
  |  Branch (1011:13): [True: 0, False: 0]
  ------------------
 1012|      0|            if (!BN_mod_lshift1_quick(tmp, Z4, p))
  ------------------
  |  Branch (1012:17): [True: 0, False: 0]
  ------------------
 1013|      0|                goto err;
 1014|      0|            if (!BN_mod_add_quick(tmp, tmp, Z4, p))
  ------------------
  |  Branch (1014:17): [True: 0, False: 0]
  ------------------
 1015|      0|                goto err;
 1016|      0|            if (!BN_mod_sub_quick(rh, rh, tmp, p))
  ------------------
  |  Branch (1016:17): [True: 0, False: 0]
  ------------------
 1017|      0|                goto err;
 1018|      0|            if (!field_mul(group, rh, rh, point->X, ctx))
  ------------------
  |  Branch (1018:17): [True: 0, False: 0]
  ------------------
 1019|      0|                goto err;
 1020|      0|        } else {
 1021|      0|            if (!field_mul(group, tmp, Z4, group->a, ctx))
  ------------------
  |  Branch (1021:17): [True: 0, False: 0]
  ------------------
 1022|      0|                goto err;
 1023|      0|            if (!BN_mod_add_quick(rh, rh, tmp, p))
  ------------------
  |  Branch (1023:17): [True: 0, False: 0]
  ------------------
 1024|      0|                goto err;
 1025|      0|            if (!field_mul(group, rh, rh, point->X, ctx))
  ------------------
  |  Branch (1025:17): [True: 0, False: 0]
  ------------------
 1026|      0|                goto err;
 1027|      0|        }
 1028|       |
 1029|       |        /* rh := rh + b*Z^6 */
 1030|      0|        if (!field_mul(group, tmp, group->b, Z6, ctx))
  ------------------
  |  Branch (1030:13): [True: 0, False: 0]
  ------------------
 1031|      0|            goto err;
 1032|      0|        if (!BN_mod_add_quick(rh, rh, tmp, p))
  ------------------
  |  Branch (1032:13): [True: 0, False: 0]
  ------------------
 1033|      0|            goto err;
 1034|  14.5k|    } else {
 1035|       |        /* point->Z_is_one */
 1036|       |
 1037|       |        /* rh := (rh + a)*X */
 1038|  14.5k|        if (!BN_mod_add_quick(rh, rh, group->a, p))
  ------------------
  |  Branch (1038:13): [True: 0, False: 14.5k]
  ------------------
 1039|      0|            goto err;
 1040|  14.5k|        if (!field_mul(group, rh, rh, point->X, ctx))
  ------------------
  |  Branch (1040:13): [True: 0, False: 14.5k]
  ------------------
 1041|      0|            goto err;
 1042|       |        /* rh := rh + b */
 1043|  14.5k|        if (!BN_mod_add_quick(rh, rh, group->b, p))
  ------------------
  |  Branch (1043:13): [True: 0, False: 14.5k]
  ------------------
 1044|      0|            goto err;
 1045|  14.5k|    }
 1046|       |
 1047|       |    /* 'lh' := Y^2 */
 1048|  14.5k|    if (!field_sqr(group, tmp, point->Y, ctx))
  ------------------
  |  Branch (1048:9): [True: 0, False: 14.5k]
  ------------------
 1049|      0|        goto err;
 1050|       |
 1051|  14.5k|    ret = (0 == BN_ucmp(tmp, rh));
 1052|       |
 1053|  14.5k| err:
 1054|  14.5k|    BN_CTX_end(ctx);
 1055|  14.5k|    BN_CTX_free(new_ctx);
 1056|  14.5k|    return ret;
 1057|  14.5k|}
ossl_ec_GFp_simple_cmp:
 1061|     73|{
 1062|       |    /*-
 1063|       |     * return values:
 1064|       |     *  -1   error
 1065|       |     *   0   equal (in affine coordinates)
 1066|       |     *   1   not equal
 1067|       |     */
 1068|       |
 1069|     73|    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,
 1070|     73|                      const BIGNUM *, BN_CTX *);
 1071|     73|    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
 1072|     73|    BN_CTX *new_ctx = NULL;
 1073|     73|    BIGNUM *tmp1, *tmp2, *Za23, *Zb23;
 1074|     73|    const BIGNUM *tmp1_, *tmp2_;
 1075|     73|    int ret = -1;
 1076|       |
 1077|     73|    if (EC_POINT_is_at_infinity(group, a)) {
  ------------------
  |  Branch (1077:9): [True: 0, False: 73]
  ------------------
 1078|      0|        return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
  ------------------
  |  Branch (1078:16): [True: 0, False: 0]
  ------------------
 1079|      0|    }
 1080|       |
 1081|     73|    if (EC_POINT_is_at_infinity(group, b))
  ------------------
  |  Branch (1081:9): [True: 0, False: 73]
  ------------------
 1082|      0|        return 1;
 1083|       |
 1084|     73|    if (a->Z_is_one && b->Z_is_one) {
  ------------------
  |  Branch (1084:9): [True: 73, False: 0]
  |  Branch (1084:24): [True: 73, False: 0]
  ------------------
 1085|     73|        return ((BN_cmp(a->X, b->X) == 0) && BN_cmp(a->Y, b->Y) == 0) ? 0 : 1;
  ------------------
  |  Branch (1085:17): [True: 73, False: 0]
  |  Branch (1085:46): [True: 73, False: 0]
  ------------------
 1086|     73|    }
 1087|       |
 1088|      0|    field_mul = group->meth->field_mul;
 1089|      0|    field_sqr = group->meth->field_sqr;
 1090|       |
 1091|      0|    if (ctx == NULL) {
  ------------------
  |  Branch (1091:9): [True: 0, False: 0]
  ------------------
 1092|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
 1093|      0|        if (ctx == NULL)
  ------------------
  |  Branch (1093:13): [True: 0, False: 0]
  ------------------
 1094|      0|            return -1;
 1095|      0|    }
 1096|       |
 1097|      0|    BN_CTX_start(ctx);
 1098|      0|    tmp1 = BN_CTX_get(ctx);
 1099|      0|    tmp2 = BN_CTX_get(ctx);
 1100|      0|    Za23 = BN_CTX_get(ctx);
 1101|      0|    Zb23 = BN_CTX_get(ctx);
 1102|      0|    if (Zb23 == NULL)
  ------------------
  |  Branch (1102:9): [True: 0, False: 0]
  ------------------
 1103|      0|        goto end;
 1104|       |
 1105|       |    /*-
 1106|       |     * We have to decide whether
 1107|       |     *     (X_a/Z_a^2, Y_a/Z_a^3) = (X_b/Z_b^2, Y_b/Z_b^3),
 1108|       |     * or equivalently, whether
 1109|       |     *     (X_a*Z_b^2, Y_a*Z_b^3) = (X_b*Z_a^2, Y_b*Z_a^3).
 1110|       |     */
 1111|       |
 1112|      0|    if (!b->Z_is_one) {
  ------------------
  |  Branch (1112:9): [True: 0, False: 0]
  ------------------
 1113|      0|        if (!field_sqr(group, Zb23, b->Z, ctx))
  ------------------
  |  Branch (1113:13): [True: 0, False: 0]
  ------------------
 1114|      0|            goto end;
 1115|      0|        if (!field_mul(group, tmp1, a->X, Zb23, ctx))
  ------------------
  |  Branch (1115:13): [True: 0, False: 0]
  ------------------
 1116|      0|            goto end;
 1117|      0|        tmp1_ = tmp1;
 1118|      0|    } else
 1119|      0|        tmp1_ = a->X;
 1120|      0|    if (!a->Z_is_one) {
  ------------------
  |  Branch (1120:9): [True: 0, False: 0]
  ------------------
 1121|      0|        if (!field_sqr(group, Za23, a->Z, ctx))
  ------------------
  |  Branch (1121:13): [True: 0, False: 0]
  ------------------
 1122|      0|            goto end;
 1123|      0|        if (!field_mul(group, tmp2, b->X, Za23, ctx))
  ------------------
  |  Branch (1123:13): [True: 0, False: 0]
  ------------------
 1124|      0|            goto end;
 1125|      0|        tmp2_ = tmp2;
 1126|      0|    } else
 1127|      0|        tmp2_ = b->X;
 1128|       |
 1129|       |    /* compare  X_a*Z_b^2  with  X_b*Z_a^2 */
 1130|      0|    if (BN_cmp(tmp1_, tmp2_) != 0) {
  ------------------
  |  Branch (1130:9): [True: 0, False: 0]
  ------------------
 1131|      0|        ret = 1;                /* points differ */
 1132|      0|        goto end;
 1133|      0|    }
 1134|       |
 1135|      0|    if (!b->Z_is_one) {
  ------------------
  |  Branch (1135:9): [True: 0, False: 0]
  ------------------
 1136|      0|        if (!field_mul(group, Zb23, Zb23, b->Z, ctx))
  ------------------
  |  Branch (1136:13): [True: 0, False: 0]
  ------------------
 1137|      0|            goto end;
 1138|      0|        if (!field_mul(group, tmp1, a->Y, Zb23, ctx))
  ------------------
  |  Branch (1138:13): [True: 0, False: 0]
  ------------------
 1139|      0|            goto end;
 1140|       |        /* tmp1_ = tmp1 */
 1141|      0|    } else
 1142|      0|        tmp1_ = a->Y;
 1143|      0|    if (!a->Z_is_one) {
  ------------------
  |  Branch (1143:9): [True: 0, False: 0]
  ------------------
 1144|      0|        if (!field_mul(group, Za23, Za23, a->Z, ctx))
  ------------------
  |  Branch (1144:13): [True: 0, False: 0]
  ------------------
 1145|      0|            goto end;
 1146|      0|        if (!field_mul(group, tmp2, b->Y, Za23, ctx))
  ------------------
  |  Branch (1146:13): [True: 0, False: 0]
  ------------------
 1147|      0|            goto end;
 1148|       |        /* tmp2_ = tmp2 */
 1149|      0|    } else
 1150|      0|        tmp2_ = b->Y;
 1151|       |
 1152|       |    /* compare  Y_a*Z_b^3  with  Y_b*Z_a^3 */
 1153|      0|    if (BN_cmp(tmp1_, tmp2_) != 0) {
  ------------------
  |  Branch (1153:9): [True: 0, False: 0]
  ------------------
 1154|      0|        ret = 1;                /* points differ */
 1155|      0|        goto end;
 1156|      0|    }
 1157|       |
 1158|       |    /* points are equal */
 1159|      0|    ret = 0;
 1160|       |
 1161|      0| end:
 1162|      0|    BN_CTX_end(ctx);
 1163|      0|    BN_CTX_free(new_ctx);
 1164|      0|    return ret;
 1165|      0|}
ossl_ec_GFp_simple_points_make_affine:
 1208|    201|{
 1209|    201|    BN_CTX *new_ctx = NULL;
 1210|    201|    BIGNUM *tmp, *tmp_Z;
 1211|    201|    BIGNUM **prod_Z = NULL;
 1212|    201|    size_t i;
 1213|    201|    int ret = 0;
 1214|       |
 1215|    201|    if (num == 0)
  ------------------
  |  Branch (1215:9): [True: 0, False: 201]
  ------------------
 1216|      0|        return 1;
 1217|       |
 1218|    201|    if (ctx == NULL) {
  ------------------
  |  Branch (1218:9): [True: 0, False: 201]
  ------------------
 1219|      0|        ctx = new_ctx = BN_CTX_new_ex(group->libctx);
 1220|      0|        if (ctx == NULL)
  ------------------
  |  Branch (1220:13): [True: 0, False: 0]
  ------------------
 1221|      0|            return 0;
 1222|      0|    }
 1223|       |
 1224|    201|    BN_CTX_start(ctx);
 1225|    201|    tmp = BN_CTX_get(ctx);
 1226|    201|    tmp_Z = BN_CTX_get(ctx);
 1227|    201|    if (tmp_Z == NULL)
  ------------------
  |  Branch (1227:9): [True: 0, False: 201]
  ------------------
 1228|      0|        goto err;
 1229|       |
 1230|    201|    prod_Z = OPENSSL_malloc(num * sizeof(prod_Z[0]));
  ------------------
  |  |   97|    201|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1231|    201|    if (prod_Z == NULL)
  ------------------
  |  Branch (1231:9): [True: 0, False: 201]
  ------------------
 1232|      0|        goto err;
 1233|  1.18k|    for (i = 0; i < num; i++) {
  ------------------
  |  Branch (1233:17): [True: 986, False: 201]
  ------------------
 1234|    986|        prod_Z[i] = BN_new();
 1235|    986|        if (prod_Z[i] == NULL)
  ------------------
  |  Branch (1235:13): [True: 0, False: 986]
  ------------------
 1236|      0|            goto err;
 1237|    986|    }
 1238|       |
 1239|       |    /*
 1240|       |     * Set each prod_Z[i] to the product of points[0]->Z .. points[i]->Z,
 1241|       |     * skipping any zero-valued inputs (pretend that they're 1).
 1242|       |     */
 1243|       |
 1244|    201|    if (!BN_is_zero(points[0]->Z)) {
  ------------------
  |  Branch (1244:9): [True: 201, False: 0]
  ------------------
 1245|    201|        if (!BN_copy(prod_Z[0], points[0]->Z))
  ------------------
  |  Branch (1245:13): [True: 0, False: 201]
  ------------------
 1246|      0|            goto err;
 1247|    201|    } else {
 1248|      0|        if (group->meth->field_set_to_one != 0) {
  ------------------
  |  Branch (1248:13): [True: 0, False: 0]
  ------------------
 1249|      0|            if (!group->meth->field_set_to_one(group, prod_Z[0], ctx))
  ------------------
  |  Branch (1249:17): [True: 0, False: 0]
  ------------------
 1250|      0|                goto err;
 1251|      0|        } else {
 1252|      0|            if (!BN_one(prod_Z[0]))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1252:17): [True: 0, False: 0]
  ------------------
 1253|      0|                goto err;
 1254|      0|        }
 1255|      0|    }
 1256|       |
 1257|    986|    for (i = 1; i < num; i++) {
  ------------------
  |  Branch (1257:17): [True: 785, False: 201]
  ------------------
 1258|    785|        if (!BN_is_zero(points[i]->Z)) {
  ------------------
  |  Branch (1258:13): [True: 785, False: 0]
  ------------------
 1259|    785|            if (!group->
  ------------------
  |  Branch (1259:17): [True: 0, False: 785]
  ------------------
 1260|    785|                meth->field_mul(group, prod_Z[i], prod_Z[i - 1], points[i]->Z,
 1261|    785|                                ctx))
 1262|      0|                goto err;
 1263|    785|        } else {
 1264|      0|            if (!BN_copy(prod_Z[i], prod_Z[i - 1]))
  ------------------
  |  Branch (1264:17): [True: 0, False: 0]
  ------------------
 1265|      0|                goto err;
 1266|      0|        }
 1267|    785|    }
 1268|       |
 1269|       |    /*
 1270|       |     * Now use a single explicit inversion to replace every non-zero
 1271|       |     * points[i]->Z by its inverse.
 1272|       |     */
 1273|       |
 1274|    201|    if (!group->meth->field_inv(group, tmp, prod_Z[num - 1], ctx)) {
  ------------------
  |  Branch (1274:9): [True: 0, False: 201]
  ------------------
 1275|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1276|      0|        goto err;
 1277|      0|    }
 1278|    201|    if (group->meth->field_encode != NULL) {
  ------------------
  |  Branch (1278:9): [True: 201, False: 0]
  ------------------
 1279|       |        /*
 1280|       |         * In the Montgomery case, we just turned R*H (representing H) into
 1281|       |         * 1/(R*H), but we need R*(1/H) (representing 1/H); i.e. we need to
 1282|       |         * multiply by the Montgomery factor twice.
 1283|       |         */
 1284|    201|        if (!group->meth->field_encode(group, tmp, tmp, ctx))
  ------------------
  |  Branch (1284:13): [True: 0, False: 201]
  ------------------
 1285|      0|            goto err;
 1286|    201|        if (!group->meth->field_encode(group, tmp, tmp, ctx))
  ------------------
  |  Branch (1286:13): [True: 0, False: 201]
  ------------------
 1287|      0|            goto err;
 1288|    201|    }
 1289|       |
 1290|    986|    for (i = num - 1; i > 0; --i) {
  ------------------
  |  Branch (1290:23): [True: 785, False: 201]
  ------------------
 1291|       |        /*
 1292|       |         * Loop invariant: tmp is the product of the inverses of points[0]->Z
 1293|       |         * .. points[i]->Z (zero-valued inputs skipped).
 1294|       |         */
 1295|    785|        if (!BN_is_zero(points[i]->Z)) {
  ------------------
  |  Branch (1295:13): [True: 785, False: 0]
  ------------------
 1296|       |            /*
 1297|       |             * Set tmp_Z to the inverse of points[i]->Z (as product of Z
 1298|       |             * inverses 0 .. i, Z values 0 .. i - 1).
 1299|       |             */
 1300|    785|            if (!group->
  ------------------
  |  Branch (1300:17): [True: 0, False: 785]
  ------------------
 1301|    785|                meth->field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx))
 1302|      0|                goto err;
 1303|       |            /*
 1304|       |             * Update tmp to satisfy the loop invariant for i - 1.
 1305|       |             */
 1306|    785|            if (!group->meth->field_mul(group, tmp, tmp, points[i]->Z, ctx))
  ------------------
  |  Branch (1306:17): [True: 0, False: 785]
  ------------------
 1307|      0|                goto err;
 1308|       |            /* Replace points[i]->Z by its inverse. */
 1309|    785|            if (!BN_copy(points[i]->Z, tmp_Z))
  ------------------
  |  Branch (1309:17): [True: 0, False: 785]
  ------------------
 1310|      0|                goto err;
 1311|    785|        }
 1312|    785|    }
 1313|       |
 1314|    201|    if (!BN_is_zero(points[0]->Z)) {
  ------------------
  |  Branch (1314:9): [True: 201, False: 0]
  ------------------
 1315|       |        /* Replace points[0]->Z by its inverse. */
 1316|    201|        if (!BN_copy(points[0]->Z, tmp))
  ------------------
  |  Branch (1316:13): [True: 0, False: 201]
  ------------------
 1317|      0|            goto err;
 1318|    201|    }
 1319|       |
 1320|       |    /* Finally, fix up the X and Y coordinates for all points. */
 1321|       |
 1322|  1.18k|    for (i = 0; i < num; i++) {
  ------------------
  |  Branch (1322:17): [True: 986, False: 201]
  ------------------
 1323|    986|        EC_POINT *p = points[i];
 1324|       |
 1325|    986|        if (!BN_is_zero(p->Z)) {
  ------------------
  |  Branch (1325:13): [True: 986, False: 0]
  ------------------
 1326|       |            /* turn  (X, Y, 1/Z)  into  (X/Z^2, Y/Z^3, 1) */
 1327|       |
 1328|    986|            if (!group->meth->field_sqr(group, tmp, p->Z, ctx))
  ------------------
  |  Branch (1328:17): [True: 0, False: 986]
  ------------------
 1329|      0|                goto err;
 1330|    986|            if (!group->meth->field_mul(group, p->X, p->X, tmp, ctx))
  ------------------
  |  Branch (1330:17): [True: 0, False: 986]
  ------------------
 1331|      0|                goto err;
 1332|       |
 1333|    986|            if (!group->meth->field_mul(group, tmp, tmp, p->Z, ctx))
  ------------------
  |  Branch (1333:17): [True: 0, False: 986]
  ------------------
 1334|      0|                goto err;
 1335|    986|            if (!group->meth->field_mul(group, p->Y, p->Y, tmp, ctx))
  ------------------
  |  Branch (1335:17): [True: 0, False: 986]
  ------------------
 1336|      0|                goto err;
 1337|       |
 1338|    986|            if (group->meth->field_set_to_one != 0) {
  ------------------
  |  Branch (1338:17): [True: 986, False: 0]
  ------------------
 1339|    986|                if (!group->meth->field_set_to_one(group, p->Z, ctx))
  ------------------
  |  Branch (1339:21): [True: 0, False: 986]
  ------------------
 1340|      0|                    goto err;
 1341|    986|            } else {
 1342|      0|                if (!BN_one(p->Z))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1342:21): [True: 0, False: 0]
  ------------------
 1343|      0|                    goto err;
 1344|      0|            }
 1345|    986|            p->Z_is_one = 1;
 1346|    986|        }
 1347|    986|    }
 1348|       |
 1349|    201|    ret = 1;
 1350|       |
 1351|    201| err:
 1352|    201|    BN_CTX_end(ctx);
 1353|    201|    BN_CTX_free(new_ctx);
 1354|    201|    if (prod_Z != NULL) {
  ------------------
  |  Branch (1354:9): [True: 201, False: 0]
  ------------------
 1355|  1.18k|        for (i = 0; i < num; i++) {
  ------------------
  |  Branch (1355:21): [True: 986, False: 201]
  ------------------
 1356|    986|            if (prod_Z[i] == NULL)
  ------------------
  |  Branch (1356:17): [True: 0, False: 986]
  ------------------
 1357|      0|                break;
 1358|    986|            BN_clear_free(prod_Z[i]);
 1359|    986|        }
 1360|    201|        OPENSSL_free(prod_Z);
  ------------------
  |  |  107|    201|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    201|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    201|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1361|    201|    }
 1362|    201|    return ret;
 1363|    201|}
ossl_ec_GFp_simple_blind_coordinates:
 1432|    197|{
 1433|    197|    int ret = 0;
 1434|    197|    BIGNUM *lambda = NULL;
 1435|    197|    BIGNUM *temp = NULL;
 1436|       |
 1437|    197|    BN_CTX_start(ctx);
 1438|    197|    lambda = BN_CTX_get(ctx);
 1439|    197|    temp = BN_CTX_get(ctx);
 1440|    197|    if (temp == NULL) {
  ------------------
  |  Branch (1440:9): [True: 0, False: 197]
  ------------------
 1441|      0|        ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1442|      0|        goto end;
 1443|      0|    }
 1444|       |
 1445|       |    /*-
 1446|       |     * Make sure lambda is not zero.
 1447|       |     * If the RNG fails, we cannot blind but nevertheless want
 1448|       |     * code to continue smoothly and not clobber the error stack.
 1449|       |     */
 1450|    197|    do {
 1451|    197|        ERR_set_mark();
 1452|    197|        ret = BN_priv_rand_range_ex(lambda, group->field, 0, ctx);
 1453|    197|        ERR_pop_to_mark();
 1454|    197|        if (ret == 0) {
  ------------------
  |  Branch (1454:13): [True: 0, False: 197]
  ------------------
 1455|      0|            ret = 1;
 1456|      0|            goto end;
 1457|      0|        }
 1458|    197|    } while (BN_is_zero(lambda));
  ------------------
  |  Branch (1458:14): [True: 0, False: 197]
  ------------------
 1459|       |
 1460|       |    /* if field_encode defined convert between representations */
 1461|    197|    if ((group->meth->field_encode != NULL
  ------------------
  |  Branch (1461:10): [True: 197, False: 0]
  ------------------
 1462|    197|         && !group->meth->field_encode(group, lambda, lambda, ctx))
  ------------------
  |  Branch (1462:13): [True: 0, False: 197]
  ------------------
 1463|    197|        || !group->meth->field_mul(group, p->Z, p->Z, lambda, ctx)
  ------------------
  |  Branch (1463:12): [True: 0, False: 197]
  ------------------
 1464|    197|        || !group->meth->field_sqr(group, temp, lambda, ctx)
  ------------------
  |  Branch (1464:12): [True: 0, False: 197]
  ------------------
 1465|    197|        || !group->meth->field_mul(group, p->X, p->X, temp, ctx)
  ------------------
  |  Branch (1465:12): [True: 0, False: 197]
  ------------------
 1466|    197|        || !group->meth->field_mul(group, temp, temp, lambda, ctx)
  ------------------
  |  Branch (1466:12): [True: 0, False: 197]
  ------------------
 1467|    197|        || !group->meth->field_mul(group, p->Y, p->Y, temp, ctx))
  ------------------
  |  Branch (1467:12): [True: 0, False: 197]
  ------------------
 1468|      0|        goto end;
 1469|       |
 1470|    197|    p->Z_is_one = 0;
 1471|    197|    ret = 1;
 1472|       |
 1473|    197| end:
 1474|    197|    BN_CTX_end(ctx);
 1475|    197|    return ret;
 1476|    197|}
ossl_ec_GFp_simple_ladder_pre:
 1496|    428|{
 1497|    428|    BIGNUM *t1, *t2, *t3, *t4, *t5 = NULL;
 1498|       |
 1499|    428|    t1 = s->Z;
 1500|    428|    t2 = r->Z;
 1501|    428|    t3 = s->X;
 1502|    428|    t4 = r->X;
 1503|    428|    t5 = s->Y;
 1504|       |
 1505|    428|    if (!p->Z_is_one /* r := 2p */
  ------------------
  |  Branch (1505:9): [True: 0, False: 428]
  ------------------
 1506|    428|        || !group->meth->field_sqr(group, t3, p->X, ctx)
  ------------------
  |  Branch (1506:12): [True: 0, False: 428]
  ------------------
 1507|    428|        || !BN_mod_sub_quick(t4, t3, group->a, group->field)
  ------------------
  |  Branch (1507:12): [True: 0, False: 428]
  ------------------
 1508|    428|        || !group->meth->field_sqr(group, t4, t4, ctx)
  ------------------
  |  Branch (1508:12): [True: 0, False: 428]
  ------------------
 1509|    428|        || !group->meth->field_mul(group, t5, p->X, group->b, ctx)
  ------------------
  |  Branch (1509:12): [True: 0, False: 428]
  ------------------
 1510|    428|        || !BN_mod_lshift_quick(t5, t5, 3, group->field)
  ------------------
  |  Branch (1510:12): [True: 0, False: 428]
  ------------------
 1511|       |        /* r->X coord output */
 1512|    428|        || !BN_mod_sub_quick(r->X, t4, t5, group->field)
  ------------------
  |  Branch (1512:12): [True: 0, False: 428]
  ------------------
 1513|    428|        || !BN_mod_add_quick(t1, t3, group->a, group->field)
  ------------------
  |  Branch (1513:12): [True: 0, False: 428]
  ------------------
 1514|    428|        || !group->meth->field_mul(group, t2, p->X, t1, ctx)
  ------------------
  |  Branch (1514:12): [True: 0, False: 428]
  ------------------
 1515|    428|        || !BN_mod_add_quick(t2, group->b, t2, group->field)
  ------------------
  |  Branch (1515:12): [True: 0, False: 428]
  ------------------
 1516|       |        /* r->Z coord output */
 1517|    428|        || !BN_mod_lshift_quick(r->Z, t2, 2, group->field))
  ------------------
  |  Branch (1517:12): [True: 0, False: 428]
  ------------------
 1518|      0|        return 0;
 1519|       |
 1520|       |    /* make sure lambda (r->Y here for storage) is not zero */
 1521|    428|    do {
 1522|    428|        if (!BN_priv_rand_range_ex(r->Y, group->field, 0, ctx))
  ------------------
  |  Branch (1522:13): [True: 0, False: 428]
  ------------------
 1523|      0|            return 0;
 1524|    428|    } while (BN_is_zero(r->Y));
  ------------------
  |  Branch (1524:14): [True: 0, False: 428]
  ------------------
 1525|       |
 1526|       |    /* make sure lambda (s->Z here for storage) is not zero */
 1527|    428|    do {
 1528|    428|        if (!BN_priv_rand_range_ex(s->Z, group->field, 0, ctx))
  ------------------
  |  Branch (1528:13): [True: 0, False: 428]
  ------------------
 1529|      0|            return 0;
 1530|    428|    } while (BN_is_zero(s->Z));
  ------------------
  |  Branch (1530:14): [True: 0, False: 428]
  ------------------
 1531|       |
 1532|       |    /* if field_encode defined convert between representations */
 1533|    428|    if (group->meth->field_encode != NULL
  ------------------
  |  Branch (1533:9): [True: 428, False: 0]
  ------------------
 1534|    428|        && (!group->meth->field_encode(group, r->Y, r->Y, ctx)
  ------------------
  |  Branch (1534:13): [True: 0, False: 428]
  ------------------
 1535|    428|            || !group->meth->field_encode(group, s->Z, s->Z, ctx)))
  ------------------
  |  Branch (1535:16): [True: 0, False: 428]
  ------------------
 1536|      0|        return 0;
 1537|       |
 1538|       |    /* blind r and s independently */
 1539|    428|    if (!group->meth->field_mul(group, r->Z, r->Z, r->Y, ctx)
  ------------------
  |  Branch (1539:9): [True: 0, False: 428]
  ------------------
 1540|    428|        || !group->meth->field_mul(group, r->X, r->X, r->Y, ctx)
  ------------------
  |  Branch (1540:12): [True: 0, False: 428]
  ------------------
 1541|    428|        || !group->meth->field_mul(group, s->X, p->X, s->Z, ctx)) /* s := p */
  ------------------
  |  Branch (1541:12): [True: 0, False: 428]
  ------------------
 1542|      0|        return 0;
 1543|       |
 1544|    428|    r->Z_is_one = 0;
 1545|    428|    s->Z_is_one = 0;
 1546|       |
 1547|    428|    return 1;
 1548|    428|}
ossl_ec_GFp_simple_ladder_step:
 1566|   231k|{
 1567|   231k|    int ret = 0;
 1568|   231k|    BIGNUM *t0, *t1, *t2, *t3, *t4, *t5, *t6 = NULL;
 1569|       |
 1570|   231k|    BN_CTX_start(ctx);
 1571|   231k|    t0 = BN_CTX_get(ctx);
 1572|   231k|    t1 = BN_CTX_get(ctx);
 1573|   231k|    t2 = BN_CTX_get(ctx);
 1574|   231k|    t3 = BN_CTX_get(ctx);
 1575|   231k|    t4 = BN_CTX_get(ctx);
 1576|   231k|    t5 = BN_CTX_get(ctx);
 1577|   231k|    t6 = BN_CTX_get(ctx);
 1578|       |
 1579|   231k|    if (t6 == NULL
  ------------------
  |  Branch (1579:9): [True: 0, False: 231k]
  ------------------
 1580|   231k|        || !group->meth->field_mul(group, t6, r->X, s->X, ctx)
  ------------------
  |  Branch (1580:12): [True: 0, False: 231k]
  ------------------
 1581|   231k|        || !group->meth->field_mul(group, t0, r->Z, s->Z, ctx)
  ------------------
  |  Branch (1581:12): [True: 0, False: 231k]
  ------------------
 1582|   231k|        || !group->meth->field_mul(group, t4, r->X, s->Z, ctx)
  ------------------
  |  Branch (1582:12): [True: 0, False: 231k]
  ------------------
 1583|   231k|        || !group->meth->field_mul(group, t3, r->Z, s->X, ctx)
  ------------------
  |  Branch (1583:12): [True: 0, False: 231k]
  ------------------
 1584|   231k|        || !group->meth->field_mul(group, t5, group->a, t0, ctx)
  ------------------
  |  Branch (1584:12): [True: 0, False: 231k]
  ------------------
 1585|   231k|        || !BN_mod_add_quick(t5, t6, t5, group->field)
  ------------------
  |  Branch (1585:12): [True: 0, False: 231k]
  ------------------
 1586|   231k|        || !BN_mod_add_quick(t6, t3, t4, group->field)
  ------------------
  |  Branch (1586:12): [True: 0, False: 231k]
  ------------------
 1587|   231k|        || !group->meth->field_mul(group, t5, t6, t5, ctx)
  ------------------
  |  Branch (1587:12): [True: 0, False: 231k]
  ------------------
 1588|   231k|        || !group->meth->field_sqr(group, t0, t0, ctx)
  ------------------
  |  Branch (1588:12): [True: 0, False: 231k]
  ------------------
 1589|   231k|        || !BN_mod_lshift_quick(t2, group->b, 2, group->field)
  ------------------
  |  Branch (1589:12): [True: 0, False: 231k]
  ------------------
 1590|   231k|        || !group->meth->field_mul(group, t0, t2, t0, ctx)
  ------------------
  |  Branch (1590:12): [True: 0, False: 231k]
  ------------------
 1591|   231k|        || !BN_mod_lshift1_quick(t5, t5, group->field)
  ------------------
  |  Branch (1591:12): [True: 0, False: 231k]
  ------------------
 1592|   231k|        || !BN_mod_sub_quick(t3, t4, t3, group->field)
  ------------------
  |  Branch (1592:12): [True: 0, False: 231k]
  ------------------
 1593|       |        /* s->Z coord output */
 1594|   231k|        || !group->meth->field_sqr(group, s->Z, t3, ctx)
  ------------------
  |  Branch (1594:12): [True: 0, False: 231k]
  ------------------
 1595|   231k|        || !group->meth->field_mul(group, t4, s->Z, p->X, ctx)
  ------------------
  |  Branch (1595:12): [True: 0, False: 231k]
  ------------------
 1596|   231k|        || !BN_mod_add_quick(t0, t0, t5, group->field)
  ------------------
  |  Branch (1596:12): [True: 0, False: 231k]
  ------------------
 1597|       |        /* s->X coord output */
 1598|   231k|        || !BN_mod_sub_quick(s->X, t0, t4, group->field)
  ------------------
  |  Branch (1598:12): [True: 0, False: 231k]
  ------------------
 1599|   231k|        || !group->meth->field_sqr(group, t4, r->X, ctx)
  ------------------
  |  Branch (1599:12): [True: 0, False: 231k]
  ------------------
 1600|   231k|        || !group->meth->field_sqr(group, t5, r->Z, ctx)
  ------------------
  |  Branch (1600:12): [True: 0, False: 231k]
  ------------------
 1601|   231k|        || !group->meth->field_mul(group, t6, t5, group->a, ctx)
  ------------------
  |  Branch (1601:12): [True: 0, False: 231k]
  ------------------
 1602|   231k|        || !BN_mod_add_quick(t1, r->X, r->Z, group->field)
  ------------------
  |  Branch (1602:12): [True: 0, False: 231k]
  ------------------
 1603|   231k|        || !group->meth->field_sqr(group, t1, t1, ctx)
  ------------------
  |  Branch (1603:12): [True: 0, False: 231k]
  ------------------
 1604|   231k|        || !BN_mod_sub_quick(t1, t1, t4, group->field)
  ------------------
  |  Branch (1604:12): [True: 0, False: 231k]
  ------------------
 1605|   231k|        || !BN_mod_sub_quick(t1, t1, t5, group->field)
  ------------------
  |  Branch (1605:12): [True: 0, False: 231k]
  ------------------
 1606|   231k|        || !BN_mod_sub_quick(t3, t4, t6, group->field)
  ------------------
  |  Branch (1606:12): [True: 0, False: 231k]
  ------------------
 1607|   231k|        || !group->meth->field_sqr(group, t3, t3, ctx)
  ------------------
  |  Branch (1607:12): [True: 0, False: 231k]
  ------------------
 1608|   231k|        || !group->meth->field_mul(group, t0, t5, t1, ctx)
  ------------------
  |  Branch (1608:12): [True: 0, False: 231k]
  ------------------
 1609|   231k|        || !group->meth->field_mul(group, t0, t2, t0, ctx)
  ------------------
  |  Branch (1609:12): [True: 0, False: 231k]
  ------------------
 1610|       |        /* r->X coord output */
 1611|   231k|        || !BN_mod_sub_quick(r->X, t3, t0, group->field)
  ------------------
  |  Branch (1611:12): [True: 0, False: 231k]
  ------------------
 1612|   231k|        || !BN_mod_add_quick(t3, t4, t6, group->field)
  ------------------
  |  Branch (1612:12): [True: 0, False: 231k]
  ------------------
 1613|   231k|        || !group->meth->field_sqr(group, t4, t5, ctx)
  ------------------
  |  Branch (1613:12): [True: 0, False: 231k]
  ------------------
 1614|   231k|        || !group->meth->field_mul(group, t4, t4, t2, ctx)
  ------------------
  |  Branch (1614:12): [True: 0, False: 231k]
  ------------------
 1615|   231k|        || !group->meth->field_mul(group, t1, t1, t3, ctx)
  ------------------
  |  Branch (1615:12): [True: 0, False: 231k]
  ------------------
 1616|   231k|        || !BN_mod_lshift1_quick(t1, t1, group->field)
  ------------------
  |  Branch (1616:12): [True: 0, False: 231k]
  ------------------
 1617|       |        /* r->Z coord output */
 1618|   231k|        || !BN_mod_add_quick(r->Z, t4, t1, group->field))
  ------------------
  |  Branch (1618:12): [True: 0, False: 231k]
  ------------------
 1619|      0|        goto err;
 1620|       |
 1621|   231k|    ret = 1;
 1622|       |
 1623|   231k| err:
 1624|   231k|    BN_CTX_end(ctx);
 1625|   231k|    return ret;
 1626|   231k|}
ossl_ec_GFp_simple_ladder_post:
 1654|    428|{
 1655|    428|    int ret = 0;
 1656|    428|    BIGNUM *t0, *t1, *t2, *t3, *t4, *t5, *t6 = NULL;
 1657|       |
 1658|    428|    if (BN_is_zero(r->Z))
  ------------------
  |  Branch (1658:9): [True: 55, False: 373]
  ------------------
 1659|     55|        return EC_POINT_set_to_infinity(group, r);
 1660|       |
 1661|    373|    if (BN_is_zero(s->Z)) {
  ------------------
  |  Branch (1661:9): [True: 4, False: 369]
  ------------------
 1662|      4|        if (!EC_POINT_copy(r, p)
  ------------------
  |  Branch (1662:13): [True: 0, False: 4]
  ------------------
 1663|      4|            || !EC_POINT_invert(group, r, ctx))
  ------------------
  |  Branch (1663:16): [True: 0, False: 4]
  ------------------
 1664|      0|            return 0;
 1665|      4|        return 1;
 1666|      4|    }
 1667|       |
 1668|    369|    BN_CTX_start(ctx);
 1669|    369|    t0 = BN_CTX_get(ctx);
 1670|    369|    t1 = BN_CTX_get(ctx);
 1671|    369|    t2 = BN_CTX_get(ctx);
 1672|    369|    t3 = BN_CTX_get(ctx);
 1673|    369|    t4 = BN_CTX_get(ctx);
 1674|    369|    t5 = BN_CTX_get(ctx);
 1675|    369|    t6 = BN_CTX_get(ctx);
 1676|       |
 1677|    369|    if (t6 == NULL
  ------------------
  |  Branch (1677:9): [True: 0, False: 369]
  ------------------
 1678|    369|        || !BN_mod_lshift1_quick(t4, p->Y, group->field)
  ------------------
  |  Branch (1678:12): [True: 0, False: 369]
  ------------------
 1679|    369|        || !group->meth->field_mul(group, t6, r->X, t4, ctx)
  ------------------
  |  Branch (1679:12): [True: 0, False: 369]
  ------------------
 1680|    369|        || !group->meth->field_mul(group, t6, s->Z, t6, ctx)
  ------------------
  |  Branch (1680:12): [True: 0, False: 369]
  ------------------
 1681|    369|        || !group->meth->field_mul(group, t5, r->Z, t6, ctx)
  ------------------
  |  Branch (1681:12): [True: 0, False: 369]
  ------------------
 1682|    369|        || !BN_mod_lshift1_quick(t1, group->b, group->field)
  ------------------
  |  Branch (1682:12): [True: 0, False: 369]
  ------------------
 1683|    369|        || !group->meth->field_mul(group, t1, s->Z, t1, ctx)
  ------------------
  |  Branch (1683:12): [True: 0, False: 369]
  ------------------
 1684|    369|        || !group->meth->field_sqr(group, t3, r->Z, ctx)
  ------------------
  |  Branch (1684:12): [True: 0, False: 369]
  ------------------
 1685|    369|        || !group->meth->field_mul(group, t2, t3, t1, ctx)
  ------------------
  |  Branch (1685:12): [True: 0, False: 369]
  ------------------
 1686|    369|        || !group->meth->field_mul(group, t6, r->Z, group->a, ctx)
  ------------------
  |  Branch (1686:12): [True: 0, False: 369]
  ------------------
 1687|    369|        || !group->meth->field_mul(group, t1, p->X, r->X, ctx)
  ------------------
  |  Branch (1687:12): [True: 0, False: 369]
  ------------------
 1688|    369|        || !BN_mod_add_quick(t1, t1, t6, group->field)
  ------------------
  |  Branch (1688:12): [True: 0, False: 369]
  ------------------
 1689|    369|        || !group->meth->field_mul(group, t1, s->Z, t1, ctx)
  ------------------
  |  Branch (1689:12): [True: 0, False: 369]
  ------------------
 1690|    369|        || !group->meth->field_mul(group, t0, p->X, r->Z, ctx)
  ------------------
  |  Branch (1690:12): [True: 0, False: 369]
  ------------------
 1691|    369|        || !BN_mod_add_quick(t6, r->X, t0, group->field)
  ------------------
  |  Branch (1691:12): [True: 0, False: 369]
  ------------------
 1692|    369|        || !group->meth->field_mul(group, t6, t6, t1, ctx)
  ------------------
  |  Branch (1692:12): [True: 0, False: 369]
  ------------------
 1693|    369|        || !BN_mod_add_quick(t6, t6, t2, group->field)
  ------------------
  |  Branch (1693:12): [True: 0, False: 369]
  ------------------
 1694|    369|        || !BN_mod_sub_quick(t0, t0, r->X, group->field)
  ------------------
  |  Branch (1694:12): [True: 0, False: 369]
  ------------------
 1695|    369|        || !group->meth->field_sqr(group, t0, t0, ctx)
  ------------------
  |  Branch (1695:12): [True: 0, False: 369]
  ------------------
 1696|    369|        || !group->meth->field_mul(group, t0, t0, s->X, ctx)
  ------------------
  |  Branch (1696:12): [True: 0, False: 369]
  ------------------
 1697|    369|        || !BN_mod_sub_quick(t0, t6, t0, group->field)
  ------------------
  |  Branch (1697:12): [True: 0, False: 369]
  ------------------
 1698|    369|        || !group->meth->field_mul(group, t1, s->Z, t4, ctx)
  ------------------
  |  Branch (1698:12): [True: 0, False: 369]
  ------------------
 1699|    369|        || !group->meth->field_mul(group, t1, t3, t1, ctx)
  ------------------
  |  Branch (1699:12): [True: 0, False: 369]
  ------------------
 1700|    369|        || (group->meth->field_decode != NULL
  ------------------
  |  Branch (1700:13): [True: 369, False: 0]
  ------------------
 1701|    369|            && !group->meth->field_decode(group, t1, t1, ctx))
  ------------------
  |  Branch (1701:16): [True: 0, False: 369]
  ------------------
 1702|    369|        || !group->meth->field_inv(group, t1, t1, ctx)
  ------------------
  |  Branch (1702:12): [True: 0, False: 369]
  ------------------
 1703|    369|        || (group->meth->field_encode != NULL
  ------------------
  |  Branch (1703:13): [True: 369, False: 0]
  ------------------
 1704|    369|            && !group->meth->field_encode(group, t1, t1, ctx))
  ------------------
  |  Branch (1704:16): [True: 0, False: 369]
  ------------------
 1705|    369|        || !group->meth->field_mul(group, r->X, t5, t1, ctx)
  ------------------
  |  Branch (1705:12): [True: 0, False: 369]
  ------------------
 1706|    369|        || !group->meth->field_mul(group, r->Y, t0, t1, ctx))
  ------------------
  |  Branch (1706:12): [True: 0, False: 369]
  ------------------
 1707|      0|        goto err;
 1708|       |
 1709|    369|    if (group->meth->field_set_to_one != NULL) {
  ------------------
  |  Branch (1709:9): [True: 369, False: 0]
  ------------------
 1710|    369|        if (!group->meth->field_set_to_one(group, r->Z, ctx))
  ------------------
  |  Branch (1710:13): [True: 0, False: 369]
  ------------------
 1711|      0|            goto err;
 1712|    369|    } else {
 1713|      0|        if (!BN_one(r->Z))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1713:13): [True: 0, False: 0]
  ------------------
 1714|      0|            goto err;
 1715|      0|    }
 1716|       |
 1717|    369|    r->Z_is_one = 1;
 1718|    369|    ret = 1;
 1719|       |
 1720|    369| err:
 1721|    369|    BN_CTX_end(ctx);
 1722|    369|    return ret;
 1723|    369|}

ossl_ecx_public_from_private:
   29|     14|{
   30|     14|    switch (key->type) {
  ------------------
  |  Branch (30:13): [True: 0, False: 14]
  ------------------
   31|      2|    case ECX_KEY_TYPE_X25519:
  ------------------
  |  Branch (31:5): [True: 2, False: 12]
  ------------------
   32|      2|        ossl_x25519_public_from_private(key->pubkey, key->privkey);
   33|      2|        break;
   34|      4|    case ECX_KEY_TYPE_ED25519:
  ------------------
  |  Branch (34:5): [True: 4, False: 10]
  ------------------
   35|      4|        if (!ossl_ed25519_public_from_private(key->libctx, key->pubkey,
  ------------------
  |  Branch (35:13): [True: 0, False: 4]
  ------------------
   36|      4|                                              key->privkey, key->propq)) {
   37|      0|            ERR_raise(ERR_LIB_EC, EC_R_FAILED_MAKING_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   38|      0|            return 0;
   39|      0|        }
   40|      4|        break;
   41|      6|    case ECX_KEY_TYPE_X448:
  ------------------
  |  Branch (41:5): [True: 6, False: 8]
  ------------------
   42|      6|        ossl_x448_public_from_private(key->pubkey, key->privkey);
   43|      6|        break;
   44|      2|    case ECX_KEY_TYPE_ED448:
  ------------------
  |  Branch (44:5): [True: 2, False: 12]
  ------------------
   45|      2|        if (!ossl_ed448_public_from_private(key->libctx, key->pubkey,
  ------------------
  |  Branch (45:13): [True: 0, False: 2]
  ------------------
   46|      2|                                            key->privkey, key->propq)) {
   47|      0|            ERR_raise(ERR_LIB_EC, EC_R_FAILED_MAKING_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   48|      0|            return 0;
   49|      0|        }
   50|      2|        break;
   51|     14|    }
   52|     14|    return 1;
   53|     14|}
ossl_ecx_key_op:
  155|     64|{
  156|     64|    ECX_KEY *key = NULL;
  157|     64|    unsigned char *privkey, *pubkey;
  158|       |
  159|     64|    if (op != KEY_OP_KEYGEN) {
  ------------------
  |  Branch (159:9): [True: 64, False: 0]
  ------------------
  160|     64|        if (palg != NULL) {
  ------------------
  |  Branch (160:13): [True: 64, False: 0]
  ------------------
  161|     64|            int ptype;
  162|       |
  163|       |            /* Algorithm parameters must be absent */
  164|     64|            X509_ALGOR_get0(NULL, &ptype, NULL, palg);
  165|     64|            if (ptype != V_ASN1_UNDEF) {
  ------------------
  |  |   60|     64|# define V_ASN1_UNDEF                    -1
  ------------------
  |  Branch (165:17): [True: 6, False: 58]
  ------------------
  166|      6|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|      6|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      6|    (ERR_new(),                                                 \
  |  |  |  |  404|      6|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      6|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      6|     ERR_set_error)
  |  |  ------------------
  ------------------
  167|      6|                return 0;
  168|      6|            }
  169|     58|            if (id == EVP_PKEY_NONE)
  ------------------
  |  |   58|     58|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|     58|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (169:17): [True: 29, False: 29]
  ------------------
  170|     29|                id = OBJ_obj2nid(palg->algorithm);
  171|     29|            else if (id != OBJ_obj2nid(palg->algorithm)) {
  ------------------
  |  Branch (171:22): [True: 0, False: 29]
  ------------------
  172|      0|                ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  173|      0|                return 0;
  174|      0|            }
  175|     58|        }
  176|       |
  177|     58|        if (p == NULL || id == EVP_PKEY_NONE || plen != KEYLENID(id)) {
  ------------------
  |  |   58|     42|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|    100|#define NID_undef                       0
  |  |  ------------------
  ------------------
                      if (p == NULL || id == EVP_PKEY_NONE || plen != KEYLENID(id)) {
  ------------------
  |  |   12|     42|#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  ------------------
  |  |  |  |   11|     42|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     42|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5492|     84|#define NID_X25519              1034
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   79|     34|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5500|     34|#define NID_ED25519             1087
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (11:26): [True: 8, False: 34]
  |  |  |  |  |  Branch (11:53): [True: 12, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  ------------------
  |  |  |  |   26|     20|#  define X25519_KEYLEN         32
  |  |  ------------------
  |  |   13|     42|                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  ------------------
  |  |  |  |   80|     22|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  ------------------
  |  |  |  |  |  | 5496|     22|#define NID_X448                1035
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                                    : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  ------------------
  |  |  |  |   27|     12|#  define X448_KEYLEN           56
  |  |  ------------------
  |  |  |  Branch (13:41): [True: 12, False: 10]
  |  |  ------------------
  |  |   14|     22|                                                              : ED448_KEYLEN))
  |  |  ------------------
  |  |  |  |   29|     10|#  define ED448_KEYLEN          57
  |  |  ------------------
  ------------------
  |  Branch (177:13): [True: 16, False: 42]
  |  Branch (177:26): [True: 0, False: 42]
  |  Branch (177:49): [True: 20, False: 22]
  ------------------
  178|     36|            ERR_raise(ERR_LIB_EC, EC_R_INVALID_ENCODING);
  ------------------
  |  |  401|     36|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     36|    (ERR_new(),                                                 \
  |  |  |  |  404|     36|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     36|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     36|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     36|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     36|     ERR_set_error)
  |  |  ------------------
  ------------------
  179|     36|            return 0;
  180|     36|        }
  181|     58|    }
  182|       |
  183|     22|    key = ossl_ecx_key_new(libctx, KEYNID2TYPE(id), 1, propq);
  ------------------
  |  |   16|     22|    (IS25519(id) ? ((id) == EVP_PKEY_X25519 ? ECX_KEY_TYPE_X25519 \
  |  |  ------------------
  |  |  |  |   11|     22|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     22|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5492|     44|#define NID_X25519              1034
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   79|     17|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5500|     17|#define NID_ED25519             1087
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (11:26): [True: 5, False: 17]
  |  |  |  |  |  Branch (11:53): [True: 7, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (IS25519(id) ? ((id) == EVP_PKEY_X25519 ? ECX_KEY_TYPE_X25519 \
  |  |  ------------------
  |  |  |  |   78|     12|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  ------------------
  |  |  |  |  |  | 5492|     12|#define NID_X25519              1034
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (16:21): [True: 5, False: 7]
  |  |  ------------------
  |  |   17|     12|                                            : ECX_KEY_TYPE_ED25519) \
  |  |   18|     22|                 : ((id) == EVP_PKEY_X448 ? ECX_KEY_TYPE_X448 \
  |  |  ------------------
  |  |  |  |   80|     10|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  ------------------
  |  |  |  |  |  | 5496|     10|#define NID_X448                1035
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (18:21): [True: 7, False: 3]
  |  |  ------------------
  |  |   19|     10|                                          : ECX_KEY_TYPE_ED448))
  ------------------
  184|     22|    if (key == NULL) {
  ------------------
  |  Branch (184:9): [True: 0, False: 22]
  ------------------
  185|      0|        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  186|      0|        return 0;
  187|      0|    }
  188|     22|    pubkey = key->pubkey;
  189|       |
  190|     22|    if (op == KEY_OP_PUBLIC) {
  ------------------
  |  Branch (190:9): [True: 8, False: 14]
  ------------------
  191|      8|        memcpy(pubkey, p, plen);
  192|     14|    } else {
  193|     14|        privkey = ossl_ecx_key_allocate_privkey(key);
  194|     14|        if (privkey == NULL) {
  ------------------
  |  Branch (194:13): [True: 0, False: 14]
  ------------------
  195|      0|            ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  196|      0|            goto err;
  197|      0|        }
  198|     14|        if (op == KEY_OP_KEYGEN) {
  ------------------
  |  Branch (198:13): [True: 0, False: 14]
  ------------------
  199|      0|            if (id != EVP_PKEY_NONE) {
  ------------------
  |  |   58|      0|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|      0|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (199:17): [True: 0, False: 0]
  ------------------
  200|      0|                if (RAND_priv_bytes_ex(libctx, privkey, KEYLENID(id), 0) <= 0)
  ------------------
  |  |   12|      0|#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  ------------------
  |  |  |  |   11|      0|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5492|      0|#define NID_X25519              1034
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   79|      0|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5500|      0|#define NID_ED25519             1087
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (11:26): [True: 0, False: 0]
  |  |  |  |  |  Branch (11:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  ------------------
  |  |  |  |   26|      0|#  define X25519_KEYLEN         32
  |  |  ------------------
  |  |   13|      0|                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  ------------------
  |  |  |  |   80|      0|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  ------------------
  |  |  |  |  |  | 5496|      0|#define NID_X448                1035
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                                    : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  ------------------
  |  |  |  |   27|      0|#  define X448_KEYLEN           56
  |  |  ------------------
  |  |  |  Branch (13:41): [True: 0, False: 0]
  |  |  ------------------
  |  |   14|      0|                                                              : ED448_KEYLEN))
  |  |  ------------------
  |  |  |  |   29|      0|#  define ED448_KEYLEN          57
  |  |  ------------------
  ------------------
  |  Branch (200:21): [True: 0, False: 0]
  ------------------
  201|      0|                    goto err;
  202|      0|                if (id == EVP_PKEY_X25519) {
  ------------------
  |  |   78|      0|# define EVP_PKEY_X25519 NID_X25519
  |  |  ------------------
  |  |  |  | 5492|      0|#define NID_X25519              1034
  |  |  ------------------
  ------------------
  |  Branch (202:21): [True: 0, False: 0]
  ------------------
  203|      0|                    privkey[0] &= 248;
  204|      0|                    privkey[X25519_KEYLEN - 1] &= 127;
  ------------------
  |  |   26|      0|#  define X25519_KEYLEN         32
  ------------------
  205|      0|                    privkey[X25519_KEYLEN - 1] |= 64;
  ------------------
  |  |   26|      0|#  define X25519_KEYLEN         32
  ------------------
  206|      0|                } else if (id == EVP_PKEY_X448) {
  ------------------
  |  |   80|      0|# define EVP_PKEY_X448 NID_X448
  |  |  ------------------
  |  |  |  | 5496|      0|#define NID_X448                1035
  |  |  ------------------
  ------------------
  |  Branch (206:28): [True: 0, False: 0]
  ------------------
  207|      0|                    privkey[0] &= 252;
  208|      0|                    privkey[X448_KEYLEN - 1] |= 128;
  ------------------
  |  |   27|      0|#  define X448_KEYLEN           56
  ------------------
  209|      0|                }
  210|      0|            }
  211|     14|        } else {
  212|     14|            memcpy(privkey, p, KEYLENID(id));
  ------------------
  |  |   12|     14|#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  ------------------
  |  |  |  |   11|     14|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     14|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5492|     28|#define NID_X25519              1034
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  ------------------
  |  |  |  |  |  |   79|     12|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5500|     12|#define NID_ED25519             1087
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (11:26): [True: 2, False: 12]
  |  |  |  |  |  Branch (11:53): [True: 4, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  ------------------
  |  |  |  |   26|      6|#  define X25519_KEYLEN         32
  |  |  ------------------
  |  |   13|     14|                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  ------------------
  |  |  |  |   80|      8|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  ------------------
  |  |  |  |  |  | 5496|      8|#define NID_X448                1035
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                                    : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  ------------------
  |  |  |  |   27|      6|#  define X448_KEYLEN           56
  |  |  ------------------
  |  |  |  Branch (13:41): [True: 6, False: 2]
  |  |  ------------------
  |  |   14|      8|                                                              : ED448_KEYLEN))
  |  |  ------------------
  |  |  |  |   29|      2|#  define ED448_KEYLEN          57
  |  |  ------------------
  ------------------
  213|     14|        }
  214|     14|        if (!ossl_ecx_public_from_private(key)) {
  ------------------
  |  Branch (214:13): [True: 0, False: 14]
  ------------------
  215|      0|            ERR_raise(ERR_LIB_EC, EC_R_FAILED_MAKING_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  216|      0|            goto err;
  217|      0|        }
  218|     14|    }
  219|       |
  220|     22|    return key;
  221|      0| err:
  222|      0|    ossl_ecx_key_free(key);
  223|      0|    return NULL;
  224|     22|}
ossl_ecx_key_from_pkcs8:
  228|     34|{
  229|     34|    ECX_KEY *ecx = NULL;
  230|     34|    const unsigned char *p;
  231|     34|    int plen;
  232|     34|    ASN1_OCTET_STRING *oct = NULL;
  233|     34|    const X509_ALGOR *palg;
  234|       |
  235|     34|    if (!PKCS8_pkey_get0(NULL, &p, &plen, &palg, p8inf))
  ------------------
  |  Branch (235:9): [True: 0, False: 34]
  ------------------
  236|      0|        return 0;
  237|       |
  238|     34|    oct = d2i_ASN1_OCTET_STRING(NULL, &p, plen);
  239|     34|    if (oct == NULL) {
  ------------------
  |  Branch (239:9): [True: 13, False: 21]
  ------------------
  240|     13|        p = NULL;
  241|     13|        plen = 0;
  242|     21|    } else {
  243|     21|        p = ASN1_STRING_get0_data(oct);
  244|     21|        plen = ASN1_STRING_length(oct);
  245|     21|    }
  246|       |
  247|       |    /*
  248|       |     * EVP_PKEY_NONE means that ecx_key_op() has to figure out the key type
  249|       |     * on its own.
  250|       |     */
  251|     34|    ecx = ossl_ecx_key_op(palg, p, plen, EVP_PKEY_NONE, KEY_OP_PRIVATE,
  ------------------
  |  |   58|     34|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|     34|#define NID_undef                       0
  |  |  ------------------
  ------------------
  252|     34|                          libctx, propq);
  253|     34|    ASN1_OCTET_STRING_free(oct);
  254|     34|    return ecx;
  255|     34|}

ossl_ecx_key_new:
   22|     22|{
   23|     22|    ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|     22|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     22|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     22|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   24|       |
   25|     22|    if (ret == NULL)
  ------------------
  |  Branch (25:9): [True: 0, False: 22]
  ------------------
   26|      0|        return NULL;
   27|       |
   28|     22|    ret->libctx = libctx;
   29|     22|    ret->haspubkey = haspubkey;
   30|     22|    switch (type) {
  ------------------
  |  Branch (30:13): [True: 0, False: 22]
  ------------------
   31|      5|    case ECX_KEY_TYPE_X25519:
  ------------------
  |  Branch (31:5): [True: 5, False: 17]
  ------------------
   32|      5|        ret->keylen = X25519_KEYLEN;
  ------------------
  |  |   26|      5|#  define X25519_KEYLEN         32
  ------------------
   33|      5|        break;
   34|      7|    case ECX_KEY_TYPE_X448:
  ------------------
  |  Branch (34:5): [True: 7, False: 15]
  ------------------
   35|      7|        ret->keylen = X448_KEYLEN;
  ------------------
  |  |   27|      7|#  define X448_KEYLEN           56
  ------------------
   36|      7|        break;
   37|      7|    case ECX_KEY_TYPE_ED25519:
  ------------------
  |  Branch (37:5): [True: 7, False: 15]
  ------------------
   38|      7|        ret->keylen = ED25519_KEYLEN;
  ------------------
  |  |   28|      7|#  define ED25519_KEYLEN        32
  ------------------
   39|      7|        break;
   40|      3|    case ECX_KEY_TYPE_ED448:
  ------------------
  |  Branch (40:5): [True: 3, False: 19]
  ------------------
   41|      3|        ret->keylen = ED448_KEYLEN;
  ------------------
  |  |   29|      3|#  define ED448_KEYLEN          57
  ------------------
   42|      3|        break;
   43|     22|    }
   44|     22|    ret->type = type;
   45|       |
   46|     22|    if (!CRYPTO_NEW_REF(&ret->references, 1))
  ------------------
  |  Branch (46:9): [True: 0, False: 22]
  ------------------
   47|      0|        goto err;
   48|       |
   49|     22|    if (propq != NULL) {
  ------------------
  |  Branch (49:9): [True: 9, False: 13]
  ------------------
   50|      9|        ret->propq = OPENSSL_strdup(propq);
  ------------------
  |  |  111|      9|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      9|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      9|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   51|      9|        if (ret->propq == NULL)
  ------------------
  |  Branch (51:13): [True: 0, False: 9]
  ------------------
   52|      0|            goto err;
   53|      9|    }
   54|     22|    return ret;
   55|      0|err:
   56|      0|    if (ret != NULL) {
  ------------------
  |  Branch (56:9): [True: 0, False: 0]
  ------------------
   57|      0|        OPENSSL_free(ret->propq);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   58|      0|        CRYPTO_FREE_REF(&ret->references);
   59|      0|    }
   60|      0|    OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|      0|    return NULL;
   62|     22|}
ossl_ecx_key_free:
   65|  41.8k|{
   66|  41.8k|    int i;
   67|       |
   68|  41.8k|    if (key == NULL)
  ------------------
  |  Branch (68:9): [True: 41.8k, False: 30]
  ------------------
   69|  41.8k|        return;
   70|       |
   71|     30|    CRYPTO_DOWN_REF(&key->references, &i);
   72|     30|    REF_PRINT_COUNT("ECX_KEY", key);
  ------------------
  |  |  289|     30|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|     30|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|     30|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|     30|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   73|     30|    if (i > 0)
  ------------------
  |  Branch (73:9): [True: 8, False: 22]
  ------------------
   74|      8|        return;
   75|     22|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|     22|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 22]
  |  |  ------------------
  ------------------
   76|       |
   77|     22|    OPENSSL_free(key->propq);
  ------------------
  |  |  107|     22|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     22|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     22|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   78|     22|    OPENSSL_secure_clear_free(key->privkey, key->keylen);
  ------------------
  |  |  121|     22|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     22|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     22|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|     22|    CRYPTO_FREE_REF(&key->references);
   80|     22|    OPENSSL_free(key);
  ------------------
  |  |  107|     22|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     22|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     22|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   81|     22|}
ossl_ecx_key_set0_libctx:
   84|     17|{
   85|     17|    key->libctx = libctx;
   86|     17|}
ossl_ecx_key_up_ref:
   89|      8|{
   90|      8|    int i;
   91|       |
   92|      8|    if (CRYPTO_UP_REF(&key->references, &i) <= 0)
  ------------------
  |  Branch (92:9): [True: 0, False: 8]
  ------------------
   93|      0|        return 0;
   94|       |
   95|      8|    REF_PRINT_COUNT("ECX_KEY", key);
  ------------------
  |  |  289|      8|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|      8|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|      8|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      8|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   96|      8|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|      8|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 8]
  |  |  ------------------
  ------------------
   97|      8|    return ((i > 1) ? 1 : 0);
  ------------------
  |  Branch (97:13): [True: 8, False: 0]
  ------------------
   98|      8|}
ossl_ecx_key_allocate_privkey:
  101|     14|{
  102|     14|    key->privkey = OPENSSL_secure_zalloc(key->keylen);
  ------------------
  |  |  117|     14|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     14|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     14|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  103|       |
  104|     14|    return key->privkey;
  105|     14|}

ecx_meth.c:ecx_pub_decode:
   55|     30|{
   56|     30|    const unsigned char *p;
   57|     30|    int pklen;
   58|     30|    X509_ALGOR *palg;
   59|     30|    ECX_KEY *ecx;
   60|     30|    int ret = 0;
   61|       |
   62|     30|    if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  ------------------
  |  Branch (62:9): [True: 0, False: 30]
  ------------------
   63|      0|        return 0;
   64|     30|    ecx = ossl_ecx_key_op(palg, p, pklen, pkey->ameth->pkey_id,
   65|     30|                          KEY_OP_PUBLIC, NULL, NULL);
   66|     30|    if (ecx != NULL) {
  ------------------
  |  Branch (66:9): [True: 8, False: 22]
  ------------------
   67|      8|        ret = 1;
   68|      8|        EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
   69|      8|    }
   70|     30|    return ret;
   71|     30|}
ecx_meth.c:ecx_key_print:
  168|      4|{
  169|      4|    const ECX_KEY *ecxkey = pkey->pkey.ecx;
  170|      4|    const char *nm = OBJ_nid2ln(pkey->ameth->pkey_id);
  171|       |
  172|      4|    if (op == KEY_OP_PRIVATE) {
  ------------------
  |  Branch (172:9): [True: 4, False: 0]
  ------------------
  173|      4|        if (ecxkey == NULL || ecxkey->privkey == NULL) {
  ------------------
  |  Branch (173:13): [True: 0, False: 4]
  |  Branch (173:31): [True: 0, False: 4]
  ------------------
  174|      0|            if (BIO_printf(bp, "%*s<INVALID PRIVATE KEY>\n", indent, "") <= 0)
  ------------------
  |  Branch (174:17): [True: 0, False: 0]
  ------------------
  175|      0|                return 0;
  176|      0|            return 1;
  177|      0|        }
  178|      4|        if (BIO_printf(bp, "%*s%s Private-Key:\n", indent, "", nm) <= 0)
  ------------------
  |  Branch (178:13): [True: 0, False: 4]
  ------------------
  179|      0|            return 0;
  180|      4|        if (BIO_printf(bp, "%*spriv:\n", indent, "") <= 0)
  ------------------
  |  Branch (180:13): [True: 0, False: 4]
  ------------------
  181|      0|            return 0;
  182|      4|        if (ASN1_buf_print(bp, ecxkey->privkey, KEYLEN(pkey),
  ------------------
  |  |   20|      4|#define KEYLEN(p)       KEYLENID((p)->ameth->pkey_id)
  |  |  ------------------
  |  |  |  |   12|      4|#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   11|      4|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   78|      4|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 5492|      8|#define NID_X25519              1034
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|      3|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 5500|      3|#define NID_ED25519             1087
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (11:26): [True: 1, False: 3]
  |  |  |  |  |  |  |  Branch (11:53): [True: 1, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   26|      2|#  define X25519_KEYLEN         32
  |  |  |  |  ------------------
  |  |  |  |   13|      4|                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      2|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5496|      2|#define NID_X448                1035
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                                    : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|      1|#  define X448_KEYLEN           56
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (13:41): [True: 1, False: 1]
  |  |  |  |  ------------------
  |  |  |  |   14|      2|                                                              : ED448_KEYLEN))
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|      1|#  define ED448_KEYLEN          57
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (182:13): [True: 0, False: 4]
  ------------------
  183|      4|                           indent + 4) == 0)
  184|      0|            return 0;
  185|      4|    } else {
  186|      0|        if (ecxkey == NULL) {
  ------------------
  |  Branch (186:13): [True: 0, False: 0]
  ------------------
  187|      0|            if (BIO_printf(bp, "%*s<INVALID PUBLIC KEY>\n", indent, "") <= 0)
  ------------------
  |  Branch (187:17): [True: 0, False: 0]
  ------------------
  188|      0|                return 0;
  189|      0|            return 1;
  190|      0|        }
  191|      0|        if (BIO_printf(bp, "%*s%s Public-Key:\n", indent, "", nm) <= 0)
  ------------------
  |  Branch (191:13): [True: 0, False: 0]
  ------------------
  192|      0|            return 0;
  193|      0|    }
  194|      4|    if (BIO_printf(bp, "%*spub:\n", indent, "") <= 0)
  ------------------
  |  Branch (194:9): [True: 0, False: 4]
  ------------------
  195|      0|        return 0;
  196|       |
  197|      4|    if (ASN1_buf_print(bp, ecxkey->pubkey, KEYLEN(pkey),
  ------------------
  |  |   20|      4|#define KEYLEN(p)       KEYLENID((p)->ameth->pkey_id)
  |  |  ------------------
  |  |  |  |   12|      4|#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   11|      4|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   78|      4|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 5492|      8|#define NID_X25519              1034
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|      3|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 5500|      3|#define NID_ED25519             1087
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (11:26): [True: 1, False: 3]
  |  |  |  |  |  |  |  Branch (11:53): [True: 1, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   26|      2|#  define X25519_KEYLEN         32
  |  |  |  |  ------------------
  |  |  |  |   13|      4|                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      2|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5496|      2|#define NID_X448                1035
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                                    : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|      1|#  define X448_KEYLEN           56
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (13:41): [True: 1, False: 1]
  |  |  |  |  ------------------
  |  |  |  |   14|      2|                                                              : ED448_KEYLEN))
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|      1|#  define ED448_KEYLEN          57
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (197:9): [True: 0, False: 4]
  ------------------
  198|      4|                       indent + 4) == 0)
  199|      0|        return 0;
  200|      4|    return 1;
  201|      4|}
ecx_meth.c:ecx_priv_encode:
   99|      4|{
  100|      4|    const ECX_KEY *ecxkey = pkey->pkey.ecx;
  101|      4|    ASN1_OCTET_STRING oct;
  102|      4|    unsigned char *penc = NULL;
  103|      4|    int penclen;
  104|       |
  105|      4|    if (ecxkey == NULL || ecxkey->privkey == NULL) {
  ------------------
  |  Branch (105:9): [True: 0, False: 4]
  |  Branch (105:27): [True: 0, False: 4]
  ------------------
  106|      0|        ERR_raise(ERR_LIB_EC, EC_R_INVALID_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  107|      0|        return 0;
  108|      0|    }
  109|       |
  110|      4|    oct.data = ecxkey->privkey;
  111|      4|    oct.length = KEYLEN(pkey);
  ------------------
  |  |   20|      4|#define KEYLEN(p)       KEYLENID((p)->ameth->pkey_id)
  |  |  ------------------
  |  |  |  |   12|      4|#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   11|      4|#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   78|      4|# define EVP_PKEY_X25519 NID_X25519
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 5492|      8|#define NID_X25519              1034
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|      3|# define EVP_PKEY_ED25519 NID_ED25519
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 5500|      3|#define NID_ED25519             1087
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (11:26): [True: 1, False: 3]
  |  |  |  |  |  |  |  Branch (11:53): [True: 1, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   26|      2|#  define X25519_KEYLEN         32
  |  |  |  |  ------------------
  |  |  |  |   13|      4|                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      2|# define EVP_PKEY_X448 NID_X448
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 5496|      2|#define NID_X448                1035
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                                    : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|      1|#  define X448_KEYLEN           56
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (13:41): [True: 1, False: 1]
  |  |  |  |  ------------------
  |  |  |  |   14|      2|                                                              : ED448_KEYLEN))
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|      1|#  define ED448_KEYLEN          57
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  112|      4|    oct.flags = 0;
  113|       |
  114|      4|    penclen = i2d_ASN1_OCTET_STRING(&oct, &penc);
  115|      4|    if (penclen < 0) {
  ------------------
  |  Branch (115:9): [True: 0, False: 4]
  ------------------
  116|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  117|      0|        return 0;
  118|      0|    }
  119|       |
  120|      4|    if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0,
  ------------------
  |  Branch (120:9): [True: 0, False: 4]
  ------------------
  121|      4|                         V_ASN1_UNDEF, NULL, penc, penclen)) {
  ------------------
  |  |   60|      4|# define V_ASN1_UNDEF                    -1
  ------------------
  122|      0|        OPENSSL_clear_free(penc, penclen);
  ------------------
  |  |  105|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  123|      0|        ERR_raise(ERR_LIB_EC, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  124|      0|        return 0;
  125|      0|    }
  126|       |
  127|      4|    return 1;
  128|      4|}
ecx_meth.c:ecx_priv_print:
  205|      4|{
  206|      4|    return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE);
  207|      4|}
ecx_meth.c:ecx_free:
  156|     44|{
  157|     44|    ossl_ecx_key_free(pkey->pkey.ecx);
  158|     44|}
ecx_meth.c:ecx_priv_decode_ex:
   86|     14|{
   87|     14|    int ret = 0;
   88|     14|    ECX_KEY *ecx = ossl_ecx_key_from_pkcs8(p8, libctx, propq);
   89|       |
   90|     14|    if (ecx != NULL) {
  ------------------
  |  Branch (90:9): [True: 5, False: 9]
  ------------------
   91|      5|        ret = 1;
   92|      5|        EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
   93|      5|    }
   94|       |
   95|     14|    return ret;
   96|     14|}

OSSL_DECODER_from_bio:
   48|  45.4k|{
   49|  45.4k|    struct decoder_process_data_st data;
   50|  45.4k|    int ok = 0;
   51|  45.4k|    BIO *new_bio = NULL;
   52|  45.4k|    unsigned long lasterr;
   53|       |
   54|  45.4k|    if (in == NULL) {
  ------------------
  |  Branch (54:9): [True: 0, False: 45.4k]
  ------------------
   55|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   56|      0|        return 0;
   57|      0|    }
   58|       |
   59|  45.4k|    if (OSSL_DECODER_CTX_get_num_decoders(ctx) == 0) {
  ------------------
  |  Branch (59:9): [True: 1.25k, False: 44.1k]
  ------------------
   60|  1.25k|        ERR_raise_data(ERR_LIB_OSSL_DECODER, OSSL_DECODER_R_DECODER_NOT_FOUND,
  ------------------
  |  |  403|  1.25k|    (ERR_new(),                                                 \
  |  |  404|  1.25k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|  1.25k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|  1.25k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|  1.25k|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|  1.25k|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, OSSL_DECODER_R_DECODER_NOT_FOUND,
  ------------------
  |  |  121|  1.25k|# define ERR_LIB_OSSL_DECODER    60
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, OSSL_DECODER_R_DECODER_NOT_FOUND,
  ------------------
  |  |   25|  1.25k|# define OSSL_DECODER_R_DECODER_NOT_FOUND                 102
  ------------------
   61|  1.25k|                       "No decoders were found. For standard decoders you need "
   62|  1.25k|                       "at least one of the default or base providers "
   63|  1.25k|                       "available. Did you forget to load them?");
   64|  1.25k|        return 0;
   65|  1.25k|    }
   66|       |
   67|  44.1k|    lasterr = ERR_peek_last_error();
   68|       |
   69|  44.1k|    if (BIO_tell(in) < 0) {
  ------------------
  |  |  564|  44.1k|# define BIO_tell(b)     (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
  |  |  ------------------
  |  |  |  |  459|  44.1k|# define BIO_C_FILE_TELL                         133
  |  |  ------------------
  ------------------
  |  Branch (69:9): [True: 0, False: 44.1k]
  ------------------
   70|      0|        new_bio = BIO_new(BIO_f_readbuffer());
   71|      0|        if (new_bio == NULL)
  ------------------
  |  Branch (71:13): [True: 0, False: 0]
  ------------------
   72|      0|            return 0;
   73|      0|        in = BIO_push(new_bio, in);
   74|      0|    }
   75|  44.1k|    memset(&data, 0, sizeof(data));
   76|  44.1k|    data.ctx = ctx;
   77|  44.1k|    data.bio = in;
   78|       |
   79|       |    /* Enable passphrase caching */
   80|  44.1k|    (void)ossl_pw_enable_passphrase_caching(&ctx->pwdata);
   81|       |
   82|  44.1k|    ok = decoder_process(NULL, &data);
   83|       |
   84|  44.1k|    if (!data.flag_construct_called) {
  ------------------
  |  Branch (84:9): [True: 29.1k, False: 15.0k]
  ------------------
   85|  29.1k|        const char *spaces
   86|  29.1k|            = ctx->start_input_type != NULL && ctx->input_structure != NULL
  ------------------
  |  Branch (86:15): [True: 29.1k, False: 0]
  |  Branch (86:48): [True: 29.1k, False: 0]
  ------------------
   87|  29.1k|            ? " " : "";
   88|  29.1k|        const char *input_type_label
   89|  29.1k|            = ctx->start_input_type != NULL ? "Input type: " : "";
  ------------------
  |  Branch (89:15): [True: 29.1k, False: 0]
  ------------------
   90|  29.1k|        const char *input_structure_label
   91|  29.1k|            = ctx->input_structure != NULL ? "Input structure: " : "";
  ------------------
  |  Branch (91:15): [True: 29.1k, False: 0]
  ------------------
   92|  29.1k|        const char *comma
   93|  29.1k|            = ctx->start_input_type != NULL && ctx->input_structure != NULL
  ------------------
  |  Branch (93:15): [True: 29.1k, False: 0]
  |  Branch (93:48): [True: 29.1k, False: 0]
  ------------------
   94|  29.1k|            ? ", " : "";
   95|  29.1k|        const char *input_type
   96|  29.1k|            = ctx->start_input_type != NULL ? ctx->start_input_type : "";
  ------------------
  |  Branch (96:15): [True: 29.1k, False: 0]
  ------------------
   97|  29.1k|        const char *input_structure
   98|  29.1k|            = ctx->input_structure != NULL ? ctx->input_structure : "";
  ------------------
  |  Branch (98:15): [True: 29.1k, False: 0]
  ------------------
   99|       |
  100|  29.1k|        if (ERR_peek_last_error() == lasterr || ERR_peek_error() == 0)
  ------------------
  |  Branch (100:13): [True: 25.3k, False: 3.84k]
  |  Branch (100:49): [True: 3.83k, False: 18]
  ------------------
  101|       |            /* Prevent spurious decoding error but add at least something */
  102|  29.1k|            ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_UNSUPPORTED,
  ------------------
  |  |  403|  29.1k|    (ERR_new(),                                                 \
  |  |  404|  29.1k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|  29.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|  29.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|  29.1k|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|  29.1k|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_UNSUPPORTED,
  ------------------
  |  |  121|  29.1k|# define ERR_LIB_OSSL_DECODER    60
  ------------------
                          ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_UNSUPPORTED,
  ------------------
  |  |  363|  29.1k|# define ERR_R_UNSUPPORTED                       (268|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|  29.1k|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|  29.1k|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  103|  29.1k|                           "No supported data to decode. %s%s%s%s%s%s",
  104|  29.1k|                           spaces, input_type_label, input_type, comma,
  105|  29.1k|                           input_structure_label, input_structure);
  106|  29.1k|        ok = 0;
  107|  29.1k|    }
  108|       |
  109|       |    /* Clear any internally cached passphrase */
  110|  44.1k|    (void)ossl_pw_clear_passphrase_cache(&ctx->pwdata);
  111|       |
  112|  44.1k|    if (new_bio != NULL) {
  ------------------
  |  Branch (112:9): [True: 0, False: 44.1k]
  ------------------
  113|      0|        BIO_pop(new_bio);
  114|      0|        BIO_free(new_bio);
  115|      0|    }
  116|  44.1k|    return ok;
  117|  44.1k|}
OSSL_DECODER_from_data:
  147|  45.4k|{
  148|  45.4k|    BIO *membio;
  149|  45.4k|    int ret = 0;
  150|       |
  151|  45.4k|    if (pdata == NULL || *pdata == NULL || pdata_len == NULL) {
  ------------------
  |  Branch (151:9): [True: 0, False: 45.4k]
  |  Branch (151:26): [True: 0, False: 45.4k]
  |  Branch (151:44): [True: 0, False: 45.4k]
  ------------------
  152|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  153|      0|        return 0;
  154|      0|    }
  155|       |
  156|  45.4k|    membio = BIO_new_mem_buf(*pdata, (int)*pdata_len);
  157|  45.4k|    if (OSSL_DECODER_from_bio(ctx, membio)) {
  ------------------
  |  Branch (157:9): [True: 15.0k, False: 30.4k]
  ------------------
  158|  15.0k|        *pdata_len = (size_t)BIO_get_mem_data(membio, pdata);
  ------------------
  |  |  606|  15.0k|# define BIO_get_mem_data(b,pp)  BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp))
  |  |  ------------------
  |  |  |  |   87|  15.0k|# define BIO_CTRL_INFO           3/* opt - extra tit-bits */
  |  |  ------------------
  ------------------
  159|  15.0k|        ret = 1;
  160|  15.0k|    }
  161|  45.4k|    BIO_free(membio);
  162|       |
  163|  45.4k|    return ret;
  164|  45.4k|}
OSSL_DECODER_CTX_set_selection:
  167|    268|{
  168|    268|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|    268|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    268|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (168:9): [True: 0, False: 268]
  ------------------
  169|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  170|      0|        return 0;
  171|      0|    }
  172|       |
  173|       |    /*
  174|       |     * 0 is a valid selection, and means that the caller leaves
  175|       |     * it to code to discover what the selection is.
  176|       |     */
  177|    268|    ctx->selection = selection;
  178|    268|    return 1;
  179|    268|}
OSSL_DECODER_CTX_set_input_type:
  183|  45.7k|{
  184|  45.7k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  45.7k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  45.7k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (184:9): [True: 0, False: 45.7k]
  ------------------
  185|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  186|      0|        return 0;
  187|      0|    }
  188|       |
  189|       |    /*
  190|       |     * NULL is a valid starting input type, and means that the caller leaves
  191|       |     * it to code to discover what the starting input type is.
  192|       |     */
  193|  45.7k|    ctx->start_input_type = input_type;
  194|  45.7k|    return 1;
  195|  45.7k|}
OSSL_DECODER_CTX_set_input_structure:
  199|  45.7k|{
  200|  45.7k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  45.7k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  45.7k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (200:9): [True: 0, False: 45.7k]
  ------------------
  201|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  202|      0|        return 0;
  203|      0|    }
  204|       |
  205|       |    /*
  206|       |     * NULL is a valid starting input structure, and means that the caller
  207|       |     * leaves it to code to discover what the starting input structure is.
  208|       |     */
  209|  45.7k|    ctx->input_structure = input_structure;
  210|  45.7k|    return 1;
  211|  45.7k|}
ossl_decoder_instance_new:
  215|    237|{
  216|    237|    OSSL_DECODER_INSTANCE *decoder_inst = NULL;
  217|    237|    const OSSL_PROVIDER *prov;
  218|    237|    OSSL_LIB_CTX *libctx;
  219|    237|    const OSSL_PROPERTY_LIST *props;
  220|    237|    const OSSL_PROPERTY_DEFINITION *prop;
  221|       |
  222|    237|    if (!ossl_assert(decoder != NULL)) {
  ------------------
  |  |   52|    237|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    237|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (222:9): [True: 0, False: 237]
  ------------------
  223|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  224|      0|        return 0;
  225|      0|    }
  226|       |
  227|    237|    if ((decoder_inst = OPENSSL_zalloc(sizeof(*decoder_inst))) == NULL)
  ------------------
  |  |   99|    237|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    237|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    237|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (227:9): [True: 0, False: 237]
  ------------------
  228|      0|        return 0;
  229|       |
  230|    237|    prov = OSSL_DECODER_get0_provider(decoder);
  231|    237|    libctx = ossl_provider_libctx(prov);
  232|    237|    props = ossl_decoder_parsed_properties(decoder);
  233|    237|    if (props == NULL) {
  ------------------
  |  Branch (233:9): [True: 0, False: 237]
  ------------------
  234|      0|        ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  121|      0|# define ERR_LIB_OSSL_DECODER    60
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  365|      0|# define ERR_R_INVALID_PROPERTY_DEFINITION       (270|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|      0|                       "there are no property definitions with decoder %s",
  236|      0|                       OSSL_DECODER_get0_name(decoder));
  237|      0|        goto err;
  238|      0|    }
  239|       |
  240|       |    /* The "input" property is mandatory */
  241|    237|    prop = ossl_property_find_property(props, libctx, "input");
  242|    237|    decoder_inst->input_type = ossl_property_get_string_value(libctx, prop);
  243|    237|    decoder_inst->input_type_id = 0;
  244|    237|    if (decoder_inst->input_type == NULL) {
  ------------------
  |  Branch (244:9): [True: 0, False: 237]
  ------------------
  245|      0|        ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  121|      0|# define ERR_LIB_OSSL_DECODER    60
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  365|      0|# define ERR_R_INVALID_PROPERTY_DEFINITION       (270|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|      0|                       "the mandatory 'input' property is missing "
  247|      0|                       "for decoder %s (properties: %s)",
  248|      0|                       OSSL_DECODER_get0_name(decoder),
  249|      0|                       OSSL_DECODER_get0_properties(decoder));
  250|      0|        goto err;
  251|      0|    }
  252|       |
  253|       |    /* The "structure" property is optional */
  254|    237|    prop = ossl_property_find_property(props, libctx, "structure");
  255|    237|    if (prop != NULL) {
  ------------------
  |  Branch (255:9): [True: 123, False: 114]
  ------------------
  256|    123|        decoder_inst->input_structure
  257|    123|            = ossl_property_get_string_value(libctx, prop);
  258|    123|    }
  259|       |
  260|    237|    if (!OSSL_DECODER_up_ref(decoder)) {
  ------------------
  |  Branch (260:9): [True: 0, False: 237]
  ------------------
  261|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  262|      0|        goto err;
  263|      0|    }
  264|    237|    decoder_inst->decoder = decoder;
  265|    237|    decoder_inst->decoderctx = decoderctx;
  266|    237|    return decoder_inst;
  267|      0| err:
  268|      0|    ossl_decoder_instance_free(decoder_inst);
  269|      0|    return NULL;
  270|    237|}
ossl_decoder_instance_free:
  273|   452k|{
  274|   452k|    if (decoder_inst != NULL) {
  ------------------
  |  Branch (274:9): [True: 452k, False: 0]
  ------------------
  275|   452k|        if (decoder_inst->decoder != NULL)
  ------------------
  |  Branch (275:13): [True: 452k, False: 0]
  ------------------
  276|   452k|            decoder_inst->decoder->freectx(decoder_inst->decoderctx);
  277|   452k|        decoder_inst->decoderctx = NULL;
  278|   452k|        OSSL_DECODER_free(decoder_inst->decoder);
  279|   452k|        decoder_inst->decoder = NULL;
  280|   452k|        OPENSSL_free(decoder_inst);
  ------------------
  |  |  107|   452k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   452k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   452k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  281|   452k|    }
  282|   452k|}
ossl_decoder_instance_dup:
  285|   452k|{
  286|   452k|    OSSL_DECODER_INSTANCE *dest;
  287|   452k|    const OSSL_PROVIDER *prov;
  288|   452k|    void *provctx;
  289|       |
  290|   452k|    if ((dest = OPENSSL_zalloc(sizeof(*dest))) == NULL)
  ------------------
  |  |   99|   452k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   452k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   452k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (290:9): [True: 0, False: 452k]
  ------------------
  291|      0|        return NULL;
  292|       |
  293|   452k|    *dest = *src;
  294|   452k|    if (!OSSL_DECODER_up_ref(dest->decoder)) {
  ------------------
  |  Branch (294:9): [True: 0, False: 452k]
  ------------------
  295|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  296|      0|        goto err;
  297|      0|    }
  298|   452k|    prov = OSSL_DECODER_get0_provider(dest->decoder);
  299|   452k|    provctx = OSSL_PROVIDER_get0_provider_ctx(prov);
  300|       |
  301|   452k|    dest->decoderctx = dest->decoder->newctx(provctx);
  302|   452k|    if (dest->decoderctx == NULL) {
  ------------------
  |  Branch (302:9): [True: 0, False: 452k]
  ------------------
  303|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  304|      0|        OSSL_DECODER_free(dest->decoder);
  305|      0|        goto err;
  306|      0|    }
  307|       |
  308|   452k|    return dest;
  309|       |
  310|      0| err:
  311|      0|    OPENSSL_free(dest);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  312|      0|    return NULL;
  313|   452k|}
ossl_decoder_ctx_add_decoder_inst:
  317|    168|{
  318|    168|    int ok;
  319|       |
  320|    168|    if (ctx->decoder_insts == NULL
  ------------------
  |  Branch (320:9): [True: 27, False: 141]
  ------------------
  321|    168|        && (ctx->decoder_insts =
  ------------------
  |  Branch (321:12): [True: 0, False: 27]
  ------------------
  322|     27|            sk_OSSL_DECODER_INSTANCE_new_null()) == NULL) {
  323|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  324|      0|        return 0;
  325|      0|    }
  326|       |
  327|    168|    ok = (sk_OSSL_DECODER_INSTANCE_push(ctx->decoder_insts, di) > 0);
  328|    168|    if (ok) {
  ------------------
  |  Branch (328:9): [True: 168, False: 0]
  ------------------
  329|    168|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    168|    do {                                        \
  |  |  220|    168|        BIO *trc_out = NULL;                    \
  |  |  221|    168|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  330|      0|            BIO_printf(trc_out,
  331|      0|                       "(ctx %p) Added decoder instance %p for decoder %p\n"
  332|      0|                       "    %s with %s\n",
  333|      0|                       (void *)ctx, (void *)di, (void *)di->decoder,
  334|      0|                       OSSL_DECODER_get0_name(di->decoder),
  335|      0|                       OSSL_DECODER_get0_properties(di->decoder));
  336|    168|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    168|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  337|    168|    }
  338|    168|    return ok;
  339|    168|}
OSSL_DECODER_CTX_add_extra:
  490|    268|{
  491|       |    /*
  492|       |     * This function goes through existing decoder methods in
  493|       |     * |ctx->decoder_insts|, and tries to fetch new decoders that produce
  494|       |     * what the existing ones want as input, and push those newly fetched
  495|       |     * decoders on top of the same stack.
  496|       |     * Then it does the same again, but looping over the newly fetched
  497|       |     * decoders, until there are no more decoders to be fetched, or
  498|       |     * when we have done this 10 times.
  499|       |     *
  500|       |     * we do this with sliding windows on the stack by keeping track of indexes
  501|       |     * and of the end.
  502|       |     *
  503|       |     * +----------------+
  504|       |     * |   DER to RSA   | <--- w_prev_start
  505|       |     * +----------------+
  506|       |     * |   DER to DSA   |
  507|       |     * +----------------+
  508|       |     * |   DER to DH    |
  509|       |     * +----------------+
  510|       |     * |   PEM to DER   | <--- w_prev_end, w_new_start
  511|       |     * +----------------+
  512|       |     *                    <--- w_new_end
  513|       |     */
  514|    268|    struct collect_extra_decoder_data_st data;
  515|    268|    size_t depth = 0; /* Counts the number of iterations */
  516|    268|    size_t count; /* Calculates how many were added in each iteration */
  517|    268|    size_t numdecoders;
  518|    268|    STACK_OF(OSSL_DECODER) *skdecoders;
  ------------------
  |  |   31|    268|# define STACK_OF(type) struct stack_st_##type
  ------------------
  519|       |
  520|    268|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|    268|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    268|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (520:9): [True: 0, False: 268]
  ------------------
  521|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  522|      0|        return 0;
  523|      0|    }
  524|       |
  525|       |    /*
  526|       |     * If there is no stack of OSSL_DECODER_INSTANCE, we have nothing
  527|       |     * more to add.  That's fine.
  528|       |     */
  529|    268|    if (ctx->decoder_insts == NULL)
  ------------------
  |  Branch (529:9): [True: 241, False: 27]
  ------------------
  530|    241|        return 1;
  531|       |
  532|     27|    OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|     27|    do {                                        \
  |  |  220|     27|        BIO *trc_out = NULL;                    \
  |  |  221|     27|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  533|      0|        BIO_printf(trc_out, "(ctx %p) Looking for extra decoders\n",
  534|      0|                   (void *)ctx);
  535|     27|    } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|     27|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  536|       |
  537|       |
  538|     27|    skdecoders = sk_OSSL_DECODER_new_null();
  539|     27|    if (skdecoders == NULL) {
  ------------------
  |  Branch (539:9): [True: 0, False: 27]
  ------------------
  540|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  541|      0|        return 0;
  542|      0|    }
  543|     27|    OSSL_DECODER_do_all_provided(libctx, collect_all_decoders, skdecoders);
  544|     27|    numdecoders = sk_OSSL_DECODER_num(skdecoders);
  545|       |
  546|     27|    memset(&data, 0, sizeof(data));
  547|     27|    data.ctx = ctx;
  548|     27|    data.w_prev_start = 0;
  549|     27|    data.w_prev_end = sk_OSSL_DECODER_INSTANCE_num(ctx->decoder_insts);
  550|     54|    do {
  551|     54|        size_t i, j;
  552|       |
  553|     54|        data.w_new_start = data.w_new_end = data.w_prev_end;
  554|       |
  555|       |        /*
  556|       |         * Two iterations:
  557|       |         * 0.  All decoders that have the same name as their input type.
  558|       |         *     This allows for decoders that unwrap some data in a specific
  559|       |         *     encoding, and pass the result on with the same encoding.
  560|       |         * 1.  All decoders that a different name than their input type.
  561|       |         */
  562|     54|        for (data.type_check = IS_SAME;
  563|    162|             data.type_check <= IS_DIFFERENT;
  ------------------
  |  Branch (563:14): [True: 108, False: 54]
  ------------------
  564|    108|             data.type_check++) {
  565|    444|            for (i = data.w_prev_start; i < data.w_prev_end; i++) {
  ------------------
  |  Branch (565:41): [True: 336, False: 108]
  ------------------
  566|    336|                OSSL_DECODER_INSTANCE *decoder_inst =
  567|    336|                    sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts, i);
  568|       |
  569|    336|                data.output_type
  570|    336|                    = OSSL_DECODER_INSTANCE_get_input_type(decoder_inst);
  571|       |
  572|    336|                data.output_type_id = 0;
  573|       |
  574|  13.7k|                for (j = 0; j < numdecoders; j++)
  ------------------
  |  Branch (574:29): [True: 13.4k, False: 336]
  ------------------
  575|  13.4k|                    collect_extra_decoder(sk_OSSL_DECODER_value(skdecoders, j),
  576|  13.4k|                                          &data);
  577|    336|            }
  578|    108|        }
  579|       |        /* How many were added in this iteration */
  580|     54|        count = data.w_new_end - data.w_new_start;
  581|       |
  582|       |        /* Slide the "previous decoder" windows */
  583|     54|        data.w_prev_start = data.w_new_start;
  584|     54|        data.w_prev_end = data.w_new_end;
  585|       |
  586|     54|        depth++;
  587|     54|    } while (count != 0 && depth <= 10);
  ------------------
  |  Branch (587:14): [True: 27, False: 27]
  |  Branch (587:28): [True: 27, False: 0]
  ------------------
  588|       |
  589|     27|    sk_OSSL_DECODER_pop_free(skdecoders, OSSL_DECODER_free);
  590|     27|    return 1;
  591|     27|}
OSSL_DECODER_CTX_get_num_decoders:
  594|  89.8k|{
  595|  89.8k|    if (ctx == NULL || ctx->decoder_insts == NULL)
  ------------------
  |  Branch (595:9): [True: 0, False: 89.8k]
  |  Branch (595:24): [True: 1.49k, False: 88.3k]
  ------------------
  596|  1.49k|        return 0;
  597|  88.3k|    return sk_OSSL_DECODER_INSTANCE_num(ctx->decoder_insts);
  598|  89.8k|}
OSSL_DECODER_CTX_set_construct:
  602|  45.4k|{
  603|  45.4k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  45.4k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  45.4k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (603:9): [True: 0, False: 45.4k]
  ------------------
  604|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  605|      0|        return 0;
  606|      0|    }
  607|  45.4k|    ctx->construct = construct;
  608|  45.4k|    return 1;
  609|  45.4k|}
OSSL_DECODER_CTX_set_construct_data:
  613|  44.2k|{
  614|  44.2k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  44.2k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  44.2k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (614:9): [True: 0, False: 44.2k]
  ------------------
  615|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  616|      0|        return 0;
  617|      0|    }
  618|  44.2k|    ctx->construct_data = construct_data;
  619|  44.2k|    return 1;
  620|  44.2k|}
OSSL_DECODER_CTX_set_cleanup:
  624|  45.4k|{
  625|  45.4k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  45.4k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  45.4k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (625:9): [True: 0, False: 45.4k]
  ------------------
  626|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  627|      0|        return 0;
  628|      0|    }
  629|  45.4k|    ctx->cleanup = cleanup;
  630|  45.4k|    return 1;
  631|  45.4k|}
OSSL_DECODER_CTX_get_construct:
  635|  45.4k|{
  636|  45.4k|    if (ctx == NULL)
  ------------------
  |  Branch (636:9): [True: 0, False: 45.4k]
  ------------------
  637|      0|        return NULL;
  638|  45.4k|    return ctx->construct;
  639|  45.4k|}
OSSL_DECODER_CTX_get_construct_data:
  642|  45.4k|{
  643|  45.4k|    if (ctx == NULL)
  ------------------
  |  Branch (643:9): [True: 0, False: 45.4k]
  ------------------
  644|      0|        return NULL;
  645|  45.4k|    return ctx->construct_data;
  646|  45.4k|}
OSSL_DECODER_CTX_get_cleanup:
  650|  45.4k|{
  651|  45.4k|    if (ctx == NULL)
  ------------------
  |  Branch (651:9): [True: 0, False: 45.4k]
  ------------------
  652|      0|        return NULL;
  653|  45.4k|    return ctx->cleanup;
  654|  45.4k|}
OSSL_DECODER_INSTANCE_get_decoder:
  679|   536k|{
  680|   536k|    if (decoder_inst == NULL)
  ------------------
  |  Branch (680:9): [True: 0, False: 536k]
  ------------------
  681|      0|        return NULL;
  682|   536k|    return decoder_inst->decoder;
  683|   536k|}
OSSL_DECODER_INSTANCE_get_decoder_ctx:
  687|   490k|{
  688|   490k|    if (decoder_inst == NULL)
  ------------------
  |  Branch (688:9): [True: 0, False: 490k]
  ------------------
  689|      0|        return NULL;
  690|   490k|    return decoder_inst->decoderctx;
  691|   490k|}
OSSL_DECODER_INSTANCE_get_input_type:
  695|   444k|{
  696|   444k|    if (decoder_inst == NULL)
  ------------------
  |  Branch (696:9): [True: 0, False: 444k]
  ------------------
  697|      0|        return NULL;
  698|   444k|    return decoder_inst->input_type;
  699|   444k|}
OSSL_DECODER_INSTANCE_get_input_structure:
  704|   444k|{
  705|   444k|    if (decoder_inst == NULL)
  ------------------
  |  Branch (705:9): [True: 0, False: 444k]
  ------------------
  706|      0|        return NULL;
  707|   444k|    *was_set = decoder_inst->flag_input_structure_was_set;
  708|   444k|    return decoder_inst->input_structure;
  709|   444k|}
decoder_lib.c:collect_all_decoders:
  391|  1.08k|{
  392|  1.08k|    STACK_OF(OSSL_DECODER) *skdecoders = arg;
  ------------------
  |  |   31|  1.08k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  393|       |
  394|  1.08k|    if (OSSL_DECODER_up_ref(decoder)
  ------------------
  |  Branch (394:9): [True: 1.08k, False: 0]
  ------------------
  395|  1.08k|            && !sk_OSSL_DECODER_push(skdecoders, decoder))
  ------------------
  |  Branch (395:16): [True: 0, False: 1.08k]
  ------------------
  396|      0|        OSSL_DECODER_free(decoder);
  397|  1.08k|}
decoder_lib.c:collect_extra_decoder:
  400|  13.4k|{
  401|  13.4k|    struct collect_extra_decoder_data_st *data = arg;
  402|  13.4k|    size_t j;
  403|  13.4k|    const OSSL_PROVIDER *prov = OSSL_DECODER_get0_provider(decoder);
  404|  13.4k|    void *provctx = OSSL_PROVIDER_get0_provider_ctx(prov);
  405|       |
  406|  13.4k|    if (ossl_decoder_fast_is_a(decoder, data->output_type, &data->output_type_id)) {
  ------------------
  |  Branch (406:9): [True: 738, False: 12.7k]
  ------------------
  407|    738|        void *decoderctx = NULL;
  408|    738|        OSSL_DECODER_INSTANCE *di = NULL;
  409|       |
  410|    738|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    738|    do {                                        \
  |  |  220|    738|        BIO *trc_out = NULL;                    \
  |  |  221|    738|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  411|      0|            BIO_printf(trc_out,
  412|      0|                       "(ctx %p) [%d] Checking out decoder %p:\n"
  413|      0|                       "    %s with %s\n",
  414|      0|                       (void *)data->ctx, data->type_check, (void *)decoder,
  415|      0|                       OSSL_DECODER_get0_name(decoder),
  416|      0|                       OSSL_DECODER_get0_properties(decoder));
  417|    738|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    738|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  418|       |
  419|       |        /*
  420|       |         * Check that we don't already have this decoder in our stack,
  421|       |         * starting with the previous windows but also looking at what
  422|       |         * we have added in the current window.
  423|       |         */
  424|  4.87k|        for (j = data->w_prev_start; j < data->w_new_end; j++) {
  ------------------
  |  Branch (424:38): [True: 4.72k, False: 150]
  ------------------
  425|  4.72k|            OSSL_DECODER_INSTANCE *check_inst =
  426|  4.72k|                sk_OSSL_DECODER_INSTANCE_value(data->ctx->decoder_insts, j);
  427|       |
  428|  4.72k|            if (decoder->base.algodef == check_inst->decoder->base.algodef) {
  ------------------
  |  Branch (428:17): [True: 588, False: 4.13k]
  ------------------
  429|       |                /* We found it, so don't do anything more */
  430|    588|                OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    588|    do {                                        \
  |  |  220|    588|        BIO *trc_out = NULL;                    \
  |  |  221|    588|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  431|      0|                    BIO_printf(trc_out,
  432|      0|                               "    REJECTED: already exists in the chain\n");
  433|    588|                } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    588|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  434|    588|                return;
  435|    588|            }
  436|  4.72k|        }
  437|       |
  438|    150|        if ((decoderctx = decoder->newctx(provctx)) == NULL)
  ------------------
  |  Branch (438:13): [True: 0, False: 150]
  ------------------
  439|      0|            return;
  440|       |
  441|    150|        if ((di = ossl_decoder_instance_new(decoder, decoderctx)) == NULL) {
  ------------------
  |  Branch (441:13): [True: 0, False: 150]
  ------------------
  442|      0|            decoder->freectx(decoderctx);
  443|      0|            return;
  444|      0|        }
  445|       |
  446|    150|        switch (data->type_check) {
  ------------------
  |  Branch (446:17): [True: 0, False: 150]
  ------------------
  447|    123|        case IS_SAME:
  ------------------
  |  Branch (447:9): [True: 123, False: 27]
  ------------------
  448|       |            /* If it differs, this is not a decoder to add for now. */
  449|    123|            if (!ossl_decoder_fast_is_a(decoder,
  ------------------
  |  Branch (449:17): [True: 69, False: 54]
  ------------------
  450|    123|                                        OSSL_DECODER_INSTANCE_get_input_type(di),
  451|    123|                                        &di->input_type_id)) {
  452|     69|                ossl_decoder_instance_free(di);
  453|     69|                OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|     69|    do {                                        \
  |  |  220|     69|        BIO *trc_out = NULL;                    \
  |  |  221|     69|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  454|      0|                    BIO_printf(trc_out,
  455|      0|                               "    REJECTED: input type doesn't match output type\n");
  456|     69|                } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|     69|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  457|     69|                return;
  458|     69|            }
  459|     54|            break;
  460|     54|        case IS_DIFFERENT:
  ------------------
  |  Branch (460:9): [True: 27, False: 123]
  ------------------
  461|       |            /* If it's the same, this is not a decoder to add for now. */
  462|     27|            if (ossl_decoder_fast_is_a(decoder,
  ------------------
  |  Branch (462:17): [True: 0, False: 27]
  ------------------
  463|     27|                                       OSSL_DECODER_INSTANCE_get_input_type(di),
  464|     27|                                       &di->input_type_id)) {
  465|      0|                ossl_decoder_instance_free(di);
  466|      0|                OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|      0|    do {                                        \
  |  |  220|      0|        BIO *trc_out = NULL;                    \
  |  |  221|      0|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  467|      0|                    BIO_printf(trc_out,
  468|      0|                               "    REJECTED: input type matches output type\n");
  469|      0|                } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  470|      0|                return;
  471|      0|            }
  472|     27|            break;
  473|    150|        }
  474|       |
  475|       |        /*
  476|       |         * Apart from keeping w_new_end up to date, We don't care about
  477|       |         * errors here.  If it doesn't collect, then it doesn't...
  478|       |         */
  479|     81|        if (!ossl_decoder_ctx_add_decoder_inst(data->ctx, di)) {
  ------------------
  |  Branch (479:13): [True: 0, False: 81]
  ------------------
  480|      0|            ossl_decoder_instance_free(di);
  481|      0|            return;
  482|      0|        }
  483|       |
  484|     81|        data->w_new_end++;
  485|     81|    }
  486|  13.4k|}
decoder_lib.c:decoder_process:
  712|  90.2k|{
  713|  90.2k|    struct decoder_process_data_st *data = arg;
  714|  90.2k|    OSSL_DECODER_CTX *ctx = data->ctx;
  715|  90.2k|    OSSL_DECODER_INSTANCE *decoder_inst = NULL;
  716|  90.2k|    OSSL_DECODER *decoder = NULL;
  717|  90.2k|    OSSL_CORE_BIO *cbio = NULL;
  718|  90.2k|    BIO *bio = data->bio;
  719|  90.2k|    long loc;
  720|  90.2k|    size_t i;
  721|  90.2k|    int ok = 0;
  722|       |    /* For recursions */
  723|  90.2k|    struct decoder_process_data_st new_data;
  724|  90.2k|    const char *data_type = NULL;
  725|  90.2k|    const char *data_structure = NULL;
  726|       |
  727|       |    /*
  728|       |     * This is an indicator up the call stack that something was indeed
  729|       |     * decoded, leading to a recursive call of this function.
  730|       |     */
  731|  90.2k|    data->flag_next_level_called = 1;
  732|       |
  733|  90.2k|    memset(&new_data, 0, sizeof(new_data));
  734|  90.2k|    new_data.ctx = data->ctx;
  735|  90.2k|    new_data.recursion = data->recursion + 1;
  736|       |
  737|  90.2k|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  738|  90.2k|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  739|  90.2k|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  740|  90.2k|               : LEVEL_STR "...")
  741|       |
  742|  90.2k|    if (params == NULL) {
  ------------------
  |  Branch (742:9): [True: 44.1k, False: 46.0k]
  ------------------
  743|       |        /* First iteration, where we prepare for what is to come */
  744|       |
  745|  44.1k|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  44.1k|    do {                                        \
  |  |  220|  44.1k|        BIO *trc_out = NULL;                    \
  |  |  221|  44.1k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  746|      0|            BIO_printf(trc_out,
  747|      0|                       "(ctx %p) starting to walk the decoder chain\n",
  748|      0|                       (void *)new_data.ctx);
  749|  44.1k|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  44.1k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  750|       |
  751|  44.1k|        data->current_decoder_inst_index =
  752|  44.1k|            OSSL_DECODER_CTX_get_num_decoders(ctx);
  753|       |
  754|  44.1k|        bio = data->bio;
  755|  46.0k|    } else {
  756|  46.0k|        const OSSL_PARAM *p;
  757|  46.0k|        const char *trace_data_structure;
  758|       |
  759|  46.0k|        decoder_inst =
  760|  46.0k|            sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts,
  761|  46.0k|                                           data->current_decoder_inst_index);
  762|  46.0k|        decoder = OSSL_DECODER_INSTANCE_get_decoder(decoder_inst);
  763|       |
  764|  46.0k|        data->flag_construct_called = 0;
  765|  46.0k|        if (ctx->construct != NULL) {
  ------------------
  |  Branch (765:13): [True: 46.0k, False: 0]
  ------------------
  766|  46.0k|            int rv;
  767|       |
  768|  46.0k|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  46.0k|    do {                                        \
  |  |  220|  46.0k|        BIO *trc_out = NULL;                    \
  |  |  221|  46.0k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  769|      0|                BIO_printf(trc_out,
  770|      0|                           "(ctx %p) %s Running constructor\n",
  771|      0|                           (void *)new_data.ctx, LEVEL);
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  772|  46.0k|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  46.0k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  773|       |
  774|  46.0k|            rv = ctx->construct(decoder_inst, params, ctx->construct_data);
  775|       |
  776|  46.0k|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  46.0k|    do {                                        \
  |  |  220|  46.0k|        BIO *trc_out = NULL;                    \
  |  |  221|  46.0k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  777|      0|                BIO_printf(trc_out,
  778|      0|                           "(ctx %p) %s Running constructor => %d\n",
  779|      0|                           (void *)new_data.ctx, LEVEL, rv);
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  780|  46.0k|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  46.0k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  781|       |
  782|  46.0k|            ok = (rv > 0);
  783|  46.0k|            if (ok) {
  ------------------
  |  Branch (783:17): [True: 15.0k, False: 31.0k]
  ------------------
  784|  15.0k|                data->flag_construct_called = 1;
  785|  15.0k|                goto end;
  786|  15.0k|            }
  787|  46.0k|        }
  788|       |
  789|       |        /* The constructor didn't return success */
  790|       |
  791|       |        /*
  792|       |         * so we try to use the object we got and feed it to any next
  793|       |         * decoder that will take it.  Object references are not
  794|       |         * allowed for this.
  795|       |         * If this data isn't present, decoding has failed.
  796|       |         */
  797|       |
  798|  31.0k|        p = OSSL_PARAM_locate_const(params, OSSL_OBJECT_PARAM_DATA);
  ------------------
  |  |  309|  31.0k|# define OSSL_OBJECT_PARAM_DATA "data"
  ------------------
  799|  31.0k|        if (p == NULL || p->data_type != OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|  31.0k|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (799:13): [True: 0, False: 31.0k]
  |  Branch (799:26): [True: 0, False: 31.0k]
  ------------------
  800|      0|            goto end;
  801|  31.0k|        new_data.bio = BIO_new_mem_buf(p->data, (int)p->data_size);
  802|  31.0k|        if (new_data.bio == NULL)
  ------------------
  |  Branch (802:13): [True: 0, False: 31.0k]
  ------------------
  803|      0|            goto end;
  804|  31.0k|        bio = new_data.bio;
  805|       |
  806|       |        /* Get the data type if there is one */
  807|  31.0k|        p = OSSL_PARAM_locate_const(params, OSSL_OBJECT_PARAM_DATA_TYPE);
  ------------------
  |  |  311|  31.0k|# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
  ------------------
  808|  31.0k|        if (p != NULL && !OSSL_PARAM_get_utf8_string_ptr(p, &data_type))
  ------------------
  |  Branch (808:13): [True: 31.0k, False: 0]
  |  Branch (808:26): [True: 0, False: 31.0k]
  ------------------
  809|      0|            goto end;
  810|       |
  811|       |        /* Get the data structure if there is one */
  812|  31.0k|        p = OSSL_PARAM_locate_const(params, OSSL_OBJECT_PARAM_DATA_STRUCTURE);
  ------------------
  |  |  310|  31.0k|# define OSSL_OBJECT_PARAM_DATA_STRUCTURE "data-structure"
  ------------------
  813|  31.0k|        if (p != NULL && !OSSL_PARAM_get_utf8_string_ptr(p, &data_structure))
  ------------------
  |  Branch (813:13): [True: 31.0k, False: 0]
  |  Branch (813:26): [True: 0, False: 31.0k]
  ------------------
  814|      0|            goto end;
  815|       |
  816|       |        /*
  817|       |         * If the data structure is "type-specific" and the data type is
  818|       |         * given, we drop the data structure.  The reasoning is that the
  819|       |         * data type is already enough to find the applicable next decoder,
  820|       |         * so an additional "type-specific" data structure is extraneous.
  821|       |         *
  822|       |         * Furthermore, if the OSSL_DECODER caller asked for a type specific
  823|       |         * structure under another name, such as "DH", we get a mismatch
  824|       |         * if the data structure we just received is "type-specific".
  825|       |         * There's only so much you can do without infusing this code with
  826|       |         * too special knowledge.
  827|       |         */
  828|  31.0k|        trace_data_structure = data_structure;
  829|  31.0k|        if (data_type != NULL && data_structure != NULL
  ------------------
  |  Branch (829:13): [True: 31.0k, False: 0]
  |  Branch (829:34): [True: 31.0k, False: 0]
  ------------------
  830|  31.0k|            && OPENSSL_strcasecmp(data_structure, "type-specific") == 0)
  ------------------
  |  Branch (830:16): [True: 0, False: 31.0k]
  ------------------
  831|      0|            data_structure = NULL;
  832|       |
  833|  31.0k|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  31.0k|    do {                                        \
  |  |  220|  31.0k|        BIO *trc_out = NULL;                    \
  |  |  221|  31.0k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  834|      0|            BIO_printf(trc_out,
  835|      0|                       "(ctx %p) %s incoming from previous decoder (%p):\n"
  836|      0|                       "    data type: %s, data structure: %s%s\n",
  837|      0|                       (void *)new_data.ctx, LEVEL, (void *)decoder,
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  838|      0|                       data_type, trace_data_structure,
  839|      0|                       (trace_data_structure == data_structure
  ------------------
  |  Branch (839:25): [True: 0, False: 0]
  ------------------
  840|      0|                        ? "" : " (dropped)"));
  841|  31.0k|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  31.0k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  842|  31.0k|    }
  843|       |
  844|       |    /*
  845|       |     * If we have no more decoders to look through at this point,
  846|       |     * we failed
  847|       |     */
  848|  75.2k|    if (data->current_decoder_inst_index == 0)
  ------------------
  |  Branch (848:9): [True: 0, False: 75.2k]
  ------------------
  849|      0|        goto end;
  850|       |
  851|  75.2k|    if ((loc = BIO_tell(bio)) < 0) {
  ------------------
  |  |  564|  75.2k|# define BIO_tell(b)     (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
  |  |  ------------------
  |  |  |  |  459|  75.2k|# define BIO_C_FILE_TELL                         133
  |  |  ------------------
  ------------------
  |  Branch (851:9): [True: 0, False: 75.2k]
  ------------------
  852|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_BIO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  853|      0|        goto end;
  854|      0|    }
  855|       |
  856|  75.2k|    if ((cbio = ossl_core_bio_new_from_bio(bio)) == NULL) {
  ------------------
  |  Branch (856:9): [True: 0, False: 75.2k]
  ------------------
  857|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_BIO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  858|      0|        goto end;
  859|      0|    }
  860|       |
  861|   473k|    for (i = data->current_decoder_inst_index; i-- > 0;) {
  ------------------
  |  Branch (861:48): [True: 444k, False: 29.1k]
  ------------------
  862|   444k|        OSSL_DECODER_INSTANCE *new_decoder_inst =
  863|   444k|            sk_OSSL_DECODER_INSTANCE_value(ctx->decoder_insts, i);
  864|   444k|        OSSL_DECODER *new_decoder =
  865|   444k|            OSSL_DECODER_INSTANCE_get_decoder(new_decoder_inst);
  866|   444k|        void *new_decoderctx =
  867|   444k|            OSSL_DECODER_INSTANCE_get_decoder_ctx(new_decoder_inst);
  868|   444k|        const char *new_input_type =
  869|   444k|            OSSL_DECODER_INSTANCE_get_input_type(new_decoder_inst);
  870|   444k|        int n_i_s_was_set = 0;   /* We don't care here */
  871|   444k|        const char *new_input_structure =
  872|   444k|            OSSL_DECODER_INSTANCE_get_input_structure(new_decoder_inst,
  873|   444k|                                                      &n_i_s_was_set);
  874|       |
  875|   444k|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|   444k|    do {                                        \
  |  |  220|   444k|        BIO *trc_out = NULL;                    \
  |  |  221|   444k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  876|      0|            BIO_printf(trc_out,
  877|      0|                       "(ctx %p) %s [%u] Considering decoder instance %p (decoder %p):\n"
  878|      0|                       "    %s with %s\n",
  879|      0|                       (void *)new_data.ctx, LEVEL, (unsigned int)i,
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  880|      0|                       (void *)new_decoder_inst, (void *)new_decoder,
  881|      0|                       OSSL_DECODER_get0_name(new_decoder),
  882|      0|                       OSSL_DECODER_get0_properties(new_decoder));
  883|   444k|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|   444k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  884|       |
  885|       |        /*
  886|       |         * If |decoder| is NULL, it means we've just started, and the caller
  887|       |         * may have specified what it expects the initial input to be.  If
  888|       |         * that's the case, we do this extra check.
  889|       |         */
  890|   444k|        if (decoder == NULL && ctx->start_input_type != NULL
  ------------------
  |  Branch (890:13): [True: 365k, False: 79.1k]
  |  Branch (890:32): [True: 365k, False: 0]
  ------------------
  891|   444k|            && OPENSSL_strcasecmp(ctx->start_input_type, new_input_type) != 0) {
  ------------------
  |  Branch (891:16): [True: 86.8k, False: 278k]
  ------------------
  892|  86.8k|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  86.8k|    do {                                        \
  |  |  220|  86.8k|        BIO *trc_out = NULL;                    \
  |  |  221|  86.8k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  893|      0|                BIO_printf(trc_out,
  894|      0|                           "(ctx %p) %s [%u] the start input type '%s' doesn't match the input type of the considered decoder, skipping...\n",
  895|      0|                           (void *)new_data.ctx, LEVEL, (unsigned int)i,
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  896|      0|                           ctx->start_input_type);
  897|  86.8k|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  86.8k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  898|  86.8k|            continue;
  899|  86.8k|        }
  900|       |
  901|       |        /*
  902|       |         * If we have a previous decoder, we check that the input type
  903|       |         * of the next to be used matches the type of this previous one.
  904|       |         * |new_input_type| holds the value of the "input-type" parameter
  905|       |         * for the decoder we're currently considering.
  906|       |         */
  907|   357k|        if (decoder != NULL && !ossl_decoder_fast_is_a(decoder, new_input_type,
  ------------------
  |  Branch (907:13): [True: 79.1k, False: 278k]
  |  Branch (907:32): [True: 8.47k, False: 70.6k]
  ------------------
  908|  79.1k|                                                       &new_decoder_inst->input_type_id)) {
  909|  8.47k|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  8.47k|    do {                                        \
  |  |  220|  8.47k|        BIO *trc_out = NULL;                    \
  |  |  221|  8.47k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  910|      0|                BIO_printf(trc_out,
  911|      0|                           "(ctx %p) %s [%u] the input type doesn't match the name of the previous decoder (%p), skipping...\n",
  912|      0|                           (void *)new_data.ctx, LEVEL, (unsigned int)i,
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  913|      0|                           (void *)decoder);
  914|  8.47k|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  8.47k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  915|  8.47k|            continue;
  916|  8.47k|        }
  917|       |
  918|       |        /*
  919|       |         * If the previous decoder gave us a data type, we check to see
  920|       |         * if that matches the decoder we're currently considering.
  921|       |         */
  922|   349k|        if (data_type != NULL && !OSSL_DECODER_is_a(new_decoder, data_type)) {
  ------------------
  |  Branch (922:13): [True: 70.6k, False: 278k]
  |  Branch (922:34): [True: 26.5k, False: 44.1k]
  ------------------
  923|  26.5k|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  26.5k|    do {                                        \
  |  |  220|  26.5k|        BIO *trc_out = NULL;                    \
  |  |  221|  26.5k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  924|      0|                BIO_printf(trc_out,
  925|      0|                           "(ctx %p) %s [%u] the previous decoder's data type doesn't match the name of the considered decoder, skipping...\n",
  926|      0|                           (void *)new_data.ctx, LEVEL, (unsigned int)i);
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  927|  26.5k|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  26.5k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  928|  26.5k|            continue;
  929|  26.5k|        }
  930|       |
  931|       |        /*
  932|       |         * If the previous decoder gave us a data structure name, we check
  933|       |         * to see that it matches the input data structure of the decoder
  934|       |         * we're currently considering.
  935|       |         */
  936|   322k|        if (data_structure != NULL
  ------------------
  |  Branch (936:13): [True: 44.1k, False: 278k]
  ------------------
  937|   322k|            && (new_input_structure == NULL
  ------------------
  |  Branch (937:17): [True: 0, False: 44.1k]
  ------------------
  938|  44.1k|                || OPENSSL_strcasecmp(data_structure,
  ------------------
  |  Branch (938:20): [True: 13.6k, False: 30.4k]
  ------------------
  939|  44.1k|                                      new_input_structure) != 0)) {
  940|  13.6k|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  13.6k|    do {                                        \
  |  |  220|  13.6k|        BIO *trc_out = NULL;                    \
  |  |  221|  13.6k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  941|      0|                BIO_printf(trc_out,
  942|      0|                           "(ctx %p) %s [%u] the previous decoder's data structure doesn't match the input structure of the considered decoder, skipping...\n",
  943|      0|                           (void *)new_data.ctx, LEVEL, (unsigned int)i);
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  944|  13.6k|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  13.6k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  945|  13.6k|            continue;
  946|  13.6k|        }
  947|       |
  948|       |        /*
  949|       |         * If the decoder we're currently considering specifies a structure,
  950|       |         * and this check hasn't already been done earlier in this chain of
  951|       |         * decoder_process() calls, check that it matches the user provided
  952|       |         * input structure, if one is given.
  953|       |         */
  954|   308k|        if (!data->flag_input_structure_checked
  ------------------
  |  Branch (954:13): [True: 44.1k, False: 264k]
  ------------------
  955|   308k|            && ctx->input_structure != NULL
  ------------------
  |  Branch (955:16): [True: 44.1k, False: 0]
  ------------------
  956|   308k|            && new_input_structure != NULL) {
  ------------------
  |  Branch (956:16): [True: 44.1k, False: 0]
  ------------------
  957|  44.1k|            data->flag_input_structure_checked = 1;
  958|  44.1k|            if (OPENSSL_strcasecmp(new_input_structure,
  ------------------
  |  Branch (958:17): [True: 44.1k, False: 0]
  ------------------
  959|  44.1k|                                   ctx->input_structure) != 0) {
  960|  44.1k|                OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  44.1k|    do {                                        \
  |  |  220|  44.1k|        BIO *trc_out = NULL;                    \
  |  |  221|  44.1k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  961|      0|                    BIO_printf(trc_out,
  962|      0|                               "(ctx %p) %s [%u] the previous decoder's data structure doesn't match the input structure given by the user, skipping...\n",
  963|      0|                               (void *)new_data.ctx, LEVEL, (unsigned int)i);
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  964|  44.1k|                } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  44.1k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  965|  44.1k|                continue;
  966|  44.1k|            }
  967|  44.1k|        }
  968|       |
  969|       |        /*
  970|       |         * Checking the return value of BIO_reset() or BIO_seek() is unsafe.
  971|       |         * Furthermore, BIO_reset() is unsafe to use if the source BIO happens
  972|       |         * to be a BIO_s_mem(), because the earlier BIO_tell() gives us zero
  973|       |         * no matter where we are in the underlying buffer we're reading from.
  974|       |         *
  975|       |         * So, we simply do a BIO_seek(), and use BIO_tell() that we're back
  976|       |         * at the same position.  This is a best effort attempt, but BIO_seek()
  977|       |         * and BIO_tell() should come as a pair...
  978|       |         */
  979|   264k|        (void)BIO_seek(bio, loc);
  ------------------
  |  |  563|   264k|# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
  |  |  ------------------
  |  |  |  |  453|   264k|# define BIO_C_FILE_SEEK                         128
  |  |  ------------------
  ------------------
  980|   264k|        if (BIO_tell(bio) != loc)
  ------------------
  |  |  564|   264k|# define BIO_tell(b)     (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
  |  |  ------------------
  |  |  |  |  459|   264k|# define BIO_C_FILE_TELL                         133
  |  |  ------------------
  ------------------
  |  Branch (980:13): [True: 0, False: 264k]
  ------------------
  981|      0|            goto end;
  982|       |
  983|       |        /* Recurse */
  984|   264k|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|   264k|    do {                                        \
  |  |  220|   264k|        BIO *trc_out = NULL;                    \
  |  |  221|   264k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  985|      0|            BIO_printf(trc_out,
  986|      0|                       "(ctx %p) %s [%u] Running decoder instance %p\n",
  987|      0|                       (void *)new_data.ctx, LEVEL, (unsigned int)i,
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
  988|      0|                       (void *)new_decoder_inst);
  989|   264k|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|   264k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  990|       |
  991|       |        /*
  992|       |         * We only care about errors reported from decoder implementations
  993|       |         * if it returns false (i.e. there was a fatal error).
  994|       |         */
  995|   264k|        ERR_set_mark();
  996|       |
  997|   264k|        new_data.current_decoder_inst_index = i;
  998|   264k|        new_data.flag_input_structure_checked
  999|   264k|            = data->flag_input_structure_checked;
 1000|   264k|        ok = new_decoder->decode(new_decoderctx, cbio,
 1001|   264k|                                 new_data.ctx->selection,
 1002|   264k|                                 decoder_process, &new_data,
 1003|   264k|                                 ossl_pw_passphrase_callback_dec,
 1004|   264k|                                 &new_data.ctx->pwdata);
 1005|       |
 1006|   264k|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|   264k|    do {                                        \
  |  |  220|   264k|        BIO *trc_out = NULL;                    \
  |  |  221|   264k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1007|      0|            BIO_printf(trc_out,
 1008|      0|                       "(ctx %p) %s [%u] Running decoder instance %p => %d"
 1009|      0|                       " (recursed further: %s, construct called: %s)\n",
 1010|      0|                       (void *)new_data.ctx, LEVEL, (unsigned int)i,
  ------------------
  |  |  738|      0|#define LEVEL (new_data.recursion < sizeof(LEVEL_STR)                   \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  |  Branch (738:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  739|      0|               ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |                              ? &LEVEL_STR[sizeof(LEVEL_STR) - new_data.recursion - 1] \
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  |  |  740|      0|               : LEVEL_STR "...")
  |  |  ------------------
  |  |  |  |  737|      0|#define LEVEL_STR ">>>>>>>>>>>>>>>>"
  |  |  ------------------
  ------------------
 1011|      0|                       (void *)new_decoder_inst, ok,
 1012|      0|                       new_data.flag_next_level_called ? "yes" : "no",
  ------------------
  |  Branch (1012:24): [True: 0, False: 0]
  ------------------
 1013|      0|                       new_data.flag_construct_called ? "yes" : "no");
  ------------------
  |  Branch (1013:24): [True: 0, False: 0]
  ------------------
 1014|   264k|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|   264k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1015|       |
 1016|   264k|        data->flag_construct_called = new_data.flag_construct_called;
 1017|       |
 1018|       |        /* Break on error or if we tried to construct an object already */
 1019|   264k|        if (!ok || data->flag_construct_called) {
  ------------------
  |  Branch (1019:13): [True: 614, False: 264k]
  |  Branch (1019:20): [True: 28.5k, False: 235k]
  ------------------
 1020|  29.1k|            ERR_clear_last_mark();
 1021|  29.1k|            break;
 1022|  29.1k|        }
 1023|   235k|        ERR_pop_to_mark();
 1024|       |
 1025|       |        /*
 1026|       |         * Break if the decoder implementation that we called recursed, since
 1027|       |         * that indicates that it successfully decoded something.
 1028|       |         */
 1029|   235k|        if (new_data.flag_next_level_called)
  ------------------
  |  Branch (1029:13): [True: 16.8k, False: 218k]
  ------------------
 1030|  16.8k|            break;
 1031|   235k|    }
 1032|       |
 1033|  90.2k| end:
 1034|  90.2k|    ossl_core_bio_free(cbio);
 1035|  90.2k|    BIO_free(new_data.bio);
 1036|  90.2k|    return ok;
 1037|  75.2k|}

OSSL_DECODER_up_ref:
   43|   453k|{
   44|   453k|    int ref = 0;
   45|       |
   46|   453k|    CRYPTO_UP_REF(&decoder->base.refcnt, &ref);
   47|   453k|    return 1;
   48|   453k|}
OSSL_DECODER_free:
   51|   453k|{
   52|   453k|    int ref = 0;
   53|       |
   54|   453k|    if (decoder == NULL)
  ------------------
  |  Branch (54:9): [True: 0, False: 453k]
  ------------------
   55|      0|        return;
   56|       |
   57|   453k|    CRYPTO_DOWN_REF(&decoder->base.refcnt, &ref);
   58|   453k|    if (ref > 0)
  ------------------
  |  Branch (58:9): [True: 453k, False: 40]
  ------------------
   59|   453k|        return;
   60|     40|    OPENSSL_free(decoder->base.name);
  ------------------
  |  |  107|     40|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|     40|    ossl_property_free(decoder->base.parsed_propdef);
   62|     40|    ossl_provider_free(decoder->base.prov);
   63|     40|    CRYPTO_FREE_REF(&decoder->base.refcnt);
   64|     40|    OPENSSL_free(decoder);
  ------------------
  |  |  107|     40|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   65|     40|}
ossl_decoder_from_algorithm:
  201|     40|{
  202|     40|    OSSL_DECODER *decoder = NULL;
  203|     40|    const OSSL_DISPATCH *fns = algodef->implementation;
  204|     40|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  205|       |
  206|     40|    if ((decoder = ossl_decoder_new()) == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 40]
  ------------------
  207|      0|        return NULL;
  208|     40|    decoder->base.id = id;
  209|     40|    if ((decoder->base.name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (209:9): [True: 0, False: 40]
  ------------------
  210|      0|        OSSL_DECODER_free(decoder);
  211|      0|        return NULL;
  212|      0|    }
  213|     40|    decoder->base.algodef = algodef;
  214|     40|    if ((decoder->base.parsed_propdef
  ------------------
  |  Branch (214:9): [True: 0, False: 40]
  ------------------
  215|     40|         = ossl_parse_property(libctx, algodef->property_definition)) == NULL) {
  216|      0|        OSSL_DECODER_free(decoder);
  217|      0|        return NULL;
  218|      0|    }
  219|       |
  220|    308|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (220:12): [True: 268, False: 40]
  ------------------
  221|    268|        switch (fns->function_id) {
  ------------------
  |  Branch (221:17): [True: 0, False: 268]
  ------------------
  222|     40|        case OSSL_FUNC_DECODER_NEWCTX:
  ------------------
  |  |  890|     40|# define OSSL_FUNC_DECODER_NEWCTX                      1
  ------------------
  |  Branch (222:9): [True: 40, False: 228]
  ------------------
  223|     40|            if (decoder->newctx == NULL)
  ------------------
  |  Branch (223:17): [True: 40, False: 0]
  ------------------
  224|     40|                decoder->newctx = OSSL_FUNC_decoder_newctx(fns);
  225|     40|            break;
  226|     40|        case OSSL_FUNC_DECODER_FREECTX:
  ------------------
  |  |  891|     40|# define OSSL_FUNC_DECODER_FREECTX                     2
  ------------------
  |  Branch (226:9): [True: 40, False: 228]
  ------------------
  227|     40|            if (decoder->freectx == NULL)
  ------------------
  |  Branch (227:17): [True: 40, False: 0]
  ------------------
  228|     40|                decoder->freectx = OSSL_FUNC_decoder_freectx(fns);
  229|     40|            break;
  230|      0|        case OSSL_FUNC_DECODER_GET_PARAMS:
  ------------------
  |  |  892|      0|# define OSSL_FUNC_DECODER_GET_PARAMS                  3
  ------------------
  |  Branch (230:9): [True: 0, False: 268]
  ------------------
  231|      0|            if (decoder->get_params == NULL)
  ------------------
  |  Branch (231:17): [True: 0, False: 0]
  ------------------
  232|      0|                decoder->get_params =
  233|      0|                    OSSL_FUNC_decoder_get_params(fns);
  234|      0|            break;
  235|      0|        case OSSL_FUNC_DECODER_GETTABLE_PARAMS:
  ------------------
  |  |  893|      0|# define OSSL_FUNC_DECODER_GETTABLE_PARAMS             4
  ------------------
  |  Branch (235:9): [True: 0, False: 268]
  ------------------
  236|      0|            if (decoder->gettable_params == NULL)
  ------------------
  |  Branch (236:17): [True: 0, False: 0]
  ------------------
  237|      0|                decoder->gettable_params =
  238|      0|                    OSSL_FUNC_decoder_gettable_params(fns);
  239|      0|            break;
  240|     37|        case OSSL_FUNC_DECODER_SET_CTX_PARAMS:
  ------------------
  |  |  894|     37|# define OSSL_FUNC_DECODER_SET_CTX_PARAMS              5
  ------------------
  |  Branch (240:9): [True: 37, False: 231]
  ------------------
  241|     37|            if (decoder->set_ctx_params == NULL)
  ------------------
  |  Branch (241:17): [True: 37, False: 0]
  ------------------
  242|     37|                decoder->set_ctx_params =
  243|     37|                    OSSL_FUNC_decoder_set_ctx_params(fns);
  244|     37|            break;
  245|     37|        case OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  895|     37|# define OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS         6
  ------------------
  |  Branch (245:9): [True: 37, False: 231]
  ------------------
  246|     37|            if (decoder->settable_ctx_params == NULL)
  ------------------
  |  Branch (246:17): [True: 37, False: 0]
  ------------------
  247|     37|                decoder->settable_ctx_params =
  248|     37|                    OSSL_FUNC_decoder_settable_ctx_params(fns);
  249|     37|            break;
  250|     37|        case OSSL_FUNC_DECODER_DOES_SELECTION:
  ------------------
  |  |  896|     37|# define OSSL_FUNC_DECODER_DOES_SELECTION             10
  ------------------
  |  Branch (250:9): [True: 37, False: 231]
  ------------------
  251|     37|            if (decoder->does_selection == NULL)
  ------------------
  |  Branch (251:17): [True: 37, False: 0]
  ------------------
  252|     37|                decoder->does_selection =
  253|     37|                    OSSL_FUNC_decoder_does_selection(fns);
  254|     37|            break;
  255|     40|        case OSSL_FUNC_DECODER_DECODE:
  ------------------
  |  |  897|     40|# define OSSL_FUNC_DECODER_DECODE                     11
  ------------------
  |  Branch (255:9): [True: 40, False: 228]
  ------------------
  256|     40|            if (decoder->decode == NULL)
  ------------------
  |  Branch (256:17): [True: 40, False: 0]
  ------------------
  257|     40|                decoder->decode = OSSL_FUNC_decoder_decode(fns);
  258|     40|            break;
  259|     37|        case OSSL_FUNC_DECODER_EXPORT_OBJECT:
  ------------------
  |  |  898|     37|# define OSSL_FUNC_DECODER_EXPORT_OBJECT              20
  ------------------
  |  Branch (259:9): [True: 37, False: 231]
  ------------------
  260|     37|            if (decoder->export_object == NULL)
  ------------------
  |  Branch (260:17): [True: 37, False: 0]
  ------------------
  261|     37|                decoder->export_object = OSSL_FUNC_decoder_export_object(fns);
  262|     37|            break;
  263|    268|        }
  264|    268|    }
  265|       |    /*
  266|       |     * Try to check that the method is sensible.
  267|       |     * If you have a constructor, you must have a destructor and vice versa.
  268|       |     * You must have at least one of the encoding driver functions.
  269|       |     */
  270|     40|    if (!((decoder->newctx == NULL && decoder->freectx == NULL)
  ------------------
  |  Branch (270:12): [True: 0, False: 40]
  |  Branch (270:39): [True: 0, False: 0]
  ------------------
  271|     40|          || (decoder->newctx != NULL && decoder->freectx != NULL))
  ------------------
  |  Branch (271:15): [True: 40, False: 0]
  |  Branch (271:42): [True: 40, False: 0]
  ------------------
  272|     40|        || decoder->decode == NULL) {
  ------------------
  |  Branch (272:12): [True: 0, False: 40]
  ------------------
  273|      0|        OSSL_DECODER_free(decoder);
  274|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROVIDER_FUNCTIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  275|      0|        return NULL;
  276|      0|    }
  277|       |
  278|     40|    if (prov != NULL && !ossl_provider_up_ref(prov)) {
  ------------------
  |  Branch (278:9): [True: 40, False: 0]
  |  Branch (278:25): [True: 0, False: 40]
  ------------------
  279|      0|        OSSL_DECODER_free(decoder);
  280|      0|        return NULL;
  281|      0|    }
  282|       |
  283|     40|    decoder->base.prov = prov;
  284|     40|    return decoder;
  285|     40|}
ossl_decoder_store_cache_flush:
  432|      2|{
  433|      2|    OSSL_METHOD_STORE *store = get_decoder_store(libctx);
  434|       |
  435|      2|    if (store != NULL)
  ------------------
  |  Branch (435:9): [True: 2, False: 0]
  ------------------
  436|      2|        return ossl_method_store_cache_flush_all(store);
  437|      0|    return 1;
  438|      2|}
OSSL_DECODER_get0_provider:
  455|   522k|{
  456|   522k|    if (!ossl_assert(decoder != NULL)) {
  ------------------
  |  |   52|   522k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|   522k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (456:9): [True: 0, False: 522k]
  ------------------
  457|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  458|      0|        return 0;
  459|      0|    }
  460|       |
  461|   522k|    return decoder->base.prov;
  462|   522k|}
ossl_decoder_parsed_properties:
  476|    237|{
  477|    237|    if (!ossl_assert(decoder != NULL)) {
  ------------------
  |  |   52|    237|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    237|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (477:9): [True: 0, False: 237]
  ------------------
  478|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  479|      0|        return 0;
  480|      0|    }
  481|       |
  482|    237|    return decoder->base.parsed_propdef;
  483|    237|}
ossl_decoder_get_number:
  486|  80.5k|{
  487|  80.5k|    if (!ossl_assert(decoder != NULL)) {
  ------------------
  |  |   52|  80.5k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  80.5k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (487:9): [True: 0, False: 80.5k]
  ------------------
  488|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  489|      0|        return 0;
  490|      0|    }
  491|       |
  492|  80.5k|    return decoder->base.id;
  493|  80.5k|}
OSSL_DECODER_is_a:
  506|  70.6k|{
  507|  70.6k|    if (decoder->base.prov != NULL) {
  ------------------
  |  Branch (507:9): [True: 70.6k, False: 0]
  ------------------
  508|  70.6k|        OSSL_LIB_CTX *libctx = ossl_provider_libctx(decoder->base.prov);
  509|  70.6k|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  510|       |
  511|  70.6k|        return ossl_namemap_name2num(namemap, name) == decoder->base.id;
  512|  70.6k|    }
  513|      0|    return 0;
  514|  70.6k|}
ossl_decoder_fast_is_a:
  525|  92.7k|{
  526|  92.7k|    int id = *id_cache;
  527|       |
  528|  92.7k|    if (id <= 0)
  ------------------
  |  Branch (528:9): [True: 83.1k, False: 9.59k]
  ------------------
  529|  83.1k|        *id_cache = id = resolve_name(decoder, name);
  530|       |
  531|  92.7k|    return id > 0 && ossl_decoder_get_number(decoder) == id;
  ------------------
  |  Branch (531:12): [True: 80.5k, False: 12.1k]
  |  Branch (531:22): [True: 71.4k, False: 9.10k]
  ------------------
  532|  92.7k|}
OSSL_DECODER_do_all_provided:
  550|    295|{
  551|    295|    struct decoder_data_st methdata;
  552|    295|    struct do_one_data_st data;
  553|       |
  554|    295|    methdata.libctx = libctx;
  555|    295|    methdata.tmp_store = NULL;
  556|    295|    (void)inner_ossl_decoder_fetch(&methdata, NULL, NULL /* properties */);
  557|       |
  558|    295|    data.user_fn = user_fn;
  559|    295|    data.user_arg = user_arg;
  560|    295|    if (methdata.tmp_store != NULL)
  ------------------
  |  Branch (560:9): [True: 0, False: 295]
  ------------------
  561|      0|        ossl_method_store_do_all(methdata.tmp_store, &do_one, &data);
  562|    295|    ossl_method_store_do_all(get_decoder_store(libctx), &do_one, &data);
  563|    295|    dealloc_tmp_decoder_store(methdata.tmp_store);
  564|    295|}
OSSL_DECODER_CTX_new:
  623|  45.7k|{
  624|  45.7k|    OSSL_DECODER_CTX *ctx;
  625|       |
  626|  45.7k|    ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  45.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  45.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  45.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  627|  45.7k|    return ctx;
  628|  45.7k|}
OSSL_DECODER_CTX_free:
  663|  76.1k|{
  664|  76.1k|    if (ctx != NULL) {
  ------------------
  |  Branch (664:9): [True: 45.7k, False: 30.4k]
  ------------------
  665|  45.7k|        if (ctx->cleanup != NULL)
  ------------------
  |  Branch (665:13): [True: 44.2k, False: 1.49k]
  ------------------
  666|  44.2k|            ctx->cleanup(ctx->construct_data);
  667|  45.7k|        sk_OSSL_DECODER_INSTANCE_pop_free(ctx->decoder_insts,
  668|  45.7k|                                          ossl_decoder_instance_free);
  669|  45.7k|        ossl_pw_clear_passphrase_data(&ctx->pwdata);
  670|  45.7k|        OPENSSL_free(ctx);
  ------------------
  |  |  107|  45.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  45.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  45.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  671|  45.7k|    }
  672|  76.1k|}
decoder_meth.c:ossl_decoder_new:
   29|     40|{
   30|     40|    OSSL_DECODER *decoder = NULL;
   31|       |
   32|     40|    if ((decoder = OPENSSL_zalloc(sizeof(*decoder))) == NULL)
  ------------------
  |  |   99|     40|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (32:9): [True: 0, False: 40]
  ------------------
   33|      0|        return NULL;
   34|     40|    if (!CRYPTO_NEW_REF(&decoder->base.refcnt, 1)) {
  ------------------
  |  Branch (34:9): [True: 0, False: 40]
  ------------------
   35|      0|        OSSL_DECODER_free(decoder);
   36|      0|        return NULL;
   37|      0|    }
   38|       |
   39|     40|    return decoder;
   40|     40|}
decoder_meth.c:inner_ossl_decoder_fetch:
  343|    295|{
  344|    295|    OSSL_METHOD_STORE *store = get_decoder_store(methdata->libctx);
  345|    295|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  346|    295|    const char *const propq = properties != NULL ? properties : "";
  ------------------
  |  Branch (346:31): [True: 0, False: 295]
  ------------------
  347|    295|    void *method = NULL;
  348|    295|    int unsupported, id;
  349|       |
  350|    295|    if (store == NULL || namemap == NULL) {
  ------------------
  |  Branch (350:9): [True: 0, False: 295]
  |  Branch (350:26): [True: 0, False: 295]
  ------------------
  351|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  352|      0|        return NULL;
  353|      0|    }
  354|       |
  355|    295|    id = name != NULL ? ossl_namemap_name2num(namemap, name) : 0;
  ------------------
  |  Branch (355:10): [True: 0, False: 295]
  ------------------
  356|       |
  357|       |    /*
  358|       |     * If we haven't found the name yet, chances are that the algorithm to
  359|       |     * be fetched is unsupported.
  360|       |     */
  361|    295|    unsupported = id == 0;
  362|       |
  363|    295|    if (id == 0
  ------------------
  |  Branch (363:9): [True: 295, False: 0]
  ------------------
  364|    295|        || !ossl_method_store_cache_get(store, NULL, id, propq, &method)) {
  ------------------
  |  Branch (364:12): [True: 0, False: 0]
  ------------------
  365|    295|        OSSL_METHOD_CONSTRUCT_METHOD mcm = {
  366|    295|            get_tmp_decoder_store,
  367|    295|            reserve_decoder_store,
  368|    295|            unreserve_decoder_store,
  369|    295|            get_decoder_from_store,
  370|    295|            put_decoder_in_store,
  371|    295|            construct_decoder,
  372|    295|            destruct_decoder
  373|    295|        };
  374|    295|        OSSL_PROVIDER *prov = NULL;
  375|       |
  376|    295|        methdata->id = id;
  377|    295|        methdata->names = name;
  378|    295|        methdata->propquery = propq;
  379|    295|        methdata->flag_construct_error_occurred = 0;
  380|    295|        if ((method = ossl_method_construct(methdata->libctx, OSSL_OP_DECODER,
  ------------------
  |  |  266|    295|# define OSSL_OP_DECODER                            21
  ------------------
  |  Branch (380:13): [True: 0, False: 295]
  ------------------
  381|    295|                                            &prov, 0 /* !force_cache */,
  382|    295|                                            &mcm, methdata)) != NULL) {
  383|       |            /*
  384|       |             * If construction did create a method for us, we know that
  385|       |             * there is a correct name_id and meth_id, since those have
  386|       |             * already been calculated in get_decoder_from_store() and
  387|       |             * put_decoder_in_store() above.
  388|       |             */
  389|      0|            if (id == 0 && name != NULL)
  ------------------
  |  Branch (389:17): [True: 0, False: 0]
  |  Branch (389:28): [True: 0, False: 0]
  ------------------
  390|      0|                id = ossl_namemap_name2num(namemap, name);
  391|      0|            if (id != 0)
  ------------------
  |  Branch (391:17): [True: 0, False: 0]
  ------------------
  392|      0|                ossl_method_store_cache_set(store, prov, id, propq, method,
  393|      0|                                            up_ref_decoder, free_decoder);
  394|      0|        }
  395|       |
  396|       |        /*
  397|       |         * If we never were in the constructor, the algorithm to be fetched
  398|       |         * is unsupported.
  399|       |         */
  400|    295|        unsupported = !methdata->flag_construct_error_occurred;
  401|    295|    }
  402|       |
  403|    295|    if ((id != 0 || name != NULL) && method == NULL) {
  ------------------
  |  Branch (403:10): [True: 0, False: 295]
  |  Branch (403:21): [True: 0, False: 295]
  |  Branch (403:38): [True: 0, False: 0]
  ------------------
  404|      0|        int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  363|      0|# define ERR_R_UNSUPPORTED                       (268|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  364|      0|# define ERR_R_FETCH_FAILED                      (269|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (404:20): [True: 0, False: 0]
  ------------------
  405|       |
  406|      0|        if (name == NULL)
  ------------------
  |  Branch (406:13): [True: 0, False: 0]
  ------------------
  407|      0|            name = ossl_namemap_num2name(namemap, id, 0);
  408|      0|        ERR_raise_data(ERR_LIB_OSSL_DECODER, code,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, code,
  ------------------
  |  |  121|      0|# define ERR_LIB_OSSL_DECODER    60
  ------------------
  409|      0|                       "%s, Name (%s : %d), Properties (%s)",
  410|      0|                       ossl_lib_ctx_get_descriptor(methdata->libctx),
  411|      0|                       name == NULL ? "<null>" : name, id,
  ------------------
  |  Branch (411:24): [True: 0, False: 0]
  ------------------
  412|      0|                       properties == NULL ? "<null>" : properties);
  ------------------
  |  Branch (412:24): [True: 0, False: 0]
  ------------------
  413|      0|    }
  414|       |
  415|    295|    return method;
  416|    295|}
decoder_meth.c:reserve_decoder_store:
  107|    590|{
  108|    590|    struct decoder_data_st *methdata = data;
  109|       |
  110|    590|    if (store == NULL
  ------------------
  |  Branch (110:9): [True: 590, False: 0]
  ------------------
  111|    590|        && (store = get_decoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (111:12): [True: 0, False: 590]
  ------------------
  112|      0|        return 0;
  113|       |
  114|    590|    return ossl_method_lock_store(store);
  115|    590|}
decoder_meth.c:unreserve_decoder_store:
  118|    590|{
  119|    590|    struct decoder_data_st *methdata = data;
  120|       |
  121|    590|    if (store == NULL
  ------------------
  |  Branch (121:9): [True: 590, False: 0]
  ------------------
  122|    590|        && (store = get_decoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (122:12): [True: 0, False: 590]
  ------------------
  123|      0|        return 0;
  124|       |
  125|    590|    return ossl_method_unlock_store(store);
  126|    590|}
decoder_meth.c:get_decoder_from_store:
  131|    295|{
  132|    295|    struct decoder_data_st *methdata = data;
  133|    295|    void *method = NULL;
  134|    295|    int id;
  135|       |
  136|       |    /*
  137|       |     * get_decoder_from_store() is only called to try and get the method
  138|       |     * that OSSL_DECODER_fetch() is asking for, and the name or name id are
  139|       |     * passed via methdata.
  140|       |     */
  141|    295|    if ((id = methdata->id) == 0 && methdata->names != NULL) {
  ------------------
  |  Branch (141:9): [True: 295, False: 0]
  |  Branch (141:37): [True: 0, False: 295]
  ------------------
  142|      0|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  143|      0|        const char *names = methdata->names;
  144|      0|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   25|      0|#define NAME_SEPARATOR ':'
  ------------------
  145|      0|        size_t l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (145:21): [True: 0, False: 0]
  ------------------
  146|       |
  147|      0|        if (namemap == 0)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            return NULL;
  149|      0|        id = ossl_namemap_name2num_n(namemap, names, l);
  150|      0|    }
  151|       |
  152|    295|    if (id == 0)
  ------------------
  |  Branch (152:9): [True: 295, False: 0]
  ------------------
  153|    295|        return NULL;
  154|       |
  155|      0|    if (store == NULL
  ------------------
  |  Branch (155:9): [True: 0, False: 0]
  ------------------
  156|      0|        && (store = get_decoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  ------------------
  157|      0|        return NULL;
  158|       |
  159|      0|    if (!ossl_method_store_fetch(store, id, methdata->propquery, prov, &method))
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|        return NULL;
  161|      0|    return method;
  162|      0|}
decoder_meth.c:put_decoder_in_store:
  168|     40|{
  169|     40|    struct decoder_data_st *methdata = data;
  170|     40|    OSSL_NAMEMAP *namemap;
  171|     40|    int id;
  172|     40|    size_t l = 0;
  173|       |
  174|       |    /*
  175|       |     * put_decoder_in_store() is only called with an OSSL_DECODER method that
  176|       |     * was successfully created by construct_decoder() below, which means that
  177|       |     * all the names should already be stored in the namemap with the same
  178|       |     * numeric identity, so just use the first to get that identity.
  179|       |     */
  180|     40|    if (names != NULL) {
  ------------------
  |  Branch (180:9): [True: 40, False: 0]
  ------------------
  181|     40|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   25|     40|#define NAME_SEPARATOR ':'
  ------------------
  182|       |
  183|     40|        l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (183:14): [True: 40, False: 0]
  ------------------
  184|     40|    }
  185|       |
  186|     40|    if ((namemap = ossl_namemap_stored(methdata->libctx)) == NULL
  ------------------
  |  Branch (186:9): [True: 0, False: 40]
  ------------------
  187|     40|        || (id = ossl_namemap_name2num_n(namemap, names, l)) == 0)
  ------------------
  |  Branch (187:12): [True: 0, False: 40]
  ------------------
  188|      0|        return 0;
  189|       |
  190|     40|    if (store == NULL && (store = get_decoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (190:9): [True: 40, False: 0]
  |  Branch (190:26): [True: 0, False: 40]
  ------------------
  191|      0|        return 0;
  192|       |
  193|     40|    return ossl_method_store_add(store, prov, id, propdef, method,
  194|     40|                                 (int (*)(void *))OSSL_DECODER_up_ref,
  195|     40|                                 (void (*)(void *))OSSL_DECODER_free);
  196|     40|}
decoder_meth.c:construct_decoder:
  295|     40|{
  296|       |    /*
  297|       |     * This function is only called if get_decoder_from_store() returned
  298|       |     * NULL, so it's safe to say that of all the spots to create a new
  299|       |     * namemap entry, this is it.  Should the name already exist there, we
  300|       |     * know that ossl_namemap_add() will return its corresponding number.
  301|       |     */
  302|     40|    struct decoder_data_st *methdata = data;
  303|     40|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  304|     40|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  305|     40|    const char *names = algodef->algorithm_names;
  306|     40|    int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
  ------------------
  |  |   25|     40|#define NAME_SEPARATOR ':'
  ------------------
  307|     40|    void *method = NULL;
  308|       |
  309|     40|    if (id != 0)
  ------------------
  |  Branch (309:9): [True: 40, False: 0]
  ------------------
  310|     40|        method = ossl_decoder_from_algorithm(id, algodef, prov);
  311|       |
  312|       |    /*
  313|       |     * Flag to indicate that there was actual construction errors.  This
  314|       |     * helps inner_evp_generic_fetch() determine what error it should
  315|       |     * record on inaccessible algorithms.
  316|       |     */
  317|     40|    if (method == NULL)
  ------------------
  |  Branch (317:9): [True: 0, False: 40]
  ------------------
  318|      0|        methdata->flag_construct_error_occurred = 1;
  319|       |
  320|     40|    return method;
  321|     40|}
decoder_meth.c:destruct_decoder:
  325|     40|{
  326|     40|    OSSL_DECODER_free(method);
  327|     40|}
decoder_meth.c:dealloc_tmp_decoder_store:
   95|    295|{
   96|    295|    if (store != NULL)
  ------------------
  |  Branch (96:9): [True: 0, False: 295]
  ------------------
   97|      0|        ossl_method_store_free(store);
   98|    295|}
decoder_meth.c:get_decoder_store:
  102|  1.81k|{
  103|  1.81k|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_STORE_INDEX);
  ------------------
  |  |  111|  1.81k|# define OSSL_LIB_CTX_DECODER_STORE_INDEX           11
  ------------------
  104|  1.81k|}
decoder_meth.c:resolve_name:
  517|  83.1k|{
  518|  83.1k|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(decoder->base.prov);
  519|  83.1k|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  520|       |
  521|  83.1k|    return ossl_namemap_name2num(namemap, name);
  522|  83.1k|}
decoder_meth.c:do_one:
  540|  11.8k|{
  541|  11.8k|    struct do_one_data_st *data = arg;
  542|       |
  543|  11.8k|    data->user_fn(method, data->user_arg);
  544|  11.8k|}

ossl_decoder_cache_new:
  683|      4|{
  684|      4|    DECODER_CACHE *cache = OPENSSL_malloc(sizeof(*cache));
  ------------------
  |  |   97|      4|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  685|       |
  686|      4|    if (cache == NULL)
  ------------------
  |  Branch (686:9): [True: 0, False: 4]
  ------------------
  687|      0|        return NULL;
  688|       |
  689|      4|    cache->lock = CRYPTO_THREAD_lock_new();
  690|      4|    if (cache->lock == NULL) {
  ------------------
  |  Branch (690:9): [True: 0, False: 4]
  ------------------
  691|      0|        OPENSSL_free(cache);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  692|      0|        return NULL;
  693|      0|    }
  694|      4|    cache->hashtable = lh_DECODER_CACHE_ENTRY_new(decoder_cache_entry_hash,
  695|      4|                                                  decoder_cache_entry_cmp);
  696|      4|    if (cache->hashtable == NULL) {
  ------------------
  |  Branch (696:9): [True: 0, False: 4]
  ------------------
  697|      0|        CRYPTO_THREAD_lock_free(cache->lock);
  698|      0|        OPENSSL_free(cache);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  699|      0|        return NULL;
  700|      0|    }
  701|       |
  702|      4|    return cache;
  703|      4|}
ossl_decoder_cache_free:
  706|      2|{
  707|      2|    DECODER_CACHE *cache = (DECODER_CACHE *)vcache;
  708|       |
  709|      2|    lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free);
  710|      2|    lh_DECODER_CACHE_ENTRY_free(cache->hashtable);
  711|      2|    CRYPTO_THREAD_lock_free(cache->lock);
  712|      2|    OPENSSL_free(cache);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  713|      2|}
ossl_decoder_cache_flush:
  720|      5|{
  721|      5|    DECODER_CACHE *cache
  722|      5|        = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_CACHE_INDEX);
  ------------------
  |  |  120|      5|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  723|       |
  724|      5|    if (cache == NULL) {
  ------------------
  |  Branch (724:9): [True: 3, False: 2]
  ------------------
  725|      3|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      3|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      3|    (ERR_new(),                                                 \
  |  |  |  |  404|      3|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      3|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      3|     ERR_set_error)
  |  |  ------------------
  ------------------
  726|      3|        return 0;
  727|      3|    }
  728|       |
  729|      2|    if (!CRYPTO_THREAD_write_lock(cache->lock)) {
  ------------------
  |  Branch (729:9): [True: 0, False: 2]
  ------------------
  730|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  731|      0|        return 0;
  732|      0|    }
  733|       |
  734|      2|    lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free);
  735|      2|    lh_DECODER_CACHE_ENTRY_flush(cache->hashtable);
  736|       |
  737|      2|    CRYPTO_THREAD_unlock(cache->lock);
  738|      2|    return 1;
  739|      2|}
OSSL_DECODER_CTX_new_for_pkey:
  747|  45.4k|{
  748|  45.4k|    OSSL_DECODER_CTX *ctx = NULL;
  749|  45.4k|    OSSL_PARAM decoder_params[] = {
  750|  45.4k|        OSSL_PARAM_END,
  ------------------
  |  |   25|  45.4k|    { NULL, 0, NULL, 0, 0 }
  ------------------
  751|  45.4k|        OSSL_PARAM_END
  ------------------
  |  |   25|  45.4k|    { NULL, 0, NULL, 0, 0 }
  ------------------
  752|  45.4k|    };
  753|  45.4k|    DECODER_CACHE *cache
  754|  45.4k|        = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_CACHE_INDEX);
  ------------------
  |  |  120|  45.4k|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  755|  45.4k|    DECODER_CACHE_ENTRY cacheent, *res, *newcache = NULL;
  756|       |
  757|  45.4k|    if (cache == NULL) {
  ------------------
  |  Branch (757:9): [True: 0, False: 45.4k]
  ------------------
  758|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  759|      0|        return NULL;
  760|      0|    }
  761|  45.4k|    if (propquery != NULL)
  ------------------
  |  Branch (761:9): [True: 0, False: 45.4k]
  ------------------
  762|      0|        decoder_params[0] = OSSL_PARAM_construct_utf8_string(OSSL_DECODER_PARAM_PROPERTIES,
  ------------------
  |  |  193|      0|# define OSSL_DECODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  116|      0|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  ------------------
  ------------------
  763|      0|                                                             (char *)propquery, 0);
  764|       |
  765|       |    /* It is safe to cast away the const here */
  766|  45.4k|    cacheent.input_type = (char *)input_type;
  767|  45.4k|    cacheent.input_structure = (char *)input_structure;
  768|  45.4k|    cacheent.keytype = (char *)keytype;
  769|  45.4k|    cacheent.selection = selection;
  770|  45.4k|    cacheent.propquery = (char *)propquery;
  771|       |
  772|  45.4k|    if (!CRYPTO_THREAD_read_lock(cache->lock)) {
  ------------------
  |  Branch (772:9): [True: 0, False: 45.4k]
  ------------------
  773|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  774|      0|        return NULL;
  775|      0|    }
  776|       |
  777|       |    /* First see if we have a template OSSL_DECODER_CTX */
  778|  45.4k|    res = lh_DECODER_CACHE_ENTRY_retrieve(cache->hashtable, &cacheent);
  779|       |
  780|  45.4k|    if (res == NULL) {
  ------------------
  |  Branch (780:9): [True: 268, False: 45.1k]
  ------------------
  781|       |        /*
  782|       |         * There is no template so we will have to construct one. This will be
  783|       |         * time consuming so release the lock and we will later upgrade it to a
  784|       |         * write lock.
  785|       |         */
  786|    268|        CRYPTO_THREAD_unlock(cache->lock);
  787|       |
  788|    268|        if ((ctx = OSSL_DECODER_CTX_new()) == NULL) {
  ------------------
  |  Branch (788:13): [True: 0, False: 268]
  ------------------
  789|      0|            ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  790|      0|            return NULL;
  791|      0|        }
  792|       |
  793|    268|        OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    268|    do {                                        \
  |  |  220|    268|        BIO *trc_out = NULL;                    \
  |  |  221|    268|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  794|      0|            BIO_printf(trc_out,
  795|      0|                    "(ctx %p) Looking for %s decoders with selection %d\n",
  796|      0|                    (void *)ctx, keytype, selection);
  797|      0|            BIO_printf(trc_out, "    input type: %s, input structure: %s\n",
  798|      0|                    input_type, input_structure);
  799|    268|        } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    268|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  800|       |
  801|    268|        if (OSSL_DECODER_CTX_set_input_type(ctx, input_type)
  ------------------
  |  Branch (801:13): [True: 268, False: 0]
  ------------------
  802|    268|            && OSSL_DECODER_CTX_set_input_structure(ctx, input_structure)
  ------------------
  |  Branch (802:16): [True: 268, False: 0]
  ------------------
  803|    268|            && OSSL_DECODER_CTX_set_selection(ctx, selection)
  ------------------
  |  Branch (803:16): [True: 268, False: 0]
  ------------------
  804|    268|            && ossl_decoder_ctx_setup_for_pkey(ctx, keytype, libctx, propquery)
  ------------------
  |  Branch (804:16): [True: 268, False: 0]
  ------------------
  805|    268|            && OSSL_DECODER_CTX_add_extra(ctx, libctx, propquery)
  ------------------
  |  Branch (805:16): [True: 268, False: 0]
  ------------------
  806|    268|            && (propquery == NULL
  ------------------
  |  Branch (806:17): [True: 268, False: 0]
  ------------------
  807|    268|                || OSSL_DECODER_CTX_set_params(ctx, decoder_params))) {
  ------------------
  |  Branch (807:20): [True: 0, False: 0]
  ------------------
  808|    268|            OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    268|    do {                                        \
  |  |  220|    268|        BIO *trc_out = NULL;                    \
  |  |  221|    268|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  809|      0|                BIO_printf(trc_out, "(ctx %p) Got %d decoders\n",
  810|      0|                        (void *)ctx, OSSL_DECODER_CTX_get_num_decoders(ctx));
  811|    268|            } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    268|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  812|    268|        } else {
  813|      0|            ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  814|      0|            OSSL_DECODER_CTX_free(ctx);
  815|      0|            return NULL;
  816|      0|        }
  817|       |
  818|    268|        newcache = OPENSSL_zalloc(sizeof(*newcache));
  ------------------
  |  |   99|    268|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  819|    268|        if (newcache == NULL) {
  ------------------
  |  Branch (819:13): [True: 0, False: 268]
  ------------------
  820|      0|            OSSL_DECODER_CTX_free(ctx);
  821|      0|            return NULL;
  822|      0|        }
  823|       |
  824|    268|        if (input_type != NULL) {
  ------------------
  |  Branch (824:13): [True: 268, False: 0]
  ------------------
  825|    268|            newcache->input_type = OPENSSL_strdup(input_type);
  ------------------
  |  |  111|    268|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  826|    268|            if (newcache->input_type == NULL)
  ------------------
  |  Branch (826:17): [True: 0, False: 268]
  ------------------
  827|      0|                goto err;
  828|    268|        }
  829|    268|        if (input_structure != NULL) {
  ------------------
  |  Branch (829:13): [True: 268, False: 0]
  ------------------
  830|    268|            newcache->input_structure = OPENSSL_strdup(input_structure);
  ------------------
  |  |  111|    268|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  831|    268|            if (newcache->input_structure == NULL)
  ------------------
  |  Branch (831:17): [True: 0, False: 268]
  ------------------
  832|      0|                goto err;
  833|    268|        }
  834|    268|        if (keytype != NULL) {
  ------------------
  |  Branch (834:13): [True: 267, False: 1]
  ------------------
  835|    267|            newcache->keytype = OPENSSL_strdup(keytype);
  ------------------
  |  |  111|    267|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    267|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    267|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  836|    267|            if (newcache->keytype == NULL)
  ------------------
  |  Branch (836:17): [True: 0, False: 267]
  ------------------
  837|      0|                goto err;
  838|    267|        }
  839|    268|        if (propquery != NULL) {
  ------------------
  |  Branch (839:13): [True: 0, False: 268]
  ------------------
  840|      0|            newcache->propquery = OPENSSL_strdup(propquery);
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  841|      0|            if (newcache->propquery == NULL)
  ------------------
  |  Branch (841:17): [True: 0, False: 0]
  ------------------
  842|      0|                goto err;
  843|      0|        }
  844|    268|        newcache->selection = selection;
  845|    268|        newcache->template = ctx;
  846|       |
  847|    268|        if (!CRYPTO_THREAD_write_lock(cache->lock)) {
  ------------------
  |  Branch (847:13): [True: 0, False: 268]
  ------------------
  848|      0|            ctx = NULL;
  849|      0|            ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  850|      0|            goto err;
  851|      0|        }
  852|    268|        res = lh_DECODER_CACHE_ENTRY_retrieve(cache->hashtable, &cacheent);
  853|    268|        if (res == NULL) {
  ------------------
  |  Branch (853:13): [True: 268, False: 0]
  ------------------
  854|    268|            (void)lh_DECODER_CACHE_ENTRY_insert(cache->hashtable, newcache);
  855|    268|            if (lh_DECODER_CACHE_ENTRY_error(cache->hashtable)) {
  ------------------
  |  Branch (855:17): [True: 0, False: 268]
  ------------------
  856|      0|                ctx = NULL;
  857|      0|                ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  858|      0|                goto err;
  859|      0|            }
  860|    268|        } else {
  861|       |            /*
  862|       |             * We raced with another thread to construct this and lost. Free
  863|       |             * what we just created and use the entry from the hashtable instead
  864|       |             */
  865|      0|            decoder_cache_entry_free(newcache);
  866|      0|            ctx = res->template;
  867|      0|        }
  868|  45.1k|    } else {
  869|  45.1k|        ctx = res->template;
  870|  45.1k|    }
  871|       |
  872|  45.4k|    ctx = ossl_decoder_ctx_for_pkey_dup(ctx, pkey, input_type, input_structure);
  873|  45.4k|    CRYPTO_THREAD_unlock(cache->lock);
  874|       |
  875|  45.4k|    return ctx;
  876|      0| err:
  877|      0|    decoder_cache_entry_free(newcache);
  878|      0|    OSSL_DECODER_CTX_free(ctx);
  879|      0|    return NULL;
  880|  45.4k|}
decoder_pkey.c:decoder_cache_entry_hash:
  617|  45.9k|{
  618|  45.9k|    unsigned long hash = 17;
  619|       |
  620|  45.9k|    hash = (hash * 23)
  621|  45.9k|           + (cache->propquery == NULL
  ------------------
  |  Branch (621:15): [True: 45.9k, False: 0]
  ------------------
  622|  45.9k|              ? 0 : ossl_lh_strcasehash(cache->propquery));
  623|  45.9k|    hash = (hash * 23)
  624|  45.9k|           + (cache->input_structure == NULL
  ------------------
  |  Branch (624:15): [True: 0, False: 45.9k]
  ------------------
  625|  45.9k|              ? 0  : ossl_lh_strcasehash(cache->input_structure));
  626|  45.9k|    hash = (hash * 23)
  627|  45.9k|           + (cache->input_type == NULL
  ------------------
  |  Branch (627:15): [True: 0, False: 45.9k]
  ------------------
  628|  45.9k|              ? 0  : ossl_lh_strcasehash(cache->input_type));
  629|  45.9k|    hash = (hash * 23)
  630|  45.9k|           + (cache->keytype == NULL
  ------------------
  |  Branch (630:15): [True: 11.0k, False: 34.9k]
  ------------------
  631|  45.9k|              ? 0  : ossl_lh_strcasehash(cache->keytype));
  632|       |
  633|  45.9k|    hash ^= cache->selection;
  634|       |
  635|  45.9k|    return hash;
  636|  45.9k|}
decoder_pkey.c:decoder_cache_entry_cmp:
  659|  45.1k|{
  660|  45.1k|    int cmp;
  661|       |
  662|  45.1k|    if (a->selection != b->selection)
  ------------------
  |  Branch (662:9): [True: 0, False: 45.1k]
  ------------------
  663|      0|        return (a->selection < b->selection) ? -1 : 1;
  ------------------
  |  Branch (663:16): [True: 0, False: 0]
  ------------------
  664|       |
  665|  45.1k|    cmp = nullstrcmp(a->keytype, b->keytype, 1);
  666|  45.1k|    if (cmp != 0)
  ------------------
  |  Branch (666:9): [True: 0, False: 45.1k]
  ------------------
  667|      0|        return cmp;
  668|       |
  669|  45.1k|    cmp = nullstrcmp(a->input_type, b->input_type, 1);
  670|  45.1k|    if (cmp != 0)
  ------------------
  |  Branch (670:9): [True: 0, False: 45.1k]
  ------------------
  671|      0|        return cmp;
  672|       |
  673|  45.1k|    cmp = nullstrcmp(a->input_structure, b->input_structure, 1);
  674|  45.1k|    if (cmp != 0)
  ------------------
  |  Branch (674:9): [True: 0, False: 45.1k]
  ------------------
  675|      0|        return cmp;
  676|       |
  677|  45.1k|    cmp = nullstrcmp(a->propquery, b->propquery, 0);
  678|       |
  679|  45.1k|    return cmp;
  680|  45.1k|}
decoder_pkey.c:nullstrcmp:
  639|   180k|{
  640|   180k|    if (a == NULL || b == NULL) {
  ------------------
  |  Branch (640:9): [True: 56.2k, False: 124k]
  |  Branch (640:22): [True: 0, False: 124k]
  ------------------
  641|  56.2k|        if (a == NULL) {
  ------------------
  |  Branch (641:13): [True: 56.2k, False: 0]
  ------------------
  642|  56.2k|            if (b == NULL)
  ------------------
  |  Branch (642:17): [True: 56.2k, False: 0]
  ------------------
  643|  56.2k|                return 0;
  644|      0|            else
  645|      0|                return 1;
  646|  56.2k|        } else {
  647|      0|            return -1;
  648|      0|        }
  649|   124k|    } else {
  650|   124k|        if (casecmp)
  ------------------
  |  Branch (650:13): [True: 124k, False: 0]
  ------------------
  651|   124k|            return OPENSSL_strcasecmp(a, b);
  652|      0|        else
  653|      0|            return strcmp(a, b);
  654|   124k|    }
  655|   180k|}
decoder_pkey.c:decoder_cache_entry_free:
  605|    268|{
  606|    268|    if (entry == NULL)
  ------------------
  |  Branch (606:9): [True: 0, False: 268]
  ------------------
  607|      0|        return;
  608|    268|    OPENSSL_free(entry->input_type);
  ------------------
  |  |  107|    268|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  609|    268|    OPENSSL_free(entry->input_structure);
  ------------------
  |  |  107|    268|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  610|    268|    OPENSSL_free(entry->keytype);
  ------------------
  |  |  107|    268|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  611|    268|    OPENSSL_free(entry->propquery);
  ------------------
  |  |  107|    268|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  612|    268|    OSSL_DECODER_CTX_free(entry->template);
  613|    268|    OPENSSL_free(entry);
  ------------------
  |  |  107|    268|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  614|    268|}
decoder_pkey.c:ossl_decoder_ctx_setup_for_pkey:
  382|    268|{
  383|    268|    int ok = 0;
  384|    268|    struct decoder_pkey_data_st *process_data = NULL;
  385|    268|    struct collect_data_st collect_data = { NULL };
  386|    268|    STACK_OF(EVP_KEYMGMT) *keymgmts = NULL;
  ------------------
  |  |   31|    268|# define STACK_OF(type) struct stack_st_##type
  ------------------
  387|       |
  388|    268|    OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    268|    do {                                        \
  |  |  220|    268|        BIO *trc_out = NULL;                    \
  |  |  221|    268|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  389|      0|        const char *input_type = ctx->start_input_type;
  390|      0|        const char *input_structure = ctx->input_structure;
  391|       |
  392|      0|        BIO_printf(trc_out,
  393|      0|                   "(ctx %p) Looking for decoders producing %s%s%s%s%s%s\n",
  394|      0|                   (void *)ctx,
  395|      0|                   keytype != NULL ? keytype : "",
  ------------------
  |  Branch (395:20): [True: 0, False: 0]
  ------------------
  396|      0|                   keytype != NULL ? " keys" : "keys of any type",
  ------------------
  |  Branch (396:20): [True: 0, False: 0]
  ------------------
  397|      0|                   input_type != NULL ? " from " : "",
  ------------------
  |  Branch (397:20): [True: 0, False: 0]
  ------------------
  398|      0|                   input_type != NULL ? input_type : "",
  ------------------
  |  Branch (398:20): [True: 0, False: 0]
  ------------------
  399|      0|                   input_structure != NULL ? " with " : "",
  ------------------
  |  Branch (399:20): [True: 0, False: 0]
  ------------------
  400|      0|                   input_structure != NULL ? input_structure : "");
  ------------------
  |  Branch (400:20): [True: 0, False: 0]
  ------------------
  401|    268|    } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    268|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  402|       |
  403|       |    /* Allocate data. */
  404|    268|    if ((process_data = OPENSSL_zalloc(sizeof(*process_data))) == NULL)
  ------------------
  |  |   99|    268|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    268|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    268|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (404:9): [True: 0, False: 268]
  ------------------
  405|      0|        goto err;
  406|    268|    if ((propquery != NULL
  ------------------
  |  Branch (406:10): [True: 0, False: 268]
  ------------------
  407|    268|            && (process_data->propq = OPENSSL_strdup(propquery)) == NULL))
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (407:16): [True: 0, False: 0]
  ------------------
  408|      0|        goto err;
  409|       |
  410|       |    /* Allocate our list of EVP_KEYMGMTs. */
  411|    268|    keymgmts = sk_EVP_KEYMGMT_new_null();
  412|    268|    if (keymgmts == NULL) {
  ------------------
  |  Branch (412:9): [True: 0, False: 268]
  ------------------
  413|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  414|      0|        goto err;
  415|      0|    }
  416|       |
  417|    268|    process_data->object    = NULL;
  418|    268|    process_data->libctx    = libctx;
  419|    268|    process_data->selection = ctx->selection;
  420|    268|    process_data->keymgmts  = keymgmts;
  421|       |
  422|       |    /*
  423|       |     * Enumerate all keymgmts into a stack.
  424|       |     *
  425|       |     * We could nest EVP_KEYMGMT_do_all_provided inside
  426|       |     * OSSL_DECODER_do_all_provided or vice versa but these functions become
  427|       |     * bottlenecks if called repeatedly, which is why we collect the
  428|       |     * EVP_KEYMGMTs into a stack here and call both functions only once.
  429|       |     *
  430|       |     * We resolve the keytype string to a name ID so we don't have to resolve it
  431|       |     * multiple times, avoiding repeated calls to EVP_KEYMGMT_is_a, which is a
  432|       |     * performance bottleneck. However, we do this lazily on the first call to
  433|       |     * collect_keymgmt made by EVP_KEYMGMT_do_all_provided, rather than do it
  434|       |     * upfront, as this ensures that the names for all loaded providers have
  435|       |     * been registered by the time we try to resolve the keytype string.
  436|       |     */
  437|    268|    collect_data.ctx        = ctx;
  438|    268|    collect_data.libctx     = libctx;
  439|    268|    collect_data.keymgmts   = keymgmts;
  440|    268|    collect_data.keytype    = keytype;
  441|    268|    EVP_KEYMGMT_do_all_provided(libctx, collect_keymgmt, &collect_data);
  442|       |
  443|    268|    if (collect_data.error_occurred)
  ------------------
  |  Branch (443:9): [True: 0, False: 268]
  ------------------
  444|      0|        goto err;
  445|       |
  446|       |    /* Enumerate all matching decoders. */
  447|    268|    OSSL_DECODER_do_all_provided(libctx, collect_decoder, &collect_data);
  448|       |
  449|    268|    if (collect_data.error_occurred)
  ------------------
  |  Branch (449:9): [True: 0, False: 268]
  ------------------
  450|      0|        goto err;
  451|       |
  452|    268|    OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|    268|    do {                                        \
  |  |  220|    268|        BIO *trc_out = NULL;                    \
  |  |  221|    268|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  453|      0|        BIO_printf(trc_out,
  454|      0|                   "(ctx %p) Got %d decoders producing keys\n",
  455|      0|                   (void *)ctx, collect_data.total);
  456|    268|    } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|    268|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  457|       |
  458|       |    /*
  459|       |     * Finish initializing the decoder context. If one or more decoders matched
  460|       |     * above then the number of decoders attached to the OSSL_DECODER_CTX will
  461|       |     * be nonzero. Else nothing was found and we do nothing.
  462|       |     */
  463|    268|    if (OSSL_DECODER_CTX_get_num_decoders(ctx) != 0) {
  ------------------
  |  Branch (463:9): [True: 27, False: 241]
  ------------------
  464|     27|        if (!OSSL_DECODER_CTX_set_construct(ctx, decoder_construct_pkey)
  ------------------
  |  Branch (464:13): [True: 0, False: 27]
  ------------------
  465|     27|            || !OSSL_DECODER_CTX_set_construct_data(ctx, process_data)
  ------------------
  |  Branch (465:16): [True: 0, False: 27]
  ------------------
  466|     27|            || !OSSL_DECODER_CTX_set_cleanup(ctx,
  ------------------
  |  Branch (466:16): [True: 0, False: 27]
  ------------------
  467|     27|                                             decoder_clean_pkey_construct_arg))
  468|      0|            goto err;
  469|       |
  470|     27|        process_data = NULL; /* Avoid it being freed */
  471|     27|    }
  472|       |
  473|    268|    ok = 1;
  474|    268| err:
  475|    268|    decoder_clean_pkey_construct_arg(process_data);
  476|    268|    return ok;
  477|    268|}
decoder_pkey.c:collect_keymgmt:
  351|  4.82k|{
  352|  4.82k|    struct collect_data_st *data = arg;
  353|       |
  354|  4.82k|    if (!check_keymgmt(keymgmt, data))
  ------------------
  |  Branch (354:9): [True: 4.77k, False: 46]
  ------------------
  355|  4.77k|        return;
  356|       |
  357|       |    /*
  358|       |     * We have to ref EVP_KEYMGMT here because in the success case,
  359|       |     * data->keymgmts is referenced by the constructor we register in the
  360|       |     * OSSL_DECODER_CTX. The registered cleanup function
  361|       |     * (decoder_clean_pkey_construct_arg) unrefs every element of the stack and
  362|       |     * frees it.
  363|       |     */
  364|     46|    if (!EVP_KEYMGMT_up_ref(keymgmt))
  ------------------
  |  Branch (364:9): [True: 0, False: 46]
  ------------------
  365|      0|        return;
  366|       |
  367|     46|    if (sk_EVP_KEYMGMT_push(data->keymgmts, keymgmt) <= 0) {
  ------------------
  |  Branch (367:9): [True: 0, False: 46]
  ------------------
  368|      0|        EVP_KEYMGMT_free(keymgmt);
  369|      0|        data->error_occurred = 1;
  370|      0|    }
  371|     46|}
decoder_pkey.c:check_keymgmt:
  312|  4.82k|{
  313|       |    /* If no keytype was specified, everything matches. */
  314|  4.82k|    if (data->keytype == NULL)
  ------------------
  |  Branch (314:9): [True: 18, False: 4.80k]
  ------------------
  315|     18|        return 1;
  316|       |
  317|  4.80k|    if (!data->keytype_resolved) {
  ------------------
  |  Branch (317:9): [True: 267, False: 4.53k]
  ------------------
  318|       |        /* We haven't cached the IDs from the keytype string yet. */
  319|    267|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(data->libctx);
  320|    267|        data->keytype_id = ossl_namemap_name2num(namemap, data->keytype);
  321|       |
  322|       |        /*
  323|       |         * If keytype is a value ambiguously used for both EC and SM2,
  324|       |         * collect the ID for SM2 as well.
  325|       |         */
  326|    267|        if (data->keytype_id != 0
  ------------------
  |  Branch (326:13): [True: 32, False: 235]
  ------------------
  327|    267|            && (strcmp(data->keytype, "id-ecPublicKey") == 0
  ------------------
  |  Branch (327:17): [True: 2, False: 30]
  ------------------
  328|     32|                || strcmp(data->keytype, "1.2.840.10045.2.1") == 0))
  ------------------
  |  Branch (328:20): [True: 0, False: 30]
  ------------------
  329|      2|            data->sm2_id = ossl_namemap_name2num(namemap, "SM2");
  330|       |
  331|       |        /*
  332|       |         * If keytype_id is zero the name was not found, but we still
  333|       |         * set keytype_resolved to avoid trying all this again.
  334|       |         */
  335|    267|        data->keytype_resolved = 1;
  336|    267|    }
  337|       |
  338|       |    /* Specified keytype could not be resolved, so nothing matches. */
  339|  4.80k|    if (data->keytype_id == 0)
  ------------------
  |  Branch (339:9): [True: 4.23k, False: 576]
  ------------------
  340|  4.23k|        return 0;
  341|       |
  342|       |    /* Does not match the keytype specified, so skip. */
  343|    576|    if (keymgmt->name_id != data->keytype_id
  ------------------
  |  Branch (343:9): [True: 550, False: 26]
  ------------------
  344|    576|        && keymgmt->name_id != data->sm2_id)
  ------------------
  |  Branch (344:12): [True: 548, False: 2]
  ------------------
  345|    548|        return 0;
  346|       |
  347|     28|    return 1;
  348|    576|}
decoder_pkey.c:collect_decoder:
  265|  10.7k|{
  266|  10.7k|    struct collect_data_st *data = arg;
  267|  10.7k|    STACK_OF(EVP_KEYMGMT) *keymgmts = data->keymgmts;
  ------------------
  |  |   31|  10.7k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  268|  10.7k|    int i, end_i;
  269|  10.7k|    EVP_KEYMGMT *keymgmt;
  270|  10.7k|    const OSSL_PROVIDER *prov;
  271|  10.7k|    void *provctx;
  272|       |
  273|  10.7k|    if (data->error_occurred)
  ------------------
  |  Branch (273:9): [True: 0, False: 10.7k]
  ------------------
  274|      0|        return;
  275|       |
  276|  10.7k|    prov = OSSL_DECODER_get0_provider(decoder);
  277|  10.7k|    provctx = OSSL_PROVIDER_get0_provider_ctx(prov);
  278|       |
  279|       |    /*
  280|       |     * Either the caller didn't give us a selection, or if they did, the decoder
  281|       |     * must tell us if it supports that selection to be accepted. If the decoder
  282|       |     * doesn't have |does_selection|, it's seen as taking anything.
  283|       |     */
  284|  10.7k|    if (decoder->does_selection != NULL
  ------------------
  |  Branch (284:9): [True: 9.91k, False: 804]
  ------------------
  285|  10.7k|            && !decoder->does_selection(provctx, data->ctx->selection))
  ------------------
  |  Branch (285:16): [True: 5.23k, False: 4.68k]
  ------------------
  286|  5.23k|        return;
  287|       |
  288|  5.49k|    OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|  5.49k|    do {                                        \
  |  |  220|  5.49k|        BIO *trc_out = NULL;                    \
  |  |  221|  5.49k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  289|      0|        BIO_printf(trc_out,
  290|      0|                   "(ctx %p) Checking out decoder %p:\n"
  291|      0|                   "    %s with %s\n",
  292|      0|                   (void *)data->ctx, (void *)decoder,
  293|      0|                   OSSL_DECODER_get0_name(decoder),
  294|      0|                   OSSL_DECODER_get0_properties(decoder));
  295|  5.49k|    } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|  5.49k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  296|       |
  297|  5.49k|    end_i = sk_EVP_KEYMGMT_num(keymgmts);
  298|  6.56k|    for (i = 0; i < end_i; ++i) {
  ------------------
  |  Branch (298:17): [True: 1.07k, False: 5.49k]
  ------------------
  299|  1.07k|        keymgmt = sk_EVP_KEYMGMT_value(keymgmts, i);
  300|       |
  301|  1.07k|        collect_decoder_keymgmt(keymgmt, decoder, provctx, data);
  302|  1.07k|        if (data->error_occurred)
  ------------------
  |  Branch (302:13): [True: 0, False: 1.07k]
  ------------------
  303|      0|            return;
  304|  1.07k|    }
  305|  5.49k|}
decoder_pkey.c:collect_decoder_keymgmt:
  222|  1.07k|{
  223|  1.07k|    void *decoderctx = NULL;
  224|  1.07k|    OSSL_DECODER_INSTANCE *di = NULL;
  225|       |
  226|       |    /*
  227|       |     * We already checked the EVP_KEYMGMT is applicable in check_keymgmt so we
  228|       |     * don't check it again here.
  229|       |     */
  230|       |
  231|  1.07k|    if (keymgmt->name_id != decoder->base.id)
  ------------------
  |  Branch (231:9): [True: 988, False: 87]
  ------------------
  232|       |        /* Mismatch is not an error, continue. */
  233|    988|        return;
  234|       |
  235|     87|    if ((decoderctx = decoder->newctx(provctx)) == NULL) {
  ------------------
  |  Branch (235:9): [True: 0, False: 87]
  ------------------
  236|      0|        data->error_occurred = 1;
  237|      0|        return;
  238|      0|    }
  239|       |
  240|     87|    if ((di = ossl_decoder_instance_new(decoder, decoderctx)) == NULL) {
  ------------------
  |  Branch (240:9): [True: 0, False: 87]
  ------------------
  241|      0|        decoder->freectx(decoderctx);
  242|      0|        data->error_occurred = 1;
  243|      0|        return;
  244|      0|    }
  245|       |
  246|     87|    OSSL_TRACE_BEGIN(DECODER) {
  ------------------
  |  |  219|     87|    do {                                        \
  |  |  220|     87|        BIO *trc_out = NULL;                    \
  |  |  221|     87|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  247|      0|        BIO_printf(trc_out,
  248|      0|                   "(ctx %p) Checking out decoder %p:\n"
  249|      0|                   "    %s with %s\n",
  250|      0|                   (void *)data->ctx, (void *)decoder,
  251|      0|                   OSSL_DECODER_get0_name(decoder),
  252|      0|                   OSSL_DECODER_get0_properties(decoder));
  253|     87|    } OSSL_TRACE_END(DECODER);
  ------------------
  |  |  224|     87|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  254|       |
  255|     87|    if (!ossl_decoder_ctx_add_decoder_inst(data->ctx, di)) {
  ------------------
  |  Branch (255:9): [True: 0, False: 87]
  ------------------
  256|      0|        ossl_decoder_instance_free(di);
  257|      0|        data->error_occurred = 1;
  258|      0|        return;
  259|      0|    }
  260|       |
  261|     87|    ++data->total;
  262|     87|}
decoder_pkey.c:decoder_construct_pkey:
   73|  46.0k|{
   74|  46.0k|    struct decoder_pkey_data_st *data = construct_data;
   75|  46.0k|    OSSL_DECODER *decoder = OSSL_DECODER_INSTANCE_get_decoder(decoder_inst);
   76|  46.0k|    void *decoderctx = OSSL_DECODER_INSTANCE_get_decoder_ctx(decoder_inst);
   77|  46.0k|    const OSSL_PROVIDER *decoder_prov = OSSL_DECODER_get0_provider(decoder);
   78|  46.0k|    EVP_KEYMGMT *keymgmt = NULL;
   79|  46.0k|    const OSSL_PROVIDER *keymgmt_prov = NULL;
   80|  46.0k|    int i, end;
   81|       |    /*
   82|       |     * |object_ref| points to a provider reference to an object, its exact
   83|       |     * contents entirely opaque to us, but may be passed to any provider
   84|       |     * function that expects this (such as OSSL_FUNC_keymgmt_load().
   85|       |     *
   86|       |     * This pointer is considered volatile, i.e. whatever it points at
   87|       |     * is assumed to be freed as soon as this function returns.
   88|       |     */
   89|  46.0k|    void *object_ref = NULL;
   90|  46.0k|    size_t object_ref_sz = 0;
   91|  46.0k|    const OSSL_PARAM *p;
   92|       |
   93|  46.0k|    p = OSSL_PARAM_locate_const(params, OSSL_OBJECT_PARAM_DATA_TYPE);
  ------------------
  |  |  311|  46.0k|# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
  ------------------
   94|  46.0k|    if (p != NULL) {
  ------------------
  |  Branch (94:9): [True: 46.0k, False: 0]
  ------------------
   95|  46.0k|        char *object_type = NULL;
   96|       |
   97|  46.0k|        if (!OSSL_PARAM_get_utf8_string(p, &object_type, 0))
  ------------------
  |  Branch (97:13): [True: 0, False: 46.0k]
  ------------------
   98|      0|            return 0;
   99|  46.0k|        OPENSSL_free(data->object_type);
  ------------------
  |  |  107|  46.0k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  46.0k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  46.0k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  100|  46.0k|        data->object_type = object_type;
  101|  46.0k|    }
  102|       |
  103|       |    /*
  104|       |     * For stuff that should end up in an EVP_PKEY, we only accept an object
  105|       |     * reference for the moment.  This enforces that the key data itself
  106|       |     * remains with the provider.
  107|       |     */
  108|  46.0k|    p = OSSL_PARAM_locate_const(params, OSSL_OBJECT_PARAM_REFERENCE);
  ------------------
  |  |  313|  46.0k|# define OSSL_OBJECT_PARAM_REFERENCE "reference"
  ------------------
  109|  46.0k|    if (p == NULL || p->data_type != OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|  15.0k|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (109:9): [True: 31.0k, False: 15.0k]
  |  Branch (109:22): [True: 0, False: 15.0k]
  ------------------
  110|  31.0k|        return 0;
  111|  15.0k|    object_ref = p->data;
  112|  15.0k|    object_ref_sz = p->data_size;
  113|       |
  114|       |    /*
  115|       |     * First, we try to find a keymgmt that comes from the same provider as
  116|       |     * the decoder that passed the params.
  117|       |     */
  118|  15.0k|    end = sk_EVP_KEYMGMT_num(data->keymgmts);
  119|  16.7k|    for (i = 0; i < end; i++) {
  ------------------
  |  Branch (119:17): [True: 16.7k, False: 0]
  ------------------
  120|  16.7k|        keymgmt = sk_EVP_KEYMGMT_value(data->keymgmts, i);
  121|  16.7k|        keymgmt_prov = EVP_KEYMGMT_get0_provider(keymgmt);
  122|       |
  123|  16.7k|        if (keymgmt_prov == decoder_prov
  ------------------
  |  Branch (123:13): [True: 16.7k, False: 0]
  ------------------
  124|  16.7k|            && evp_keymgmt_has_load(keymgmt)
  ------------------
  |  Branch (124:16): [True: 16.7k, False: 0]
  ------------------
  125|  16.7k|            && EVP_KEYMGMT_is_a(keymgmt, data->object_type))
  ------------------
  |  Branch (125:16): [True: 15.0k, False: 1.75k]
  ------------------
  126|  15.0k|            break;
  127|  16.7k|    }
  128|  15.0k|    if (i < end) {
  ------------------
  |  Branch (128:9): [True: 15.0k, False: 0]
  ------------------
  129|       |        /* To allow it to be freed further down */
  130|  15.0k|        if (!EVP_KEYMGMT_up_ref(keymgmt))
  ------------------
  |  Branch (130:13): [True: 0, False: 15.0k]
  ------------------
  131|      0|            return 0;
  132|  15.0k|    } else if ((keymgmt = EVP_KEYMGMT_fetch(data->libctx,
  ------------------
  |  Branch (132:16): [True: 0, False: 0]
  ------------------
  133|      0|                                            data->object_type,
  134|      0|                                            data->propq)) != NULL) {
  135|      0|        keymgmt_prov = EVP_KEYMGMT_get0_provider(keymgmt);
  136|      0|    }
  137|       |
  138|  15.0k|    if (keymgmt != NULL) {
  ------------------
  |  Branch (138:9): [True: 15.0k, False: 0]
  ------------------
  139|  15.0k|        EVP_PKEY *pkey = NULL;
  140|  15.0k|        void *keydata = NULL;
  141|       |
  142|       |        /*
  143|       |         * If the EVP_KEYMGMT and the OSSL_DECODER are from the
  144|       |         * same provider, we assume that the KEYMGMT has a key loading
  145|       |         * function that can handle the provider reference we hold.
  146|       |         *
  147|       |         * Otherwise, we export from the decoder and import the
  148|       |         * result in the keymgmt.
  149|       |         */
  150|  15.0k|        if (keymgmt_prov == decoder_prov) {
  ------------------
  |  Branch (150:13): [True: 15.0k, False: 0]
  ------------------
  151|  15.0k|            keydata = evp_keymgmt_load(keymgmt, object_ref, object_ref_sz);
  152|  15.0k|        } else {
  153|      0|            struct evp_keymgmt_util_try_import_data_st import_data;
  154|       |
  155|      0|            import_data.keymgmt = keymgmt;
  156|      0|            import_data.keydata = NULL;
  157|      0|            if (data->selection == 0)
  ------------------
  |  Branch (157:17): [True: 0, False: 0]
  ------------------
  158|       |                /* import/export functions do not tolerate 0 selection */
  159|      0|                import_data.selection = OSSL_KEYMGMT_SELECT_ALL;
  ------------------
  |  |  554|      0|    ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  ------------------
  |  |  |  |  552|      0|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|      0|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  ------------------
  |  |  |  |  549|      0|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  ------------------
  |  |  |  |  550|      0|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  160|      0|            else
  161|      0|                import_data.selection = data->selection;
  162|       |
  163|       |            /*
  164|       |             * No need to check for errors here, the value of
  165|       |             * |import_data.keydata| is as much an indicator.
  166|       |             */
  167|      0|            (void)decoder->export_object(decoderctx,
  168|      0|                                         object_ref, object_ref_sz,
  169|      0|                                         &evp_keymgmt_util_try_import,
  170|      0|                                         &import_data);
  171|      0|            keydata = import_data.keydata;
  172|      0|            import_data.keydata = NULL;
  173|      0|        }
  174|       |
  175|  15.0k|        if (keydata != NULL
  ------------------
  |  Branch (175:13): [True: 15.0k, False: 0]
  ------------------
  176|  15.0k|            && (pkey = evp_keymgmt_util_make_pkey(keymgmt, keydata)) == NULL)
  ------------------
  |  Branch (176:16): [True: 0, False: 15.0k]
  ------------------
  177|      0|            evp_keymgmt_freedata(keymgmt, keydata);
  178|       |
  179|  15.0k|        *data->object = pkey;
  180|       |
  181|       |        /*
  182|       |         * evp_keymgmt_util_make_pkey() increments the reference count when
  183|       |         * assigning the EVP_PKEY, so we can free the keymgmt here.
  184|       |         */
  185|  15.0k|        EVP_KEYMGMT_free(keymgmt);
  186|  15.0k|    }
  187|       |    /*
  188|       |     * We successfully looked through, |*ctx->object| determines if we
  189|       |     * actually found something.
  190|       |     */
  191|  15.0k|    return (*data->object != NULL);
  192|  15.0k|}
decoder_pkey.c:decoder_clean_pkey_construct_arg:
  195|  44.4k|{
  196|  44.4k|    struct decoder_pkey_data_st *data = construct_data;
  197|       |
  198|  44.4k|    if (data != NULL) {
  ------------------
  |  Branch (198:9): [True: 44.4k, False: 27]
  ------------------
  199|  44.4k|        sk_EVP_KEYMGMT_pop_free(data->keymgmts, EVP_KEYMGMT_free);
  200|  44.4k|        OPENSSL_free(data->propq);
  ------------------
  |  |  107|  44.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  201|  44.4k|        OPENSSL_free(data->object_type);
  ------------------
  |  |  107|  44.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  202|  44.4k|        OPENSSL_free(data);
  ------------------
  |  |  107|  44.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  203|  44.4k|    }
  204|  44.4k|}
decoder_pkey.c:ossl_decoder_ctx_for_pkey_dup:
  499|  45.4k|{
  500|  45.4k|    OSSL_DECODER_CTX *dest;
  501|  45.4k|    struct decoder_pkey_data_st *process_data_src, *process_data_dest = NULL;
  502|       |
  503|  45.4k|    if (src == NULL)
  ------------------
  |  Branch (503:9): [True: 0, False: 45.4k]
  ------------------
  504|      0|        return NULL;
  505|       |
  506|  45.4k|    if ((dest = OSSL_DECODER_CTX_new()) == NULL) {
  ------------------
  |  Branch (506:9): [True: 0, False: 45.4k]
  ------------------
  507|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  508|      0|        return NULL;
  509|      0|    }
  510|       |
  511|  45.4k|    if (!OSSL_DECODER_CTX_set_input_type(dest, input_type)
  ------------------
  |  Branch (511:9): [True: 0, False: 45.4k]
  ------------------
  512|  45.4k|            || !OSSL_DECODER_CTX_set_input_structure(dest, input_structure)) {
  ------------------
  |  Branch (512:16): [True: 0, False: 45.4k]
  ------------------
  513|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  514|      0|        goto err;
  515|      0|    }
  516|  45.4k|    dest->selection = src->selection;
  517|       |
  518|  45.4k|    if (src->decoder_insts != NULL) {
  ------------------
  |  Branch (518:9): [True: 44.1k, False: 1.25k]
  ------------------
  519|  44.1k|        dest->decoder_insts
  520|  44.1k|            = sk_OSSL_DECODER_INSTANCE_deep_copy(src->decoder_insts,
  521|  44.1k|                                                 ossl_decoder_instance_dup,
  522|  44.1k|                                                 ossl_decoder_instance_free);
  523|  44.1k|        if (dest->decoder_insts == NULL) {
  ------------------
  |  Branch (523:13): [True: 0, False: 44.1k]
  ------------------
  524|      0|            ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  525|      0|            goto err;
  526|      0|        }
  527|  44.1k|    }
  528|       |
  529|  45.4k|    if (!OSSL_DECODER_CTX_set_construct(dest,
  ------------------
  |  Branch (529:9): [True: 0, False: 45.4k]
  ------------------
  530|  45.4k|                                        OSSL_DECODER_CTX_get_construct(src))) {
  531|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  532|      0|        goto err;
  533|      0|    }
  534|       |
  535|  45.4k|    process_data_src = OSSL_DECODER_CTX_get_construct_data(src);
  536|  45.4k|    if (process_data_src != NULL) {
  ------------------
  |  Branch (536:9): [True: 44.1k, False: 1.25k]
  ------------------
  537|  44.1k|        process_data_dest = OPENSSL_zalloc(sizeof(*process_data_dest));
  ------------------
  |  |   99|  44.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  538|  44.1k|        if (process_data_dest == NULL) {
  ------------------
  |  Branch (538:13): [True: 0, False: 44.1k]
  ------------------
  539|      0|            ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  540|      0|            goto err;
  541|      0|        }
  542|  44.1k|        if (process_data_src->propq != NULL) {
  ------------------
  |  Branch (542:13): [True: 0, False: 44.1k]
  ------------------
  543|      0|            process_data_dest->propq = OPENSSL_strdup(process_data_src->propq);
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  544|      0|            if (process_data_dest->propq == NULL) {
  ------------------
  |  Branch (544:17): [True: 0, False: 0]
  ------------------
  545|      0|                ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  546|      0|                goto err;
  547|      0|            }
  548|      0|        }
  549|       |
  550|  44.1k|        if (process_data_src->keymgmts != NULL) {
  ------------------
  |  Branch (550:13): [True: 44.1k, False: 0]
  ------------------
  551|  44.1k|            process_data_dest->keymgmts
  552|  44.1k|                = sk_EVP_KEYMGMT_deep_copy(process_data_src->keymgmts,
  553|  44.1k|                                           keymgmt_dup,
  554|  44.1k|                                           EVP_KEYMGMT_free);
  555|  44.1k|            if (process_data_dest->keymgmts == NULL) {
  ------------------
  |  Branch (555:17): [True: 0, False: 44.1k]
  ------------------
  556|      0|                ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  557|      0|                goto err;
  558|      0|            }
  559|  44.1k|        }
  560|       |
  561|  44.1k|        process_data_dest->object    = (void **)pkey;
  562|  44.1k|        process_data_dest->libctx    = process_data_src->libctx;
  563|  44.1k|        process_data_dest->selection = process_data_src->selection;
  564|  44.1k|        if (!OSSL_DECODER_CTX_set_construct_data(dest, process_data_dest)) {
  ------------------
  |  Branch (564:13): [True: 0, False: 44.1k]
  ------------------
  565|      0|            ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  566|      0|            goto err;
  567|      0|        }
  568|  44.1k|        process_data_dest = NULL;
  569|  44.1k|    }
  570|       |
  571|  45.4k|    if (!OSSL_DECODER_CTX_set_cleanup(dest,
  ------------------
  |  Branch (571:9): [True: 0, False: 45.4k]
  ------------------
  572|  45.4k|                                      OSSL_DECODER_CTX_get_cleanup(src))) {
  573|      0|        ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_OSSL_DECODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  574|      0|        goto err;
  575|      0|    }
  576|       |
  577|  45.4k|    return dest;
  578|      0| err:
  579|      0|    if (process_data_dest != NULL) {
  ------------------
  |  Branch (579:9): [True: 0, False: 0]
  ------------------
  580|      0|        OPENSSL_free(process_data_dest->propq);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  581|      0|        sk_EVP_KEYMGMT_pop_free(process_data_dest->keymgmts, EVP_KEYMGMT_free);
  582|      0|        OPENSSL_free(process_data_dest);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  583|      0|    }
  584|      0|    OSSL_DECODER_CTX_free(dest);
  585|      0|    return NULL;
  586|  45.4k|}
decoder_pkey.c:keymgmt_dup:
  481|   249k|{
  482|   249k|    if (!EVP_KEYMGMT_up_ref((EVP_KEYMGMT *)keymgmt))
  ------------------
  |  Branch (482:9): [True: 0, False: 249k]
  ------------------
  483|      0|        return NULL;
  484|       |
  485|   249k|    return (EVP_KEYMGMT *)keymgmt;
  486|   249k|}

OSSL_ENCODER_to_bio:
   46|  3.08k|{
   47|  3.08k|    struct encoder_process_data_st data;
   48|       |
   49|  3.08k|    memset(&data, 0, sizeof(data));
   50|  3.08k|    data.ctx = ctx;
   51|  3.08k|    data.bio = out;
   52|  3.08k|    data.current_encoder_inst_index = OSSL_ENCODER_CTX_get_num_encoders(ctx);
   53|       |
   54|  3.08k|    if (data.current_encoder_inst_index == 0) {
  ------------------
  |  Branch (54:9): [True: 0, False: 3.08k]
  ------------------
   55|      0|        ERR_raise_data(ERR_LIB_OSSL_ENCODER, OSSL_ENCODER_R_ENCODER_NOT_FOUND,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_ENCODER, OSSL_ENCODER_R_ENCODER_NOT_FOUND,
  ------------------
  |  |  120|      0|# define ERR_LIB_OSSL_ENCODER    59
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_ENCODER, OSSL_ENCODER_R_ENCODER_NOT_FOUND,
  ------------------
  |  |   24|      0|# define OSSL_ENCODER_R_ENCODER_NOT_FOUND                 101
  ------------------
   56|      0|                       "No encoders were found. For standard encoders you need "
   57|      0|                       "at least one of the default or base providers "
   58|      0|                       "available. Did you forget to load them?");
   59|      0|        return 0;
   60|      0|    }
   61|       |
   62|  3.08k|    return encoder_process(&data) > 0;
   63|  3.08k|}
OSSL_ENCODER_to_data:
   93|  1.63k|{
   94|  1.63k|    BIO *out;
   95|  1.63k|    BUF_MEM *buf = NULL;
   96|  1.63k|    int ret = 0;
   97|       |
   98|  1.63k|    if (pdata_len == NULL) {
  ------------------
  |  Branch (98:9): [True: 0, False: 1.63k]
  ------------------
   99|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  100|      0|        return 0;
  101|      0|    }
  102|       |
  103|  1.63k|    out = BIO_new(BIO_s_mem());
  104|       |
  105|  1.63k|    if (out != NULL
  ------------------
  |  Branch (105:9): [True: 1.63k, False: 0]
  ------------------
  106|  1.63k|        && OSSL_ENCODER_to_bio(ctx, out)
  ------------------
  |  Branch (106:12): [True: 1.30k, False: 335]
  ------------------
  107|  1.63k|        && BIO_get_mem_ptr(out, &buf) > 0) {
  ------------------
  |  |  608|  1.30k|# define BIO_get_mem_ptr(b,pp)   BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \
  |  |  ------------------
  |  |  |  |  440|  1.30k|# define BIO_C_GET_BUF_MEM_PTR                   115
  |  |  ------------------
  |  |  609|  1.30k|                                          (char *)(pp))
  ------------------
  |  Branch (107:12): [True: 1.30k, False: 0]
  ------------------
  108|  1.30k|        ret = 1; /* Hope for the best. A too small buffer will clear this */
  109|       |
  110|  1.30k|        if (pdata != NULL && *pdata != NULL) {
  ------------------
  |  Branch (110:13): [True: 1.30k, False: 0]
  |  Branch (110:30): [True: 0, False: 1.30k]
  ------------------
  111|      0|            if (*pdata_len < buf->length)
  ------------------
  |  Branch (111:17): [True: 0, False: 0]
  ------------------
  112|       |                /*
  113|       |                 * It's tempting to do |*pdata_len = (size_t)buf->length|
  114|       |                 * However, it's believed to be confusing more than helpful,
  115|       |                 * so we don't.
  116|       |                 */
  117|      0|                ret = 0;
  118|      0|            else
  119|      0|                *pdata_len -= buf->length;
  120|  1.30k|        } else {
  121|       |            /* The buffer with the right size is already allocated for us */
  122|  1.30k|            *pdata_len = (size_t)buf->length;
  123|  1.30k|        }
  124|       |
  125|  1.30k|        if (ret) {
  ------------------
  |  Branch (125:13): [True: 1.30k, False: 0]
  ------------------
  126|  1.30k|            if (pdata != NULL) {
  ------------------
  |  Branch (126:17): [True: 1.30k, False: 0]
  ------------------
  127|  1.30k|                if (*pdata != NULL) {
  ------------------
  |  Branch (127:21): [True: 0, False: 1.30k]
  ------------------
  128|      0|                    memcpy(*pdata, buf->data, buf->length);
  129|      0|                    *pdata += buf->length;
  130|  1.30k|                } else {
  131|       |                    /* In this case, we steal the data from BIO_s_mem() */
  132|  1.30k|                    *pdata = (unsigned char *)buf->data;
  133|  1.30k|                    buf->data = NULL;
  134|  1.30k|                }
  135|  1.30k|            }
  136|  1.30k|        }
  137|  1.30k|    }
  138|  1.63k|    BIO_free(out);
  139|  1.63k|    return ret;
  140|  1.63k|}
OSSL_ENCODER_CTX_set_selection:
  143|  3.19k|{
  144|  3.19k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  3.19k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.19k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (144:9): [True: 0, False: 3.19k]
  ------------------
  145|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  146|      0|        return 0;
  147|      0|    }
  148|       |
  149|  3.19k|    if (!ossl_assert(selection != 0)) {
  ------------------
  |  |   52|  3.19k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.19k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (149:9): [True: 0, False: 3.19k]
  ------------------
  150|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  151|      0|        return 0;
  152|      0|    }
  153|       |
  154|  3.19k|    ctx->selection = selection;
  155|  3.19k|    return 1;
  156|  3.19k|}
OSSL_ENCODER_CTX_set_output_type:
  160|  3.19k|{
  161|  3.19k|    if (!ossl_assert(ctx != NULL) || !ossl_assert(output_type != NULL)) {
  ------------------
  |  |   52|  6.38k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  6.38k|                                         __FILE__, __LINE__)
  ------------------
                  if (!ossl_assert(ctx != NULL) || !ossl_assert(output_type != NULL)) {
  ------------------
  |  |   52|  3.19k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.19k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (161:9): [True: 0, False: 3.19k]
  |  Branch (161:38): [True: 0, False: 3.19k]
  ------------------
  162|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  163|      0|        return 0;
  164|      0|    }
  165|       |
  166|  3.19k|    ctx->output_type = output_type;
  167|  3.19k|    return 1;
  168|  3.19k|}
OSSL_ENCODER_CTX_set_output_structure:
  172|  1.63k|{
  173|  1.63k|    if (!ossl_assert(ctx != NULL) || !ossl_assert(output_structure != NULL)) {
  ------------------
  |  |   52|  3.27k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.27k|                                         __FILE__, __LINE__)
  ------------------
                  if (!ossl_assert(ctx != NULL) || !ossl_assert(output_structure != NULL)) {
  ------------------
  |  |   52|  1.63k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  1.63k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (173:9): [True: 0, False: 1.63k]
  |  Branch (173:38): [True: 0, False: 1.63k]
  ------------------
  174|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  175|      0|        return 0;
  176|      0|    }
  177|       |
  178|  1.63k|    ctx->output_structure = output_structure;
  179|  1.63k|    return 1;
  180|  1.63k|}
ossl_encoder_instance_free:
  241|  34.7k|{
  242|  34.7k|    if (encoder_inst != NULL) {
  ------------------
  |  Branch (242:9): [True: 34.7k, False: 0]
  ------------------
  243|  34.7k|        if (encoder_inst->encoder != NULL)
  ------------------
  |  Branch (243:13): [True: 34.7k, False: 0]
  ------------------
  244|  34.7k|            encoder_inst->encoder->freectx(encoder_inst->encoderctx);
  245|  34.7k|        encoder_inst->encoderctx = NULL;
  246|  34.7k|        OSSL_ENCODER_free(encoder_inst->encoder);
  247|  34.7k|        encoder_inst->encoder = NULL;
  248|  34.7k|        OPENSSL_free(encoder_inst);
  ------------------
  |  |  107|  34.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  34.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  34.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  249|  34.7k|    }
  250|  34.7k|}
OSSL_ENCODER_CTX_add_encoder:
  279|  34.7k|{
  280|  34.7k|    OSSL_ENCODER_INSTANCE *encoder_inst = NULL;
  281|  34.7k|    const OSSL_PROVIDER *prov = NULL;
  282|  34.7k|    void *encoderctx = NULL;
  283|  34.7k|    void *provctx = NULL;
  284|       |
  285|  34.7k|    if (!ossl_assert(ctx != NULL) || !ossl_assert(encoder != NULL)) {
  ------------------
  |  |   52|  69.5k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  69.5k|                                         __FILE__, __LINE__)
  ------------------
                  if (!ossl_assert(ctx != NULL) || !ossl_assert(encoder != NULL)) {
  ------------------
  |  |   52|  34.7k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  34.7k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (285:9): [True: 0, False: 34.7k]
  |  Branch (285:38): [True: 0, False: 34.7k]
  ------------------
  286|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  287|      0|        return 0;
  288|      0|    }
  289|       |
  290|  34.7k|    prov = OSSL_ENCODER_get0_provider(encoder);
  291|  34.7k|    provctx = OSSL_PROVIDER_get0_provider_ctx(prov);
  292|       |
  293|  34.7k|    if ((encoderctx = encoder->newctx(provctx)) == NULL
  ------------------
  |  Branch (293:9): [True: 0, False: 34.7k]
  ------------------
  294|  34.7k|        || (encoder_inst =
  ------------------
  |  Branch (294:12): [True: 0, False: 34.7k]
  ------------------
  295|  34.7k|            ossl_encoder_instance_new(encoder, encoderctx)) == NULL)
  296|      0|        goto err;
  297|       |    /* Avoid double free of encoderctx on further errors */
  298|  34.7k|    encoderctx = NULL;
  299|       |
  300|  34.7k|    if (!ossl_encoder_ctx_add_encoder_inst(ctx, encoder_inst))
  ------------------
  |  Branch (300:9): [True: 0, False: 34.7k]
  ------------------
  301|      0|        goto err;
  302|       |
  303|  34.7k|    return 1;
  304|      0| err:
  305|      0|    ossl_encoder_instance_free(encoder_inst);
  306|      0|    if (encoderctx != NULL)
  ------------------
  |  Branch (306:9): [True: 0, False: 0]
  ------------------
  307|      0|        encoder->freectx(encoderctx);
  308|      0|    return 0;
  309|  34.7k|}
OSSL_ENCODER_CTX_add_extra:
  313|  3.19k|{
  314|  3.19k|    return 1;
  315|  3.19k|}
OSSL_ENCODER_CTX_get_num_encoders:
  318|  10.8k|{
  319|  10.8k|    if (ctx == NULL || ctx->encoder_insts == NULL)
  ------------------
  |  Branch (319:9): [True: 0, False: 10.8k]
  |  Branch (319:24): [True: 103, False: 10.7k]
  ------------------
  320|    103|        return 0;
  321|  10.7k|    return sk_OSSL_ENCODER_INSTANCE_num(ctx->encoder_insts);
  322|  10.8k|}
OSSL_ENCODER_CTX_set_construct:
  326|  3.08k|{
  327|  3.08k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  3.08k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.08k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (327:9): [True: 0, False: 3.08k]
  ------------------
  328|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  329|      0|        return 0;
  330|      0|    }
  331|  3.08k|    ctx->construct = construct;
  332|  3.08k|    return 1;
  333|  3.08k|}
OSSL_ENCODER_CTX_set_construct_data:
  337|  3.08k|{
  338|  3.08k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  3.08k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.08k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (338:9): [True: 0, False: 3.08k]
  ------------------
  339|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  340|      0|        return 0;
  341|      0|    }
  342|  3.08k|    ctx->construct_data = construct_data;
  343|  3.08k|    return 1;
  344|  3.08k|}
OSSL_ENCODER_CTX_set_cleanup:
  348|  3.08k|{
  349|  3.08k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  3.08k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.08k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (349:9): [True: 0, False: 3.08k]
  ------------------
  350|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  351|      0|        return 0;
  352|      0|    }
  353|  3.08k|    ctx->cleanup = cleanup;
  354|  3.08k|    return 1;
  355|  3.08k|}
OSSL_ENCODER_INSTANCE_get_encoder:
  359|  74.8k|{
  360|  74.8k|    if (encoder_inst == NULL)
  ------------------
  |  Branch (360:9): [True: 0, False: 74.8k]
  ------------------
  361|      0|        return NULL;
  362|  74.8k|    return encoder_inst->encoder;
  363|  74.8k|}
OSSL_ENCODER_INSTANCE_get_encoder_ctx:
  367|  69.5k|{
  368|  69.5k|    if (encoder_inst == NULL)
  ------------------
  |  Branch (368:9): [True: 0, False: 69.5k]
  ------------------
  369|      0|        return NULL;
  370|  69.5k|    return encoder_inst->encoderctx;
  371|  69.5k|}
OSSL_ENCODER_INSTANCE_get_output_type:
  375|  34.7k|{
  376|  34.7k|    if (encoder_inst == NULL)
  ------------------
  |  Branch (376:9): [True: 0, False: 34.7k]
  ------------------
  377|      0|        return NULL;
  378|  34.7k|    return encoder_inst->output_type;
  379|  34.7k|}
OSSL_ENCODER_INSTANCE_get_output_structure:
  383|  34.7k|{
  384|  34.7k|    if (encoder_inst == NULL)
  ------------------
  |  Branch (384:9): [True: 0, False: 34.7k]
  ------------------
  385|      0|        return NULL;
  386|  34.7k|    return encoder_inst->output_structure;
  387|  34.7k|}
encoder_lib.c:ossl_encoder_instance_new:
  184|  34.7k|{
  185|  34.7k|    OSSL_ENCODER_INSTANCE *encoder_inst = NULL;
  186|  34.7k|    const OSSL_PROVIDER *prov;
  187|  34.7k|    OSSL_LIB_CTX *libctx;
  188|  34.7k|    const OSSL_PROPERTY_LIST *props;
  189|  34.7k|    const OSSL_PROPERTY_DEFINITION *prop;
  190|       |
  191|  34.7k|    if (!ossl_assert(encoder != NULL)) {
  ------------------
  |  |   52|  34.7k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  34.7k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (191:9): [True: 0, False: 34.7k]
  ------------------
  192|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  193|      0|        return 0;
  194|      0|    }
  195|       |
  196|  34.7k|    if ((encoder_inst = OPENSSL_zalloc(sizeof(*encoder_inst))) == NULL)
  ------------------
  |  |   99|  34.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  34.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  34.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (196:9): [True: 0, False: 34.7k]
  ------------------
  197|      0|        return 0;
  198|       |
  199|  34.7k|    if (!OSSL_ENCODER_up_ref(encoder)) {
  ------------------
  |  Branch (199:9): [True: 0, False: 34.7k]
  ------------------
  200|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  201|      0|        goto err;
  202|      0|    }
  203|       |
  204|  34.7k|    prov = OSSL_ENCODER_get0_provider(encoder);
  205|  34.7k|    libctx = ossl_provider_libctx(prov);
  206|  34.7k|    props = ossl_encoder_parsed_properties(encoder);
  207|  34.7k|    if (props == NULL) {
  ------------------
  |  Branch (207:9): [True: 0, False: 34.7k]
  ------------------
  208|      0|        ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  121|      0|# define ERR_LIB_OSSL_DECODER    60
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  365|      0|# define ERR_R_INVALID_PROPERTY_DEFINITION       (270|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  209|      0|                       "there are no property definitions with encoder %s",
  210|      0|                       OSSL_ENCODER_get0_name(encoder));
  211|      0|        goto err;
  212|      0|    }
  213|       |
  214|       |    /* The "output" property is mandatory */
  215|  34.7k|    prop = ossl_property_find_property(props, libctx, "output");
  216|  34.7k|    encoder_inst->output_type = ossl_property_get_string_value(libctx, prop);
  217|  34.7k|    if (encoder_inst->output_type == NULL) {
  ------------------
  |  Branch (217:9): [True: 0, False: 34.7k]
  ------------------
  218|      0|        ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  121|      0|# define ERR_LIB_OSSL_DECODER    60
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_DECODER, ERR_R_INVALID_PROPERTY_DEFINITION,
  ------------------
  |  |  365|      0|# define ERR_R_INVALID_PROPERTY_DEFINITION       (270|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|      0|                       "the mandatory 'output' property is missing "
  220|      0|                       "for encoder %s (properties: %s)",
  221|      0|                       OSSL_ENCODER_get0_name(encoder),
  222|      0|                       OSSL_ENCODER_get0_properties(encoder));
  223|      0|        goto err;
  224|      0|    }
  225|       |
  226|       |    /* The "structure" property is optional */
  227|  34.7k|    prop = ossl_property_find_property(props, libctx, "structure");
  228|  34.7k|    if (prop != NULL)
  ------------------
  |  Branch (228:9): [True: 28.2k, False: 6.51k]
  ------------------
  229|  28.2k|        encoder_inst->output_structure
  230|  28.2k|            = ossl_property_get_string_value(libctx, prop);
  231|       |
  232|  34.7k|    encoder_inst->encoder = encoder;
  233|  34.7k|    encoder_inst->encoderctx = encoderctx;
  234|  34.7k|    return encoder_inst;
  235|      0| err:
  236|      0|    ossl_encoder_instance_free(encoder_inst);
  237|      0|    return NULL;
  238|  34.7k|}
encoder_lib.c:ossl_encoder_ctx_add_encoder_inst:
  254|  34.7k|{
  255|  34.7k|    int ok;
  256|       |
  257|  34.7k|    if (ctx->encoder_insts == NULL
  ------------------
  |  Branch (257:9): [True: 3.08k, False: 31.6k]
  ------------------
  258|  34.7k|        && (ctx->encoder_insts =
  ------------------
  |  Branch (258:12): [True: 0, False: 3.08k]
  ------------------
  259|  3.08k|            sk_OSSL_ENCODER_INSTANCE_new_null()) == NULL) {
  260|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  261|      0|        return 0;
  262|      0|    }
  263|       |
  264|  34.7k|    ok = (sk_OSSL_ENCODER_INSTANCE_push(ctx->encoder_insts, ei) > 0);
  265|  34.7k|    if (ok) {
  ------------------
  |  Branch (265:9): [True: 34.7k, False: 0]
  ------------------
  266|  34.7k|        OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  34.7k|    do {                                        \
  |  |  220|  34.7k|        BIO *trc_out = NULL;                    \
  |  |  221|  34.7k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  267|      0|            BIO_printf(trc_out,
  268|      0|                       "(ctx %p) Added encoder instance %p (encoder %p):\n"
  269|      0|                       "    %s with %s\n",
  270|      0|                       (void *)ctx, (void *)ei, (void *)ei->encoder,
  271|      0|                       OSSL_ENCODER_get0_name(ei->encoder),
  272|      0|                       OSSL_ENCODER_get0_properties(ei->encoder));
  273|  34.7k|        } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  34.7k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  274|  34.7k|    }
  275|  34.7k|    return ok;
  276|  34.7k|}
encoder_lib.c:encoder_process:
  390|  6.14k|{
  391|  6.14k|    OSSL_ENCODER_INSTANCE *current_encoder_inst = NULL;
  392|  6.14k|    OSSL_ENCODER *current_encoder = NULL;
  393|  6.14k|    OSSL_ENCODER_CTX *current_encoder_ctx = NULL;
  394|  6.14k|    BIO *allocated_out = NULL;
  395|  6.14k|    const void *original_data = NULL;
  396|  6.14k|    OSSL_PARAM abstract[10];
  397|  6.14k|    const OSSL_PARAM *current_abstract = NULL;
  398|  6.14k|    int i;
  399|  6.14k|    int ok = -1;  /* -1 signifies that the lookup loop gave nothing */
  400|  6.14k|    int top = 0;
  401|       |
  402|  6.14k|    if (data->next_encoder_inst == NULL) {
  ------------------
  |  Branch (402:9): [True: 3.08k, False: 3.05k]
  ------------------
  403|       |        /* First iteration, where we prepare for what is to come */
  404|       |
  405|  3.08k|        data->count_output_structure =
  406|  3.08k|            data->ctx->output_structure == NULL ? -1 : 0;
  ------------------
  |  Branch (406:13): [True: 1.45k, False: 1.63k]
  ------------------
  407|  3.08k|        top = 1;
  408|  3.08k|    }
  409|       |
  410|  37.8k|    for (i = data->current_encoder_inst_index; i-- > 0;) {
  ------------------
  |  Branch (410:48): [True: 34.7k, False: 3.08k]
  ------------------
  411|  34.7k|        OSSL_ENCODER *next_encoder = NULL;
  412|  34.7k|        const char *current_output_type;
  413|  34.7k|        const char *current_output_structure;
  414|  34.7k|        struct encoder_process_data_st new_data;
  415|       |
  416|  34.7k|        if (!top)
  ------------------
  |  Branch (416:13): [True: 2.27k, False: 32.4k]
  ------------------
  417|  2.27k|            next_encoder =
  418|  2.27k|                OSSL_ENCODER_INSTANCE_get_encoder(data->next_encoder_inst);
  419|       |
  420|  34.7k|        current_encoder_inst =
  421|  34.7k|            sk_OSSL_ENCODER_INSTANCE_value(data->ctx->encoder_insts, i);
  422|  34.7k|        current_encoder =
  423|  34.7k|            OSSL_ENCODER_INSTANCE_get_encoder(current_encoder_inst);
  424|  34.7k|        current_encoder_ctx =
  425|  34.7k|            OSSL_ENCODER_INSTANCE_get_encoder_ctx(current_encoder_inst);
  426|  34.7k|        current_output_type =
  427|  34.7k|            OSSL_ENCODER_INSTANCE_get_output_type(current_encoder_inst);
  428|  34.7k|        current_output_structure =
  429|  34.7k|            OSSL_ENCODER_INSTANCE_get_output_structure(current_encoder_inst);
  430|  34.7k|        memset(&new_data, 0, sizeof(new_data));
  431|  34.7k|        new_data.ctx = data->ctx;
  432|  34.7k|        new_data.current_encoder_inst_index = i;
  433|  34.7k|        new_data.next_encoder_inst = current_encoder_inst;
  434|  34.7k|        new_data.count_output_structure = data->count_output_structure;
  435|  34.7k|        new_data.level = data->level + 1;
  436|       |
  437|  34.7k|        OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  34.7k|    do {                                        \
  |  |  220|  34.7k|        BIO *trc_out = NULL;                    \
  |  |  221|  34.7k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  438|      0|            BIO_printf(trc_out,
  439|      0|                       "[%d] (ctx %p) Considering encoder instance %p (encoder %p)\n",
  440|      0|                       data->level, (void *)data->ctx,
  441|      0|                       (void *)current_encoder_inst, (void *)current_encoder);
  442|  34.7k|        } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  34.7k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  443|       |
  444|       |        /*
  445|       |         * If this is the top call, we check if the output type of the current
  446|       |         * encoder matches the desired output type.
  447|       |         * If this isn't the top call, i.e. this is deeper in the recursion,
  448|       |         * we instead check if the output type of the current encoder matches
  449|       |         * the name of the next encoder (the one found by the parent call).
  450|       |         */
  451|  34.7k|        if (top) {
  ------------------
  |  Branch (451:13): [True: 32.4k, False: 2.27k]
  ------------------
  452|  32.4k|            if (data->ctx->output_type != NULL
  ------------------
  |  Branch (452:17): [True: 32.4k, False: 0]
  ------------------
  453|  32.4k|                && OPENSSL_strcasecmp(current_output_type,
  ------------------
  |  Branch (453:20): [True: 23.9k, False: 8.58k]
  ------------------
  454|  32.4k|                                      data->ctx->output_type) != 0) {
  455|  23.9k|                OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  23.9k|    do {                                        \
  |  |  220|  23.9k|        BIO *trc_out = NULL;                    \
  |  |  221|  23.9k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  456|      0|                    BIO_printf(trc_out,
  457|      0|                               "[%d]    Skipping because current encoder output type (%s) != desired output type (%s)\n",
  458|      0|                               data->level,
  459|      0|                               current_output_type, data->ctx->output_type);
  460|  23.9k|                } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  23.9k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  461|  23.9k|                continue;
  462|  23.9k|            }
  463|  32.4k|        } else {
  464|  2.27k|            if (!OSSL_ENCODER_is_a(next_encoder, current_output_type)) {
  ------------------
  |  Branch (464:17): [True: 2.27k, False: 0]
  ------------------
  465|  2.27k|                OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  2.27k|    do {                                        \
  |  |  220|  2.27k|        BIO *trc_out = NULL;                    \
  |  |  221|  2.27k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  466|      0|                    BIO_printf(trc_out,
  467|      0|                               "[%d]    Skipping because current encoder output type (%s) != name of encoder %p\n",
  468|      0|                               data->level,
  469|      0|                               current_output_type, (void *)next_encoder);
  470|  2.27k|                } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  2.27k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  471|  2.27k|                continue;
  472|  2.27k|            }
  473|  2.27k|        }
  474|       |
  475|       |        /*
  476|       |         * If the caller and the current encoder specify an output structure,
  477|       |         * Check if they match.  If they do, count the match, otherwise skip
  478|       |         * the current encoder.
  479|       |         */
  480|  8.58k|        if (data->ctx->output_structure != NULL
  ------------------
  |  Branch (480:13): [True: 7.13k, False: 1.45k]
  ------------------
  481|  8.58k|            && current_output_structure != NULL) {
  ------------------
  |  Branch (481:16): [True: 7.13k, False: 0]
  ------------------
  482|  7.13k|            if (OPENSSL_strcasecmp(data->ctx->output_structure,
  ------------------
  |  Branch (482:17): [True: 5.53k, False: 1.60k]
  ------------------
  483|  7.13k|                                   current_output_structure) != 0) {
  484|  5.53k|                OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  5.53k|    do {                                        \
  |  |  220|  5.53k|        BIO *trc_out = NULL;                    \
  |  |  221|  5.53k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  485|      0|                    BIO_printf(trc_out,
  486|      0|                               "[%d]    Skipping because current encoder output structure (%s) != ctx output structure (%s)\n",
  487|      0|                               data->level,
  488|      0|                               current_output_structure,
  489|      0|                               data->ctx->output_structure);
  490|  5.53k|                } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  5.53k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  491|  5.53k|                continue;
  492|  5.53k|            }
  493|       |
  494|  1.60k|            data->count_output_structure++;
  495|  1.60k|        }
  496|       |
  497|       |        /*
  498|       |         * Recurse to process the encoder implementations before the current
  499|       |         * one.
  500|       |         */
  501|  3.05k|        ok = encoder_process(&new_data);
  502|       |
  503|  3.05k|        data->prev_encoder_inst = new_data.prev_encoder_inst;
  504|  3.05k|        data->running_output = new_data.running_output;
  505|  3.05k|        data->running_output_length = new_data.running_output_length;
  506|       |
  507|       |        /*
  508|       |         * ok == -1     means that the recursion call above gave no further
  509|       |         *              encoders, and that the one we're currently at should
  510|       |         *              be tried.
  511|       |         * ok == 0      means that something failed in the recursion call
  512|       |         *              above, making the result unsuitable for a chain.
  513|       |         *              In this case, we simply continue to try finding a
  514|       |         *              suitable encoder at this recursion level.
  515|       |         * ok == 1      means that the recursion call was successful, and we
  516|       |         *              try to use the result at this recursion level.
  517|       |         */
  518|  3.05k|        if (ok != 0)
  ------------------
  |  Branch (518:13): [True: 3.05k, False: 0]
  ------------------
  519|  3.05k|            break;
  520|       |
  521|      0|        OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|      0|    do {                                        \
  |  |  220|      0|        BIO *trc_out = NULL;                    \
  |  |  221|      0|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  522|      0|            BIO_printf(trc_out,
  523|      0|                       "[%d]    Skipping because recursion level %d failed\n",
  524|      0|                       data->level, new_data.level);
  525|      0|        } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  526|      0|    }
  527|       |
  528|       |    /*
  529|       |     * If |i < 0|, we didn't find any useful encoder in this recursion, so
  530|       |     * we do the rest of the process only if |i >= 0|.
  531|       |     */
  532|  6.14k|    if (i < 0) {
  ------------------
  |  Branch (532:9): [True: 3.08k, False: 3.05k]
  ------------------
  533|  3.08k|        ok = -1;
  534|       |
  535|  3.08k|        OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  3.08k|    do {                                        \
  |  |  220|  3.08k|        BIO *trc_out = NULL;                    \
  |  |  221|  3.08k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  536|      0|            BIO_printf(trc_out,
  537|      0|                       "[%d] (ctx %p) No suitable encoder found\n",
  538|      0|                       data->level, (void *)data->ctx);
  539|  3.08k|        } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  3.08k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  540|  3.08k|    } else {
  541|       |        /* Preparations */
  542|       |
  543|  3.05k|        switch (ok) {
  ------------------
  |  Branch (543:17): [True: 0, False: 3.05k]
  ------------------
  544|      0|        case 0:
  ------------------
  |  Branch (544:9): [True: 0, False: 3.05k]
  ------------------
  545|      0|            break;
  546|  3.05k|        case -1:
  ------------------
  |  Branch (546:9): [True: 3.05k, False: 0]
  ------------------
  547|       |            /*
  548|       |             * We have reached the beginning of the encoder instance sequence,
  549|       |             * so we prepare the object to be encoded.
  550|       |             */
  551|       |
  552|       |            /*
  553|       |             * |data->count_output_structure| is one of these values:
  554|       |             *
  555|       |             * -1       There is no desired output structure
  556|       |             *  0       There is a desired output structure, and it wasn't
  557|       |             *          matched by any of the encoder instances that were
  558|       |             *          considered
  559|       |             * >0       There is a desired output structure, and at least one
  560|       |             *          of the encoder instances matched it
  561|       |             */
  562|  3.05k|            if (data->count_output_structure == 0)
  ------------------
  |  Branch (562:17): [True: 0, False: 3.05k]
  ------------------
  563|      0|                return 0;
  564|       |
  565|  3.05k|            original_data =
  566|  3.05k|                data->ctx->construct(current_encoder_inst,
  567|  3.05k|                                     data->ctx->construct_data);
  568|       |
  569|       |            /* Also set the data type, using the encoder implementation name */
  570|  3.05k|            data->data_type = OSSL_ENCODER_get0_name(current_encoder);
  571|       |
  572|       |            /* Assume that the constructor recorded an error */
  573|  3.05k|            if (original_data != NULL)
  ------------------
  |  Branch (573:17): [True: 3.05k, False: 0]
  ------------------
  574|  3.05k|                ok = 1;
  575|      0|            else
  576|      0|                ok = 0;
  577|  3.05k|            break;
  578|      0|        case 1:
  ------------------
  |  Branch (578:9): [True: 0, False: 3.05k]
  ------------------
  579|      0|            if (!ossl_assert(data->running_output != NULL)) {
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (579:17): [True: 0, False: 0]
  ------------------
  580|      0|                ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  581|      0|                ok = 0;
  582|      0|                break;
  583|      0|            }
  584|       |
  585|      0|            {
  586|       |                /*
  587|       |                 * Create an object abstraction from the latest output, which
  588|       |                 * was stolen from the previous round.
  589|       |                 */
  590|       |
  591|      0|                OSSL_PARAM *abstract_p = abstract;
  592|      0|                const char *prev_output_structure =
  593|      0|                    OSSL_ENCODER_INSTANCE_get_output_structure(data->prev_encoder_inst);
  594|       |
  595|      0|                *abstract_p++ =
  596|      0|                    OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE,
  ------------------
  |  |  311|      0|# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
  ------------------
  597|      0|                                                     (char *)data->data_type, 0);
  598|      0|                if (prev_output_structure != NULL)
  ------------------
  |  Branch (598:21): [True: 0, False: 0]
  ------------------
  599|      0|                    *abstract_p++ =
  600|      0|                        OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_STRUCTURE,
  ------------------
  |  |  310|      0|# define OSSL_OBJECT_PARAM_DATA_STRUCTURE "data-structure"
  ------------------
  601|      0|                                                         (char *)prev_output_structure,
  602|      0|                                                         0);
  603|      0|                *abstract_p++ =
  604|      0|                    OSSL_PARAM_construct_octet_string(OSSL_OBJECT_PARAM_DATA,
  ------------------
  |  |  309|      0|# define OSSL_OBJECT_PARAM_DATA "data"
  ------------------
  605|      0|                                                      data->running_output,
  606|      0|                                                      data->running_output_length);
  607|      0|                *abstract_p = OSSL_PARAM_construct_end();
  608|      0|                current_abstract = abstract;
  609|      0|            }
  610|      0|            break;
  611|  3.05k|        }
  612|       |
  613|       |        /* Calling the encoder implementation */
  614|       |
  615|  3.05k|        if (ok) {
  ------------------
  |  Branch (615:13): [True: 3.05k, False: 0]
  ------------------
  616|  3.05k|            OSSL_CORE_BIO *cbio = NULL;
  617|  3.05k|            BIO *current_out = NULL;
  618|       |
  619|       |            /*
  620|       |             * If we're at the last encoder instance to use, we're setting up
  621|       |             * final output.  Otherwise, set up an intermediary memory output.
  622|       |             */
  623|  3.05k|            if (top)
  ------------------
  |  Branch (623:17): [True: 3.05k, False: 0]
  ------------------
  624|  3.05k|                current_out = data->bio;
  625|      0|            else if ((current_out = allocated_out = BIO_new(BIO_s_mem()))
  ------------------
  |  Branch (625:22): [True: 0, False: 0]
  ------------------
  626|      0|                     == NULL)
  627|      0|                ok = 0;     /* Assume BIO_new() recorded an error */
  628|       |
  629|  3.05k|            if (ok)
  ------------------
  |  Branch (629:17): [True: 3.05k, False: 0]
  ------------------
  630|  3.05k|                ok = (cbio = ossl_core_bio_new_from_bio(current_out)) != NULL;
  631|  3.05k|            if (ok) {
  ------------------
  |  Branch (631:17): [True: 3.05k, False: 0]
  ------------------
  632|  3.05k|                ok = current_encoder->encode(current_encoder_ctx, cbio,
  633|  3.05k|                                             original_data, current_abstract,
  634|  3.05k|                                             data->ctx->selection,
  635|  3.05k|                                             ossl_pw_passphrase_callback_enc,
  636|  3.05k|                                             &data->ctx->pwdata);
  637|  3.05k|                OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  3.05k|    do {                                        \
  |  |  220|  3.05k|        BIO *trc_out = NULL;                    \
  |  |  221|  3.05k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  638|      0|                    BIO_printf(trc_out,
  639|      0|                               "[%d] (ctx %p) Running encoder instance %p => %d\n",
  640|      0|                               data->level, (void *)data->ctx,
  641|      0|                               (void *)current_encoder_inst, ok);
  642|  3.05k|                } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  3.05k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  643|  3.05k|            }
  644|       |
  645|  3.05k|            ossl_core_bio_free(cbio);
  646|  3.05k|            data->prev_encoder_inst = current_encoder_inst;
  647|  3.05k|        }
  648|  3.05k|    }
  649|       |
  650|       |    /* Cleanup and collecting the result */
  651|       |
  652|  6.14k|    OPENSSL_free(data->running_output);
  ------------------
  |  |  107|  6.14k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  6.14k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  6.14k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  653|  6.14k|    data->running_output = NULL;
  654|       |
  655|       |    /*
  656|       |     * Steal the output from the BIO_s_mem, if we did allocate one.
  657|       |     * That'll be the data for an object abstraction in the next round.
  658|       |     */
  659|  6.14k|    if (allocated_out != NULL) {
  ------------------
  |  Branch (659:9): [True: 0, False: 6.14k]
  ------------------
  660|      0|        BUF_MEM *buf;
  661|       |
  662|      0|        BIO_get_mem_ptr(allocated_out, &buf);
  ------------------
  |  |  608|      0|# define BIO_get_mem_ptr(b,pp)   BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \
  |  |  ------------------
  |  |  |  |  440|      0|# define BIO_C_GET_BUF_MEM_PTR                   115
  |  |  ------------------
  |  |  609|      0|                                          (char *)(pp))
  ------------------
  663|      0|        data->running_output = (unsigned char *)buf->data;
  664|      0|        data->running_output_length = buf->length;
  665|      0|        memset(buf, 0, sizeof(*buf));
  666|      0|    }
  667|       |
  668|  6.14k|    BIO_free(allocated_out);
  669|  6.14k|    if (original_data != NULL)
  ------------------
  |  Branch (669:9): [True: 3.05k, False: 3.08k]
  ------------------
  670|  3.05k|        data->ctx->cleanup(data->ctx->construct_data);
  671|  6.14k|    return ok;
  672|  6.14k|}

OSSL_ENCODER_up_ref:
   43|  34.8k|{
   44|  34.8k|    int ref = 0;
   45|       |
   46|  34.8k|    CRYPTO_UP_REF(&encoder->base.refcnt, &ref);
   47|  34.8k|    return 1;
   48|  34.8k|}
OSSL_ENCODER_free:
   51|  34.9k|{
   52|  34.9k|    int ref = 0;
   53|       |
   54|  34.9k|    if (encoder == NULL)
  ------------------
  |  Branch (54:9): [True: 0, False: 34.9k]
  ------------------
   55|      0|        return;
   56|       |
   57|  34.9k|    CRYPTO_DOWN_REF(&encoder->base.refcnt, &ref);
   58|  34.9k|    if (ref > 0)
  ------------------
  |  Branch (58:9): [True: 34.8k, False: 115]
  ------------------
   59|  34.8k|        return;
   60|    115|    OPENSSL_free(encoder->base.name);
  ------------------
  |  |  107|    115|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    115|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    115|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|    115|    ossl_property_free(encoder->base.parsed_propdef);
   62|    115|    ossl_provider_free(encoder->base.prov);
   63|    115|    CRYPTO_FREE_REF(&encoder->base.refcnt);
   64|    115|    OPENSSL_free(encoder);
  ------------------
  |  |  107|    115|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    115|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    115|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   65|    115|}
ossl_encoder_store_cache_flush:
  441|      2|{
  442|      2|    OSSL_METHOD_STORE *store = get_encoder_store(libctx);
  443|       |
  444|      2|    if (store != NULL)
  ------------------
  |  Branch (444:9): [True: 2, False: 0]
  ------------------
  445|      2|        return ossl_method_store_cache_flush_all(store);
  446|      0|    return 1;
  447|      2|}
OSSL_ENCODER_get0_provider:
  464|   783k|{
  465|   783k|    if (!ossl_assert(encoder != NULL)) {
  ------------------
  |  |   52|   783k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|   783k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (465:9): [True: 0, False: 783k]
  ------------------
  466|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  467|      0|        return 0;
  468|      0|    }
  469|       |
  470|   783k|    return encoder->base.prov;
  471|   783k|}
ossl_encoder_parsed_properties:
  485|  34.7k|{
  486|  34.7k|    if (!ossl_assert(encoder != NULL)) {
  ------------------
  |  |   52|  34.7k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  34.7k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (486:9): [True: 0, False: 34.7k]
  ------------------
  487|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  488|      0|        return 0;
  489|      0|    }
  490|       |
  491|  34.7k|    return encoder->base.parsed_propdef;
  492|  34.7k|}
OSSL_ENCODER_get0_name:
  505|  3.05k|{
  506|  3.05k|    return encoder->base.name;
  507|  3.05k|}
OSSL_ENCODER_is_a:
  515|  2.27k|{
  516|  2.27k|    if (encoder->base.prov != NULL) {
  ------------------
  |  Branch (516:9): [True: 2.27k, False: 0]
  ------------------
  517|  2.27k|        OSSL_LIB_CTX *libctx = ossl_provider_libctx(encoder->base.prov);
  518|  2.27k|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  519|       |
  520|  2.27k|        return ossl_namemap_name2num(namemap, name) == encoder->base.id;
  521|  2.27k|    }
  522|      0|    return 0;
  523|  2.27k|}
OSSL_ENCODER_do_all_provided:
  541|  6.17k|{
  542|  6.17k|    struct encoder_data_st methdata;
  543|  6.17k|    struct do_one_data_st data;
  544|       |
  545|  6.17k|    methdata.libctx = libctx;
  546|  6.17k|    methdata.tmp_store = NULL;
  547|  6.17k|    (void)inner_ossl_encoder_fetch(&methdata, NULL, NULL /* properties */);
  548|       |
  549|  6.17k|    data.user_fn = user_fn;
  550|  6.17k|    data.user_arg = user_arg;
  551|  6.17k|    if (methdata.tmp_store != NULL)
  ------------------
  |  Branch (551:9): [True: 0, False: 6.17k]
  ------------------
  552|      0|        ossl_method_store_do_all(methdata.tmp_store, &do_one, &data);
  553|  6.17k|    ossl_method_store_do_all(get_encoder_store(libctx), &do_one, &data);
  554|  6.17k|    dealloc_tmp_encoder_store(methdata.tmp_store);
  555|  6.17k|}
OSSL_ENCODER_CTX_new:
  607|  3.19k|{
  608|  3.19k|    OSSL_ENCODER_CTX *ctx;
  609|       |
  610|  3.19k|    ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  3.19k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.19k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.19k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  611|  3.19k|    return ctx;
  612|  3.19k|}
OSSL_ENCODER_CTX_set_params:
  616|  3.19k|{
  617|  3.19k|    int ok = 1;
  618|  3.19k|    size_t i;
  619|  3.19k|    size_t l;
  620|       |
  621|  3.19k|    if (!ossl_assert(ctx != NULL)) {
  ------------------
  |  |   52|  3.19k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.19k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (621:9): [True: 0, False: 3.19k]
  ------------------
  622|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  623|      0|        return 0;
  624|      0|    }
  625|       |
  626|  3.19k|    if (ctx->encoder_insts == NULL)
  ------------------
  |  Branch (626:9): [True: 103, False: 3.08k]
  ------------------
  627|    103|        return 1;
  628|       |
  629|  3.08k|    l = OSSL_ENCODER_CTX_get_num_encoders(ctx);
  630|  37.8k|    for (i = 0; i < l; i++) {
  ------------------
  |  Branch (630:17): [True: 34.7k, False: 3.08k]
  ------------------
  631|  34.7k|        OSSL_ENCODER_INSTANCE *encoder_inst =
  632|  34.7k|            sk_OSSL_ENCODER_INSTANCE_value(ctx->encoder_insts, i);
  633|  34.7k|        OSSL_ENCODER *encoder = OSSL_ENCODER_INSTANCE_get_encoder(encoder_inst);
  634|  34.7k|        void *encoderctx = OSSL_ENCODER_INSTANCE_get_encoder_ctx(encoder_inst);
  635|       |
  636|  34.7k|        if (encoderctx == NULL || encoder->set_ctx_params == NULL)
  ------------------
  |  Branch (636:13): [True: 0, False: 34.7k]
  |  Branch (636:35): [True: 4.80k, False: 29.9k]
  ------------------
  637|  4.80k|            continue;
  638|  29.9k|        if (!encoder->set_ctx_params(encoderctx, params))
  ------------------
  |  Branch (638:13): [True: 0, False: 29.9k]
  ------------------
  639|      0|            ok = 0;
  640|  29.9k|    }
  641|  3.08k|    return ok;
  642|  3.19k|}
OSSL_ENCODER_CTX_free:
  645|  3.19k|{
  646|  3.19k|    if (ctx != NULL) {
  ------------------
  |  Branch (646:9): [True: 3.19k, False: 4]
  ------------------
  647|  3.19k|        sk_OSSL_ENCODER_INSTANCE_pop_free(ctx->encoder_insts,
  648|  3.19k|                                          ossl_encoder_instance_free);
  649|  3.19k|        OPENSSL_free(ctx->construct_data);
  ------------------
  |  |  107|  3.19k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.19k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.19k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  650|  3.19k|        ossl_pw_clear_passphrase_data(&ctx->pwdata);
  651|  3.19k|        OPENSSL_free(ctx);
  ------------------
  |  |  107|  3.19k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.19k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.19k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  652|  3.19k|    }
  653|  3.19k|}
encoder_meth.c:inner_ossl_encoder_fetch:
  353|  6.17k|{
  354|  6.17k|    OSSL_METHOD_STORE *store = get_encoder_store(methdata->libctx);
  355|  6.17k|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  356|  6.17k|    const char *const propq = properties != NULL ? properties : "";
  ------------------
  |  Branch (356:31): [True: 0, False: 6.17k]
  ------------------
  357|  6.17k|    void *method = NULL;
  358|  6.17k|    int unsupported, id;
  359|       |
  360|  6.17k|    if (store == NULL || namemap == NULL) {
  ------------------
  |  Branch (360:9): [True: 0, False: 6.17k]
  |  Branch (360:26): [True: 0, False: 6.17k]
  ------------------
  361|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  362|      0|        return NULL;
  363|      0|    }
  364|       |
  365|  6.17k|    id = name != NULL ? ossl_namemap_name2num(namemap, name) : 0;
  ------------------
  |  Branch (365:10): [True: 0, False: 6.17k]
  ------------------
  366|       |
  367|       |    /*
  368|       |     * If we haven't found the name yet, chances are that the algorithm to
  369|       |     * be fetched is unsupported.
  370|       |     */
  371|  6.17k|    unsupported = id == 0;
  372|       |
  373|  6.17k|    if (id == 0
  ------------------
  |  Branch (373:9): [True: 6.17k, False: 0]
  ------------------
  374|  6.17k|        || !ossl_method_store_cache_get(store, NULL, id, propq, &method)) {
  ------------------
  |  Branch (374:12): [True: 0, False: 0]
  ------------------
  375|  6.17k|        OSSL_METHOD_CONSTRUCT_METHOD mcm = {
  376|  6.17k|            get_tmp_encoder_store,
  377|  6.17k|            reserve_encoder_store,
  378|  6.17k|            unreserve_encoder_store,
  379|  6.17k|            get_encoder_from_store,
  380|  6.17k|            put_encoder_in_store,
  381|  6.17k|            construct_encoder,
  382|  6.17k|            destruct_encoder
  383|  6.17k|        };
  384|  6.17k|        OSSL_PROVIDER *prov = NULL;
  385|       |
  386|  6.17k|        methdata->id = id;
  387|  6.17k|        methdata->names = name;
  388|  6.17k|        methdata->propquery = propq;
  389|  6.17k|        methdata->flag_construct_error_occurred = 0;
  390|  6.17k|        if ((method = ossl_method_construct(methdata->libctx, OSSL_OP_ENCODER,
  ------------------
  |  |  265|  6.17k|# define OSSL_OP_ENCODER                            20
  ------------------
  |  Branch (390:13): [True: 0, False: 6.17k]
  ------------------
  391|  6.17k|                                            &prov, 0 /* !force_cache */,
  392|  6.17k|                                            &mcm, methdata)) != NULL) {
  393|       |            /*
  394|       |             * If construction did create a method for us, we know that
  395|       |             * there is a correct name_id and meth_id, since those have
  396|       |             * already been calculated in get_encoder_from_store() and
  397|       |             * put_encoder_in_store() above.
  398|       |             */
  399|      0|            if (id == 0)
  ------------------
  |  Branch (399:17): [True: 0, False: 0]
  ------------------
  400|      0|                id = ossl_namemap_name2num(namemap, name);
  401|      0|            ossl_method_store_cache_set(store, prov, id, propq, method,
  402|      0|                                        up_ref_encoder, free_encoder);
  403|      0|        }
  404|       |
  405|       |        /*
  406|       |         * If we never were in the constructor, the algorithm to be fetched
  407|       |         * is unsupported.
  408|       |         */
  409|  6.17k|        unsupported = !methdata->flag_construct_error_occurred;
  410|  6.17k|    }
  411|       |
  412|  6.17k|    if ((id != 0 || name != NULL) && method == NULL) {
  ------------------
  |  Branch (412:10): [True: 0, False: 6.17k]
  |  Branch (412:21): [True: 0, False: 6.17k]
  |  Branch (412:38): [True: 0, False: 0]
  ------------------
  413|      0|        int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  363|      0|# define ERR_R_UNSUPPORTED                       (268|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  364|      0|# define ERR_R_FETCH_FAILED                      (269|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (413:20): [True: 0, False: 0]
  ------------------
  414|       |
  415|      0|        if (name == NULL)
  ------------------
  |  Branch (415:13): [True: 0, False: 0]
  ------------------
  416|      0|            name = ossl_namemap_num2name(namemap, id, 0);
  417|      0|        ERR_raise_data(ERR_LIB_OSSL_ENCODER, code,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_ENCODER, code,
  ------------------
  |  |  120|      0|# define ERR_LIB_OSSL_ENCODER    59
  ------------------
  418|      0|                       "%s, Name (%s : %d), Properties (%s)",
  419|      0|                       ossl_lib_ctx_get_descriptor(methdata->libctx),
  420|      0|                       name == NULL ? "<null>" : name, id,
  ------------------
  |  Branch (420:24): [True: 0, False: 0]
  ------------------
  421|      0|                       properties == NULL ? "<null>" : properties);
  ------------------
  |  Branch (421:24): [True: 0, False: 0]
  ------------------
  422|      0|    }
  423|       |
  424|  6.17k|    return method;
  425|  6.17k|}
encoder_meth.c:reserve_encoder_store:
  107|  12.3k|{
  108|  12.3k|    struct encoder_data_st *methdata = data;
  109|       |
  110|  12.3k|    if (store == NULL
  ------------------
  |  Branch (110:9): [True: 12.3k, False: 0]
  ------------------
  111|  12.3k|        && (store = get_encoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (111:12): [True: 0, False: 12.3k]
  ------------------
  112|      0|        return 0;
  113|       |
  114|  12.3k|    return ossl_method_lock_store(store);
  115|  12.3k|}
encoder_meth.c:unreserve_encoder_store:
  118|  12.3k|{
  119|  12.3k|    struct encoder_data_st *methdata = data;
  120|       |
  121|  12.3k|    if (store == NULL
  ------------------
  |  Branch (121:9): [True: 12.3k, False: 0]
  ------------------
  122|  12.3k|        && (store = get_encoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (122:12): [True: 0, False: 12.3k]
  ------------------
  123|      0|        return 0;
  124|       |
  125|  12.3k|    return ossl_method_unlock_store(store);
  126|  12.3k|}
encoder_meth.c:get_encoder_from_store:
  131|  6.17k|{
  132|  6.17k|    struct encoder_data_st *methdata = data;
  133|  6.17k|    void *method = NULL;
  134|  6.17k|    int id;
  135|       |
  136|       |    /*
  137|       |     * get_encoder_from_store() is only called to try and get the method
  138|       |     * that OSSL_ENCODER_fetch() is asking for, and the name or name id are
  139|       |     * passed via methdata.
  140|       |     */
  141|  6.17k|    if ((id = methdata->id) == 0 && methdata->names != NULL) {
  ------------------
  |  Branch (141:9): [True: 6.17k, False: 0]
  |  Branch (141:37): [True: 0, False: 6.17k]
  ------------------
  142|      0|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  143|      0|        const char *names = methdata->names;
  144|      0|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   25|      0|#define NAME_SEPARATOR ':'
  ------------------
  145|      0|        size_t l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (145:21): [True: 0, False: 0]
  ------------------
  146|       |
  147|      0|        if (namemap == 0)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            return NULL;
  149|      0|        id = ossl_namemap_name2num_n(namemap, methdata->names, l);
  150|      0|    }
  151|       |
  152|  6.17k|    if (id == 0)
  ------------------
  |  Branch (152:9): [True: 6.17k, False: 0]
  ------------------
  153|  6.17k|        return NULL;
  154|       |
  155|      0|    if (store == NULL
  ------------------
  |  Branch (155:9): [True: 0, False: 0]
  ------------------
  156|      0|        && (store = get_encoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  ------------------
  157|      0|        return NULL;
  158|       |
  159|      0|    if (!ossl_method_store_fetch(store, id, methdata->propquery, prov, &method))
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|        return NULL;
  161|      0|    return method;
  162|      0|}
encoder_meth.c:put_encoder_in_store:
  168|    115|{
  169|    115|    struct encoder_data_st *methdata = data;
  170|    115|    OSSL_NAMEMAP *namemap;
  171|    115|    int id;
  172|    115|    size_t l = 0;
  173|       |
  174|       |    /*
  175|       |     * put_encoder_in_store() is only called with an OSSL_ENCODER method that
  176|       |     * was successfully created by construct_encoder() below, which means that
  177|       |     * all the names should already be stored in the namemap with the same
  178|       |     * numeric identity, so just use the first to get that identity.
  179|       |     */
  180|    115|    if (names != NULL) {
  ------------------
  |  Branch (180:9): [True: 115, False: 0]
  ------------------
  181|    115|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   25|    115|#define NAME_SEPARATOR ':'
  ------------------
  182|       |
  183|    115|        l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (183:14): [True: 115, False: 0]
  ------------------
  184|    115|    }
  185|       |
  186|    115|    if ((namemap = ossl_namemap_stored(methdata->libctx)) == NULL
  ------------------
  |  Branch (186:9): [True: 0, False: 115]
  ------------------
  187|    115|        || (id = ossl_namemap_name2num_n(namemap, names, l)) == 0)
  ------------------
  |  Branch (187:12): [True: 0, False: 115]
  ------------------
  188|      0|        return 0;
  189|       |
  190|    115|    if (store == NULL && (store = get_encoder_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (190:9): [True: 115, False: 0]
  |  Branch (190:26): [True: 0, False: 115]
  ------------------
  191|      0|        return 0;
  192|       |
  193|    115|    return ossl_method_store_add(store, prov, id, propdef, method,
  194|    115|                                 (int (*)(void *))OSSL_ENCODER_up_ref,
  195|    115|                                 (void (*)(void *))OSSL_ENCODER_free);
  196|    115|}
encoder_meth.c:construct_encoder:
  305|    115|{
  306|       |    /*
  307|       |     * This function is only called if get_encoder_from_store() returned
  308|       |     * NULL, so it's safe to say that of all the spots to create a new
  309|       |     * namemap entry, this is it.  Should the name already exist there, we
  310|       |     * know that ossl_namemap_add() will return its corresponding number.
  311|       |     */
  312|    115|    struct encoder_data_st *methdata = data;
  313|    115|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  314|    115|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  315|    115|    const char *names = algodef->algorithm_names;
  316|    115|    int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
  ------------------
  |  |   25|    115|#define NAME_SEPARATOR ':'
  ------------------
  317|    115|    void *method = NULL;
  318|       |
  319|    115|    if (id != 0)
  ------------------
  |  Branch (319:9): [True: 115, False: 0]
  ------------------
  320|    115|        method = encoder_from_algorithm(id, algodef, prov);
  321|       |
  322|       |    /*
  323|       |     * Flag to indicate that there was actual construction errors.  This
  324|       |     * helps inner_evp_generic_fetch() determine what error it should
  325|       |     * record on inaccessible algorithms.
  326|       |     */
  327|    115|    if (method == NULL)
  ------------------
  |  Branch (327:9): [True: 0, False: 115]
  ------------------
  328|      0|        methdata->flag_construct_error_occurred = 1;
  329|       |
  330|    115|    return method;
  331|    115|}
encoder_meth.c:encoder_from_algorithm:
  201|    115|{
  202|    115|    OSSL_ENCODER *encoder = NULL;
  203|    115|    const OSSL_DISPATCH *fns = algodef->implementation;
  204|    115|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  205|       |
  206|    115|    if ((encoder = ossl_encoder_new()) == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 115]
  ------------------
  207|      0|        return NULL;
  208|    115|    encoder->base.id = id;
  209|    115|    if ((encoder->base.name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (209:9): [True: 0, False: 115]
  ------------------
  210|      0|        OSSL_ENCODER_free(encoder);
  211|      0|        return NULL;
  212|      0|    }
  213|    115|    encoder->base.algodef = algodef;
  214|    115|    if ((encoder->base.parsed_propdef
  ------------------
  |  Branch (214:9): [True: 0, False: 115]
  ------------------
  215|    115|         = ossl_parse_property(libctx, algodef->property_definition)) == NULL) {
  216|      0|        OSSL_ENCODER_free(encoder);
  217|      0|        return NULL;
  218|      0|    }
  219|       |
  220|    994|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (220:12): [True: 879, False: 115]
  ------------------
  221|    879|        switch (fns->function_id) {
  ------------------
  |  Branch (221:17): [True: 0, False: 879]
  ------------------
  222|    115|        case OSSL_FUNC_ENCODER_NEWCTX:
  ------------------
  |  |  858|    115|# define OSSL_FUNC_ENCODER_NEWCTX                      1
  ------------------
  |  Branch (222:9): [True: 115, False: 764]
  ------------------
  223|    115|            if (encoder->newctx == NULL)
  ------------------
  |  Branch (223:17): [True: 115, False: 0]
  ------------------
  224|    115|                encoder->newctx =
  225|    115|                    OSSL_FUNC_encoder_newctx(fns);
  226|    115|            break;
  227|    115|        case OSSL_FUNC_ENCODER_FREECTX:
  ------------------
  |  |  859|    115|# define OSSL_FUNC_ENCODER_FREECTX                     2
  ------------------
  |  Branch (227:9): [True: 115, False: 764]
  ------------------
  228|    115|            if (encoder->freectx == NULL)
  ------------------
  |  Branch (228:17): [True: 115, False: 0]
  ------------------
  229|    115|                encoder->freectx =
  230|    115|                    OSSL_FUNC_encoder_freectx(fns);
  231|    115|            break;
  232|      0|        case OSSL_FUNC_ENCODER_GET_PARAMS:
  ------------------
  |  |  860|      0|# define OSSL_FUNC_ENCODER_GET_PARAMS                  3
  ------------------
  |  Branch (232:9): [True: 0, False: 879]
  ------------------
  233|      0|            if (encoder->get_params == NULL)
  ------------------
  |  Branch (233:17): [True: 0, False: 0]
  ------------------
  234|      0|                encoder->get_params =
  235|      0|                    OSSL_FUNC_encoder_get_params(fns);
  236|      0|            break;
  237|      0|        case OSSL_FUNC_ENCODER_GETTABLE_PARAMS:
  ------------------
  |  |  861|      0|# define OSSL_FUNC_ENCODER_GETTABLE_PARAMS             4
  ------------------
  |  Branch (237:9): [True: 0, False: 879]
  ------------------
  238|      0|            if (encoder->gettable_params == NULL)
  ------------------
  |  Branch (238:17): [True: 0, False: 0]
  ------------------
  239|      0|                encoder->gettable_params =
  240|      0|                    OSSL_FUNC_encoder_gettable_params(fns);
  241|      0|            break;
  242|    100|        case OSSL_FUNC_ENCODER_SET_CTX_PARAMS:
  ------------------
  |  |  862|    100|# define OSSL_FUNC_ENCODER_SET_CTX_PARAMS              5
  ------------------
  |  Branch (242:9): [True: 100, False: 779]
  ------------------
  243|    100|            if (encoder->set_ctx_params == NULL)
  ------------------
  |  Branch (243:17): [True: 100, False: 0]
  ------------------
  244|    100|                encoder->set_ctx_params =
  245|    100|                    OSSL_FUNC_encoder_set_ctx_params(fns);
  246|    100|            break;
  247|    100|        case OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  863|    100|# define OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS         6
  ------------------
  |  Branch (247:9): [True: 100, False: 779]
  ------------------
  248|    100|            if (encoder->settable_ctx_params == NULL)
  ------------------
  |  Branch (248:17): [True: 100, False: 0]
  ------------------
  249|    100|                encoder->settable_ctx_params =
  250|    100|                    OSSL_FUNC_encoder_settable_ctx_params(fns);
  251|    100|            break;
  252|    104|        case OSSL_FUNC_ENCODER_DOES_SELECTION:
  ------------------
  |  |  864|    104|# define OSSL_FUNC_ENCODER_DOES_SELECTION             10
  ------------------
  |  Branch (252:9): [True: 104, False: 775]
  ------------------
  253|    104|            if (encoder->does_selection == NULL)
  ------------------
  |  Branch (253:17): [True: 104, False: 0]
  ------------------
  254|    104|                encoder->does_selection =
  255|    104|                    OSSL_FUNC_encoder_does_selection(fns);
  256|    104|            break;
  257|    115|        case OSSL_FUNC_ENCODER_ENCODE:
  ------------------
  |  |  865|    115|# define OSSL_FUNC_ENCODER_ENCODE                     11
  ------------------
  |  Branch (257:9): [True: 115, False: 764]
  ------------------
  258|    115|            if (encoder->encode == NULL)
  ------------------
  |  Branch (258:17): [True: 115, False: 0]
  ------------------
  259|    115|                encoder->encode = OSSL_FUNC_encoder_encode(fns);
  260|    115|            break;
  261|    115|        case OSSL_FUNC_ENCODER_IMPORT_OBJECT:
  ------------------
  |  |  866|    115|# define OSSL_FUNC_ENCODER_IMPORT_OBJECT              20
  ------------------
  |  Branch (261:9): [True: 115, False: 764]
  ------------------
  262|    115|            if (encoder->import_object == NULL)
  ------------------
  |  Branch (262:17): [True: 115, False: 0]
  ------------------
  263|    115|                encoder->import_object =
  264|    115|                    OSSL_FUNC_encoder_import_object(fns);
  265|    115|            break;
  266|    115|        case OSSL_FUNC_ENCODER_FREE_OBJECT:
  ------------------
  |  |  867|    115|# define OSSL_FUNC_ENCODER_FREE_OBJECT                21
  ------------------
  |  Branch (266:9): [True: 115, False: 764]
  ------------------
  267|    115|            if (encoder->free_object == NULL)
  ------------------
  |  Branch (267:17): [True: 115, False: 0]
  ------------------
  268|    115|                encoder->free_object =
  269|    115|                    OSSL_FUNC_encoder_free_object(fns);
  270|    115|            break;
  271|    879|        }
  272|    879|    }
  273|       |    /*
  274|       |     * Try to check that the method is sensible.
  275|       |     * If you have a constructor, you must have a destructor and vice versa.
  276|       |     * You must have the encoding driver functions.
  277|       |     */
  278|    115|    if (!((encoder->newctx == NULL && encoder->freectx == NULL)
  ------------------
  |  Branch (278:12): [True: 0, False: 115]
  |  Branch (278:39): [True: 0, False: 0]
  ------------------
  279|    115|          || (encoder->newctx != NULL && encoder->freectx != NULL)
  ------------------
  |  Branch (279:15): [True: 115, False: 0]
  |  Branch (279:42): [True: 115, False: 0]
  ------------------
  280|    115|          || (encoder->import_object != NULL && encoder->free_object != NULL)
  ------------------
  |  Branch (280:15): [True: 0, False: 0]
  |  Branch (280:49): [True: 0, False: 0]
  ------------------
  281|    115|          || (encoder->import_object == NULL && encoder->free_object == NULL))
  ------------------
  |  Branch (281:15): [True: 0, False: 0]
  |  Branch (281:49): [True: 0, False: 0]
  ------------------
  282|    115|        || encoder->encode == NULL) {
  ------------------
  |  Branch (282:12): [True: 0, False: 115]
  ------------------
  283|      0|        OSSL_ENCODER_free(encoder);
  284|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_INVALID_PROVIDER_FUNCTIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  285|      0|        return NULL;
  286|      0|    }
  287|       |
  288|    115|    if (prov != NULL && !ossl_provider_up_ref(prov)) {
  ------------------
  |  Branch (288:9): [True: 115, False: 0]
  |  Branch (288:25): [True: 0, False: 115]
  ------------------
  289|      0|        OSSL_ENCODER_free(encoder);
  290|      0|        return NULL;
  291|      0|    }
  292|       |
  293|    115|    encoder->base.prov = prov;
  294|    115|    return encoder;
  295|    115|}
encoder_meth.c:ossl_encoder_new:
   29|    115|{
   30|    115|    OSSL_ENCODER *encoder = NULL;
   31|       |
   32|    115|    if ((encoder = OPENSSL_zalloc(sizeof(*encoder))) == NULL)
  ------------------
  |  |   99|    115|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    115|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    115|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (32:9): [True: 0, False: 115]
  ------------------
   33|      0|        return NULL;
   34|    115|    if (!CRYPTO_NEW_REF(&encoder->base.refcnt, 1)) {
  ------------------
  |  Branch (34:9): [True: 0, False: 115]
  ------------------
   35|      0|        OSSL_ENCODER_free(encoder);
   36|      0|        return NULL;
   37|      0|    }
   38|       |
   39|    115|    return encoder;
   40|    115|}
encoder_meth.c:destruct_encoder:
  335|    115|{
  336|    115|    OSSL_ENCODER_free(method);
  337|    115|}
encoder_meth.c:dealloc_tmp_encoder_store:
   95|  6.17k|{
   96|  6.17k|    if (store != NULL)
  ------------------
  |  Branch (96:9): [True: 0, False: 6.17k]
  ------------------
   97|      0|        ossl_method_store_free(store);
   98|  6.17k|}
encoder_meth.c:get_encoder_store:
  102|  37.1k|{
  103|  37.1k|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_ENCODER_STORE_INDEX);
  ------------------
  |  |  110|  37.1k|# define OSSL_LIB_CTX_ENCODER_STORE_INDEX           10
  ------------------
  104|  37.1k|}
encoder_meth.c:do_one:
  531|   710k|{
  532|   710k|    struct do_one_data_st *data = arg;
  533|       |
  534|   710k|    data->user_fn(method, data->user_arg);
  535|   710k|}

OSSL_ENCODER_CTX_new_for_pkey:
  345|  3.19k|{
  346|  3.19k|    OSSL_ENCODER_CTX *ctx = NULL;
  347|  3.19k|    OSSL_LIB_CTX *libctx = NULL;
  348|       |
  349|  3.19k|    if (pkey == NULL) {
  ------------------
  |  Branch (349:9): [True: 0, False: 3.19k]
  ------------------
  350|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  351|      0|        return NULL;
  352|      0|    }
  353|       |
  354|  3.19k|    if (!evp_pkey_is_assigned(pkey)) {
  ------------------
  |  |  634|  3.19k|    ((pk)->pkey.ptr != NULL || (pk)->keydata != NULL)
  |  |  ------------------
  |  |  |  Branch (634:6): [True: 103, False: 3.08k]
  |  |  |  Branch (634:32): [True: 3.08k, False: 0]
  |  |  ------------------
  ------------------
  355|      0|        ERR_raise_data(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_INVALID_ARGUMENT,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_INVALID_ARGUMENT,
  ------------------
  |  |  120|      0|# define ERR_LIB_OSSL_ENCODER    59
  ------------------
                      ERR_raise_data(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_INVALID_ARGUMENT,
  ------------------
  |  |  357|      0|# define ERR_R_PASSED_INVALID_ARGUMENT           (262|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  356|      0|                       "The passed EVP_PKEY must be assigned a key");
  357|      0|        return NULL;
  358|      0|    }
  359|       |
  360|  3.19k|    if ((ctx = OSSL_ENCODER_CTX_new()) == NULL) {
  ------------------
  |  Branch (360:9): [True: 0, False: 3.19k]
  ------------------
  361|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_OSSL_ENCODER_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  362|      0|        return NULL;
  363|      0|    }
  364|       |
  365|  3.19k|    if (evp_pkey_is_provided(pkey)) {
  ------------------
  |  |  642|  3.19k|    ((pk)->keymgmt != NULL)
  |  |  ------------------
  |  |  |  Branch (642:5): [True: 3.08k, False: 103]
  |  |  ------------------
  ------------------
  366|  3.08k|        const OSSL_PROVIDER *prov = EVP_KEYMGMT_get0_provider(pkey->keymgmt);
  367|       |
  368|  3.08k|        libctx = ossl_provider_libctx(prov);
  369|  3.08k|    }
  370|       |
  371|  3.19k|    OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  3.19k|    do {                                        \
  |  |  220|  3.19k|        BIO *trc_out = NULL;                    \
  |  |  221|  3.19k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  372|      0|        BIO_printf(trc_out,
  373|      0|                   "(ctx %p) Looking for %s encoders with selection %d\n",
  374|      0|                   (void *)ctx, EVP_PKEY_get0_type_name(pkey), selection);
  375|      0|        BIO_printf(trc_out, "    output type: %s, output structure: %s\n",
  376|      0|                   output_type, output_struct);
  377|  3.19k|    } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  3.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  378|       |
  379|  3.19k|    if (OSSL_ENCODER_CTX_set_output_type(ctx, output_type)
  ------------------
  |  Branch (379:9): [True: 3.19k, False: 0]
  ------------------
  380|  3.19k|        && (output_struct == NULL
  ------------------
  |  Branch (380:13): [True: 1.55k, False: 1.63k]
  ------------------
  381|  3.19k|            || OSSL_ENCODER_CTX_set_output_structure(ctx, output_struct))
  ------------------
  |  Branch (381:16): [True: 1.63k, False: 0]
  ------------------
  382|  3.19k|        && OSSL_ENCODER_CTX_set_selection(ctx, selection)
  ------------------
  |  Branch (382:12): [True: 3.19k, False: 0]
  ------------------
  383|  3.19k|        && ossl_encoder_ctx_setup_for_pkey(ctx, pkey, selection, propquery)
  ------------------
  |  Branch (383:12): [True: 3.19k, False: 0]
  ------------------
  384|  3.19k|        && OSSL_ENCODER_CTX_add_extra(ctx, libctx, propquery)) {
  ------------------
  |  Branch (384:12): [True: 3.19k, False: 0]
  ------------------
  385|  3.19k|        OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|  3.19k|    { NULL, 0, NULL, 0, 0 }
  ------------------
                      OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|  3.19k|    { NULL, 0, NULL, 0, 0 }
  ------------------
  386|  3.19k|        int save_parameters = pkey->save_parameters;
  387|       |
  388|  3.19k|        params[0] = OSSL_PARAM_construct_int(OSSL_ENCODER_PARAM_SAVE_PARAMETERS,
  ------------------
  |  |  226|  3.19k|# define OSSL_ENCODER_PARAM_SAVE_PARAMETERS "save-parameters"
  ------------------
  389|  3.19k|                                             &save_parameters);
  390|       |        /* ignoring error as this is only auxiliary parameter */
  391|  3.19k|        (void)OSSL_ENCODER_CTX_set_params(ctx, params);
  392|       |
  393|  3.19k|        OSSL_TRACE_BEGIN(ENCODER) {
  ------------------
  |  |  219|  3.19k|    do {                                        \
  |  |  220|  3.19k|        BIO *trc_out = NULL;                    \
  |  |  221|  3.19k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  394|      0|            BIO_printf(trc_out, "(ctx %p) Got %d encoders\n",
  395|      0|                       (void *)ctx, OSSL_ENCODER_CTX_get_num_encoders(ctx));
  396|  3.19k|        } OSSL_TRACE_END(ENCODER);
  ------------------
  |  |  224|  3.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  397|  3.19k|        return ctx;
  398|  3.19k|    }
  399|       |
  400|      0|    OSSL_ENCODER_CTX_free(ctx);
  401|      0|    return NULL;
  402|  3.19k|}
encoder_pkey.c:ossl_encoder_ctx_setup_for_pkey:
  229|  3.19k|{
  230|  3.19k|    struct construct_data_st *data = NULL;
  231|  3.19k|    const OSSL_PROVIDER *prov = NULL;
  232|  3.19k|    OSSL_LIB_CTX *libctx = NULL;
  233|  3.19k|    int ok = 0, i, end;
  234|  3.19k|    OSSL_NAMEMAP *namemap;
  235|       |
  236|  3.19k|    if (!ossl_assert(ctx != NULL) || !ossl_assert(pkey != NULL)) {
  ------------------
  |  |   52|  6.38k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  6.38k|                                         __FILE__, __LINE__)
  ------------------
                  if (!ossl_assert(ctx != NULL) || !ossl_assert(pkey != NULL)) {
  ------------------
  |  |   52|  3.19k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  3.19k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (236:9): [True: 0, False: 3.19k]
  |  Branch (236:38): [True: 0, False: 3.19k]
  ------------------
  237|      0|        ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  238|      0|        return 0;
  239|      0|    }
  240|       |
  241|  3.19k|    if (evp_pkey_is_provided(pkey)) {
  ------------------
  |  |  642|  3.19k|    ((pk)->keymgmt != NULL)
  |  |  ------------------
  |  |  |  Branch (642:5): [True: 3.08k, False: 103]
  |  |  ------------------
  ------------------
  242|  3.08k|        prov = EVP_KEYMGMT_get0_provider(pkey->keymgmt);
  243|  3.08k|        libctx = ossl_provider_libctx(prov);
  244|  3.08k|    }
  245|       |
  246|  3.19k|    if (pkey->keymgmt != NULL) {
  ------------------
  |  Branch (246:9): [True: 3.08k, False: 103]
  ------------------
  247|  3.08k|        struct collected_encoder_st encoder_data;
  248|  3.08k|        struct collected_names_st keymgmt_data;
  249|       |
  250|  3.08k|        if ((data = OPENSSL_zalloc(sizeof(*data))) == NULL)
  ------------------
  |  |   99|  3.08k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (250:13): [True: 0, False: 3.08k]
  ------------------
  251|      0|            goto err;
  252|       |
  253|       |        /*
  254|       |         * Select the first encoder implementations in two steps.
  255|       |         * First, collect the keymgmt names, then the encoders that match.
  256|       |         */
  257|  3.08k|        keymgmt_data.names = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  235|  3.08k|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  258|  3.08k|        if (keymgmt_data.names == NULL) {
  ------------------
  |  Branch (258:13): [True: 0, False: 3.08k]
  ------------------
  259|      0|            ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  260|      0|            goto err;
  261|      0|        }
  262|       |
  263|  3.08k|        keymgmt_data.error_occurred = 0;
  264|  3.08k|        EVP_KEYMGMT_names_do_all(pkey->keymgmt, collect_name, &keymgmt_data);
  265|  3.08k|        if (keymgmt_data.error_occurred) {
  ------------------
  |  Branch (265:13): [True: 0, False: 3.08k]
  ------------------
  266|      0|            sk_OPENSSL_CSTRING_free(keymgmt_data.names);
  ------------------
  |  |  238|      0|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
  267|      0|            goto err;
  268|      0|        }
  269|       |
  270|  3.08k|        encoder_data.names = keymgmt_data.names;
  271|  3.08k|        encoder_data.output_type = ctx->output_type;
  272|  3.08k|        encoder_data.output_structure = ctx->output_structure;
  273|  3.08k|        encoder_data.error_occurred = 0;
  274|  3.08k|        encoder_data.keymgmt_prov = prov;
  275|  3.08k|        encoder_data.ctx = ctx;
  276|  3.08k|        encoder_data.id_names = NULL;
  277|       |
  278|       |        /*
  279|       |         * collect_encoder() is called many times, and for every call it converts all encoder_data.names
  280|       |         * into namemap ids if it calls OSSL_ENCODER_is_a(). We cache the ids here instead,
  281|       |         * and can use them for encoders with the same provider as the keymgmt.
  282|       |         */
  283|  3.08k|        namemap = ossl_namemap_stored(libctx);
  284|  3.08k|        end = sk_OPENSSL_CSTRING_num(encoder_data.names);
  ------------------
  |  |  232|  3.08k|#define sk_OPENSSL_CSTRING_num(sk) OPENSSL_sk_num(ossl_check_const_OPENSSL_CSTRING_sk_type(sk))
  ------------------
  285|  3.08k|        if (end > 0) {
  ------------------
  |  Branch (285:13): [True: 3.08k, False: 0]
  ------------------
  286|  3.08k|            encoder_data.id_names = OPENSSL_malloc(end * sizeof(int));
  ------------------
  |  |   97|  3.08k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  287|  3.08k|            if (encoder_data.id_names == NULL) {
  ------------------
  |  Branch (287:17): [True: 0, False: 3.08k]
  ------------------
  288|      0|                sk_OPENSSL_CSTRING_free(keymgmt_data.names);
  ------------------
  |  |  238|      0|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
  289|      0|                goto err;
  290|      0|            }
  291|  25.0k|            for (i = 0; i < end; ++i) {
  ------------------
  |  Branch (291:25): [True: 21.9k, False: 3.08k]
  ------------------
  292|  21.9k|                const char *name = sk_OPENSSL_CSTRING_value(keymgmt_data.names, i);
  ------------------
  |  |  233|  21.9k|#define sk_OPENSSL_CSTRING_value(sk, idx) ((const char *)OPENSSL_sk_value(ossl_check_const_OPENSSL_CSTRING_sk_type(sk), (idx)))
  ------------------
  293|       |
  294|  21.9k|                encoder_data.id_names[i] = ossl_namemap_name2num(namemap, name);
  295|  21.9k|            }
  296|  3.08k|        }
  297|       |        /*
  298|       |         * Place the encoders with the a different provider as the keymgmt
  299|       |         * last (the chain is processed in reverse order)
  300|       |         */
  301|  3.08k|        encoder_data.flag_find_same_provider = 0;
  302|  3.08k|        OSSL_ENCODER_do_all_provided(libctx, collect_encoder, &encoder_data);
  303|       |
  304|       |        /*
  305|       |         * Place the encoders with the same provider as the keymgmt first
  306|       |         * (the chain is processed in reverse order)
  307|       |         */
  308|  3.08k|        encoder_data.flag_find_same_provider = 1;
  309|  3.08k|        OSSL_ENCODER_do_all_provided(libctx, collect_encoder, &encoder_data);
  310|       |
  311|  3.08k|        OPENSSL_free(encoder_data.id_names);
  ------------------
  |  |  107|  3.08k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  312|  3.08k|        sk_OPENSSL_CSTRING_free(keymgmt_data.names);
  ------------------
  |  |  238|  3.08k|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
  313|  3.08k|        if (encoder_data.error_occurred) {
  ------------------
  |  Branch (313:13): [True: 0, False: 3.08k]
  ------------------
  314|      0|            ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  315|      0|            goto err;
  316|      0|        }
  317|  3.08k|    }
  318|       |
  319|  3.19k|    if (data != NULL && OSSL_ENCODER_CTX_get_num_encoders(ctx) != 0) {
  ------------------
  |  Branch (319:9): [True: 3.08k, False: 103]
  |  Branch (319:25): [True: 3.08k, False: 0]
  ------------------
  320|  3.08k|        if (!OSSL_ENCODER_CTX_set_construct(ctx, encoder_construct_pkey)
  ------------------
  |  Branch (320:13): [True: 0, False: 3.08k]
  ------------------
  321|  3.08k|            || !OSSL_ENCODER_CTX_set_construct_data(ctx, data)
  ------------------
  |  Branch (321:16): [True: 0, False: 3.08k]
  ------------------
  322|  3.08k|            || !OSSL_ENCODER_CTX_set_cleanup(ctx, encoder_destruct_pkey))
  ------------------
  |  Branch (322:16): [True: 0, False: 3.08k]
  ------------------
  323|      0|            goto err;
  324|       |
  325|  3.08k|        data->pk = pkey;
  326|  3.08k|        data->selection = selection;
  327|       |
  328|  3.08k|        data = NULL;             /* Avoid it being freed */
  329|  3.08k|    }
  330|       |
  331|  3.19k|    ok = 1;
  332|  3.19k| err:
  333|  3.19k|    if (data != NULL) {
  ------------------
  |  Branch (333:9): [True: 0, False: 3.19k]
  ------------------
  334|      0|        OSSL_ENCODER_CTX_set_construct_data(ctx, NULL);
  335|      0|        OPENSSL_free(data);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  336|      0|    }
  337|  3.19k|    return ok;
  338|  3.19k|}
encoder_pkey.c:collect_name:
  137|  21.9k|{
  138|  21.9k|    struct collected_names_st *data = arg;
  139|       |
  140|  21.9k|    if (data->error_occurred)
  ------------------
  |  Branch (140:9): [True: 0, False: 21.9k]
  ------------------
  141|      0|        return;
  142|       |
  143|  21.9k|    data->error_occurred = 1;         /* Assume the worst */
  144|       |
  145|  21.9k|    if (sk_OPENSSL_CSTRING_push(data->names, name) <= 0)
  ------------------
  |  |  242|  21.9k|#define sk_OPENSSL_CSTRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr))
  ------------------
  |  Branch (145:9): [True: 0, False: 21.9k]
  ------------------
  146|      0|        return;
  147|       |
  148|  21.9k|    data->error_occurred = 0;         /* All is good now */
  149|  21.9k|}
encoder_pkey.c:collect_encoder:
   88|   710k|{
   89|   710k|    struct collected_encoder_st *data = arg;
   90|   710k|    const OSSL_PROVIDER *prov;
   91|       |
   92|   710k|    if (data->error_occurred)
  ------------------
  |  Branch (92:9): [True: 0, False: 710k]
  ------------------
   93|      0|        return;
   94|       |
   95|   710k|    data->error_occurred = 1;     /* Assume the worst */
   96|       |
   97|   710k|    prov = OSSL_ENCODER_get0_provider(encoder);
   98|       |    /*
   99|       |     * collect_encoder() is called in two passes, one where the encoders
  100|       |     * from the same provider as the keymgmt are looked up, and one where
  101|       |     * the other encoders are looked up.  |data->flag_find_same_provider|
  102|       |     * tells us which pass we're in.
  103|       |     */
  104|   710k|    if ((data->keymgmt_prov == prov) == data->flag_find_same_provider) {
  ------------------
  |  Branch (104:9): [True: 355k, False: 355k]
  ------------------
  105|   355k|        void *provctx = OSSL_PROVIDER_get0_provider_ctx(prov);
  106|   355k|        int i, end_i = sk_OPENSSL_CSTRING_num(data->names);
  ------------------
  |  |  232|   355k|#define sk_OPENSSL_CSTRING_num(sk) OPENSSL_sk_num(ossl_check_const_OPENSSL_CSTRING_sk_type(sk))
  ------------------
  107|   355k|        int match;
  108|       |
  109|  2.63M|        for (i = 0; i < end_i; i++) {
  ------------------
  |  Branch (109:21): [True: 2.30M, False: 320k]
  ------------------
  110|  2.30M|            if (data->flag_find_same_provider)
  ------------------
  |  Branch (110:17): [True: 2.30M, False: 0]
  ------------------
  111|  2.30M|                match = (data->id_names[i] == encoder->base.id);
  112|      0|            else
  113|      0|                match = OSSL_ENCODER_is_a(encoder,
  114|      0|                                          sk_OPENSSL_CSTRING_value(data->names, i));
  ------------------
  |  |  233|      0|#define sk_OPENSSL_CSTRING_value(sk, idx) ((const char *)OPENSSL_sk_value(ossl_check_const_OPENSSL_CSTRING_sk_type(sk), (idx)))
  ------------------
  115|  2.30M|            if (!match
  ------------------
  |  Branch (115:17): [True: 2.22M, False: 84.1k]
  ------------------
  116|  2.30M|                || (encoder->does_selection != NULL
  ------------------
  |  Branch (116:21): [True: 81.0k, False: 3.08k]
  ------------------
  117|  84.1k|                    && !encoder->does_selection(provctx, data->ctx->selection))
  ------------------
  |  Branch (117:24): [True: 49.4k, False: 31.6k]
  ------------------
  118|  2.30M|                || (data->keymgmt_prov != prov
  ------------------
  |  Branch (118:21): [True: 0, False: 34.7k]
  ------------------
  119|  34.7k|                    && encoder->import_object == NULL))
  ------------------
  |  Branch (119:24): [True: 0, False: 0]
  ------------------
  120|  2.27M|                continue;
  121|       |
  122|       |            /* Only add each encoder implementation once */
  123|  34.7k|            if (OSSL_ENCODER_CTX_add_encoder(data->ctx, encoder))
  ------------------
  |  Branch (123:17): [True: 34.7k, False: 0]
  ------------------
  124|  34.7k|                break;
  125|  34.7k|        }
  126|   355k|    }
  127|       |
  128|   710k|    data->error_occurred = 0;         /* All is good now */
  129|   710k|}
encoder_pkey.c:encoder_construct_pkey:
  181|  3.05k|{
  182|  3.05k|    struct construct_data_st *data = arg;
  183|       |
  184|  3.05k|    if (data->obj == NULL) {
  ------------------
  |  Branch (184:9): [True: 3.05k, False: 0]
  ------------------
  185|  3.05k|        OSSL_ENCODER *encoder =
  186|  3.05k|            OSSL_ENCODER_INSTANCE_get_encoder(encoder_inst);
  187|  3.05k|        const EVP_PKEY *pk = data->pk;
  188|  3.05k|        const OSSL_PROVIDER *k_prov = EVP_KEYMGMT_get0_provider(pk->keymgmt);
  189|  3.05k|        const OSSL_PROVIDER *e_prov = OSSL_ENCODER_get0_provider(encoder);
  190|       |
  191|  3.05k|        if (k_prov != e_prov) {
  ------------------
  |  Branch (191:13): [True: 0, False: 3.05k]
  ------------------
  192|      0|            data->encoder_inst = encoder_inst;
  193|       |
  194|      0|            if (!evp_keymgmt_export(pk->keymgmt, pk->keydata, data->selection,
  ------------------
  |  Branch (194:17): [True: 0, False: 0]
  ------------------
  195|      0|                                    &encoder_import_cb, data))
  196|      0|                return NULL;
  197|      0|            data->obj = data->constructed_obj;
  198|  3.05k|        } else {
  199|  3.05k|            data->obj = pk->keydata;
  200|  3.05k|        }
  201|  3.05k|    }
  202|       |
  203|  3.05k|    return data->obj;
  204|  3.05k|}
encoder_pkey.c:encoder_destruct_pkey:
  207|  3.05k|{
  208|  3.05k|    struct construct_data_st *data = arg;
  209|       |
  210|  3.05k|    if (data->encoder_inst != NULL) {
  ------------------
  |  Branch (210:9): [True: 0, False: 3.05k]
  ------------------
  211|      0|        OSSL_ENCODER *encoder =
  212|      0|            OSSL_ENCODER_INSTANCE_get_encoder(data->encoder_inst);
  213|       |
  214|      0|        encoder->free_object(data->constructed_obj);
  215|      0|    }
  216|  3.05k|    data->constructed_obj = NULL;
  217|  3.05k|}

ossl_err_load_ENGINE_strings:
   85|      2|{
   86|      2|# ifndef OPENSSL_NO_ERR
   87|      2|    if (ERR_reason_error_string(ENGINE_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (87:9): [True: 2, False: 0]
  ------------------
   88|      2|        ERR_load_strings_const(ENGINE_str_reasons);
   89|      2|# endif
   90|      2|    return 1;
   91|      2|}

ENGINE_finish:
  107|   530k|{
  108|   530k|    int to_return = 1;
  109|       |
  110|   530k|    if (e == NULL)
  ------------------
  |  Branch (110:9): [True: 530k, False: 0]
  ------------------
  111|   530k|        return 1;
  112|      0|    if (!CRYPTO_THREAD_write_lock(global_engine_lock))
  ------------------
  |  Branch (112:9): [True: 0, False: 0]
  ------------------
  113|      0|        return 0;
  114|      0|    to_return = engine_unlocked_finish(e, 1);
  115|      0|    CRYPTO_THREAD_unlock(global_engine_lock);
  116|      0|    if (!to_return) {
  ------------------
  |  Branch (116:9): [True: 0, False: 0]
  ------------------
  117|      0|        ERR_raise(ERR_LIB_ENGINE, ENGINE_R_FINISH_FAILED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  118|      0|        return 0;
  119|      0|    }
  120|      0|    return to_return;
  121|      0|}

engine_cleanup_int:
  176|      2|{
  177|      2|    if (int_cleanup_check(0)) {
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
  179|      0|                                        engine_cleanup_cb_free);
  180|      0|        cleanup_stack = NULL;
  181|      0|    }
  182|      2|    CRYPTO_THREAD_lock_free(global_engine_lock);
  183|      2|    global_engine_lock = NULL;
  184|      2|}
eng_lib.c:do_engine_lock_init:
   22|      1|{
   23|      1|    global_engine_lock = CRYPTO_THREAD_lock_new();
   24|      1|    return global_engine_lock != NULL;
   25|      1|}
eng_lib.c:int_cleanup_check:
  119|      2|{
  120|      2|    if (cleanup_stack)
  ------------------
  |  Branch (120:9): [True: 0, False: 2]
  ------------------
  121|      0|        return 1;
  122|      2|    if (!create)
  ------------------
  |  Branch (122:9): [True: 2, False: 0]
  ------------------
  123|      2|        return 0;
  124|      0|    cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null();
  125|      0|    return (cleanup_stack ? 1 : 0);
  ------------------
  |  Branch (125:13): [True: 0, False: 0]
  ------------------
  126|      2|}

ossl_engine_table_select:
  202|   273k|{
  203|   273k|    ENGINE *ret = NULL;
  204|   273k|    ENGINE_PILE tmplate, *fnd = NULL;
  205|   273k|    int initres, loop = 0;
  206|       |
  207|   273k|#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
  208|       |    /* Load the config before trying to check if engines are available */
  209|   273k|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  455|   273k|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  210|   273k|#endif
  211|       |
  212|   273k|    if (!(*table)) {
  ------------------
  |  Branch (212:9): [True: 273k, False: 0]
  ------------------
  213|   273k|        OSSL_TRACE3(ENGINE_TABLE,
  ------------------
  |  |  294|   273k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  ------------------
  |  |  |  |  282|   273k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  214|   273k|                   "%s:%d, nid=%d, nothing registered!\n",
  215|   273k|                   f, l, nid);
  216|   273k|        return NULL;
  217|   273k|    }
  218|      0|    ERR_set_mark();
  219|      0|    if (!CRYPTO_THREAD_write_lock(global_engine_lock))
  ------------------
  |  Branch (219:9): [True: 0, False: 0]
  ------------------
  220|      0|        goto end;
  221|       |    /*
  222|       |     * Check again inside the lock otherwise we could race against cleanup
  223|       |     * operations. But don't worry about a debug printout
  224|       |     */
  225|      0|    if (!int_table_check(table, 0))
  ------------------
  |  Branch (225:9): [True: 0, False: 0]
  ------------------
  226|      0|        goto end;
  227|      0|    tmplate.nid = nid;
  228|      0|    fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);
  229|      0|    if (!fnd)
  ------------------
  |  Branch (229:9): [True: 0, False: 0]
  ------------------
  230|      0|        goto end;
  231|      0|    if (fnd->funct && engine_unlocked_init(fnd->funct)) {
  ------------------
  |  Branch (231:9): [True: 0, False: 0]
  |  Branch (231:23): [True: 0, False: 0]
  ------------------
  232|      0|        OSSL_TRACE4(ENGINE_TABLE,
  ------------------
  |  |  296|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  233|      0|                   "%s:%d, nid=%d, using ENGINE '%s' cached\n",
  234|      0|                   f, l, nid, fnd->funct->id);
  235|      0|        ret = fnd->funct;
  236|      0|        goto end;
  237|      0|    }
  238|      0|    if (fnd->uptodate) {
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  ------------------
  239|      0|        ret = fnd->funct;
  240|      0|        goto end;
  241|      0|    }
  242|      0| trynext:
  243|      0|    ret = sk_ENGINE_value(fnd->sk, loop++);
  244|      0|    if (!ret) {
  ------------------
  |  Branch (244:9): [True: 0, False: 0]
  ------------------
  245|      0|        OSSL_TRACE3(ENGINE_TABLE,
  ------------------
  |  |  294|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  246|      0|                    "%s:%d, nid=%d, "
  247|      0|                    "no registered implementations would initialise\n",
  248|      0|                    f, l, nid);
  249|      0|        goto end;
  250|      0|    }
  251|       |    /* Try to initialise the ENGINE? */
  252|      0|    if ((ret->funct_ref > 0) || !(table_flags & ENGINE_TABLE_FLAG_NOINIT))
  ------------------
  |  |   64|      0|#  define ENGINE_TABLE_FLAG_NOINIT        (unsigned int)0x0001
  ------------------
  |  Branch (252:9): [True: 0, False: 0]
  |  Branch (252:33): [True: 0, False: 0]
  ------------------
  253|      0|        initres = engine_unlocked_init(ret);
  254|      0|    else
  255|      0|        initres = 0;
  256|      0|    if (initres) {
  ------------------
  |  Branch (256:9): [True: 0, False: 0]
  ------------------
  257|       |        /* Update 'funct' */
  258|      0|        if ((fnd->funct != ret) && engine_unlocked_init(ret)) {
  ------------------
  |  Branch (258:13): [True: 0, False: 0]
  |  Branch (258:36): [True: 0, False: 0]
  ------------------
  259|       |            /* If there was a previous default we release it. */
  260|      0|            if (fnd->funct)
  ------------------
  |  Branch (260:17): [True: 0, False: 0]
  ------------------
  261|      0|                engine_unlocked_finish(fnd->funct, 0);
  262|      0|            fnd->funct = ret;
  263|      0|            OSSL_TRACE4(ENGINE_TABLE,
  ------------------
  |  |  296|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  264|      0|                        "%s:%d, nid=%d, setting default to '%s'\n",
  265|      0|                        f, l, nid, ret->id);
  266|      0|        }
  267|      0|        OSSL_TRACE4(ENGINE_TABLE,
  ------------------
  |  |  296|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  268|      0|                    "%s:%d, nid=%d, using newly initialised '%s'\n",
  269|      0|                    f, l, nid, ret->id);
  270|      0|        goto end;
  271|      0|    }
  272|      0|    goto trynext;
  273|      0| end:
  274|       |    /*
  275|       |     * If it failed, it is unlikely to succeed again until some future
  276|       |     * registrations have taken place. In all cases, we cache.
  277|       |     */
  278|      0|    if (fnd)
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|        fnd->uptodate = 1;
  280|      0|    if (ret)
  ------------------
  |  Branch (280:9): [True: 0, False: 0]
  ------------------
  281|      0|        OSSL_TRACE4(ENGINE_TABLE,
  ------------------
  |  |  296|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  282|      0|                   "%s:%d, nid=%d, caching ENGINE '%s'\n",
  283|      0|                   f, l, nid, ret->id);
  284|      0|    else
  285|      0|        OSSL_TRACE3(ENGINE_TABLE,
  ------------------
  |  |  294|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  286|      0|                    "%s:%d, nid=%d, caching 'no matching ENGINE'\n",
  287|      0|                    f, l, nid);
  288|      0|    CRYPTO_THREAD_unlock(global_engine_lock);
  289|       |    /*
  290|       |     * Whatever happened, any failed init()s are not failures in this
  291|       |     * context, so clear our error state.
  292|       |     */
  293|      0|    ERR_pop_to_mark();
  294|      0|    return ret;
  295|      0|}
engine_table_doall:
  308|  70.0k|{
  309|  70.0k|    ENGINE_PILE_DOALL dall;
  310|  70.0k|    dall.cb = cb;
  311|  70.0k|    dall.arg = arg;
  312|  70.0k|    if (table)
  ------------------
  |  Branch (312:9): [True: 0, False: 70.0k]
  ------------------
  313|      0|        lh_ENGINE_PILE_doall_ENGINE_PILE_DOALL(&table->piles, int_dall, &dall);
  314|  70.0k|}

ENGINE_get_pkey_asn1_meth_engine:
   78|  63.5k|{
   79|  63.5k|    return ossl_engine_table_select(&pkey_asn1_meth_table, nid,
   80|  63.5k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  63.5k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  63.5k|#   define OPENSSL_LINE __LINE__
  ------------------
   81|  63.5k|}
ENGINE_pkey_asn1_find_str:
  191|  70.0k|{
  192|  70.0k|    ENGINE_FIND_STR fstr;
  193|  70.0k|    fstr.e = NULL;
  194|  70.0k|    fstr.ameth = NULL;
  195|  70.0k|    fstr.str = str;
  196|  70.0k|    fstr.len = len;
  197|       |
  198|  70.0k|    if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
  ------------------
  |  |  130|  70.0k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 70.0k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (198:9): [True: 0, False: 70.0k]
  ------------------
  199|       |        /* Maybe this should be raised in do_engine_lock_init() */
  200|      0|        ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  201|      0|        return NULL;
  202|      0|    }
  203|       |
  204|  70.0k|    if (!CRYPTO_THREAD_read_lock(global_engine_lock))
  ------------------
  |  Branch (204:9): [True: 0, False: 70.0k]
  ------------------
  205|      0|        return NULL;
  206|  70.0k|    engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
  207|       |    /* If found obtain a structural reference to engine */
  208|  70.0k|    if (fstr.e != NULL) {
  ------------------
  |  Branch (208:9): [True: 0, False: 70.0k]
  ------------------
  209|      0|        int ref;
  210|       |
  211|      0|        if (!CRYPTO_UP_REF(&fstr.e->struct_ref, &ref)) {
  ------------------
  |  Branch (211:13): [True: 0, False: 0]
  ------------------
  212|      0|            CRYPTO_THREAD_unlock(global_engine_lock);
  213|      0|            ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  214|      0|            return NULL;
  215|      0|        }
  216|      0|        ENGINE_REF_PRINT(fstr.e, 0, 1);
  ------------------
  |  |   29|      0|    OSSL_TRACE6(ENGINE_REF_COUNT,                                       \
  |  |  ------------------
  |  |  |  |  300|      0|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3, arg4, arg5, arg6))
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   30|      0|               "engine: %p %s from %d to %d (%s:%d)\n",                 \
  |  |   31|      0|               (void *)(e), (isfunct ? "funct" : "struct"),             \
  |  |   32|      0|               ((isfunct)                                               \
  |  |   33|      0|                ? ((e)->funct_ref - (diff))                             \
  |  |   34|      0|                : (eng_struct_ref(e) - (diff))),                        \
  |  |   35|      0|               ((isfunct) ? (e)->funct_ref : eng_struct_ref(e)),        \
  |  |   36|      0|               (OPENSSL_FILE), (OPENSSL_LINE))
  ------------------
  217|      0|    }
  218|  70.0k|    *pe = fstr.e;
  219|  70.0k|    CRYPTO_THREAD_unlock(global_engine_lock);
  220|  70.0k|    return fstr.ameth;
  221|  70.0k|}

ENGINE_get_default_DH:
   60|  33.1k|{
   61|  33.1k|    return ossl_engine_table_select(&dh_table, dummy_nid,
   62|  33.1k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  33.1k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  33.1k|#   define OPENSSL_LINE __LINE__
  ------------------
   63|  33.1k|}

ENGINE_get_digest_engine:
   67|  14.6k|{
   68|  14.6k|    return ossl_engine_table_select(&digest_table, nid,
   69|  14.6k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  14.6k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  14.6k|#   define OPENSSL_LINE __LINE__
  ------------------
   70|  14.6k|}

ENGINE_get_default_DSA:
   60|  45.7k|{
   61|  45.7k|    return ossl_engine_table_select(&dsa_table, dummy_nid,
   62|  45.7k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  45.7k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  45.7k|#   define OPENSSL_LINE __LINE__
  ------------------
   63|  45.7k|}

ENGINE_get_default_EC:
   60|  31.1k|{
   61|  31.1k|    return ossl_engine_table_select(&dh_table, dummy_nid,
   62|  31.1k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  31.1k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  31.1k|#   define OPENSSL_LINE __LINE__
  ------------------
   63|  31.1k|}

ENGINE_get_pkey_meth_engine:
   68|  33.7k|{
   69|  33.7k|    return ossl_engine_table_select(&pkey_meth_table, nid,
   70|  33.7k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  33.7k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  33.7k|#   define OPENSSL_LINE __LINE__
  ------------------
   71|  33.7k|}

ENGINE_get_default_RAND:
   60|      1|{
   61|      1|    return ossl_engine_table_select(&rand_table, dummy_nid,
   62|      1|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  ------------------
   63|      1|}

ENGINE_get_default_RSA:
   60|  51.2k|{
   61|  51.2k|    return ossl_engine_table_select(&rsa_table, dummy_nid,
   62|  51.2k|                                    OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|  51.2k|#   define OPENSSL_FILE __FILE__
  ------------------
                                                  OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|  51.2k|#   define OPENSSL_LINE __LINE__
  ------------------
   63|  51.2k|}

OSSL_ERR_STATE_free:
  202|      2|{
  203|      2|    int i;
  204|       |
  205|      2|    if (state == NULL)
  ------------------
  |  Branch (205:9): [True: 0, False: 2]
  ------------------
  206|      0|        return;
  207|     34|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|     34|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (207:17): [True: 32, False: 2]
  ------------------
  208|     32|        err_clear(state, i, 1);
  209|     32|    }
  210|      2|    CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  ------------------
                  CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  ------------------
  211|      2|}
err_cleanup:
  233|      2|{
  234|      2|    if (set_err_thread_local != 0)
  ------------------
  |  Branch (234:9): [True: 2, False: 0]
  ------------------
  235|      2|        CRYPTO_THREAD_cleanup_local(&err_thread_local);
  236|      2|    CRYPTO_THREAD_lock_free(err_string_lock);
  237|      2|    err_string_lock = NULL;
  238|      2|#ifndef OPENSSL_NO_ERR
  239|      2|    lh_ERR_STRING_DATA_free(int_error_hash);
  ------------------
  |  |  376|      2|#define lh_ERR_STRING_DATA_free(lh) OPENSSL_LH_free(ossl_check_ERR_STRING_DATA_lh_type(lh))
  ------------------
  240|      2|    int_error_hash = NULL;
  241|      2|#endif
  242|      2|}
ossl_err_load_ERR_strings:
  272|     72|{
  273|     72|#ifndef OPENSSL_NO_ERR
  274|     72|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  130|     72|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 72, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (274:9): [True: 0, False: 72]
  ------------------
  275|      0|        return 0;
  276|       |
  277|     72|    err_load_strings(ERR_str_libraries);
  278|     72|    err_load_strings(ERR_str_reasons);
  279|     72|#endif
  280|     72|    return 1;
  281|     72|}
ERR_load_strings_const:
  297|     70|{
  298|     70|#ifndef OPENSSL_NO_ERR
  299|     70|    if (ossl_err_load_ERR_strings() == 0)
  ------------------
  |  Branch (299:9): [True: 0, False: 70]
  ------------------
  300|      0|        return 0;
  301|     70|    err_load_strings(str);
  302|     70|#endif
  303|       |
  304|     70|    return 1;
  305|     70|}
ERR_clear_error:
  335|  11.7k|{
  336|  11.7k|    int i;
  337|  11.7k|    ERR_STATE *es;
  338|       |
  339|  11.7k|    es = ossl_err_get_state_int();
  340|  11.7k|    if (es == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 11.7k]
  ------------------
  341|      0|        return;
  342|       |
  343|   199k|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|   199k|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (343:17): [True: 187k, False: 11.7k]
  ------------------
  344|   187k|        err_clear(es, i, 0);
  345|   187k|    }
  346|  11.7k|    es->top = es->bottom = 0;
  347|  11.7k|}
ERR_peek_error:
  375|  3.84k|{
  376|  3.84k|    return get_error_values(EV_PEEK, NULL, NULL, NULL, NULL, NULL);
  377|  3.84k|}
ERR_peek_last_error:
  410|  4.14M|{
  411|  4.14M|    return get_error_values(EV_PEEK_LAST, NULL, NULL, NULL, NULL, NULL);
  412|  4.14M|}
ERR_reason_error_string:
  613|     70|{
  614|     70|#ifndef OPENSSL_NO_ERR
  615|     70|    ERR_STRING_DATA d, *p = NULL;
  616|     70|    unsigned long l, r;
  617|       |
  618|     70|    if (!RUN_ONCE(&err_string_init, do_err_strings_init)) {
  ------------------
  |  |  130|     70|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 70, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (618:9): [True: 0, False: 70]
  ------------------
  619|      0|        return NULL;
  620|      0|    }
  621|       |
  622|       |    /*
  623|       |     * ERR_reason_error_string() can't safely return system error strings,
  624|       |     * since openssl_strerror_r() needs a buffer for thread safety, and we
  625|       |     * haven't got one that would serve any sensible purpose.
  626|       |     */
  627|     70|    if (ERR_SYSTEM_ERROR(e))
  ------------------
  |  |  239|     70|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|     70|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 70]
  |  |  ------------------
  ------------------
  628|      0|        return NULL;
  629|       |
  630|     70|    l = ERR_GET_LIB(e);
  631|     70|    r = ERR_GET_REASON(e);
  632|     70|    d.error = ERR_PACK(l, 0, r);
  ------------------
  |  |  279|     70|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     70|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     70|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     70|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     70|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  633|     70|    p = int_err_get_item(&d);
  634|     70|    if (p == NULL) {
  ------------------
  |  Branch (634:9): [True: 70, False: 0]
  ------------------
  635|     70|        d.error = ERR_PACK(0, 0, r);
  ------------------
  |  |  279|     70|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     70|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     70|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     70|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     70|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  636|     70|        p = int_err_get_item(&d);
  637|     70|    }
  638|     70|    return ((p == NULL) ? NULL : p->string);
  ------------------
  |  Branch (638:13): [True: 70, False: 0]
  ------------------
  639|       |#else
  640|       |    return NULL;
  641|       |#endif
  642|     70|}
ossl_err_get_state_int:
  673|  42.7M|{
  674|  42.7M|    ERR_STATE *state;
  675|  42.7M|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|  42.7M|# define get_last_sys_error()    errno
  ------------------
  676|       |
  677|  42.7M|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|  42.7M|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (677:9): [True: 9, False: 42.7M]
  ------------------
  678|      9|        return NULL;
  679|       |
  680|  42.7M|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|  42.7M|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 42.7M, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (680:9): [True: 0, False: 42.7M]
  ------------------
  681|      0|        return NULL;
  682|       |
  683|  42.7M|    state = CRYPTO_THREAD_get_local(&err_thread_local);
  684|  42.7M|    if (state == (ERR_STATE*)-1)
  ------------------
  |  Branch (684:9): [True: 0, False: 42.7M]
  ------------------
  685|      0|        return NULL;
  686|       |
  687|  42.7M|    if (state == NULL) {
  ------------------
  |  Branch (687:9): [True: 2, False: 42.7M]
  ------------------
  688|      2|        if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (688:13): [True: 0, False: 2]
  ------------------
  689|      0|            return NULL;
  690|       |
  691|      2|        state = OSSL_ERR_STATE_new();
  692|      2|        if (state == NULL) {
  ------------------
  |  Branch (692:13): [True: 0, False: 2]
  ------------------
  693|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  694|      0|            return NULL;
  695|      0|        }
  696|       |
  697|      2|        if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state)
  ------------------
  |  Branch (697:13): [True: 0, False: 2]
  ------------------
  698|      2|                || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  ------------------
  |  Branch (698:20): [True: 0, False: 2]
  ------------------
  699|      0|            OSSL_ERR_STATE_free(state);
  700|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  701|      0|            return NULL;
  702|      0|        }
  703|       |
  704|       |        /* Ignore failures from these */
  705|      2|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  450|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  706|      2|    }
  707|       |
  708|  42.7M|    set_sys_error(saveerrno);
  ------------------
  |  |   32|  42.7M|# define set_sys_error(e)        errno=(e)
  ------------------
  709|  42.7M|    return state;
  710|  42.7M|}
err_shelve_state:
  725|      2|{
  726|      2|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|      2|# define get_last_sys_error()    errno
  ------------------
  727|       |
  728|       |    /*
  729|       |     * Note, at present our only caller is OPENSSL_init_crypto(), indirectly
  730|       |     * via ossl_init_load_crypto_nodelete(), by which point the requested
  731|       |     * "base" initialization has already been performed, so the below call is a
  732|       |     * NOOP, that re-enters OPENSSL_init_crypto() only to quickly return.
  733|       |     *
  734|       |     * If are no other valid callers of this function, the call below can be
  735|       |     * removed, avoiding the re-entry into OPENSSL_init_crypto().  If there are
  736|       |     * potential uses that are not from inside OPENSSL_init_crypto(), then this
  737|       |     * call is needed, but some care is required to make sure that the re-entry
  738|       |     * remains a NOOP.
  739|       |     */
  740|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (740:9): [True: 0, False: 2]
  ------------------
  741|      0|        return 0;
  742|       |
  743|      2|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (743:9): [True: 0, False: 2]
  ------------------
  744|      0|        return 0;
  745|       |
  746|      2|    *state = CRYPTO_THREAD_get_local(&err_thread_local);
  747|      2|    if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (747:9): [True: 0, False: 2]
  ------------------
  748|      0|        return 0;
  749|       |
  750|      2|    set_sys_error(saveerrno);
  ------------------
  |  |   32|      2|# define set_sys_error(e)        errno=(e)
  ------------------
  751|      2|    return 1;
  752|      2|}
err_unshelve_state:
  759|      2|{
  760|      2|    if (state != (void*)-1)
  ------------------
  |  Branch (760:9): [True: 2, False: 0]
  ------------------
  761|      2|        CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)state);
  762|      2|}
ERR_get_next_error_library:
  765|      3|{
  766|      3|    int ret;
  767|       |
  768|      3|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  130|      3|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 3, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (768:9): [True: 0, False: 3]
  ------------------
  769|      0|        return 0;
  770|       |
  771|      3|    if (!CRYPTO_THREAD_write_lock(err_string_lock))
  ------------------
  |  Branch (771:9): [True: 0, False: 3]
  ------------------
  772|      0|        return 0;
  773|      3|    ret = int_err_library_number++;
  774|      3|    CRYPTO_THREAD_unlock(err_string_lock);
  775|      3|    return ret;
  776|      3|}
ERR_add_error_data:
  813|  2.00M|{
  814|  2.00M|    va_list args;
  815|  2.00M|    va_start(args, num);
  816|  2.00M|    ERR_add_error_vdata(num, args);
  817|  2.00M|    va_end(args);
  818|  2.00M|}
ERR_add_error_vdata:
  821|  2.00M|{
  822|  2.00M|    int i, len, size;
  823|  2.00M|    int flags = ERR_TXT_MALLOCED | ERR_TXT_STRING;
  ------------------
  |  |   48|  2.00M|# define ERR_TXT_MALLOCED        0x01
  ------------------
                  int flags = ERR_TXT_MALLOCED | ERR_TXT_STRING;
  ------------------
  |  |   49|  2.00M|# define ERR_TXT_STRING          0x02
  ------------------
  824|  2.00M|    char *str, *arg;
  825|  2.00M|    ERR_STATE *es;
  826|       |
  827|       |    /* Get the current error data; if an allocated string get it. */
  828|  2.00M|    es = ossl_err_get_state_int();
  829|  2.00M|    if (es == NULL)
  ------------------
  |  Branch (829:9): [True: 0, False: 2.00M]
  ------------------
  830|      0|        return;
  831|  2.00M|    i = es->top;
  832|       |
  833|       |    /*
  834|       |     * If err_data is allocated already, reuse the space.
  835|       |     * Otherwise, allocate a small new buffer.
  836|       |     */
  837|  2.00M|    if ((es->err_data_flags[i] & flags) == flags) {
  ------------------
  |  Branch (837:9): [True: 0, False: 2.00M]
  ------------------
  838|      0|        str = es->err_data[i];
  839|      0|        size = es->err_data_size[i];
  840|       |
  841|       |        /*
  842|       |         * To protect the string we just grabbed from tampering by other
  843|       |         * functions we may call, or to protect them from freeing a pointer
  844|       |         * that may no longer be valid at that point, we clear away the
  845|       |         * data pointer and the flags.  We will set them again at the end
  846|       |         * of this function.
  847|       |         */
  848|      0|        es->err_data[i] = NULL;
  849|      0|        es->err_data_flags[i] = 0;
  850|  2.00M|    } else if ((str = OPENSSL_malloc(size = 81)) == NULL) {
  ------------------
  |  |   97|  2.00M|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.00M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.00M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (850:16): [True: 0, False: 2.00M]
  ------------------
  851|      0|        return;
  852|  2.00M|    } else {
  853|  2.00M|        str[0] = '\0';
  854|  2.00M|    }
  855|  2.00M|    len = strlen(str);
  856|       |
  857|  8.54M|    while (--num >= 0) {
  ------------------
  |  Branch (857:12): [True: 6.53M, False: 2.00M]
  ------------------
  858|  6.53M|        arg = va_arg(args, char *);
  859|  6.53M|        if (arg == NULL)
  ------------------
  |  Branch (859:13): [True: 0, False: 6.53M]
  ------------------
  860|      0|            arg = "<NULL>";
  861|  6.53M|        len += strlen(arg);
  862|  6.53M|        if (len >= size) {
  ------------------
  |  Branch (862:13): [True: 0, False: 6.53M]
  ------------------
  863|      0|            char *p;
  864|       |
  865|      0|            size = len + 20;
  866|      0|            p = OPENSSL_realloc(str, size);
  ------------------
  |  |  101|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  867|      0|            if (p == NULL) {
  ------------------
  |  Branch (867:17): [True: 0, False: 0]
  ------------------
  868|      0|                OPENSSL_free(str);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  869|      0|                return;
  870|      0|            }
  871|      0|            str = p;
  872|      0|        }
  873|  6.53M|        OPENSSL_strlcat(str, arg, (size_t)size);
  874|  6.53M|    }
  875|  2.00M|    if (!err_set_error_data_int(str, size, flags, 0))
  ------------------
  |  Branch (875:9): [True: 0, False: 2.00M]
  ------------------
  876|      0|        OPENSSL_free(str);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  877|  2.00M|}
err.c:do_err_strings_init:
  214|      2|{
  215|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (215:9): [True: 0, False: 2]
  ------------------
  216|      0|        return 0;
  217|      2|    err_string_lock = CRYPTO_THREAD_lock_new();
  218|      2|    if (err_string_lock == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 2]
  ------------------
  219|      0|        return 0;
  220|      2|#ifndef OPENSSL_NO_ERR
  221|      2|    int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
  ------------------
  |  |  375|      2|#define lh_ERR_STRING_DATA_new(hfn, cmp) ((LHASH_OF(ERR_STRING_DATA) *)OPENSSL_LH_new(ossl_check_ERR_STRING_DATA_lh_hashfunc_type(hfn), ossl_check_ERR_STRING_DATA_lh_compfunc_type(cmp)))
  ------------------
  222|      2|                                            err_string_data_cmp);
  223|      2|    if (int_error_hash == NULL) {
  ------------------
  |  Branch (223:9): [True: 0, False: 2]
  ------------------
  224|      0|        CRYPTO_THREAD_lock_free(err_string_lock);
  225|      0|        err_string_lock = NULL;
  226|      0|        return 0;
  227|      0|    }
  228|      2|#endif
  229|      2|    return 1;
  230|      2|}
err.c:err_string_data_hash:
  172|  9.48k|{
  173|  9.48k|    unsigned long ret, l;
  174|       |
  175|  9.48k|    l = a->error;
  176|  9.48k|    ret = l ^ ERR_GET_LIB(l);
  177|  9.48k|    return (ret ^ ret % 19 * 13);
  178|  9.48k|}
err.c:err_string_data_cmp:
  182|  6.13k|{
  183|  6.13k|    if (a->error == b->error)
  ------------------
  |  Branch (183:9): [True: 5.74k, False: 392]
  ------------------
  184|  5.74k|        return 0;
  185|    392|    return a->error > b->error ? 1 : -1;
  ------------------
  |  Branch (185:12): [True: 216, False: 176]
  ------------------
  186|  6.13k|}
err.c:err_load_strings:
  260|    214|{
  261|    214|    if (!CRYPTO_THREAD_write_lock(err_string_lock))
  ------------------
  |  Branch (261:9): [True: 0, False: 214]
  ------------------
  262|      0|        return 0;
  263|  9.55k|    for (; str->error; str++)
  ------------------
  |  Branch (263:12): [True: 9.34k, False: 214]
  ------------------
  264|  9.34k|        (void)lh_ERR_STRING_DATA_insert(int_error_hash,
  ------------------
  |  |  378|  9.55k|#define lh_ERR_STRING_DATA_insert(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_insert(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_ERR_STRING_DATA_lh_plain_type(ptr)))
  ------------------
  265|    214|                                       (ERR_STRING_DATA *)str);
  266|    214|    CRYPTO_THREAD_unlock(err_string_lock);
  267|    214|    return 1;
  268|    214|}
err.c:get_error_values:
  448|  4.15M|{
  449|  4.15M|    int i = 0;
  450|  4.15M|    ERR_STATE *es;
  451|  4.15M|    unsigned long ret;
  452|       |
  453|  4.15M|    es = ossl_err_get_state_int();
  454|  4.15M|    if (es == NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 4.15M]
  ------------------
  455|      0|        return 0;
  456|       |
  457|       |    /*
  458|       |     * Clear anything that should have been cleared earlier. We do this
  459|       |     * here because this doesn't have constant-time issues.
  460|       |     */
  461|  4.15M|    while (es->bottom != es->top) {
  ------------------
  |  Branch (461:12): [True: 4.13M, False: 19.2k]
  ------------------
  462|  4.13M|        if (es->err_flags[es->top] & ERR_FLAG_CLEAR) {
  ------------------
  |  |   53|  4.13M|#  define ERR_FLAG_CLEAR          0x02
  ------------------
  |  Branch (462:13): [True: 0, False: 4.13M]
  ------------------
  463|      0|            err_clear(es, es->top, 0);
  464|      0|            es->top = es->top > 0 ? es->top - 1 : ERR_NUM_ERRORS - 1;
  ------------------
  |  |   55|      0|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (464:23): [True: 0, False: 0]
  ------------------
  465|      0|            continue;
  466|      0|        }
  467|  4.13M|        i = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|  4.13M|#  define ERR_NUM_ERRORS  16
  ------------------
  468|  4.13M|        if (es->err_flags[i] & ERR_FLAG_CLEAR) {
  ------------------
  |  |   53|  4.13M|#  define ERR_FLAG_CLEAR          0x02
  ------------------
  |  Branch (468:13): [True: 0, False: 4.13M]
  ------------------
  469|      0|            es->bottom = i;
  470|      0|            err_clear(es, es->bottom, 0);
  471|      0|            continue;
  472|      0|        }
  473|  4.13M|        break;
  474|  4.13M|    }
  475|       |
  476|       |    /* If everything has been cleared, the stack is empty. */
  477|  4.15M|    if (es->bottom == es->top)
  ------------------
  |  Branch (477:9): [True: 19.2k, False: 4.13M]
  ------------------
  478|  19.2k|        return 0;
  479|       |
  480|       |    /* Which error, the top of stack (latest one) or the first one? */
  481|  4.13M|    if (g == EV_PEEK_LAST)
  ------------------
  |  Branch (481:9): [True: 4.13M, False: 18]
  ------------------
  482|  4.13M|        i = es->top;
  483|     18|    else
  484|     18|        i = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|     18|#  define ERR_NUM_ERRORS  16
  ------------------
  485|       |
  486|  4.13M|    ret = es->err_buffer[i];
  487|  4.13M|    if (g == EV_POP) {
  ------------------
  |  Branch (487:9): [True: 0, False: 4.13M]
  ------------------
  488|      0|        es->bottom = i;
  489|      0|        es->err_buffer[i] = 0;
  490|      0|    }
  491|       |
  492|  4.13M|    if (file != NULL) {
  ------------------
  |  Branch (492:9): [True: 0, False: 4.13M]
  ------------------
  493|      0|        *file = es->err_file[i];
  494|      0|        if (*file == NULL)
  ------------------
  |  Branch (494:13): [True: 0, False: 0]
  ------------------
  495|      0|            *file = "";
  496|      0|    }
  497|  4.13M|    if (line != NULL)
  ------------------
  |  Branch (497:9): [True: 0, False: 4.13M]
  ------------------
  498|      0|        *line = es->err_line[i];
  499|  4.13M|    if (func != NULL) {
  ------------------
  |  Branch (499:9): [True: 0, False: 4.13M]
  ------------------
  500|      0|        *func = es->err_func[i];
  501|      0|        if (*func == NULL)
  ------------------
  |  Branch (501:13): [True: 0, False: 0]
  ------------------
  502|      0|            *func = "";
  503|      0|    }
  504|  4.13M|    if (flags != NULL)
  ------------------
  |  Branch (504:9): [True: 0, False: 4.13M]
  ------------------
  505|      0|        *flags = es->err_data_flags[i];
  506|  4.13M|    if (data == NULL) {
  ------------------
  |  Branch (506:9): [True: 4.13M, False: 0]
  ------------------
  507|  4.13M|        if (g == EV_POP) {
  ------------------
  |  Branch (507:13): [True: 0, False: 4.13M]
  ------------------
  508|      0|            err_clear_data(es, i, 0);
  509|      0|        }
  510|  4.13M|    } else {
  511|      0|        *data = es->err_data[i];
  512|      0|        if (*data == NULL) {
  ------------------
  |  Branch (512:13): [True: 0, False: 0]
  ------------------
  513|      0|            *data = "";
  514|      0|            if (flags != NULL)
  ------------------
  |  Branch (514:17): [True: 0, False: 0]
  ------------------
  515|      0|                *flags = 0;
  516|      0|        }
  517|      0|    }
  518|  4.13M|    return ret;
  519|  4.15M|}
err.c:int_err_get_item:
  189|    140|{
  190|    140|    ERR_STRING_DATA *p = NULL;
  191|       |
  192|    140|    if (!CRYPTO_THREAD_read_lock(err_string_lock))
  ------------------
  |  Branch (192:9): [True: 0, False: 140]
  ------------------
  193|      0|        return NULL;
  194|    140|    p = lh_ERR_STRING_DATA_retrieve(int_error_hash, d);
  ------------------
  |  |  380|    140|#define lh_ERR_STRING_DATA_retrieve(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_retrieve(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_const_ERR_STRING_DATA_lh_plain_type(ptr)))
  ------------------
  195|    140|    CRYPTO_THREAD_unlock(err_string_lock);
  196|       |
  197|    140|    return p;
  198|    140|}
err.c:err_do_init:
  667|      2|{
  668|      2|    set_err_thread_local = 1;
  669|      2|    return CRYPTO_THREAD_init_local(&err_thread_local, NULL);
  670|      2|}
err.c:err_delete_thread_state:
  645|      2|{
  646|      2|    ERR_STATE *state = CRYPTO_THREAD_get_local(&err_thread_local);
  647|      2|    if (state == NULL)
  ------------------
  |  Branch (647:9): [True: 0, False: 2]
  ------------------
  648|      0|        return;
  649|       |
  650|      2|    CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  651|      2|    OSSL_ERR_STATE_free(state);
  652|      2|}
err.c:err_set_error_data_int:
  780|  2.00M|{
  781|  2.00M|    ERR_STATE *es;
  782|       |
  783|  2.00M|    es = ossl_err_get_state_int();
  784|  2.00M|    if (es == NULL)
  ------------------
  |  Branch (784:9): [True: 0, False: 2.00M]
  ------------------
  785|      0|        return 0;
  786|       |
  787|  2.00M|    err_clear_data(es, es->top, deallocate);
  788|  2.00M|    err_set_data(es, es->top, data, size, flags);
  789|       |
  790|  2.00M|    return 1;
  791|  2.00M|}

ossl_err_load_crypto_strings:
   49|      2|{
   50|      2|    if (0
  ------------------
  |  Branch (50:9): [Folded - Ignored]
  ------------------
   51|      2|#ifndef OPENSSL_NO_ERR
   52|      2|        || ossl_err_load_ERR_strings() == 0 /* include error strings for SYSerr */
  ------------------
  |  Branch (52:12): [True: 0, False: 2]
  ------------------
   53|      2|        || ossl_err_load_BN_strings() == 0
  ------------------
  |  Branch (53:12): [True: 0, False: 2]
  ------------------
   54|      2|        || ossl_err_load_RSA_strings() == 0
  ------------------
  |  Branch (54:12): [True: 0, False: 2]
  ------------------
   55|      2|# ifndef OPENSSL_NO_DH
   56|      2|        || ossl_err_load_DH_strings() == 0
  ------------------
  |  Branch (56:12): [True: 0, False: 2]
  ------------------
   57|      2|# endif
   58|      2|        || ossl_err_load_EVP_strings() == 0
  ------------------
  |  Branch (58:12): [True: 0, False: 2]
  ------------------
   59|      2|        || ossl_err_load_BUF_strings() == 0
  ------------------
  |  Branch (59:12): [True: 0, False: 2]
  ------------------
   60|      2|        || ossl_err_load_OBJ_strings() == 0
  ------------------
  |  Branch (60:12): [True: 0, False: 2]
  ------------------
   61|      2|        || ossl_err_load_PEM_strings() == 0
  ------------------
  |  Branch (61:12): [True: 0, False: 2]
  ------------------
   62|      2|# ifndef OPENSSL_NO_DSA
   63|      2|        || ossl_err_load_DSA_strings() == 0
  ------------------
  |  Branch (63:12): [True: 0, False: 2]
  ------------------
   64|      2|# endif
   65|      2|        || ossl_err_load_X509_strings() == 0
  ------------------
  |  Branch (65:12): [True: 0, False: 2]
  ------------------
   66|      2|        || ossl_err_load_ASN1_strings() == 0
  ------------------
  |  Branch (66:12): [True: 0, False: 2]
  ------------------
   67|      2|        || ossl_err_load_CONF_strings() == 0
  ------------------
  |  Branch (67:12): [True: 0, False: 2]
  ------------------
   68|      2|        || ossl_err_load_CRYPTO_strings() == 0
  ------------------
  |  Branch (68:12): [True: 0, False: 2]
  ------------------
   69|      2|# ifndef OPENSSL_NO_COMP
   70|      2|        || ossl_err_load_COMP_strings() == 0
  ------------------
  |  Branch (70:12): [True: 0, False: 2]
  ------------------
   71|      2|# endif
   72|      2|# ifndef OPENSSL_NO_EC
   73|      2|        || ossl_err_load_EC_strings() == 0
  ------------------
  |  Branch (73:12): [True: 0, False: 2]
  ------------------
   74|      2|# endif
   75|       |        /* skip ossl_err_load_SSL_strings() because it is not in this library */
   76|      2|        || ossl_err_load_BIO_strings() == 0
  ------------------
  |  Branch (76:12): [True: 0, False: 2]
  ------------------
   77|      2|        || ossl_err_load_PKCS7_strings() == 0
  ------------------
  |  Branch (77:12): [True: 0, False: 2]
  ------------------
   78|      2|        || ossl_err_load_X509V3_strings() == 0
  ------------------
  |  Branch (78:12): [True: 0, False: 2]
  ------------------
   79|      2|        || ossl_err_load_PKCS12_strings() == 0
  ------------------
  |  Branch (79:12): [True: 0, False: 2]
  ------------------
   80|      2|        || ossl_err_load_RAND_strings() == 0
  ------------------
  |  Branch (80:12): [True: 0, False: 2]
  ------------------
   81|      2|        || ossl_err_load_DSO_strings() == 0
  ------------------
  |  Branch (81:12): [True: 0, False: 2]
  ------------------
   82|      2|# ifndef OPENSSL_NO_TS
   83|      2|        || ossl_err_load_TS_strings() == 0
  ------------------
  |  Branch (83:12): [True: 0, False: 2]
  ------------------
   84|      2|# endif
   85|      2|# ifndef OPENSSL_NO_ENGINE
   86|      2|        || ossl_err_load_ENGINE_strings() == 0
  ------------------
  |  Branch (86:12): [True: 0, False: 2]
  ------------------
   87|      2|# endif
   88|      2|# ifndef OPENSSL_NO_HTTP
   89|      2|        || ossl_err_load_HTTP_strings() == 0
  ------------------
  |  Branch (89:12): [True: 0, False: 2]
  ------------------
   90|      2|# endif
   91|      2|# ifndef OPENSSL_NO_OCSP
   92|      2|        || ossl_err_load_OCSP_strings() == 0
  ------------------
  |  Branch (92:12): [True: 0, False: 2]
  ------------------
   93|      2|# endif
   94|      2|        || ossl_err_load_UI_strings() == 0
  ------------------
  |  Branch (94:12): [True: 0, False: 2]
  ------------------
   95|      2|# ifndef OPENSSL_NO_CMS
   96|      2|        || ossl_err_load_CMS_strings() == 0
  ------------------
  |  Branch (96:12): [True: 0, False: 2]
  ------------------
   97|      2|# endif
   98|      2|# ifndef OPENSSL_NO_CRMF
   99|      2|        || ossl_err_load_CRMF_strings() == 0
  ------------------
  |  Branch (99:12): [True: 0, False: 2]
  ------------------
  100|      2|        || ossl_err_load_CMP_strings() == 0
  ------------------
  |  Branch (100:12): [True: 0, False: 2]
  ------------------
  101|      2|# endif
  102|      2|# ifndef OPENSSL_NO_CT
  103|      2|        || ossl_err_load_CT_strings() == 0
  ------------------
  |  Branch (103:12): [True: 0, False: 2]
  ------------------
  104|      2|# endif
  105|      2|        || ossl_err_load_ESS_strings() == 0
  ------------------
  |  Branch (105:12): [True: 0, False: 2]
  ------------------
  106|      2|        || ossl_err_load_ASYNC_strings() == 0
  ------------------
  |  Branch (106:12): [True: 0, False: 2]
  ------------------
  107|      2|        || ossl_err_load_OSSL_STORE_strings() == 0
  ------------------
  |  Branch (107:12): [True: 0, False: 2]
  ------------------
  108|      2|        || ossl_err_load_PROP_strings() == 0
  ------------------
  |  Branch (108:12): [True: 0, False: 2]
  ------------------
  109|      2|        || ossl_err_load_PROV_strings() == 0
  ------------------
  |  Branch (109:12): [True: 0, False: 2]
  ------------------
  110|      2|#endif
  111|      2|        )
  112|      0|        return 0;
  113|       |
  114|      2|    return 1;
  115|      2|}

ERR_new:
   17|  9.62M|{
   18|  9.62M|    ERR_STATE *es;
   19|       |
   20|  9.62M|    es = ossl_err_get_state_int();
   21|  9.62M|    if (es == NULL)
  ------------------
  |  Branch (21:9): [True: 3, False: 9.62M]
  ------------------
   22|      3|        return;
   23|       |
   24|       |    /* Allocate a slot */
   25|  9.62M|    err_get_slot(es);
   26|  9.62M|    err_clear(es, es->top, 0);
   27|  9.62M|}
ERR_set_debug:
   30|  9.62M|{
   31|  9.62M|    ERR_STATE *es;
   32|       |
   33|  9.62M|    es = ossl_err_get_state_int();
   34|  9.62M|    if (es == NULL)
  ------------------
  |  Branch (34:9): [True: 3, False: 9.62M]
  ------------------
   35|      3|        return;
   36|       |
   37|  9.62M|    err_set_debug(es, es->top, file, line, func);
   38|  9.62M|}
ERR_set_error:
   41|  9.62M|{
   42|  9.62M|    va_list args;
   43|       |
   44|  9.62M|    va_start(args, fmt);
   45|  9.62M|    ERR_vset_error(lib, reason, fmt, args);
   46|  9.62M|    va_end(args);
   47|  9.62M|}
ERR_vset_error:
   50|  9.62M|{
   51|  9.62M|    ERR_STATE *es;
   52|  9.62M|    char *buf = NULL;
   53|  9.62M|    size_t buf_size = 0;
   54|  9.62M|    unsigned long flags = 0;
   55|  9.62M|    size_t i;
   56|       |
   57|  9.62M|    es = ossl_err_get_state_int();
   58|  9.62M|    if (es == NULL)
  ------------------
  |  Branch (58:9): [True: 3, False: 9.62M]
  ------------------
   59|      3|        return;
   60|  9.62M|    i = es->top;
   61|       |
   62|  9.62M|    if (fmt != NULL) {
  ------------------
  |  Branch (62:9): [True: 31.0k, False: 9.59M]
  ------------------
   63|  31.0k|        int printed_len = 0;
   64|  31.0k|        char *rbuf = NULL;
   65|       |
   66|  31.0k|        buf = es->err_data[i];
   67|  31.0k|        buf_size = es->err_data_size[i];
   68|       |
   69|       |        /*
   70|       |         * To protect the string we just grabbed from tampering by other
   71|       |         * functions we may call, or to protect them from freeing a pointer
   72|       |         * that may no longer be valid at that point, we clear away the
   73|       |         * data pointer and the flags.  We will set them again at the end
   74|       |         * of this function.
   75|       |         */
   76|  31.0k|        es->err_data[i] = NULL;
   77|  31.0k|        es->err_data_flags[i] = 0;
   78|       |
   79|       |        /*
   80|       |         * Try to maximize the space available.  If that fails, we use what
   81|       |         * we have.
   82|       |         */
   83|  31.0k|        if (buf_size < ERR_MAX_DATA_SIZE
  ------------------
  |  |  392|  62.0k|#define ERR_MAX_DATA_SIZE       1024
  ------------------
  |  Branch (83:13): [True: 31.0k, False: 0]
  ------------------
   84|  31.0k|            && (rbuf = OPENSSL_realloc(buf, ERR_MAX_DATA_SIZE)) != NULL) {
  ------------------
  |  |  101|  31.0k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  31.0k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  31.0k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (84:16): [True: 31.0k, False: 0]
  ------------------
   85|  31.0k|            buf = rbuf;
   86|  31.0k|            buf_size = ERR_MAX_DATA_SIZE;
  ------------------
  |  |  392|  31.0k|#define ERR_MAX_DATA_SIZE       1024
  ------------------
   87|  31.0k|        }
   88|       |
   89|  31.0k|        if (buf != NULL) {
  ------------------
  |  Branch (89:13): [True: 31.0k, False: 0]
  ------------------
   90|  31.0k|            printed_len = BIO_vsnprintf(buf, buf_size, fmt, args);
   91|  31.0k|        }
   92|  31.0k|        if (printed_len < 0)
  ------------------
  |  Branch (92:13): [True: 0, False: 31.0k]
  ------------------
   93|      0|            printed_len = 0;
   94|  31.0k|        if (buf != NULL)
  ------------------
  |  Branch (94:13): [True: 31.0k, False: 0]
  ------------------
   95|  31.0k|            buf[printed_len] = '\0';
   96|       |
   97|       |        /*
   98|       |         * Try to reduce the size, but only if we maximized above.  If that
   99|       |         * fails, we keep what we have.
  100|       |         * (According to documentation, realloc leaves the old buffer untouched
  101|       |         * if it fails)
  102|       |         */
  103|  31.0k|        if ((rbuf = OPENSSL_realloc(buf, printed_len + 1)) != NULL) {
  ------------------
  |  |  101|  31.0k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  31.0k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  31.0k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (103:13): [True: 31.0k, False: 0]
  ------------------
  104|  31.0k|            buf = rbuf;
  105|  31.0k|            buf_size = printed_len + 1;
  106|  31.0k|            buf[printed_len] = '\0';
  107|  31.0k|        }
  108|       |
  109|  31.0k|        if (buf != NULL)
  ------------------
  |  Branch (109:13): [True: 31.0k, False: 0]
  ------------------
  110|  31.0k|            flags = ERR_TXT_MALLOCED | ERR_TXT_STRING;
  ------------------
  |  |   48|  31.0k|# define ERR_TXT_MALLOCED        0x01
  ------------------
                          flags = ERR_TXT_MALLOCED | ERR_TXT_STRING;
  ------------------
  |  |   49|  31.0k|# define ERR_TXT_STRING          0x02
  ------------------
  111|  31.0k|    }
  112|       |
  113|  9.62M|    err_clear_data(es, es->top, 0);
  114|  9.62M|    err_set_error(es, es->top, lib, reason);
  115|  9.62M|    if (fmt != NULL)
  ------------------
  |  Branch (115:9): [True: 31.0k, False: 9.59M]
  ------------------
  116|  31.0k|        err_set_data(es, es->top, buf, buf_size, flags);
  117|  9.62M|}

err.c:err_clear:
   85|   187k|{
   86|   187k|    err_clear_data(es, i, (deall));
   87|   187k|    es->err_marks[i] = 0;
   88|   187k|    es->err_flags[i] = 0;
   89|   187k|    es->err_buffer[i] = 0;
   90|   187k|    es->err_line[i] = -1;
   91|   187k|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  107|   187k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   187k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   187k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|   187k|    es->err_file[i] = NULL;
   93|   187k|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  107|   187k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   187k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   187k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|   187k|    es->err_func[i] = NULL;
   95|   187k|}
err.c:err_clear_data:
   22|  2.19M|{
   23|  2.19M|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|  2.19M|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 2.19M, False: 60]
  ------------------
   24|  2.19M|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 17, False: 2.19M]
  ------------------
   25|     17|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  107|     17|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     17|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     17|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|     17|            es->err_data[i] = NULL;
   27|     17|            es->err_data_size[i] = 0;
   28|     17|            es->err_data_flags[i] = 0;
   29|  2.19M|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 2.19M, False: 0]
  ------------------
   30|  2.19M|            es->err_data[i][0] = '\0';
   31|  2.19M|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|  2.19M|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|  2.19M|        }
   33|  2.19M|    } else {
   34|     60|        es->err_data[i] = NULL;
   35|     60|        es->err_data_size[i] = 0;
   36|     60|        es->err_data_flags[i] = 0;
   37|     60|    }
   38|  2.19M|}
err.c:err_set_data:
   76|  2.00M|{
   77|  2.00M|    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
  ------------------
  |  |   48|  2.00M|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (77:9): [True: 2.00M, False: 15]
  ------------------
   78|  2.00M|        OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  107|  2.00M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.00M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.00M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|  2.00M|    es->err_data[i] = data;
   80|  2.00M|    es->err_data_size[i] = datasz;
   81|  2.00M|    es->err_data_flags[i] = flags;
   82|  2.00M|}
err_blocks.c:err_get_slot:
   15|  9.62M|{
   16|  9.62M|    es->top = (es->top + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|  9.62M|#  define ERR_NUM_ERRORS  16
  ------------------
   17|  9.62M|    if (es->top == es->bottom)
  ------------------
  |  Branch (17:9): [True: 4.70M, False: 4.91M]
  ------------------
   18|  4.70M|        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
  ------------------
  |  |   55|  4.70M|#  define ERR_NUM_ERRORS  16
  ------------------
   19|  9.62M|}
err_blocks.c:err_clear:
   85|  9.62M|{
   86|  9.62M|    err_clear_data(es, i, (deall));
   87|  9.62M|    es->err_marks[i] = 0;
   88|  9.62M|    es->err_flags[i] = 0;
   89|  9.62M|    es->err_buffer[i] = 0;
   90|  9.62M|    es->err_line[i] = -1;
   91|  9.62M|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  107|  9.62M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.62M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.62M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|  9.62M|    es->err_file[i] = NULL;
   93|  9.62M|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  107|  9.62M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.62M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.62M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|  9.62M|    es->err_func[i] = NULL;
   95|  9.62M|}
err_blocks.c:err_set_debug:
   52|  9.62M|{
   53|       |    /*
   54|       |     * We dup the file and fn strings because they may be provider owned. If the
   55|       |     * provider gets unloaded, they may not be valid anymore.
   56|       |     */
   57|  9.62M|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  107|  9.62M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.62M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.62M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   58|  9.62M|    if (file == NULL || file[0] == '\0')
  ------------------
  |  Branch (58:9): [True: 0, False: 9.62M]
  |  Branch (58:25): [True: 0, False: 9.62M]
  ------------------
   59|      0|        es->err_file[i] = NULL;
   60|  9.62M|    else if ((es->err_file[i] = CRYPTO_malloc(strlen(file) + 1,
  ------------------
  |  Branch (60:14): [True: 9.62M, False: 0]
  ------------------
   61|  9.62M|                                              NULL, 0)) != NULL)
   62|       |        /* We cannot use OPENSSL_strdup due to possible recursion */
   63|  9.62M|        strcpy(es->err_file[i], file);
   64|       |
   65|  9.62M|    es->err_line[i] = line;
   66|  9.62M|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  107|  9.62M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.62M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.62M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   67|  9.62M|    if (fn == NULL || fn[0] == '\0')
  ------------------
  |  Branch (67:9): [True: 0, False: 9.62M]
  |  Branch (67:23): [True: 0, False: 9.62M]
  ------------------
   68|      0|        es->err_func[i] = NULL;
   69|  9.62M|    else if ((es->err_func[i] = CRYPTO_malloc(strlen(fn) + 1,
  ------------------
  |  Branch (69:14): [True: 9.62M, False: 0]
  ------------------
   70|  9.62M|                                              NULL, 0)) != NULL)
   71|  9.62M|        strcpy(es->err_func[i], fn);
   72|  9.62M|}
err_blocks.c:err_clear_data:
   22|  19.2M|{
   23|  19.2M|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|  19.2M|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 19.2M, False: 31.2k]
  ------------------
   24|  19.2M|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 19.2M]
  ------------------
   25|      0|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|      0|            es->err_data[i] = NULL;
   27|      0|            es->err_data_size[i] = 0;
   28|      0|            es->err_data_flags[i] = 0;
   29|  19.2M|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 19.2M, False: 0]
  ------------------
   30|  19.2M|            es->err_data[i][0] = '\0';
   31|  19.2M|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|  19.2M|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|  19.2M|        }
   33|  19.2M|    } else {
   34|  31.2k|        es->err_data[i] = NULL;
   35|  31.2k|        es->err_data_size[i] = 0;
   36|  31.2k|        es->err_data_flags[i] = 0;
   37|  31.2k|    }
   38|  19.2M|}
err_blocks.c:err_set_error:
   42|  9.62M|{
   43|  9.62M|    es->err_buffer[i] =
   44|  9.62M|        lib == ERR_LIB_SYS
  ------------------
  |  |   72|  9.62M|# define ERR_LIB_SYS             2
  ------------------
  |  Branch (44:9): [True: 2, False: 9.62M]
  ------------------
   45|  9.62M|        ? (unsigned int)(ERR_SYSTEM_FLAG |  reason)
  ------------------
  |  |  218|      2|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  ------------------
   46|  9.62M|        : ERR_PACK(lib, 0, reason);
  ------------------
  |  |  279|  19.2M|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|  9.62M|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|  9.62M|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|  19.2M|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|  9.62M|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
   47|  9.62M|}
err_blocks.c:err_set_data:
   76|  31.0k|{
   77|  31.0k|    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
  ------------------
  |  |   48|  31.0k|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (77:9): [True: 0, False: 31.0k]
  ------------------
   78|      0|        OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|  31.0k|    es->err_data[i] = data;
   80|  31.0k|    es->err_data_size[i] = datasz;
   81|  31.0k|    es->err_data_flags[i] = flags;
   82|  31.0k|}
err_mark.c:err_clear:
   85|  4.76M|{
   86|  4.76M|    err_clear_data(es, i, (deall));
   87|  4.76M|    es->err_marks[i] = 0;
   88|  4.76M|    es->err_flags[i] = 0;
   89|  4.76M|    es->err_buffer[i] = 0;
   90|  4.76M|    es->err_line[i] = -1;
   91|  4.76M|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  107|  4.76M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  4.76M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  4.76M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|  4.76M|    es->err_file[i] = NULL;
   93|  4.76M|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  107|  4.76M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  4.76M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  4.76M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|  4.76M|    es->err_func[i] = NULL;
   95|  4.76M|}
err_mark.c:err_clear_data:
   22|  4.76M|{
   23|  4.76M|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|  4.76M|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 4.76M, False: 4]
  ------------------
   24|  4.76M|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 4.76M]
  ------------------
   25|      0|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|      0|            es->err_data[i] = NULL;
   27|      0|            es->err_data_size[i] = 0;
   28|      0|            es->err_data_flags[i] = 0;
   29|  4.76M|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 4.76M, False: 0]
  ------------------
   30|  4.76M|            es->err_data[i][0] = '\0';
   31|  4.76M|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|  4.76M|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|  4.76M|        }
   33|  4.76M|    } else {
   34|      4|        es->err_data[i] = NULL;
   35|      4|        es->err_data_size[i] = 0;
   36|      4|        es->err_data_flags[i] = 0;
   37|      4|    }
   38|  4.76M|}

ERR_set_mark:
   16|   912k|{
   17|   912k|    ERR_STATE *es;
   18|       |
   19|   912k|    es = ossl_err_get_state_int();
   20|   912k|    if (es == NULL)
  ------------------
  |  Branch (20:9): [True: 0, False: 912k]
  ------------------
   21|      0|        return 0;
   22|       |
   23|   912k|    if (es->bottom == es->top)
  ------------------
  |  Branch (23:9): [True: 275k, False: 637k]
  ------------------
   24|   275k|        return 0;
   25|   637k|    es->err_marks[es->top]++;
   26|   637k|    return 1;
   27|   912k|}
ERR_pop_to_mark:
   30|  4.50M|{
   31|  4.50M|    ERR_STATE *es;
   32|       |
   33|  4.50M|    es = ossl_err_get_state_int();
   34|  4.50M|    if (es == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 4.50M]
  ------------------
   35|      0|        return 0;
   36|       |
   37|  9.26M|    while (es->bottom != es->top
  ------------------
  |  Branch (37:12): [True: 5.17M, False: 4.08M]
  ------------------
   38|  9.26M|           && es->err_marks[es->top] == 0) {
  ------------------
  |  Branch (38:15): [True: 4.76M, False: 412k]
  ------------------
   39|  4.76M|        err_clear(es, es->top, 0);
   40|  4.76M|        es->top = es->top > 0 ? es->top - 1 : ERR_NUM_ERRORS - 1;
  ------------------
  |  |   55|   119k|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (40:19): [True: 4.64M, False: 119k]
  ------------------
   41|  4.76M|    }
   42|       |
   43|  4.50M|    if (es->bottom == es->top)
  ------------------
  |  Branch (43:9): [True: 4.08M, False: 412k]
  ------------------
   44|  4.08M|        return 0;
   45|   412k|    es->err_marks[es->top]--;
   46|   412k|    return 1;
   47|  4.50M|}
ERR_clear_last_mark:
   69|   255k|{
   70|   255k|    ERR_STATE *es;
   71|   255k|    int top;
   72|       |
   73|   255k|    es = ossl_err_get_state_int();
   74|   255k|    if (es == NULL)
  ------------------
  |  Branch (74:9): [True: 0, False: 255k]
  ------------------
   75|      0|        return 0;
   76|       |
   77|   255k|    top = es->top;
   78|   728k|    while (es->bottom != top
  ------------------
  |  Branch (78:12): [True: 637k, False: 91.1k]
  ------------------
   79|   728k|           && es->err_marks[top] == 0) {
  ------------------
  |  Branch (79:15): [True: 472k, False: 164k]
  ------------------
   80|   472k|        top = top > 0 ? top - 1 : ERR_NUM_ERRORS - 1;
  ------------------
  |  |   55|  26.4k|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (80:15): [True: 446k, False: 26.4k]
  ------------------
   81|   472k|    }
   82|       |
   83|   255k|    if (es->bottom == top)
  ------------------
  |  Branch (83:9): [True: 91.1k, False: 164k]
  ------------------
   84|  91.1k|        return 0;
   85|   164k|    es->err_marks[top]--;
   86|   164k|    return 1;
   87|   255k|}

OSSL_ERR_STATE_new:
   22|      2|{
   23|      2|    return CRYPTO_zalloc(sizeof(ERR_STATE), NULL, 0);
   24|      2|}

ossl_err_load_ESS_strings:
   42|      2|{
   43|      2|#ifndef OPENSSL_NO_ERR
   44|      2|    if (ERR_reason_error_string(ESS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (44:9): [True: 2, False: 0]
  ------------------
   45|      2|        ERR_load_strings_const(ESS_str_reasons);
   46|      2|#endif
   47|      2|    return 1;
   48|      2|}

openssl_add_all_ciphers_int:
   18|      2|{
   19|       |
   20|      2|#ifndef OPENSSL_NO_DES
   21|      2|    EVP_add_cipher(EVP_des_cfb());
  ------------------
  |  |  949|      2|#  define EVP_des_cfb EVP_des_cfb64
  ------------------
   22|      2|    EVP_add_cipher(EVP_des_cfb1());
   23|      2|    EVP_add_cipher(EVP_des_cfb8());
   24|      2|    EVP_add_cipher(EVP_des_ede_cfb());
  ------------------
  |  |  953|      2|#  define EVP_des_ede_cfb EVP_des_ede_cfb64
  ------------------
   25|      2|    EVP_add_cipher(EVP_des_ede3_cfb());
  ------------------
  |  |  955|      2|#  define EVP_des_ede3_cfb EVP_des_ede3_cfb64
  ------------------
   26|      2|    EVP_add_cipher(EVP_des_ede3_cfb1());
   27|      2|    EVP_add_cipher(EVP_des_ede3_cfb8());
   28|       |
   29|      2|    EVP_add_cipher(EVP_des_ofb());
   30|      2|    EVP_add_cipher(EVP_des_ede_ofb());
   31|      2|    EVP_add_cipher(EVP_des_ede3_ofb());
   32|       |
   33|      2|    EVP_add_cipher(EVP_desx_cbc());
   34|      2|    EVP_add_cipher_alias(SN_desx_cbc, "DESX");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   35|      2|    EVP_add_cipher_alias(SN_desx_cbc, "desx");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   36|       |
   37|      2|    EVP_add_cipher(EVP_des_cbc());
   38|      2|    EVP_add_cipher_alias(SN_des_cbc, "DES");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   39|      2|    EVP_add_cipher_alias(SN_des_cbc, "des");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   40|      2|    EVP_add_cipher(EVP_des_ede_cbc());
   41|      2|    EVP_add_cipher(EVP_des_ede3_cbc());
   42|      2|    EVP_add_cipher_alias(SN_des_ede3_cbc, "DES3");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   43|      2|    EVP_add_cipher_alias(SN_des_ede3_cbc, "des3");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   44|       |
   45|      2|    EVP_add_cipher(EVP_des_ecb());
   46|      2|    EVP_add_cipher(EVP_des_ede());
   47|      2|    EVP_add_cipher_alias(SN_des_ede_ecb, "DES-EDE-ECB");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   48|      2|    EVP_add_cipher_alias(SN_des_ede_ecb, "des-ede-ecb");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   49|      2|    EVP_add_cipher(EVP_des_ede3());
   50|      2|    EVP_add_cipher_alias(SN_des_ede3_ecb, "DES-EDE3-ECB");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   51|      2|    EVP_add_cipher_alias(SN_des_ede3_ecb, "des-ede3-ecb");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   52|      2|    EVP_add_cipher(EVP_des_ede3_wrap());
   53|      2|    EVP_add_cipher_alias(SN_id_smime_alg_CMS3DESwrap, "des3-wrap");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   54|      2|#endif
   55|       |
   56|      2|#ifndef OPENSSL_NO_RC4
   57|      2|    EVP_add_cipher(EVP_rc4());
   58|      2|    EVP_add_cipher(EVP_rc4_40());
   59|      2|# ifndef OPENSSL_NO_MD5
   60|      2|    EVP_add_cipher(EVP_rc4_hmac_md5());
   61|      2|# endif
   62|      2|#endif
   63|       |
   64|      2|#ifndef OPENSSL_NO_IDEA
   65|      2|    EVP_add_cipher(EVP_idea_ecb());
   66|      2|    EVP_add_cipher(EVP_idea_cfb());
  ------------------
  |  |  982|      2|#  define EVP_idea_cfb EVP_idea_cfb64
  ------------------
   67|      2|    EVP_add_cipher(EVP_idea_ofb());
   68|      2|    EVP_add_cipher(EVP_idea_cbc());
   69|      2|    EVP_add_cipher_alias(SN_idea_cbc, "IDEA");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   70|      2|    EVP_add_cipher_alias(SN_idea_cbc, "idea");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   71|      2|#endif
   72|       |
   73|      2|#ifndef OPENSSL_NO_SEED
   74|      2|    EVP_add_cipher(EVP_seed_ecb());
   75|      2|    EVP_add_cipher(EVP_seed_cfb());
  ------------------
  |  | 1136|      2|#  define EVP_seed_cfb EVP_seed_cfb128
  ------------------
   76|      2|    EVP_add_cipher(EVP_seed_ofb());
   77|      2|    EVP_add_cipher(EVP_seed_cbc());
   78|      2|    EVP_add_cipher_alias(SN_seed_cbc, "SEED");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   79|      2|    EVP_add_cipher_alias(SN_seed_cbc, "seed");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   80|      2|#endif
   81|       |
   82|      2|#ifndef OPENSSL_NO_SM4
   83|      2|    EVP_add_cipher(EVP_sm4_ecb());
   84|      2|    EVP_add_cipher(EVP_sm4_cbc());
   85|      2|    EVP_add_cipher(EVP_sm4_cfb());
  ------------------
  |  | 1144|      2|#  define EVP_sm4_cfb EVP_sm4_cfb128
  ------------------
   86|      2|    EVP_add_cipher(EVP_sm4_ofb());
   87|      2|    EVP_add_cipher(EVP_sm4_ctr());
   88|      2|    EVP_add_cipher_alias(SN_sm4_cbc, "SM4");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   89|      2|    EVP_add_cipher_alias(SN_sm4_cbc, "sm4");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   90|      2|#endif
   91|       |
   92|      2|#ifndef OPENSSL_NO_RC2
   93|      2|    EVP_add_cipher(EVP_rc2_ecb());
   94|      2|    EVP_add_cipher(EVP_rc2_cfb());
  ------------------
  |  |  992|      2|#  define EVP_rc2_cfb EVP_rc2_cfb64
  ------------------
   95|      2|    EVP_add_cipher(EVP_rc2_ofb());
   96|      2|    EVP_add_cipher(EVP_rc2_cbc());
   97|      2|    EVP_add_cipher(EVP_rc2_40_cbc());
   98|      2|    EVP_add_cipher(EVP_rc2_64_cbc());
   99|      2|    EVP_add_cipher_alias(SN_rc2_cbc, "RC2");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  100|      2|    EVP_add_cipher_alias(SN_rc2_cbc, "rc2");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  101|      2|    EVP_add_cipher_alias(SN_rc2_cbc, "rc2-128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  102|      2|    EVP_add_cipher_alias(SN_rc2_64_cbc, "rc2-64");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  103|      2|    EVP_add_cipher_alias(SN_rc2_40_cbc, "rc2-40");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  104|      2|#endif
  105|       |
  106|      2|#ifndef OPENSSL_NO_BF
  107|      2|    EVP_add_cipher(EVP_bf_ecb());
  108|      2|    EVP_add_cipher(EVP_bf_cfb());
  ------------------
  |  |  999|      2|#  define EVP_bf_cfb EVP_bf_cfb64
  ------------------
  109|      2|    EVP_add_cipher(EVP_bf_ofb());
  110|      2|    EVP_add_cipher(EVP_bf_cbc());
  111|      2|    EVP_add_cipher_alias(SN_bf_cbc, "BF");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  112|      2|    EVP_add_cipher_alias(SN_bf_cbc, "bf");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  113|      2|    EVP_add_cipher_alias(SN_bf_cbc, "blowfish");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  114|      2|#endif
  115|       |
  116|      2|#ifndef OPENSSL_NO_CAST
  117|      2|    EVP_add_cipher(EVP_cast5_ecb());
  118|      2|    EVP_add_cipher(EVP_cast5_cfb());
  ------------------
  |  | 1006|      2|#  define EVP_cast5_cfb EVP_cast5_cfb64
  ------------------
  119|      2|    EVP_add_cipher(EVP_cast5_ofb());
  120|      2|    EVP_add_cipher(EVP_cast5_cbc());
  121|      2|    EVP_add_cipher_alias(SN_cast5_cbc, "CAST");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  122|      2|    EVP_add_cipher_alias(SN_cast5_cbc, "cast");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  123|      2|    EVP_add_cipher_alias(SN_cast5_cbc, "CAST-cbc");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  124|      2|    EVP_add_cipher_alias(SN_cast5_cbc, "cast-cbc");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  125|      2|#endif
  126|       |
  127|      2|#ifndef OPENSSL_NO_RC5
  128|      2|    EVP_add_cipher(EVP_rc5_32_12_16_ecb());
  129|      2|    EVP_add_cipher(EVP_rc5_32_12_16_cfb());
  ------------------
  |  | 1013|      2|#  define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
  ------------------
  130|      2|    EVP_add_cipher(EVP_rc5_32_12_16_ofb());
  131|      2|    EVP_add_cipher(EVP_rc5_32_12_16_cbc());
  132|      2|    EVP_add_cipher_alias(SN_rc5_cbc, "rc5");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  133|      2|    EVP_add_cipher_alias(SN_rc5_cbc, "RC5");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  134|      2|#endif
  135|       |
  136|      2|    EVP_add_cipher(EVP_aes_128_ecb());
  137|      2|    EVP_add_cipher(EVP_aes_128_cbc());
  138|      2|    EVP_add_cipher(EVP_aes_128_cfb());
  ------------------
  |  | 1021|      2|# define EVP_aes_128_cfb EVP_aes_128_cfb128
  ------------------
  139|      2|    EVP_add_cipher(EVP_aes_128_cfb1());
  140|      2|    EVP_add_cipher(EVP_aes_128_cfb8());
  141|      2|    EVP_add_cipher(EVP_aes_128_ofb());
  142|      2|    EVP_add_cipher(EVP_aes_128_ctr());
  143|      2|    EVP_add_cipher(EVP_aes_128_gcm());
  144|      2|#ifndef OPENSSL_NO_OCB
  145|      2|    EVP_add_cipher(EVP_aes_128_ocb());
  146|      2|#endif
  147|      2|    EVP_add_cipher(EVP_aes_128_xts());
  148|      2|    EVP_add_cipher(EVP_aes_128_ccm());
  149|      2|    EVP_add_cipher(EVP_aes_128_wrap());
  150|      2|    EVP_add_cipher_alias(SN_id_aes128_wrap, "aes128-wrap");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  151|      2|    EVP_add_cipher(EVP_aes_128_wrap_pad());
  152|      2|    EVP_add_cipher_alias(SN_id_aes128_wrap_pad, "aes128-wrap-pad");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  153|      2|    EVP_add_cipher_alias(SN_aes_128_cbc, "AES128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  154|      2|    EVP_add_cipher_alias(SN_aes_128_cbc, "aes128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  155|      2|    EVP_add_cipher(EVP_aes_192_ecb());
  156|      2|    EVP_add_cipher(EVP_aes_192_cbc());
  157|      2|    EVP_add_cipher(EVP_aes_192_cfb());
  ------------------
  |  | 1037|      2|# define EVP_aes_192_cfb EVP_aes_192_cfb128
  ------------------
  158|      2|    EVP_add_cipher(EVP_aes_192_cfb1());
  159|      2|    EVP_add_cipher(EVP_aes_192_cfb8());
  160|      2|    EVP_add_cipher(EVP_aes_192_ofb());
  161|      2|    EVP_add_cipher(EVP_aes_192_ctr());
  162|      2|    EVP_add_cipher(EVP_aes_192_gcm());
  163|      2|#ifndef OPENSSL_NO_OCB
  164|      2|    EVP_add_cipher(EVP_aes_192_ocb());
  165|      2|#endif
  166|      2|    EVP_add_cipher(EVP_aes_192_ccm());
  167|      2|    EVP_add_cipher(EVP_aes_192_wrap());
  168|      2|    EVP_add_cipher_alias(SN_id_aes192_wrap, "aes192-wrap");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  169|      2|    EVP_add_cipher(EVP_aes_192_wrap_pad());
  170|      2|    EVP_add_cipher_alias(SN_id_aes192_wrap_pad, "aes192-wrap-pad");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  171|      2|    EVP_add_cipher_alias(SN_aes_192_cbc, "AES192");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  172|      2|    EVP_add_cipher_alias(SN_aes_192_cbc, "aes192");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  173|      2|    EVP_add_cipher(EVP_aes_256_ecb());
  174|      2|    EVP_add_cipher(EVP_aes_256_cbc());
  175|      2|    EVP_add_cipher(EVP_aes_256_cfb());
  ------------------
  |  | 1052|      2|# define EVP_aes_256_cfb EVP_aes_256_cfb128
  ------------------
  176|      2|    EVP_add_cipher(EVP_aes_256_cfb1());
  177|      2|    EVP_add_cipher(EVP_aes_256_cfb8());
  178|      2|    EVP_add_cipher(EVP_aes_256_ofb());
  179|      2|    EVP_add_cipher(EVP_aes_256_ctr());
  180|      2|    EVP_add_cipher(EVP_aes_256_gcm());
  181|      2|#ifndef OPENSSL_NO_OCB
  182|      2|    EVP_add_cipher(EVP_aes_256_ocb());
  183|      2|#endif
  184|      2|    EVP_add_cipher(EVP_aes_256_xts());
  185|      2|    EVP_add_cipher(EVP_aes_256_ccm());
  186|      2|    EVP_add_cipher(EVP_aes_256_wrap());
  187|      2|    EVP_add_cipher_alias(SN_id_aes256_wrap, "aes256-wrap");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  188|      2|    EVP_add_cipher(EVP_aes_256_wrap_pad());
  189|      2|    EVP_add_cipher_alias(SN_id_aes256_wrap_pad, "aes256-wrap-pad");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  190|      2|    EVP_add_cipher_alias(SN_aes_256_cbc, "AES256");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  191|      2|    EVP_add_cipher_alias(SN_aes_256_cbc, "aes256");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  192|      2|    EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
  193|      2|    EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
  194|      2|    EVP_add_cipher(EVP_aes_128_cbc_hmac_sha256());
  195|      2|    EVP_add_cipher(EVP_aes_256_cbc_hmac_sha256());
  196|      2|#ifndef OPENSSL_NO_ARIA
  197|      2|    EVP_add_cipher(EVP_aria_128_ecb());
  198|      2|    EVP_add_cipher(EVP_aria_128_cbc());
  199|      2|    EVP_add_cipher(EVP_aria_128_cfb());
  ------------------
  |  | 1073|      2|#  define EVP_aria_128_cfb EVP_aria_128_cfb128
  ------------------
  200|      2|    EVP_add_cipher(EVP_aria_128_cfb1());
  201|      2|    EVP_add_cipher(EVP_aria_128_cfb8());
  202|      2|    EVP_add_cipher(EVP_aria_128_ctr());
  203|      2|    EVP_add_cipher(EVP_aria_128_ofb());
  204|      2|    EVP_add_cipher(EVP_aria_128_gcm());
  205|      2|    EVP_add_cipher(EVP_aria_128_ccm());
  206|      2|    EVP_add_cipher_alias(SN_aria_128_cbc, "ARIA128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  207|      2|    EVP_add_cipher_alias(SN_aria_128_cbc, "aria128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  208|      2|    EVP_add_cipher(EVP_aria_192_ecb());
  209|      2|    EVP_add_cipher(EVP_aria_192_cbc());
  210|      2|    EVP_add_cipher(EVP_aria_192_cfb());
  ------------------
  |  | 1083|      2|#  define EVP_aria_192_cfb EVP_aria_192_cfb128
  ------------------
  211|      2|    EVP_add_cipher(EVP_aria_192_cfb1());
  212|      2|    EVP_add_cipher(EVP_aria_192_cfb8());
  213|      2|    EVP_add_cipher(EVP_aria_192_ctr());
  214|      2|    EVP_add_cipher(EVP_aria_192_ofb());
  215|      2|    EVP_add_cipher(EVP_aria_192_gcm());
  216|      2|    EVP_add_cipher(EVP_aria_192_ccm());
  217|      2|    EVP_add_cipher_alias(SN_aria_192_cbc, "ARIA192");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  218|      2|    EVP_add_cipher_alias(SN_aria_192_cbc, "aria192");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  219|      2|    EVP_add_cipher(EVP_aria_256_ecb());
  220|      2|    EVP_add_cipher(EVP_aria_256_cbc());
  221|      2|    EVP_add_cipher(EVP_aria_256_cfb());
  ------------------
  |  | 1093|      2|#  define EVP_aria_256_cfb EVP_aria_256_cfb128
  ------------------
  222|      2|    EVP_add_cipher(EVP_aria_256_cfb1());
  223|      2|    EVP_add_cipher(EVP_aria_256_cfb8());
  224|      2|    EVP_add_cipher(EVP_aria_256_ctr());
  225|      2|    EVP_add_cipher(EVP_aria_256_ofb());
  226|      2|    EVP_add_cipher(EVP_aria_256_gcm());
  227|      2|    EVP_add_cipher(EVP_aria_256_ccm());
  228|      2|    EVP_add_cipher_alias(SN_aria_256_cbc, "ARIA256");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  229|      2|    EVP_add_cipher_alias(SN_aria_256_cbc, "aria256");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  230|      2|#endif
  231|       |
  232|      2|#ifndef OPENSSL_NO_CAMELLIA
  233|      2|    EVP_add_cipher(EVP_camellia_128_ecb());
  234|      2|    EVP_add_cipher(EVP_camellia_128_cbc());
  235|      2|    EVP_add_cipher(EVP_camellia_128_cfb());
  ------------------
  |  | 1105|      2|#  define EVP_camellia_128_cfb EVP_camellia_128_cfb128
  ------------------
  236|      2|    EVP_add_cipher(EVP_camellia_128_cfb1());
  237|      2|    EVP_add_cipher(EVP_camellia_128_cfb8());
  238|      2|    EVP_add_cipher(EVP_camellia_128_ofb());
  239|      2|    EVP_add_cipher_alias(SN_camellia_128_cbc, "CAMELLIA128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  240|      2|    EVP_add_cipher_alias(SN_camellia_128_cbc, "camellia128");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  241|      2|    EVP_add_cipher(EVP_camellia_192_ecb());
  242|      2|    EVP_add_cipher(EVP_camellia_192_cbc());
  243|      2|    EVP_add_cipher(EVP_camellia_192_cfb());
  ------------------
  |  | 1113|      2|#  define EVP_camellia_192_cfb EVP_camellia_192_cfb128
  ------------------
  244|      2|    EVP_add_cipher(EVP_camellia_192_cfb1());
  245|      2|    EVP_add_cipher(EVP_camellia_192_cfb8());
  246|      2|    EVP_add_cipher(EVP_camellia_192_ofb());
  247|      2|    EVP_add_cipher_alias(SN_camellia_192_cbc, "CAMELLIA192");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  248|      2|    EVP_add_cipher_alias(SN_camellia_192_cbc, "camellia192");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  249|      2|    EVP_add_cipher(EVP_camellia_256_ecb());
  250|      2|    EVP_add_cipher(EVP_camellia_256_cbc());
  251|      2|    EVP_add_cipher(EVP_camellia_256_cfb());
  ------------------
  |  | 1121|      2|#  define EVP_camellia_256_cfb EVP_camellia_256_cfb128
  ------------------
  252|      2|    EVP_add_cipher(EVP_camellia_256_cfb1());
  253|      2|    EVP_add_cipher(EVP_camellia_256_cfb8());
  254|      2|    EVP_add_cipher(EVP_camellia_256_ofb());
  255|      2|    EVP_add_cipher_alias(SN_camellia_256_cbc, "CAMELLIA256");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  256|      2|    EVP_add_cipher_alias(SN_camellia_256_cbc, "camellia256");
  ------------------
  |  |  682|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
  257|      2|    EVP_add_cipher(EVP_camellia_128_ctr());
  258|      2|    EVP_add_cipher(EVP_camellia_192_ctr());
  259|      2|    EVP_add_cipher(EVP_camellia_256_ctr());
  260|      2|#endif
  261|       |
  262|      2|#ifndef OPENSSL_NO_CHACHA
  263|      2|    EVP_add_cipher(EVP_chacha20());
  264|      2|# ifndef OPENSSL_NO_POLY1305
  265|      2|    EVP_add_cipher(EVP_chacha20_poly1305());
  266|      2|# endif
  267|      2|#endif
  268|      2|}

openssl_add_all_digests_int:
   18|      2|{
   19|      2|#ifndef OPENSSL_NO_MD4
   20|      2|    EVP_add_digest(EVP_md4());
   21|      2|#endif
   22|      2|#ifndef OPENSSL_NO_MD5
   23|      2|    EVP_add_digest(EVP_md5());
   24|      2|    EVP_add_digest_alias(SN_md5, "ssl3-md5");
  ------------------
  |  |  684|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   25|      2|    EVP_add_digest(EVP_md5_sha1());
   26|      2|#endif
   27|      2|    EVP_add_digest(EVP_sha1());
   28|      2|    EVP_add_digest_alias(SN_sha1, "ssl3-sha1");
  ------------------
  |  |  684|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   29|      2|    EVP_add_digest_alias(SN_sha1WithRSAEncryption, SN_sha1WithRSA);
  ------------------
  |  |  684|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   30|      2|#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
   31|      2|    EVP_add_digest(EVP_mdc2());
   32|      2|#endif
   33|      2|#ifndef OPENSSL_NO_RMD160
   34|      2|    EVP_add_digest(EVP_ripemd160());
   35|      2|    EVP_add_digest_alias(SN_ripemd160, "ripemd");
  ------------------
  |  |  684|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   36|      2|    EVP_add_digest_alias(SN_ripemd160, "rmd160");
  ------------------
  |  |  684|      2|        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  |  |  ------------------
  |  |                       OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
  |  |  ------------------
  |  |  |  |   33|      2|# define OBJ_NAME_ALIAS                  0x8000
  |  |  ------------------
  ------------------
   37|      2|#endif
   38|      2|    EVP_add_digest(EVP_sha224());
   39|      2|    EVP_add_digest(EVP_sha256());
   40|      2|    EVP_add_digest(EVP_sha384());
   41|      2|    EVP_add_digest(EVP_sha512());
   42|      2|    EVP_add_digest(EVP_sha512_224());
   43|      2|    EVP_add_digest(EVP_sha512_256());
   44|      2|#ifndef OPENSSL_NO_WHIRLPOOL
   45|      2|    EVP_add_digest(EVP_whirlpool());
   46|      2|#endif
   47|      2|#ifndef OPENSSL_NO_SM3
   48|      2|    EVP_add_digest(EVP_sm3());
   49|      2|#endif
   50|      2|#ifndef OPENSSL_NO_BLAKE2
   51|      2|    EVP_add_digest(EVP_blake2b512());
   52|      2|    EVP_add_digest(EVP_blake2s256());
   53|      2|#endif
   54|      2|    EVP_add_digest(EVP_sha3_224());
   55|      2|    EVP_add_digest(EVP_sha3_256());
   56|      2|    EVP_add_digest(EVP_sha3_384());
   57|      2|    EVP_add_digest(EVP_sha3_512());
   58|      2|    EVP_add_digest(EVP_shake128());
   59|      2|    EVP_add_digest(EVP_shake256());
   60|      2|}

evp_md_ctx_clear_digest:
   44|  7.34k|{
   45|  7.34k|    if (ctx->algctx != NULL) {
  ------------------
  |  Branch (45:9): [True: 7.34k, False: 0]
  ------------------
   46|  7.34k|        if (ctx->digest != NULL && ctx->digest->freectx != NULL)
  ------------------
  |  Branch (46:13): [True: 7.34k, False: 0]
  |  Branch (46:36): [True: 7.34k, False: 0]
  ------------------
   47|  7.34k|            ctx->digest->freectx(ctx->algctx);
   48|  7.34k|        ctx->algctx = NULL;
   49|  7.34k|        EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
  ------------------
  |  |  199|  7.34k|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
   50|  7.34k|    }
   51|       |
   52|       |    /* Code below to be removed when legacy support is dropped. */
   53|       |
   54|       |    /*
   55|       |     * Don't assume ctx->md_data was cleaned in EVP_Digest_Final, because
   56|       |     * sometimes only copies of the context are ever finalised.
   57|       |     */
   58|  7.34k|    cleanup_old_md_data(ctx, force);
   59|  7.34k|    if (force)
  ------------------
  |  Branch (59:9): [True: 0, False: 7.34k]
  ------------------
   60|      0|        ctx->digest = NULL;
   61|       |
   62|  7.34k|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_ENGINE)
   63|  7.34k|    ENGINE_finish(ctx->engine);
   64|  7.34k|    ctx->engine = NULL;
   65|  7.34k|#endif
   66|       |
   67|       |    /* Non legacy code, this has to be later than the ctx->digest cleaning */
   68|  7.34k|    if (!keep_fetched) {
  ------------------
  |  Branch (68:9): [True: 7.34k, False: 0]
  ------------------
   69|  7.34k|        EVP_MD_free(ctx->fetched_digest);
   70|  7.34k|        ctx->fetched_digest = NULL;
   71|  7.34k|        ctx->reqdigest = NULL;
   72|  7.34k|    }
   73|  7.34k|}
EVP_MD_CTX_reset:
  100|  7.34k|{
  101|  7.34k|    return evp_md_ctx_reset_ex(ctx, 0);
  102|  7.34k|}
EVP_MD_CTX_new:
  131|  7.34k|{
  132|  7.34k|    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  ------------------
  |  |   99|  7.34k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  7.34k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  7.34k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  133|  7.34k|}
EVP_MD_CTX_free:
  136|  8.62k|{
  137|  8.62k|    if (ctx == NULL)
  ------------------
  |  Branch (137:9): [True: 1.28k, False: 7.34k]
  ------------------
  138|  1.28k|        return;
  139|       |
  140|  7.34k|    EVP_MD_CTX_reset(ctx);
  141|  7.34k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  7.34k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  7.34k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  7.34k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  142|  7.34k|}
evp_md_ctx_free_algctx:
  145|  7.34k|{
  146|  7.34k|    if (ctx->algctx != NULL) {
  ------------------
  |  Branch (146:9): [True: 0, False: 7.34k]
  ------------------
  147|      0|        if (!ossl_assert(ctx->digest != NULL)) {
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  149|      0|            return 0;
  150|      0|        }
  151|      0|        if (ctx->digest->freectx != NULL)
  ------------------
  |  Branch (151:13): [True: 0, False: 0]
  ------------------
  152|      0|            ctx->digest->freectx(ctx->algctx);
  153|      0|        ctx->algctx = NULL;
  154|      0|    }
  155|  7.34k|    return 1;
  156|  7.34k|}
EVP_DigestInit_ex:
  382|  7.34k|{
  383|  7.34k|    return evp_md_init_internal(ctx, type, NULL, impl);
  384|  7.34k|}
EVP_DigestUpdate:
  387|  7.34k|{
  388|  7.34k|    if (count == 0)
  ------------------
  |  Branch (388:9): [True: 0, False: 7.34k]
  ------------------
  389|      0|        return 1;
  390|       |
  391|  7.34k|    if ((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0) {
  ------------------
  |  |   33|  7.34k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  |  Branch (391:9): [True: 0, False: 7.34k]
  ------------------
  392|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_UPDATE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  393|      0|        return 0;
  394|      0|    }
  395|       |
  396|  7.34k|    if (ctx->pctx != NULL
  ------------------
  |  Branch (396:9): [True: 0, False: 7.34k]
  ------------------
  397|  7.34k|            && EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx->pctx)
  ------------------
  |  |  731|  7.34k|    ((ctx)->operation == EVP_PKEY_OP_SIGN \
  |  |  ------------------
  |  |  |  | 1691|      0|# define EVP_PKEY_OP_SIGN                (1<<4)
  |  |  ------------------
  |  |  |  Branch (731:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|     || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
  |  |  ------------------
  |  |  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  |  |  ------------------
  |  |  |  Branch (732:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  733|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFY \
  |  |  ------------------
  |  |  |  | 1692|      0|# define EVP_PKEY_OP_VERIFY              (1<<5)
  |  |  ------------------
  |  |  |  Branch (733:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  734|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
  |  |  ------------------
  |  |  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  |  |  ------------------
  |  |  |  Branch (734:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  735|  7.34k|     || (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
  |  |  ------------------
  |  |  |  | 1693|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1<<6)
  |  |  ------------------
  |  |  |  Branch (735:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  398|  7.34k|            && ctx->pctx->op.sig.algctx != NULL) {
  ------------------
  |  Branch (398:16): [True: 0, False: 0]
  ------------------
  399|       |        /*
  400|       |         * Prior to OpenSSL 3.0 EVP_DigestSignUpdate() and
  401|       |         * EVP_DigestVerifyUpdate() were just macros for EVP_DigestUpdate().
  402|       |         * Some code calls EVP_DigestUpdate() directly even when initialised
  403|       |         * with EVP_DigestSignInit_ex() or
  404|       |         * EVP_DigestVerifyInit_ex(), so we detect that and redirect to
  405|       |         * the correct EVP_Digest*Update() function
  406|       |         */
  407|      0|        if (ctx->pctx->operation == EVP_PKEY_OP_SIGNCTX)
  ------------------
  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  ------------------
  |  Branch (407:13): [True: 0, False: 0]
  ------------------
  408|      0|            return EVP_DigestSignUpdate(ctx, data, count);
  409|      0|        if (ctx->pctx->operation == EVP_PKEY_OP_VERIFYCTX)
  ------------------
  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  ------------------
  410|      0|            return EVP_DigestVerifyUpdate(ctx, data, count);
  411|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_UPDATE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  412|      0|        return 0;
  413|      0|    }
  414|       |
  415|  7.34k|    if (ctx->digest == NULL
  ------------------
  |  Branch (415:9): [True: 0, False: 7.34k]
  ------------------
  416|  7.34k|            || ctx->digest->prov == NULL
  ------------------
  |  Branch (416:16): [True: 0, False: 7.34k]
  ------------------
  417|  7.34k|            || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0)
  ------------------
  |  |  221|  7.34k|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (417:16): [True: 0, False: 7.34k]
  ------------------
  418|      0|        goto legacy;
  419|       |
  420|  7.34k|    if (ctx->digest->dupdate == NULL) {
  ------------------
  |  Branch (420:9): [True: 0, False: 7.34k]
  ------------------
  421|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_UPDATE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  422|      0|        return 0;
  423|      0|    }
  424|  7.34k|    return ctx->digest->dupdate(ctx->algctx, data, count);
  425|       |
  426|       |    /* Code below to be removed when legacy support is dropped. */
  427|      0| legacy:
  428|      0|    return ctx->update(ctx, data, count);
  429|  7.34k|}
EVP_DigestFinal_ex:
  442|  7.33k|{
  443|  7.33k|    int ret, sz;
  444|  7.33k|    size_t size = 0;
  445|  7.33k|    size_t mdsize = 0;
  446|       |
  447|  7.33k|    if (ctx->digest == NULL)
  ------------------
  |  Branch (447:9): [True: 0, False: 7.33k]
  ------------------
  448|      0|        return 0;
  449|       |
  450|  7.33k|    sz = EVP_MD_get_size(ctx->digest);
  451|  7.33k|    if (sz < 0)
  ------------------
  |  Branch (451:9): [True: 0, False: 7.33k]
  ------------------
  452|      0|        return 0;
  453|  7.33k|    mdsize = sz;
  454|  7.33k|    if (ctx->digest->prov == NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 7.33k]
  ------------------
  455|      0|        goto legacy;
  456|       |
  457|  7.33k|    if (ctx->digest->dfinal == NULL) {
  ------------------
  |  Branch (457:9): [True: 0, False: 7.33k]
  ------------------
  458|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  459|      0|        return 0;
  460|      0|    }
  461|       |
  462|  7.33k|    if ((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0) {
  ------------------
  |  |   33|  7.33k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  |  Branch (462:9): [True: 0, False: 7.33k]
  ------------------
  463|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  464|      0|        return 0;
  465|      0|    }
  466|       |
  467|  7.33k|    ret = ctx->digest->dfinal(ctx->algctx, md, &size, mdsize);
  468|       |
  469|  7.33k|    ctx->flags |= EVP_MD_CTX_FLAG_FINALISED;
  ------------------
  |  |   33|  7.33k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  470|       |
  471|  7.33k|    if (isize != NULL) {
  ------------------
  |  Branch (471:9): [True: 0, False: 7.33k]
  ------------------
  472|      0|        if (size <= UINT_MAX) {
  ------------------
  |  Branch (472:13): [True: 0, False: 0]
  ------------------
  473|      0|            *isize = (unsigned int)size;
  474|      0|        } else {
  475|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  476|      0|            ret = 0;
  477|      0|        }
  478|      0|    }
  479|       |
  480|  7.33k|    return ret;
  481|       |
  482|       |    /* Code below to be removed when legacy support is dropped. */
  483|      0| legacy:
  484|      0|    OPENSSL_assert(mdsize <= EVP_MAX_MD_SIZE);
  ------------------
  |  |  421|      0|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  485|      0|    ret = ctx->digest->final(ctx, md);
  486|      0|    if (isize != NULL)
  ------------------
  |  Branch (486:9): [True: 0, False: 0]
  ------------------
  487|      0|        *isize = mdsize;
  488|      0|    if (ctx->digest->cleanup) {
  ------------------
  |  Branch (488:9): [True: 0, False: 0]
  ------------------
  489|      0|        ctx->digest->cleanup(ctx);
  490|      0|        EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
  ------------------
  |  |  199|      0|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  491|      0|    }
  492|      0|    OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
  493|      0|    return ret;
  494|  7.33k|}
EVP_DigestFinalXOF:
  497|      2|{
  498|      2|    int ret = 0;
  499|      2|    OSSL_PARAM params[2];
  500|      2|    size_t i = 0;
  501|       |
  502|      2|    if (ctx->digest == NULL) {
  ------------------
  |  Branch (502:9): [True: 0, False: 2]
  ------------------
  503|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_NULL_ALGORITHM);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  504|      0|        return 0;
  505|      0|    }
  506|       |
  507|      2|    if (ctx->digest->prov == NULL)
  ------------------
  |  Branch (507:9): [True: 0, False: 2]
  ------------------
  508|      0|        goto legacy;
  509|       |
  510|      2|    if (ctx->digest->dfinal == NULL) {
  ------------------
  |  Branch (510:9): [True: 0, False: 2]
  ------------------
  511|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  512|      0|        return 0;
  513|      0|    }
  514|       |
  515|      2|    if ((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0) {
  ------------------
  |  |   33|      2|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  |  Branch (515:9): [True: 0, False: 2]
  ------------------
  516|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  517|      0|        return 0;
  518|      0|    }
  519|       |
  520|      2|    params[i++] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN, &size);
  ------------------
  |  |  201|      2|# define OSSL_DIGEST_PARAM_XOFLEN "xoflen"
  ------------------
  521|      2|    params[i++] = OSSL_PARAM_construct_end();
  522|       |
  523|      2|    if (EVP_MD_CTX_set_params(ctx, params) > 0)
  ------------------
  |  Branch (523:9): [True: 2, False: 0]
  ------------------
  524|      2|        ret = ctx->digest->dfinal(ctx->algctx, md, &size, size);
  525|       |
  526|      2|    ctx->flags |= EVP_MD_CTX_FLAG_FINALISED;
  ------------------
  |  |   33|      2|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  527|       |
  528|      2|    return ret;
  529|       |
  530|      0|legacy:
  531|      0|    if (ctx->digest->flags & EVP_MD_FLAG_XOF
  ------------------
  |  |  161|      0|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
  |  Branch (531:9): [True: 0, False: 0]
  ------------------
  532|      0|        && size <= INT_MAX
  ------------------
  |  Branch (532:12): [True: 0, False: 0]
  ------------------
  533|      0|        && ctx->digest->md_ctrl(ctx, EVP_MD_CTRL_XOF_LEN, (int)size, NULL)) {
  ------------------
  |  |  186|      0|#  define EVP_MD_CTRL_XOF_LEN                     0x3
  ------------------
  |  Branch (533:12): [True: 0, False: 0]
  ------------------
  534|      0|        ret = ctx->digest->final(ctx, md);
  535|      0|        if (ctx->digest->cleanup != NULL) {
  ------------------
  |  Branch (535:13): [True: 0, False: 0]
  ------------------
  536|      0|            ctx->digest->cleanup(ctx);
  537|      0|            EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
  ------------------
  |  |  199|      0|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  538|      0|        }
  539|      0|        OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
  540|      0|    } else {
  541|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_NOT_XOF_OR_INVALID_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  542|      0|    }
  543|       |
  544|      0|    return ret;
  545|      2|}
EVP_Digest:
  688|  7.33k|{
  689|  7.33k|    EVP_MD_CTX *ctx = EVP_MD_CTX_new();
  690|  7.33k|    int ret;
  691|       |
  692|  7.33k|    if (ctx == NULL)
  ------------------
  |  Branch (692:9): [True: 0, False: 7.33k]
  ------------------
  693|      0|        return 0;
  694|  7.33k|    EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);
  ------------------
  |  |  197|  7.33k|# define EVP_MD_CTX_FLAG_ONESHOT         0x0001/* digest update will be
  ------------------
  695|  7.33k|    ret = EVP_DigestInit_ex(ctx, type, impl)
  ------------------
  |  Branch (695:11): [True: 7.33k, False: 0]
  ------------------
  696|  7.33k|        && EVP_DigestUpdate(ctx, data, count)
  ------------------
  |  Branch (696:12): [True: 7.33k, False: 0]
  ------------------
  697|  7.33k|        && EVP_DigestFinal_ex(ctx, md, size);
  ------------------
  |  Branch (697:12): [True: 7.33k, False: 0]
  ------------------
  698|  7.33k|    EVP_MD_CTX_free(ctx);
  699|       |
  700|  7.33k|    return ret;
  701|  7.33k|}
EVP_MD_CTX_set_params:
  736|      2|{
  737|      2|    EVP_PKEY_CTX *pctx = ctx->pctx;
  738|       |
  739|       |    /* If we have a pctx then we should try that first */
  740|      2|    if (pctx != NULL
  ------------------
  |  Branch (740:9): [True: 0, False: 2]
  ------------------
  741|      2|            && (pctx->operation == EVP_PKEY_OP_VERIFYCTX
  ------------------
  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  ------------------
  |  Branch (741:17): [True: 0, False: 0]
  ------------------
  742|      0|                || pctx->operation == EVP_PKEY_OP_SIGNCTX)
  ------------------
  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  ------------------
  |  Branch (742:20): [True: 0, False: 0]
  ------------------
  743|      2|            && pctx->op.sig.algctx != NULL
  ------------------
  |  Branch (743:16): [True: 0, False: 0]
  ------------------
  744|      2|            && pctx->op.sig.signature->set_ctx_md_params != NULL)
  ------------------
  |  Branch (744:16): [True: 0, False: 0]
  ------------------
  745|      0|        return pctx->op.sig.signature->set_ctx_md_params(pctx->op.sig.algctx,
  746|      0|                                                         params);
  747|       |
  748|      2|    if (ctx->digest != NULL && ctx->digest->set_ctx_params != NULL)
  ------------------
  |  Branch (748:9): [True: 2, False: 0]
  |  Branch (748:32): [True: 2, False: 0]
  ------------------
  749|      2|        return ctx->digest->set_ctx_params(ctx->algctx, params);
  750|       |
  751|      0|    return 0;
  752|      2|}
evp_md_new:
  901|     27|{
  902|     27|    EVP_MD *md = OPENSSL_zalloc(sizeof(*md));
  ------------------
  |  |   99|     27|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  903|       |
  904|     27|    if (md != NULL && !CRYPTO_NEW_REF(&md->refcnt, 1)) {
  ------------------
  |  Branch (904:9): [True: 27, False: 0]
  |  Branch (904:23): [True: 0, False: 27]
  ------------------
  905|      0|        OPENSSL_free(md);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  906|      0|        return NULL;
  907|      0|    }
  908|     27|    return md;
  909|     27|}
EVP_MD_fetch:
 1106|  7.34k|{
 1107|  7.34k|    EVP_MD *md =
 1108|  7.34k|        evp_generic_fetch(ctx, OSSL_OP_DIGEST, algorithm, properties,
  ------------------
  |  |  254|  7.34k|# define OSSL_OP_DIGEST                              1
  ------------------
 1109|  7.34k|                          evp_md_from_algorithm, evp_md_up_ref, evp_md_free);
 1110|       |
 1111|  7.34k|    return md;
 1112|  7.34k|}
EVP_MD_up_ref:
 1115|  14.7k|{
 1116|  14.7k|    int ref = 0;
 1117|       |
 1118|  14.7k|    if (md->origin == EVP_ORIG_DYNAMIC)
  ------------------
  |  |  251|  14.7k|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (1118:9): [True: 14.7k, False: 0]
  ------------------
 1119|  14.7k|        CRYPTO_UP_REF(&md->refcnt, &ref);
 1120|  14.7k|    return 1;
 1121|  14.7k|}
EVP_MD_free:
 1124|  22.0k|{
 1125|  22.0k|    int i;
 1126|       |
 1127|  22.0k|    if (md == NULL || md->origin != EVP_ORIG_DYNAMIC)
  ------------------
  |  |  251|  14.7k|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (1127:9): [True: 7.34k, False: 14.7k]
  |  Branch (1127:23): [True: 0, False: 14.7k]
  ------------------
 1128|  7.34k|        return;
 1129|       |
 1130|  14.7k|    CRYPTO_DOWN_REF(&md->refcnt, &i);
 1131|  14.7k|    if (i > 0)
  ------------------
  |  Branch (1131:9): [True: 14.7k, False: 27]
  ------------------
 1132|  14.7k|        return;
 1133|     27|    evp_md_free_int(md);
 1134|     27|}
digest.c:cleanup_old_md_data:
   29|  14.6k|{
   30|  14.6k|    if (ctx->digest != NULL) {
  ------------------
  |  Branch (30:9): [True: 7.34k, False: 7.34k]
  ------------------
   31|  7.34k|        if (ctx->digest->cleanup != NULL
  ------------------
  |  Branch (31:13): [True: 0, False: 7.34k]
  ------------------
   32|  7.34k|                && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED))
  ------------------
  |  |  199|      0|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  |  Branch (32:20): [True: 0, False: 0]
  ------------------
   33|      0|            ctx->digest->cleanup(ctx);
   34|  7.34k|        if (ctx->md_data != NULL && ctx->digest->ctx_size > 0
  ------------------
  |  Branch (34:13): [True: 0, False: 7.34k]
  |  Branch (34:37): [True: 0, False: 0]
  ------------------
   35|  7.34k|                && (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)
  ------------------
  |  |  201|      0|# define EVP_MD_CTX_FLAG_REUSE           0x0004/* Don't free up ctx->md_data
  ------------------
  |  Branch (35:21): [True: 0, False: 0]
  ------------------
   36|      0|                    || force)) {
  ------------------
  |  Branch (36:24): [True: 0, False: 0]
  ------------------
   37|      0|            OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);
  ------------------
  |  |  105|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   38|      0|            ctx->md_data = NULL;
   39|      0|        }
   40|  7.34k|    }
   41|  14.6k|}
digest.c:evp_md_ctx_reset_ex:
   76|  7.34k|{
   77|  7.34k|    if (ctx == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 7.34k]
  ------------------
   78|      0|        return 1;
   79|       |
   80|  7.34k|#ifndef FIPS_MODULE
   81|       |    /*
   82|       |     * pctx should be freed by the user of EVP_MD_CTX
   83|       |     * if EVP_MD_CTX_FLAG_KEEP_PKEY_CTX is set
   84|       |     */
   85|  7.34k|    if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX)) {
  ------------------
  |  |   32|  7.34k|#define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX   0x0400
  ------------------
  |  Branch (85:9): [True: 7.34k, False: 0]
  ------------------
   86|  7.34k|        EVP_PKEY_CTX_free(ctx->pctx);
   87|  7.34k|        ctx->pctx = NULL;
   88|  7.34k|    }
   89|  7.34k|#endif
   90|       |
   91|  7.34k|    evp_md_ctx_clear_digest(ctx, 0, keep_fetched);
   92|  7.34k|    if (!keep_fetched)
  ------------------
  |  Branch (92:9): [True: 7.34k, False: 0]
  ------------------
   93|  7.34k|        OPENSSL_cleanse(ctx, sizeof(*ctx));
   94|       |
   95|  7.34k|    return 1;
   96|  7.34k|}
digest.c:evp_md_init_internal:
  160|  7.34k|{
  161|  7.34k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  162|  7.34k|    ENGINE *tmpimpl = NULL;
  163|  7.34k|#endif
  164|       |
  165|  7.34k|#if !defined(FIPS_MODULE)
  166|  7.34k|    if (ctx->pctx != NULL
  ------------------
  |  Branch (166:9): [True: 0, False: 7.34k]
  ------------------
  167|  7.34k|            && EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx->pctx)
  ------------------
  |  |  731|  7.34k|    ((ctx)->operation == EVP_PKEY_OP_SIGN \
  |  |  ------------------
  |  |  |  | 1691|      0|# define EVP_PKEY_OP_SIGN                (1<<4)
  |  |  ------------------
  |  |  |  Branch (731:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|     || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
  |  |  ------------------
  |  |  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  |  |  ------------------
  |  |  |  Branch (732:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  733|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFY \
  |  |  ------------------
  |  |  |  | 1692|      0|# define EVP_PKEY_OP_VERIFY              (1<<5)
  |  |  ------------------
  |  |  |  Branch (733:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  734|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
  |  |  ------------------
  |  |  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  |  |  ------------------
  |  |  |  Branch (734:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  735|  7.34k|     || (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
  |  |  ------------------
  |  |  |  | 1693|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1<<6)
  |  |  ------------------
  |  |  |  Branch (735:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  168|  7.34k|            && ctx->pctx->op.sig.algctx != NULL) {
  ------------------
  |  Branch (168:16): [True: 0, False: 0]
  ------------------
  169|       |        /*
  170|       |         * Prior to OpenSSL 3.0 calling EVP_DigestInit_ex() on an mdctx
  171|       |         * previously initialised with EVP_DigestSignInit() would retain
  172|       |         * information about the key, and re-initialise for another sign
  173|       |         * operation. So in that case we redirect to EVP_DigestSignInit()
  174|       |         */
  175|      0|        if (ctx->pctx->operation == EVP_PKEY_OP_SIGNCTX)
  ------------------
  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  ------------------
  |  Branch (175:13): [True: 0, False: 0]
  ------------------
  176|      0|            return EVP_DigestSignInit(ctx, NULL, type, impl, NULL);
  177|      0|        if (ctx->pctx->operation == EVP_PKEY_OP_VERIFYCTX)
  ------------------
  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  ------------------
  |  Branch (177:13): [True: 0, False: 0]
  ------------------
  178|      0|            return EVP_DigestVerifyInit(ctx, NULL, type, impl, NULL);
  179|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_UPDATE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  180|      0|        return 0;
  181|      0|    }
  182|  7.34k|#endif
  183|       |
  184|  7.34k|    EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED
  ------------------
  |  |  199|  7.34k|# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
  ------------------
  185|  7.34k|                                | EVP_MD_CTX_FLAG_FINALISED);
  ------------------
  |  |   33|  7.34k|#define EVP_MD_CTX_FLAG_FINALISED       0x0800
  ------------------
  186|       |
  187|  7.34k|    if (type != NULL) {
  ------------------
  |  Branch (187:9): [True: 7.34k, False: 0]
  ------------------
  188|  7.34k|        ctx->reqdigest = type;
  189|  7.34k|    } else {
  190|      0|        if (ctx->digest == NULL) {
  ------------------
  |  Branch (190:13): [True: 0, False: 0]
  ------------------
  191|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_NO_DIGEST_SET);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  192|      0|            return 0;
  193|      0|        }
  194|      0|        type = ctx->digest;
  195|      0|    }
  196|       |
  197|       |    /* Code below to be removed when legacy support is dropped. */
  198|  7.34k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  199|       |    /*
  200|       |     * Whether it's nice or not, "Inits" can be used on "Final"'d contexts so
  201|       |     * this context may already have an ENGINE! Try to avoid releasing the
  202|       |     * previous handle, re-querying for an ENGINE, and having a
  203|       |     * reinitialisation, when it may all be unnecessary.
  204|       |     */
  205|  7.34k|    if (ctx->engine != NULL
  ------------------
  |  Branch (205:9): [True: 0, False: 7.34k]
  ------------------
  206|  7.34k|            && ctx->digest != NULL
  ------------------
  |  Branch (206:16): [True: 0, False: 0]
  ------------------
  207|  7.34k|            && type->type == ctx->digest->type)
  ------------------
  |  Branch (207:16): [True: 0, False: 0]
  ------------------
  208|      0|        goto skip_to_init;
  209|       |
  210|       |    /*
  211|       |     * Ensure an ENGINE left lying around from last time is cleared (the
  212|       |     * previous check attempted to avoid this if the same ENGINE and
  213|       |     * EVP_MD could be used).
  214|       |     */
  215|  7.34k|    ENGINE_finish(ctx->engine);
  216|  7.34k|    ctx->engine = NULL;
  217|       |
  218|  7.34k|    if (impl == NULL)
  ------------------
  |  Branch (218:9): [True: 7.34k, False: 0]
  ------------------
  219|  7.34k|        tmpimpl = ENGINE_get_digest_engine(type->type);
  220|  7.34k|#endif
  221|       |
  222|       |    /*
  223|       |     * If there are engines involved or EVP_MD_CTX_FLAG_NO_INIT is set then we
  224|       |     * should use legacy handling for now.
  225|       |     */
  226|  7.34k|    if (impl != NULL
  ------------------
  |  Branch (226:9): [True: 0, False: 7.34k]
  ------------------
  227|  7.34k|#if !defined(OPENSSL_NO_ENGINE)
  228|  7.34k|            || ctx->engine != NULL
  ------------------
  |  Branch (228:16): [True: 0, False: 7.34k]
  ------------------
  229|  7.34k|# if !defined(FIPS_MODULE)
  230|  7.34k|            || tmpimpl != NULL
  ------------------
  |  Branch (230:16): [True: 0, False: 7.34k]
  ------------------
  231|  7.34k|# endif
  232|  7.34k|#endif
  233|  7.34k|            || (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0
  ------------------
  |  |  221|  7.34k|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (233:16): [True: 0, False: 7.34k]
  ------------------
  234|  7.34k|            || (type != NULL && type->origin == EVP_ORIG_METH)
  ------------------
  |  |  253|  7.34k|#define EVP_ORIG_METH       2
  ------------------
  |  Branch (234:17): [True: 7.34k, False: 0]
  |  Branch (234:33): [True: 0, False: 7.34k]
  ------------------
  235|  7.34k|            || (type == NULL && ctx->digest != NULL
  ------------------
  |  Branch (235:17): [True: 0, False: 7.34k]
  |  Branch (235:33): [True: 0, False: 0]
  ------------------
  236|  7.34k|                             && ctx->digest->origin == EVP_ORIG_METH)) {
  ------------------
  |  |  253|      0|#define EVP_ORIG_METH       2
  ------------------
  |  Branch (236:33): [True: 0, False: 0]
  ------------------
  237|       |        /* If we were using provided hash before, cleanup algctx */
  238|      0|        if (!evp_md_ctx_free_algctx(ctx))
  ------------------
  |  Branch (238:13): [True: 0, False: 0]
  ------------------
  239|      0|            return 0;
  240|      0|        if (ctx->digest == ctx->fetched_digest)
  ------------------
  |  Branch (240:13): [True: 0, False: 0]
  ------------------
  241|      0|            ctx->digest = NULL;
  242|      0|        EVP_MD_free(ctx->fetched_digest);
  243|      0|        ctx->fetched_digest = NULL;
  244|      0|        goto legacy;
  245|      0|    }
  246|       |
  247|  7.34k|    cleanup_old_md_data(ctx, 1);
  248|       |
  249|       |    /* Start of non-legacy code below */
  250|  7.34k|    if (ctx->digest == type) {
  ------------------
  |  Branch (250:9): [True: 0, False: 7.34k]
  ------------------
  251|      0|        if (!ossl_assert(type->prov != NULL)) {
  ------------------
  |  |   52|      0|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      0|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (251:13): [True: 0, False: 0]
  ------------------
  252|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  253|      0|            return 0;
  254|      0|        }
  255|  7.34k|    } else {
  256|  7.34k|        if (!evp_md_ctx_free_algctx(ctx))
  ------------------
  |  Branch (256:13): [True: 0, False: 7.34k]
  ------------------
  257|      0|            return 0;
  258|  7.34k|    }
  259|       |
  260|  7.34k|    if (type->prov == NULL) {
  ------------------
  |  Branch (260:9): [True: 0, False: 7.34k]
  ------------------
  261|       |#ifdef FIPS_MODULE
  262|       |        /* We only do explicit fetches inside the FIPS module */
  263|       |        ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  264|       |        return 0;
  265|       |#else
  266|       |        /* The NULL digest is a special case */
  267|      0|        EVP_MD *provmd = EVP_MD_fetch(NULL,
  268|      0|                                      type->type != NID_undef ? OBJ_nid2sn(type->type)
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (268:39): [True: 0, False: 0]
  ------------------
  269|      0|                                                              : "NULL", "");
  270|       |
  271|      0|        if (provmd == NULL) {
  ------------------
  |  Branch (271:13): [True: 0, False: 0]
  ------------------
  272|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  273|      0|            return 0;
  274|      0|        }
  275|      0|        type = provmd;
  276|      0|        EVP_MD_free(ctx->fetched_digest);
  277|      0|        ctx->fetched_digest = provmd;
  278|      0|#endif
  279|      0|    }
  280|       |
  281|  7.34k|    if (type->prov != NULL && ctx->fetched_digest != type) {
  ------------------
  |  Branch (281:9): [True: 7.34k, False: 0]
  |  Branch (281:31): [True: 7.34k, False: 0]
  ------------------
  282|  7.34k|        if (!EVP_MD_up_ref((EVP_MD *)type)) {
  ------------------
  |  Branch (282:13): [True: 0, False: 7.34k]
  ------------------
  283|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  284|      0|            return 0;
  285|      0|        }
  286|  7.34k|        EVP_MD_free(ctx->fetched_digest);
  287|  7.34k|        ctx->fetched_digest = (EVP_MD *)type;
  288|  7.34k|    }
  289|  7.34k|    ctx->digest = type;
  290|  7.34k|    if (ctx->algctx == NULL) {
  ------------------
  |  Branch (290:9): [True: 7.34k, False: 0]
  ------------------
  291|  7.34k|        ctx->algctx = ctx->digest->newctx(ossl_provider_ctx(type->prov));
  292|  7.34k|        if (ctx->algctx == NULL) {
  ------------------
  |  Branch (292:13): [True: 0, False: 7.34k]
  ------------------
  293|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  294|      0|            return 0;
  295|      0|        }
  296|  7.34k|    }
  297|       |
  298|  7.34k|    if (ctx->digest->dinit == NULL) {
  ------------------
  |  Branch (298:9): [True: 0, False: 7.34k]
  ------------------
  299|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  300|      0|        return 0;
  301|      0|    }
  302|       |
  303|  7.34k|    return ctx->digest->dinit(ctx->algctx, params);
  304|       |
  305|       |    /* Code below to be removed when legacy support is dropped. */
  306|      0| legacy:
  307|       |
  308|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  309|      0|    if (type) {
  ------------------
  |  Branch (309:9): [True: 0, False: 0]
  ------------------
  310|      0|        if (impl != NULL) {
  ------------------
  |  Branch (310:13): [True: 0, False: 0]
  ------------------
  311|      0|            if (!ENGINE_init(impl)) {
  ------------------
  |  Branch (311:17): [True: 0, False: 0]
  ------------------
  312|      0|                ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  313|      0|                return 0;
  314|      0|            }
  315|      0|        } else {
  316|       |            /* Ask if an ENGINE is reserved for this job */
  317|      0|            impl = tmpimpl;
  318|      0|        }
  319|      0|        if (impl != NULL) {
  ------------------
  |  Branch (319:13): [True: 0, False: 0]
  ------------------
  320|       |            /* There's an ENGINE for this job ... (apparently) */
  321|      0|            const EVP_MD *d = ENGINE_get_digest(impl, type->type);
  322|       |
  323|      0|            if (d == NULL) {
  ------------------
  |  Branch (323:17): [True: 0, False: 0]
  ------------------
  324|      0|                ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  325|      0|                ENGINE_finish(impl);
  326|      0|                return 0;
  327|      0|            }
  328|       |            /* We'll use the ENGINE's private digest definition */
  329|      0|            type = d;
  330|       |            /*
  331|       |             * Store the ENGINE functional reference so we know 'type' came
  332|       |             * from an ENGINE and we need to release it when done.
  333|       |             */
  334|      0|            ctx->engine = impl;
  335|      0|        } else
  336|      0|            ctx->engine = NULL;
  337|      0|    }
  338|      0|#endif
  339|      0|    if (ctx->digest != type) {
  ------------------
  |  Branch (339:9): [True: 0, False: 0]
  ------------------
  340|      0|        cleanup_old_md_data(ctx, 1);
  341|       |
  342|      0|        ctx->digest = type;
  343|      0|        if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) {
  ------------------
  |  |  221|      0|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (343:13): [True: 0, False: 0]
  |  Branch (343:56): [True: 0, False: 0]
  ------------------
  344|      0|            ctx->update = type->update;
  345|      0|            ctx->md_data = OPENSSL_zalloc(type->ctx_size);
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  346|      0|            if (ctx->md_data == NULL)
  ------------------
  |  Branch (346:17): [True: 0, False: 0]
  ------------------
  347|      0|                return 0;
  348|      0|        }
  349|      0|    }
  350|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  351|      0| skip_to_init:
  352|      0|#endif
  353|      0|#ifndef FIPS_MODULE
  354|      0|    if (ctx->pctx != NULL
  ------------------
  |  Branch (354:9): [True: 0, False: 0]
  ------------------
  355|      0|            && (!EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx->pctx)
  ------------------
  |  |  731|      0|    ((ctx)->operation == EVP_PKEY_OP_SIGN \
  |  |  ------------------
  |  |  |  | 1691|      0|# define EVP_PKEY_OP_SIGN                (1<<4)
  |  |  ------------------
  |  |  |  Branch (731:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|     || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
  |  |  ------------------
  |  |  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  |  |  ------------------
  |  |  |  Branch (732:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  733|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFY \
  |  |  ------------------
  |  |  |  | 1692|      0|# define EVP_PKEY_OP_VERIFY              (1<<5)
  |  |  ------------------
  |  |  |  Branch (733:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  734|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
  |  |  ------------------
  |  |  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  |  |  ------------------
  |  |  |  Branch (734:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  735|      0|     || (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
  |  |  ------------------
  |  |  |  | 1693|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1<<6)
  |  |  ------------------
  |  |  |  Branch (735:9): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  356|      0|                 || ctx->pctx->op.sig.signature == NULL)) {
  ------------------
  |  Branch (356:21): [True: 0, False: 0]
  ------------------
  357|      0|        int r;
  358|      0|        r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
  ------------------
  |  | 1703|      0|        (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
  |  |  ------------------
  |  |  |  | 1691|      0|# define EVP_PKEY_OP_SIGN                (1<<4)
  |  |  ------------------
  |  |                       (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
  |  |  ------------------
  |  |  |  | 1692|      0|# define EVP_PKEY_OP_VERIFY              (1<<5)
  |  |  ------------------
  |  |                       (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
  |  |  ------------------
  |  |  |  | 1693|      0|# define EVP_PKEY_OP_VERIFYRECOVER       (1<<6)
  |  |  ------------------
  |  | 1704|      0|                | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  ------------------
  |  |  |  | 1694|      0|# define EVP_PKEY_OP_SIGNCTX             (1<<7)
  |  |  ------------------
  |  |                               | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  |  |  ------------------
  |  |  |  | 1695|      0|# define EVP_PKEY_OP_VERIFYCTX           (1<<8)
  |  |  ------------------
  ------------------
  359|      0|                              EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
  ------------------
  |  | 1722|      0|# define EVP_PKEY_CTRL_DIGESTINIT        7
  ------------------
  360|      0|        if (r <= 0 && (r != -2))
  ------------------
  |  Branch (360:13): [True: 0, False: 0]
  |  Branch (360:23): [True: 0, False: 0]
  ------------------
  361|      0|            return 0;
  362|      0|    }
  363|      0|#endif
  364|      0|    if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT)
  ------------------
  |  |  221|      0|# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|        return 1;
  366|      0|    return ctx->digest->init(ctx);
  367|      0|}
digest.c:evp_md_from_algorithm:
  972|     27|{
  973|     27|    const OSSL_DISPATCH *fns = algodef->implementation;
  974|     27|    EVP_MD *md = NULL;
  975|     27|    int fncnt = 0;
  976|       |
  977|       |    /* EVP_MD_fetch() will set the legacy NID if available */
  978|     27|    if ((md = evp_md_new()) == NULL) {
  ------------------
  |  Branch (978:9): [True: 0, False: 27]
  ------------------
  979|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  980|      0|        return NULL;
  981|      0|    }
  982|       |
  983|     27|#ifndef FIPS_MODULE
  984|     27|    md->type = NID_undef;
  ------------------
  |  |   18|     27|#define NID_undef                       0
  ------------------
  985|     27|    if (!evp_names_do_all(prov, name_id, set_legacy_nid, &md->type)
  ------------------
  |  Branch (985:9): [True: 0, False: 27]
  ------------------
  986|     27|            || md->type == -1) {
  ------------------
  |  Branch (986:16): [True: 0, False: 27]
  ------------------
  987|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  988|      0|        EVP_MD_free(md);
  989|      0|        return NULL;
  990|      0|    }
  991|     27|#endif
  992|       |
  993|     27|    md->name_id = name_id;
  994|     27|    if ((md->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (994:9): [True: 0, False: 27]
  ------------------
  995|      0|        EVP_MD_free(md);
  996|      0|        return NULL;
  997|      0|    }
  998|     27|    md->description = algodef->algorithm_description;
  999|       |
 1000|    257|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (1000:12): [True: 230, False: 27]
  ------------------
 1001|    230|        switch (fns->function_id) {
  ------------------
  |  Branch (1001:17): [True: 0, False: 230]
  ------------------
 1002|     27|        case OSSL_FUNC_DIGEST_NEWCTX:
  ------------------
  |  |  273|     27|# define OSSL_FUNC_DIGEST_NEWCTX                     1
  ------------------
  |  Branch (1002:9): [True: 27, False: 203]
  ------------------
 1003|     27|            if (md->newctx == NULL) {
  ------------------
  |  Branch (1003:17): [True: 27, False: 0]
  ------------------
 1004|     27|                md->newctx = OSSL_FUNC_digest_newctx(fns);
 1005|     27|                fncnt++;
 1006|     27|            }
 1007|     27|            break;
 1008|     27|        case OSSL_FUNC_DIGEST_INIT:
  ------------------
  |  |  274|     27|# define OSSL_FUNC_DIGEST_INIT                       2
  ------------------
  |  Branch (1008:9): [True: 27, False: 203]
  ------------------
 1009|     27|            if (md->dinit == NULL) {
  ------------------
  |  Branch (1009:17): [True: 27, False: 0]
  ------------------
 1010|     27|                md->dinit = OSSL_FUNC_digest_init(fns);
 1011|     27|                fncnt++;
 1012|     27|            }
 1013|     27|            break;
 1014|     27|        case OSSL_FUNC_DIGEST_UPDATE:
  ------------------
  |  |  275|     27|# define OSSL_FUNC_DIGEST_UPDATE                     3
  ------------------
  |  Branch (1014:9): [True: 27, False: 203]
  ------------------
 1015|     27|            if (md->dupdate == NULL) {
  ------------------
  |  Branch (1015:17): [True: 27, False: 0]
  ------------------
 1016|     27|                md->dupdate = OSSL_FUNC_digest_update(fns);
 1017|     27|                fncnt++;
 1018|     27|            }
 1019|     27|            break;
 1020|     27|        case OSSL_FUNC_DIGEST_FINAL:
  ------------------
  |  |  276|     27|# define OSSL_FUNC_DIGEST_FINAL                      4
  ------------------
  |  Branch (1020:9): [True: 27, False: 203]
  ------------------
 1021|     27|            if (md->dfinal == NULL) {
  ------------------
  |  Branch (1021:17): [True: 27, False: 0]
  ------------------
 1022|     27|                md->dfinal = OSSL_FUNC_digest_final(fns);
 1023|     27|                fncnt++;
 1024|     27|            }
 1025|     27|            break;
 1026|      0|        case OSSL_FUNC_DIGEST_DIGEST:
  ------------------
  |  |  277|      0|# define OSSL_FUNC_DIGEST_DIGEST                     5
  ------------------
  |  Branch (1026:9): [True: 0, False: 230]
  ------------------
 1027|      0|            if (md->digest == NULL)
  ------------------
  |  Branch (1027:17): [True: 0, False: 0]
  ------------------
 1028|      0|                md->digest = OSSL_FUNC_digest_digest(fns);
 1029|       |            /* We don't increment fnct for this as it is stand alone */
 1030|      0|            break;
 1031|     27|        case OSSL_FUNC_DIGEST_FREECTX:
  ------------------
  |  |  278|     27|# define OSSL_FUNC_DIGEST_FREECTX                    6
  ------------------
  |  Branch (1031:9): [True: 27, False: 203]
  ------------------
 1032|     27|            if (md->freectx == NULL) {
  ------------------
  |  Branch (1032:17): [True: 27, False: 0]
  ------------------
 1033|     27|                md->freectx = OSSL_FUNC_digest_freectx(fns);
 1034|     27|                fncnt++;
 1035|     27|            }
 1036|     27|            break;
 1037|     27|        case OSSL_FUNC_DIGEST_DUPCTX:
  ------------------
  |  |  279|     27|# define OSSL_FUNC_DIGEST_DUPCTX                     7
  ------------------
  |  Branch (1037:9): [True: 27, False: 203]
  ------------------
 1038|     27|            if (md->dupctx == NULL)
  ------------------
  |  Branch (1038:17): [True: 27, False: 0]
  ------------------
 1039|     27|                md->dupctx = OSSL_FUNC_digest_dupctx(fns);
 1040|     27|            break;
 1041|     27|        case OSSL_FUNC_DIGEST_GET_PARAMS:
  ------------------
  |  |  280|     27|# define OSSL_FUNC_DIGEST_GET_PARAMS                 8
  ------------------
  |  Branch (1041:9): [True: 27, False: 203]
  ------------------
 1042|     27|            if (md->get_params == NULL)
  ------------------
  |  Branch (1042:17): [True: 27, False: 0]
  ------------------
 1043|     27|                md->get_params = OSSL_FUNC_digest_get_params(fns);
 1044|     27|            break;
 1045|      7|        case OSSL_FUNC_DIGEST_SET_CTX_PARAMS:
  ------------------
  |  |  281|      7|# define OSSL_FUNC_DIGEST_SET_CTX_PARAMS             9
  ------------------
  |  Branch (1045:9): [True: 7, False: 223]
  ------------------
 1046|      7|            if (md->set_ctx_params == NULL)
  ------------------
  |  Branch (1046:17): [True: 7, False: 0]
  ------------------
 1047|      7|                md->set_ctx_params = OSSL_FUNC_digest_set_ctx_params(fns);
 1048|      7|            break;
 1049|      0|        case OSSL_FUNC_DIGEST_GET_CTX_PARAMS:
  ------------------
  |  |  282|      0|# define OSSL_FUNC_DIGEST_GET_CTX_PARAMS            10
  ------------------
  |  Branch (1049:9): [True: 0, False: 230]
  ------------------
 1050|      0|            if (md->get_ctx_params == NULL)
  ------------------
  |  Branch (1050:17): [True: 0, False: 0]
  ------------------
 1051|      0|                md->get_ctx_params = OSSL_FUNC_digest_get_ctx_params(fns);
 1052|      0|            break;
 1053|     27|        case OSSL_FUNC_DIGEST_GETTABLE_PARAMS:
  ------------------
  |  |  283|     27|# define OSSL_FUNC_DIGEST_GETTABLE_PARAMS           11
  ------------------
  |  Branch (1053:9): [True: 27, False: 203]
  ------------------
 1054|     27|            if (md->gettable_params == NULL)
  ------------------
  |  Branch (1054:17): [True: 27, False: 0]
  ------------------
 1055|     27|                md->gettable_params = OSSL_FUNC_digest_gettable_params(fns);
 1056|     27|            break;
 1057|      7|        case OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  284|      7|# define OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS       12
  ------------------
  |  Branch (1057:9): [True: 7, False: 223]
  ------------------
 1058|      7|            if (md->settable_ctx_params == NULL)
  ------------------
  |  Branch (1058:17): [True: 7, False: 0]
  ------------------
 1059|      7|                md->settable_ctx_params =
 1060|      7|                    OSSL_FUNC_digest_settable_ctx_params(fns);
 1061|      7|            break;
 1062|      0|        case OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  285|      0|# define OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS       13
  ------------------
  |  Branch (1062:9): [True: 0, False: 230]
  ------------------
 1063|      0|            if (md->gettable_ctx_params == NULL)
  ------------------
  |  Branch (1063:17): [True: 0, False: 0]
  ------------------
 1064|      0|                md->gettable_ctx_params =
 1065|      0|                    OSSL_FUNC_digest_gettable_ctx_params(fns);
 1066|      0|            break;
 1067|    230|        }
 1068|    230|    }
 1069|     27|    if ((fncnt != 0 && fncnt != 5)
  ------------------
  |  Branch (1069:10): [True: 27, False: 0]
  |  Branch (1069:24): [True: 0, False: 27]
  ------------------
 1070|     27|        || (fncnt == 0 && md->digest == NULL)) {
  ------------------
  |  Branch (1070:13): [True: 0, False: 27]
  |  Branch (1070:27): [True: 0, False: 0]
  ------------------
 1071|       |        /*
 1072|       |         * In order to be a consistent set of functions we either need the
 1073|       |         * whole set of init/update/final etc functions or none of them.
 1074|       |         * The "digest" function can standalone. We at least need one way to
 1075|       |         * generate digests.
 1076|       |         */
 1077|      0|        EVP_MD_free(md);
 1078|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1079|      0|        return NULL;
 1080|      0|    }
 1081|     27|    md->prov = prov;
 1082|     27|    if (prov != NULL)
  ------------------
  |  Branch (1082:9): [True: 27, False: 0]
  ------------------
 1083|     27|        ossl_provider_up_ref(prov);
 1084|       |
 1085|     27|    if (!evp_md_cache_constants(md)) {
  ------------------
  |  Branch (1085:9): [True: 0, False: 27]
  ------------------
 1086|      0|        EVP_MD_free(md);
 1087|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_CACHE_CONSTANTS_FAILED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1088|      0|        md = NULL;
 1089|      0|    }
 1090|       |
 1091|     27|    return md;
 1092|     27|}
digest.c:set_legacy_nid:
  918|     71|{
  919|     71|    int nid;
  920|     71|    int *legacy_nid = vlegacy_nid;
  921|       |    /*
  922|       |     * We use lowest level function to get the associated method, because
  923|       |     * higher level functions such as EVP_get_digestbyname() have changed
  924|       |     * to look at providers too.
  925|       |     */
  926|     71|    const void *legacy_method = OBJ_NAME_get(name, OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|     71|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  927|       |
  928|     71|    if (*legacy_nid == -1)       /* We found a clash already */
  ------------------
  |  Branch (928:9): [True: 0, False: 71]
  ------------------
  929|      0|        return;
  930|       |
  931|     71|    if (legacy_method == NULL)
  ------------------
  |  Branch (931:9): [True: 48, False: 23]
  ------------------
  932|     48|        return;
  933|     23|    nid = EVP_MD_nid(legacy_method);
  ------------------
  |  |  535|     23|# define EVP_MD_nid EVP_MD_get_type
  ------------------
  934|     23|    if (*legacy_nid != NID_undef && *legacy_nid != nid) {
  ------------------
  |  |   18|     46|#define NID_undef                       0
  ------------------
  |  Branch (934:9): [True: 4, False: 19]
  |  Branch (934:37): [True: 0, False: 4]
  ------------------
  935|      0|        *legacy_nid = -1;
  936|      0|        return;
  937|      0|    }
  938|     23|    *legacy_nid = nid;
  939|     23|}
digest.c:evp_md_cache_constants:
  943|     27|{
  944|     27|    int ok, xof = 0, algid_absent = 0;
  945|     27|    size_t blksz = 0;
  946|     27|    size_t mdsize = 0;
  947|     27|    OSSL_PARAM params[5];
  948|       |
  949|     27|    params[0] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_BLOCK_SIZE, &blksz);
  ------------------
  |  |  195|     27|# define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize"
  ------------------
  950|     27|    params[1] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_SIZE, &mdsize);
  ------------------
  |  |  198|     27|# define OSSL_DIGEST_PARAM_SIZE "size"
  ------------------
  951|     27|    params[2] = OSSL_PARAM_construct_int(OSSL_DIGEST_PARAM_XOF, &xof);
  ------------------
  |  |  200|     27|# define OSSL_DIGEST_PARAM_XOF "xof"
  ------------------
  952|     27|    params[3] = OSSL_PARAM_construct_int(OSSL_DIGEST_PARAM_ALGID_ABSENT,
  ------------------
  |  |  194|     27|# define OSSL_DIGEST_PARAM_ALGID_ABSENT "algid-absent"
  ------------------
  953|     27|                                         &algid_absent);
  954|     27|    params[4] = OSSL_PARAM_construct_end();
  955|     27|    ok = evp_do_md_getparams(md, params) > 0;
  956|     27|    if (mdsize > INT_MAX || blksz > INT_MAX)
  ------------------
  |  Branch (956:9): [True: 0, False: 27]
  |  Branch (956:29): [True: 0, False: 27]
  ------------------
  957|      0|        ok = 0;
  958|     27|    if (ok) {
  ------------------
  |  Branch (958:9): [True: 27, False: 0]
  ------------------
  959|     27|        md->block_size = (int)blksz;
  960|     27|        md->md_size = (int)mdsize;
  961|     27|        if (xof)
  ------------------
  |  Branch (961:13): [True: 4, False: 23]
  ------------------
  962|      4|            md->flags |= EVP_MD_FLAG_XOF;
  ------------------
  |  |  161|      4|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
  963|     27|        if (algid_absent)
  ------------------
  |  Branch (963:13): [True: 16, False: 11]
  ------------------
  964|     16|            md->flags |= EVP_MD_FLAG_DIGALGID_ABSENT;
  ------------------
  |  |  173|     16|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  965|     27|    }
  966|     27|    return ok;
  967|     27|}
digest.c:evp_md_up_ref:
 1095|  7.37k|{
 1096|  7.37k|    return EVP_MD_up_ref(md);
 1097|  7.37k|}
digest.c:evp_md_free:
 1100|     57|{
 1101|     57|    EVP_MD_free(md);
 1102|     57|}

EVP_aes_128_cbc:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ecb:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ofb:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_cfb128:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_cfb1:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_cfb8:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ctr:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cbc:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ecb:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ofb:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cfb128:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cfb1:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_cfb8:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ctr:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cbc:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ecb:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ofb:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cfb128:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cfb1:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_cfb8:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ctr:
  442|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  443|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_gcm:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_gcm:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_gcm:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_xts:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_xts:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_ccm:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ccm:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ccm:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_128_wrap:
 3778|      2|{
 3779|      2|    return &aes_128_wrap;
 3780|      2|}
EVP_aes_192_wrap:
 3792|      2|{
 3793|      2|    return &aes_192_wrap;
 3794|      2|}
EVP_aes_256_wrap:
 3806|      2|{
 3807|      2|    return &aes_256_wrap;
 3808|      2|}
EVP_aes_128_wrap_pad:
 3820|      2|{
 3821|      2|    return &aes_128_wrap_pad;
 3822|      2|}
EVP_aes_192_wrap_pad:
 3834|      2|{
 3835|      2|    return &aes_192_wrap_pad;
 3836|      2|}
EVP_aes_256_wrap_pad:
 3848|      2|{
 3849|      2|    return &aes_256_wrap_pad;
 3850|      2|}
EVP_aes_128_ocb:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_192_ocb:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------
EVP_aes_256_ocb:
  468|      2|const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
  469|      2|{ return AESNI_CAPABLE?&aesni_##keylen##_##mode:&aes_##keylen##_##mode; }
  ------------------
  |  |  180|      2|#  define AESNI_CAPABLE   (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (180:27): [True: 2, False: 0]
  |  |  ------------------
  ------------------

EVP_aes_128_cbc_hmac_sha1:
  956|      2|{
  957|      2|    return (OPENSSL_ia32cap_P[1] & AESNI_CAPABLE ?
  ------------------
  |  |   47|      2|# define AESNI_CAPABLE   (1<<(57-32))
  ------------------
  |  Branch (957:13): [True: 2, False: 0]
  ------------------
  958|      2|            &aesni_128_cbc_hmac_sha1_cipher : NULL);
  959|      2|}
EVP_aes_256_cbc_hmac_sha1:
  962|      2|{
  963|      2|    return (OPENSSL_ia32cap_P[1] & AESNI_CAPABLE ?
  ------------------
  |  |   47|      2|# define AESNI_CAPABLE   (1<<(57-32))
  ------------------
  |  Branch (963:13): [True: 2, False: 0]
  ------------------
  964|      2|            &aesni_256_cbc_hmac_sha1_cipher : NULL);
  965|      2|}

EVP_aes_128_cbc_hmac_sha256:
  933|      2|{
  934|      2|    return ((OPENSSL_ia32cap_P[1] & AESNI_CAPABLE) &&
  ------------------
  |  |   47|      2|# define AESNI_CAPABLE   (1<<(57-32))
  ------------------
  |  Branch (934:13): [True: 2, False: 0]
  ------------------
  935|      2|            aesni_cbc_sha256_enc(NULL, NULL, 0, NULL, NULL, NULL, NULL) ?
  ------------------
  |  Branch (935:13): [True: 2, False: 0]
  ------------------
  936|      2|            &aesni_128_cbc_hmac_sha256_cipher : NULL);
  937|      2|}
EVP_aes_256_cbc_hmac_sha256:
  940|      2|{
  941|      2|    return ((OPENSSL_ia32cap_P[1] & AESNI_CAPABLE) &&
  ------------------
  |  |   47|      2|# define AESNI_CAPABLE   (1<<(57-32))
  ------------------
  |  Branch (941:13): [True: 2, False: 0]
  ------------------
  942|      2|            aesni_cbc_sha256_enc(NULL, NULL, 0, NULL, NULL, NULL, NULL) ?
  ------------------
  |  Branch (942:13): [True: 2, False: 0]
  ------------------
  943|      2|            &aesni_256_cbc_hmac_sha256_cipher : NULL);
  944|      2|}

EVP_aria_128_ctr:
  172|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  173|      2|{ return &aria_##keylen##_##mode; }
EVP_aria_192_ctr:
  172|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  173|      2|{ return &aria_##keylen##_##mode; }
EVP_aria_256_ctr:
  172|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  173|      2|{ return &aria_##keylen##_##mode; }
EVP_aria_128_gcm:
  775|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  776|      2|{ return (EVP_CIPHER*)&aria_##keylen##_##mode; }
EVP_aria_192_gcm:
  775|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  776|      2|{ return (EVP_CIPHER*)&aria_##keylen##_##mode; }
EVP_aria_256_gcm:
  775|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  776|      2|{ return (EVP_CIPHER*)&aria_##keylen##_##mode; }
EVP_aria_128_ccm:
  775|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  776|      2|{ return (EVP_CIPHER*)&aria_##keylen##_##mode; }
EVP_aria_192_ccm:
  775|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  776|      2|{ return (EVP_CIPHER*)&aria_##keylen##_##mode; }
EVP_aria_256_ccm:
  775|      2|const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
  776|      2|{ return (EVP_CIPHER*)&aria_##keylen##_##mode; }

EVP_camellia_128_cbc:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_128_ecb:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_128_ofb:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_128_cfb128:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_128_cfb1:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_128_cfb8:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_128_ctr:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_cbc:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_ecb:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_ofb:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_cfb128:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_cfb1:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_cfb8:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_192_ctr:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_cbc:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_ecb:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_ofb:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_cfb128:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_cfb1:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_cfb8:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }
EVP_camellia_256_ctr:
  177|      2|const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
  178|      2|{ return &camellia_##keylen##_##mode; }

EVP_chacha20:
  146|      2|{
  147|      2|    return &chacha20;
  148|      2|}
EVP_chacha20_poly1305:
  631|      2|{
  632|      2|    return(&chacha20_poly1305);
  633|      2|}

EVP_des_ede:
  303|      2|{
  304|      2|    return &des_ede_ecb;
  305|      2|}
EVP_des_ede3:
  308|      2|{
  309|      2|    return &des_ede3_ecb;
  310|      2|}
EVP_des_ede3_wrap:
  422|      2|{
  423|      2|    return &des3_wrap;
  424|      2|}

EVP_rc2_64_cbc:
   83|      2|{
   84|      2|    return &r2_64_cbc_cipher;
   85|      2|}
EVP_rc2_40_cbc:
   88|      2|{
   89|      2|    return &r2_40_cbc_cipher;
   90|      2|}

EVP_rc4:
   68|      2|{
   69|      2|    return &r4_cipher;
   70|      2|}
EVP_rc4_40:
   73|      2|{
   74|      2|    return &r4_40_cipher;
   75|      2|}

EVP_rc4_hmac_md5:
  270|      2|{
  271|      2|    return &r4_hmac_md5_cipher;
  272|      2|}

EVP_sm4_cbc:
   46|      2|const EVP_CIPHER *EVP_sm4_##mode(void) \
   47|      2|{ return &sm4_##mode; }
EVP_sm4_ecb:
   46|      2|const EVP_CIPHER *EVP_sm4_##mode(void) \
   47|      2|{ return &sm4_##mode; }
EVP_sm4_ofb:
   46|      2|const EVP_CIPHER *EVP_sm4_##mode(void) \
   47|      2|{ return &sm4_##mode; }
EVP_sm4_cfb128:
   46|      2|const EVP_CIPHER *EVP_sm4_##mode(void) \
   47|      2|{ return &sm4_##mode; }
EVP_sm4_ctr:
   46|      2|const EVP_CIPHER *EVP_sm4_##mode(void) \
   47|      2|{ return &sm4_##mode; }

EVP_desx_cbc:
   56|      2|{
   57|      2|    return &d_xcbc_cipher;
   58|      2|}

OSSL_EC_curve_nid2name:
  119|  10.3k|{
  120|  10.3k|    size_t i;
  121|       |
  122|  10.3k|    if (nid <= 0)
  ------------------
  |  Branch (122:9): [True: 0, False: 10.3k]
  ------------------
  123|      0|        return NULL;
  124|       |
  125|   340k|    for (i = 0; i < OSSL_NELEM(curve_list); i++) {
  ------------------
  |  |   14|   340k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (125:17): [True: 340k, False: 0]
  ------------------
  126|   340k|        if (curve_list[i].nid == nid)
  ------------------
  |  Branch (126:13): [True: 10.3k, False: 330k]
  ------------------
  127|  10.3k|            return curve_list[i].name;
  128|   340k|    }
  129|      0|    return NULL;
  130|  10.3k|}
ossl_ec_curve_nid2nist_int:
  171|    824|{
  172|    824|    size_t i;
  173|  11.1k|    for (i = 0; i < OSSL_NELEM(nist_curves); i++) {
  ------------------
  |  |   14|  11.1k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (173:17): [True: 10.6k, False: 477]
  ------------------
  174|  10.6k|        if (nist_curves[i].nid == nid)
  ------------------
  |  Branch (174:13): [True: 347, False: 10.2k]
  ------------------
  175|    347|            return nist_curves[i].name;
  176|  10.6k|    }
  177|    477|    return NULL;
  178|    824|}

EVP_CIPHER_CTX_reset:
   34|  1.35k|{
   35|  1.35k|    if (ctx == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 1.35k]
  ------------------
   36|      0|        return 1;
   37|       |
   38|  1.35k|    if (ctx->cipher == NULL || ctx->cipher->prov == NULL)
  ------------------
  |  Branch (38:9): [True: 1.35k, False: 0]
  |  Branch (38:32): [True: 0, False: 0]
  ------------------
   39|  1.35k|        goto legacy;
   40|       |
   41|      0|    if (ctx->algctx != NULL) {
  ------------------
  |  Branch (41:9): [True: 0, False: 0]
  ------------------
   42|      0|        if (ctx->cipher->freectx != NULL)
  ------------------
  |  Branch (42:13): [True: 0, False: 0]
  ------------------
   43|      0|            ctx->cipher->freectx(ctx->algctx);
   44|      0|        ctx->algctx = NULL;
   45|      0|    }
   46|      0|    if (ctx->fetched_cipher != NULL)
  ------------------
  |  Branch (46:9): [True: 0, False: 0]
  ------------------
   47|      0|        EVP_CIPHER_free(ctx->fetched_cipher);
   48|      0|    memset(ctx, 0, sizeof(*ctx));
   49|      0|    ctx->iv_len = -1;
   50|       |
   51|      0|    return 1;
   52|       |
   53|       |    /* Remove legacy code below when legacy support is removed. */
   54|  1.35k| legacy:
   55|       |
   56|  1.35k|    if (ctx->cipher != NULL) {
  ------------------
  |  Branch (56:9): [True: 0, False: 1.35k]
  ------------------
   57|      0|        if (ctx->cipher->cleanup && !ctx->cipher->cleanup(ctx))
  ------------------
  |  Branch (57:13): [True: 0, False: 0]
  |  Branch (57:37): [True: 0, False: 0]
  ------------------
   58|      0|            return 0;
   59|       |        /* Cleanse cipher context data */
   60|      0|        if (ctx->cipher_data && ctx->cipher->ctx_size)
  ------------------
  |  Branch (60:13): [True: 0, False: 0]
  |  Branch (60:33): [True: 0, False: 0]
  ------------------
   61|      0|            OPENSSL_cleanse(ctx->cipher_data, ctx->cipher->ctx_size);
   62|      0|    }
   63|  1.35k|    OPENSSL_free(ctx->cipher_data);
  ------------------
  |  |  107|  1.35k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.35k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.35k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   64|  1.35k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
   65|  1.35k|    ENGINE_finish(ctx->engine);
   66|  1.35k|#endif
   67|  1.35k|    memset(ctx, 0, sizeof(*ctx));
   68|  1.35k|    ctx->iv_len = -1;
   69|  1.35k|    return 1;
   70|  1.35k|}
EVP_CIPHER_CTX_new:
   73|  1.35k|{
   74|  1.35k|    EVP_CIPHER_CTX *ctx;
   75|       |
   76|  1.35k|    ctx = OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  ------------------
  |  |   99|  1.35k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.35k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.35k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|  1.35k|    if (ctx == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 1.35k]
  ------------------
   78|      0|        return NULL;
   79|       |
   80|  1.35k|    ctx->iv_len = -1;
   81|  1.35k|    return ctx;
   82|  1.35k|}
EVP_CIPHER_CTX_free:
   85|  1.35k|{
   86|  1.35k|    if (ctx == NULL)
  ------------------
  |  Branch (86:9): [True: 0, False: 1.35k]
  ------------------
   87|      0|        return;
   88|  1.35k|    EVP_CIPHER_CTX_reset(ctx);
   89|  1.35k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  1.35k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.35k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.35k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   90|  1.35k|}
EVP_CIPHER_free:
 1701|  28.2k|{
 1702|  28.2k|    int i;
 1703|       |
 1704|  28.2k|    if (cipher == NULL || cipher->origin != EVP_ORIG_DYNAMIC)
  ------------------
  |  |  251|      0|#define EVP_ORIG_DYNAMIC    0
  ------------------
  |  Branch (1704:9): [True: 28.2k, False: 0]
  |  Branch (1704:27): [True: 0, False: 0]
  ------------------
 1705|  28.2k|        return;
 1706|       |
 1707|      0|    CRYPTO_DOWN_REF(&cipher->refcnt, &i);
 1708|      0|    if (i > 0)
  ------------------
  |  Branch (1708:9): [True: 0, False: 0]
  ------------------
 1709|      0|        return;
 1710|      0|    evp_cipher_free_int(cipher);
 1711|      0|}

ossl_err_load_EVP_strings:
  202|      2|{
  203|      2|#ifndef OPENSSL_NO_ERR
  204|      2|    if (ERR_reason_error_string(EVP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (204:9): [True: 2, False: 0]
  ------------------
  205|      2|        ERR_load_strings_const(EVP_str_reasons);
  206|      2|#endif
  207|      2|    return 1;
  208|      2|}

evp_generic_fetch:
  359|  7.34k|{
  360|  7.34k|    struct evp_method_data_st methdata;
  361|  7.34k|    void *method;
  362|       |
  363|  7.34k|    methdata.libctx = libctx;
  364|  7.34k|    methdata.tmp_store = NULL;
  365|  7.34k|    method = inner_evp_generic_fetch(&methdata, NULL, operation_id,
  366|  7.34k|                                     name, properties,
  367|  7.34k|                                     new_method, up_ref_method, free_method);
  368|  7.34k|    dealloc_tmp_evp_method_store(methdata.tmp_store);
  369|  7.34k|    return method;
  370|  7.34k|}
evp_method_store_cache_flush:
  399|      2|{
  400|      2|    OSSL_METHOD_STORE *store = get_evp_method_store(libctx);
  401|       |
  402|      2|    if (store != NULL)
  ------------------
  |  Branch (402:9): [True: 2, False: 0]
  ------------------
  403|      2|        return ossl_method_store_cache_flush_all(store);
  404|      0|    return 1;
  405|      2|}
evp_generic_do_all:
  593|    268|{
  594|    268|    struct evp_method_data_st methdata;
  595|    268|    struct filter_data_st data;
  596|       |
  597|    268|    methdata.libctx = libctx;
  598|    268|    methdata.tmp_store = NULL;
  599|    268|    (void)inner_evp_generic_fetch(&methdata, NULL, operation_id, NULL, NULL,
  600|    268|                                  new_method, up_ref_method, free_method);
  601|       |
  602|    268|    data.operation_id = operation_id;
  603|    268|    data.user_fn = user_fn;
  604|    268|    data.user_arg = user_arg;
  605|    268|    if (methdata.tmp_store != NULL)
  ------------------
  |  Branch (605:9): [True: 0, False: 268]
  ------------------
  606|      0|        ossl_method_store_do_all(methdata.tmp_store, &filter_on_operation_id,
  607|      0|                                 &data);
  608|    268|    ossl_method_store_do_all(get_evp_method_store(libctx),
  609|    268|                             &filter_on_operation_id, &data);
  610|    268|    dealloc_tmp_evp_method_store(methdata.tmp_store);
  611|    268|}
evp_is_a:
  615|  24.0k|{
  616|       |    /*
  617|       |     * For a |prov| that is NULL, the library context will be NULL
  618|       |     */
  619|  24.0k|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  620|  24.0k|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  621|       |
  622|  24.0k|    if (prov == NULL)
  ------------------
  |  Branch (622:9): [True: 7.33k, False: 16.7k]
  ------------------
  623|  7.33k|        number = ossl_namemap_name2num(namemap, legacy_name);
  624|  24.0k|    return ossl_namemap_name2num(namemap, name) == number;
  625|  24.0k|}
evp_names_do_all:
  630|  18.1k|{
  631|  18.1k|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  632|  18.1k|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  633|       |
  634|  18.1k|    return ossl_namemap_doall_names(namemap, number, fn, data);
  635|  18.1k|}
evp_fetch.c:inner_evp_generic_fetch:
  249|  7.61k|{
  250|  7.61k|    OSSL_METHOD_STORE *store = get_evp_method_store(methdata->libctx);
  251|  7.61k|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  252|  7.61k|    const char *const propq = properties != NULL ? properties : "";
  ------------------
  |  Branch (252:31): [True: 3, False: 7.60k]
  ------------------
  253|  7.61k|    uint32_t meth_id = 0;
  254|  7.61k|    void *method = NULL;
  255|  7.61k|    int unsupported, name_id;
  256|       |
  257|  7.61k|    if (store == NULL || namemap == NULL) {
  ------------------
  |  Branch (257:9): [True: 0, False: 7.61k]
  |  Branch (257:26): [True: 0, False: 7.61k]
  ------------------
  258|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  259|      0|        return NULL;
  260|      0|    }
  261|       |
  262|       |    /*
  263|       |     * If there's ever an operation_id == 0 passed, we have an internal
  264|       |     * programming error.
  265|       |     */
  266|  7.61k|    if (!ossl_assert(operation_id > 0)) {
  ------------------
  |  |   52|  7.61k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  7.61k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (266:9): [True: 0, False: 7.61k]
  ------------------
  267|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  268|      0|        return NULL;
  269|      0|    }
  270|       |
  271|       |    /* If we haven't received a name id yet, try to get one for the name */
  272|  7.61k|    name_id = name != NULL ? ossl_namemap_name2num(namemap, name) : 0;
  ------------------
  |  Branch (272:15): [True: 7.34k, False: 268]
  ------------------
  273|       |
  274|       |    /*
  275|       |     * If we have a name id, calculate a method id with evp_method_id().
  276|       |     *
  277|       |     * evp_method_id returns 0 if we have too many operations (more than
  278|       |     * about 2^8) or too many names (more than about 2^24).  In that case,
  279|       |     * we can't create any new method.
  280|       |     * For all intents and purposes, this is an internal error.
  281|       |     */
  282|  7.61k|    if (name_id != 0 && (meth_id = evp_method_id(name_id, operation_id)) == 0) {
  ------------------
  |  Branch (282:9): [True: 7.34k, False: 269]
  |  Branch (282:25): [True: 0, False: 7.34k]
  ------------------
  283|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  284|      0|        return NULL;
  285|      0|    }
  286|       |
  287|       |    /*
  288|       |     * If we haven't found the name yet, chances are that the algorithm to
  289|       |     * be fetched is unsupported.
  290|       |     */
  291|  7.61k|    unsupported = name_id == 0;
  292|       |
  293|  7.61k|    if (meth_id == 0
  ------------------
  |  Branch (293:9): [True: 269, False: 7.34k]
  ------------------
  294|  7.61k|        || !ossl_method_store_cache_get(store, prov, meth_id, propq, &method)) {
  ------------------
  |  Branch (294:12): [True: 4, False: 7.33k]
  ------------------
  295|    273|        OSSL_METHOD_CONSTRUCT_METHOD mcm = {
  296|    273|            get_tmp_evp_method_store,
  297|    273|            reserve_evp_method_store,
  298|    273|            unreserve_evp_method_store,
  299|    273|            get_evp_method_from_store,
  300|    273|            put_evp_method_in_store,
  301|    273|            construct_evp_method,
  302|    273|            destruct_evp_method
  303|    273|        };
  304|       |
  305|    273|        methdata->operation_id = operation_id;
  306|    273|        methdata->name_id = name_id;
  307|    273|        methdata->names = name;
  308|    273|        methdata->propquery = propq;
  309|    273|        methdata->method_from_algorithm = new_method;
  310|    273|        methdata->refcnt_up_method = up_ref_method;
  311|    273|        methdata->destruct_method = free_method;
  312|    273|        methdata->flag_construct_error_occurred = 0;
  313|    273|        if ((method = ossl_method_construct(methdata->libctx, operation_id,
  ------------------
  |  Branch (313:13): [True: 5, False: 268]
  ------------------
  314|    273|                                            &prov, 0 /* !force_cache */,
  315|    273|                                            &mcm, methdata)) != NULL) {
  316|       |            /*
  317|       |             * If construction did create a method for us, we know that
  318|       |             * there is a correct name_id and meth_id, since those have
  319|       |             * already been calculated in get_evp_method_from_store() and
  320|       |             * put_evp_method_in_store() above.
  321|       |             */
  322|      5|            if (name_id == 0)
  ------------------
  |  Branch (322:17): [True: 1, False: 4]
  ------------------
  323|      1|                name_id = ossl_namemap_name2num(namemap, name);
  324|      5|            meth_id = evp_method_id(name_id, operation_id);
  325|      5|            if (name_id != 0)
  ------------------
  |  Branch (325:17): [True: 5, False: 0]
  ------------------
  326|      5|                ossl_method_store_cache_set(store, prov, meth_id, propq,
  327|      5|                                            method, up_ref_method, free_method);
  328|      5|        }
  329|       |
  330|       |        /*
  331|       |         * If we never were in the constructor, the algorithm to be fetched
  332|       |         * is unsupported.
  333|       |         */
  334|    273|        unsupported = !methdata->flag_construct_error_occurred;
  335|    273|    }
  336|       |
  337|  7.61k|    if ((name_id != 0 || name != NULL) && method == NULL) {
  ------------------
  |  Branch (337:10): [True: 7.34k, False: 268]
  |  Branch (337:26): [True: 0, False: 268]
  |  Branch (337:43): [True: 0, False: 7.34k]
  ------------------
  338|      0|        int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  363|      0|# define ERR_R_UNSUPPORTED                       (268|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      int code = unsupported ? ERR_R_UNSUPPORTED : ERR_R_FETCH_FAILED;
  ------------------
  |  |  364|      0|# define ERR_R_FETCH_FAILED                      (269|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (338:20): [True: 0, False: 0]
  ------------------
  339|       |
  340|      0|        if (name == NULL)
  ------------------
  |  Branch (340:13): [True: 0, False: 0]
  ------------------
  341|      0|            name = ossl_namemap_num2name(namemap, name_id, 0);
  342|      0|        ERR_raise_data(ERR_LIB_EVP, code,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, code,
  ------------------
  |  |   76|      0|# define ERR_LIB_EVP             6
  ------------------
  343|      0|                       "%s, Algorithm (%s : %d), Properties (%s)",
  344|      0|                       ossl_lib_ctx_get_descriptor(methdata->libctx),
  345|      0|                       name == NULL ? "<null>" : name, name_id,
  ------------------
  |  Branch (345:24): [True: 0, False: 0]
  ------------------
  346|      0|                       properties == NULL ? "<null>" : properties);
  ------------------
  |  Branch (346:24): [True: 0, False: 0]
  ------------------
  347|      0|    }
  348|       |
  349|  7.61k|    return method;
  350|  7.61k|}
evp_fetch.c:evp_method_id:
  112|  7.40k|{
  113|  7.40k|    if (!ossl_assert(name_id > 0 && name_id <= METHOD_ID_NAME_MAX)
  ------------------
  |  |   52|  14.8k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 7.40k, False: 0]
  |  |  |  Branch (52:43): [True: 7.40k, False: 0]
  |  |  ------------------
  |  |   53|  14.8k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (113:9): [True: 0, False: 7.40k]
  ------------------
  114|  7.40k|        || !ossl_assert(operation_id > 0
  ------------------
  |  |   52|  14.8k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 7.40k, False: 0]
  |  |  |  Branch (52:43): [True: 7.40k, False: 0]
  |  |  ------------------
  |  |   53|  7.40k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (114:12): [True: 0, False: 7.40k]
  ------------------
  115|  7.40k|                        && operation_id <= METHOD_ID_OPERATION_MAX))
  116|      0|        return 0;
  117|  7.40k|    return (((name_id << METHOD_ID_NAME_OFFSET) & METHOD_ID_NAME_MASK)
  ------------------
  |  |  109|  7.40k|#define METHOD_ID_NAME_OFFSET           8
  ------------------
                  return (((name_id << METHOD_ID_NAME_OFFSET) & METHOD_ID_NAME_MASK)
  ------------------
  |  |  108|  7.40k|#define METHOD_ID_NAME_MASK             0x7FFFFF00
  ------------------
  118|  7.40k|            | (operation_id & METHOD_ID_OPERATION_MASK));
  ------------------
  |  |  106|  7.40k|#define METHOD_ID_OPERATION_MASK        0x000000FF
  ------------------
  119|  7.40k|}
evp_fetch.c:reserve_evp_method_store:
   68|    546|{
   69|    546|    struct evp_method_data_st *methdata = data;
   70|       |
   71|    546|    if (store == NULL
  ------------------
  |  Branch (71:9): [True: 546, False: 0]
  ------------------
   72|    546|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (72:12): [True: 0, False: 546]
  ------------------
   73|      0|        return 0;
   74|       |
   75|    546|    return ossl_method_lock_store(store);
   76|    546|}
evp_fetch.c:unreserve_evp_method_store:
   79|    546|{
   80|    546|    struct evp_method_data_st *methdata = data;
   81|       |
   82|    546|    if (store == NULL
  ------------------
  |  Branch (82:9): [True: 546, False: 0]
  ------------------
   83|    546|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (83:12): [True: 0, False: 546]
  ------------------
   84|      0|        return 0;
   85|       |
   86|    546|    return ossl_method_unlock_store(store);
   87|    546|}
evp_fetch.c:get_evp_method_from_store:
  123|    273|{
  124|    273|    struct evp_method_data_st *methdata = data;
  125|    273|    void *method = NULL;
  126|    273|    int name_id;
  127|    273|    uint32_t meth_id;
  128|       |
  129|       |    /*
  130|       |     * get_evp_method_from_store() is only called to try and get the method
  131|       |     * that evp_generic_fetch() is asking for, and the operation id as well
  132|       |     * as the name or name id are passed via methdata.
  133|       |     */
  134|    273|    if ((name_id = methdata->name_id) == 0 && methdata->names != NULL) {
  ------------------
  |  Branch (134:9): [True: 269, False: 4]
  |  Branch (134:47): [True: 1, False: 268]
  ------------------
  135|      1|        OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx);
  136|      1|        const char *names = methdata->names;
  137|      1|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   24|      1|#define NAME_SEPARATOR ':'
  ------------------
  138|      1|        size_t l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (138:21): [True: 1, False: 0]
  ------------------
  139|       |
  140|      1|        if (namemap == 0)
  ------------------
  |  Branch (140:13): [True: 0, False: 1]
  ------------------
  141|      0|            return NULL;
  142|      1|        name_id = ossl_namemap_name2num_n(namemap, names, l);
  143|      1|    }
  144|       |
  145|    273|    if (name_id == 0
  ------------------
  |  Branch (145:9): [True: 268, False: 5]
  ------------------
  146|    273|        || (meth_id = evp_method_id(name_id, methdata->operation_id)) == 0)
  ------------------
  |  Branch (146:12): [True: 0, False: 5]
  ------------------
  147|    268|        return NULL;
  148|       |
  149|      5|    if (store == NULL
  ------------------
  |  Branch (149:9): [True: 5, False: 0]
  ------------------
  150|      5|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (150:12): [True: 0, False: 5]
  ------------------
  151|      0|        return NULL;
  152|       |
  153|      5|    if (!ossl_method_store_fetch(store, meth_id, methdata->propquery, prov,
  ------------------
  |  Branch (153:9): [True: 0, False: 5]
  ------------------
  154|      5|                                 &method))
  155|      0|        return NULL;
  156|      5|    return method;
  157|      5|}
evp_fetch.c:put_evp_method_in_store:
  163|     51|{
  164|     51|    struct evp_method_data_st *methdata = data;
  165|     51|    OSSL_NAMEMAP *namemap;
  166|     51|    int name_id;
  167|     51|    uint32_t meth_id;
  168|     51|    size_t l = 0;
  169|       |
  170|       |    /*
  171|       |     * put_evp_method_in_store() is only called with an EVP method that was
  172|       |     * successfully created by construct_method() below, which means that
  173|       |     * all the names should already be stored in the namemap with the same
  174|       |     * numeric identity, so just use the first to get that identity.
  175|       |     */
  176|     51|    if (names != NULL) {
  ------------------
  |  Branch (176:9): [True: 51, False: 0]
  ------------------
  177|     51|        const char *q = strchr(names, NAME_SEPARATOR);
  ------------------
  |  |   24|     51|#define NAME_SEPARATOR ':'
  ------------------
  178|       |
  179|     51|        l = (q == NULL ? strlen(names) : (size_t)(q - names));
  ------------------
  |  Branch (179:14): [True: 18, False: 33]
  ------------------
  180|     51|    }
  181|       |
  182|     51|    if ((namemap = ossl_namemap_stored(methdata->libctx)) == NULL
  ------------------
  |  Branch (182:9): [True: 0, False: 51]
  ------------------
  183|     51|        || (name_id = ossl_namemap_name2num_n(namemap, names, l)) == 0
  ------------------
  |  Branch (183:12): [True: 0, False: 51]
  ------------------
  184|     51|        || (meth_id = evp_method_id(name_id, methdata->operation_id)) == 0)
  ------------------
  |  Branch (184:12): [True: 0, False: 51]
  ------------------
  185|      0|        return 0;
  186|       |
  187|     51|    if (store == NULL
  ------------------
  |  Branch (187:9): [True: 51, False: 0]
  ------------------
  188|     51|        && (store = get_evp_method_store(methdata->libctx)) == NULL)
  ------------------
  |  Branch (188:12): [True: 0, False: 51]
  ------------------
  189|      0|        return 0;
  190|       |
  191|     51|    return ossl_method_store_add(store, prov, meth_id, propdef, method,
  192|     51|                                 methdata->refcnt_up_method,
  193|     51|                                 methdata->destruct_method);
  194|     51|}
evp_fetch.c:construct_evp_method:
  202|     51|{
  203|       |    /*
  204|       |     * This function is only called if get_evp_method_from_store() returned
  205|       |     * NULL, so it's safe to say that of all the spots to create a new
  206|       |     * namemap entry, this is it.  Should the name already exist there, we
  207|       |     * know that ossl_namemap_add_name() will return its corresponding
  208|       |     * number.
  209|       |     */
  210|     51|    struct evp_method_data_st *methdata = data;
  211|     51|    OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
  212|     51|    OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
  213|     51|    const char *names = algodef->algorithm_names;
  214|     51|    int name_id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
  ------------------
  |  |   24|     51|#define NAME_SEPARATOR ':'
  ------------------
  215|     51|    void *method;
  216|       |
  217|     51|    if (name_id == 0)
  ------------------
  |  Branch (217:9): [True: 0, False: 51]
  ------------------
  218|      0|        return NULL;
  219|       |
  220|     51|    method = methdata->method_from_algorithm(name_id, algodef, prov);
  221|       |
  222|       |    /*
  223|       |     * Flag to indicate that there was actual construction errors.  This
  224|       |     * helps inner_evp_generic_fetch() determine what error it should
  225|       |     * record on inaccessible algorithms.
  226|       |     */
  227|     51|    if (method == NULL)
  ------------------
  |  Branch (227:9): [True: 0, False: 51]
  ------------------
  228|      0|        methdata->flag_construct_error_occurred = 1;
  229|       |
  230|     51|    return method;
  231|     51|}
evp_fetch.c:destruct_evp_method:
  234|     51|{
  235|     51|    struct evp_method_data_st *methdata = data;
  236|       |
  237|     51|    methdata->destruct_method(method);
  238|     51|}
evp_fetch.c:dealloc_tmp_evp_method_store:
   57|  7.61k|{
   58|  7.61k|    if (store != NULL)
  ------------------
  |  Branch (58:9): [True: 0, False: 7.61k]
  ------------------
   59|      0|        ossl_method_store_free(store);
   60|  7.61k|}
evp_fetch.c:get_evp_method_store:
   63|  9.02k|{
   64|  9.02k|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX);
  ------------------
  |  |   98|  9.02k|# define OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX         0
  ------------------
   65|  9.02k|}
evp_fetch.c:filter_on_operation_id:
  578|  12.3k|{
  579|  12.3k|    struct filter_data_st *data = arg;
  580|       |
  581|  12.3k|    if ((id & METHOD_ID_OPERATION_MASK) == data->operation_id)
  ------------------
  |  |  106|  12.3k|#define METHOD_ID_OPERATION_MASK        0x000000FF
  ------------------
  |  Branch (581:9): [True: 4.82k, False: 7.50k]
  ------------------
  582|  4.82k|        data->user_fn(method, data->user_arg);
  583|  12.3k|}

EVP_CIPHER_get_type:
  277|    183|{
  278|    183|    int nid;
  279|    183|    nid = EVP_CIPHER_get_nid(cipher);
  280|       |
  281|    183|    switch (nid) {
  282|       |
  283|      3|    case NID_rc2_cbc:
  ------------------
  |  | 1276|      3|#define NID_rc2_cbc             37
  ------------------
  |  Branch (283:5): [True: 3, False: 180]
  ------------------
  284|      5|    case NID_rc2_64_cbc:
  ------------------
  |  | 1297|      5|#define NID_rc2_64_cbc          166
  ------------------
  |  Branch (284:5): [True: 2, False: 181]
  ------------------
  285|      7|    case NID_rc2_40_cbc:
  ------------------
  |  | 1293|      7|#define NID_rc2_40_cbc          98
  ------------------
  |  Branch (285:5): [True: 2, False: 181]
  ------------------
  286|       |
  287|      7|        return NID_rc2_cbc;
  ------------------
  |  | 1276|      7|#define NID_rc2_cbc             37
  ------------------
  288|       |
  289|      1|    case NID_rc4:
  ------------------
  |  | 1301|      1|#define NID_rc4         5
  ------------------
  |  Branch (289:5): [True: 1, False: 182]
  ------------------
  290|      2|    case NID_rc4_40:
  ------------------
  |  | 1306|      2|#define NID_rc4_40              97
  ------------------
  |  Branch (290:5): [True: 1, False: 182]
  ------------------
  291|       |
  292|      2|        return NID_rc4;
  ------------------
  |  | 1301|      2|#define NID_rc4         5
  ------------------
  293|       |
  294|      1|    case NID_aes_128_cfb128:
  ------------------
  |  | 3071|      1|#define NID_aes_128_cfb128              421
  ------------------
  |  Branch (294:5): [True: 1, False: 182]
  ------------------
  295|      2|    case NID_aes_128_cfb8:
  ------------------
  |  | 3192|      2|#define NID_aes_128_cfb8                653
  ------------------
  |  Branch (295:5): [True: 1, False: 182]
  ------------------
  296|      3|    case NID_aes_128_cfb1:
  ------------------
  |  | 3180|      3|#define NID_aes_128_cfb1                650
  ------------------
  |  Branch (296:5): [True: 1, False: 182]
  ------------------
  297|       |
  298|      3|        return NID_aes_128_cfb128;
  ------------------
  |  | 3071|      3|#define NID_aes_128_cfb128              421
  ------------------
  299|       |
  300|      1|    case NID_aes_192_cfb128:
  ------------------
  |  | 3109|      1|#define NID_aes_192_cfb128              425
  ------------------
  |  Branch (300:5): [True: 1, False: 182]
  ------------------
  301|      2|    case NID_aes_192_cfb8:
  ------------------
  |  | 3196|      2|#define NID_aes_192_cfb8                654
  ------------------
  |  Branch (301:5): [True: 1, False: 182]
  ------------------
  302|      3|    case NID_aes_192_cfb1:
  ------------------
  |  | 3184|      3|#define NID_aes_192_cfb1                651
  ------------------
  |  Branch (302:5): [True: 1, False: 182]
  ------------------
  303|       |
  304|      3|        return NID_aes_192_cfb128;
  ------------------
  |  | 3109|      3|#define NID_aes_192_cfb128              425
  ------------------
  305|       |
  306|      1|    case NID_aes_256_cfb128:
  ------------------
  |  | 3147|      1|#define NID_aes_256_cfb128              429
  ------------------
  |  Branch (306:5): [True: 1, False: 182]
  ------------------
  307|      2|    case NID_aes_256_cfb8:
  ------------------
  |  | 3200|      2|#define NID_aes_256_cfb8                655
  ------------------
  |  Branch (307:5): [True: 1, False: 182]
  ------------------
  308|      3|    case NID_aes_256_cfb1:
  ------------------
  |  | 3188|      3|#define NID_aes_256_cfb1                652
  ------------------
  |  Branch (308:5): [True: 1, False: 182]
  ------------------
  309|       |
  310|      3|        return NID_aes_256_cfb128;
  ------------------
  |  | 3147|      3|#define NID_aes_256_cfb128              429
  ------------------
  311|       |
  312|      1|    case NID_des_cfb64:
  ------------------
  |  | 2246|      1|#define NID_des_cfb64           30
  ------------------
  |  Branch (312:5): [True: 1, False: 182]
  ------------------
  313|      2|    case NID_des_cfb8:
  ------------------
  |  | 3232|      2|#define NID_des_cfb8            657
  ------------------
  |  Branch (313:5): [True: 1, False: 182]
  ------------------
  314|      3|    case NID_des_cfb1:
  ------------------
  |  | 3228|      3|#define NID_des_cfb1            656
  ------------------
  |  Branch (314:5): [True: 1, False: 182]
  ------------------
  315|       |
  316|      3|        return NID_des_cfb64;
  ------------------
  |  | 2246|      3|#define NID_des_cfb64           30
  ------------------
  317|       |
  318|      1|    case NID_des_ede3_cfb64:
  ------------------
  |  | 2287|      1|#define NID_des_ede3_cfb64              61
  ------------------
  |  Branch (318:5): [True: 1, False: 182]
  ------------------
  319|      2|    case NID_des_ede3_cfb8:
  ------------------
  |  | 3240|      2|#define NID_des_ede3_cfb8               659
  ------------------
  |  Branch (319:5): [True: 1, False: 182]
  ------------------
  320|      3|    case NID_des_ede3_cfb1:
  ------------------
  |  | 3236|      3|#define NID_des_ede3_cfb1               658
  ------------------
  |  Branch (320:5): [True: 1, False: 182]
  ------------------
  321|       |
  322|      3|        return NID_des_cfb64;
  ------------------
  |  | 2246|      3|#define NID_des_cfb64           30
  ------------------
  323|       |
  324|    159|    default:
  ------------------
  |  Branch (324:5): [True: 159, False: 24]
  ------------------
  325|       |#ifdef FIPS_MODULE
  326|       |        return NID_undef;
  327|       |#else
  328|    159|        {
  329|       |            /* Check it has an OID and it is valid */
  330|    159|            ASN1_OBJECT *otmp = OBJ_nid2obj(nid);
  331|       |
  332|    159|            if (OBJ_get0_data(otmp) == NULL)
  ------------------
  |  Branch (332:17): [True: 48, False: 111]
  ------------------
  333|     48|                nid = NID_undef;
  ------------------
  |  |   18|     48|#define NID_undef                       0
  ------------------
  334|    159|            ASN1_OBJECT_free(otmp);
  335|    159|            return nid;
  336|      2|        }
  337|    183|#endif
  338|    183|    }
  339|    183|}
EVP_CIPHER_get_nid:
  680|    183|{
  681|    183|    return cipher->nid;
  682|    183|}
EVP_MD_is_a:
  746|  7.33k|{
  747|  7.33k|    if (md == NULL)
  ------------------
  |  Branch (747:9): [True: 0, False: 7.33k]
  ------------------
  748|      0|        return 0;
  749|  7.33k|    if (md->prov != NULL)
  ------------------
  |  Branch (749:9): [True: 0, False: 7.33k]
  ------------------
  750|      0|        return evp_is_a(md->prov, md->name_id, NULL, name);
  751|  7.33k|    return evp_is_a(NULL, 0, EVP_MD_get0_name(md), name);
  752|  7.33k|}
EVP_MD_get0_name:
  771|  14.6k|{
  772|  14.6k|    if (md == NULL)
  ------------------
  |  Branch (772:9): [True: 0, False: 14.6k]
  ------------------
  773|      0|        return NULL;
  774|  14.6k|    if (md->type_name != NULL)
  ------------------
  |  Branch (774:9): [True: 0, False: 14.6k]
  ------------------
  775|      0|        return md->type_name;
  776|  14.6k|#ifndef FIPS_MODULE
  777|  14.6k|    return OBJ_nid2sn(EVP_MD_nid(md));
  ------------------
  |  |  535|  14.6k|# define EVP_MD_nid EVP_MD_get_type
  ------------------
  778|       |#else
  779|       |    return NULL;
  780|       |#endif
  781|  14.6k|}
EVP_MD_get0_provider:
  794|  7.33k|{
  795|  7.33k|    return md->prov;
  796|  7.33k|}
EVP_MD_get_type:
  799|  29.0k|{
  800|  29.0k|    return md->type;
  801|  29.0k|}
EVP_MD_get_size:
  818|  7.33k|{
  819|  7.33k|    if (md == NULL) {
  ------------------
  |  Branch (819:9): [True: 0, False: 7.33k]
  ------------------
  820|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_MESSAGE_DIGEST_IS_NULL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  821|      0|        return -1;
  822|      0|    }
  823|  7.33k|    return md->md_size;
  824|  7.33k|}
evp_md_free_int:
  865|     27|{
  866|     27|    OPENSSL_free(md->type_name);
  ------------------
  |  |  107|     27|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  867|     27|    ossl_provider_free(md->prov);
  868|     27|    CRYPTO_FREE_REF(&md->refcnt);
  869|     27|    OPENSSL_free(md);
  ------------------
  |  |  107|     27|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  870|     27|}
EVP_MD_CTX_set_flags:
 1085|  14.6k|{
 1086|  14.6k|    ctx->flags |= flags;
 1087|  14.6k|}
EVP_MD_CTX_clear_flags:
 1090|  7.34k|{
 1091|  7.34k|    ctx->flags &= ~flags;
 1092|  7.34k|}
EVP_MD_CTX_test_flags:
 1095|  7.34k|{
 1096|  7.34k|    return (ctx->flags & flags);
 1097|  7.34k|}
EVP_CIPHER_CTX_set_flags:
 1109|  1.35k|{
 1110|  1.35k|    int oldflags = ctx->flags;
 1111|       |
 1112|  1.35k|    ctx->flags |= flags;
 1113|  1.35k|    if (((oldflags ^ ctx->flags) & EVP_CIPH_FLAG_LENGTH_BITS) != 0)
  ------------------
  |  |  334|  1.35k|# define         EVP_CIPH_FLAG_LENGTH_BITS       0x2000
  ------------------
  |  Branch (1113:9): [True: 0, False: 1.35k]
  ------------------
 1114|      0|        evp_cipher_ctx_enable_use_bits(ctx, 1);
 1115|  1.35k|}

EVP_PBE_cleanup:
  295|      2|{
  296|      2|    sk_EVP_PBE_CTL_pop_free(pbe_algs, free_evp_pbe_ctl);
  297|      2|    pbe_algs = NULL;
  298|      2|}

evp_pkcs82pkey_legacy:
   27|    157|{
   28|    157|    EVP_PKEY *pkey = NULL;
   29|    157|    const ASN1_OBJECT *algoid;
   30|    157|    char obj_tmp[80];
   31|       |
   32|    157|    if (!PKCS8_pkey_get0(&algoid, NULL, NULL, NULL, p8))
  ------------------
  |  Branch (32:9): [True: 0, False: 157]
  ------------------
   33|      0|        return NULL;
   34|       |
   35|    157|    if ((pkey = EVP_PKEY_new()) == NULL) {
  ------------------
  |  Branch (35:9): [True: 0, False: 157]
  ------------------
   36|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   37|      0|        return NULL;
   38|      0|    }
   39|       |
   40|    157|    if (!EVP_PKEY_set_type(pkey, OBJ_obj2nid(algoid))) {
  ------------------
  |  Branch (40:9): [True: 23, False: 134]
  ------------------
   41|     23|        i2t_ASN1_OBJECT(obj_tmp, 80, algoid);
   42|     23|        ERR_raise_data(ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
  ------------------
  |  |  403|     23|    (ERR_new(),                                                 \
  |  |  404|     23|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|     23|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|     23|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|     23|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|     23|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
  ------------------
  |  |   76|     23|# define ERR_LIB_EVP             6
  ------------------
                      ERR_raise_data(ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
  ------------------
  |  |  126|     23|# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM          118
  ------------------
   43|     23|                       "TYPE=%s", obj_tmp);
   44|     23|        goto error;
   45|     23|    }
   46|       |
   47|    134|    if (pkey->ameth->priv_decode_ex != NULL) {
  ------------------
  |  Branch (47:9): [True: 39, False: 95]
  ------------------
   48|     39|        if (!pkey->ameth->priv_decode_ex(pkey, p8, libctx, propq))
  ------------------
  |  Branch (48:13): [True: 32, False: 7]
  ------------------
   49|     32|            goto error;
   50|     95|    } else if (pkey->ameth->priv_decode != NULL) {
  ------------------
  |  Branch (50:16): [True: 95, False: 0]
  ------------------
   51|     95|        if (!pkey->ameth->priv_decode(pkey, p8)) {
  ------------------
  |  Branch (51:13): [True: 28, False: 67]
  ------------------
   52|     28|            ERR_raise(ERR_LIB_EVP, EVP_R_PRIVATE_KEY_DECODE_ERROR);
  ------------------
  |  |  401|     28|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     28|    (ERR_new(),                                                 \
  |  |  |  |  404|     28|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     28|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     28|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     28|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     28|     ERR_set_error)
  |  |  ------------------
  ------------------
   53|     28|            goto error;
   54|     28|        }
   55|     95|    } else {
   56|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   57|      0|        goto error;
   58|      0|    }
   59|       |
   60|     74|    return pkey;
   61|       |
   62|     83| error:
   63|     83|    EVP_PKEY_free(pkey);
   64|     83|    return NULL;
   65|    134|}
EVP_PKEY2PKCS8:
  125|      4|{
  126|      4|    PKCS8_PRIV_KEY_INFO *p8 = NULL;
  127|      4|    OSSL_ENCODER_CTX *ctx = NULL;
  128|       |
  129|       |    /*
  130|       |     * The implementation for provider-native keys is to encode the
  131|       |     * key to a DER encoded PKCS#8 structure, then convert it to a
  132|       |     * PKCS8_PRIV_KEY_INFO with good old d2i functions.
  133|       |     */
  134|      4|    if (evp_pkey_is_provided(pkey)) {
  ------------------
  |  |  642|      4|    ((pk)->keymgmt != NULL)
  |  |  ------------------
  |  |  |  Branch (642:5): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  135|      0|        int selection = OSSL_KEYMGMT_SELECT_ALL;
  ------------------
  |  |  554|      0|    ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  ------------------
  |  |  |  |  552|      0|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|      0|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  ------------------
  |  |  |  |  549|      0|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  ------------------
  |  |  |  |  550|      0|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|      0|        unsigned char *der = NULL;
  137|      0|        size_t derlen = 0;
  138|      0|        const unsigned char *pp;
  139|       |
  140|      0|        if ((ctx = OSSL_ENCODER_CTX_new_for_pkey(pkey, selection,
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  ------------------
  141|      0|                                                 "DER", "PrivateKeyInfo",
  142|      0|                                                 NULL)) == NULL
  143|      0|            || !OSSL_ENCODER_to_data(ctx, &der, &derlen))
  ------------------
  |  Branch (143:16): [True: 0, False: 0]
  ------------------
  144|      0|            goto error;
  145|       |
  146|      0|        pp = der;
  147|      0|        p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &pp, (long)derlen);
  148|      0|        OPENSSL_free(der);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  149|      0|        if (p8 == NULL)
  ------------------
  |  Branch (149:13): [True: 0, False: 0]
  ------------------
  150|      0|            goto error;
  151|      4|    } else {
  152|      4|        p8 = PKCS8_PRIV_KEY_INFO_new();
  153|      4|        if (p8  == NULL) {
  ------------------
  |  Branch (153:13): [True: 0, False: 4]
  ------------------
  154|      0|            ERR_raise(ERR_LIB_EVP, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  155|      0|            return NULL;
  156|      0|        }
  157|       |
  158|      4|        if (pkey->ameth != NULL) {
  ------------------
  |  Branch (158:13): [True: 4, False: 0]
  ------------------
  159|      4|            if (pkey->ameth->priv_encode != NULL) {
  ------------------
  |  Branch (159:17): [True: 4, False: 0]
  ------------------
  160|      4|                if (!pkey->ameth->priv_encode(p8, pkey)) {
  ------------------
  |  Branch (160:21): [True: 0, False: 4]
  ------------------
  161|      0|                    ERR_raise(ERR_LIB_EVP, EVP_R_PRIVATE_KEY_ENCODE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  162|      0|                    goto error;
  163|      0|                }
  164|      4|            } else {
  165|      0|                ERR_raise(ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  166|      0|                goto error;
  167|      0|            }
  168|      4|        } else {
  169|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  170|      0|            goto error;
  171|      0|        }
  172|      4|    }
  173|      4|    goto end;
  174|      4| error:
  175|      0|    PKCS8_PRIV_KEY_INFO_free(p8);
  176|      0|    p8 = NULL;
  177|      4| end:
  178|      4|    OSSL_ENCODER_CTX_free(ctx);
  179|      4|    return p8;
  180|       |
  181|      0|}

EVP_RAND_enable_locking:
   93|      1|{
   94|      1|    if (rand->meth->enable_locking != NULL)
  ------------------
  |  Branch (94:9): [True: 1, False: 0]
  ------------------
   95|      1|        return rand->meth->enable_locking(rand->algctx);
   96|      1|    ERR_raise(ERR_LIB_EVP, EVP_R_LOCKING_NOT_SUPPORTED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   97|      0|    return 0;
   98|      1|}
EVP_RAND_fetch:
  275|      3|{
  276|      3|    return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties,
  ------------------
  |  |  258|      3|# define OSSL_OP_RAND                                5
  ------------------
  277|      3|                             evp_rand_from_algorithm, evp_rand_up_ref,
  278|      3|                             evp_rand_free);
  279|      3|}
EVP_RAND_up_ref:
  282|      3|{
  283|      3|    return evp_rand_up_ref(rand);
  284|      3|}
EVP_RAND_free:
  287|      6|{
  288|      6|    evp_rand_free(rand);
  289|      6|}
EVP_RAND_CTX_up_ref:
  324|      2|{
  325|      2|    int ref = 0;
  326|       |
  327|      2|    return CRYPTO_UP_REF(&ctx->refcnt, &ref);
  328|      2|}
EVP_RAND_CTX_new:
  331|      3|{
  332|      3|    EVP_RAND_CTX *ctx;
  333|      3|    void *parent_ctx = NULL;
  334|      3|    const OSSL_DISPATCH *parent_dispatch = NULL;
  335|       |
  336|      3|    if (rand == NULL) {
  ------------------
  |  Branch (336:9): [True: 0, False: 3]
  ------------------
  337|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_NULL_ALGORITHM);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  338|      0|        return NULL;
  339|      0|    }
  340|       |
  341|      3|    ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|      3|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  342|      3|    if (ctx == NULL)
  ------------------
  |  Branch (342:9): [True: 0, False: 3]
  ------------------
  343|      0|        return NULL;
  344|      3|    if (!CRYPTO_NEW_REF(&ctx->refcnt, 1)) {
  ------------------
  |  Branch (344:9): [True: 0, False: 3]
  ------------------
  345|      0|        OPENSSL_free(ctx);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  346|      0|        return NULL;
  347|      0|    }
  348|      3|    if (parent != NULL) {
  ------------------
  |  Branch (348:9): [True: 2, False: 1]
  ------------------
  349|      2|        if (!EVP_RAND_CTX_up_ref(parent)) {
  ------------------
  |  Branch (349:13): [True: 0, False: 2]
  ------------------
  350|      0|            ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  351|      0|            CRYPTO_FREE_REF(&ctx->refcnt);
  352|      0|            OPENSSL_free(ctx);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  353|      0|            return NULL;
  354|      0|        }
  355|      2|        parent_ctx = parent->algctx;
  356|      2|        parent_dispatch = parent->meth->dispatch;
  357|      2|    }
  358|      3|    if ((ctx->algctx = rand->newctx(ossl_provider_ctx(rand->prov), parent_ctx,
  ------------------
  |  Branch (358:9): [True: 0, False: 3]
  ------------------
  359|      3|                                    parent_dispatch)) == NULL
  360|      3|            || !EVP_RAND_up_ref(rand)) {
  ------------------
  |  Branch (360:16): [True: 0, False: 3]
  ------------------
  361|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  362|      0|        rand->freectx(ctx->algctx);
  363|      0|        CRYPTO_FREE_REF(&ctx->refcnt);
  364|      0|        OPENSSL_free(ctx);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  365|      0|        EVP_RAND_CTX_free(parent);
  366|      0|        return NULL;
  367|      0|    }
  368|      3|    ctx->meth = rand;
  369|      3|    ctx->parent = parent;
  370|      3|    return ctx;
  371|      3|}
EVP_RAND_CTX_free:
  374|      9|{
  375|      9|    int ref = 0;
  376|      9|    EVP_RAND_CTX *parent;
  377|       |
  378|      9|    if (ctx == NULL)
  ------------------
  |  Branch (378:9): [True: 4, False: 5]
  ------------------
  379|      4|        return;
  380|       |
  381|      5|    CRYPTO_DOWN_REF(&ctx->refcnt, &ref);
  382|      5|    if (ref > 0)
  ------------------
  |  Branch (382:9): [True: 2, False: 3]
  ------------------
  383|      2|        return;
  384|      3|    parent = ctx->parent;
  385|      3|    ctx->meth->freectx(ctx->algctx);
  386|      3|    ctx->algctx = NULL;
  387|      3|    EVP_RAND_free(ctx->meth);
  388|      3|    CRYPTO_FREE_REF(&ctx->refcnt);
  389|      3|    OPENSSL_free(ctx);
  ------------------
  |  |  107|      3|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  390|      3|    EVP_RAND_CTX_free(parent);
  391|      3|}
EVP_RAND_CTX_settable_params:
  472|      2|{
  473|      2|    void *provctx;
  474|       |
  475|      2|    if (ctx->meth->settable_ctx_params == NULL)
  ------------------
  |  Branch (475:9): [True: 2, False: 0]
  ------------------
  476|      2|        return NULL;
  477|      0|    provctx = ossl_provider_ctx(EVP_RAND_get0_provider(ctx->meth));
  478|      0|    return ctx->meth->settable_ctx_params(ctx->algctx, provctx);
  479|      2|}
EVP_RAND_instantiate:
  513|      3|{
  514|      3|    int res;
  515|       |
  516|      3|    if (!evp_rand_lock(ctx))
  ------------------
  |  Branch (516:9): [True: 0, False: 3]
  ------------------
  517|      0|        return 0;
  518|      3|    res = evp_rand_instantiate_locked(ctx, strength, prediction_resistance,
  519|      3|                                      pstr, pstr_len, params);
  520|      3|    evp_rand_unlock(ctx);
  521|      3|    return res;
  522|      3|}
EVP_RAND_generate:
  575|  52.6k|{
  576|  52.6k|    int res;
  577|       |
  578|  52.6k|    if (!evp_rand_lock(ctx))
  ------------------
  |  Branch (578:9): [True: 0, False: 52.6k]
  ------------------
  579|      0|        return 0;
  580|  52.6k|    res = evp_rand_generate_locked(ctx, out, outlen, strength,
  581|  52.6k|                                   prediction_resistance, addin, addin_len);
  582|  52.6k|    evp_rand_unlock(ctx);
  583|  52.6k|    return res;
  584|  52.6k|}
evp_rand.c:evp_rand_from_algorithm:
  118|      6|{
  119|      6|    const OSSL_DISPATCH *fns = algodef->implementation;
  120|      6|    EVP_RAND *rand = NULL;
  121|      6|    int fnrandcnt = 0, fnctxcnt = 0, fnlockcnt = 0, fnenablelockcnt = 0;
  122|       |#ifdef FIPS_MODULE
  123|       |    int fnzeroizecnt = 0;
  124|       |#endif
  125|       |
  126|      6|    if ((rand = evp_rand_new()) == NULL) {
  ------------------
  |  Branch (126:9): [True: 0, False: 6]
  ------------------
  127|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  128|      0|        return NULL;
  129|      0|    }
  130|      6|    rand->name_id = name_id;
  131|      6|    if ((rand->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (131:9): [True: 0, False: 6]
  ------------------
  132|      0|        evp_rand_free(rand);
  133|      0|        return NULL;
  134|      0|    }
  135|      6|    rand->description = algodef->algorithm_description;
  136|      6|    rand->dispatch = fns;
  137|     92|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (137:12): [True: 86, False: 6]
  ------------------
  138|     86|        switch (fns->function_id) {
  ------------------
  |  Branch (138:17): [True: 9, False: 77]
  ------------------
  139|      6|        case OSSL_FUNC_RAND_NEWCTX:
  ------------------
  |  |  437|      6|# define OSSL_FUNC_RAND_NEWCTX                        1
  ------------------
  |  Branch (139:9): [True: 6, False: 80]
  ------------------
  140|      6|            if (rand->newctx != NULL)
  ------------------
  |  Branch (140:17): [True: 0, False: 6]
  ------------------
  141|      0|                break;
  142|      6|            rand->newctx = OSSL_FUNC_rand_newctx(fns);
  143|      6|            fnctxcnt++;
  144|      6|            break;
  145|      6|        case OSSL_FUNC_RAND_FREECTX:
  ------------------
  |  |  438|      6|# define OSSL_FUNC_RAND_FREECTX                       2
  ------------------
  |  Branch (145:9): [True: 6, False: 80]
  ------------------
  146|      6|            if (rand->freectx != NULL)
  ------------------
  |  Branch (146:17): [True: 0, False: 6]
  ------------------
  147|      0|                break;
  148|      6|            rand->freectx = OSSL_FUNC_rand_freectx(fns);
  149|      6|            fnctxcnt++;
  150|      6|            break;
  151|      6|        case OSSL_FUNC_RAND_INSTANTIATE:
  ------------------
  |  |  439|      6|# define OSSL_FUNC_RAND_INSTANTIATE                   3
  ------------------
  |  Branch (151:9): [True: 6, False: 80]
  ------------------
  152|      6|            if (rand->instantiate != NULL)
  ------------------
  |  Branch (152:17): [True: 0, False: 6]
  ------------------
  153|      0|                break;
  154|      6|            rand->instantiate = OSSL_FUNC_rand_instantiate(fns);
  155|      6|            fnrandcnt++;
  156|      6|            break;
  157|      6|        case OSSL_FUNC_RAND_UNINSTANTIATE:
  ------------------
  |  |  440|      6|# define OSSL_FUNC_RAND_UNINSTANTIATE                 4
  ------------------
  |  Branch (157:9): [True: 6, False: 80]
  ------------------
  158|      6|             if (rand->uninstantiate != NULL)
  ------------------
  |  Branch (158:18): [True: 0, False: 6]
  ------------------
  159|      0|                break;
  160|      6|            rand->uninstantiate = OSSL_FUNC_rand_uninstantiate(fns);
  161|      6|            fnrandcnt++;
  162|      6|            break;
  163|      6|        case OSSL_FUNC_RAND_GENERATE:
  ------------------
  |  |  441|      6|# define OSSL_FUNC_RAND_GENERATE                      5
  ------------------
  |  Branch (163:9): [True: 6, False: 80]
  ------------------
  164|      6|            if (rand->generate != NULL)
  ------------------
  |  Branch (164:17): [True: 0, False: 6]
  ------------------
  165|      0|                break;
  166|      6|            rand->generate = OSSL_FUNC_rand_generate(fns);
  167|      6|            fnrandcnt++;
  168|      6|            break;
  169|      5|        case OSSL_FUNC_RAND_RESEED:
  ------------------
  |  |  442|      5|# define OSSL_FUNC_RAND_RESEED                        6
  ------------------
  |  Branch (169:9): [True: 5, False: 81]
  ------------------
  170|      5|            if (rand->reseed != NULL)
  ------------------
  |  Branch (170:17): [True: 0, False: 5]
  ------------------
  171|      0|                break;
  172|      5|            rand->reseed = OSSL_FUNC_rand_reseed(fns);
  173|      5|            break;
  174|      1|        case OSSL_FUNC_RAND_NONCE:
  ------------------
  |  |  443|      1|# define OSSL_FUNC_RAND_NONCE                         7
  ------------------
  |  Branch (174:9): [True: 1, False: 85]
  ------------------
  175|      1|            if (rand->nonce != NULL)
  ------------------
  |  Branch (175:17): [True: 0, False: 1]
  ------------------
  176|      0|                break;
  177|      1|            rand->nonce = OSSL_FUNC_rand_nonce(fns);
  178|      1|            break;
  179|      6|        case OSSL_FUNC_RAND_ENABLE_LOCKING:
  ------------------
  |  |  444|      6|# define OSSL_FUNC_RAND_ENABLE_LOCKING                8
  ------------------
  |  Branch (179:9): [True: 6, False: 80]
  ------------------
  180|      6|            if (rand->enable_locking != NULL)
  ------------------
  |  Branch (180:17): [True: 0, False: 6]
  ------------------
  181|      0|                break;
  182|      6|            rand->enable_locking = OSSL_FUNC_rand_enable_locking(fns);
  183|      6|            fnenablelockcnt++;
  184|      6|            break;
  185|      5|        case OSSL_FUNC_RAND_LOCK:
  ------------------
  |  |  445|      5|# define OSSL_FUNC_RAND_LOCK                          9
  ------------------
  |  Branch (185:9): [True: 5, False: 81]
  ------------------
  186|      5|            if (rand->lock != NULL)
  ------------------
  |  Branch (186:17): [True: 0, False: 5]
  ------------------
  187|      0|                break;
  188|      5|            rand->lock = OSSL_FUNC_rand_lock(fns);
  189|      5|            fnlockcnt++;
  190|      5|            break;
  191|      5|        case OSSL_FUNC_RAND_UNLOCK:
  ------------------
  |  |  446|      5|# define OSSL_FUNC_RAND_UNLOCK                       10
  ------------------
  |  Branch (191:9): [True: 5, False: 81]
  ------------------
  192|      5|            if (rand->unlock != NULL)
  ------------------
  |  Branch (192:17): [True: 0, False: 5]
  ------------------
  193|      0|                break;
  194|      5|            rand->unlock = OSSL_FUNC_rand_unlock(fns);
  195|      5|            fnlockcnt++;
  196|      5|            break;
  197|      0|        case OSSL_FUNC_RAND_GETTABLE_PARAMS:
  ------------------
  |  |  447|      0|# define OSSL_FUNC_RAND_GETTABLE_PARAMS              11
  ------------------
  |  Branch (197:9): [True: 0, False: 86]
  ------------------
  198|      0|            if (rand->gettable_params != NULL)
  ------------------
  |  Branch (198:17): [True: 0, False: 0]
  ------------------
  199|      0|                break;
  200|      0|            rand->gettable_params =
  201|      0|                OSSL_FUNC_rand_gettable_params(fns);
  202|      0|            break;
  203|      6|        case OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS:
  ------------------
  |  |  448|      6|# define OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS          12
  ------------------
  |  Branch (203:9): [True: 6, False: 80]
  ------------------
  204|      6|            if (rand->gettable_ctx_params != NULL)
  ------------------
  |  Branch (204:17): [True: 0, False: 6]
  ------------------
  205|      0|                break;
  206|      6|            rand->gettable_ctx_params =
  207|      6|                OSSL_FUNC_rand_gettable_ctx_params(fns);
  208|      6|            break;
  209|      4|        case OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS:
  ------------------
  |  |  449|      4|# define OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS          13
  ------------------
  |  Branch (209:9): [True: 4, False: 82]
  ------------------
  210|      4|            if (rand->settable_ctx_params != NULL)
  ------------------
  |  Branch (210:17): [True: 0, False: 4]
  ------------------
  211|      0|                break;
  212|      4|            rand->settable_ctx_params =
  213|      4|                OSSL_FUNC_rand_settable_ctx_params(fns);
  214|      4|            break;
  215|      0|        case OSSL_FUNC_RAND_GET_PARAMS:
  ------------------
  |  |  450|      0|# define OSSL_FUNC_RAND_GET_PARAMS                   14
  ------------------
  |  Branch (215:9): [True: 0, False: 86]
  ------------------
  216|      0|            if (rand->get_params != NULL)
  ------------------
  |  Branch (216:17): [True: 0, False: 0]
  ------------------
  217|      0|                break;
  218|      0|            rand->get_params = OSSL_FUNC_rand_get_params(fns);
  219|      0|            break;
  220|      6|        case OSSL_FUNC_RAND_GET_CTX_PARAMS:
  ------------------
  |  |  451|      6|# define OSSL_FUNC_RAND_GET_CTX_PARAMS               15
  ------------------
  |  Branch (220:9): [True: 6, False: 80]
  ------------------
  221|      6|            if (rand->get_ctx_params != NULL)
  ------------------
  |  Branch (221:17): [True: 0, False: 6]
  ------------------
  222|      0|                break;
  223|      6|            rand->get_ctx_params = OSSL_FUNC_rand_get_ctx_params(fns);
  224|      6|            fnctxcnt++;
  225|      6|            break;
  226|      4|        case OSSL_FUNC_RAND_SET_CTX_PARAMS:
  ------------------
  |  |  452|      4|# define OSSL_FUNC_RAND_SET_CTX_PARAMS               16
  ------------------
  |  Branch (226:9): [True: 4, False: 82]
  ------------------
  227|      4|            if (rand->set_ctx_params != NULL)
  ------------------
  |  Branch (227:17): [True: 0, False: 4]
  ------------------
  228|      0|                break;
  229|      4|            rand->set_ctx_params = OSSL_FUNC_rand_set_ctx_params(fns);
  230|      4|            break;
  231|      5|        case OSSL_FUNC_RAND_VERIFY_ZEROIZATION:
  ------------------
  |  |  453|      5|# define OSSL_FUNC_RAND_VERIFY_ZEROIZATION           17
  ------------------
  |  Branch (231:9): [True: 5, False: 81]
  ------------------
  232|      5|            if (rand->verify_zeroization != NULL)
  ------------------
  |  Branch (232:17): [True: 0, False: 5]
  ------------------
  233|      0|                break;
  234|      5|            rand->verify_zeroization = OSSL_FUNC_rand_verify_zeroization(fns);
  235|       |#ifdef FIPS_MODULE
  236|       |            fnzeroizecnt++;
  237|       |#endif
  238|      5|            break;
  239|     86|        }
  240|     86|    }
  241|       |    /*
  242|       |     * In order to be a consistent set of functions we must have at least
  243|       |     * a complete set of "rand" functions and a complete set of context
  244|       |     * management functions.  In FIPS mode, we also require the zeroization
  245|       |     * verification function.
  246|       |     *
  247|       |     * In addition, if locking can be enabled, we need a complete set of
  248|       |     * locking functions.
  249|       |     */
  250|      6|    if (fnrandcnt != 3
  ------------------
  |  Branch (250:9): [True: 0, False: 6]
  ------------------
  251|      6|            || fnctxcnt != 3
  ------------------
  |  Branch (251:16): [True: 0, False: 6]
  ------------------
  252|      6|            || (fnenablelockcnt != 0 && fnenablelockcnt != 1)
  ------------------
  |  Branch (252:17): [True: 6, False: 0]
  |  Branch (252:41): [True: 0, False: 6]
  ------------------
  253|      6|            || (fnlockcnt != 0 && fnlockcnt != 2)
  ------------------
  |  Branch (253:17): [True: 5, False: 1]
  |  Branch (253:35): [True: 0, False: 5]
  ------------------
  254|       |#ifdef FIPS_MODULE
  255|       |            || fnzeroizecnt != 1
  256|       |#endif
  257|      6|       ) {
  258|      0|        evp_rand_free(rand);
  259|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  260|      0|        return NULL;
  261|      0|    }
  262|       |
  263|      6|    if (prov != NULL && !ossl_provider_up_ref(prov)) {
  ------------------
  |  Branch (263:9): [True: 6, False: 0]
  |  Branch (263:25): [True: 0, False: 6]
  ------------------
  264|      0|        evp_rand_free(rand);
  265|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  266|      0|        return NULL;
  267|      0|    }
  268|      6|    rand->prov = prov;
  269|       |
  270|      6|    return rand;
  271|      6|}
evp_rand.c:evp_rand_new:
   78|      6|{
   79|      6|    EVP_RAND *rand = OPENSSL_zalloc(sizeof(*rand));
  ------------------
  |  |   99|      6|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   80|       |
   81|      6|    if (rand == NULL)
  ------------------
  |  Branch (81:9): [True: 0, False: 6]
  ------------------
   82|      0|        return NULL;
   83|       |
   84|      6|    if (!CRYPTO_NEW_REF(&rand->refcnt, 1)) {
  ------------------
  |  Branch (84:9): [True: 0, False: 6]
  ------------------
   85|      0|        OPENSSL_free(rand);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   86|      0|        return NULL;
   87|      0|    }
   88|      6|    return rand;
   89|      6|}
evp_rand.c:evp_rand_up_ref:
   52|     14|{
   53|     14|    EVP_RAND *rand = (EVP_RAND *)vrand;
   54|     14|    int ref = 0;
   55|       |
   56|     14|    if (rand != NULL)
  ------------------
  |  Branch (56:9): [True: 14, False: 0]
  ------------------
   57|     14|        return CRYPTO_UP_REF(&rand->refcnt, &ref);
   58|      0|    return 1;
   59|     14|}
evp_rand.c:evp_rand_free:
   62|     20|{
   63|     20|    EVP_RAND *rand = (EVP_RAND *)vrand;
   64|     20|    int ref = 0;
   65|       |
   66|     20|    if (rand == NULL)
  ------------------
  |  Branch (66:9): [True: 0, False: 20]
  ------------------
   67|      0|        return;
   68|     20|    CRYPTO_DOWN_REF(&rand->refcnt, &ref);
   69|     20|    if (ref > 0)
  ------------------
  |  Branch (69:9): [True: 14, False: 6]
  ------------------
   70|     14|        return;
   71|      6|    OPENSSL_free(rand->type_name);
  ------------------
  |  |  107|      6|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   72|      6|    ossl_provider_free(rand->prov);
   73|      6|    CRYPTO_FREE_REF(&rand->refcnt);
   74|      6|    OPENSSL_free(rand);
  ------------------
  |  |  107|      6|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   75|      6|}
evp_rand.c:evp_rand_lock:
  102|  52.6k|{
  103|  52.6k|    if (rand->meth->lock != NULL)
  ------------------
  |  Branch (103:9): [True: 1, False: 52.6k]
  ------------------
  104|      1|        return rand->meth->lock(rand->algctx);
  105|  52.6k|    return 1;
  106|  52.6k|}
evp_rand.c:evp_rand_get_ctx_params_locked:
  400|  52.6k|{
  401|  52.6k|    return ctx->meth->get_ctx_params(ctx->algctx, params);
  402|  52.6k|}
evp_rand.c:evp_rand_unlock:
  110|  52.6k|{
  111|  52.6k|    if (rand->meth->unlock != NULL)
  ------------------
  |  Branch (111:9): [True: 1, False: 52.6k]
  ------------------
  112|      1|        rand->meth->unlock(rand->algctx);
  113|  52.6k|}
evp_rand.c:evp_rand_instantiate_locked:
  504|      3|{
  505|      3|    return ctx->meth->instantiate(ctx->algctx, strength, prediction_resistance,
  506|      3|                                  pstr, pstr_len, params);
  507|      3|}
evp_rand.c:evp_rand_generate_locked:
  545|  52.6k|{
  546|  52.6k|    size_t chunk, max_request = 0;
  547|  52.6k|    OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|  52.6k|    { NULL, 0, NULL, 0, 0 }
  ------------------
                  OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
  ------------------
  |  |   25|  52.6k|    { NULL, 0, NULL, 0, 0 }
  ------------------
  548|       |
  549|  52.6k|    params[0] = OSSL_PARAM_construct_size_t(OSSL_RAND_PARAM_MAX_REQUEST,
  ------------------
  |  |  443|  52.6k|# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
  ------------------
  550|  52.6k|                                            &max_request);
  551|  52.6k|    if (!evp_rand_get_ctx_params_locked(ctx, params)
  ------------------
  |  Branch (551:9): [True: 0, False: 52.6k]
  ------------------
  552|  52.6k|            || max_request == 0) {
  ------------------
  |  Branch (552:16): [True: 0, False: 52.6k]
  ------------------
  553|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  554|      0|        return 0;
  555|      0|    }
  556|   105k|    for (; outlen > 0; outlen -= chunk, out += chunk) {
  ------------------
  |  Branch (556:12): [True: 52.6k, False: 52.6k]
  ------------------
  557|  52.6k|        chunk = outlen > max_request ? max_request : outlen;
  ------------------
  |  Branch (557:17): [True: 0, False: 52.6k]
  ------------------
  558|  52.6k|        if (!ctx->meth->generate(ctx->algctx, out, chunk, strength,
  ------------------
  |  Branch (558:13): [True: 0, False: 52.6k]
  ------------------
  559|  52.6k|                                 prediction_resistance, addin, addin_len)) {
  560|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_GENERATE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  561|      0|            return 0;
  562|      0|        }
  563|       |        /*
  564|       |         * Prediction resistance is only relevant the first time around,
  565|       |         * subsequently, the DRBG has already been properly reseeded.
  566|       |         */
  567|  52.6k|        prediction_resistance = 0;
  568|  52.6k|    }
  569|  52.6k|    return 1;
  570|  52.6k|}

evp_do_md_getparams:
   38|     27|int name (const type *obj, OSSL_PARAM params[])                                \
   39|     27|{                                                                              \
   40|     54|    PARAM_CHECK(obj, func, err)                                                \
  ------------------
  |  |   28|     27|    if (obj == NULL)                                                           \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 0, False: 27]
  |  |  ------------------
  |  |   29|     27|        return 0;                                                              \
  |  |   30|     27|    if (obj->prov == NULL)                                                     \
  |  |  ------------------
  |  |  |  Branch (30:9): [True: 0, False: 27]
  |  |  ------------------
  |  |   31|     27|        return EVP_CTRL_RET_UNSUPPORTED;                                       \
  |  |  ------------------
  |  |  |  |   13|      0|#define EVP_CTRL_RET_UNSUPPORTED -1
  |  |  ------------------
  |  |   32|     27|    if (obj->func == NULL) {                                                   \
  |  |  ------------------
  |  |  |  Branch (32:9): [True: 0, False: 27]
  |  |  ------------------
  |  |   33|      0|        errfunc();                                                             \
  |  |   34|      0|        return 0;                                                              \
  |  |   35|      0|    }
  ------------------
   41|     54|    return obj->func(params);                                                  \
   42|     54|}

evp_keymgmt_util_assign_pkey:
   62|  15.0k|{
   63|  15.0k|    if (pkey == NULL || keymgmt == NULL || keydata == NULL
  ------------------
  |  Branch (63:9): [True: 0, False: 15.0k]
  |  Branch (63:25): [True: 0, False: 15.0k]
  |  Branch (63:44): [True: 0, False: 15.0k]
  ------------------
   64|  15.0k|        || !EVP_PKEY_set_type_by_keymgmt(pkey, keymgmt)) {
  ------------------
  |  Branch (64:12): [True: 0, False: 15.0k]
  ------------------
   65|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   66|      0|        return 0;
   67|      0|    }
   68|  15.0k|    pkey->keydata = keydata;
   69|  15.0k|    evp_keymgmt_util_cache_keyinfo(pkey);
   70|  15.0k|    return 1;
   71|  15.0k|}
evp_keymgmt_util_make_pkey:
   74|  15.0k|{
   75|  15.0k|    EVP_PKEY *pkey = NULL;
   76|       |
   77|  15.0k|    if (keymgmt == NULL
  ------------------
  |  Branch (77:9): [True: 0, False: 15.0k]
  ------------------
   78|  15.0k|        || keydata == NULL
  ------------------
  |  Branch (78:12): [True: 0, False: 15.0k]
  ------------------
   79|  15.0k|        || (pkey = EVP_PKEY_new()) == NULL
  ------------------
  |  Branch (79:12): [True: 0, False: 15.0k]
  ------------------
   80|  15.0k|        || !evp_keymgmt_util_assign_pkey(pkey, keymgmt, keydata)) {
  ------------------
  |  Branch (80:12): [True: 0, False: 15.0k]
  ------------------
   81|      0|        EVP_PKEY_free(pkey);
   82|      0|        return NULL;
   83|      0|    }
   84|  15.0k|    return pkey;
   85|  15.0k|}
evp_keymgmt_util_clear_operation_cache:
  223|  54.8k|{
  224|  54.8k|    if (pk != NULL) {
  ------------------
  |  Branch (224:9): [True: 54.8k, False: 0]
  ------------------
  225|  54.8k|        sk_OP_CACHE_ELEM_pop_free(pk->operation_cache, op_cache_free);
  226|  54.8k|        pk->operation_cache = NULL;
  227|  54.8k|    }
  228|       |
  229|  54.8k|    return 1;
  230|  54.8k|}
evp_keymgmt_util_cache_keyinfo:
  285|  15.0k|{
  286|       |    /*
  287|       |     * Cache information about the provider "origin" key.
  288|       |     *
  289|       |     * This services functions like EVP_PKEY_get_size, EVP_PKEY_get_bits, etc
  290|       |     */
  291|  15.0k|    if (pk->keydata != NULL) {
  ------------------
  |  Branch (291:9): [True: 15.0k, False: 0]
  ------------------
  292|  15.0k|        int bits = 0;
  293|  15.0k|        int security_bits = 0;
  294|  15.0k|        int size = 0;
  295|  15.0k|        OSSL_PARAM params[4];
  296|       |
  297|  15.0k|        params[0] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_BITS, &bits);
  ------------------
  |  |  316|  15.0k|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  298|  15.0k|        params[1] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_SECURITY_BITS,
  ------------------
  |  |  427|  15.0k|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  299|  15.0k|                                             &security_bits);
  300|  15.0k|        params[2] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_MAX_SIZE, &size);
  ------------------
  |  |  368|  15.0k|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  301|  15.0k|        params[3] = OSSL_PARAM_construct_end();
  302|  15.0k|        if (evp_keymgmt_get_params(pk->keymgmt, pk->keydata, params)) {
  ------------------
  |  Branch (302:13): [True: 15.0k, False: 0]
  ------------------
  303|  15.0k|            pk->cache.size = size;
  304|  15.0k|            pk->cache.bits = bits;
  305|  15.0k|            pk->cache.security_bits = security_bits;
  306|  15.0k|        }
  307|  15.0k|    }
  308|  15.0k|}
evp_keymgmt_util_has:
  325|  1.45k|{
  326|       |    /* Check if key is even assigned */
  327|  1.45k|    if (pk->keymgmt == NULL)
  ------------------
  |  Branch (327:9): [True: 0, False: 1.45k]
  ------------------
  328|      0|        return 0;
  329|       |
  330|  1.45k|    return evp_keymgmt_has(pk->keymgmt, pk->keydata, selection);
  331|  1.45k|}

EVP_KEYMGMT_up_ref:
  245|   279k|{
  246|   279k|    int ref = 0;
  247|       |
  248|   279k|    CRYPTO_UP_REF(&keymgmt->refcnt, &ref);
  249|   279k|    return 1;
  250|   279k|}
EVP_KEYMGMT_free:
  253|   279k|{
  254|   279k|    int ref = 0;
  255|       |
  256|   279k|    if (keymgmt == NULL)
  ------------------
  |  Branch (256:9): [True: 0, False: 279k]
  ------------------
  257|      0|        return;
  258|       |
  259|   279k|    CRYPTO_DOWN_REF(&keymgmt->refcnt, &ref);
  260|   279k|    if (ref > 0)
  ------------------
  |  Branch (260:9): [True: 279k, False: 18]
  ------------------
  261|   279k|        return;
  262|     18|    OPENSSL_free(keymgmt->type_name);
  ------------------
  |  |  107|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  263|     18|    ossl_provider_free(keymgmt->prov);
  264|     18|    CRYPTO_FREE_REF(&keymgmt->refcnt);
  265|     18|    OPENSSL_free(keymgmt);
  ------------------
  |  |  107|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  266|     18|}
EVP_KEYMGMT_get0_provider:
  269|  25.9k|{
  270|  25.9k|    return keymgmt->prov;
  271|  25.9k|}
EVP_KEYMGMT_is_a:
  289|  16.7k|{
  290|  16.7k|    return keymgmt != NULL
  ------------------
  |  Branch (290:12): [True: 16.7k, False: 0]
  ------------------
  291|  16.7k|           && evp_is_a(keymgmt->prov, keymgmt->name_id, NULL, name);
  ------------------
  |  Branch (291:15): [True: 15.0k, False: 1.75k]
  ------------------
  292|  16.7k|}
EVP_KEYMGMT_do_all_provided:
  297|    268|{
  298|    268|    evp_generic_do_all(libctx, OSSL_OP_KEYMGMT,
  ------------------
  |  |  259|    268|# define OSSL_OP_KEYMGMT                            10
  ------------------
  299|    268|                       (void (*)(void *, void *))fn, arg,
  300|    268|                       keymgmt_from_algorithm,
  301|    268|                       (int (*)(void *))EVP_KEYMGMT_up_ref,
  302|    268|                       (void (*)(void *))EVP_KEYMGMT_free);
  303|    268|}
EVP_KEYMGMT_names_do_all:
  308|  18.0k|{
  309|  18.0k|    if (keymgmt->prov != NULL)
  ------------------
  |  Branch (309:9): [True: 18.0k, False: 0]
  ------------------
  310|  18.0k|        return evp_names_do_all(keymgmt->prov, keymgmt->name_id, fn, data);
  311|       |
  312|      0|    return 1;
  313|  18.0k|}
evp_keymgmt_freedata:
  333|  15.0k|{
  334|       |    /* This is mandatory, no need to check for its presence */
  335|  15.0k|    keymgmt->free(keydata);
  336|  15.0k|}
evp_keymgmt_has_load:
  394|  31.7k|{
  395|  31.7k|    return keymgmt != NULL && keymgmt->load != NULL;
  ------------------
  |  Branch (395:12): [True: 31.7k, False: 0]
  |  Branch (395:31): [True: 31.7k, False: 0]
  ------------------
  396|  31.7k|}
evp_keymgmt_load:
  400|  15.0k|{
  401|  15.0k|    if (evp_keymgmt_has_load(keymgmt))
  ------------------
  |  Branch (401:9): [True: 15.0k, False: 0]
  ------------------
  402|  15.0k|        return keymgmt->load(objref, objref_sz);
  403|      0|    return NULL;
  404|  15.0k|}
evp_keymgmt_get_params:
  408|  15.0k|{
  409|  15.0k|    if (keymgmt->get_params == NULL)
  ------------------
  |  Branch (409:9): [True: 0, False: 15.0k]
  ------------------
  410|      0|        return 1;
  411|  15.0k|    return keymgmt->get_params(keydata, params);
  412|  15.0k|}
evp_keymgmt_has:
  441|  1.45k|{
  442|       |    /* This is mandatory, no need to check for its presence */
  443|  1.45k|    return keymgmt->has(keydata, selection);
  444|  1.45k|}
keymgmt_meth.c:keymgmt_from_algorithm:
   36|     18|{
   37|     18|    const OSSL_DISPATCH *fns = algodef->implementation;
   38|     18|    EVP_KEYMGMT *keymgmt = NULL;
   39|     18|    int setparamfncnt = 0, getparamfncnt = 0;
   40|     18|    int setgenparamfncnt = 0;
   41|     18|    int importfncnt = 0, exportfncnt = 0;
   42|     18|    int importtypesfncnt = 0, exporttypesfncnt = 0;
   43|       |
   44|     18|    if ((keymgmt = keymgmt_new()) == NULL)
  ------------------
  |  Branch (44:9): [True: 0, False: 18]
  ------------------
   45|      0|        return NULL;
   46|       |
   47|     18|    keymgmt->name_id = name_id;
   48|     18|    if ((keymgmt->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
  ------------------
  |  Branch (48:9): [True: 0, False: 18]
  ------------------
   49|      0|        EVP_KEYMGMT_free(keymgmt);
   50|      0|        return NULL;
   51|      0|    }
   52|     18|    keymgmt->description = algodef->algorithm_description;
   53|       |
   54|    318|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (54:12): [True: 300, False: 18]
  ------------------
   55|    300|        switch (fns->function_id) {
  ------------------
  |  Branch (55:17): [True: 0, False: 300]
  ------------------
   56|     18|        case OSSL_FUNC_KEYMGMT_NEW:
  ------------------
  |  |  560|     18|# define OSSL_FUNC_KEYMGMT_NEW                         1
  ------------------
  |  Branch (56:9): [True: 18, False: 282]
  ------------------
   57|     18|            if (keymgmt->new == NULL)
  ------------------
  |  Branch (57:17): [True: 18, False: 0]
  ------------------
   58|     18|                keymgmt->new = OSSL_FUNC_keymgmt_new(fns);
   59|     18|            break;
   60|     15|        case OSSL_FUNC_KEYMGMT_GEN_INIT:
  ------------------
  |  |  564|     15|# define OSSL_FUNC_KEYMGMT_GEN_INIT                    2
  ------------------
  |  Branch (60:9): [True: 15, False: 285]
  ------------------
   61|     15|            if (keymgmt->gen_init == NULL)
  ------------------
  |  Branch (61:17): [True: 15, False: 0]
  ------------------
   62|     15|                keymgmt->gen_init = OSSL_FUNC_keymgmt_gen_init(fns);
   63|     15|            break;
   64|      5|        case OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE:
  ------------------
  |  |  565|      5|# define OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE            3
  ------------------
  |  Branch (64:9): [True: 5, False: 295]
  ------------------
   65|      5|            if (keymgmt->gen_set_template == NULL)
  ------------------
  |  Branch (65:17): [True: 5, False: 0]
  ------------------
   66|      5|                keymgmt->gen_set_template =
   67|      5|                    OSSL_FUNC_keymgmt_gen_set_template(fns);
   68|      5|            break;
   69|     15|        case OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS:
  ------------------
  |  |  566|     15|# define OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS              4
  ------------------
  |  Branch (69:9): [True: 15, False: 285]
  ------------------
   70|     15|            if (keymgmt->gen_set_params == NULL) {
  ------------------
  |  Branch (70:17): [True: 15, False: 0]
  ------------------
   71|     15|                setgenparamfncnt++;
   72|     15|                keymgmt->gen_set_params =
   73|     15|                    OSSL_FUNC_keymgmt_gen_set_params(fns);
   74|     15|            }
   75|     15|            break;
   76|     15|        case OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS:
  ------------------
  |  |  567|     15|# define OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS         5
  ------------------
  |  Branch (76:9): [True: 15, False: 285]
  ------------------
   77|     15|            if (keymgmt->gen_settable_params == NULL) {
  ------------------
  |  Branch (77:17): [True: 15, False: 0]
  ------------------
   78|     15|                setgenparamfncnt++;
   79|     15|                keymgmt->gen_settable_params =
   80|     15|                    OSSL_FUNC_keymgmt_gen_settable_params(fns);
   81|     15|            }
   82|     15|            break;
   83|     15|        case OSSL_FUNC_KEYMGMT_GEN:
  ------------------
  |  |  568|     15|# define OSSL_FUNC_KEYMGMT_GEN                         6
  ------------------
  |  Branch (83:9): [True: 15, False: 285]
  ------------------
   84|     15|            if (keymgmt->gen == NULL)
  ------------------
  |  Branch (84:17): [True: 15, False: 0]
  ------------------
   85|     15|                keymgmt->gen = OSSL_FUNC_keymgmt_gen(fns);
   86|     15|            break;
   87|     15|        case OSSL_FUNC_KEYMGMT_GEN_CLEANUP:
  ------------------
  |  |  569|     15|# define OSSL_FUNC_KEYMGMT_GEN_CLEANUP                 7
  ------------------
  |  Branch (87:9): [True: 15, False: 285]
  ------------------
   88|     15|            if (keymgmt->gen_cleanup == NULL)
  ------------------
  |  Branch (88:17): [True: 15, False: 0]
  ------------------
   89|     15|                keymgmt->gen_cleanup = OSSL_FUNC_keymgmt_gen_cleanup(fns);
   90|     15|            break;
   91|     18|        case OSSL_FUNC_KEYMGMT_FREE:
  ------------------
  |  |  589|     18|# define OSSL_FUNC_KEYMGMT_FREE                       10
  ------------------
  |  Branch (91:9): [True: 18, False: 282]
  ------------------
   92|     18|            if (keymgmt->free == NULL)
  ------------------
  |  Branch (92:17): [True: 18, False: 0]
  ------------------
   93|     18|                keymgmt->free = OSSL_FUNC_keymgmt_free(fns);
   94|     18|            break;
   95|     11|        case OSSL_FUNC_KEYMGMT_LOAD:
  ------------------
  |  |  584|     11|# define OSSL_FUNC_KEYMGMT_LOAD                        8
  ------------------
  |  Branch (95:9): [True: 11, False: 289]
  ------------------
   96|     11|            if (keymgmt->load == NULL)
  ------------------
  |  Branch (96:17): [True: 11, False: 0]
  ------------------
   97|     11|                keymgmt->load = OSSL_FUNC_keymgmt_load(fns);
   98|     11|            break;
   99|     15|        case OSSL_FUNC_KEYMGMT_GET_PARAMS:
  ------------------
  |  |  593|     15|#define OSSL_FUNC_KEYMGMT_GET_PARAMS                  11
  ------------------
  |  Branch (99:9): [True: 15, False: 285]
  ------------------
  100|     15|            if (keymgmt->get_params == NULL) {
  ------------------
  |  Branch (100:17): [True: 15, False: 0]
  ------------------
  101|     15|                getparamfncnt++;
  102|     15|                keymgmt->get_params = OSSL_FUNC_keymgmt_get_params(fns);
  103|     15|            }
  104|     15|            break;
  105|     15|        case OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS:
  ------------------
  |  |  594|     15|#define OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS             12
  ------------------
  |  Branch (105:9): [True: 15, False: 285]
  ------------------
  106|     15|            if (keymgmt->gettable_params == NULL) {
  ------------------
  |  Branch (106:17): [True: 15, False: 0]
  ------------------
  107|     15|                getparamfncnt++;
  108|     15|                keymgmt->gettable_params =
  109|     15|                    OSSL_FUNC_keymgmt_gettable_params(fns);
  110|     15|            }
  111|     15|            break;
  112|     12|         case OSSL_FUNC_KEYMGMT_SET_PARAMS:
  ------------------
  |  |  600|     12|#define OSSL_FUNC_KEYMGMT_SET_PARAMS                  13
  ------------------
  |  Branch (112:10): [True: 12, False: 288]
  ------------------
  113|     12|            if (keymgmt->set_params == NULL) {
  ------------------
  |  Branch (113:17): [True: 12, False: 0]
  ------------------
  114|     12|                setparamfncnt++;
  115|     12|                keymgmt->set_params = OSSL_FUNC_keymgmt_set_params(fns);
  116|     12|            }
  117|     12|            break;
  118|     12|        case OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS:
  ------------------
  |  |  601|     12|#define OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS             14
  ------------------
  |  Branch (118:9): [True: 12, False: 288]
  ------------------
  119|     12|            if (keymgmt->settable_params == NULL) {
  ------------------
  |  Branch (119:17): [True: 12, False: 0]
  ------------------
  120|     12|                setparamfncnt++;
  121|     12|                keymgmt->settable_params =
  122|     12|                    OSSL_FUNC_keymgmt_settable_params(fns);
  123|     12|            }
  124|     12|            break;
  125|      4|        case OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME:
  ------------------
  |  |  608|      4|# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME       20
  ------------------
  |  Branch (125:9): [True: 4, False: 296]
  ------------------
  126|      4|            if (keymgmt->query_operation_name == NULL)
  ------------------
  |  Branch (126:17): [True: 4, False: 0]
  ------------------
  127|      4|                keymgmt->query_operation_name =
  128|      4|                    OSSL_FUNC_keymgmt_query_operation_name(fns);
  129|      4|            break;
  130|     18|        case OSSL_FUNC_KEYMGMT_HAS:
  ------------------
  |  |  613|     18|# define OSSL_FUNC_KEYMGMT_HAS                        21
  ------------------
  |  Branch (130:9): [True: 18, False: 282]
  ------------------
  131|     18|            if (keymgmt->has == NULL)
  ------------------
  |  Branch (131:17): [True: 18, False: 0]
  ------------------
  132|     18|                keymgmt->has = OSSL_FUNC_keymgmt_has(fns);
  133|     18|            break;
  134|     11|        case OSSL_FUNC_KEYMGMT_DUP:
  ------------------
  |  |  643|     11|# define OSSL_FUNC_KEYMGMT_DUP                        44
  ------------------
  |  Branch (134:9): [True: 11, False: 289]
  ------------------
  135|     11|            if (keymgmt->dup == NULL)
  ------------------
  |  Branch (135:17): [True: 11, False: 0]
  ------------------
  136|     11|                keymgmt->dup = OSSL_FUNC_keymgmt_dup(fns);
  137|     11|            break;
  138|     11|        case OSSL_FUNC_KEYMGMT_VALIDATE:
  ------------------
  |  |  617|     11|# define OSSL_FUNC_KEYMGMT_VALIDATE                   22
  ------------------
  |  Branch (138:9): [True: 11, False: 289]
  ------------------
  139|     11|            if (keymgmt->validate == NULL)
  ------------------
  |  Branch (139:17): [True: 11, False: 0]
  ------------------
  140|     11|                keymgmt->validate = OSSL_FUNC_keymgmt_validate(fns);
  141|     11|            break;
  142|     15|        case OSSL_FUNC_KEYMGMT_MATCH:
  ------------------
  |  |  622|     15|# define OSSL_FUNC_KEYMGMT_MATCH                      23
  ------------------
  |  Branch (142:9): [True: 15, False: 285]
  ------------------
  143|     15|            if (keymgmt->match == NULL)
  ------------------
  |  Branch (143:17): [True: 15, False: 0]
  ------------------
  144|     15|                keymgmt->match = OSSL_FUNC_keymgmt_match(fns);
  145|     15|            break;
  146|     15|        case OSSL_FUNC_KEYMGMT_IMPORT:
  ------------------
  |  |  628|     15|# define OSSL_FUNC_KEYMGMT_IMPORT                     40
  ------------------
  |  Branch (146:9): [True: 15, False: 285]
  ------------------
  147|     15|            if (keymgmt->import == NULL) {
  ------------------
  |  Branch (147:17): [True: 15, False: 0]
  ------------------
  148|     15|                importfncnt++;
  149|     15|                keymgmt->import = OSSL_FUNC_keymgmt_import(fns);
  150|     15|            }
  151|     15|            break;
  152|     15|        case OSSL_FUNC_KEYMGMT_IMPORT_TYPES:
  ------------------
  |  |  629|     15|# define OSSL_FUNC_KEYMGMT_IMPORT_TYPES               41
  ------------------
  |  Branch (152:9): [True: 15, False: 285]
  ------------------
  153|     15|            if (keymgmt->import_types == NULL) {
  ------------------
  |  Branch (153:17): [True: 15, False: 0]
  ------------------
  154|     15|                if (importtypesfncnt == 0)
  ------------------
  |  Branch (154:21): [True: 15, False: 0]
  ------------------
  155|     15|                    importfncnt++;
  156|     15|                importtypesfncnt++;
  157|     15|                keymgmt->import_types = OSSL_FUNC_keymgmt_import_types(fns);
  158|     15|            }
  159|     15|            break;
  160|      0|        case OSSL_FUNC_KEYMGMT_IMPORT_TYPES_EX:
  ------------------
  |  |  648|      0|# define OSSL_FUNC_KEYMGMT_IMPORT_TYPES_EX            45
  ------------------
  |  Branch (160:9): [True: 0, False: 300]
  ------------------
  161|      0|            if (keymgmt->import_types_ex == NULL) {
  ------------------
  |  Branch (161:17): [True: 0, False: 0]
  ------------------
  162|      0|                if (importtypesfncnt == 0)
  ------------------
  |  Branch (162:21): [True: 0, False: 0]
  ------------------
  163|      0|                    importfncnt++;
  164|      0|                importtypesfncnt++;
  165|      0|                keymgmt->import_types_ex = OSSL_FUNC_keymgmt_import_types_ex(fns);
  166|      0|            }
  167|      0|            break;
  168|     15|        case OSSL_FUNC_KEYMGMT_EXPORT:
  ------------------
  |  |  630|     15|# define OSSL_FUNC_KEYMGMT_EXPORT                     42
  ------------------
  |  Branch (168:9): [True: 15, False: 285]
  ------------------
  169|     15|            if (keymgmt->export == NULL) {
  ------------------
  |  Branch (169:17): [True: 15, False: 0]
  ------------------
  170|     15|                exportfncnt++;
  171|     15|                keymgmt->export = OSSL_FUNC_keymgmt_export(fns);
  172|     15|            }
  173|     15|            break;
  174|     15|        case OSSL_FUNC_KEYMGMT_EXPORT_TYPES:
  ------------------
  |  |  631|     15|# define OSSL_FUNC_KEYMGMT_EXPORT_TYPES               43
  ------------------
  |  Branch (174:9): [True: 15, False: 285]
  ------------------
  175|     15|            if (keymgmt->export_types == NULL) {
  ------------------
  |  Branch (175:17): [True: 15, False: 0]
  ------------------
  176|     15|                if (exporttypesfncnt == 0)
  ------------------
  |  Branch (176:21): [True: 15, False: 0]
  ------------------
  177|     15|                    exportfncnt++;
  178|     15|                exporttypesfncnt++;
  179|     15|                keymgmt->export_types = OSSL_FUNC_keymgmt_export_types(fns);
  180|     15|            }
  181|     15|            break;
  182|      0|        case OSSL_FUNC_KEYMGMT_EXPORT_TYPES_EX:
  ------------------
  |  |  649|      0|# define OSSL_FUNC_KEYMGMT_EXPORT_TYPES_EX            46
  ------------------
  |  Branch (182:9): [True: 0, False: 300]
  ------------------
  183|      0|            if (keymgmt->export_types_ex == NULL) {
  ------------------
  |  Branch (183:17): [True: 0, False: 0]
  ------------------
  184|      0|                if (exporttypesfncnt == 0)
  ------------------
  |  Branch (184:21): [True: 0, False: 0]
  ------------------
  185|      0|                    exportfncnt++;
  186|      0|                exporttypesfncnt++;
  187|      0|                keymgmt->export_types_ex = OSSL_FUNC_keymgmt_export_types_ex(fns);
  188|      0|            }
  189|      0|            break;
  190|    300|        }
  191|    300|    }
  192|       |    /*
  193|       |     * Try to check that the method is sensible.
  194|       |     * At least one constructor and the destructor are MANDATORY
  195|       |     * The functions 'has' is MANDATORY
  196|       |     * It makes no sense being able to free stuff if you can't create it.
  197|       |     * It makes no sense providing OSSL_PARAM descriptors for import and
  198|       |     * export if you can't import or export.
  199|       |     */
  200|     18|    if (keymgmt->free == NULL
  ------------------
  |  Branch (200:9): [True: 0, False: 18]
  ------------------
  201|     18|        || (keymgmt->new == NULL
  ------------------
  |  Branch (201:13): [True: 0, False: 18]
  ------------------
  202|     18|            && keymgmt->gen == NULL
  ------------------
  |  Branch (202:16): [True: 0, False: 0]
  ------------------
  203|     18|            && keymgmt->load == NULL)
  ------------------
  |  Branch (203:16): [True: 0, False: 0]
  ------------------
  204|     18|        || keymgmt->has == NULL
  ------------------
  |  Branch (204:12): [True: 0, False: 18]
  ------------------
  205|     18|        || (getparamfncnt != 0 && getparamfncnt != 2)
  ------------------
  |  Branch (205:13): [True: 15, False: 3]
  |  Branch (205:35): [True: 0, False: 15]
  ------------------
  206|     18|        || (setparamfncnt != 0 && setparamfncnt != 2)
  ------------------
  |  Branch (206:13): [True: 12, False: 6]
  |  Branch (206:35): [True: 0, False: 12]
  ------------------
  207|     18|        || (setgenparamfncnt != 0 && setgenparamfncnt != 2)
  ------------------
  |  Branch (207:13): [True: 15, False: 3]
  |  Branch (207:38): [True: 0, False: 15]
  ------------------
  208|     18|        || (importfncnt != 0 && importfncnt != 2)
  ------------------
  |  Branch (208:13): [True: 15, False: 3]
  |  Branch (208:33): [True: 0, False: 15]
  ------------------
  209|     18|        || (exportfncnt != 0 && exportfncnt != 2)
  ------------------
  |  Branch (209:13): [True: 15, False: 3]
  |  Branch (209:33): [True: 0, False: 15]
  ------------------
  210|     18|        || (keymgmt->gen != NULL
  ------------------
  |  Branch (210:13): [True: 15, False: 3]
  ------------------
  211|     18|            && (keymgmt->gen_init == NULL
  ------------------
  |  Branch (211:17): [True: 0, False: 15]
  ------------------
  212|     15|                || keymgmt->gen_cleanup == NULL))) {
  ------------------
  |  Branch (212:20): [True: 0, False: 15]
  ------------------
  213|      0|        EVP_KEYMGMT_free(keymgmt);
  214|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  215|      0|        return NULL;
  216|      0|    }
  217|     18|    keymgmt->prov = prov;
  218|     18|    if (prov != NULL)
  ------------------
  |  Branch (218:9): [True: 18, False: 0]
  ------------------
  219|     18|        ossl_provider_up_ref(prov);
  220|       |
  221|     18|    return keymgmt;
  222|     18|}
keymgmt_meth.c:keymgmt_new:
   21|     18|{
   22|     18|    EVP_KEYMGMT *keymgmt = NULL;
   23|       |
   24|     18|    if ((keymgmt = OPENSSL_zalloc(sizeof(*keymgmt))) == NULL)
  ------------------
  |  |   99|     18|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (24:9): [True: 0, False: 18]
  ------------------
   25|      0|        return NULL;
   26|     18|    if (!CRYPTO_NEW_REF(&keymgmt->refcnt, 1)) {
  ------------------
  |  Branch (26:9): [True: 0, False: 18]
  ------------------
   27|      0|        EVP_KEYMGMT_free(keymgmt);
   28|      0|        return NULL;
   29|      0|    }
   30|     18|    return keymgmt;
   31|     18|}

EVP_blake2b512:
   51|      2|{
   52|      2|    return &blake2b_md;
   53|      2|}
EVP_blake2s256:
   66|      2|{
   67|      2|    return &blake2s_md;
   68|      2|}

EVP_md4:
   32|      2|{
   33|      2|    return &md4_md;
   34|      2|}

EVP_md5:
   32|      2|{
   33|      2|    return &md5_md;
   34|      2|}

EVP_md5_sha1:
   39|      2|{
   40|      2|    return &md5_sha1_md;
   41|      2|}

EVP_mdc2:
   33|      2|{
   34|      2|    return &mdc2_md;
   35|      2|}

EVP_ripemd160:
   33|      2|{
   34|      2|    return &ripemd160_md;
   35|      2|}

EVP_sha1:
   98|  14.2k|{
   99|  14.2k|    return &sha1_md;
  100|  14.2k|}
EVP_sha224:
  113|      2|{
  114|      2|    return &sha224_md;
  115|      2|}
EVP_sha256:
  128|      2|{
  129|      2|    return &sha256_md;
  130|      2|}
EVP_sha512_224:
  143|      2|{
  144|      2|    return &sha512_224_md;
  145|      2|}
EVP_sha512_256:
  158|      2|{
  159|      2|    return &sha512_256_md;
  160|      2|}
EVP_sha384:
  173|      2|{
  174|      2|    return &sha384_md;
  175|      2|}
EVP_sha512:
  188|      2|{
  189|      2|    return &sha512_md;
  190|      2|}
EVP_sha3_224:
  193|      2|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  194|      2|{                                                                              \
  195|      2|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  196|      2|        NID_sha3_##bitlen,                                                     \
  197|      2|        NID_RSA_SHA3_##bitlen,                                                 \
  198|      2|        bitlen / 8,                                                            \
  199|      2|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  173|      2|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  200|      2|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  252|      2|#define EVP_ORIG_GLOBAL     1
  ------------------
  201|      2|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      2|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  202|      2|                                 sha3_int_final, NULL,                         \
  203|      2|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  204|      2|    };                                                                         \
  205|      2|    return &sha3_##bitlen##_md;                                                \
  206|      2|}
EVP_sha3_256:
  193|      2|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  194|      2|{                                                                              \
  195|      2|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  196|      2|        NID_sha3_##bitlen,                                                     \
  197|      2|        NID_RSA_SHA3_##bitlen,                                                 \
  198|      2|        bitlen / 8,                                                            \
  199|      2|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  173|      2|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  200|      2|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  252|      2|#define EVP_ORIG_GLOBAL     1
  ------------------
  201|      2|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      2|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  202|      2|                                 sha3_int_final, NULL,                         \
  203|      2|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  204|      2|    };                                                                         \
  205|      2|    return &sha3_##bitlen##_md;                                                \
  206|      2|}
EVP_sha3_384:
  193|      2|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  194|      2|{                                                                              \
  195|      2|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  196|      2|        NID_sha3_##bitlen,                                                     \
  197|      2|        NID_RSA_SHA3_##bitlen,                                                 \
  198|      2|        bitlen / 8,                                                            \
  199|      2|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  173|      2|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  200|      2|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  252|      2|#define EVP_ORIG_GLOBAL     1
  ------------------
  201|      2|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      2|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  202|      2|                                 sha3_int_final, NULL,                         \
  203|      2|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  204|      2|    };                                                                         \
  205|      2|    return &sha3_##bitlen##_md;                                                \
  206|      2|}
EVP_sha3_512:
  193|      2|const EVP_MD *EVP_sha3_##bitlen(void)                                          \
  194|      2|{                                                                              \
  195|      2|    static const EVP_MD sha3_##bitlen##_md = {                                 \
  196|      2|        NID_sha3_##bitlen,                                                     \
  197|      2|        NID_RSA_SHA3_##bitlen,                                                 \
  198|      2|        bitlen / 8,                                                            \
  199|      2|        EVP_MD_FLAG_DIGALGID_ABSENT,                                           \
  ------------------
  |  |  173|      2|#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
  ------------------
  200|      2|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  252|      2|#define EVP_ORIG_GLOBAL     1
  ------------------
  201|      2|        LEGACY_EVP_MD_METH_TABLE(sha3_int_init, sha3_int_update,               \
  ------------------
  |  |   40|      2|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  202|      2|                                 sha3_int_final, NULL,                         \
  203|      2|                                 (KECCAK1600_WIDTH - bitlen * 2) / 8),         \
  204|      2|    };                                                                         \
  205|      2|    return &sha3_##bitlen##_md;                                                \
  206|      2|}
EVP_shake128:
  208|      2|const EVP_MD *EVP_shake##bitlen(void)                                          \
  209|      2|{                                                                              \
  210|      2|    static const EVP_MD shake##bitlen##_md = {                                 \
  211|      2|        NID_shake##bitlen,                                                     \
  212|      2|        0,                                                                     \
  213|      2|        bitlen / 8,                                                            \
  214|      2|        EVP_MD_FLAG_XOF,                                                       \
  ------------------
  |  |  161|      2|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
  215|      2|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  252|      2|#define EVP_ORIG_GLOBAL     1
  ------------------
  216|      2|        LEGACY_EVP_MD_METH_TABLE(shake_init, sha3_int_update, sha3_int_final,  \
  ------------------
  |  |   40|      2|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  217|      2|                        shake_ctrl, (KECCAK1600_WIDTH - bitlen * 2) / 8),      \
  218|      2|    };                                                                         \
  219|      2|    return &shake##bitlen##_md;                                                \
  220|      2|}
EVP_shake256:
  208|      2|const EVP_MD *EVP_shake##bitlen(void)                                          \
  209|      2|{                                                                              \
  210|      2|    static const EVP_MD shake##bitlen##_md = {                                 \
  211|      2|        NID_shake##bitlen,                                                     \
  212|      2|        0,                                                                     \
  213|      2|        bitlen / 8,                                                            \
  214|      2|        EVP_MD_FLAG_XOF,                                                       \
  ------------------
  |  |  161|      2|#  define EVP_MD_FLAG_XOF         0x0002
  ------------------
  215|      2|        EVP_ORIG_GLOBAL,                                                       \
  ------------------
  |  |  252|      2|#define EVP_ORIG_GLOBAL     1
  ------------------
  216|      2|        LEGACY_EVP_MD_METH_TABLE(shake_init, sha3_int_update, sha3_int_final,  \
  ------------------
  |  |   40|      2|    init, update, final, NULL, NULL, blksz, 0, ctrl
  ------------------
  217|      2|                        shake_ctrl, (KECCAK1600_WIDTH - bitlen * 2) / 8),      \
  218|      2|    };                                                                         \
  219|      2|    return &shake##bitlen##_md;                                                \
  220|      2|}

EVP_whirlpool:
   33|      2|{
   34|      2|    return &whirlpool_md;
   35|      2|}

EVP_add_cipher:
   20|    288|{
   21|    288|    int r;
   22|       |
   23|    288|    if (c == NULL)
  ------------------
  |  Branch (23:9): [True: 0, False: 288]
  ------------------
   24|      0|        return 0;
   25|       |
   26|    288|    r = OBJ_NAME_add(OBJ_nid2sn(c->nid), OBJ_NAME_TYPE_CIPHER_METH,
  ------------------
  |  |   26|    288|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
   27|    288|                     (const char *)c);
   28|    288|    if (r == 0)
  ------------------
  |  Branch (28:9): [True: 0, False: 288]
  ------------------
   29|      0|        return 0;
   30|    288|    r = OBJ_NAME_add(OBJ_nid2ln(c->nid), OBJ_NAME_TYPE_CIPHER_METH,
  ------------------
  |  |   26|    288|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
   31|    288|                     (const char *)c);
   32|    288|    return r;
   33|    288|}
EVP_add_digest:
   36|     44|{
   37|     44|    int r;
   38|     44|    const char *name;
   39|       |
   40|     44|    name = OBJ_nid2sn(md->type);
   41|     44|    r = OBJ_NAME_add(name, OBJ_NAME_TYPE_MD_METH, (const char *)md);
  ------------------
  |  |   25|     44|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
   42|     44|    if (r == 0)
  ------------------
  |  Branch (42:9): [True: 0, False: 44]
  ------------------
   43|      0|        return 0;
   44|     44|    r = OBJ_NAME_add(OBJ_nid2ln(md->type), OBJ_NAME_TYPE_MD_METH,
  ------------------
  |  |   25|     44|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
   45|     44|                     (const char *)md);
   46|     44|    if (r == 0)
  ------------------
  |  Branch (46:9): [True: 0, False: 44]
  ------------------
   47|      0|        return 0;
   48|       |
   49|     44|    if (md->pkey_type && md->type != md->pkey_type) {
  ------------------
  |  Branch (49:9): [True: 34, False: 10]
  |  Branch (49:26): [True: 32, False: 2]
  ------------------
   50|     32|        r = OBJ_NAME_add(OBJ_nid2sn(md->pkey_type),
   51|     32|                         OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   25|     32|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
                                       OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   33|     32|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
   52|     32|        if (r == 0)
  ------------------
  |  Branch (52:13): [True: 0, False: 32]
  ------------------
   53|      0|            return 0;
   54|     32|        r = OBJ_NAME_add(OBJ_nid2ln(md->pkey_type),
   55|     32|                         OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   25|     32|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
                                       OBJ_NAME_TYPE_MD_METH | OBJ_NAME_ALIAS, name);
  ------------------
  |  |   33|     32|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
   56|     32|    }
   57|     44|    return r;
   58|     44|}
evp_cleanup_int:
  154|      2|{
  155|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_KDF_METH);
  ------------------
  |  |   30|      2|# define OBJ_NAME_TYPE_KDF_METH          0x06
  ------------------
  156|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  157|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  158|       |    /*
  159|       |     * The above calls will only clean out the contents of the name hash
  160|       |     * table, but not the hash table itself.  The following line does that
  161|       |     * part.  -- Richard Levitte
  162|       |     */
  163|      2|    OBJ_NAME_cleanup(-1);
  164|       |
  165|      2|    EVP_PBE_cleanup();
  166|      2|    OBJ_sigid_free();
  167|       |
  168|      2|    evp_app_cleanup_int();
  169|      2|}

evp_pkey_get0_RSA_int:
   35|  3.62k|{
   36|  3.62k|    if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA_PSS) {
  ------------------
  |  |   59|  3.62k|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|  7.24k|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
                  if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA_PSS) {
  ------------------
  |  |   61|  3.47k|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|  3.47k|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  |  Branch (36:9): [True: 3.47k, False: 148]
  |  Branch (36:39): [True: 0, False: 3.47k]
  ------------------
   37|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_AN_RSA_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   38|      0|        return NULL;
   39|      0|    }
   40|  3.62k|    return evp_pkey_get_legacy((EVP_PKEY *)pkey);
   41|  3.62k|}
EVP_PKEY_get1_RSA:
   49|  3.62k|{
   50|  3.62k|    RSA *ret = evp_pkey_get0_RSA_int(pkey);
   51|       |
   52|  3.62k|    if (ret != NULL)
  ------------------
  |  Branch (52:9): [True: 3.62k, False: 0]
  ------------------
   53|  3.62k|        RSA_up_ref(ret);
   54|  3.62k|    return ret;
   55|  3.62k|}
evp_pkey_get0_EC_KEY_int:
   70|  9.85k|{
   71|  9.85k|    if (EVP_PKEY_get_base_id(pkey) != EVP_PKEY_EC) {
  ------------------
  |  |   69|  9.85k|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|  9.85k|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
  |  Branch (71:9): [True: 0, False: 9.85k]
  ------------------
   72|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_A_EC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   73|      0|        return NULL;
   74|      0|    }
   75|  9.85k|    return evp_pkey_get_legacy((EVP_PKEY *)pkey);
   76|  9.85k|}
EVP_PKEY_get1_EC_KEY:
   84|  9.85k|{
   85|  9.85k|    EC_KEY *ret = evp_pkey_get0_EC_KEY_int(pkey);
   86|       |
   87|  9.85k|    if (ret != NULL && !EC_KEY_up_ref(ret))
  ------------------
  |  Branch (87:9): [True: 9.85k, False: 0]
  |  Branch (87:24): [True: 0, False: 9.85k]
  ------------------
   88|      0|        ret = NULL;
   89|  9.85k|    return ret;
   90|  9.85k|}

EVP_PKEY_set_type:
  681|  53.5k|{
  682|  53.5k|    return pkey_set_type(pkey, NULL, type, NULL, -1, NULL);
  683|  53.5k|}
EVP_PKEY_assign:
  751|  13.6k|{
  752|  13.6k|#  ifndef OPENSSL_NO_EC
  753|  13.6k|    int pktype;
  754|       |
  755|  13.6k|    pktype = EVP_PKEY_type(type);
  756|  13.6k|    if ((key != NULL) && (pktype == EVP_PKEY_EC || pktype == EVP_PKEY_SM2)) {
  ------------------
  |  |   69|  13.6k|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|  27.3k|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
                  if ((key != NULL) && (pktype == EVP_PKEY_EC || pktype == EVP_PKEY_SM2)) {
  ------------------
  |  |   70|  3.80k|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|  3.80k|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  |  Branch (756:9): [True: 13.6k, False: 0]
  |  Branch (756:27): [True: 9.86k, False: 3.80k]
  |  Branch (756:52): [True: 0, False: 3.80k]
  ------------------
  757|  9.86k|        const EC_GROUP *group = EC_KEY_get0_group(key);
  758|       |
  759|  9.86k|        if (group != NULL) {
  ------------------
  |  Branch (759:13): [True: 9.86k, False: 0]
  ------------------
  760|  9.86k|            int curve = EC_GROUP_get_curve_name(group);
  761|       |
  762|       |            /*
  763|       |             * Regardless of what is requested the SM2 curve must be SM2 type,
  764|       |             * and non SM2 curves are EC type.
  765|       |             */
  766|  9.86k|            if (curve == NID_sm2 && pktype == EVP_PKEY_EC)
  ------------------
  |  | 1228|  19.7k|#define NID_sm2         1172
  ------------------
                          if (curve == NID_sm2 && pktype == EVP_PKEY_EC)
  ------------------
  |  |   69|     10|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|     10|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
  |  Branch (766:17): [True: 10, False: 9.85k]
  |  Branch (766:37): [True: 10, False: 0]
  ------------------
  767|     10|                type = EVP_PKEY_SM2;
  ------------------
  |  |   70|     10|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|     10|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  768|  9.85k|            else if(curve != NID_sm2 && pktype == EVP_PKEY_SM2)
  ------------------
  |  | 1228|  19.7k|#define NID_sm2         1172
  ------------------
                          else if(curve != NID_sm2 && pktype == EVP_PKEY_SM2)
  ------------------
  |  |   70|  9.85k|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|  9.85k|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  |  Branch (768:21): [True: 9.85k, False: 0]
  |  Branch (768:41): [True: 0, False: 9.85k]
  ------------------
  769|      0|                type = EVP_PKEY_EC;
  ------------------
  |  |   69|      0|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|      0|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
  770|  9.86k|        }
  771|  9.86k|    }
  772|  13.6k|#  endif
  773|       |
  774|  13.6k|    if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
  ------------------
  |  Branch (774:9): [True: 0, False: 13.6k]
  |  Branch (774:25): [True: 0, False: 13.6k]
  ------------------
  775|      0|        return 0;
  776|       |
  777|  13.6k|    pkey->pkey.ptr = key;
  778|  13.6k|    detect_foreign_key(pkey);
  779|       |
  780|  13.6k|    return (key != NULL);
  781|  13.6k|}
EVP_PKEY_get1_DSA:
  868|     18|{
  869|     18|    DSA *ret = evp_pkey_get0_DSA_int(pkey);
  870|       |
  871|     18|    if (ret != NULL)
  ------------------
  |  Branch (871:9): [True: 18, False: 0]
  ------------------
  872|     18|        DSA_up_ref(ret);
  873|     18|    return ret;
  874|     18|}
ossl_evp_pkey_get1_X25519:
  898|      3|    {                                                                   \
  899|      3|        return evp_pkey_get1_ECX_KEY(pkey, EVP_PKEY_##NAME);            \
  900|      3|    }
ossl_evp_pkey_get1_X448:
  898|      1|    {                                                                   \
  899|      1|        return evp_pkey_get1_ECX_KEY(pkey, EVP_PKEY_##NAME);            \
  900|      1|    }
ossl_evp_pkey_get1_ED25519:
  898|      3|    {                                                                   \
  899|      3|        return evp_pkey_get1_ECX_KEY(pkey, EVP_PKEY_##NAME);            \
  900|      3|    }
ossl_evp_pkey_get1_ED448:
  898|      1|    {                                                                   \
  899|      1|        return evp_pkey_get1_ECX_KEY(pkey, EVP_PKEY_##NAME);            \
  900|      1|    }
evp_pkey_get0_DH_int:
  946|     61|{
  947|     61|    if (pkey->type != EVP_PKEY_DH && pkey->type != EVP_PKEY_DHX) {
  ------------------
  |  |   67|     61|# define EVP_PKEY_DH     NID_dhKeyAgreement
  |  |  ------------------
  |  |  |  |  621|    122|#define NID_dhKeyAgreement              28
  |  |  ------------------
  ------------------
                  if (pkey->type != EVP_PKEY_DH && pkey->type != EVP_PKEY_DHX) {
  ------------------
  |  |   68|      1|# define EVP_PKEY_DHX    NID_dhpublicnumber
  |  |  ------------------
  |  |  |  | 5295|      1|#define NID_dhpublicnumber              920
  |  |  ------------------
  ------------------
  |  Branch (947:9): [True: 1, False: 60]
  |  Branch (947:38): [True: 0, False: 1]
  ------------------
  948|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_A_DH_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  949|      0|        return NULL;
  950|      0|    }
  951|     61|    return evp_pkey_get_legacy((EVP_PKEY *)pkey);
  952|     61|}
EVP_PKEY_get1_DH:
  960|     61|{
  961|     61|    DH *ret = evp_pkey_get0_DH_int(pkey);
  962|       |
  963|     61|    if (ret != NULL)
  ------------------
  |  Branch (963:9): [True: 61, False: 0]
  ------------------
  964|     61|        DH_up_ref(ret);
  965|     61|    return ret;
  966|     61|}
EVP_PKEY_type:
  970|  23.5k|{
  971|  23.5k|    int ret;
  972|  23.5k|    const EVP_PKEY_ASN1_METHOD *ameth;
  973|  23.5k|    ENGINE *e;
  974|  23.5k|    ameth = EVP_PKEY_asn1_find(&e, type);
  975|  23.5k|    if (ameth)
  ------------------
  |  Branch (975:9): [True: 23.5k, False: 0]
  ------------------
  976|  23.5k|        ret = ameth->pkey_id;
  977|      0|    else
  978|      0|        ret = NID_undef;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  979|  23.5k|# ifndef OPENSSL_NO_ENGINE
  980|  23.5k|    ENGINE_finish(e);
  981|  23.5k|# endif
  982|  23.5k|    return ret;
  983|  23.5k|}
EVP_PKEY_get_id:
  986|  9.92k|{
  987|  9.92k|    return pkey->type;
  988|  9.92k|}
EVP_PKEY_get_base_id:
  991|  9.86k|{
  992|  9.86k|    return EVP_PKEY_type(pkey->type);
  993|  9.86k|}
EVP_PKEY_print_private:
 1203|  1.55k|{
 1204|  1.55k|    return print_pkey(pkey, out, indent, EVP_PKEY_KEYPAIR, NULL,
  ------------------
  |  |   91|  1.55k|    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |   89|  1.55k|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  1.55k|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  549|  1.55k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  544|  1.55k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  550|  1.55k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  545|  1.55k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  1.55k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
  |  |  ------------------
  |  |  |  |  542|  1.55k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  ------------------
 1205|  1.55k|                      (pkey->ameth != NULL ? pkey->ameth->priv_print : NULL),
  ------------------
  |  Branch (1205:24): [True: 103, False: 1.45k]
  ------------------
 1206|  1.55k|                      pctx);
 1207|  1.55k|}
EVP_PKEY_new:
 1446|  54.8k|{
 1447|  54.8k|    EVP_PKEY *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  54.8k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  54.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  54.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1448|       |
 1449|  54.8k|    if (ret == NULL)
  ------------------
  |  Branch (1449:9): [True: 0, False: 54.8k]
  ------------------
 1450|      0|        return NULL;
 1451|       |
 1452|  54.8k|    ret->type = EVP_PKEY_NONE;
  ------------------
  |  |   58|  54.8k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  54.8k|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1453|  54.8k|    ret->save_type = EVP_PKEY_NONE;
  ------------------
  |  |   58|  54.8k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  54.8k|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1454|       |
 1455|  54.8k|    if (!CRYPTO_NEW_REF(&ret->references, 1))
  ------------------
  |  Branch (1455:9): [True: 0, False: 54.8k]
  ------------------
 1456|      0|        goto err;
 1457|       |
 1458|  54.8k|    ret->lock = CRYPTO_THREAD_lock_new();
 1459|  54.8k|    if (ret->lock == NULL) {
  ------------------
  |  Branch (1459:9): [True: 0, False: 54.8k]
  ------------------
 1460|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1461|      0|        goto err;
 1462|      0|    }
 1463|       |
 1464|  54.8k|#ifndef FIPS_MODULE
 1465|  54.8k|    ret->save_parameters = 1;
 1466|  54.8k|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_EVP_PKEY, ret, &ret->ex_data)) {
  ------------------
  |  |  236|  54.8k|# define CRYPTO_EX_INDEX_EVP_PKEY        17
  ------------------
  |  Branch (1466:9): [True: 0, False: 54.8k]
  ------------------
 1467|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1468|      0|        goto err;
 1469|      0|    }
 1470|  54.8k|#endif
 1471|  54.8k|    return ret;
 1472|       |
 1473|      0| err:
 1474|      0|    CRYPTO_FREE_REF(&ret->references);
 1475|      0|    CRYPTO_THREAD_lock_free(ret->lock);
 1476|      0|    OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1477|      0|    return NULL;
 1478|  54.8k|}
EVP_PKEY_set_type_by_keymgmt:
 1632|  15.0k|{
 1633|  15.0k|#ifndef FIPS_MODULE
 1634|  15.0k|# define EVP_PKEY_TYPE_STR str[0]
 1635|  15.0k|# define EVP_PKEY_TYPE_STRLEN (str[0] == NULL ? -1 : (int)strlen(str[0]))
 1636|       |    /*
 1637|       |     * Find at most two strings that have an associated EVP_PKEY_ASN1_METHOD
 1638|       |     * Ideally, only one should be found.  If two (or more) are found, the
 1639|       |     * match is ambiguous.  This should never happen, but...
 1640|       |     */
 1641|  15.0k|    const char *str[2] = { NULL, NULL };
 1642|       |
 1643|  15.0k|    if (!EVP_KEYMGMT_names_do_all(keymgmt, find_ameth, &str)
  ------------------
  |  Branch (1643:9): [True: 0, False: 15.0k]
  ------------------
 1644|  15.0k|            || str[1] != NULL) {
  ------------------
  |  Branch (1644:16): [True: 0, False: 15.0k]
  ------------------
 1645|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1646|      0|        return 0;
 1647|      0|    }
 1648|       |#else
 1649|       |# define EVP_PKEY_TYPE_STR NULL
 1650|       |# define EVP_PKEY_TYPE_STRLEN -1
 1651|       |#endif
 1652|  15.0k|    return pkey_set_type(pkey, NULL, EVP_PKEY_NONE,
  ------------------
  |  |   58|  15.0k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  15.0k|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1653|  15.0k|                         EVP_PKEY_TYPE_STR, EVP_PKEY_TYPE_STRLEN,
  ------------------
  |  | 1634|  15.0k|# define EVP_PKEY_TYPE_STR str[0]
  ------------------
                                       EVP_PKEY_TYPE_STR, EVP_PKEY_TYPE_STRLEN,
  ------------------
  |  | 1635|  15.0k|# define EVP_PKEY_TYPE_STRLEN (str[0] == NULL ? -1 : (int)strlen(str[0]))
  |  |  ------------------
  |  |  |  Branch (1635:32): [True: 15, False: 14.9k]
  |  |  ------------------
  ------------------
 1654|  15.0k|                         keymgmt);
 1655|       |
 1656|  15.0k|#undef EVP_PKEY_TYPE_STR
 1657|  15.0k|#undef EVP_PKEY_TYPE_STRLEN
 1658|  15.0k|}
EVP_PKEY_up_ref:
 1661|  13.5k|{
 1662|  13.5k|    int i;
 1663|       |
 1664|  13.5k|    if (CRYPTO_UP_REF(&pkey->references, &i) <= 0)
  ------------------
  |  Branch (1664:9): [True: 0, False: 13.5k]
  ------------------
 1665|      0|        return 0;
 1666|       |
 1667|  13.5k|    REF_PRINT_COUNT("EVP_PKEY", pkey);
  ------------------
  |  |  289|  13.5k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  13.5k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  13.5k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  13.5k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1668|  13.5k|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|  13.5k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 13.5k]
  |  |  ------------------
  ------------------
 1669|  13.5k|    return ((i > 1) ? 1 : 0);
  ------------------
  |  Branch (1669:13): [True: 13.5k, False: 0]
  ------------------
 1670|  13.5k|}
evp_pkey_free_legacy:
 1728|  54.8k|{
 1729|  54.8k|    const EVP_PKEY_ASN1_METHOD *ameth = x->ameth;
 1730|  54.8k|    ENGINE *tmpe = NULL;
 1731|       |
 1732|  54.8k|    if (ameth == NULL && x->legacy_cache_pkey.ptr != NULL)
  ------------------
  |  Branch (1732:9): [True: 15.0k, False: 39.8k]
  |  Branch (1732:26): [True: 0, False: 15.0k]
  ------------------
 1733|      0|        ameth = EVP_PKEY_asn1_find(&tmpe, x->type);
 1734|       |
 1735|  54.8k|    if (ameth != NULL) {
  ------------------
  |  Branch (1735:9): [True: 39.8k, False: 15.0k]
  ------------------
 1736|  39.8k|        if (x->legacy_cache_pkey.ptr != NULL) {
  ------------------
  |  Branch (1736:13): [True: 0, False: 39.8k]
  ------------------
 1737|       |            /*
 1738|       |             * We should never have both a legacy origin key, and a key in the
 1739|       |             * legacy cache.
 1740|       |             */
 1741|      0|            assert(x->pkey.ptr == NULL);
 1742|       |            /*
 1743|       |             * For the purposes of freeing we make the legacy cache look like
 1744|       |             * a legacy origin key.
 1745|       |             */
 1746|      0|            x->pkey = x->legacy_cache_pkey;
 1747|      0|            x->legacy_cache_pkey.ptr = NULL;
 1748|      0|        }
 1749|  39.8k|        if (ameth->pkey_free != NULL)
  ------------------
  |  Branch (1749:13): [True: 39.8k, False: 0]
  ------------------
 1750|  39.8k|            ameth->pkey_free(x);
 1751|  39.8k|        x->pkey.ptr = NULL;
 1752|  39.8k|    }
 1753|  54.8k|# ifndef OPENSSL_NO_ENGINE
 1754|  54.8k|    ENGINE_finish(tmpe);
 1755|  54.8k|    ENGINE_finish(x->engine);
 1756|  54.8k|    x->engine = NULL;
 1757|  54.8k|    ENGINE_finish(x->pmeth_engine);
 1758|  54.8k|    x->pmeth_engine = NULL;
 1759|  54.8k|# endif
 1760|  54.8k|}
EVP_PKEY_free:
 1781|   237k|{
 1782|   237k|    int i;
 1783|       |
 1784|   237k|    if (x == NULL)
  ------------------
  |  Branch (1784:9): [True: 168k, False: 68.4k]
  ------------------
 1785|   168k|        return;
 1786|       |
 1787|  68.4k|    CRYPTO_DOWN_REF(&x->references, &i);
 1788|  68.4k|    REF_PRINT_COUNT("EVP_PKEY", x);
  ------------------
  |  |  289|  68.4k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  68.4k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  68.4k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  68.4k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1789|  68.4k|    if (i > 0)
  ------------------
  |  Branch (1789:9): [True: 13.5k, False: 54.8k]
  ------------------
 1790|  13.5k|        return;
 1791|  54.8k|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|  54.8k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 54.8k]
  |  |  ------------------
  ------------------
 1792|  54.8k|    evp_pkey_free_it(x);
 1793|  54.8k|#ifndef FIPS_MODULE
 1794|  54.8k|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_EVP_PKEY, x, &x->ex_data);
  ------------------
  |  |  236|  54.8k|# define CRYPTO_EX_INDEX_EVP_PKEY        17
  ------------------
 1795|  54.8k|#endif
 1796|  54.8k|    CRYPTO_THREAD_lock_free(x->lock);
 1797|  54.8k|    CRYPTO_FREE_REF(&x->references);
 1798|  54.8k|#ifndef FIPS_MODULE
 1799|  54.8k|    sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
  ------------------
  |  |  270|  54.8k|#define sk_X509_ATTRIBUTE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ATTRIBUTE_sk_type(sk),ossl_check_X509_ATTRIBUTE_freefunc_type(freefunc))
  ------------------
 1800|  54.8k|#endif
 1801|  54.8k|    OPENSSL_free(x);
  ------------------
  |  |  107|  54.8k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  54.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  54.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1802|  54.8k|}
evp_pkey_get_legacy:
 2095|  13.5k|{
 2096|  13.5k|    EVP_PKEY *tmp_copy = NULL;
 2097|  13.5k|    void *ret = NULL;
 2098|       |
 2099|  13.5k|    if (!ossl_assert(pk != NULL))
  ------------------
  |  |   52|  13.5k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  13.5k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (2099:9): [True: 0, False: 13.5k]
  ------------------
 2100|      0|        return NULL;
 2101|       |
 2102|       |    /*
 2103|       |     * If this isn't an assigned provider side key, we just use any existing
 2104|       |     * origin legacy key.
 2105|       |     */
 2106|  13.5k|    if (!evp_pkey_is_assigned(pk))
  ------------------
  |  |  634|  13.5k|    ((pk)->pkey.ptr != NULL || (pk)->keydata != NULL)
  |  |  ------------------
  |  |  |  Branch (634:6): [True: 13.5k, False: 0]
  |  |  |  Branch (634:32): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2107|      0|        return NULL;
 2108|  13.5k|    if (!evp_pkey_is_provided(pk))
  ------------------
  |  |  642|  13.5k|    ((pk)->keymgmt != NULL)
  ------------------
  |  Branch (2108:9): [True: 13.5k, False: 0]
  ------------------
 2109|  13.5k|        return pk->pkey.ptr;
 2110|       |
 2111|      0|    if (!CRYPTO_THREAD_read_lock(pk->lock))
  ------------------
  |  Branch (2111:9): [True: 0, False: 0]
  ------------------
 2112|      0|        return NULL;
 2113|       |
 2114|      0|    ret = pk->legacy_cache_pkey.ptr;
 2115|       |
 2116|      0|    if (!CRYPTO_THREAD_unlock(pk->lock))
  ------------------
  |  Branch (2116:9): [True: 0, False: 0]
  ------------------
 2117|      0|        return NULL;
 2118|       |
 2119|      0|    if (ret != NULL)
  ------------------
  |  Branch (2119:9): [True: 0, False: 0]
  ------------------
 2120|      0|        return ret;
 2121|       |
 2122|      0|    if (!evp_pkey_copy_downgraded(&tmp_copy, pk))
  ------------------
  |  Branch (2122:9): [True: 0, False: 0]
  ------------------
 2123|      0|        goto err;
 2124|       |
 2125|      0|    if (!CRYPTO_THREAD_write_lock(pk->lock))
  ------------------
  |  Branch (2125:9): [True: 0, False: 0]
  ------------------
 2126|      0|        goto err;
 2127|       |
 2128|       |    /* Check again in case some other thread has updated it in the meantime */
 2129|      0|    ret = pk->legacy_cache_pkey.ptr;
 2130|      0|    if (ret == NULL) {
  ------------------
  |  Branch (2130:9): [True: 0, False: 0]
  ------------------
 2131|       |        /* Steal the legacy key reference from the temporary copy */
 2132|      0|        ret = pk->legacy_cache_pkey.ptr = tmp_copy->pkey.ptr;
 2133|      0|        tmp_copy->pkey.ptr = NULL;
 2134|      0|    }
 2135|       |
 2136|      0|    if (!CRYPTO_THREAD_unlock(pk->lock)) {
  ------------------
  |  Branch (2136:9): [True: 0, False: 0]
  ------------------
 2137|      0|        ret = NULL;
 2138|      0|        goto err;
 2139|      0|    }
 2140|       |
 2141|      0| err:
 2142|      0|    EVP_PKEY_free(tmp_copy);
 2143|       |
 2144|      0|    return ret;
 2145|      0|}
p_lib.c:detect_foreign_key:
  717|  13.6k|{
  718|  13.6k|    switch (pkey->type) {
  719|    176|    case EVP_PKEY_RSA:
  ------------------
  |  |   59|    176|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|    176|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
  |  Branch (719:5): [True: 176, False: 13.4k]
  ------------------
  720|  3.64k|    case EVP_PKEY_RSA_PSS:
  ------------------
  |  |   61|  3.64k|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|  3.64k|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  |  Branch (720:5): [True: 3.47k, False: 10.1k]
  ------------------
  721|  3.64k|        pkey->foreign = pkey->pkey.rsa != NULL
  ------------------
  |  Branch (721:25): [True: 3.64k, False: 0]
  ------------------
  722|  3.64k|                        && ossl_rsa_is_foreign(pkey->pkey.rsa);
  ------------------
  |  Branch (722:28): [True: 0, False: 3.64k]
  ------------------
  723|  3.64k|        break;
  724|      0|#  ifndef OPENSSL_NO_EC
  725|     10|    case EVP_PKEY_SM2:
  ------------------
  |  |   70|     10|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|     10|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  |  Branch (725:5): [True: 10, False: 13.6k]
  ------------------
  726|     10|        break;
  727|  9.85k|    case EVP_PKEY_EC:
  ------------------
  |  |   69|  9.85k|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|  9.85k|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
  |  Branch (727:5): [True: 9.85k, False: 3.81k]
  ------------------
  728|  9.85k|        pkey->foreign = pkey->pkey.ec != NULL
  ------------------
  |  Branch (728:25): [True: 9.85k, False: 0]
  ------------------
  729|  9.85k|                        && ossl_ec_key_is_foreign(pkey->pkey.ec);
  ------------------
  |  Branch (729:28): [True: 0, False: 9.85k]
  ------------------
  730|  9.85k|        break;
  731|      0|#  endif
  732|      0|#  ifndef OPENSSL_NO_DSA
  733|     86|    case EVP_PKEY_DSA:
  ------------------
  |  |   62|     86|# define EVP_PKEY_DSA    NID_dsa
  |  |  ------------------
  |  |  |  |  136|     86|#define NID_dsa         116
  |  |  ------------------
  ------------------
  |  Branch (733:5): [True: 86, False: 13.5k]
  ------------------
  734|     86|        pkey->foreign = pkey->pkey.dsa != NULL
  ------------------
  |  Branch (734:25): [True: 86, False: 0]
  ------------------
  735|     86|                        && ossl_dsa_is_foreign(pkey->pkey.dsa);
  ------------------
  |  Branch (735:28): [True: 0, False: 86]
  ------------------
  736|     86|        break;
  737|      0|#endif
  738|      0|#  ifndef OPENSSL_NO_DH
  739|     60|    case EVP_PKEY_DH:
  ------------------
  |  |   67|     60|# define EVP_PKEY_DH     NID_dhKeyAgreement
  |  |  ------------------
  |  |  |  |  621|     60|#define NID_dhKeyAgreement              28
  |  |  ------------------
  ------------------
  |  Branch (739:5): [True: 60, False: 13.6k]
  ------------------
  740|     60|        pkey->foreign = pkey->pkey.dh != NULL
  ------------------
  |  Branch (740:25): [True: 60, False: 0]
  ------------------
  741|     60|                        && ossl_dh_is_foreign(pkey->pkey.dh);
  ------------------
  |  Branch (741:28): [True: 0, False: 60]
  ------------------
  742|     60|        break;
  743|      0|#endif
  744|     14|    default:
  ------------------
  |  Branch (744:5): [True: 14, False: 13.6k]
  ------------------
  745|     14|        pkey->foreign = 0;
  746|     14|        break;
  747|  13.6k|    }
  748|  13.6k|}
p_lib.c:evp_pkey_get0_DSA_int:
  847|     18|{
  848|     18|    if (pkey->type != EVP_PKEY_DSA) {
  ------------------
  |  |   62|     18|# define EVP_PKEY_DSA    NID_dsa
  |  |  ------------------
  |  |  |  |  136|     18|#define NID_dsa         116
  |  |  ------------------
  ------------------
  |  Branch (848:9): [True: 0, False: 18]
  ------------------
  849|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_A_DSA_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  850|      0|        return NULL;
  851|      0|    }
  852|     18|    return evp_pkey_get_legacy((EVP_PKEY *)pkey);
  853|     18|}
p_lib.c:evp_pkey_get1_ECX_KEY:
  888|      8|{
  889|      8|    ECX_KEY *ret = (ECX_KEY *)evp_pkey_get0_ECX_KEY(pkey, type);
  890|       |
  891|      8|    if (ret != NULL && !ossl_ecx_key_up_ref(ret))
  ------------------
  |  Branch (891:9): [True: 8, False: 0]
  |  Branch (891:24): [True: 0, False: 8]
  ------------------
  892|      0|        ret = NULL;
  893|      8|    return ret;
  894|      8|}
p_lib.c:evp_pkey_get0_ECX_KEY:
  879|      8|{
  880|      8|    if (EVP_PKEY_get_base_id(pkey) != type) {
  ------------------
  |  Branch (880:9): [True: 0, False: 8]
  ------------------
  881|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_A_ECX_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  882|      0|        return NULL;
  883|      0|    }
  884|      8|    return evp_pkey_get_legacy((EVP_PKEY *)pkey);
  885|      8|}
p_lib.c:print_pkey:
 1164|  1.55k|{
 1165|  1.55k|    int pop_f_prefix;
 1166|  1.55k|    long saved_indent;
 1167|  1.55k|    OSSL_ENCODER_CTX *ctx = NULL;
 1168|  1.55k|    int ret = -2;                /* default to unsupported */
 1169|       |
 1170|  1.55k|    if (!print_set_indent(&out, &pop_f_prefix, &saved_indent, indent))
  ------------------
  |  Branch (1170:9): [True: 0, False: 1.55k]
  ------------------
 1171|      0|        return 0;
 1172|       |
 1173|  1.55k|    ctx = OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, "TEXT", NULL,
 1174|  1.55k|                                        propquery);
 1175|  1.55k|    if (OSSL_ENCODER_CTX_get_num_encoders(ctx) != 0)
  ------------------
  |  Branch (1175:9): [True: 1.45k, False: 103]
  ------------------
 1176|  1.45k|        ret = OSSL_ENCODER_to_bio(ctx, out);
 1177|  1.55k|    OSSL_ENCODER_CTX_free(ctx);
 1178|       |
 1179|  1.55k|    if (ret != -2)
  ------------------
  |  Branch (1179:9): [True: 1.45k, False: 103]
  ------------------
 1180|  1.45k|        goto end;
 1181|       |
 1182|       |    /* legacy fallback */
 1183|    103|    if (legacy_print != NULL)
  ------------------
  |  Branch (1183:9): [True: 103, False: 0]
  ------------------
 1184|    103|        ret = legacy_print(out, pkey, 0, legacy_pctx);
 1185|      0|    else
 1186|      0|        ret = unsup_alg(out, pkey, 0, "Public Key");
 1187|       |
 1188|  1.55k| end:
 1189|  1.55k|    print_reset_indent(&out, pop_f_prefix, saved_indent);
 1190|  1.55k|    return ret;
 1191|    103|}
p_lib.c:print_set_indent:
 1127|  1.55k|{
 1128|  1.55k|    *pop_f_prefix = 0;
 1129|  1.55k|    *saved_indent = 0;
 1130|  1.55k|    if (indent > 0) {
  ------------------
  |  Branch (1130:9): [True: 0, False: 1.55k]
  ------------------
 1131|      0|        long i = BIO_get_indent(*out);
  ------------------
  |  |  695|      0|# define BIO_get_indent(b) BIO_ctrl((b), BIO_CTRL_GET_INDENT, 0, NULL)
  |  |  ------------------
  |  |  |  |  174|      0|# define BIO_CTRL_GET_INDENT                    81
  |  |  ------------------
  ------------------
 1132|       |
 1133|      0|        *saved_indent =  (i < 0 ? 0 : i);
  ------------------
  |  Branch (1133:27): [True: 0, False: 0]
  ------------------
 1134|      0|        if (BIO_set_indent(*out, indent) <= 0) {
  ------------------
  |  |  694|      0|# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL)
  |  |  ------------------
  |  |  |  |  173|      0|# define BIO_CTRL_SET_INDENT                    80
  |  |  ------------------
  ------------------
  |  Branch (1134:13): [True: 0, False: 0]
  ------------------
 1135|      0|            BIO *prefbio = BIO_new(BIO_f_prefix());
 1136|       |
 1137|      0|            if (prefbio == NULL)
  ------------------
  |  Branch (1137:17): [True: 0, False: 0]
  ------------------
 1138|      0|                return 0;
 1139|      0|            *out = BIO_push(prefbio, *out);
 1140|      0|            *pop_f_prefix = 1;
 1141|      0|        }
 1142|      0|        if (BIO_set_indent(*out, indent) <= 0) {
  ------------------
  |  |  694|      0|# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL)
  |  |  ------------------
  |  |  |  |  173|      0|# define BIO_CTRL_SET_INDENT                    80
  |  |  ------------------
  ------------------
  |  Branch (1142:13): [True: 0, False: 0]
  ------------------
 1143|      0|            print_reset_indent(out, *pop_f_prefix, *saved_indent);
 1144|      0|            return 0;
 1145|      0|        }
 1146|      0|    }
 1147|  1.55k|    return 1;
 1148|  1.55k|}
p_lib.c:print_reset_indent:
 1114|  1.55k|{
 1115|  1.55k|    BIO_set_indent(*out, saved_indent);
  ------------------
  |  |  694|  1.55k|# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL)
  |  |  ------------------
  |  |  |  |  173|  1.55k|# define BIO_CTRL_SET_INDENT                    80
  |  |  ------------------
  ------------------
 1116|  1.55k|    if (pop_f_prefix) {
  ------------------
  |  Branch (1116:9): [True: 0, False: 1.55k]
  ------------------
 1117|      0|        BIO *next = BIO_pop(*out);
 1118|       |
 1119|      0|        BIO_free(*out);
 1120|      0|        *out = next;
 1121|      0|    }
 1122|  1.55k|    return 1;
 1123|  1.55k|}
p_lib.c:pkey_set_type:
 1495|   123k|{
 1496|   123k|#ifndef FIPS_MODULE
 1497|   123k|    const EVP_PKEY_ASN1_METHOD *ameth = NULL;
 1498|   123k|    ENGINE **eptr = (e == NULL) ? &e :  NULL;
  ------------------
  |  Branch (1498:21): [True: 123k, False: 0]
  ------------------
 1499|   123k|#endif
 1500|       |
 1501|       |    /*
 1502|       |     * The setups can't set both legacy and provider side methods.
 1503|       |     * It is forbidden
 1504|       |     */
 1505|   123k|    if (!ossl_assert(type == EVP_PKEY_NONE || keymgmt == NULL)
  ------------------
  |  |   52|   247k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 70.0k, False: 53.5k]
  |  |  |  Branch (52:43): [True: 53.5k, False: 0]
  |  |  ------------------
  |  |   53|   247k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1505:9): [True: 0, False: 123k]
  ------------------
 1506|   123k|        || !ossl_assert(e == NULL || keymgmt == NULL)) {
  ------------------
  |  |   52|   123k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 123k, False: 0]
  |  |  |  Branch (52:43): [True: 0, False: 0]
  |  |  ------------------
  |  |   53|   123k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1506:12): [True: 0, False: 123k]
  ------------------
 1507|      0|        ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1508|      0|        return 0;
 1509|      0|    }
 1510|       |
 1511|   123k|    if (pkey != NULL) {
  ------------------
  |  Branch (1511:9): [True: 68.5k, False: 55.0k]
  ------------------
 1512|  68.5k|        int free_it = 0;
 1513|       |
 1514|  68.5k|#ifndef FIPS_MODULE
 1515|  68.5k|        free_it = free_it || pkey->pkey.ptr != NULL;
  ------------------
  |  Branch (1515:19): [True: 0, False: 68.5k]
  |  Branch (1515:30): [True: 0, False: 68.5k]
  ------------------
 1516|  68.5k|#endif
 1517|  68.5k|        free_it = free_it || pkey->keydata != NULL;
  ------------------
  |  Branch (1517:19): [True: 0, False: 68.5k]
  |  Branch (1517:30): [True: 0, False: 68.5k]
  ------------------
 1518|  68.5k|        if (free_it)
  ------------------
  |  Branch (1518:13): [True: 0, False: 68.5k]
  ------------------
 1519|      0|            evp_pkey_free_it(pkey);
 1520|  68.5k|#ifndef FIPS_MODULE
 1521|       |        /*
 1522|       |         * If key type matches and a method exists then this lookup has
 1523|       |         * succeeded once so just indicate success.
 1524|       |         */
 1525|  68.5k|        if (pkey->type != EVP_PKEY_NONE
  ------------------
  |  |   58|  68.5k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|   137k|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1525:13): [True: 13.6k, False: 54.8k]
  ------------------
 1526|  68.5k|            && type == pkey->save_type
  ------------------
  |  Branch (1526:16): [True: 13.5k, False: 85]
  ------------------
 1527|  68.5k|            && pkey->ameth != NULL)
  ------------------
  |  Branch (1527:16): [True: 13.5k, False: 0]
  ------------------
 1528|  13.5k|            return 1;
 1529|  54.9k|# ifndef OPENSSL_NO_ENGINE
 1530|       |        /* If we have ENGINEs release them */
 1531|  54.9k|        ENGINE_finish(pkey->engine);
 1532|  54.9k|        pkey->engine = NULL;
 1533|  54.9k|        ENGINE_finish(pkey->pmeth_engine);
 1534|  54.9k|        pkey->pmeth_engine = NULL;
 1535|  54.9k|# endif
 1536|  54.9k|#endif
 1537|  54.9k|    }
 1538|   110k|#ifndef FIPS_MODULE
 1539|   110k|    if (str != NULL)
  ------------------
  |  Branch (1539:9): [True: 70.0k, False: 39.9k]
  ------------------
 1540|  70.0k|        ameth = EVP_PKEY_asn1_find_str(eptr, str, len);
 1541|  39.9k|    else if (type != EVP_PKEY_NONE)
  ------------------
  |  |   58|  39.9k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  39.9k|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1541:14): [True: 39.9k, False: 22]
  ------------------
 1542|  39.9k|        ameth = EVP_PKEY_asn1_find(eptr, type);
 1543|   110k|# ifndef OPENSSL_NO_ENGINE
 1544|   110k|    if (pkey == NULL && eptr != NULL)
  ------------------
  |  Branch (1544:9): [True: 55.0k, False: 54.9k]
  |  Branch (1544:25): [True: 55.0k, False: 0]
  ------------------
 1545|  55.0k|        ENGINE_finish(e);
 1546|   110k|# endif
 1547|   110k|#endif
 1548|       |
 1549|       |
 1550|   110k|    {
 1551|   110k|        int check = 1;
 1552|       |
 1553|   110k|#ifndef FIPS_MODULE
 1554|   110k|        check = check && ameth == NULL;
  ------------------
  |  Branch (1554:17): [True: 110k, False: 0]
  |  Branch (1554:26): [True: 40.1k, False: 69.9k]
  ------------------
 1555|   110k|#endif
 1556|   110k|        check = check && keymgmt == NULL;
  ------------------
  |  Branch (1556:17): [True: 40.1k, False: 69.9k]
  |  Branch (1556:26): [True: 40.0k, False: 15]
  ------------------
 1557|   110k|        if (check) {
  ------------------
  |  Branch (1557:13): [True: 40.0k, False: 69.9k]
  ------------------
 1558|  40.0k|            ERR_raise(ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM);
  ------------------
  |  |  401|  40.0k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  40.0k|    (ERR_new(),                                                 \
  |  |  |  |  404|  40.0k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  40.0k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  40.0k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  40.0k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  40.0k|     ERR_set_error)
  |  |  ------------------
  ------------------
 1559|  40.0k|            return 0;
 1560|  40.0k|        }
 1561|   110k|    }
 1562|  69.9k|    if (pkey != NULL) {
  ------------------
  |  Branch (1562:9): [True: 54.9k, False: 14.9k]
  ------------------
 1563|  54.9k|        if (keymgmt != NULL && !EVP_KEYMGMT_up_ref(keymgmt)) {
  ------------------
  |  Branch (1563:13): [True: 15.0k, False: 39.9k]
  |  Branch (1563:32): [True: 0, False: 15.0k]
  ------------------
 1564|      0|            ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1565|      0|            return 0;
 1566|      0|        }
 1567|       |
 1568|  54.9k|        pkey->keymgmt = keymgmt;
 1569|       |
 1570|  54.9k|        pkey->save_type = type;
 1571|  54.9k|        pkey->type = type;
 1572|       |
 1573|  54.9k|#ifndef FIPS_MODULE
 1574|       |        /*
 1575|       |         * If the internal "origin" key is provider side, don't save |ameth|.
 1576|       |         * The main reason is that |ameth| is one factor to detect that the
 1577|       |         * internal "origin" key is a legacy one.
 1578|       |         */
 1579|  54.9k|        if (keymgmt == NULL)
  ------------------
  |  Branch (1579:13): [True: 39.9k, False: 15.0k]
  ------------------
 1580|  39.9k|            pkey->ameth = ameth;
 1581|       |
 1582|       |        /*
 1583|       |         * The EVP_PKEY_ASN1_METHOD |pkey_id| retains its legacy key purpose
 1584|       |         * for any key type that has a legacy implementation, regardless of
 1585|       |         * if the internal key is a legacy or a provider side one.  When
 1586|       |         * there is no legacy implementation for the key, the type becomes
 1587|       |         * EVP_PKEY_KEYMGMT, which indicates that one should be cautious
 1588|       |         * with functions that expect legacy internal keys.
 1589|       |         */
 1590|  54.9k|        if (ameth != NULL) {
  ------------------
  |  Branch (1590:13): [True: 54.9k, False: 15]
  ------------------
 1591|  54.9k|            if (type == EVP_PKEY_NONE)
  ------------------
  |  |   58|  54.9k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  54.9k|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1591:17): [True: 14.9k, False: 39.9k]
  ------------------
 1592|  14.9k|                pkey->type = ameth->pkey_id;
 1593|  54.9k|        } else {
 1594|     15|            pkey->type = EVP_PKEY_KEYMGMT;
  ------------------
  |  |   83|     15|# define EVP_PKEY_KEYMGMT -1
  ------------------
 1595|     15|        }
 1596|  54.9k|# ifndef OPENSSL_NO_ENGINE
 1597|  54.9k|        if (eptr == NULL && e != NULL && !ENGINE_init(e)) {
  ------------------
  |  Branch (1597:13): [True: 0, False: 54.9k]
  |  Branch (1597:29): [True: 0, False: 0]
  |  Branch (1597:42): [True: 0, False: 0]
  ------------------
 1598|      0|            ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1599|      0|            return 0;
 1600|      0|        }
 1601|  54.9k|# endif
 1602|  54.9k|        pkey->engine = e;
 1603|  54.9k|#endif
 1604|  54.9k|    }
 1605|  69.9k|    return 1;
 1606|  69.9k|}
p_lib.c:find_ameth:
 1610|  55.0k|{
 1611|  55.0k|    const char **str = data;
 1612|       |
 1613|       |    /*
 1614|       |     * The error messages from pkey_set_type() are uninteresting here,
 1615|       |     * and misleading.
 1616|       |     */
 1617|  55.0k|    ERR_set_mark();
 1618|       |
 1619|  55.0k|    if (pkey_set_type(NULL, NULL, EVP_PKEY_NONE, name, strlen(name),
  ------------------
  |  |   58|  55.0k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  55.0k|#define NID_undef                       0
  |  |  ------------------
  ------------------
  |  Branch (1619:9): [True: 14.9k, False: 40.0k]
  ------------------
 1620|  55.0k|                      NULL)) {
 1621|  14.9k|        if (str[0] == NULL)
  ------------------
  |  Branch (1621:13): [True: 14.9k, False: 0]
  ------------------
 1622|  14.9k|            str[0] = name;
 1623|      0|        else if (str[1] == NULL)
  ------------------
  |  Branch (1623:18): [True: 0, False: 0]
  ------------------
 1624|      0|            str[1] = name;
 1625|  14.9k|    }
 1626|       |
 1627|  55.0k|    ERR_pop_to_mark();
 1628|  55.0k|}
p_lib.c:evp_pkey_free_it:
 1764|  54.8k|{
 1765|       |    /* internal function; x is never NULL */
 1766|  54.8k|    evp_keymgmt_util_clear_operation_cache(x);
 1767|  54.8k|#ifndef FIPS_MODULE
 1768|  54.8k|    evp_pkey_free_legacy(x);
 1769|  54.8k|#endif
 1770|       |
 1771|  54.8k|    if (x->keymgmt != NULL) {
  ------------------
  |  Branch (1771:9): [True: 15.0k, False: 39.8k]
  ------------------
 1772|  15.0k|        evp_keymgmt_freedata(x->keymgmt, x->keydata);
 1773|  15.0k|        EVP_KEYMGMT_free(x->keymgmt);
 1774|  15.0k|        x->keymgmt = NULL;
 1775|  15.0k|        x->keydata = NULL;
 1776|  15.0k|    }
 1777|  54.8k|    x->type = EVP_PKEY_NONE;
  ------------------
  |  |   58|  54.8k|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|  54.8k|#define NID_undef                       0
  |  |  ------------------
  ------------------
 1778|  54.8k|}

EVP_PKEY_CTX_free:
  406|  8.77k|{
  407|  8.77k|    if (ctx == NULL)
  ------------------
  |  Branch (407:9): [True: 8.77k, False: 0]
  ------------------
  408|  8.77k|        return;
  409|      0|    if (ctx->pmeth && ctx->pmeth->cleanup)
  ------------------
  |  Branch (409:9): [True: 0, False: 0]
  |  Branch (409:23): [True: 0, False: 0]
  ------------------
  410|      0|        ctx->pmeth->cleanup(ctx);
  411|       |
  412|      0|    evp_pkey_ctx_free_old_ops(ctx);
  413|      0|#ifndef FIPS_MODULE
  414|      0|    evp_pkey_ctx_free_all_cached_data(ctx);
  415|      0|#endif
  416|      0|    EVP_KEYMGMT_free(ctx->keymgmt);
  417|       |
  418|      0|    OPENSSL_free(ctx->propquery);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  419|      0|    EVP_PKEY_free(ctx->pkey);
  420|      0|    EVP_PKEY_free(ctx->peerkey);
  421|      0|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  422|      0|    ENGINE_finish(ctx->engine);
  423|      0|#endif
  424|      0|    BN_free(ctx->rsa_pubexp);
  425|      0|    OPENSSL_free(ctx);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  426|      0|}
evp_app_cleanup_int:
  636|      2|{
  637|      2|    if (app_pkey_methods != NULL)
  ------------------
  |  Branch (637:9): [True: 0, False: 2]
  ------------------
  638|      0|        sk_EVP_PKEY_METHOD_pop_free(app_pkey_methods, EVP_PKEY_meth_free);
  639|      2|}

ossl_do_ex_data_init:
   15|      4|{
   16|      4|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   17|       |
   18|      4|    if (global == NULL)
  ------------------
  |  Branch (18:9): [True: 0, False: 4]
  ------------------
   19|      0|        return 0;
   20|       |
   21|      4|    global->ex_data_lock = CRYPTO_THREAD_lock_new();
   22|      4|    return global->ex_data_lock != NULL;
   23|      4|}
ossl_crypto_cleanup_all_ex_data_int:
   73|      2|{
   74|      2|    int i;
   75|      2|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   76|       |
   77|      2|    if (global == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 2]
  ------------------
   78|      0|        return;
   79|       |
   80|     38|    for (i = 0; i < CRYPTO_EX_INDEX__COUNT; ++i) {
  ------------------
  |  |  237|     38|# define CRYPTO_EX_INDEX__COUNT          18
  ------------------
  |  Branch (80:17): [True: 36, False: 2]
  ------------------
   81|     36|        EX_CALLBACKS *ip = &global->ex_data[i];
   82|       |
   83|     36|        sk_EX_CALLBACK_pop_free(ip->meth, cleanup_cb);
   84|     36|        ip->meth = NULL;
   85|     36|    }
   86|       |
   87|      2|    CRYPTO_THREAD_lock_free(global->ex_data_lock);
   88|      2|    global->ex_data_lock = NULL;
   89|      2|}
ossl_crypto_free_ex_index_ex:
  114|      2|{
  115|      2|    EX_CALLBACKS *ip;
  116|      2|    EX_CALLBACK *a;
  117|      2|    int toret = 0;
  118|      2|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
  119|       |
  120|      2|    if (global == NULL)
  ------------------
  |  Branch (120:9): [True: 0, False: 2]
  ------------------
  121|      0|        return 0;
  122|       |
  123|      2|    ip = get_and_lock(global, class_index, 0);
  124|      2|    if (ip == NULL)
  ------------------
  |  Branch (124:9): [True: 0, False: 2]
  ------------------
  125|      0|        return 0;
  126|       |
  127|      2|    if (idx < 0 || idx >= sk_EX_CALLBACK_num(ip->meth))
  ------------------
  |  Branch (127:9): [True: 2, False: 0]
  |  Branch (127:20): [True: 0, False: 0]
  ------------------
  128|      2|        goto err;
  129|      0|    a = sk_EX_CALLBACK_value(ip->meth, idx);
  130|      0|    if (a == NULL)
  ------------------
  |  Branch (130:9): [True: 0, False: 0]
  ------------------
  131|      0|        goto err;
  132|      0|    a->new_func = dummy_new;
  133|      0|    a->dup_func = dummy_dup;
  134|      0|    a->free_func = dummy_free;
  135|      0|    toret = 1;
  136|      2|err:
  137|      2|    CRYPTO_THREAD_unlock(global->ex_data_lock);
  138|      2|    return toret;
  139|      0|}
CRYPTO_free_ex_index:
  142|      2|{
  143|      2|    return ossl_crypto_free_ex_index_ex(NULL, class_index, idx);
  144|      2|}
ossl_crypto_new_ex_data_ex:
  221|  9.12M|{
  222|  9.12M|    int mx, i;
  223|  9.12M|    void *ptr;
  224|  9.12M|    EX_CALLBACK **storage = NULL;
  225|  9.12M|    EX_CALLBACK *stack[10];
  226|  9.12M|    EX_CALLBACKS *ip;
  227|  9.12M|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
  228|       |
  229|  9.12M|    if (global == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 9.12M]
  ------------------
  230|      0|        return 0;
  231|       |
  232|  9.12M|    ip = get_and_lock(global, class_index, 1);
  233|  9.12M|    if (ip == NULL)
  ------------------
  |  Branch (233:9): [True: 0, False: 9.12M]
  ------------------
  234|      0|        return 0;
  235|       |
  236|  9.12M|    ad->ctx = ctx;
  237|  9.12M|    ad->sk = NULL;
  238|  9.12M|    mx = sk_EX_CALLBACK_num(ip->meth);
  239|  9.12M|    if (mx > 0) {
  ------------------
  |  Branch (239:9): [True: 0, False: 9.12M]
  ------------------
  240|      0|        if (mx < (int)OSSL_NELEM(stack))
  ------------------
  |  |   14|      0|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (240:13): [True: 0, False: 0]
  ------------------
  241|      0|            storage = stack;
  242|      0|        else
  243|      0|            storage = OPENSSL_malloc(sizeof(*storage) * mx);
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  244|      0|        if (storage != NULL)
  ------------------
  |  Branch (244:13): [True: 0, False: 0]
  ------------------
  245|      0|            for (i = 0; i < mx; i++)
  ------------------
  |  Branch (245:25): [True: 0, False: 0]
  ------------------
  246|      0|                storage[i] = sk_EX_CALLBACK_value(ip->meth, i);
  247|      0|    }
  248|  9.12M|    CRYPTO_THREAD_unlock(global->ex_data_lock);
  249|       |
  250|  9.12M|    if (mx > 0 && storage == NULL)
  ------------------
  |  Branch (250:9): [True: 0, False: 9.12M]
  |  Branch (250:19): [True: 0, False: 0]
  ------------------
  251|      0|        return 0;
  252|  9.12M|    for (i = 0; i < mx; i++) {
  ------------------
  |  Branch (252:17): [True: 0, False: 9.12M]
  ------------------
  253|      0|        if (storage[i] != NULL && storage[i]->new_func != NULL) {
  ------------------
  |  Branch (253:13): [True: 0, False: 0]
  |  Branch (253:35): [True: 0, False: 0]
  ------------------
  254|      0|            ptr = CRYPTO_get_ex_data(ad, i);
  255|      0|            storage[i]->new_func(obj, ptr, ad, i,
  256|      0|                                 storage[i]->argl, storage[i]->argp);
  257|      0|        }
  258|      0|    }
  259|  9.12M|    if (storage != stack)
  ------------------
  |  Branch (259:9): [True: 9.12M, False: 0]
  ------------------
  260|  9.12M|        OPENSSL_free(storage);
  ------------------
  |  |  107|  9.12M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.12M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.12M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  261|  9.12M|    return 1;
  262|  9.12M|}
CRYPTO_new_ex_data:
  265|  9.08M|{
  266|  9.08M|    return ossl_crypto_new_ex_data_ex(NULL, class_index, obj, ad);
  267|  9.08M|}
CRYPTO_free_ex_data:
  368|  9.12M|{
  369|  9.12M|    int mx, i;
  370|  9.12M|    EX_CALLBACKS *ip;
  371|  9.12M|    void *ptr;
  372|  9.12M|    const EX_CALLBACK *f;
  373|  9.12M|    struct ex_callback_entry stack[10];
  374|  9.12M|    struct ex_callback_entry *storage = NULL;
  375|  9.12M|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ad->ctx);
  376|       |
  377|  9.12M|    if (global == NULL)
  ------------------
  |  Branch (377:9): [True: 0, False: 9.12M]
  ------------------
  378|      0|        goto err;
  379|       |
  380|  9.12M|    ip = get_and_lock(global, class_index, 1);
  381|  9.12M|    if (ip == NULL)
  ------------------
  |  Branch (381:9): [True: 0, False: 9.12M]
  ------------------
  382|      0|        goto err;
  383|       |
  384|  9.12M|    mx = sk_EX_CALLBACK_num(ip->meth);
  385|  9.12M|    if (mx > 0) {
  ------------------
  |  Branch (385:9): [True: 0, False: 9.12M]
  ------------------
  386|      0|        if (mx < (int)OSSL_NELEM(stack))
  ------------------
  |  |   14|      0|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (386:13): [True: 0, False: 0]
  ------------------
  387|      0|            storage = stack;
  388|      0|        else
  389|      0|            storage = OPENSSL_malloc(sizeof(*storage) * mx);
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  390|      0|        if (storage != NULL)
  ------------------
  |  Branch (390:13): [True: 0, False: 0]
  ------------------
  391|      0|            for (i = 0; i < mx; i++) {
  ------------------
  |  Branch (391:25): [True: 0, False: 0]
  ------------------
  392|      0|                storage[i].excb = sk_EX_CALLBACK_value(ip->meth, i);
  393|      0|                storage[i].index = i;
  394|      0|            }
  395|      0|    }
  396|  9.12M|    CRYPTO_THREAD_unlock(global->ex_data_lock);
  397|       |
  398|  9.12M|    if (storage != NULL) {
  ------------------
  |  Branch (398:9): [True: 0, False: 9.12M]
  ------------------
  399|       |        /* Sort according to priority. High priority first */
  400|      0|        qsort(storage, mx, sizeof(*storage), ex_callback_compare);
  401|      0|        for (i = 0; i < mx; i++) {
  ------------------
  |  Branch (401:21): [True: 0, False: 0]
  ------------------
  402|      0|            f = storage[i].excb;
  403|       |
  404|      0|            if (f != NULL && f->free_func != NULL) {
  ------------------
  |  Branch (404:17): [True: 0, False: 0]
  |  Branch (404:30): [True: 0, False: 0]
  ------------------
  405|      0|                ptr = CRYPTO_get_ex_data(ad, storage[i].index);
  406|      0|                f->free_func(obj, ptr, ad, storage[i].index, f->argl, f->argp);
  407|      0|            }
  408|      0|        }
  409|      0|    }
  410|       |
  411|  9.12M|    if (storage != stack)
  ------------------
  |  Branch (411:9): [True: 9.12M, False: 0]
  ------------------
  412|  9.12M|        OPENSSL_free(storage);
  ------------------
  |  |  107|  9.12M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.12M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.12M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  413|  9.12M| err:
  414|  9.12M|    sk_void_free(ad->sk);
  ------------------
  |  |  193|  9.12M|#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
  ------------------
  415|  9.12M|    ad->sk = NULL;
  416|  9.12M|    ad->ctx = NULL;
  417|  9.12M|}
ex_data.c:get_and_lock:
   33|  18.2M|{
   34|  18.2M|    EX_CALLBACKS *ip;
   35|       |
   36|  18.2M|    if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
  ------------------
  |  |  237|  18.2M|# define CRYPTO_EX_INDEX__COUNT          18
  ------------------
  |  Branch (36:9): [True: 0, False: 18.2M]
  |  Branch (36:28): [True: 0, False: 18.2M]
  ------------------
   37|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   38|      0|        return NULL;
   39|      0|    }
   40|       |
   41|  18.2M|    if (global->ex_data_lock == NULL) {
  ------------------
  |  Branch (41:9): [True: 0, False: 18.2M]
  ------------------
   42|       |        /*
   43|       |         * If we get here, someone (who?) cleaned up the lock, so just
   44|       |         * treat it as an error.
   45|       |         */
   46|      0|         return NULL;
   47|      0|    }
   48|       |
   49|  18.2M|    if (read) {
  ------------------
  |  Branch (49:9): [True: 18.2M, False: 2]
  ------------------
   50|  18.2M|        if (!CRYPTO_THREAD_read_lock(global->ex_data_lock))
  ------------------
  |  Branch (50:13): [True: 0, False: 18.2M]
  ------------------
   51|      0|            return NULL;
   52|  18.2M|    } else {
   53|      2|        if (!CRYPTO_THREAD_write_lock(global->ex_data_lock))
  ------------------
  |  Branch (53:13): [True: 0, False: 2]
  ------------------
   54|      0|            return NULL;
   55|      2|    }
   56|       |
   57|  18.2M|    ip = &global->ex_data[class_index];
   58|  18.2M|    return ip;
   59|  18.2M|}

ossl_ffc_numbers_to_dh_named_group:
  116|  1.26k|{
  117|  1.26k|    size_t i;
  118|       |
  119|  18.9k|    for (i = 0; i < OSSL_NELEM(dh_named_groups); ++i) {
  ------------------
  |  |   14|  18.9k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (119:17): [True: 17.7k, False: 1.26k]
  ------------------
  120|       |        /* Keep searching until a matching p and g is found */
  121|  17.7k|        if (BN_cmp(p, dh_named_groups[i].p) == 0
  ------------------
  |  Branch (121:13): [True: 0, False: 17.7k]
  ------------------
  122|  17.7k|            && BN_cmp(g, dh_named_groups[i].g) == 0
  ------------------
  |  Branch (122:16): [True: 0, False: 0]
  ------------------
  123|       |            /* Verify q is correct if it exists */
  124|  17.7k|            && (q == NULL || BN_cmp(q, dh_named_groups[i].q) == 0))
  ------------------
  |  Branch (124:17): [True: 0, False: 0]
  |  Branch (124:30): [True: 0, False: 0]
  ------------------
  125|      0|            return &dh_named_groups[i];
  126|  17.7k|    }
  127|  1.26k|    return NULL;
  128|  1.26k|}

ossl_ffc_params_init:
   21|   157k|{
   22|   157k|    memset(params, 0, sizeof(*params));
   23|   157k|    params->pcounter = -1;
   24|   157k|    params->gindex = FFC_UNVERIFIABLE_GINDEX;
  ------------------
  |  |   23|   157k|# define FFC_UNVERIFIABLE_GINDEX -1
  ------------------
   25|   157k|    params->flags = FFC_PARAM_FLAG_VALIDATE_PQG;
  ------------------
  |  |   46|   157k|    (FFC_PARAM_FLAG_VALIDATE_PQ | FFC_PARAM_FLAG_VALIDATE_G)
  |  |  ------------------
  |  |  |  |   43|   157k|# define FFC_PARAM_FLAG_VALIDATE_PQ    0x01
  |  |  ------------------
  |  |                   (FFC_PARAM_FLAG_VALIDATE_PQ | FFC_PARAM_FLAG_VALIDATE_G)
  |  |  ------------------
  |  |  |  |   44|   157k|# define FFC_PARAM_FLAG_VALIDATE_G     0x02
  |  |  ------------------
  ------------------
   26|   157k|}
ossl_ffc_params_cleanup:
   29|  78.8k|{
   30|  78.8k|    BN_free(params->p);
   31|  78.8k|    BN_free(params->q);
   32|  78.8k|    BN_free(params->g);
   33|  78.8k|    BN_free(params->j);
   34|  78.8k|    OPENSSL_free(params->seed);
  ------------------
  |  |  107|  78.8k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  78.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  78.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   35|  78.8k|    ossl_ffc_params_init(params);
   36|  78.8k|}
ossl_ffc_params_set0_pqg:
   39|  1.08k|{
   40|  1.08k|    if (p != NULL && p != d->p) {
  ------------------
  |  Branch (40:9): [True: 1.08k, False: 0]
  |  Branch (40:22): [True: 1.08k, False: 0]
  ------------------
   41|  1.08k|        BN_free(d->p);
   42|  1.08k|        d->p = p;
   43|  1.08k|    }
   44|  1.08k|    if (q != NULL && q != d->q) {
  ------------------
  |  Branch (44:9): [True: 1.08k, False: 0]
  |  Branch (44:22): [True: 1.08k, False: 0]
  ------------------
   45|  1.08k|        BN_free(d->q);
   46|  1.08k|        d->q = q;
   47|  1.08k|    }
   48|  1.08k|    if (g != NULL && g != d->g) {
  ------------------
  |  Branch (48:9): [True: 1.08k, False: 0]
  |  Branch (48:22): [True: 1.08k, False: 0]
  ------------------
   49|  1.08k|        BN_free(d->g);
   50|  1.08k|        d->g = g;
   51|  1.08k|    }
   52|  1.08k|}
ossl_ffc_params_get0_pqg:
   56|     93|{
   57|     93|    if (p != NULL)
  ------------------
  |  Branch (57:9): [True: 93, False: 0]
  ------------------
   58|     93|        *p = d->p;
   59|     93|    if (q != NULL)
  ------------------
  |  Branch (59:9): [True: 93, False: 0]
  ------------------
   60|     93|        *q = d->q;
   61|     93|    if (g != NULL)
  ------------------
  |  Branch (61:9): [True: 93, False: 0]
  ------------------
   62|     93|        *g = d->g;
   63|     93|}
ossl_ffc_params_set0_j:
   68|  1.08k|{
   69|  1.08k|    BN_free(d->j);
   70|  1.08k|    d->j = NULL;
   71|  1.08k|    if (j != NULL)
  ------------------
  |  Branch (71:9): [True: 28, False: 1.05k]
  ------------------
   72|     28|        d->j = j;
   73|  1.08k|}
ossl_ffc_params_set_seed:
   77|     28|{
   78|     28|    if (params->seed != NULL) {
  ------------------
  |  Branch (78:9): [True: 0, False: 28]
  ------------------
   79|      0|        if (params->seed == seed)
  ------------------
  |  Branch (79:13): [True: 0, False: 0]
  ------------------
   80|      0|            return 1;
   81|      0|        OPENSSL_free(params->seed);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   82|      0|    }
   83|       |
   84|     28|    if (seed != NULL && seedlen > 0) {
  ------------------
  |  Branch (84:9): [True: 26, False: 2]
  |  Branch (84:25): [True: 26, False: 0]
  ------------------
   85|     26|        params->seed = OPENSSL_memdup(seed, seedlen);
  ------------------
  |  |  109|     26|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     26|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     26|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   86|     26|        if (params->seed == NULL)
  ------------------
  |  Branch (86:13): [True: 0, False: 26]
  ------------------
   87|      0|            return 0;
   88|     26|        params->seedlen = seedlen;
   89|     26|    } else {
   90|      2|        params->seed = NULL;
   91|      2|        params->seedlen = 0;
   92|      2|    }
   93|     28|    return 1;
   94|     28|}
ossl_ffc_params_set_validate_params:
  134|     28|{
  135|     28|    if (!ossl_ffc_params_set_seed(params, seed, seedlen))
  ------------------
  |  Branch (135:9): [True: 0, False: 28]
  ------------------
  136|      0|        return 0;
  137|     28|    params->pcounter = counter;
  138|     28|    return 1;
  139|     28|}
ossl_ffc_params_get_validate_params:
  144|     75|{
  145|     75|    if (seed != NULL)
  ------------------
  |  Branch (145:9): [True: 75, False: 0]
  ------------------
  146|     75|        *seed = params->seed;
  147|     75|    if (seedlen != NULL)
  ------------------
  |  Branch (147:9): [True: 75, False: 0]
  ------------------
  148|     75|        *seedlen = params->seedlen;
  149|     75|    if (pcounter != NULL)
  ------------------
  |  Branch (149:9): [True: 75, False: 0]
  ------------------
  150|     75|        *pcounter = params->pcounter;
  151|     75|}
ossl_ffc_params_todata:
  210|    591|{
  211|    591|    int test_flags;
  212|       |
  213|    591|    if (ffc->p != NULL
  ------------------
  |  Branch (213:9): [True: 591, False: 0]
  ------------------
  214|    591|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_FFC_P, ffc->p))
  ------------------
  |  |  354|    591|# define OSSL_PKEY_PARAM_FFC_P "p"
  ------------------
  |  Branch (214:12): [True: 0, False: 591]
  ------------------
  215|      0|        return 0;
  216|    591|    if (ffc->q != NULL
  ------------------
  |  Branch (216:9): [True: 531, False: 60]
  ------------------
  217|    591|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_FFC_Q, ffc->q))
  ------------------
  |  |  357|    531|# define OSSL_PKEY_PARAM_FFC_Q "q"
  ------------------
  |  Branch (217:12): [True: 0, False: 531]
  ------------------
  218|      0|        return 0;
  219|    591|    if (ffc->g != NULL
  ------------------
  |  Branch (219:9): [True: 591, False: 0]
  ------------------
  220|    591|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_FFC_G, ffc->g))
  ------------------
  |  |  351|    591|# define OSSL_PKEY_PARAM_FFC_G "g"
  ------------------
  |  Branch (220:12): [True: 0, False: 591]
  ------------------
  221|      0|        return 0;
  222|    591|    if (ffc->j != NULL
  ------------------
  |  Branch (222:9): [True: 14, False: 577]
  ------------------
  223|    591|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_FFC_COFACTOR,
  ------------------
  |  |  348|     14|# define OSSL_PKEY_PARAM_FFC_COFACTOR "j"
  ------------------
  |  Branch (223:12): [True: 0, False: 14]
  ------------------
  224|     14|                                    ffc->j))
  225|      0|        return 0;
  226|    591|    if (!ossl_param_build_set_int(bld, params, OSSL_PKEY_PARAM_FFC_GINDEX,
  ------------------
  |  |  352|    591|# define OSSL_PKEY_PARAM_FFC_GINDEX "gindex"
  ------------------
  |  Branch (226:9): [True: 0, False: 591]
  ------------------
  227|    591|                                  ffc->gindex))
  228|      0|        return 0;
  229|    591|    if (!ossl_param_build_set_int(bld, params, OSSL_PKEY_PARAM_FFC_PCOUNTER,
  ------------------
  |  |  356|    591|# define OSSL_PKEY_PARAM_FFC_PCOUNTER "pcounter"
  ------------------
  |  Branch (229:9): [True: 0, False: 591]
  ------------------
  230|    591|                                  ffc->pcounter))
  231|      0|        return 0;
  232|    591|    if (!ossl_param_build_set_int(bld, params, OSSL_PKEY_PARAM_FFC_H, ffc->h))
  ------------------
  |  |  353|    591|# define OSSL_PKEY_PARAM_FFC_H "hindex"
  ------------------
  |  Branch (232:9): [True: 0, False: 591]
  ------------------
  233|      0|        return 0;
  234|    591|    if (ffc->seed != NULL
  ------------------
  |  Branch (234:9): [True: 0, False: 591]
  ------------------
  235|    591|        && !ossl_param_build_set_octet_string(bld, params,
  ------------------
  |  Branch (235:12): [True: 0, False: 0]
  ------------------
  236|      0|                                              OSSL_PKEY_PARAM_FFC_SEED,
  ------------------
  |  |  359|      0|# define OSSL_PKEY_PARAM_FFC_SEED "seed"
  ------------------
  237|      0|                                              ffc->seed, ffc->seedlen))
  238|      0|        return 0;
  239|    591|    if (ffc->nid != NID_undef) {
  ------------------
  |  |   18|    591|#define NID_undef                       0
  ------------------
  |  Branch (239:9): [True: 0, False: 591]
  ------------------
  240|      0|        const DH_NAMED_GROUP *group = ossl_ffc_uid_to_dh_named_group(ffc->nid);
  241|      0|        const char *name = ossl_ffc_named_group_get_name(group);
  242|       |
  243|      0|        if (name == NULL
  ------------------
  |  Branch (243:13): [True: 0, False: 0]
  ------------------
  244|      0|            || !ossl_param_build_set_utf8_string(bld, params,
  ------------------
  |  Branch (244:16): [True: 0, False: 0]
  ------------------
  245|      0|                                                 OSSL_PKEY_PARAM_GROUP_NAME,
  ------------------
  |  |  364|      0|# define OSSL_PKEY_PARAM_GROUP_NAME "group"
  ------------------
  246|      0|                                                 name))
  247|      0|            return 0;
  248|      0|    }
  249|    591|    test_flags = ((ffc->flags & FFC_PARAM_FLAG_VALIDATE_PQ) != 0);
  ------------------
  |  |   43|    591|# define FFC_PARAM_FLAG_VALIDATE_PQ    0x01
  ------------------
  250|    591|    if (!ossl_param_build_set_int(bld, params,
  ------------------
  |  Branch (250:9): [True: 0, False: 591]
  ------------------
  251|    591|                                  OSSL_PKEY_PARAM_FFC_VALIDATE_PQ, test_flags))
  ------------------
  |  |  363|    591|# define OSSL_PKEY_PARAM_FFC_VALIDATE_PQ "validate-pq"
  ------------------
  252|      0|        return 0;
  253|    591|    test_flags = ((ffc->flags & FFC_PARAM_FLAG_VALIDATE_G) != 0);
  ------------------
  |  |   44|    591|# define FFC_PARAM_FLAG_VALIDATE_G     0x02
  ------------------
  254|    591|    if (!ossl_param_build_set_int(bld, params,
  ------------------
  |  Branch (254:9): [True: 0, False: 591]
  ------------------
  255|    591|                                  OSSL_PKEY_PARAM_FFC_VALIDATE_G, test_flags))
  ------------------
  |  |  361|    591|# define OSSL_PKEY_PARAM_FFC_VALIDATE_G "validate-g"
  ------------------
  256|      0|        return 0;
  257|    591|    test_flags = ((ffc->flags & FFC_PARAM_FLAG_VALIDATE_LEGACY) != 0);
  ------------------
  |  |   47|    591|#define FFC_PARAM_FLAG_VALIDATE_LEGACY 0x04
  ------------------
  258|    591|    if (!ossl_param_build_set_int(bld, params,
  ------------------
  |  Branch (258:9): [True: 0, False: 591]
  ------------------
  259|    591|                                  OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY,
  ------------------
  |  |  362|    591|# define OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY "validate-legacy"
  ------------------
  260|    591|                                  test_flags))
  261|      0|        return 0;
  262|       |
  263|    591|    if (ffc->mdname != NULL
  ------------------
  |  Branch (263:9): [True: 0, False: 591]
  ------------------
  264|    591|        && !ossl_param_build_set_utf8_string(bld, params,
  ------------------
  |  Branch (264:12): [True: 0, False: 0]
  ------------------
  265|      0|                                             OSSL_PKEY_PARAM_FFC_DIGEST,
  ------------------
  |  |  349|      0|# define OSSL_PKEY_PARAM_FFC_DIGEST OSSL_PKEY_PARAM_DIGEST
  |  |  ------------------
  |  |  |  |  322|      0|# define OSSL_PKEY_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      0|# define OSSL_ALG_PARAM_DIGEST "digest"
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  266|      0|                                             ffc->mdname))
  267|      0|       return 0;
  268|    591|    if (ffc->mdprops != NULL
  ------------------
  |  Branch (268:9): [True: 0, False: 591]
  ------------------
  269|    591|        && !ossl_param_build_set_utf8_string(bld, params,
  ------------------
  |  Branch (269:12): [True: 0, False: 0]
  ------------------
  270|      0|                                             OSSL_PKEY_PARAM_FFC_DIGEST_PROPS,
  ------------------
  |  |  350|      0|# define OSSL_PKEY_PARAM_FFC_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  373|      0|# define OSSL_PKEY_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      0|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  271|      0|                                             ffc->mdprops))
  272|      0|        return 0;
  273|    591|    return 1;
  274|    591|}
ossl_ffc_params_print:
  278|     68|{
  279|     68|    if (!ASN1_bn_print(bp, "prime P:", ffc->p, NULL, indent))
  ------------------
  |  Branch (279:9): [True: 0, False: 68]
  ------------------
  280|      0|        goto err;
  281|     68|    if (!ASN1_bn_print(bp, "generator G:", ffc->g, NULL, indent))
  ------------------
  |  Branch (281:9): [True: 0, False: 68]
  ------------------
  282|      0|        goto err;
  283|     68|    if (ffc->q != NULL
  ------------------
  |  Branch (283:9): [True: 68, False: 0]
  ------------------
  284|     68|        && !ASN1_bn_print(bp, "subgroup order Q:", ffc->q, NULL, indent))
  ------------------
  |  Branch (284:12): [True: 0, False: 68]
  ------------------
  285|      0|        goto err;
  286|     68|    if (ffc->j != NULL
  ------------------
  |  Branch (286:9): [True: 0, False: 68]
  ------------------
  287|     68|        && !ASN1_bn_print(bp, "subgroup factor:", ffc->j, NULL, indent))
  ------------------
  |  Branch (287:12): [True: 0, False: 0]
  ------------------
  288|      0|        goto err;
  289|     68|    if (ffc->seed != NULL) {
  ------------------
  |  Branch (289:9): [True: 0, False: 68]
  ------------------
  290|      0|        size_t i;
  291|       |
  292|      0|        if (!BIO_indent(bp, indent, 128)
  ------------------
  |  Branch (292:13): [True: 0, False: 0]
  ------------------
  293|      0|            || BIO_puts(bp, "seed:") <= 0)
  ------------------
  |  Branch (293:16): [True: 0, False: 0]
  ------------------
  294|      0|            goto err;
  295|      0|        for (i = 0; i < ffc->seedlen; i++) {
  ------------------
  |  Branch (295:21): [True: 0, False: 0]
  ------------------
  296|      0|            if ((i % 15) == 0) {
  ------------------
  |  Branch (296:17): [True: 0, False: 0]
  ------------------
  297|      0|                if (BIO_puts(bp, "\n") <= 0
  ------------------
  |  Branch (297:21): [True: 0, False: 0]
  ------------------
  298|      0|                    || !BIO_indent(bp, indent + 4, 128))
  ------------------
  |  Branch (298:24): [True: 0, False: 0]
  ------------------
  299|      0|                    goto err;
  300|      0|            }
  301|      0|            if (BIO_printf(bp, "%02x%s", ffc->seed[i],
  ------------------
  |  Branch (301:17): [True: 0, False: 0]
  ------------------
  302|      0|                           ((i + 1) == ffc->seedlen) ? "" : ":") <= 0)
  ------------------
  |  Branch (302:28): [True: 0, False: 0]
  ------------------
  303|      0|                goto err;
  304|      0|        }
  305|      0|        if (BIO_write(bp, "\n", 1) <= 0)
  ------------------
  |  Branch (305:13): [True: 0, False: 0]
  ------------------
  306|      0|            return 0;
  307|      0|    }
  308|     68|    if (ffc->pcounter != -1) {
  ------------------
  |  Branch (308:9): [True: 0, False: 68]
  ------------------
  309|      0|        if (!BIO_indent(bp, indent, 128)
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            || BIO_printf(bp, "counter: %d\n", ffc->pcounter) <= 0)
  ------------------
  |  Branch (310:16): [True: 0, False: 0]
  ------------------
  311|      0|            goto err;
  312|      0|    }
  313|     68|    return 1;
  314|      0|err:
  315|      0|    return 0;
  316|     68|}

ossl_safe_getenv:
   19|      2|{
   20|       |#if defined(_WIN32) && defined(CP_UTF8) && !defined(_WIN32_WCE)
   21|       |    if (GetEnvironmentVariableW(L"OPENSSL_WIN32_UTF8", NULL, 0) != 0) {
   22|       |        char *val = NULL;
   23|       |        int vallen = 0;
   24|       |        WCHAR *namew = NULL;
   25|       |        WCHAR *valw = NULL;
   26|       |        DWORD envlen = 0;
   27|       |        DWORD dwFlags = MB_ERR_INVALID_CHARS;
   28|       |        int rsize, fsize;
   29|       |        UINT curacp;
   30|       |
   31|       |        curacp = GetACP();
   32|       |
   33|       |        /*
   34|       |         * For the code pages listed below, dwFlags must be set to 0.
   35|       |         * Otherwise, the function fails with ERROR_INVALID_FLAGS.
   36|       |         */
   37|       |        if (curacp == 50220 || curacp == 50221 || curacp == 50222 ||
   38|       |            curacp == 50225 || curacp == 50227 || curacp == 50229 ||
   39|       |            (57002 <= curacp && curacp <=57011) || curacp == 65000 ||
   40|       |            curacp == 42)
   41|       |            dwFlags = 0;
   42|       |
   43|       |        /* query for buffer len */
   44|       |        rsize = MultiByteToWideChar(curacp, dwFlags, name, -1, NULL, 0);
   45|       |        /* if name is valid string and can be converted to wide string */
   46|       |        if (rsize > 0)
   47|       |            namew = _malloca(rsize * sizeof(WCHAR));
   48|       |
   49|       |        if (NULL != namew) {
   50|       |            /* convert name to wide string */
   51|       |            fsize = MultiByteToWideChar(curacp, dwFlags, name, -1, namew, rsize);
   52|       |            /* if conversion is ok, then determine value string size in wchars */
   53|       |            if (fsize > 0)
   54|       |                envlen = GetEnvironmentVariableW(namew, NULL, 0);
   55|       |        }
   56|       |
   57|       |        if (envlen > 0)
   58|       |            valw = _malloca(envlen * sizeof(WCHAR));
   59|       |
   60|       |        if (NULL != valw) {
   61|       |            /* if can get env value as wide string */
   62|       |            if (GetEnvironmentVariableW(namew, valw, envlen) < envlen) {
   63|       |                /* determine value string size in utf-8 */
   64|       |                vallen = WideCharToMultiByte(CP_UTF8, 0, valw, -1, NULL, 0,
   65|       |                                             NULL, NULL);
   66|       |            }
   67|       |        }
   68|       |
   69|       |        if (vallen > 0)
   70|       |            val = OPENSSL_malloc(vallen);
   71|       |
   72|       |        if (NULL != val) {
   73|       |            /* convert value string from wide to utf-8 */
   74|       |            if (WideCharToMultiByte(CP_UTF8, 0, valw, -1, val, vallen,
   75|       |                                    NULL, NULL) == 0) {
   76|       |                OPENSSL_free(val);
   77|       |                val = NULL;
   78|       |            }
   79|       |        }
   80|       |
   81|       |        if (NULL != namew)
   82|       |            _freea(namew);
   83|       |
   84|       |        if (NULL != valw)
   85|       |            _freea(valw);
   86|       |
   87|       |        return val;
   88|       |    }
   89|       |#endif
   90|       |
   91|      2|#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
   92|      2|# if __GLIBC_PREREQ(2, 17)
   93|      2|#  define SECURE_GETENV
   94|      2|    return secure_getenv(name);
   95|      2|# endif
   96|      2|#endif
   97|       |
   98|       |#ifndef SECURE_GETENV
   99|       |    if (OPENSSL_issetugid())
  100|       |        return NULL;
  101|       |    return getenv(name);
  102|       |#endif
  103|      2|}

ossl_err_load_HTTP_strings:
   76|      2|{
   77|      2|#ifndef OPENSSL_NO_ERR
   78|      2|    if (ERR_reason_error_string(HTTP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (78:9): [True: 2, False: 0]
  ------------------
   79|      2|        ERR_load_strings_const(HTTP_str_reasons);
   80|      2|#endif
   81|      2|    return 1;
   82|      2|}

OPENSSL_cleanup:
  352|      2|{
  353|      2|    OPENSSL_INIT_STOP *currhandler, *lasthandler;
  354|       |
  355|       |    /*
  356|       |     * At some point we should consider looking at this function with a view to
  357|       |     * moving most/all of this into onfree handlers in OSSL_LIB_CTX.
  358|       |     */
  359|       |
  360|       |    /* If we've not been inited then no need to deinit */
  361|      2|    if (!base_inited)
  ------------------
  |  Branch (361:9): [True: 0, False: 2]
  ------------------
  362|      0|        return;
  363|       |
  364|       |    /* Might be explicitly called and also by atexit */
  365|      2|    if (stopped)
  ------------------
  |  Branch (365:9): [True: 0, False: 2]
  ------------------
  366|      0|        return;
  367|      2|    stopped = 1;
  368|       |
  369|       |    /*
  370|       |     * Thread stop may not get automatically called by the thread library for
  371|       |     * the very last thread in some situations, so call it directly.
  372|       |     */
  373|      2|    OPENSSL_thread_stop();
  374|       |
  375|      2|    currhandler = stop_handlers;
  376|      4|    while (currhandler != NULL) {
  ------------------
  |  Branch (376:12): [True: 2, False: 2]
  ------------------
  377|      2|        currhandler->handler();
  378|      2|        lasthandler = currhandler;
  379|      2|        currhandler = currhandler->next;
  380|      2|        OPENSSL_free(lasthandler);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  381|      2|    }
  382|      2|    stop_handlers = NULL;
  383|       |
  384|      2|    CRYPTO_THREAD_lock_free(optsdone_lock);
  385|      2|    optsdone_lock = NULL;
  386|      2|    CRYPTO_THREAD_lock_free(init_lock);
  387|      2|    init_lock = NULL;
  388|       |
  389|      2|    CRYPTO_THREAD_cleanup_local(&in_init_config_local);
  390|       |
  391|       |    /*
  392|       |     * We assume we are single-threaded for this function, i.e. no race
  393|       |     * conditions for the various "*_inited" vars below.
  394|       |     */
  395|       |
  396|      2|#ifndef OPENSSL_NO_COMP
  397|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zlib_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  398|      2|    ossl_comp_zlib_cleanup();
  399|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_brotli_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  400|      2|    ossl_comp_brotli_cleanup();
  401|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zstd_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  402|      2|    ossl_comp_zstd_cleanup();
  403|      2|#endif
  404|       |
  405|      2|    if (async_inited) {
  ------------------
  |  Branch (405:9): [True: 0, False: 2]
  ------------------
  406|      0|        OSSL_TRACE(INIT, "OPENSSL_cleanup: async_deinit()\n");
  ------------------
  |  |  287|      0|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  407|      0|        async_deinit();
  408|      0|    }
  409|       |
  410|       |    /*
  411|       |     * Note that cleanup order is important:
  412|       |     * - ossl_rand_cleanup_int could call an ENGINE's RAND cleanup function so
  413|       |     * must be called before engine_cleanup_int()
  414|       |     * - ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
  415|       |     * before the ex data handlers are wiped during default ossl_lib_ctx deinit.
  416|       |     * - ossl_config_modules_free() can end up in ENGINE code so must be called
  417|       |     * before engine_cleanup_int()
  418|       |     * - ENGINEs and additional EVP algorithms might use added OIDs names so
  419|       |     * ossl_obj_cleanup_int() must be called last
  420|       |     */
  421|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_rand_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  422|      2|    ossl_rand_cleanup_int();
  423|       |
  424|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_config_modules_free()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  425|      2|    ossl_config_modules_free();
  426|       |
  427|      2|#ifndef OPENSSL_NO_ENGINE
  428|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: engine_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  429|      2|    engine_cleanup_int();
  430|      2|#endif
  431|       |
  432|      2|#ifndef OPENSSL_NO_DEPRECATED_3_0
  433|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_store_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  434|      2|    ossl_store_cleanup_int();
  435|      2|#endif
  436|       |
  437|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_lib_ctx_default_deinit()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  438|      2|    ossl_lib_ctx_default_deinit();
  439|       |
  440|      2|    ossl_cleanup_thread();
  441|       |
  442|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: bio_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  443|      2|    bio_cleanup();
  444|       |
  445|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: evp_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  446|      2|    evp_cleanup_int();
  447|       |
  448|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_obj_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  449|      2|    ossl_obj_cleanup_int();
  450|       |
  451|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: err_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  452|      2|    err_cleanup();
  453|       |
  454|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: CRYPTO_secure_malloc_done()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  455|      2|    CRYPTO_secure_malloc_done();
  456|       |
  457|      2|#ifndef OPENSSL_NO_CMP
  458|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: OSSL_CMP_log_close()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  459|      2|    OSSL_CMP_log_close();
  460|      2|#endif
  461|       |
  462|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_trace_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  463|      2|    ossl_trace_cleanup();
  464|       |
  465|      2|    base_inited = 0;
  466|      2|}
OPENSSL_init_crypto:
  474|  45.3M|{
  475|  45.3M|    uint64_t tmp;
  476|  45.3M|    int aloaddone = 0;
  477|       |
  478|       |   /* Applications depend on 0 being returned when cleanup was already done */
  479|  45.3M|    if (stopped) {
  ------------------
  |  Branch (479:9): [True: 9, False: 45.3M]
  ------------------
  480|      9|        if (!(opts & OPENSSL_INIT_BASE_ONLY))
  ------------------
  |  |   31|      9|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (480:13): [True: 0, False: 9]
  ------------------
  481|      9|            ERR_raise(ERR_LIB_CRYPTO, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  482|      9|        return 0;
  483|      9|    }
  484|       |
  485|       |    /*
  486|       |     * We ignore failures from this function. It is probably because we are
  487|       |     * on a platform that doesn't support lockless atomic loads (we may not
  488|       |     * have created optsdone_lock yet so we can't use it). This is just an
  489|       |     * optimisation to skip the full checks in this function if we don't need
  490|       |     * to, so we carry on regardless in the event of failure.
  491|       |     *
  492|       |     * There could be a race here with other threads, so that optsdone has not
  493|       |     * been updated yet, even though the options have in fact been initialised.
  494|       |     * This doesn't matter - it just means we will run the full function
  495|       |     * unnecessarily - but all the critical code is contained in RUN_ONCE
  496|       |     * functions anyway so we are safe.
  497|       |     */
  498|  45.3M|    if (CRYPTO_atomic_load(&optsdone, &tmp, NULL)) {
  ------------------
  |  Branch (498:9): [True: 45.3M, False: 0]
  ------------------
  499|  45.3M|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (499:13): [True: 2.65M, False: 42.7M]
  ------------------
  500|  2.65M|            return 1;
  501|  42.7M|        aloaddone = 1;
  502|  42.7M|    }
  503|       |
  504|       |    /*
  505|       |     * At some point we should look at this function with a view to moving
  506|       |     * most/all of this into OSSL_LIB_CTX.
  507|       |     *
  508|       |     * When the caller specifies OPENSSL_INIT_BASE_ONLY, that should be the
  509|       |     * *only* option specified.  With that option we return immediately after
  510|       |     * doing the requested limited initialization.  Note that
  511|       |     * err_shelve_state() called by us via ossl_init_load_crypto_nodelete()
  512|       |     * re-enters OPENSSL_init_crypto() with OPENSSL_INIT_BASE_ONLY, but with
  513|       |     * base already initialized this is a harmless NOOP.
  514|       |     *
  515|       |     * If we remain the only caller of err_shelve_state() the recursion should
  516|       |     * perhaps be removed, but if in doubt, it can be left in place.
  517|       |     */
  518|  42.7M|    if (!RUN_ONCE(&base, ossl_init_base))
  ------------------
  |  |  130|  42.7M|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 42.7M, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (518:9): [True: 0, False: 42.7M]
  ------------------
  519|      0|        return 0;
  520|       |
  521|  42.7M|    if (opts & OPENSSL_INIT_BASE_ONLY)
  ------------------
  |  |   31|  42.7M|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (521:9): [True: 42.7M, False: 6]
  ------------------
  522|  42.7M|        return 1;
  523|       |
  524|       |    /*
  525|       |     * optsdone_lock should definitely be set up now, so we can now repeat the
  526|       |     * same check from above but be sure that it will work even on platforms
  527|       |     * without lockless CRYPTO_atomic_load
  528|       |     */
  529|      6|    if (!aloaddone) {
  ------------------
  |  Branch (529:9): [True: 0, False: 6]
  ------------------
  530|      0|        if (!CRYPTO_atomic_load(&optsdone, &tmp, optsdone_lock))
  ------------------
  |  Branch (530:13): [True: 0, False: 0]
  ------------------
  531|      0|            return 0;
  532|      0|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (532:13): [True: 0, False: 0]
  ------------------
  533|      0|            return 1;
  534|      0|    }
  535|       |
  536|       |    /*
  537|       |     * Now we don't always set up exit handlers, the INIT_BASE_ONLY calls
  538|       |     * should not have the side-effect of setting up exit handlers, and
  539|       |     * therefore, this code block is below the INIT_BASE_ONLY-conditioned early
  540|       |     * return above.
  541|       |     */
  542|      6|    if ((opts & OPENSSL_INIT_NO_ATEXIT) != 0) {
  ------------------
  |  |  468|      6|# define OPENSSL_INIT_NO_ATEXIT              0x00080000L
  ------------------
  |  Branch (542:9): [True: 0, False: 6]
  ------------------
  543|      0|        if (!RUN_ONCE_ALT(&register_atexit, ossl_init_no_register_atexit,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (543:13): [True: 0, False: 0]
  ------------------
  544|      0|                          ossl_init_register_atexit))
  545|      0|            return 0;
  546|      6|    } else if (!RUN_ONCE(&register_atexit, ossl_init_register_atexit)) {
  ------------------
  |  |  130|      6|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 6, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (546:16): [True: 0, False: 6]
  ------------------
  547|      0|        return 0;
  548|      0|    }
  549|       |
  550|      6|    if (!RUN_ONCE(&load_crypto_nodelete, ossl_init_load_crypto_nodelete))
  ------------------
  |  |  130|      6|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 6, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (550:9): [True: 0, False: 6]
  ------------------
  551|      0|        return 0;
  552|       |
  553|      6|    if ((opts & OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  449|      6|# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
  ------------------
  |  Branch (553:9): [True: 0, False: 6]
  ------------------
  554|      6|            && !RUN_ONCE_ALT(&load_crypto_strings,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (554:16): [True: 0, False: 0]
  ------------------
  555|      6|                             ossl_init_no_load_crypto_strings,
  556|      6|                             ossl_init_load_crypto_strings))
  557|      0|        return 0;
  558|       |
  559|      6|    if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  450|      6|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  |  Branch (559:9): [True: 2, False: 4]
  ------------------
  560|      6|            && !RUN_ONCE(&load_crypto_strings, ossl_init_load_crypto_strings))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (560:16): [True: 0, False: 2]
  ------------------
  561|      0|        return 0;
  562|       |
  563|      6|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_CIPHERS)
  ------------------
  |  |  453|      6|# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS     0x00000010L
  ------------------
  |  Branch (563:9): [True: 0, False: 6]
  ------------------
  564|      6|            && !RUN_ONCE_ALT(&add_all_ciphers, ossl_init_no_add_all_ciphers,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (564:16): [True: 0, False: 0]
  ------------------
  565|      6|                             ossl_init_add_all_ciphers))
  566|      0|        return 0;
  567|       |
  568|      6|    if ((opts & OPENSSL_INIT_ADD_ALL_CIPHERS)
  ------------------
  |  |  451|      6|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  |  Branch (568:9): [True: 2, False: 4]
  ------------------
  569|      6|            && !RUN_ONCE(&add_all_ciphers, ossl_init_add_all_ciphers))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (569:16): [True: 0, False: 2]
  ------------------
  570|      0|        return 0;
  571|       |
  572|      6|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_DIGESTS)
  ------------------
  |  |  454|      6|# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS     0x00000020L
  ------------------
  |  Branch (572:9): [True: 0, False: 6]
  ------------------
  573|      6|            && !RUN_ONCE_ALT(&add_all_digests, ossl_init_no_add_all_digests,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (573:16): [True: 0, False: 0]
  ------------------
  574|      6|                             ossl_init_add_all_digests))
  575|      0|        return 0;
  576|       |
  577|      6|    if ((opts & OPENSSL_INIT_ADD_ALL_DIGESTS)
  ------------------
  |  |  452|      6|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  |  Branch (577:9): [True: 2, False: 4]
  ------------------
  578|      6|            && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (578:16): [True: 0, False: 2]
  ------------------
  579|      0|        return 0;
  580|       |
  581|      6|    if ((opts & OPENSSL_INIT_ATFORK)
  ------------------
  |  |  466|      6|# define OPENSSL_INIT_ATFORK                 0x00020000L
  ------------------
  |  Branch (581:9): [True: 0, False: 6]
  ------------------
  582|      6|            && !openssl_init_fork_handlers())
  ------------------
  |  Branch (582:16): [True: 0, False: 0]
  ------------------
  583|      0|        return 0;
  584|       |
  585|      6|    if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG)
  ------------------
  |  |  456|      6|# define OPENSSL_INIT_NO_LOAD_CONFIG         0x00000080L
  ------------------
  |  Branch (585:9): [True: 0, False: 6]
  ------------------
  586|      6|            && !RUN_ONCE_ALT(&config, ossl_init_no_config, ossl_init_config))
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (586:16): [True: 0, False: 0]
  ------------------
  587|      0|        return 0;
  588|       |
  589|      6|    if (opts & OPENSSL_INIT_LOAD_CONFIG) {
  ------------------
  |  |  455|      6|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (589:9): [True: 4, False: 2]
  ------------------
  590|      4|        int loading = CRYPTO_THREAD_get_local(&in_init_config_local) != NULL;
  591|       |
  592|       |        /* If called recursively from OBJ_ calls, just skip it. */
  593|      4|        if (!loading) {
  ------------------
  |  Branch (593:13): [True: 2, False: 2]
  ------------------
  594|      2|            int ret;
  595|       |
  596|      2|            if (!CRYPTO_THREAD_set_local(&in_init_config_local, (void *)-1))
  ------------------
  |  Branch (596:17): [True: 0, False: 2]
  ------------------
  597|      0|                return 0;
  598|      2|            if (settings == NULL) {
  ------------------
  |  Branch (598:17): [True: 2, False: 0]
  ------------------
  599|      2|                ret = RUN_ONCE(&config, ossl_init_config);
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  600|      2|            } else {
  601|      0|                if (!CRYPTO_THREAD_write_lock(init_lock))
  ------------------
  |  Branch (601:21): [True: 0, False: 0]
  ------------------
  602|      0|                    return 0;
  603|      0|                conf_settings = settings;
  604|      0|                ret = RUN_ONCE_ALT(&config, ossl_init_config_settings,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  605|      0|                                   ossl_init_config);
  606|      0|                conf_settings = NULL;
  607|      0|                CRYPTO_THREAD_unlock(init_lock);
  608|      0|            }
  609|       |
  610|      2|            if (ret <= 0)
  ------------------
  |  Branch (610:17): [True: 0, False: 2]
  ------------------
  611|      0|                return 0;
  612|      2|        }
  613|      4|    }
  614|       |
  615|      6|    if ((opts & OPENSSL_INIT_ASYNC)
  ------------------
  |  |  457|      6|# define OPENSSL_INIT_ASYNC                  0x00000100L
  ------------------
  |  Branch (615:9): [True: 0, False: 6]
  ------------------
  616|      6|            && !RUN_ONCE(&async, ossl_init_async))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (616:16): [True: 0, False: 0]
  ------------------
  617|      0|        return 0;
  618|       |
  619|      6|#ifndef OPENSSL_NO_ENGINE
  620|      6|    if ((opts & OPENSSL_INIT_ENGINE_OPENSSL)
  ------------------
  |  |  460|      6|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  |  Branch (620:9): [True: 0, False: 6]
  ------------------
  621|      6|            && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (621:16): [True: 0, False: 0]
  ------------------
  622|      0|        return 0;
  623|      6|# ifndef OPENSSL_NO_RDRAND
  624|      6|    if ((opts & OPENSSL_INIT_ENGINE_RDRAND)
  ------------------
  |  |  458|      6|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  ------------------
  |  Branch (624:9): [True: 0, False: 6]
  ------------------
  625|      6|            && !RUN_ONCE(&engine_rdrand, ossl_init_engine_rdrand))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (625:16): [True: 0, False: 0]
  ------------------
  626|      0|        return 0;
  627|      6|# endif
  628|      6|    if ((opts & OPENSSL_INIT_ENGINE_DYNAMIC)
  ------------------
  |  |  459|      6|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  ------------------
  |  Branch (628:9): [True: 0, False: 6]
  ------------------
  629|      6|            && !RUN_ONCE(&engine_dynamic, ossl_init_engine_dynamic))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (629:16): [True: 0, False: 0]
  ------------------
  630|      0|        return 0;
  631|      6|# ifndef OPENSSL_NO_STATIC_ENGINE
  632|       |#  ifndef OPENSSL_NO_DEVCRYPTOENG
  633|       |    if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV)
  634|       |            && !RUN_ONCE(&engine_devcrypto, ossl_init_engine_devcrypto))
  635|       |        return 0;
  636|       |#  endif
  637|      6|#  if !defined(OPENSSL_NO_PADLOCKENG)
  638|      6|    if ((opts & OPENSSL_INIT_ENGINE_PADLOCK)
  ------------------
  |  |  463|      6|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  ------------------
  |  Branch (638:9): [True: 0, False: 6]
  ------------------
  639|      6|            && !RUN_ONCE(&engine_padlock, ossl_init_engine_padlock))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (639:16): [True: 0, False: 0]
  ------------------
  640|      0|        return 0;
  641|      6|#  endif
  642|       |#  if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
  643|       |    if ((opts & OPENSSL_INIT_ENGINE_CAPI)
  644|       |            && !RUN_ONCE(&engine_capi, ossl_init_engine_capi))
  645|       |        return 0;
  646|       |#  endif
  647|      6|#  if !defined(OPENSSL_NO_AFALGENG)
  648|      6|    if ((opts & OPENSSL_INIT_ENGINE_AFALG)
  ------------------
  |  |  464|      6|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  |  Branch (648:9): [True: 0, False: 6]
  ------------------
  649|      6|            && !RUN_ONCE(&engine_afalg, ossl_init_engine_afalg))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (649:16): [True: 0, False: 0]
  ------------------
  650|      0|        return 0;
  651|      6|#  endif
  652|      6|# endif
  653|      6|    if (opts & (OPENSSL_INIT_ENGINE_ALL_BUILTIN
  ------------------
  |  |  480|      6|    (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  458|      6|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  |  |  ------------------
  |  |                   (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  459|      6|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  |  |  ------------------
  |  |  481|      6|    | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  461|      6|# define OPENSSL_INIT_ENGINE_CRYPTODEV       0x00001000L
  |  |  ------------------
  |  |                   | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  462|      6|# define OPENSSL_INIT_ENGINE_CAPI            0x00002000L
  |  |  ------------------
  |  |  482|      6|    OPENSSL_INIT_ENGINE_PADLOCK)
  |  |  ------------------
  |  |  |  |  463|      6|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  |  |  ------------------
  ------------------
  |  Branch (653:9): [True: 0, False: 6]
  ------------------
  654|      6|                | OPENSSL_INIT_ENGINE_OPENSSL
  ------------------
  |  |  460|      6|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  655|      6|                | OPENSSL_INIT_ENGINE_AFALG)) {
  ------------------
  |  |  464|      6|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  656|      0|        ENGINE_register_all_complete();
  657|      0|    }
  658|      6|#endif
  659|       |
  660|      6|    if (!CRYPTO_atomic_or(&optsdone, opts, &tmp, optsdone_lock))
  ------------------
  |  Branch (660:9): [True: 0, False: 6]
  ------------------
  661|      0|        return 0;
  662|       |
  663|      6|    return 1;
  664|      6|}
OPENSSL_atexit:
  667|      2|{
  668|      2|    OPENSSL_INIT_STOP *newhand;
  669|       |
  670|       |#if !defined(OPENSSL_USE_NODELETE)\
  671|       |    && !defined(OPENSSL_NO_PINSHARED)
  672|       |    {
  673|       |# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
  674|       |        HMODULE handle = NULL;
  675|       |        BOOL ret;
  676|       |        union {
  677|       |            void *sym;
  678|       |            void (*func)(void);
  679|       |        } handlersym;
  680|       |
  681|       |        handlersym.func = handler;
  682|       |
  683|       |        /*
  684|       |         * We don't use the DSO route for WIN32 because there is a better
  685|       |         * way
  686|       |         */
  687|       |        ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
  688|       |                                | GET_MODULE_HANDLE_EX_FLAG_PIN,
  689|       |                                handlersym.sym, &handle);
  690|       |
  691|       |        if (!ret)
  692|       |            return 0;
  693|       |# elif !defined(DSO_NONE)
  694|       |        /*
  695|       |         * Deliberately leak a reference to the handler. This will force the
  696|       |         * library/code containing the handler to remain loaded until we run the
  697|       |         * atexit handler. If -znodelete has been used then this is
  698|       |         * unnecessary.
  699|       |         */
  700|       |        DSO *dso = NULL;
  701|       |        union {
  702|       |            void *sym;
  703|       |            void (*func)(void);
  704|       |        } handlersym;
  705|       |
  706|       |        handlersym.func = handler;
  707|       |
  708|       |        ERR_set_mark();
  709|       |        dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);
  710|       |        /* See same code above in ossl_init_base() for an explanation. */
  711|       |        OSSL_TRACE1(INIT,
  712|       |                   "atexit: obtained DSO reference? %s\n",
  713|       |                   (dso == NULL ? "No!" : "Yes."));
  714|       |        DSO_free(dso);
  715|       |        ERR_pop_to_mark();
  716|       |# endif
  717|       |    }
  718|       |#endif
  719|       |
  720|      2|    if ((newhand = OPENSSL_malloc(sizeof(*newhand))) == NULL)
  ------------------
  |  |   97|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (720:9): [True: 0, False: 2]
  ------------------
  721|      0|        return 0;
  722|       |
  723|      2|    newhand->handler = handler;
  724|      2|    newhand->next = stop_handlers;
  725|      2|    stop_handlers = newhand;
  726|       |
  727|      2|    return 1;
  728|      2|}
init.c:ossl_init_base:
   56|      2|{
   57|       |    /* no need to init trace */
   58|       |
   59|      2|    OSSL_TRACE(INIT, "ossl_init_base: setting up stop handlers\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   60|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
   61|       |    ossl_malloc_setup_failures();
   62|       |#endif
   63|       |
   64|      2|    if ((optsdone_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (64:9): [True: 0, False: 2]
  ------------------
   65|      2|        || (init_lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (65:12): [True: 0, False: 2]
  ------------------
   66|      0|        goto err;
   67|       |
   68|      2|    OPENSSL_cpuid_setup();
   69|       |
   70|      2|    if (!ossl_init_thread())
  ------------------
  |  Branch (70:9): [True: 0, False: 2]
  ------------------
   71|      0|        goto err;
   72|       |
   73|      2|    if (!CRYPTO_THREAD_init_local(&in_init_config_local, NULL))
  ------------------
  |  Branch (73:9): [True: 0, False: 2]
  ------------------
   74|      0|        goto err;
   75|       |
   76|      2|    base_inited = 1;
   77|      2|    return 1;
   78|       |
   79|      0|err:
   80|      0|    OSSL_TRACE(INIT, "ossl_init_base failed!\n");
  ------------------
  |  |  287|      0|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   81|      0|    CRYPTO_THREAD_lock_free(optsdone_lock);
   82|      0|    optsdone_lock = NULL;
   83|      0|    CRYPTO_THREAD_lock_free(init_lock);
   84|      0|    init_lock = NULL;
   85|       |
   86|      0|    return 0;
   87|      2|}
init.c:ossl_init_register_atexit:
   99|      2|{
  100|       |#ifdef OPENSSL_INIT_DEBUG
  101|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
  102|       |#endif
  103|      2|#ifndef OPENSSL_SYS_UEFI
  104|       |# if defined(_WIN32) && !defined(__BORLANDC__)
  105|       |    /* We use _onexit() in preference because it gets called on DLL unload */
  106|       |    if (_onexit(win32atexit) == NULL)
  107|       |        return 0;
  108|       |# else
  109|      2|    if (atexit(OPENSSL_cleanup) != 0)
  ------------------
  |  Branch (109:9): [True: 0, False: 2]
  ------------------
  110|      0|        return 0;
  111|      2|# endif
  112|      2|#endif
  113|       |
  114|      2|    return 1;
  115|      2|}
init.c:ossl_init_load_crypto_nodelete:
  129|      2|{
  130|      2|    OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  131|       |
  132|       |#if !defined(OPENSSL_USE_NODELETE) \
  133|       |    && !defined(OPENSSL_NO_PINSHARED)
  134|       |# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
  135|       |    {
  136|       |        HMODULE handle = NULL;
  137|       |        BOOL ret;
  138|       |
  139|       |        /* We don't use the DSO route for WIN32 because there is a better way */
  140|       |        ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
  141|       |                                | GET_MODULE_HANDLE_EX_FLAG_PIN,
  142|       |                                (void *)&base_inited, &handle);
  143|       |
  144|       |        OSSL_TRACE1(INIT,
  145|       |                    "ossl_init_load_crypto_nodelete: "
  146|       |                    "obtained DSO reference? %s\n",
  147|       |                    (ret == TRUE ? "No!" : "Yes."));
  148|       |        return (ret == TRUE) ? 1 : 0;
  149|       |    }
  150|       |# elif !defined(DSO_NONE)
  151|       |    /*
  152|       |     * Deliberately leak a reference to ourselves. This will force the library
  153|       |     * to remain loaded until the atexit() handler is run at process exit.
  154|       |     */
  155|       |    {
  156|       |        DSO *dso;
  157|       |        void *err;
  158|       |
  159|       |        if (!err_shelve_state(&err))
  160|       |            return 0;
  161|       |
  162|       |        dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
  163|       |        /*
  164|       |         * In case of No!, it is uncertain our exit()-handlers can still be
  165|       |         * called. After dlclose() the whole library might have been unloaded
  166|       |         * already.
  167|       |         */
  168|       |        OSSL_TRACE1(INIT, "obtained DSO reference? %s\n",
  169|       |                    (dso == NULL ? "No!" : "Yes."));
  170|       |        DSO_free(dso);
  171|       |        err_unshelve_state(err);
  172|       |    }
  173|       |# endif
  174|       |#endif
  175|       |
  176|      2|    return 1;
  177|      2|}
init.c:ossl_init_load_crypto_strings:
  182|      2|{
  183|      2|    int ret = 1;
  184|       |    /*
  185|       |     * OPENSSL_NO_AUTOERRINIT is provided here to prevent at compile time
  186|       |     * pulling in all the error strings during static linking
  187|       |     */
  188|      2|#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
  189|      2|    void *err;
  190|       |
  191|      2|    if (!err_shelve_state(&err))
  ------------------
  |  Branch (191:9): [True: 0, False: 2]
  ------------------
  192|      0|        return 0;
  193|       |
  194|      2|    OSSL_TRACE(INIT, "ossl_err_load_crypto_strings()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  195|      2|    ret = ossl_err_load_crypto_strings();
  196|       |
  197|      2|    err_unshelve_state(err);
  198|      2|#endif
  199|      2|    return ret;
  200|      2|}
init.c:ossl_init_add_all_ciphers:
  211|      2|{
  212|       |    /*
  213|       |     * OPENSSL_NO_AUTOALGINIT is provided here to prevent at compile time
  214|       |     * pulling in all the ciphers during static linking
  215|       |     */
  216|      2|#ifndef OPENSSL_NO_AUTOALGINIT
  217|      2|    OSSL_TRACE(INIT, "openssl_add_all_ciphers_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  218|      2|    openssl_add_all_ciphers_int();
  219|      2|#endif
  220|      2|    return 1;
  221|      2|}
init.c:ossl_init_add_all_digests:
  232|      2|{
  233|       |    /*
  234|       |     * OPENSSL_NO_AUTOALGINIT is provided here to prevent at compile time
  235|       |     * pulling in all the ciphers during static linking
  236|       |     */
  237|      2|#ifndef OPENSSL_NO_AUTOALGINIT
  238|      2|    OSSL_TRACE(INIT, "openssl_add_all_digests()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  239|      2|    openssl_add_all_digests_int();
  240|      2|#endif
  241|      2|    return 1;
  242|      2|}
init.c:ossl_init_config:
  255|      2|{
  256|      2|    int ret = ossl_config_int(NULL);
  257|       |
  258|      2|    config_inited = 1;
  259|      2|    return ret;
  260|      2|}

ossl_init_thread:
  203|      2|{
  204|      2|    if (!CRYPTO_THREAD_init_local(&destructor_key.value,
  ------------------
  |  Branch (204:9): [True: 0, False: 2]
  ------------------
  205|      2|                                  init_thread_destructor))
  206|      0|        return 0;
  207|       |
  208|      2|    return 1;
  209|      2|}
ossl_cleanup_thread:
  212|      2|{
  213|      2|    init_thread_deregister(NULL, 1);
  214|      2|    CRYPTO_THREAD_cleanup_local(&destructor_key.value);
  215|      2|    destructor_key.sane = -1;
  216|      2|}
OPENSSL_thread_stop:
  230|      2|{
  231|      2|    if (destructor_key.sane != -1) {
  ------------------
  |  Branch (231:9): [True: 2, False: 0]
  ------------------
  232|      2|        THREAD_EVENT_HANDLER **hands
  233|      2|            = init_get_thread_local(&destructor_key.value, 0, 0);
  234|      2|        init_thread_stop(NULL, hands);
  235|       |
  236|      2|        init_thread_remove_handlers(hands);
  237|      2|        OPENSSL_free(hands);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  238|      2|    }
  239|      2|}
ossl_ctx_thread_stop:
  242|      2|{
  243|      2|    if (destructor_key.sane != -1) {
  ------------------
  |  Branch (243:9): [True: 2, False: 0]
  ------------------
  244|      2|        THREAD_EVENT_HANDLER **hands
  245|      2|            = init_get_thread_local(&destructor_key.value, 0, 1);
  246|      2|        init_thread_stop(ctx, hands);
  247|      2|    }
  248|      2|}
ossl_init_thread_start:
  348|      3|{
  349|      3|    THREAD_EVENT_HANDLER **hands;
  350|      3|    THREAD_EVENT_HANDLER *hand;
  351|       |#ifdef FIPS_MODULE
  352|       |    OSSL_LIB_CTX *ctx = arg;
  353|       |
  354|       |    /*
  355|       |     * In FIPS mode the list of THREAD_EVENT_HANDLERs is unique per combination
  356|       |     * of OSSL_LIB_CTX and thread. This is because in FIPS mode each
  357|       |     * OSSL_LIB_CTX gets informed about thread stop events individually.
  358|       |     */
  359|       |    CRYPTO_THREAD_LOCAL *local
  360|       |        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX);
  361|       |#else
  362|       |    /*
  363|       |     * Outside of FIPS mode the list of THREAD_EVENT_HANDLERs is unique per
  364|       |     * thread, but may hold multiple OSSL_LIB_CTXs. We only get told about
  365|       |     * thread stop events globally, so we have to ensure all affected
  366|       |     * OSSL_LIB_CTXs are informed.
  367|       |     */
  368|      3|    CRYPTO_THREAD_LOCAL *local = &destructor_key.value;
  369|      3|#endif
  370|       |
  371|      3|    hands = init_get_thread_local(local, 1, 0);
  372|      3|    if (hands == NULL)
  ------------------
  |  Branch (372:9): [True: 0, False: 3]
  ------------------
  373|      0|        return 0;
  374|       |
  375|       |#ifdef FIPS_MODULE
  376|       |    if (*hands == NULL) {
  377|       |        /*
  378|       |         * We've not yet registered any handlers for this thread. We need to get
  379|       |         * libcrypto to tell us about later thread stop events. c_thread_start
  380|       |         * is a callback to libcrypto defined in fipsprov.c
  381|       |         */
  382|       |        if (!c_thread_start(FIPS_get_core_handle(ctx), ossl_arg_thread_stop,
  383|       |                            ctx))
  384|       |            return 0;
  385|       |    }
  386|       |#endif
  387|       |
  388|      3|    hand = OPENSSL_malloc(sizeof(*hand));
  ------------------
  |  |   97|      3|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  389|      3|    if (hand == NULL)
  ------------------
  |  Branch (389:9): [True: 0, False: 3]
  ------------------
  390|      0|        return 0;
  391|       |
  392|      3|    hand->handfn = handfn;
  393|      3|    hand->arg = arg;
  394|      3|#ifndef FIPS_MODULE
  395|      3|    hand->index = index;
  396|      3|#endif
  397|      3|    hand->next = *hands;
  398|      3|    *hands = hand;
  399|       |
  400|      3|    return 1;
  401|      3|}
ossl_init_thread_deregister:
  457|      1|{
  458|      1|    return init_thread_deregister(index, 0);
  459|      1|}
initthread.c:init_get_thread_local:
   95|      7|{
   96|      7|    THREAD_EVENT_HANDLER **hands = CRYPTO_THREAD_get_local(local);
   97|       |
   98|      7|    if (alloc) {
  ------------------
  |  Branch (98:9): [True: 3, False: 4]
  ------------------
   99|      3|        if (hands == NULL) {
  ------------------
  |  Branch (99:13): [True: 2, False: 1]
  ------------------
  100|       |
  101|      2|            if ((hands = OPENSSL_zalloc(sizeof(*hands))) == NULL)
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (101:17): [True: 0, False: 2]
  ------------------
  102|      0|                return NULL;
  103|       |
  104|      2|            if (!CRYPTO_THREAD_set_local(local, hands)) {
  ------------------
  |  Branch (104:17): [True: 0, False: 2]
  ------------------
  105|      0|                OPENSSL_free(hands);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  106|      0|                return NULL;
  107|      0|            }
  108|       |
  109|      2|#ifndef FIPS_MODULE
  110|      2|            if (!init_thread_push_handlers(hands)) {
  ------------------
  |  Branch (110:17): [True: 0, False: 2]
  ------------------
  111|      0|                CRYPTO_THREAD_set_local(local, NULL);
  112|      0|                OPENSSL_free(hands);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  113|      0|                return NULL;
  114|      0|            }
  115|      2|#endif
  116|      2|        }
  117|      4|    } else if (!keep) {
  ------------------
  |  Branch (117:16): [True: 2, False: 2]
  ------------------
  118|      2|        CRYPTO_THREAD_set_local(local, NULL);
  119|      2|    }
  120|       |
  121|      7|    return hands;
  122|      7|}
initthread.c:init_thread_push_handlers:
  155|      2|{
  156|      2|    int ret;
  157|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  158|       |
  159|      2|    gtr = get_global_tevent_register();
  160|      2|    if (gtr == NULL)
  ------------------
  |  Branch (160:9): [True: 0, False: 2]
  ------------------
  161|      0|        return 0;
  162|       |
  163|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (163:9): [True: 0, False: 2]
  ------------------
  164|      0|        return 0;
  165|      2|    ret = (sk_THREAD_EVENT_HANDLER_PTR_push(gtr->skhands, hands) != 0);
  166|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  167|       |
  168|      2|    return ret;
  169|      2|}
initthread.c:get_global_tevent_register:
   78|      9|{
   79|      9|    if (!RUN_ONCE(&tevent_register_runonce, create_global_tevent_register))
  ------------------
  |  |  130|      9|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 9, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (79:9): [True: 0, False: 9]
  ------------------
   80|      0|        return NULL;
   81|      9|    return glob_tevent_reg;
   82|      9|}
initthread.c:create_global_tevent_register:
   59|      2|{
   60|      2|    glob_tevent_reg = OPENSSL_zalloc(sizeof(*glob_tevent_reg));
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|      2|    if (glob_tevent_reg == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 2]
  ------------------
   62|      0|        return 0;
   63|       |
   64|      2|    glob_tevent_reg->skhands = sk_THREAD_EVENT_HANDLER_PTR_new_null();
   65|      2|    glob_tevent_reg->lock = CRYPTO_THREAD_lock_new();
   66|      2|    if (glob_tevent_reg->skhands == NULL || glob_tevent_reg->lock == NULL) {
  ------------------
  |  Branch (66:9): [True: 0, False: 2]
  |  Branch (66:45): [True: 0, False: 2]
  ------------------
   67|      0|        sk_THREAD_EVENT_HANDLER_PTR_free(glob_tevent_reg->skhands);
   68|      0|        CRYPTO_THREAD_lock_free(glob_tevent_reg->lock);
   69|      0|        OPENSSL_free(glob_tevent_reg);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   70|      0|        glob_tevent_reg = NULL;
   71|      0|        return 0;
   72|      0|    }
   73|       |
   74|      2|    return 1;
   75|      2|}
initthread.c:init_thread_remove_handlers:
  172|      2|{
  173|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  174|      2|    int i;
  175|       |
  176|      2|    gtr = get_global_tevent_register();
  177|      2|    if (gtr == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        return;
  179|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (179:9): [True: 0, False: 2]
  ------------------
  180|      0|        return;
  181|      2|    for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
  ------------------
  |  Branch (181:17): [True: 2, False: 0]
  ------------------
  182|      2|        THREAD_EVENT_HANDLER **hands
  183|      2|            = sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
  184|       |
  185|      2|        if (hands == handsin) {
  ------------------
  |  Branch (185:13): [True: 2, False: 0]
  ------------------
  186|      2|            sk_THREAD_EVENT_HANDLER_PTR_delete(gtr->skhands, i);
  187|      2|            CRYPTO_THREAD_unlock(gtr->lock);
  188|      2|            return;
  189|      2|        }
  190|      2|    }
  191|      0|    CRYPTO_THREAD_unlock(gtr->lock);
  192|      0|    return;
  193|      2|}
initthread.c:init_thread_stop:
  304|      4|{
  305|      4|    THREAD_EVENT_HANDLER *curr, *prev = NULL, *tmp;
  306|      4|#ifndef FIPS_MODULE
  307|      4|    GLOBAL_TEVENT_REGISTER *gtr;
  308|      4|#endif
  309|       |
  310|       |    /* Can't do much about this */
  311|      4|    if (hands == NULL)
  ------------------
  |  Branch (311:9): [True: 2, False: 2]
  ------------------
  312|      2|        return;
  313|       |
  314|      2|#ifndef FIPS_MODULE
  315|      2|    gtr = get_global_tevent_register();
  316|      2|    if (gtr == NULL)
  ------------------
  |  Branch (316:9): [True: 0, False: 2]
  ------------------
  317|      0|        return;
  318|       |
  319|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (319:9): [True: 0, False: 2]
  ------------------
  320|      0|        return;
  321|      2|#endif
  322|       |
  323|      2|    curr = *hands;
  324|      5|    while (curr != NULL) {
  ------------------
  |  Branch (324:12): [True: 3, False: 2]
  ------------------
  325|      3|        if (arg != NULL && curr->arg != arg) {
  ------------------
  |  Branch (325:13): [True: 0, False: 3]
  |  Branch (325:28): [True: 0, False: 0]
  ------------------
  326|      0|            prev = curr;
  327|      0|            curr = curr->next;
  328|      0|            continue;
  329|      0|        }
  330|      3|        curr->handfn(curr->arg);
  331|      3|        if (prev == NULL)
  ------------------
  |  Branch (331:13): [True: 3, False: 0]
  ------------------
  332|      3|            *hands = curr->next;
  333|      0|        else
  334|      0|            prev->next = curr->next;
  335|       |
  336|      3|        tmp = curr;
  337|      3|        curr = curr->next;
  338|       |
  339|      3|        OPENSSL_free(tmp);
  ------------------
  |  |  107|      3|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  340|      3|    }
  341|      2|#ifndef FIPS_MODULE
  342|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  343|      2|#endif
  344|      2|}
initthread.c:init_thread_deregister:
  405|      3|{
  406|      3|    GLOBAL_TEVENT_REGISTER *gtr;
  407|      3|    int i;
  408|       |
  409|      3|    gtr = get_global_tevent_register();
  410|      3|    if (gtr == NULL)
  ------------------
  |  Branch (410:9): [True: 0, False: 3]
  ------------------
  411|      0|        return 0;
  412|      3|    if (!all) {
  ------------------
  |  Branch (412:9): [True: 1, False: 2]
  ------------------
  413|      1|        if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (413:13): [True: 0, False: 1]
  ------------------
  414|      0|            return 0;
  415|      2|    } else {
  416|      2|        glob_tevent_reg = NULL;
  417|      2|    }
  418|      3|    for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
  ------------------
  |  Branch (418:17): [True: 0, False: 3]
  ------------------
  419|      0|        THREAD_EVENT_HANDLER **hands
  420|      0|            = sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
  421|      0|        THREAD_EVENT_HANDLER *curr = NULL, *prev = NULL, *tmp;
  422|       |
  423|      0|        if (hands == NULL) {
  ------------------
  |  Branch (423:13): [True: 0, False: 0]
  ------------------
  424|      0|            if (!all)
  ------------------
  |  Branch (424:17): [True: 0, False: 0]
  ------------------
  425|      0|                CRYPTO_THREAD_unlock(gtr->lock);
  426|      0|            return 0;
  427|      0|        }
  428|      0|        curr = *hands;
  429|      0|        while (curr != NULL) {
  ------------------
  |  Branch (429:16): [True: 0, False: 0]
  ------------------
  430|      0|            if (all || curr->index == index) {
  ------------------
  |  Branch (430:17): [True: 0, False: 0]
  |  Branch (430:24): [True: 0, False: 0]
  ------------------
  431|      0|                if (prev != NULL)
  ------------------
  |  Branch (431:21): [True: 0, False: 0]
  ------------------
  432|      0|                    prev->next = curr->next;
  433|      0|                else
  434|      0|                    *hands = curr->next;
  435|      0|                tmp = curr;
  436|      0|                curr = curr->next;
  437|      0|                OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  438|      0|                continue;
  439|      0|            }
  440|      0|            prev = curr;
  441|      0|            curr = curr->next;
  442|      0|        }
  443|      0|        if (all)
  ------------------
  |  Branch (443:13): [True: 0, False: 0]
  ------------------
  444|      0|            OPENSSL_free(hands);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  445|      0|    }
  446|      3|    if (all) {
  ------------------
  |  Branch (446:9): [True: 2, False: 1]
  ------------------
  447|      2|        CRYPTO_THREAD_lock_free(gtr->lock);
  448|      2|        sk_THREAD_EVENT_HANDLER_PTR_free(gtr->skhands);
  449|      2|        OPENSSL_free(gtr);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  450|      2|    } else {
  451|      1|        CRYPTO_THREAD_unlock(gtr->lock);
  452|      1|    }
  453|      3|    return 1;
  454|      3|}

OPENSSL_LH_new:
   48|     98|{
   49|     98|    OPENSSL_LHASH *ret;
   50|       |
   51|     98|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|     98|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     98|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     98|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (51:9): [True: 0, False: 98]
  ------------------
   52|      0|        return NULL;
   53|     98|    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
  ------------------
  |  |   99|     98|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     98|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     98|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (53:9): [True: 0, False: 98]
  ------------------
   54|      0|        goto err;
   55|     98|    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
  ------------------
  |  Branch (55:18): [True: 0, False: 98]
  ------------------
   56|     98|    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
  ------------------
  |  Branch (56:18): [True: 0, False: 98]
  ------------------
   57|     98|    ret->num_nodes = MIN_NODES / 2;
  ------------------
  |  |   39|     98|#define MIN_NODES       16
  ------------------
   58|     98|    ret->num_alloc_nodes = MIN_NODES;
  ------------------
  |  |   39|     98|#define MIN_NODES       16
  ------------------
   59|     98|    ret->pmax = MIN_NODES / 2;
  ------------------
  |  |   39|     98|#define MIN_NODES       16
  ------------------
   60|     98|    ret->up_load = UP_LOAD;
  ------------------
  |  |   40|     98|#define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
  |  |  ------------------
  |  |  |  |   81|     98|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   61|     98|    ret->down_load = DOWN_LOAD;
  ------------------
  |  |   41|     98|#define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
  |  |  ------------------
  |  |  |  |   81|     98|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   62|     98|    return ret;
   63|       |
   64|      0|err:
   65|      0|    OPENSSL_free(ret->b);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   66|      0|    OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   67|      0|    return NULL;
   68|     98|}
OPENSSL_LH_free:
   71|     90|{
   72|     90|    if (lh == NULL)
  ------------------
  |  Branch (72:9): [True: 2, False: 88]
  ------------------
   73|      2|        return;
   74|       |
   75|     88|    OPENSSL_LH_flush(lh);
   76|     88|    OPENSSL_free(lh->b);
  ------------------
  |  |  107|     88|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     88|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     88|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|     88|    OPENSSL_free(lh);
  ------------------
  |  |  107|     88|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     88|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     88|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   78|     88|}
OPENSSL_LH_flush:
   81|    222|{
   82|    222|    unsigned int i;
   83|    222|    OPENSSL_LH_NODE *n, *nn;
   84|       |
   85|    222|    if (lh == NULL)
  ------------------
  |  Branch (85:9): [True: 0, False: 222]
  ------------------
   86|      0|        return;
   87|       |
   88|  4.30k|    for (i = 0; i < lh->num_nodes; i++) {
  ------------------
  |  Branch (88:17): [True: 4.08k, False: 222]
  ------------------
   89|  4.08k|        n = lh->b[i];
   90|  8.36k|        while (n != NULL) {
  ------------------
  |  Branch (90:16): [True: 4.27k, False: 4.08k]
  ------------------
   91|  4.27k|            nn = n->next;
   92|  4.27k|            OPENSSL_free(n);
  ------------------
  |  |  107|  4.27k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  4.27k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  4.27k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|  4.27k|            n = nn;
   94|  4.27k|        }
   95|  4.08k|        lh->b[i] = NULL;
   96|  4.08k|    }
   97|       |
   98|    222|    lh->num_items = 0;
   99|    222|}
OPENSSL_LH_insert:
  102|  10.8k|{
  103|  10.8k|    unsigned long hash;
  104|  10.8k|    OPENSSL_LH_NODE *nn, **rn;
  105|  10.8k|    void *ret;
  106|       |
  107|  10.8k|    lh->error = 0;
  108|  10.8k|    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
  ------------------
  |  |   81|  10.8k|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (108:9): [True: 2.31k, False: 8.57k]
  |  Branch (108:76): [True: 0, False: 2.31k]
  ------------------
  109|      0|        return NULL;        /* 'lh->error++' already done in 'expand' */
  110|       |
  111|  10.8k|    rn = getrn(lh, data, &hash);
  112|       |
  113|  10.8k|    if (*rn == NULL) {
  ------------------
  |  Branch (113:9): [True: 4.77k, False: 6.10k]
  ------------------
  114|  4.77k|        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
  ------------------
  |  |   97|  4.77k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  4.77k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  4.77k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (114:13): [True: 0, False: 4.77k]
  ------------------
  115|      0|            lh->error++;
  116|      0|            return NULL;
  117|      0|        }
  118|  4.77k|        nn->data = data;
  119|  4.77k|        nn->next = NULL;
  120|  4.77k|        nn->hash = hash;
  121|  4.77k|        *rn = nn;
  122|  4.77k|        ret = NULL;
  123|  4.77k|        lh->num_items++;
  124|  6.10k|    } else {                    /* replace same key */
  125|  6.10k|        ret = (*rn)->data;
  126|  6.10k|        (*rn)->data = data;
  127|  6.10k|    }
  128|  10.8k|    return ret;
  129|  10.8k|}
OPENSSL_LH_delete:
  132|    484|{
  133|    484|    unsigned long hash;
  134|    484|    OPENSSL_LH_NODE *nn, **rn;
  135|    484|    void *ret;
  136|       |
  137|    484|    lh->error = 0;
  138|    484|    rn = getrn(lh, data, &hash);
  139|       |
  140|    484|    if (*rn == NULL) {
  ------------------
  |  Branch (140:9): [True: 0, False: 484]
  ------------------
  141|      0|        return NULL;
  142|    484|    } else {
  143|    484|        nn = *rn;
  144|    484|        *rn = nn->next;
  145|    484|        ret = nn->data;
  146|    484|        OPENSSL_free(nn);
  ------------------
  |  |  107|    484|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    484|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    484|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  147|    484|    }
  148|       |
  149|    484|    lh->num_items--;
  150|    484|    if ((lh->num_nodes > MIN_NODES) &&
  ------------------
  |  |   39|    484|#define MIN_NODES       16
  ------------------
  |  Branch (150:9): [True: 484, False: 0]
  ------------------
  151|    484|        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
  ------------------
  |  |   81|    484|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (151:9): [True: 2, False: 482]
  ------------------
  152|      2|        contract(lh);
  153|       |
  154|    484|    return ret;
  155|    484|}
OPENSSL_LH_retrieve:
  158|   343k|{
  159|   343k|    unsigned long hash;
  160|   343k|    OPENSSL_LH_NODE **rn;
  161|       |
  162|   343k|    if (lh->error != 0)
  ------------------
  |  Branch (162:9): [True: 0, False: 343k]
  ------------------
  163|      0|        lh->error = 0;
  164|       |
  165|   343k|    rn = getrn(lh, data, &hash);
  166|       |
  167|   343k|    return *rn == NULL ? NULL : (*rn)->data;
  ------------------
  |  Branch (167:12): [True: 16.0k, False: 327k]
  ------------------
  168|   343k|}
OPENSSL_LH_doall:
  198|    226|{
  199|    226|    doall_util_fn(lh, 0, func, (OPENSSL_LH_DOALL_FUNCARG)0, NULL);
  200|    226|}
OPENSSL_LH_doall_arg:
  203|  18.1k|{
  204|  18.1k|    doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
  205|  18.1k|}
OPENSSL_LH_strhash:
  318|  79.4k|{
  319|  79.4k|    unsigned long ret = 0;
  320|  79.4k|    long n;
  321|  79.4k|    unsigned long v;
  322|  79.4k|    int r;
  323|       |
  324|  79.4k|    if ((c == NULL) || (*c == '\0'))
  ------------------
  |  Branch (324:9): [True: 0, False: 79.4k]
  |  Branch (324:24): [True: 7.34k, False: 72.0k]
  ------------------
  325|  7.34k|        return ret;
  326|       |
  327|  72.0k|    n = 0x100;
  328|   623k|    while (*c) {
  ------------------
  |  Branch (328:12): [True: 551k, False: 72.0k]
  ------------------
  329|   551k|        v = n | (*c);
  330|   551k|        n += 0x100;
  331|   551k|        r = (int)((v >> 2) ^ v) & 0x0f;
  332|       |        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
  333|   551k|        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
  334|   551k|        ret &= 0xFFFFFFFFL;
  335|   551k|        ret ^= v * v;
  336|   551k|        c++;
  337|   551k|    }
  338|  72.0k|    return (ret >> 16) ^ ret;
  339|  79.4k|}
ossl_lh_strcasehash:
  356|   347k|{
  357|   347k|    unsigned long ret = 0;
  358|   347k|    long n;
  359|   347k|    unsigned long v;
  360|   347k|    int r;
  361|       |#if defined(CHARSET_EBCDIC) && !defined(CHARSET_EBCDIC_TEST)
  362|       |    const long int case_adjust = ~0x40;
  363|       |#else
  364|   347k|    const long int case_adjust = ~0x20;
  365|   347k|#endif
  366|       |
  367|   347k|    if (c == NULL || *c == '\0')
  ------------------
  |  Branch (367:9): [True: 0, False: 347k]
  |  Branch (367:22): [True: 0, False: 347k]
  ------------------
  368|      0|        return ret;
  369|       |
  370|  3.38M|    for (n = 0x100; *c != '\0'; n += 0x100) {
  ------------------
  |  Branch (370:21): [True: 3.03M, False: 347k]
  ------------------
  371|  3.03M|        v = n | (case_adjust & *c);
  372|  3.03M|        r = (int)((v >> 2) ^ v) & 0x0f;
  373|       |        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
  374|  3.03M|        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
  375|  3.03M|        ret &= 0xFFFFFFFFL;
  376|  3.03M|        ret ^= v * v;
  377|  3.03M|        c++;
  378|  3.03M|    }
  379|   347k|    return (ret >> 16) ^ ret;
  380|   347k|}
OPENSSL_LH_num_items:
  383|  18.2k|{
  384|  18.2k|    return lh ? lh->num_items : 0;
  ------------------
  |  Branch (384:12): [True: 18.2k, False: 0]
  ------------------
  385|  18.2k|}
OPENSSL_LH_get_down_load:
  388|      8|{
  389|      8|    return lh->down_load;
  390|      8|}
OPENSSL_LH_set_down_load:
  393|     14|{
  394|     14|    lh->down_load = down_load;
  395|     14|}
OPENSSL_LH_error:
  398|  1.17k|{
  399|  1.17k|    return lh->error;
  400|  1.17k|}
lhash.c:doall_util_fn:
  173|  18.3k|{
  174|  18.3k|    int i;
  175|  18.3k|    OPENSSL_LH_NODE *a, *n;
  176|       |
  177|  18.3k|    if (lh == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 18.3k]
  ------------------
  178|      0|        return;
  179|       |
  180|       |    /*
  181|       |     * reverse the order so we search from 'top to bottom' We were having
  182|       |     * memory leaks otherwise
  183|       |     */
  184|  2.82M|    for (i = lh->num_nodes - 1; i >= 0; i--) {
  ------------------
  |  Branch (184:33): [True: 2.80M, False: 18.3k]
  ------------------
  185|  2.80M|        a = lh->b[i];
  186|  8.40M|        while (a != NULL) {
  ------------------
  |  Branch (186:16): [True: 5.60M, False: 2.80M]
  ------------------
  187|  5.60M|            n = a->next;
  188|  5.60M|            if (use_arg)
  ------------------
  |  Branch (188:17): [True: 5.59M, False: 1.76k]
  ------------------
  189|  5.59M|                func_arg(a->data, arg);
  190|  1.76k|            else
  191|  1.76k|                func(a->data);
  192|  5.60M|            a = n;
  193|  5.60M|        }
  194|  2.80M|    }
  195|  18.3k|}
lhash.c:expand:
  208|  2.31k|{
  209|  2.31k|    OPENSSL_LH_NODE **n, **n1, **n2, *np;
  210|  2.31k|    unsigned int p, pmax, nni, j;
  211|  2.31k|    unsigned long hash;
  212|       |
  213|  2.31k|    nni = lh->num_alloc_nodes;
  214|  2.31k|    p = lh->p;
  215|  2.31k|    pmax = lh->pmax;
  216|  2.31k|    if (p + 1 >= pmax) {
  ------------------
  |  Branch (216:9): [True: 27, False: 2.28k]
  ------------------
  217|     27|        j = nni * 2;
  218|     27|        n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
  ------------------
  |  |  101|     27|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     27|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     27|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  219|     27|        if (n == NULL) {
  ------------------
  |  Branch (219:13): [True: 0, False: 27]
  ------------------
  220|      0|            lh->error++;
  221|      0|            return 0;
  222|      0|        }
  223|     27|        lh->b = n;
  224|     27|        memset(n + nni, 0, sizeof(*n) * (j - nni));
  225|     27|        lh->pmax = nni;
  226|     27|        lh->num_alloc_nodes = j;
  227|     27|        lh->p = 0;
  228|  2.28k|    } else {
  229|  2.28k|        lh->p++;
  230|  2.28k|    }
  231|       |
  232|  2.31k|    lh->num_nodes++;
  233|  2.31k|    n1 = &(lh->b[p]);
  234|  2.31k|    n2 = &(lh->b[p + pmax]);
  235|  2.31k|    *n2 = NULL;
  236|       |
  237|  9.54k|    for (np = *n1; np != NULL;) {
  ------------------
  |  Branch (237:20): [True: 7.22k, False: 2.31k]
  ------------------
  238|  7.22k|        hash = np->hash;
  239|  7.22k|        if ((hash % nni) != p) { /* move it */
  ------------------
  |  Branch (239:13): [True: 1.55k, False: 5.67k]
  ------------------
  240|  1.55k|            *n1 = (*n1)->next;
  241|  1.55k|            np->next = *n2;
  242|  1.55k|            *n2 = np;
  243|  1.55k|        } else
  244|  5.67k|            n1 = &((*n1)->next);
  245|  7.22k|        np = *n1;
  246|  7.22k|    }
  247|       |
  248|  2.31k|    return 1;
  249|  2.31k|}
lhash.c:contract:
  252|      2|{
  253|      2|    OPENSSL_LH_NODE **n, *n1, *np;
  254|       |
  255|      2|    np = lh->b[lh->p + lh->pmax - 1];
  256|      2|    lh->b[lh->p + lh->pmax - 1] = NULL; /* 24/07-92 - eay - weird but :-( */
  257|      2|    if (lh->p == 0) {
  ------------------
  |  Branch (257:9): [True: 0, False: 2]
  ------------------
  258|      0|        n = OPENSSL_realloc(lh->b,
  ------------------
  |  |  101|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  259|      0|                            (unsigned int)(sizeof(OPENSSL_LH_NODE *) * lh->pmax));
  260|      0|        if (n == NULL) {
  ------------------
  |  Branch (260:13): [True: 0, False: 0]
  ------------------
  261|       |            /* fputs("realloc error in lhash", stderr); */
  262|      0|            lh->error++;
  263|      0|        } else {
  264|      0|            lh->b = n;
  265|      0|        }
  266|      0|        lh->num_alloc_nodes /= 2;
  267|      0|        lh->pmax /= 2;
  268|      0|        lh->p = lh->pmax - 1;
  269|      0|    } else
  270|      2|        lh->p--;
  271|       |
  272|      2|    lh->num_nodes--;
  273|       |
  274|      2|    n1 = lh->b[(int)lh->p];
  275|      2|    if (n1 == NULL)
  ------------------
  |  Branch (275:9): [True: 2, False: 0]
  ------------------
  276|      2|        lh->b[(int)lh->p] = np;
  277|      0|    else {
  278|      0|        while (n1->next != NULL)
  ------------------
  |  Branch (278:16): [True: 0, False: 0]
  ------------------
  279|      0|            n1 = n1->next;
  280|      0|        n1->next = np;
  281|      0|    }
  282|      2|}
lhash.c:getrn:
  286|   355k|{
  287|   355k|    OPENSSL_LH_NODE **ret, *n1;
  288|   355k|    unsigned long hash, nn;
  289|   355k|    OPENSSL_LH_COMPFUNC cf;
  290|       |
  291|   355k|    hash = (*(lh->hash)) (data);
  292|   355k|    *rhash = hash;
  293|       |
  294|   355k|    nn = hash % lh->pmax;
  295|   355k|    if (nn < lh->p)
  ------------------
  |  Branch (295:9): [True: 37.0k, False: 318k]
  ------------------
  296|  37.0k|        nn = hash % lh->num_alloc_nodes;
  297|       |
  298|   355k|    cf = lh->comp;
  299|   355k|    ret = &(lh->b[(int)nn]);
  300|   804k|    for (n1 = *ret; n1 != NULL; n1 = n1->next) {
  ------------------
  |  Branch (300:21): [True: 783k, False: 20.8k]
  ------------------
  301|   783k|        if (n1->hash != hash) {
  ------------------
  |  Branch (301:13): [True: 448k, False: 334k]
  ------------------
  302|   448k|            ret = &(n1->next);
  303|   448k|            continue;
  304|   448k|        }
  305|   334k|        if (cf(n1->data, data) == 0)
  ------------------
  |  Branch (305:13): [True: 334k, False: 392]
  ------------------
  306|   334k|            break;
  307|    392|        ret = &(n1->next);
  308|    392|    }
  309|   355k|    return ret;
  310|   355k|}

CRYPTO_malloc:
  172|  75.4M|{
  173|  75.4M|    void *ptr;
  174|       |
  175|  75.4M|    INCREMENT(malloc_count);
  176|  75.4M|    if (malloc_impl != CRYPTO_malloc) {
  ------------------
  |  Branch (176:9): [True: 0, False: 75.4M]
  ------------------
  177|      0|        ptr = malloc_impl(num, file, line);
  178|      0|        if (ptr != NULL || num == 0)
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  |  Branch (178:28): [True: 0, False: 0]
  ------------------
  179|      0|            return ptr;
  180|      0|        goto err;
  181|      0|    }
  182|       |
  183|  75.4M|    if (num == 0)
  ------------------
  |  Branch (183:9): [True: 0, False: 75.4M]
  ------------------
  184|      0|        return NULL;
  185|       |
  186|  75.4M|    FAILTEST();
  187|  75.4M|    if (allow_customize) {
  ------------------
  |  Branch (187:9): [True: 2, False: 75.4M]
  ------------------
  188|       |        /*
  189|       |         * Disallow customization after the first allocation. We only set this
  190|       |         * if necessary to avoid a store to the same cache line on every
  191|       |         * allocation.
  192|       |         */
  193|      2|        allow_customize = 0;
  194|      2|    }
  195|       |
  196|  75.4M|    ptr = malloc(num);
  197|  75.4M|    if (ptr != NULL)
  ------------------
  |  Branch (197:9): [True: 75.4M, False: 0]
  ------------------
  198|  75.4M|        return ptr;
  199|      0| err:
  200|       |    /*
  201|       |     * ossl_err_get_state_int() in err.c uses CRYPTO_zalloc(num, NULL, 0) for
  202|       |     * ERR_STATE allocation. Prevent mem alloc error loop while reporting error.
  203|       |     */
  204|      0|    if (file != NULL || line != 0) {
  ------------------
  |  Branch (204:9): [True: 0, False: 0]
  |  Branch (204:25): [True: 0, False: 0]
  ------------------
  205|      0|        ERR_new();
  206|      0|        ERR_set_debug(file, line, NULL);
  207|      0|        ERR_set_error(ERR_LIB_CRYPTO, ERR_R_MALLOC_FAILURE, NULL);
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                      ERR_set_error(ERR_LIB_CRYPTO, ERR_R_MALLOC_FAILURE, NULL);
  ------------------
  |  |  351|      0|# define ERR_R_MALLOC_FAILURE                    (256|ERR_R_FATAL)
  |  |  ------------------
  |  |  |  |  350|      0|# define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  236|      0|# define ERR_RFLAG_FATAL                (0x1 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  208|      0|    }
  209|      0|    return NULL;
  210|  75.4M|}
CRYPTO_zalloc:
  213|  35.4M|{
  214|  35.4M|    void *ret;
  215|       |
  216|  35.4M|    ret = CRYPTO_malloc(num, file, line);
  217|  35.4M|    if (ret != NULL)
  ------------------
  |  Branch (217:9): [True: 35.4M, False: 0]
  ------------------
  218|  35.4M|        memset(ret, 0, num);
  219|       |
  220|  35.4M|    return ret;
  221|  35.4M|}
CRYPTO_realloc:
  224|  4.02M|{
  225|  4.02M|    INCREMENT(realloc_count);
  226|  4.02M|    if (realloc_impl != CRYPTO_realloc)
  ------------------
  |  Branch (226:9): [True: 0, False: 4.02M]
  ------------------
  227|      0|        return realloc_impl(str, num, file, line);
  228|       |
  229|  4.02M|    if (str == NULL)
  ------------------
  |  Branch (229:9): [True: 3.90M, False: 115k]
  ------------------
  230|  3.90M|        return CRYPTO_malloc(num, file, line);
  231|       |
  232|   115k|    if (num == 0) {
  ------------------
  |  Branch (232:9): [True: 0, False: 115k]
  ------------------
  233|      0|        CRYPTO_free(str, file, line);
  234|      0|        return NULL;
  235|      0|    }
  236|       |
  237|   115k|    FAILTEST();
  238|   115k|    return realloc(str, num);
  239|   115k|}
CRYPTO_clear_realloc:
  243|  1.26M|{
  244|  1.26M|    void *ret = NULL;
  245|       |
  246|  1.26M|    if (str == NULL)
  ------------------
  |  Branch (246:9): [True: 289k, False: 972k]
  ------------------
  247|   289k|        return CRYPTO_malloc(num, file, line);
  248|       |
  249|   972k|    if (num == 0) {
  ------------------
  |  Branch (249:9): [True: 0, False: 972k]
  ------------------
  250|      0|        CRYPTO_clear_free(str, old_len, file, line);
  251|      0|        return NULL;
  252|      0|    }
  253|       |
  254|       |    /* Can't shrink the buffer since memcpy below copies |old_len| bytes. */
  255|   972k|    if (num < old_len) {
  ------------------
  |  Branch (255:9): [True: 0, False: 972k]
  ------------------
  256|      0|        OPENSSL_cleanse((char*)str + num, old_len - num);
  257|      0|        return str;
  258|      0|    }
  259|       |
  260|   972k|    ret = CRYPTO_malloc(num, file, line);
  261|   972k|    if (ret != NULL) {
  ------------------
  |  Branch (261:9): [True: 972k, False: 0]
  ------------------
  262|   972k|        memcpy(ret, str, old_len);
  263|   972k|        CRYPTO_clear_free(str, old_len, file, line);
  264|   972k|    }
  265|   972k|    return ret;
  266|   972k|}
CRYPTO_free:
  269|   139M|{
  270|   139M|    INCREMENT(free_count);
  271|   139M|    if (free_impl != CRYPTO_free) {
  ------------------
  |  Branch (271:9): [True: 0, False: 139M]
  ------------------
  272|      0|        free_impl(str, file, line);
  273|      0|        return;
  274|      0|    }
  275|       |
  276|   139M|    free(str);
  277|   139M|}
CRYPTO_clear_free:
  280|  2.47M|{
  281|  2.47M|    if (str == NULL)
  ------------------
  |  Branch (281:9): [True: 131k, False: 2.34M]
  ------------------
  282|   131k|        return;
  283|  2.34M|    if (num)
  ------------------
  |  Branch (283:9): [True: 2.34M, False: 0]
  ------------------
  284|  2.34M|        OPENSSL_cleanse(str, num);
  285|  2.34M|    CRYPTO_free(str, file, line);
  286|  2.34M|}

CRYPTO_secure_malloc_done:
  132|      2|{
  133|      2|#ifndef OPENSSL_NO_SECURE_MEMORY
  134|      2|    if (secure_mem_used == 0) {
  ------------------
  |  Branch (134:9): [True: 2, False: 0]
  ------------------
  135|      2|        sh_done();
  136|      2|        secure_mem_initialized = 0;
  137|      2|        CRYPTO_THREAD_lock_free(sec_malloc_lock);
  138|      2|        sec_malloc_lock = NULL;
  139|      2|        return 1;
  140|      2|    }
  141|      0|#endif /* OPENSSL_NO_SECURE_MEMORY */
  142|      0|    return 0;
  143|      2|}
CRYPTO_secure_zalloc:
  185|   117k|{
  186|   117k|#ifndef OPENSSL_NO_SECURE_MEMORY
  187|   117k|    if (secure_mem_initialized)
  ------------------
  |  Branch (187:9): [True: 0, False: 117k]
  ------------------
  188|       |        /* CRYPTO_secure_malloc() zeroes allocations when it is implemented */
  189|      0|        return CRYPTO_secure_malloc(num, file, line);
  190|   117k|#endif
  191|   117k|    return CRYPTO_zalloc(num, file, line);
  192|   117k|}
CRYPTO_secure_clear_free:
  219|   117k|{
  220|   117k|#ifndef OPENSSL_NO_SECURE_MEMORY
  221|   117k|    size_t actual_size;
  222|       |
  223|   117k|    if (ptr == NULL)
  ------------------
  |  Branch (223:9): [True: 11, False: 117k]
  ------------------
  224|     11|        return;
  225|   117k|    if (!CRYPTO_secure_allocated(ptr)) {
  ------------------
  |  Branch (225:9): [True: 117k, False: 0]
  ------------------
  226|   117k|        OPENSSL_cleanse(ptr, num);
  227|   117k|        CRYPTO_free(ptr, file, line);
  228|   117k|        return;
  229|   117k|    }
  230|      0|    if (!CRYPTO_THREAD_write_lock(sec_malloc_lock))
  ------------------
  |  Branch (230:9): [True: 0, False: 0]
  ------------------
  231|      0|        return;
  232|      0|    actual_size = sh_actual_size(ptr);
  233|      0|    CLEAR(ptr, actual_size);
  ------------------
  |  |   82|      0|#define CLEAR(p, s) OPENSSL_cleanse(p, s)
  ------------------
  234|      0|    secure_mem_used -= actual_size;
  235|      0|    sh_free(ptr);
  236|      0|    CRYPTO_THREAD_unlock(sec_malloc_lock);
  237|       |#else
  238|       |    if (ptr == NULL)
  239|       |        return;
  240|       |    OPENSSL_cleanse(ptr, num);
  241|       |    CRYPTO_free(ptr, file, line);
  242|       |#endif /* OPENSSL_NO_SECURE_MEMORY */
  243|      0|}
CRYPTO_secure_allocated:
  246|   117k|{
  247|   117k|#ifndef OPENSSL_NO_SECURE_MEMORY
  248|   117k|    if (!secure_mem_initialized)
  ------------------
  |  Branch (248:9): [True: 117k, False: 0]
  ------------------
  249|   117k|        return 0;
  250|       |    /*
  251|       |     * Only read accesses to the arena take place in sh_allocated() and this
  252|       |     * is only changed by the sh_init() and sh_done() calls which are not
  253|       |     * locked.  Hence, it is safe to make this check without a lock too.
  254|       |     */
  255|      0|    return sh_allocated(ptr);
  256|       |#else
  257|       |    return 0;
  258|       |#endif /* OPENSSL_NO_SECURE_MEMORY */
  259|   117k|}
mem_sec.c:sh_done:
  595|      2|{
  596|      2|    OPENSSL_free(sh.freelist);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  597|      2|    OPENSSL_free(sh.bittable);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  598|      2|    OPENSSL_free(sh.bitmalloc);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  599|      2|#if !defined(_WIN32)
  600|      2|    if (sh.map_result != MAP_FAILED && sh.map_size)
  ------------------
  |  Branch (600:9): [True: 2, False: 0]
  |  Branch (600:40): [True: 0, False: 2]
  ------------------
  601|      0|        munmap(sh.map_result, sh.map_size);
  602|       |#else
  603|       |    if (sh.map_result != NULL && sh.map_size)
  604|       |        VirtualFree(sh.map_result, 0, MEM_RELEASE);
  605|       |#endif
  606|      2|    memset(&sh, 0, sizeof(sh));
  607|      2|}

openssl_fopen:
   39|      2|{
   40|      2|    FILE *file = NULL;
   41|       |# if defined(_WIN32) && defined(CP_UTF8)
   42|       |    int sz, len_0 = (int)strlen(filename) + 1;
   43|       |    DWORD flags;
   44|       |
   45|       |    /*
   46|       |     * Basically there are three cases to cover: a) filename is
   47|       |     * pure ASCII string; b) actual UTF-8 encoded string and
   48|       |     * c) locale-ized string, i.e. one containing 8-bit
   49|       |     * characters that are meaningful in current system locale.
   50|       |     * If filename is pure ASCII or real UTF-8 encoded string,
   51|       |     * MultiByteToWideChar succeeds and _wfopen works. If
   52|       |     * filename is locale-ized string, chances are that
   53|       |     * MultiByteToWideChar fails reporting
   54|       |     * ERROR_NO_UNICODE_TRANSLATION, in which case we fall
   55|       |     * back to fopen...
   56|       |     */
   57|       |    if ((sz = MultiByteToWideChar(CP_UTF8, (flags = MB_ERR_INVALID_CHARS),
   58|       |                                  filename, len_0, NULL, 0)) > 0 ||
   59|       |        (GetLastError() == ERROR_INVALID_FLAGS &&
   60|       |         (sz = MultiByteToWideChar(CP_UTF8, (flags = 0),
   61|       |                                   filename, len_0, NULL, 0)) > 0)
   62|       |        ) {
   63|       |        WCHAR wmode[8];
   64|       |        WCHAR *wfilename = _alloca(sz * sizeof(WCHAR));
   65|       |
   66|       |        if (MultiByteToWideChar(CP_UTF8, flags,
   67|       |                                filename, len_0, wfilename, sz) &&
   68|       |            MultiByteToWideChar(CP_UTF8, 0, mode, strlen(mode) + 1,
   69|       |                                wmode, OSSL_NELEM(wmode)) &&
   70|       |            (file = _wfopen(wfilename, wmode)) == NULL &&
   71|       |            (errno == ENOENT || errno == EBADF)
   72|       |            ) {
   73|       |            /*
   74|       |             * UTF-8 decode succeeded, but no file, filename
   75|       |             * could still have been locale-ized...
   76|       |             */
   77|       |            file = fopen(filename, mode);
   78|       |        }
   79|       |    } else if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) {
   80|       |        file = fopen(filename, mode);
   81|       |    }
   82|       |# elif defined(__DJGPP__)
   83|       |    {
   84|       |        char *newname = NULL;
   85|       |
   86|       |        if (pathconf(filename, _PC_NAME_MAX) <= 12) {  /* 8.3 file system? */
   87|       |            char *iterator;
   88|       |            char lastchar;
   89|       |
   90|       |            if ((newname = OPENSSL_malloc(strlen(filename) + 1)) == NULL)
   91|       |                return NULL;
   92|       |
   93|       |            for (iterator = newname, lastchar = '\0';
   94|       |                *filename; filename++, iterator++) {
   95|       |                if (lastchar == '/' && filename[0] == '.'
   96|       |                    && filename[1] != '.' && filename[1] != '/') {
   97|       |                    /* Leading dots are not permitted in plain DOS. */
   98|       |                    *iterator = '_';
   99|       |                } else {
  100|       |                    *iterator = *filename;
  101|       |                }
  102|       |                lastchar = *filename;
  103|       |            }
  104|       |            *iterator = '\0';
  105|       |            filename = newname;
  106|       |        }
  107|       |        file = fopen(filename, mode);
  108|       |
  109|       |        OPENSSL_free(newname);
  110|       |    }
  111|       |# else
  112|      2|    file = fopen(filename, mode);
  113|      2|# endif
  114|      2|    return file;
  115|      2|}

CRYPTO_strdup:
   22|  8.43M|{
   23|  8.43M|    char *ret;
   24|       |
   25|  8.43M|    if (str == NULL)
  ------------------
  |  Branch (25:9): [True: 0, False: 8.43M]
  ------------------
   26|      0|        return NULL;
   27|  8.43M|    ret = CRYPTO_malloc(strlen(str) + 1, file, line);
   28|  8.43M|    if (ret != NULL)
  ------------------
  |  Branch (28:9): [True: 8.43M, False: 0]
  ------------------
   29|  8.43M|        strcpy(ret, str);
   30|  8.43M|    return ret;
   31|  8.43M|}
CRYPTO_strndup:
   34|  2.96k|{
   35|  2.96k|    size_t maxlen;
   36|  2.96k|    char *ret;
   37|       |
   38|  2.96k|    if (str == NULL)
  ------------------
  |  Branch (38:9): [True: 0, False: 2.96k]
  ------------------
   39|      0|        return NULL;
   40|       |
   41|  2.96k|    maxlen = OPENSSL_strnlen(str, s);
   42|       |
   43|  2.96k|    ret = CRYPTO_malloc(maxlen + 1, file, line);
   44|  2.96k|    if (ret) {
  ------------------
  |  Branch (44:9): [True: 2.96k, False: 0]
  ------------------
   45|  2.96k|        memcpy(ret, str, maxlen);
   46|  2.96k|        ret[maxlen] = CH_ZERO;
  ------------------
  |  |   19|  2.96k|#define CH_ZERO '\0'
  ------------------
   47|  2.96k|    }
   48|  2.96k|    return ret;
   49|  2.96k|}
CRYPTO_memdup:
   52|   215k|{
   53|   215k|    void *ret;
   54|       |
   55|   215k|    if (data == NULL || siz >= INT_MAX)
  ------------------
  |  Branch (55:9): [True: 0, False: 215k]
  |  Branch (55:25): [True: 0, False: 215k]
  ------------------
   56|      0|        return NULL;
   57|       |
   58|   215k|    ret = CRYPTO_malloc(siz, file, line);
   59|   215k|    if (ret == NULL)
  ------------------
  |  Branch (59:9): [True: 0, False: 215k]
  ------------------
   60|      0|        return NULL;
   61|   215k|    return memcpy(ret, data, siz);
   62|   215k|}
OPENSSL_strnlen:
   65|  28.2M|{
   66|  28.2M|    const char *p;
   67|       |
   68|   127M|    for (p = str; maxlen-- != 0 && *p != CH_ZERO; ++p) ;
  ------------------
  |  |   19|   127M|#define CH_ZERO '\0'
  ------------------
  |  Branch (68:19): [True: 127M, False: 3.56k]
  |  Branch (68:36): [True: 99.5M, False: 28.2M]
  ------------------
   69|       |
   70|  28.2M|    return p - str;
   71|  28.2M|}
OPENSSL_strlcpy:
   74|  8.03M|{
   75|  8.03M|    size_t l = 0;
   76|  77.6M|    for (; size > 1 && *src; size--) {
  ------------------
  |  Branch (76:12): [True: 77.6M, False: 4.79k]
  |  Branch (76:24): [True: 69.5M, False: 8.03M]
  ------------------
   77|  69.5M|        *dst++ = *src++;
   78|  69.5M|        l++;
   79|  69.5M|    }
   80|  8.03M|    if (size)
  ------------------
  |  Branch (80:9): [True: 8.03M, False: 610]
  ------------------
   81|  8.03M|        *dst = CH_ZERO;
  ------------------
  |  |   19|  8.03M|#define CH_ZERO '\0'
  ------------------
   82|  8.03M|    return l + strlen(src);
   83|  8.03M|}
OPENSSL_strlcat:
   86|  6.54M|{
   87|  6.54M|    size_t l = 0;
   88|  62.6M|    for (; size > 0 && *dst; size--, dst++)
  ------------------
  |  Branch (88:12): [True: 62.6M, False: 0]
  |  Branch (88:24): [True: 56.0M, False: 6.54M]
  ------------------
   89|  56.0M|        l++;
   90|  6.54M|    return l + OPENSSL_strlcpy(dst, src, size);
   91|  6.54M|}
ossl_buf2hexstr_sep:
  263|    546|{
  264|    546|    char *tmp;
  265|    546|    size_t tmp_n;
  266|       |
  267|    546|    if (buflen == 0)
  ------------------
  |  Branch (267:9): [True: 208, False: 338]
  ------------------
  268|    208|        return OPENSSL_zalloc(1);
  ------------------
  |  |   99|    208|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    208|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    208|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  269|       |
  270|    338|    tmp_n = (sep != CH_ZERO) ? buflen * 3 : 1 + buflen * 2;
  ------------------
  |  |   19|    338|#define CH_ZERO '\0'
  ------------------
  |  Branch (270:13): [True: 338, False: 0]
  ------------------
  271|    338|    if ((tmp = OPENSSL_malloc(tmp_n)) == NULL)
  ------------------
  |  |   97|    338|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    338|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    338|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (271:9): [True: 0, False: 338]
  ------------------
  272|      0|        return NULL;
  273|       |
  274|    338|    if (buf2hexstr_sep(tmp, tmp_n, NULL, buf, buflen, sep))
  ------------------
  |  Branch (274:9): [True: 338, False: 0]
  ------------------
  275|    338|        return tmp;
  276|      0|    OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  277|      0|    return NULL;
  278|    338|}
OPENSSL_buf2hexstr:
  287|    546|{
  288|    546|    return ossl_buf2hexstr_sep(buf, buflen, DEFAULT_SEPARATOR);
  ------------------
  |  |   18|    546|#define DEFAULT_SEPARATOR ':'
  ------------------
  289|    546|}
OPENSSL_strcasecmp:
  340|   853k|{
  341|   853k|    int t;
  342|       |
  343|  5.25M|    while ((t = ossl_tolower(*s1) - ossl_tolower(*s2++)) == 0)
  ------------------
  |  Branch (343:12): [True: 5.04M, False: 205k]
  ------------------
  344|  5.04M|        if (*s1++ == '\0')
  ------------------
  |  Branch (344:13): [True: 647k, False: 4.40M]
  ------------------
  345|   647k|            return 0;
  346|   205k|    return t;
  347|   853k|}
OPENSSL_strncasecmp:
  350|  40.6k|{
  351|  40.6k|    int t;
  352|  40.6k|    size_t i;
  353|       |
  354|   137k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (354:17): [True: 107k, False: 29.9k]
  ------------------
  355|   107k|        if ((t = ossl_tolower(*s1) - ossl_tolower(*s2++)) != 0)
  ------------------
  |  Branch (355:13): [True: 10.6k, False: 97.1k]
  ------------------
  356|  10.6k|            return t;
  357|  97.1k|        else if (*s1++ == '\0')
  ------------------
  |  Branch (357:18): [True: 0, False: 97.1k]
  ------------------
  358|      0|            return 0;
  359|  29.9k|    return 0;
  360|  40.6k|}
o_str.c:buf2hexstr_sep:
  220|    338|{
  221|    338|    static const char hexdig[] = "0123456789ABCDEF";
  222|    338|    const unsigned char *p;
  223|    338|    char *q;
  224|    338|    size_t i;
  225|    338|    int has_sep = (sep != CH_ZERO);
  ------------------
  |  |   19|    338|#define CH_ZERO '\0'
  ------------------
  226|    338|    size_t len = has_sep ? buflen * 3 : 1 + buflen * 2;
  ------------------
  |  Branch (226:18): [True: 338, False: 0]
  ------------------
  227|       |
  228|    338|    if (strlength != NULL)
  ------------------
  |  Branch (228:9): [True: 0, False: 338]
  ------------------
  229|      0|        *strlength = len;
  230|    338|    if (str == NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 338]
  ------------------
  231|      0|        return 1;
  232|       |
  233|    338|    if (str_n < (unsigned long)len) {
  ------------------
  |  Branch (233:9): [True: 0, False: 338]
  ------------------
  234|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  235|      0|        return 0;
  236|      0|    }
  237|       |
  238|    338|    q = str;
  239|    956|    for (i = 0, p = buf; i < buflen; i++, p++) {
  ------------------
  |  Branch (239:26): [True: 618, False: 338]
  ------------------
  240|    618|        *q++ = hexdig[(*p >> 4) & 0xf];
  241|    618|        *q++ = hexdig[*p & 0xf];
  242|    618|        if (has_sep)
  ------------------
  |  Branch (242:13): [True: 618, False: 0]
  ------------------
  243|    618|            *q++ = sep;
  244|    618|    }
  245|    338|    if (has_sep)
  ------------------
  |  Branch (245:9): [True: 338, False: 0]
  ------------------
  246|    338|        --q;
  247|    338|    *q = CH_ZERO;
  ------------------
  |  |   19|    338|#define CH_ZERO '\0'
  ------------------
  248|       |
  249|       |#ifdef CHARSET_EBCDIC
  250|       |    ebcdic2ascii(str, str, q - str - 1);
  251|       |#endif
  252|    338|    return 1;
  253|    338|}

OPENSSL_gmtime_adj:
   73|    720|{
   74|    720|    int time_sec, time_year, time_month, time_day;
   75|    720|    long time_jd;
   76|       |
   77|       |    /* Convert time and offset into Julian day and seconds */
   78|    720|    if (!julian_adj(tm, off_day, offset_sec, &time_jd, &time_sec))
  ------------------
  |  Branch (78:9): [True: 0, False: 720]
  ------------------
   79|      0|        return 0;
   80|       |
   81|       |    /* Convert Julian day back to date */
   82|       |
   83|    720|    julian_to_date(time_jd, &time_year, &time_month, &time_day);
   84|       |
   85|    720|    if (time_year < 1900 || time_year > 9999)
  ------------------
  |  Branch (85:9): [True: 54, False: 666]
  |  Branch (85:29): [True: 4, False: 662]
  ------------------
   86|     58|        return 0;
   87|       |
   88|       |    /* Update tm structure */
   89|       |
   90|    662|    tm->tm_year = time_year - 1900;
   91|    662|    tm->tm_mon = time_month - 1;
   92|    662|    tm->tm_mday = time_day;
   93|       |
   94|    662|    tm->tm_hour = time_sec / 3600;
   95|    662|    tm->tm_min = (time_sec / 60) % 60;
   96|    662|    tm->tm_sec = time_sec % 60;
   97|       |
   98|    662|    return 1;
   99|       |
  100|    720|}
o_time.c:julian_adj:
  135|    720|{
  136|    720|    int offset_hms;
  137|    720|    long offset_day, time_jd;
  138|    720|    int time_year, time_month, time_day;
  139|       |    /* split offset into days and day seconds */
  140|    720|    offset_day = offset_sec / SECS_PER_DAY;
  ------------------
  |  |   65|    720|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  141|       |    /* Avoid sign issues with % operator */
  142|    720|    offset_hms = offset_sec - (offset_day * SECS_PER_DAY);
  ------------------
  |  |   65|    720|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  143|    720|    offset_day += off_day;
  144|       |    /* Add current time seconds to offset */
  145|    720|    offset_hms += tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
  146|       |    /* Adjust day seconds if overflow */
  147|    720|    if (offset_hms >= SECS_PER_DAY) {
  ------------------
  |  |   65|    720|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  |  Branch (147:9): [True: 203, False: 517]
  ------------------
  148|    203|        offset_day++;
  149|    203|        offset_hms -= SECS_PER_DAY;
  ------------------
  |  |   65|    203|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  150|    517|    } else if (offset_hms < 0) {
  ------------------
  |  Branch (150:16): [True: 367, False: 150]
  ------------------
  151|    367|        offset_day--;
  152|    367|        offset_hms += SECS_PER_DAY;
  ------------------
  |  |   65|    367|#define SECS_PER_DAY (24 * 60 * 60)
  ------------------
  153|    367|    }
  154|       |
  155|       |    /*
  156|       |     * Convert date of time structure into a Julian day number.
  157|       |     */
  158|       |
  159|    720|    time_year = tm->tm_year + 1900;
  160|    720|    time_month = tm->tm_mon + 1;
  161|    720|    time_day = tm->tm_mday;
  162|       |
  163|    720|    time_jd = date_to_julian(time_year, time_month, time_day);
  164|       |
  165|       |    /* Work out Julian day of new date */
  166|    720|    time_jd += offset_day;
  167|       |
  168|    720|    if (time_jd < 0)
  ------------------
  |  Branch (168:9): [True: 0, False: 720]
  ------------------
  169|      0|        return 0;
  170|       |
  171|    720|    *pday = time_jd;
  172|    720|    *psec = offset_hms;
  173|    720|    return 1;
  174|    720|}
o_time.c:date_to_julian:
  180|    720|{
  181|    720|    return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +
  182|    720|        (367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -
  183|    720|        (3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 + d - 32075;
  184|    720|}
o_time.c:julian_to_date:
  187|    720|{
  188|    720|    long L = jd + 68569;
  189|    720|    long n = (4 * L) / 146097;
  190|    720|    long i, j;
  191|       |
  192|    720|    L = L - (146097 * n + 3) / 4;
  193|    720|    i = (4000 * (L + 1)) / 1461001;
  194|    720|    L = L - (1461 * i) / 4 + 31;
  195|    720|    j = (80 * L) / 2447;
  196|    720|    *d = L - (2447 * j) / 80;
  197|    720|    L = j / 11;
  198|    720|    *m = j + 2 - (12 * L);
  199|    720|    *y = 100 * (n - 49) + i + L;
  200|    720|}

OBJ_NAME_init:
   64|  1.64k|{
   65|  1.64k|    return RUN_ONCE(&init, o_names_init);
  ------------------
  |  |  130|  1.64k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1.64k, False: 0]
  |  |  ------------------
  ------------------
   66|  1.64k|}
OBJ_NAME_get:
  152|    313|{
  153|    313|    OBJ_NAME on, *ret;
  154|    313|    int num = 0, alias;
  155|    313|    const char *value = NULL;
  156|       |
  157|    313|    if (name == NULL)
  ------------------
  |  Branch (157:9): [True: 0, False: 313]
  ------------------
  158|      0|        return NULL;
  159|    313|    if (!OBJ_NAME_init())
  ------------------
  |  Branch (159:9): [True: 0, False: 313]
  ------------------
  160|      0|        return NULL;
  161|    313|    if (!CRYPTO_THREAD_read_lock(obj_lock))
  ------------------
  |  Branch (161:9): [True: 0, False: 313]
  ------------------
  162|      0|        return NULL;
  163|       |
  164|    313|    alias = type & OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    313|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  165|    313|    type &= ~OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    313|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  166|       |
  167|    313|    on.name = name;
  168|    313|    on.type = type;
  169|       |
  170|    388|    for (;;) {
  171|    388|        ret = lh_OBJ_NAME_retrieve(names_lh, &on);
  172|    388|        if (ret == NULL)
  ------------------
  |  Branch (172:13): [True: 48, False: 340]
  ------------------
  173|     48|            break;
  174|    340|        if ((ret->alias) && !alias) {
  ------------------
  |  Branch (174:13): [True: 75, False: 265]
  |  Branch (174:29): [True: 75, False: 0]
  ------------------
  175|     75|            if (++num > 10)
  ------------------
  |  Branch (175:17): [True: 0, False: 75]
  ------------------
  176|      0|                break;
  177|     75|            on.name = ret->data;
  178|    265|        } else {
  179|    265|            value = ret->data;
  180|    265|            break;
  181|    265|        }
  182|    340|    }
  183|       |
  184|    313|    CRYPTO_THREAD_unlock(obj_lock);
  185|    313|    return value;
  186|    313|}
OBJ_NAME_add:
  189|    848|{
  190|    848|    OBJ_NAME *onp, *ret;
  191|    848|    int alias, ok = 0;
  192|       |
  193|    848|    if (!OBJ_NAME_init())
  ------------------
  |  Branch (193:9): [True: 0, False: 848]
  ------------------
  194|      0|        return 0;
  195|       |
  196|    848|    alias = type & OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    848|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  197|    848|    type &= ~OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    848|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  198|       |
  199|    848|    onp = OPENSSL_malloc(sizeof(*onp));
  ------------------
  |  |   97|    848|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    848|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    848|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  200|    848|    if (onp == NULL)
  ------------------
  |  Branch (200:9): [True: 0, False: 848]
  ------------------
  201|      0|        return 0;
  202|       |
  203|    848|    onp->name = name;
  204|    848|    onp->alias = alias;
  205|    848|    onp->type = type;
  206|    848|    onp->data = data;
  207|       |
  208|    848|    if (!CRYPTO_THREAD_write_lock(obj_lock)) {
  ------------------
  |  Branch (208:9): [True: 0, False: 848]
  ------------------
  209|      0|        OPENSSL_free(onp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  210|      0|        return 0;
  211|      0|    }
  212|       |
  213|    848|    ret = lh_OBJ_NAME_insert(names_lh, onp);
  214|    848|    if (ret != NULL) {
  ------------------
  |  Branch (214:9): [True: 364, False: 484]
  ------------------
  215|       |        /* free things */
  216|    364|        if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (216:13): [True: 0, False: 364]
  ------------------
  217|    364|            && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) {
  ------------------
  |  Branch (217:16): [True: 0, False: 0]
  ------------------
  218|       |            /*
  219|       |             * XXX: I'm not sure I understand why the free function should
  220|       |             * get three arguments... -- Richard Levitte
  221|       |             */
  222|      0|            sk_NAME_FUNCS_value(name_funcs_stack,
  223|      0|                                ret->type)->free_func(ret->name, ret->type,
  224|      0|                                                      ret->data);
  225|      0|        }
  226|    364|        OPENSSL_free(ret);
  ------------------
  |  |  107|    364|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    364|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    364|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  227|    484|    } else {
  228|    484|        if (lh_OBJ_NAME_error(names_lh)) {
  ------------------
  |  Branch (228:13): [True: 0, False: 484]
  ------------------
  229|       |            /* ERROR */
  230|      0|            OPENSSL_free(onp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  231|      0|            goto unlock;
  232|      0|        }
  233|    484|    }
  234|       |
  235|    848|    ok = 1;
  236|       |
  237|    848|unlock:
  238|    848|    CRYPTO_THREAD_unlock(obj_lock);
  239|    848|    return ok;
  240|    848|}
OBJ_NAME_remove:
  243|    484|{
  244|    484|    OBJ_NAME on, *ret;
  245|    484|    int ok = 0;
  246|       |
  247|    484|    if (!OBJ_NAME_init())
  ------------------
  |  Branch (247:9): [True: 0, False: 484]
  ------------------
  248|      0|        return 0;
  249|       |
  250|    484|    if (!CRYPTO_THREAD_write_lock(obj_lock))
  ------------------
  |  Branch (250:9): [True: 0, False: 484]
  ------------------
  251|      0|        return 0;
  252|       |
  253|    484|    type &= ~OBJ_NAME_ALIAS;
  ------------------
  |  |   33|    484|# define OBJ_NAME_ALIAS                  0x8000
  ------------------
  254|    484|    on.name = name;
  255|    484|    on.type = type;
  256|    484|    ret = lh_OBJ_NAME_delete(names_lh, &on);
  257|    484|    if (ret != NULL) {
  ------------------
  |  Branch (257:9): [True: 484, False: 0]
  ------------------
  258|       |        /* free things */
  259|    484|        if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (259:13): [True: 0, False: 484]
  ------------------
  260|    484|            && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) {
  ------------------
  |  Branch (260:16): [True: 0, False: 0]
  ------------------
  261|       |            /*
  262|       |             * XXX: I'm not sure I understand why the free function should
  263|       |             * get three arguments... -- Richard Levitte
  264|       |             */
  265|      0|            sk_NAME_FUNCS_value(name_funcs_stack,
  266|      0|                                ret->type)->free_func(ret->name, ret->type,
  267|      0|                                                      ret->data);
  268|      0|        }
  269|    484|        OPENSSL_free(ret);
  ------------------
  |  |  107|    484|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    484|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    484|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  270|    484|        ok = 1;
  271|    484|    }
  272|       |
  273|    484|    CRYPTO_THREAD_unlock(obj_lock);
  274|    484|    return ok;
  275|    484|}
OBJ_NAME_do_all:
  293|      2|{
  294|      2|    OBJ_DOALL d;
  295|       |
  296|      2|    d.type = type;
  297|      2|    d.fn = fn;
  298|      2|    d.arg = arg;
  299|       |
  300|      2|    lh_OBJ_NAME_doall_OBJ_DOALL(names_lh, do_all_fn, &d);
  301|      2|}
OBJ_NAME_cleanup:
  368|      8|{
  369|      8|    unsigned long down_load;
  370|       |
  371|      8|    if (names_lh == NULL)
  ------------------
  |  Branch (371:9): [True: 0, False: 8]
  ------------------
  372|      0|        return;
  373|       |
  374|      8|    free_type = type;
  375|      8|    down_load = lh_OBJ_NAME_get_down_load(names_lh);
  376|      8|    lh_OBJ_NAME_set_down_load(names_lh, 0);
  377|       |
  378|      8|    lh_OBJ_NAME_doall(names_lh, names_lh_free_doall);
  379|      8|    if (type < 0) {
  ------------------
  |  Branch (379:9): [True: 2, False: 6]
  ------------------
  380|      2|        lh_OBJ_NAME_free(names_lh);
  381|      2|        sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
  382|      2|        CRYPTO_THREAD_lock_free(obj_lock);
  383|      2|        names_lh = NULL;
  384|      2|        name_funcs_stack = NULL;
  385|      2|        obj_lock = NULL;
  386|      2|    } else
  387|      6|        lh_OBJ_NAME_set_down_load(names_lh, down_load);
  388|      8|}
o_names.c:o_names_init:
   51|      2|{
   52|      2|    names_lh = NULL;
   53|      2|    obj_lock = CRYPTO_THREAD_lock_new();
   54|      2|    if (obj_lock != NULL)
  ------------------
  |  Branch (54:9): [True: 2, False: 0]
  ------------------
   55|      2|        names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
   56|      2|    if (names_lh == NULL) {
  ------------------
  |  Branch (56:9): [True: 0, False: 2]
  ------------------
   57|      0|        CRYPTO_THREAD_lock_free(obj_lock);
   58|      0|        obj_lock = NULL;
   59|      0|    }
   60|      2|    return names_lh != NULL && obj_lock != NULL;
  ------------------
  |  Branch (60:12): [True: 2, False: 0]
  |  Branch (60:32): [True: 2, False: 0]
  ------------------
   61|      2|}
o_names.c:obj_name_hash:
  136|  1.72k|{
  137|  1.72k|    unsigned long ret;
  138|       |
  139|  1.72k|    if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (139:9): [True: 0, False: 1.72k]
  ------------------
  140|  1.72k|        && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) {
  ------------------
  |  Branch (140:12): [True: 0, False: 0]
  ------------------
  141|      0|        ret =
  142|      0|            sk_NAME_FUNCS_value(name_funcs_stack,
  143|      0|                                a->type)->hash_func(a->name);
  144|  1.72k|    } else {
  145|  1.72k|        ret = ossl_lh_strcasehash(a->name);
  146|  1.72k|    }
  147|  1.72k|    ret ^= a->type;
  148|  1.72k|    return ret;
  149|  1.72k|}
o_names.c:obj_name_cmp:
  120|  1.18k|{
  121|  1.18k|    int ret;
  122|       |
  123|  1.18k|    ret = a->type - b->type;
  124|  1.18k|    if (ret == 0) {
  ------------------
  |  Branch (124:9): [True: 1.18k, False: 0]
  ------------------
  125|  1.18k|        if ((name_funcs_stack != NULL)
  ------------------
  |  Branch (125:13): [True: 0, False: 1.18k]
  ------------------
  126|  1.18k|            && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) {
  ------------------
  |  Branch (126:16): [True: 0, False: 0]
  ------------------
  127|      0|            ret = sk_NAME_FUNCS_value(name_funcs_stack,
  128|      0|                                      a->type)->cmp_func(a->name, b->name);
  129|      0|        } else
  130|  1.18k|            ret = OPENSSL_strcasecmp(a->name, b->name);
  131|  1.18k|    }
  132|  1.18k|    return ret;
  133|  1.18k|}
o_names.c:do_all_fn:
  284|    484|{
  285|    484|    if (name->type == d->type)
  ------------------
  |  Branch (285:9): [True: 242, False: 242]
  ------------------
  286|    242|        d->fn(name, d->arg);
  287|    484|}
o_names.c:names_lh_free_doall:
  354|  1.08k|{
  355|  1.08k|    if (onp == NULL)
  ------------------
  |  Branch (355:9): [True: 0, False: 1.08k]
  ------------------
  356|      0|        return;
  357|       |
  358|  1.08k|    if (free_type < 0 || free_type == onp->type)
  ------------------
  |  Branch (358:9): [True: 0, False: 1.08k]
  |  Branch (358:26): [True: 484, False: 602]
  ------------------
  359|    484|        OBJ_NAME_remove(onp->name, onp->type);
  360|  1.08k|}

ossl_obj_cleanup_int:
  212|      2|{
  213|      2|    if (added != NULL) {
  ------------------
  |  Branch (213:9): [True: 0, False: 2]
  ------------------
  214|      0|        lh_ADDED_OBJ_set_down_load(added, 0);
  215|      0|        lh_ADDED_OBJ_doall(added, cleanup1_doall); /* zero counters */
  216|      0|        lh_ADDED_OBJ_doall(added, cleanup2_doall); /* set counters */
  217|      0|        lh_ADDED_OBJ_doall(added, cleanup3_doall); /* free objects */
  218|      0|        lh_ADDED_OBJ_free(added);
  219|      0|        added = NULL;
  220|      0|    }
  221|      2|    objs_free_locks();
  222|      2|}
OBJ_nid2obj:
  299|  2.50M|{
  300|  2.50M|    ADDED_OBJ ad, *adp = NULL;
  301|  2.50M|    ASN1_OBJECT ob;
  302|       |
  303|  2.50M|    if (n == NID_undef
  ------------------
  |  |   18|  5.00M|#define NID_undef                       0
  ------------------
  |  Branch (303:9): [True: 1.64M, False: 852k]
  ------------------
  304|  2.50M|        || (n > 0 && n < NUM_NID && nid_objs[n].nid != NID_undef))
  ------------------
  |  | 1187|  1.70M|#define NUM_NID 1320
  ------------------
                      || (n > 0 && n < NUM_NID && nid_objs[n].nid != NID_undef))
  ------------------
  |  |   18|   852k|#define NID_undef                       0
  ------------------
  |  Branch (304:13): [True: 852k, False: 12]
  |  Branch (304:22): [True: 852k, False: 0]
  |  Branch (304:37): [True: 852k, False: 0]
  ------------------
  305|  2.50M|        return (ASN1_OBJECT *)&(nid_objs[n]);
  306|       |
  307|     12|    ad.type = ADDED_NID;
  ------------------
  |  |   33|     12|#define ADDED_NID       3
  ------------------
  308|     12|    ad.obj = &ob;
  309|     12|    ob.nid = n;
  310|     12|    if (!ossl_obj_read_lock(1)) {
  ------------------
  |  Branch (310:9): [True: 0, False: 12]
  ------------------
  311|      0|        ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  312|      0|        return NULL;
  313|      0|    }
  314|     12|    if (added != NULL)
  ------------------
  |  Branch (314:9): [True: 0, False: 12]
  ------------------
  315|      0|        adp = lh_ADDED_OBJ_retrieve(added, &ad);
  316|     12|    ossl_obj_unlock(1);
  317|     12|    if (adp != NULL)
  ------------------
  |  Branch (317:9): [True: 0, False: 12]
  ------------------
  318|      0|        return adp->obj;
  319|       |
  320|     12|    ERR_raise(ERR_LIB_OBJ, OBJ_R_UNKNOWN_NID);
  ------------------
  |  |  401|     12|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     12|    (ERR_new(),                                                 \
  |  |  |  |  404|     12|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     12|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     12|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     12|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     12|     ERR_set_error)
  |  |  ------------------
  ------------------
  321|     12|    return NULL;
  322|     12|}
OBJ_nid2sn:
  325|  50.6k|{
  326|  50.6k|    ASN1_OBJECT *ob = OBJ_nid2obj(n);
  327|       |
  328|  50.6k|    return ob == NULL ? NULL : ob->sn;
  ------------------
  |  Branch (328:12): [True: 12, False: 50.6k]
  ------------------
  329|  50.6k|}
OBJ_nid2ln:
  332|   264k|{
  333|   264k|    ASN1_OBJECT *ob = OBJ_nid2obj(n);
  334|       |
  335|   264k|    return ob == NULL ? NULL : ob->ln;
  ------------------
  |  Branch (335:12): [True: 0, False: 264k]
  ------------------
  336|   264k|}
OBJ_obj2txt:
  437|  1.26M|{
  438|  1.26M|    int i, n = 0, len, nid, first, use_bn;
  439|  1.26M|    BIGNUM *bl;
  440|  1.26M|    unsigned long l;
  441|  1.26M|    const unsigned char *p;
  442|  1.26M|    char tbuf[DECIMAL_SIZE(i) + DECIMAL_SIZE(l) + 2];
  443|  1.26M|    const char *s;
  444|       |
  445|       |    /* Ensure that, at every state, |buf| is NUL-terminated. */
  446|  1.26M|    if (buf != NULL && buf_len > 0)
  ------------------
  |  Branch (446:9): [True: 1.26M, False: 0]
  |  Branch (446:24): [True: 1.26M, False: 0]
  ------------------
  447|  1.26M|        buf[0] = '\0';
  448|       |
  449|  1.26M|    if (a == NULL || a->data == NULL)
  ------------------
  |  Branch (449:9): [True: 0, False: 1.26M]
  |  Branch (449:22): [True: 1, False: 1.26M]
  ------------------
  450|      1|        return 0;
  451|       |
  452|  1.26M|    if (!no_name && (nid = OBJ_obj2nid(a)) != NID_undef) {
  ------------------
  |  |   18|  1.24M|#define NID_undef                       0
  ------------------
  |  Branch (452:9): [True: 1.24M, False: 26.7k]
  |  Branch (452:21): [True: 242k, False: 1.00M]
  ------------------
  453|   242k|        s = OBJ_nid2ln(nid);
  454|   242k|        if (s == NULL)
  ------------------
  |  Branch (454:13): [True: 0, False: 242k]
  ------------------
  455|      0|            s = OBJ_nid2sn(nid);
  456|   242k|        if (s != NULL) {
  ------------------
  |  Branch (456:13): [True: 242k, False: 0]
  ------------------
  457|   242k|            if (buf != NULL)
  ------------------
  |  Branch (457:17): [True: 242k, False: 0]
  ------------------
  458|   242k|                OPENSSL_strlcpy(buf, s, buf_len);
  459|   242k|            return (int)strlen(s);
  460|   242k|        }
  461|   242k|    }
  462|       |
  463|  1.02M|    len = a->length;
  464|  1.02M|    p = a->data;
  465|       |
  466|  1.02M|    first = 1;
  467|  1.02M|    bl = NULL;
  468|       |
  469|       |    /*
  470|       |     * RFC 2578 (STD 58) says this about OBJECT IDENTIFIERs:
  471|       |     *
  472|       |     * > 3.5. OBJECT IDENTIFIER values
  473|       |     * >
  474|       |     * > An OBJECT IDENTIFIER value is an ordered list of non-negative
  475|       |     * > numbers. For the SMIv2, each number in the list is referred to as a
  476|       |     * > sub-identifier, there are at most 128 sub-identifiers in a value,
  477|       |     * > and each sub-identifier has a maximum value of 2^32-1 (4294967295
  478|       |     * > decimal).
  479|       |     *
  480|       |     * So a legitimate OID according to this RFC is at most (32 * 128 / 7),
  481|       |     * i.e. 586 bytes long.
  482|       |     *
  483|       |     * Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
  484|       |     */
  485|  1.02M|    if (len > 586)
  ------------------
  |  Branch (485:9): [True: 76, False: 1.02M]
  ------------------
  486|     76|        goto err;
  487|       |
  488|  2.32M|    while (len > 0) {
  ------------------
  |  Branch (488:12): [True: 1.29M, False: 1.02M]
  ------------------
  489|  1.29M|        l = 0;
  490|  1.29M|        use_bn = 0;
  491|  1.43M|        for (;;) {
  492|  1.43M|            unsigned char c = *p++;
  493|       |
  494|  1.43M|            len--;
  495|  1.43M|            if (len == 0 && (c & 0x80) != 0)
  ------------------
  |  Branch (495:17): [True: 1.02M, False: 404k]
  |  Branch (495:29): [True: 0, False: 1.02M]
  ------------------
  496|      0|                goto err;
  497|  1.43M|            if (use_bn) {
  ------------------
  |  Branch (497:17): [True: 31.0k, False: 1.40M]
  ------------------
  498|  31.0k|                if (!BN_add_word(bl, c & 0x7f))
  ------------------
  |  Branch (498:21): [True: 0, False: 31.0k]
  ------------------
  499|      0|                    goto err;
  500|  1.40M|            } else {
  501|  1.40M|                l |= c & 0x7f;
  502|  1.40M|            }
  503|  1.43M|            if ((c & 0x80) == 0)
  ------------------
  |  Branch (503:17): [True: 1.29M, False: 137k]
  ------------------
  504|  1.29M|                break;
  505|   137k|            if (!use_bn && l > (ULONG_MAX >> 7L)) {
  ------------------
  |  Branch (505:17): [True: 110k, False: 27.4k]
  |  Branch (505:28): [True: 3.52k, False: 106k]
  ------------------
  506|  3.52k|                if (bl == NULL && (bl = BN_new()) == NULL)
  ------------------
  |  Branch (506:21): [True: 2.09k, False: 1.42k]
  |  Branch (506:35): [True: 0, False: 2.09k]
  ------------------
  507|      0|                    goto err;
  508|  3.52k|                if (!BN_set_word(bl, l))
  ------------------
  |  Branch (508:21): [True: 0, False: 3.52k]
  ------------------
  509|      0|                    goto err;
  510|  3.52k|                use_bn = 1;
  511|  3.52k|            }
  512|   137k|            if (use_bn) {
  ------------------
  |  Branch (512:17): [True: 31.0k, False: 106k]
  ------------------
  513|  31.0k|                if (!BN_lshift(bl, bl, 7))
  ------------------
  |  Branch (513:21): [True: 0, False: 31.0k]
  ------------------
  514|      0|                    goto err;
  515|   106k|            } else {
  516|   106k|                l <<= 7L;
  517|   106k|            }
  518|   137k|        }
  519|       |
  520|  1.29M|        if (first) {
  ------------------
  |  Branch (520:13): [True: 1.02M, False: 266k]
  ------------------
  521|  1.02M|            first = 0;
  522|  1.02M|            if (l >= 80) {
  ------------------
  |  Branch (522:17): [True: 30.3k, False: 996k]
  ------------------
  523|  30.3k|                i = 2;
  524|  30.3k|                if (use_bn) {
  ------------------
  |  Branch (524:21): [True: 1.45k, False: 28.8k]
  ------------------
  525|  1.45k|                    if (!BN_sub_word(bl, 80))
  ------------------
  |  Branch (525:25): [True: 0, False: 1.45k]
  ------------------
  526|      0|                        goto err;
  527|  28.8k|                } else {
  528|  28.8k|                    l -= 80;
  529|  28.8k|                }
  530|   996k|            } else {
  531|   996k|                i = (int)(l / 40);
  532|   996k|                l -= (long)(i * 40);
  533|   996k|            }
  534|  1.02M|            if (buf != NULL && buf_len > 1) {
  ------------------
  |  Branch (534:17): [True: 1.02M, False: 0]
  |  Branch (534:32): [True: 1.02M, False: 0]
  ------------------
  535|  1.02M|                *buf++ = i + '0';
  536|  1.02M|                *buf = '\0';
  537|  1.02M|                buf_len--;
  538|  1.02M|            }
  539|  1.02M|            n++;
  540|  1.02M|        }
  541|       |
  542|  1.29M|        if (use_bn) {
  ------------------
  |  Branch (542:13): [True: 3.52k, False: 1.29M]
  ------------------
  543|  3.52k|            char *bndec;
  544|  3.52k|            bndec = BN_bn2dec(bl);
  545|  3.52k|            if (!bndec)
  ------------------
  |  Branch (545:17): [True: 0, False: 3.52k]
  ------------------
  546|      0|                goto err;
  547|  3.52k|            i = strlen(bndec);
  548|  3.52k|            if (buf != NULL) {
  ------------------
  |  Branch (548:17): [True: 3.52k, False: 0]
  ------------------
  549|  3.52k|                if (buf_len > 1) {
  ------------------
  |  Branch (549:21): [True: 2.91k, False: 610]
  ------------------
  550|  2.91k|                    *buf++ = '.';
  551|  2.91k|                    *buf = '\0';
  552|  2.91k|                    buf_len--;
  553|  2.91k|                }
  554|  3.52k|                OPENSSL_strlcpy(buf, bndec, buf_len);
  555|  3.52k|                if (i > buf_len) {
  ------------------
  |  Branch (555:21): [True: 890, False: 2.63k]
  ------------------
  556|    890|                    buf += buf_len;
  557|    890|                    buf_len = 0;
  558|  2.63k|                } else {
  559|  2.63k|                    buf += i;
  560|  2.63k|                    buf_len -= i;
  561|  2.63k|                }
  562|  3.52k|            }
  563|  3.52k|            n++;
  564|  3.52k|            n += i;
  565|  3.52k|            OPENSSL_free(bndec);
  ------------------
  |  |  107|  3.52k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.52k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.52k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  566|  1.29M|        } else {
  567|  1.29M|            BIO_snprintf(tbuf, sizeof(tbuf), ".%lu", l);
  568|  1.29M|            i = strlen(tbuf);
  569|  1.29M|            if (buf && buf_len > 0) {
  ------------------
  |  Branch (569:17): [True: 1.29M, False: 0]
  |  Branch (569:24): [True: 1.25M, False: 39.8k]
  ------------------
  570|  1.25M|                OPENSSL_strlcpy(buf, tbuf, buf_len);
  571|  1.25M|                if (i > buf_len) {
  ------------------
  |  Branch (571:21): [True: 737, False: 1.24M]
  ------------------
  572|    737|                    buf += buf_len;
  573|    737|                    buf_len = 0;
  574|  1.24M|                } else {
  575|  1.24M|                    buf += i;
  576|  1.24M|                    buf_len -= i;
  577|  1.24M|                }
  578|  1.25M|            }
  579|  1.29M|            n += i;
  580|  1.29M|            l = 0;
  581|  1.29M|        }
  582|  1.29M|    }
  583|       |
  584|  1.02M|    BN_free(bl);
  585|  1.02M|    return n;
  586|       |
  587|     76| err:
  588|     76|    BN_free(bl);
  589|     76|    return -1;
  590|  1.02M|}
OBJ_bsearch_:
  660|  2.98M|{
  661|  2.98M|    return OBJ_bsearch_ex_(key, base, num, size, cmp, 0);
  662|  2.98M|}
OBJ_bsearch_ex_:
  668|  2.98M|{
  669|  2.98M|    const char *p = ossl_bsearch(key, base, num, size, cmp, flags);
  670|       |
  671|       |#ifdef CHARSET_EBCDIC
  672|       |    /*
  673|       |     * THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and I
  674|       |     * don't have perl (yet), we revert to a *LINEAR* search when the object
  675|       |     * wasn't found in the binary search.
  676|       |     */
  677|       |    if (p == NULL) {
  678|       |        const char *base_ = base;
  679|       |        int l, h, i = 0, c = 0;
  680|       |
  681|       |        for (i = 0; i < num; ++i) {
  682|       |            p = &(base_[i * size]);
  683|       |            c = (*cmp) (key, p);
  684|       |            if (c == 0
  685|       |                || (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)))
  686|       |                return p;
  687|       |        }
  688|       |    }
  689|       |#endif
  690|  2.98M|    return p;
  691|  2.98M|}
OBJ_length:
  806|  17.8k|{
  807|  17.8k|    if (obj == NULL)
  ------------------
  |  Branch (807:9): [True: 0, False: 17.8k]
  ------------------
  808|      0|        return 0;
  809|  17.8k|    return obj->length;
  810|  17.8k|}
OBJ_get0_data:
  813|    159|{
  814|    159|    if (obj == NULL)
  ------------------
  |  Branch (814:9): [True: 0, False: 159]
  ------------------
  815|      0|        return NULL;
  816|    159|    return obj->data;
  817|    159|}
OBJ_obj2nid:
  825|  3.51M|{
  826|  3.51M|    return ossl_obj_obj2nid(a, 1);
  827|  3.51M|}
obj_dat.c:objs_free_locks:
   49|      2|{
   50|      2|    CRYPTO_THREAD_lock_free(ossl_obj_lock);
   51|      2|    ossl_obj_lock = NULL;
   52|       |#ifdef TSAN_REQUIRES_LOCKING
   53|       |    CRYPTO_THREAD_lock_free(ossl_obj_nid_lock);
   54|       |    ossl_obj_nid_lock = NULL;
   55|       |#endif
   56|      2|}
obj_dat.c:ossl_obj_read_lock:
   93|  2.37M|{
   94|  2.37M|    if (!lock)
  ------------------
  |  Branch (94:9): [True: 0, False: 2.37M]
  ------------------
   95|      0|        return 1;
   96|  2.37M|    if (!ossl_init_added_lock())
  ------------------
  |  Branch (96:9): [True: 0, False: 2.37M]
  ------------------
   97|      0|        return 0;
   98|  2.37M|    return CRYPTO_THREAD_read_lock(ossl_obj_lock);
   99|  2.37M|}
obj_dat.c:ossl_init_added_lock:
   75|  2.37M|{
   76|  2.37M|#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
   77|       |    /* Make sure we've loaded config before checking for any "added" objects */
   78|  2.37M|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  455|  2.37M|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
   79|  2.37M|#endif
   80|  2.37M|    return RUN_ONCE(&ossl_obj_lock_init, obj_lock_initialise);
  ------------------
  |  |  130|  2.37M|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2.37M, False: 0]
  |  |  ------------------
  ------------------
   81|  2.37M|}
obj_dat.c:obj_lock_initialise:
   59|      1|{
   60|      1|    ossl_obj_lock = CRYPTO_THREAD_lock_new();
   61|      1|    if (ossl_obj_lock == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 1]
  ------------------
   62|      0|        return 0;
   63|       |
   64|       |#ifdef TSAN_REQUIRES_LOCKING
   65|       |    ossl_obj_nid_lock = CRYPTO_THREAD_lock_new();
   66|       |    if (ossl_obj_nid_lock == NULL) {
   67|       |        objs_free_locks();
   68|       |        return 0;
   69|       |    }
   70|       |#endif
   71|      1|    return 1;
   72|      1|}
obj_dat.c:ossl_obj_unlock:
  102|  2.37M|{
  103|  2.37M|    if (lock)
  ------------------
  |  Branch (103:9): [True: 2.37M, False: 0]
  ------------------
  104|  2.37M|        CRYPTO_THREAD_unlock(ossl_obj_lock);
  105|  2.37M|}
obj_dat.c:ossl_obj_obj2nid:
  355|  3.51M|{
  356|  3.51M|    int nid = NID_undef;
  ------------------
  |  |   18|  3.51M|#define NID_undef                       0
  ------------------
  357|  3.51M|    const unsigned int *op;
  358|  3.51M|    ADDED_OBJ ad, *adp;
  359|       |
  360|  3.51M|    if (a == NULL)
  ------------------
  |  Branch (360:9): [True: 0, False: 3.51M]
  ------------------
  361|      0|        return NID_undef;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  362|  3.51M|    if (a->nid != NID_undef)
  ------------------
  |  |   18|  3.51M|#define NID_undef                       0
  ------------------
  |  Branch (362:9): [True: 559k, False: 2.95M]
  ------------------
  363|   559k|        return a->nid;
  364|  2.95M|    if (a->length == 0)
  ------------------
  |  Branch (364:9): [True: 55.9k, False: 2.89M]
  ------------------
  365|  55.9k|        return NID_undef;
  ------------------
  |  |   18|  55.9k|#define NID_undef                       0
  ------------------
  366|       |
  367|  2.89M|    op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);
  ------------------
  |  | 5141|  2.89M|#define NUM_OBJ 1177
  ------------------
  368|  2.89M|    if (op != NULL)
  ------------------
  |  Branch (368:9): [True: 518k, False: 2.37M]
  ------------------
  369|   518k|        return nid_objs[*op].nid;
  370|  2.37M|    if (!ossl_obj_read_lock(lock)) {
  ------------------
  |  Branch (370:9): [True: 0, False: 2.37M]
  ------------------
  371|      0|        ERR_raise(ERR_LIB_OBJ, ERR_R_UNABLE_TO_GET_READ_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  372|      0|        return NID_undef;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  373|      0|    }
  374|  2.37M|    if (added != NULL) {
  ------------------
  |  Branch (374:9): [True: 0, False: 2.37M]
  ------------------
  375|      0|        ad.type = ADDED_DATA;
  ------------------
  |  |   30|      0|#define ADDED_DATA      0
  ------------------
  376|      0|        ad.obj = (ASN1_OBJECT *)a; /* casting away const is harmless here */
  377|      0|        adp = lh_ADDED_OBJ_retrieve(added, &ad);
  378|      0|        if (adp != NULL)
  ------------------
  |  Branch (378:13): [True: 0, False: 0]
  ------------------
  379|      0|            nid = adp->obj->nid;
  380|      0|    }
  381|  2.37M|    ossl_obj_unlock(lock);
  382|  2.37M|    return nid;
  383|  2.37M|}
obj_dat.c:obj_cmp:
  339|  29.2M|{
  340|  29.2M|    int j;
  341|  29.2M|    const ASN1_OBJECT *a = *ap;
  342|  29.2M|    const ASN1_OBJECT *b = &nid_objs[*bp];
  343|       |
  344|  29.2M|    j = (a->length - b->length);
  345|  29.2M|    if (j)
  ------------------
  |  Branch (345:9): [True: 18.6M, False: 10.6M]
  ------------------
  346|  18.6M|        return j;
  347|  10.6M|    if (a->length == 0)
  ------------------
  |  Branch (347:9): [True: 0, False: 10.6M]
  ------------------
  348|      0|        return 0;
  349|  10.6M|    return memcmp(a->data, b->data, a->length);
  350|  10.6M|}

ossl_err_load_OBJ_strings:
   28|      2|{
   29|      2|#ifndef OPENSSL_NO_ERR
   30|      2|    if (ERR_reason_error_string(OBJ_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (30:9): [True: 2, False: 0]
  ------------------
   31|      2|        ERR_load_strings_const(OBJ_str_reasons);
   32|      2|#endif
   33|      2|    return 1;
   34|      2|}

OBJ_dup:
   17|   356k|{
   18|   356k|    ASN1_OBJECT *r;
   19|       |
   20|   356k|    if (o == NULL)
  ------------------
  |  Branch (20:9): [True: 0, False: 356k]
  ------------------
   21|      0|        return NULL;
   22|       |    /* If object isn't dynamic it's an internal OID which is never freed */
   23|   356k|    if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
  ------------------
  |  |  110|   356k|# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
  ------------------
  |  Branch (23:9): [True: 141k, False: 215k]
  ------------------
   24|   141k|        return (ASN1_OBJECT *)o;
   25|       |
   26|   215k|    r = ASN1_OBJECT_new();
   27|   215k|    if (r == NULL) {
  ------------------
  |  Branch (27:9): [True: 0, False: 215k]
  ------------------
   28|      0|        ERR_raise(ERR_LIB_OBJ, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   29|      0|        return NULL;
   30|      0|    }
   31|       |
   32|       |    /* Set dynamic flags so everything gets freed up on error */
   33|       |
   34|   215k|    r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |
  ------------------
  |  |  110|   215k|# define ASN1_OBJECT_FLAG_DYNAMIC         0x01/* internal use */
  ------------------
   35|   215k|                           ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  ------------------
  |  |  112|   215k|# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
  ------------------
   36|   215k|                           ASN1_OBJECT_FLAG_DYNAMIC_DATA);
  ------------------
  |  |  113|   215k|# define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08/* internal use */
  ------------------
   37|       |
   38|   215k|    if (o->length > 0 && (r->data = OPENSSL_memdup(o->data, o->length)) == NULL)
  ------------------
  |  |  109|   215k|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   215k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   215k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (38:9): [True: 215k, False: 0]
  |  Branch (38:26): [True: 0, False: 215k]
  ------------------
   39|      0|        goto err;
   40|       |
   41|   215k|    r->length = o->length;
   42|   215k|    r->nid = o->nid;
   43|       |
   44|   215k|    if (o->ln != NULL && (r->ln = OPENSSL_strdup(o->ln)) == NULL)
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (44:9): [True: 0, False: 215k]
  |  Branch (44:26): [True: 0, False: 0]
  ------------------
   45|      0|        goto err;
   46|       |
   47|   215k|    if (o->sn != NULL && (r->sn = OPENSSL_strdup(o->sn)) == NULL)
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (47:9): [True: 0, False: 215k]
  |  Branch (47:26): [True: 0, False: 0]
  ------------------
   48|      0|        goto err;
   49|       |
   50|   215k|    return r;
   51|      0| err:
   52|      0|    ASN1_OBJECT_free(r);
   53|      0|    return NULL;
   54|   215k|}

OBJ_sigid_free:
  215|      2|{
  216|      2|    sk_nid_triple_pop_free(sig_app, sid_free);
  217|      2|    sk_nid_triple_free(sigx_app);
  218|      2|    CRYPTO_THREAD_lock_free(sig_lock);
  219|      2|    sig_app = NULL;
  220|      2|    sigx_app = NULL;
  221|      2|    sig_lock = NULL;
  222|      2|}

ossl_err_load_OCSP_strings:
   66|      2|{
   67|      2|# ifndef OPENSSL_NO_ERR
   68|      2|    if (ERR_reason_error_string(OCSP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (68:9): [True: 2, False: 0]
  ------------------
   69|      2|        ERR_load_strings_const(OCSP_str_reasons);
   70|      2|# endif
   71|      2|    return 1;
   72|      2|}

v3_ocsp.c:i2r_ocsp_acutoff:
  145|  1.83k|{
  146|  1.83k|    if (BIO_printf(bp, "%*s", ind, "") <= 0)
  ------------------
  |  Branch (146:9): [True: 0, False: 1.83k]
  ------------------
  147|      0|        return 0;
  148|  1.83k|    if (!ASN1_GENERALIZEDTIME_print(bp, cutoff))
  ------------------
  |  Branch (148:9): [True: 1.80k, False: 28]
  ------------------
  149|  1.80k|        return 0;
  150|     28|    return 1;
  151|  1.83k|}
v3_ocsp.c:i2r_object:
  155|     34|{
  156|     34|    if (BIO_printf(bp, "%*s", ind, "") <= 0)
  ------------------
  |  Branch (156:9): [True: 0, False: 34]
  ------------------
  157|      0|        return 0;
  158|     34|    if (i2a_ASN1_OBJECT(bp, oid) <= 0)
  ------------------
  |  Branch (158:9): [True: 0, False: 34]
  ------------------
  159|      0|        return 0;
  160|     34|    return 1;
  161|     34|}

WPACKET_allocate_bytes:
   20|  88.6k|{
   21|  88.6k|    if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
  ------------------
  |  Branch (21:9): [True: 0, False: 88.6k]
  ------------------
   22|      0|        return 0;
   23|       |
   24|  88.6k|    pkt->written += len;
   25|  88.6k|    pkt->curr += len;
   26|  88.6k|    return 1;
   27|  88.6k|}
WPACKET_reserve_bytes:
   47|  88.6k|{
   48|       |    /* Internal API, so should not fail */
   49|  88.6k|    if (!ossl_assert(pkt->subs != NULL && len != 0))
  ------------------
  |  |   52|   177k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 88.6k, False: 0]
  |  |  |  Branch (52:43): [True: 88.6k, False: 0]
  |  |  ------------------
  |  |   53|  88.6k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (49:9): [True: 0, False: 88.6k]
  ------------------
   50|      0|        return 0;
   51|       |
   52|  88.6k|    if (pkt->maxsize - pkt->written < len)
  ------------------
  |  Branch (52:9): [True: 0, False: 88.6k]
  ------------------
   53|      0|        return 0;
   54|       |
   55|  88.6k|    if (pkt->buf != NULL && (pkt->buf->length - pkt->written < len)) {
  ------------------
  |  Branch (55:9): [True: 272, False: 88.4k]
  |  Branch (55:29): [True: 38, False: 234]
  ------------------
   56|     38|        size_t newlen;
   57|     38|        size_t reflen;
   58|       |
   59|     38|        reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
  ------------------
  |  Branch (59:18): [True: 34, False: 4]
  ------------------
   60|       |
   61|     38|        if (reflen > SIZE_MAX / 2) {
  ------------------
  |  Branch (61:13): [True: 0, False: 38]
  ------------------
   62|      0|            newlen = SIZE_MAX;
   63|     38|        } else {
   64|     38|            newlen = reflen * 2;
   65|     38|            if (newlen < DEFAULT_BUF_SIZE)
  ------------------
  |  |   17|     38|#define DEFAULT_BUF_SIZE    256
  ------------------
  |  Branch (65:17): [True: 32, False: 6]
  ------------------
   66|     32|                newlen = DEFAULT_BUF_SIZE;
  ------------------
  |  |   17|     32|#define DEFAULT_BUF_SIZE    256
  ------------------
   67|     38|        }
   68|     38|        if (BUF_MEM_grow(pkt->buf, newlen) == 0)
  ------------------
  |  Branch (68:13): [True: 0, False: 38]
  ------------------
   69|      0|            return 0;
   70|     38|    }
   71|  88.6k|    if (allocbytes != NULL) {
  ------------------
  |  Branch (71:9): [True: 88.6k, False: 0]
  ------------------
   72|  88.6k|        *allocbytes = WPACKET_get_curr(pkt);
   73|  88.6k|        if (pkt->endfirst && *allocbytes != NULL)
  ------------------
  |  Branch (73:13): [True: 4, False: 88.6k]
  |  Branch (73:30): [True: 2, False: 2]
  ------------------
   74|      2|            *allocbytes -= len;
   75|  88.6k|    }
   76|       |
   77|  88.6k|    return 1;
   78|  88.6k|}
WPACKET_init_der:
  147|      1|{
  148|       |    /* Internal API, so should not fail */
  149|      1|    if (!ossl_assert(buf != NULL && len > 0))
  ------------------
  |  |   52|      2|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 1, False: 0]
  |  |  |  Branch (52:43): [True: 1, False: 0]
  |  |  ------------------
  |  |   53|      1|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (149:9): [True: 0, False: 1]
  ------------------
  150|      0|        return 0;
  151|       |
  152|      1|    pkt->staticbuf = buf;
  153|      1|    pkt->buf = NULL;
  154|      1|    pkt->maxsize = len;
  155|      1|    pkt->endfirst = 1;
  156|       |
  157|      1|    return wpacket_intern_init_len(pkt, 0);
  158|      1|}
WPACKET_init_len:
  161|     32|{
  162|       |    /* Internal API, so should not fail */
  163|     32|    if (!ossl_assert(buf != NULL))
  ------------------
  |  |   52|     32|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     32|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (163:9): [True: 0, False: 32]
  ------------------
  164|      0|        return 0;
  165|       |
  166|     32|    pkt->staticbuf = NULL;
  167|     32|    pkt->buf = buf;
  168|     32|    pkt->maxsize = maxmaxsize(lenbytes);
  169|     32|    pkt->endfirst = 0;
  170|       |
  171|     32|    return wpacket_intern_init_len(pkt, lenbytes);
  172|     32|}
WPACKET_init_null:
  180|  10.9k|{
  181|  10.9k|    pkt->staticbuf = NULL;
  182|  10.9k|    pkt->buf = NULL;
  183|  10.9k|    pkt->maxsize = maxmaxsize(lenbytes);
  184|  10.9k|    pkt->endfirst = 0;
  185|       |
  186|  10.9k|    return wpacket_intern_init_len(pkt, 0);
  187|  10.9k|}
WPACKET_init_null_der:
  190|      1|{
  191|      1|    pkt->staticbuf = NULL;
  192|      1|    pkt->buf = NULL;
  193|      1|    pkt->maxsize = SIZE_MAX;
  194|      1|    pkt->endfirst = 1;
  195|       |
  196|      1|    return wpacket_intern_init_len(pkt, 0);
  197|      1|}
WPACKET_close:
  335|  32.9k|{
  336|       |    /*
  337|       |     * Internal API, so should not fail - but we do negative testing of this
  338|       |     * so no assert (otherwise the tests fail)
  339|       |     */
  340|  32.9k|    if (pkt->subs == NULL || pkt->subs->parent == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 32.9k]
  |  Branch (340:30): [True: 0, False: 32.9k]
  ------------------
  341|      0|        return 0;
  342|       |
  343|  32.9k|    return wpacket_intern_close(pkt, pkt->subs, 1);
  344|  32.9k|}
WPACKET_finish:
  347|  10.9k|{
  348|  10.9k|    int ret;
  349|       |
  350|       |    /*
  351|       |     * Internal API, so should not fail - but we do negative testing of this
  352|       |     * so no assert (otherwise the tests fail)
  353|       |     */
  354|  10.9k|    if (pkt->subs == NULL || pkt->subs->parent != NULL)
  ------------------
  |  Branch (354:9): [True: 0, False: 10.9k]
  |  Branch (354:30): [True: 0, False: 10.9k]
  ------------------
  355|      0|        return 0;
  356|       |
  357|  10.9k|    ret = wpacket_intern_close(pkt, pkt->subs, 1);
  358|  10.9k|    if (ret) {
  ------------------
  |  Branch (358:9): [True: 10.9k, False: 0]
  ------------------
  359|  10.9k|        OPENSSL_free(pkt->subs);
  ------------------
  |  |  107|  10.9k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  10.9k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  10.9k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  360|  10.9k|        pkt->subs = NULL;
  361|  10.9k|    }
  362|       |
  363|  10.9k|    return ret;
  364|  10.9k|}
WPACKET_start_sub_packet_len__:
  367|  32.9k|{
  368|  32.9k|    WPACKET_SUB *sub;
  369|  32.9k|    unsigned char *lenchars;
  370|       |
  371|       |    /* Internal API, so should not fail */
  372|  32.9k|    if (!ossl_assert(pkt->subs != NULL))
  ------------------
  |  |   52|  32.9k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  32.9k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (372:9): [True: 0, False: 32.9k]
  ------------------
  373|      0|        return 0;
  374|       |
  375|       |    /* We don't support lenbytes greater than 0 when doing endfirst writing */
  376|  32.9k|    if (lenbytes > 0 && pkt->endfirst)
  ------------------
  |  Branch (376:9): [True: 0, False: 32.9k]
  |  Branch (376:25): [True: 0, False: 0]
  ------------------
  377|      0|        return 0;
  378|       |
  379|  32.9k|    if ((sub = OPENSSL_zalloc(sizeof(*sub))) == NULL)
  ------------------
  |  |   99|  32.9k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  32.9k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  32.9k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (379:9): [True: 0, False: 32.9k]
  ------------------
  380|      0|        return 0;
  381|       |
  382|  32.9k|    sub->parent = pkt->subs;
  383|  32.9k|    pkt->subs = sub;
  384|  32.9k|    sub->pwritten = pkt->written + lenbytes;
  385|  32.9k|    sub->lenbytes = lenbytes;
  386|       |
  387|  32.9k|    if (lenbytes == 0) {
  ------------------
  |  Branch (387:9): [True: 32.9k, False: 0]
  ------------------
  388|  32.9k|        sub->packet_len = 0;
  389|  32.9k|        return 1;
  390|  32.9k|    }
  391|       |
  392|      0|    sub->packet_len = pkt->written;
  393|       |
  394|      0|    if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
  ------------------
  |  Branch (394:9): [True: 0, False: 0]
  ------------------
  395|      0|        return 0;
  396|       |
  397|      0|    return 1;
  398|      0|}
WPACKET_start_sub_packet:
  401|  32.9k|{
  402|  32.9k|    return WPACKET_start_sub_packet_len__(pkt, 0);
  403|  32.9k|}
WPACKET_put_bytes__:
  406|  66.7k|{
  407|  66.7k|    unsigned char *data;
  408|       |
  409|       |    /* Internal API, so should not fail */
  410|  66.7k|    if (!ossl_assert(size <= sizeof(uint64_t))
  ------------------
  |  |   52|   133k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|   133k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (410:9): [True: 0, False: 66.7k]
  ------------------
  411|  66.7k|            || !WPACKET_allocate_bytes(pkt, size, &data)
  ------------------
  |  Branch (411:16): [True: 0, False: 66.7k]
  ------------------
  412|  66.7k|            || !put_value(data, val, size))
  ------------------
  |  Branch (412:16): [True: 0, False: 66.7k]
  ------------------
  413|      0|        return 0;
  414|       |
  415|  66.7k|    return 1;
  416|  66.7k|}
WPACKET_get_total_written:
  487|  10.9k|{
  488|       |    /* Internal API, so should not fail */
  489|  10.9k|    if (!ossl_assert(written != NULL))
  ------------------
  |  |   52|  10.9k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  10.9k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (489:9): [True: 0, False: 10.9k]
  ------------------
  490|      0|        return 0;
  491|       |
  492|  10.9k|    *written = pkt->written;
  493|       |
  494|  10.9k|    return 1;
  495|  10.9k|}
WPACKET_get_length:
  498|  10.9k|{
  499|       |    /* Internal API, so should not fail */
  500|  10.9k|    if (!ossl_assert(pkt->subs != NULL && len != NULL))
  ------------------
  |  |   52|  21.9k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 10.9k, False: 0]
  |  |  |  Branch (52:43): [True: 10.9k, False: 0]
  |  |  ------------------
  |  |   53|  10.9k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (500:9): [True: 0, False: 10.9k]
  ------------------
  501|      0|        return 0;
  502|       |
  503|  10.9k|    *len = pkt->written - pkt->subs->pwritten;
  504|       |
  505|  10.9k|    return 1;
  506|  10.9k|}
WPACKET_get_curr:
  509|  88.6k|{
  510|  88.6k|    unsigned char *buf = GETBUF(pkt);
  ------------------
  |  |   40|  88.6k|#define GETBUF(p)   (((p)->staticbuf != NULL) \
  |  |  ------------------
  |  |  |  Branch (40:22): [True: 2, False: 88.6k]
  |  |  ------------------
  |  |   41|  88.6k|                     ? (p)->staticbuf \
  |  |   42|  88.6k|                     : ((p)->buf != NULL \
  |  |  ------------------
  |  |  |  Branch (42:25): [True: 272, False: 88.4k]
  |  |  ------------------
  |  |   43|  88.6k|                        ? (unsigned char *)(p)->buf->data \
  |  |   44|  88.6k|                        : NULL))
  ------------------
  511|       |
  512|  88.6k|    if (buf == NULL)
  ------------------
  |  Branch (512:9): [True: 88.4k, False: 274]
  ------------------
  513|  88.4k|        return NULL;
  514|       |
  515|    274|    if (pkt->endfirst)
  ------------------
  |  Branch (515:9): [True: 2, False: 272]
  ------------------
  516|      2|        return buf + pkt->maxsize - pkt->curr;
  517|       |
  518|    272|    return buf + pkt->curr;
  519|    274|}
WPACKET_is_null_buf:
  522|  10.9k|{
  523|  10.9k|    return pkt->buf == NULL && pkt->staticbuf == NULL;
  ------------------
  |  Branch (523:12): [True: 10.9k, False: 32]
  |  Branch (523:32): [True: 10.9k, False: 0]
  ------------------
  524|  10.9k|}
WPACKET_cleanup:
  527|      2|{
  528|      2|    WPACKET_SUB *sub, *parent;
  529|       |
  530|      2|    for (sub = pkt->subs; sub != NULL; sub = parent) {
  ------------------
  |  Branch (530:27): [True: 0, False: 2]
  ------------------
  531|      0|        parent = sub->parent;
  532|      0|        OPENSSL_free(sub);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  533|      0|    }
  534|      2|    pkt->subs = NULL;
  535|      2|}
packet.c:maxmaxsize:
   96|  10.9k|{
   97|  10.9k|    if (lenbytes >= sizeof(size_t) || lenbytes == 0)
  ------------------
  |  Branch (97:9): [True: 0, False: 10.9k]
  |  Branch (97:39): [True: 10.9k, False: 0]
  ------------------
   98|  10.9k|        return SIZE_MAX;
   99|       |
  100|      0|    return ((size_t)1 << (lenbytes * 8)) - 1 + lenbytes;
  101|  10.9k|}
packet.c:wpacket_intern_init_len:
  104|  10.9k|{
  105|  10.9k|    unsigned char *lenchars;
  106|       |
  107|  10.9k|    pkt->curr = 0;
  108|  10.9k|    pkt->written = 0;
  109|       |
  110|  10.9k|    if ((pkt->subs = OPENSSL_zalloc(sizeof(*pkt->subs))) == NULL)
  ------------------
  |  |   99|  10.9k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  10.9k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  10.9k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (110:9): [True: 0, False: 10.9k]
  ------------------
  111|      0|        return 0;
  112|       |
  113|  10.9k|    if (lenbytes == 0)
  ------------------
  |  Branch (113:9): [True: 10.9k, False: 0]
  ------------------
  114|  10.9k|        return 1;
  115|       |
  116|      0|    pkt->subs->pwritten = lenbytes;
  117|      0|    pkt->subs->lenbytes = lenbytes;
  118|       |
  119|      0|    if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) {
  ------------------
  |  Branch (119:9): [True: 0, False: 0]
  ------------------
  120|      0|        OPENSSL_free(pkt->subs);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  121|      0|        pkt->subs = NULL;
  122|      0|        return 0;
  123|      0|    }
  124|      0|    pkt->subs->packet_len = 0;
  125|       |
  126|      0|    return 1;
  127|      0|}
packet.c:wpacket_intern_close:
  251|  43.9k|{
  252|  43.9k|    size_t packlen = pkt->written - sub->pwritten;
  253|       |
  254|  43.9k|    if (packlen == 0
  ------------------
  |  Branch (254:9): [True: 2, False: 43.9k]
  ------------------
  255|  43.9k|            && (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0)
  ------------------
  |  |  686|      2|#define WPACKET_FLAGS_NON_ZERO_LENGTH           1
  ------------------
  |  Branch (255:16): [True: 0, False: 2]
  ------------------
  256|      0|        return 0;
  257|       |
  258|  43.9k|    if (packlen == 0
  ------------------
  |  Branch (258:9): [True: 2, False: 43.9k]
  ------------------
  259|  43.9k|            && sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) {
  ------------------
  |  |  692|      2|#define WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH    2
  ------------------
  |  Branch (259:16): [True: 0, False: 2]
  ------------------
  260|       |        /* We can't handle this case. Return an error */
  261|      0|        if (!doclose)
  ------------------
  |  Branch (261:13): [True: 0, False: 0]
  ------------------
  262|      0|            return 0;
  263|       |
  264|       |        /* Deallocate any bytes allocated for the length of the WPACKET */
  265|      0|        if ((pkt->curr - sub->lenbytes) == sub->packet_len) {
  ------------------
  |  Branch (265:13): [True: 0, False: 0]
  ------------------
  266|      0|            pkt->written -= sub->lenbytes;
  267|      0|            pkt->curr -= sub->lenbytes;
  268|      0|        }
  269|       |
  270|       |        /* Don't write out the packet length */
  271|      0|        sub->packet_len = 0;
  272|      0|        sub->lenbytes = 0;
  273|      0|    }
  274|       |
  275|       |    /* Write out the WPACKET length if needed */
  276|  43.9k|    if (sub->lenbytes > 0) {
  ------------------
  |  Branch (276:9): [True: 0, False: 43.9k]
  ------------------
  277|      0|        unsigned char *buf = GETBUF(pkt);
  ------------------
  |  |   40|      0|#define GETBUF(p)   (((p)->staticbuf != NULL) \
  |  |  ------------------
  |  |  |  Branch (40:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   41|      0|                     ? (p)->staticbuf \
  |  |   42|      0|                     : ((p)->buf != NULL \
  |  |  ------------------
  |  |  |  Branch (42:25): [True: 0, False: 0]
  |  |  ------------------
  |  |   43|      0|                        ? (unsigned char *)(p)->buf->data \
  |  |   44|      0|                        : NULL))
  ------------------
  278|       |
  279|      0|        if (buf != NULL) {
  ------------------
  |  Branch (279:13): [True: 0, False: 0]
  ------------------
  280|      0|#if !defined OPENSSL_NO_QUIC && !defined FIPS_MODULE
  281|      0|            if ((sub->flags & WPACKET_FLAGS_QUIC_VLINT) == 0) {
  ------------------
  |  |  695|      0|#define WPACKET_FLAGS_QUIC_VLINT                4
  ------------------
  |  Branch (281:17): [True: 0, False: 0]
  ------------------
  282|      0|                if (!put_value(&buf[sub->packet_len], packlen, sub->lenbytes))
  ------------------
  |  Branch (282:21): [True: 0, False: 0]
  ------------------
  283|      0|                    return 0;
  284|      0|            } else {
  285|      0|                if (!put_quic_value(&buf[sub->packet_len], packlen, sub->lenbytes))
  ------------------
  |  Branch (285:21): [True: 0, False: 0]
  ------------------
  286|      0|                    return 0;
  287|      0|            }
  288|       |#else
  289|       |            if (!put_value(&buf[sub->packet_len], packlen, sub->lenbytes))
  290|       |                return 0;
  291|       |#endif
  292|      0|        }
  293|  43.9k|    } else if (pkt->endfirst && sub->parent != NULL
  ------------------
  |  Branch (293:16): [True: 4, False: 43.9k]
  |  Branch (293:33): [True: 2, False: 2]
  ------------------
  294|  43.9k|               && (packlen != 0
  ------------------
  |  Branch (294:20): [True: 0, False: 2]
  ------------------
  295|      2|                   || (sub->flags
  ------------------
  |  Branch (295:23): [True: 2, False: 0]
  ------------------
  296|      2|                       & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) == 0)) {
  ------------------
  |  |  692|      2|#define WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH    2
  ------------------
  297|      2|        size_t tmplen = packlen;
  298|      2|        size_t numlenbytes = 1;
  299|       |
  300|      2|        while ((tmplen = tmplen >> 8) > 0)
  ------------------
  |  Branch (300:16): [True: 0, False: 2]
  ------------------
  301|      0|            numlenbytes++;
  302|      2|        if (!WPACKET_put_bytes__(pkt, packlen, numlenbytes))
  ------------------
  |  Branch (302:13): [True: 0, False: 2]
  ------------------
  303|      0|            return 0;
  304|      2|        if (packlen > 0x7f) {
  ------------------
  |  Branch (304:13): [True: 0, False: 2]
  ------------------
  305|      0|            numlenbytes |= 0x80;
  306|      0|            if (!WPACKET_put_bytes_u8(pkt, numlenbytes))
  ------------------
  |  |  878|      0|    WPACKET_put_bytes__((pkt), (val), 1)
  ------------------
  |  Branch (306:17): [True: 0, False: 0]
  ------------------
  307|      0|                return 0;
  308|      0|        }
  309|      2|    }
  310|       |
  311|  43.9k|    if (doclose) {
  ------------------
  |  Branch (311:9): [True: 43.9k, False: 0]
  ------------------
  312|  43.9k|        pkt->subs = sub->parent;
  313|  43.9k|        OPENSSL_free(sub);
  ------------------
  |  |  107|  43.9k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  43.9k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  43.9k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  314|  43.9k|    }
  315|       |
  316|  43.9k|    return 1;
  317|  43.9k|}
packet.c:put_value:
  212|  66.7k|{
  213|  66.7k|    if (data == NULL)
  ------------------
  |  Branch (213:9): [True: 66.5k, False: 210]
  ------------------
  214|  66.5k|        return 1;
  215|       |
  216|    428|    for (data += len - 1; len > 0; len--) {
  ------------------
  |  Branch (216:27): [True: 218, False: 210]
  ------------------
  217|    218|        *data = (unsigned char)(value & 0xff);
  218|    218|        data--;
  219|    218|        value >>= 8;
  220|    218|    }
  221|       |
  222|       |    /* Check whether we could fit the value in the assigned number of bytes */
  223|    210|    if (value > 0)
  ------------------
  |  Branch (223:9): [True: 0, False: 210]
  ------------------
  224|      0|        return 0;
  225|       |
  226|    210|    return 1;
  227|    210|}

ossl_param_build_set_int:
   24|  45.2k|{
   25|  45.2k|    if (bld != NULL)
  ------------------
  |  Branch (25:9): [True: 0, False: 45.2k]
  ------------------
   26|      0|        return OSSL_PARAM_BLD_push_int(bld, key, num);
   27|  45.2k|    p = OSSL_PARAM_locate(p, key);
   28|  45.2k|    if (p != NULL)
  ------------------
  |  Branch (28:9): [True: 0, False: 45.2k]
  ------------------
   29|      0|        return OSSL_PARAM_set_int(p, num);
   30|  45.2k|    return 1;
   31|  45.2k|}
ossl_param_build_set_long:
   35|     25|{
   36|     25|    if (bld != NULL)
  ------------------
  |  Branch (36:9): [True: 0, False: 25]
  ------------------
   37|      0|        return OSSL_PARAM_BLD_push_long(bld, key, num);
   38|     25|    p = OSSL_PARAM_locate(p, key);
   39|     25|    if (p != NULL)
  ------------------
  |  Branch (39:9): [True: 0, False: 25]
  ------------------
   40|      0|        return OSSL_PARAM_set_long(p, num);
   41|     25|    return 1;
   42|     25|}
ossl_param_build_set_utf8_string:
   46|  56.4k|{
   47|  56.4k|    if (bld != NULL)
  ------------------
  |  Branch (47:9): [True: 0, False: 56.4k]
  ------------------
   48|      0|        return OSSL_PARAM_BLD_push_utf8_string(bld, key, buf, 0);
   49|  56.4k|    p = OSSL_PARAM_locate(p, key);
   50|  56.4k|    if (p != NULL)
  ------------------
  |  Branch (50:9): [True: 0, False: 56.4k]
  ------------------
   51|      0|        return OSSL_PARAM_set_utf8_string(p, buf);
   52|  56.4k|    return 1;
   53|  56.4k|}
ossl_param_build_set_octet_string:
   59|     26|{
   60|     26|    if (bld != NULL)
  ------------------
  |  Branch (60:9): [True: 0, False: 26]
  ------------------
   61|      0|        return OSSL_PARAM_BLD_push_octet_string(bld, key, data, data_len);
   62|       |
   63|     26|    p = OSSL_PARAM_locate(p, key);
   64|     26|    if (p != NULL)
  ------------------
  |  Branch (64:9): [True: 0, False: 26]
  ------------------
   65|      0|        return OSSL_PARAM_set_octet_string(p, data, data_len);
   66|     26|    return 1;
   67|     26|}
ossl_param_build_set_bn_pad:
   71|    560|{
   72|    560|    if (bld != NULL)
  ------------------
  |  Branch (72:9): [True: 0, False: 560]
  ------------------
   73|      0|        return OSSL_PARAM_BLD_push_BN_pad(bld, key, bn, sz);
   74|    560|    p = OSSL_PARAM_locate(p, key);
   75|    560|    if (p != NULL) {
  ------------------
  |  Branch (75:9): [True: 0, False: 560]
  ------------------
   76|      0|        if (sz > p->data_size) {
  ------------------
  |  Branch (76:13): [True: 0, False: 0]
  ------------------
   77|      0|            ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   78|      0|            return 0;
   79|      0|        }
   80|      0|        p->data_size = sz;
   81|      0|        return OSSL_PARAM_set_BN(p, bn);
   82|      0|    }
   83|    560|    return 1;
   84|    560|}
ossl_param_build_set_bn:
   88|  11.1k|{
   89|  11.1k|    if (bld != NULL)
  ------------------
  |  Branch (89:9): [True: 0, False: 11.1k]
  ------------------
   90|      0|        return OSSL_PARAM_BLD_push_BN(bld, key, bn);
   91|       |
   92|  11.1k|    p = OSSL_PARAM_locate(p, key);
   93|  11.1k|    if (p != NULL)
  ------------------
  |  Branch (93:9): [True: 0, False: 11.1k]
  ------------------
   94|      0|        return OSSL_PARAM_set_BN(p, bn) > 0;
   95|  11.1k|    return 1;
   96|  11.1k|}
ossl_param_build_set_multi_key_bn:
  101|  1.08k|{
  102|  1.08k|    int i, sz = sk_BIGNUM_const_num(stk);
  103|  1.08k|    OSSL_PARAM *p;
  104|       |
  105|       |
  106|  1.08k|    if (bld != NULL) {
  ------------------
  |  Branch (106:9): [True: 0, False: 1.08k]
  ------------------
  107|      0|        for (i = 0; i < sz && names[i] != NULL; ++i) {
  ------------------
  |  Branch (107:21): [True: 0, False: 0]
  |  Branch (107:31): [True: 0, False: 0]
  ------------------
  108|      0|            if (!OSSL_PARAM_BLD_push_BN(bld, names[i],
  ------------------
  |  Branch (108:17): [True: 0, False: 0]
  ------------------
  109|      0|                                        sk_BIGNUM_const_value(stk, i)))
  110|      0|                return 0;
  111|      0|        }
  112|      0|        return 1;
  113|      0|    }
  114|       |
  115|  6.78k|    for (i = 0; i < sz && names[i] != NULL; ++i) {
  ------------------
  |  Branch (115:17): [True: 5.94k, False: 846]
  |  Branch (115:27): [True: 5.69k, False: 243]
  ------------------
  116|  5.69k|        p = OSSL_PARAM_locate(params, names[i]);
  117|  5.69k|        if (p != NULL) {
  ------------------
  |  Branch (117:13): [True: 0, False: 5.69k]
  ------------------
  118|      0|            if (!OSSL_PARAM_set_BN(p, sk_BIGNUM_const_value(stk, i)))
  ------------------
  |  Branch (118:17): [True: 0, False: 0]
  ------------------
  119|      0|                return 0;
  120|      0|        }
  121|  5.69k|    }
  122|  1.08k|    return 1;
  123|  1.08k|}

OSSL_PARAM_locate:
   54|   758k|{
   55|   758k|    if (p != NULL && key != NULL)
  ------------------
  |  Branch (55:9): [True: 758k, False: 6]
  |  Branch (55:22): [True: 758k, False: 0]
  ------------------
   56|  2.08M|        for (; p->key != NULL; p++)
  ------------------
  |  Branch (56:16): [True: 1.60M, False: 478k]
  ------------------
   57|  1.60M|            if (strcmp(key, p->key) == 0)
  ------------------
  |  Branch (57:17): [True: 280k, False: 1.32M]
  ------------------
   58|   280k|                return p;
   59|   478k|    return NULL;
   60|   758k|}
OSSL_PARAM_locate_const:
   63|   355k|{
   64|   355k|    return OSSL_PARAM_locate((OSSL_PARAM *)p, key);
   65|   355k|}
OSSL_PARAM_get_int:
  256|  28.2k|{
  257|  28.2k|#ifndef OPENSSL_SMALL_FOOTPRINT
  258|  28.2k|    switch (sizeof(int)) {
  ------------------
  |  Branch (258:13): [Folded - Ignored]
  ------------------
  259|  28.2k|    case sizeof(int32_t):
  ------------------
  |  Branch (259:5): [True: 28.2k, False: 0]
  ------------------
  260|  28.2k|        return OSSL_PARAM_get_int32(p, (int32_t *)val);
  261|      0|    case sizeof(int64_t):
  ------------------
  |  Branch (261:5): [True: 0, False: 28.2k]
  ------------------
  262|      0|        return OSSL_PARAM_get_int64(p, (int64_t *)val);
  263|  28.2k|    }
  264|      0|#endif
  265|      0|    return general_get_int(p, val, sizeof(*val));
  266|  28.2k|}
OSSL_PARAM_set_int:
  269|  45.0k|{
  270|  45.0k|#ifndef OPENSSL_SMALL_FOOTPRINT
  271|  45.0k|    switch (sizeof(int)) {
  ------------------
  |  Branch (271:13): [Folded - Ignored]
  ------------------
  272|  45.0k|    case sizeof(int32_t):
  ------------------
  |  Branch (272:5): [True: 45.0k, False: 0]
  ------------------
  273|  45.0k|        return OSSL_PARAM_set_int32(p, (int32_t)val);
  274|      0|    case sizeof(int64_t):
  ------------------
  |  Branch (274:5): [True: 0, False: 45.0k]
  ------------------
  275|      0|        return OSSL_PARAM_set_int64(p, (int64_t)val);
  276|  45.0k|    }
  277|      0|#endif
  278|      0|    return general_set_int(p, &val, sizeof(val));
  279|  45.0k|}
OSSL_PARAM_construct_int:
  282|  94.3k|{
  283|  94.3k|    return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(int));
  ------------------
  |  |  106|  94.3k|# define OSSL_PARAM_INTEGER              1
  ------------------
  284|  94.3k|}
OSSL_PARAM_construct_uint:
  313|      2|{
  314|      2|    return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
  ------------------
  |  |  107|      2|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  315|      2|                                sizeof(unsigned int));
  316|      2|}
OSSL_PARAM_get_int32:
  382|  28.2k|{
  383|  28.2k|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (383:9): [True: 0, False: 28.2k]
  |  Branch (383:24): [True: 0, False: 28.2k]
  ------------------
  384|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  385|      0|        return 0;
  386|      0|    }
  387|       |
  388|  28.2k|    if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|  28.2k|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (388:9): [True: 28.2k, False: 0]
  ------------------
  389|  28.2k|#ifndef OPENSSL_SMALL_FOOTPRINT
  390|  28.2k|        int64_t i64;
  391|       |
  392|  28.2k|        switch (p->data_size) {
  ------------------
  |  Branch (392:17): [True: 0, False: 28.2k]
  ------------------
  393|  28.2k|        case sizeof(int32_t):
  ------------------
  |  Branch (393:9): [True: 28.2k, False: 0]
  ------------------
  394|  28.2k|            *val = *(const int32_t *)p->data;
  395|  28.2k|            return 1;
  396|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (396:9): [True: 0, False: 28.2k]
  ------------------
  397|      0|            i64 = *(const int64_t *)p->data;
  398|      0|            if (i64 >= INT32_MIN && i64 <= INT32_MAX) {
  ------------------
  |  Branch (398:17): [True: 0, False: 0]
  |  Branch (398:37): [True: 0, False: 0]
  ------------------
  399|      0|                *val = (int32_t)i64;
  400|      0|                return 1;
  401|      0|            }
  402|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  403|      0|            return 0;
  404|  28.2k|        }
  405|      0|#endif
  406|      0|        return general_get_int(p, val, sizeof(*val));
  407|       |
  408|  28.2k|    } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|      0|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (408:16): [True: 0, False: 0]
  ------------------
  409|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  410|      0|        uint32_t u32;
  411|      0|        uint64_t u64;
  412|       |
  413|      0|        switch (p->data_size) {
  ------------------
  |  Branch (413:17): [True: 0, False: 0]
  ------------------
  414|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (414:9): [True: 0, False: 0]
  ------------------
  415|      0|            u32 = *(const uint32_t *)p->data;
  416|      0|            if (u32 <= INT32_MAX) {
  ------------------
  |  Branch (416:17): [True: 0, False: 0]
  ------------------
  417|      0|                *val = (int32_t)u32;
  418|      0|                return 1;
  419|      0|            }
  420|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  421|      0|            return 0;
  422|      0|        case sizeof(uint64_t):
  ------------------
  |  Branch (422:9): [True: 0, False: 0]
  ------------------
  423|      0|            u64 = *(const uint64_t *)p->data;
  424|      0|            if (u64 <= INT32_MAX) {
  ------------------
  |  Branch (424:17): [True: 0, False: 0]
  ------------------
  425|      0|                *val = (int32_t)u64;
  426|      0|                return 1;
  427|      0|            }
  428|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  429|      0|            return 0;
  430|      0|        }
  431|      0|#endif
  432|      0|        return general_get_int(p, val, sizeof(*val));
  433|       |
  434|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (434:16): [True: 0, False: 0]
  ------------------
  435|      0|#ifndef OPENSSL_SYS_UEFI
  436|      0|        double d;
  437|       |
  438|      0|        switch (p->data_size) {
  ------------------
  |  Branch (438:17): [True: 0, False: 0]
  ------------------
  439|      0|        case sizeof(double):
  ------------------
  |  Branch (439:9): [True: 0, False: 0]
  ------------------
  440|      0|            d = *(const double *)p->data;
  441|      0|            if (d >= INT32_MIN && d <= INT32_MAX && d == (int32_t)d) {
  ------------------
  |  Branch (441:17): [True: 0, False: 0]
  |  Branch (441:35): [True: 0, False: 0]
  |  Branch (441:53): [True: 0, False: 0]
  ------------------
  442|      0|                *val = (int32_t)d;
  443|      0|                return 1;
  444|      0|            }
  445|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  446|      0|            return 0;
  447|      0|        }
  448|      0|        err_unsupported_real;
  ------------------
  |  |   39|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  449|      0|        return 0;
  450|      0|#endif
  451|      0|    }
  452|      0|    err_bad_type;
  ------------------
  |  |   35|  28.2k|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  453|      0|    return 0;
  454|  28.2k|}
OSSL_PARAM_set_int32:
  457|  45.0k|{
  458|  45.0k|    uint32_t u32;
  459|  45.0k|    unsigned int shift;
  460|       |
  461|  45.0k|    if (p == NULL) {
  ------------------
  |  Branch (461:9): [True: 0, False: 45.0k]
  ------------------
  462|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  463|      0|        return 0;
  464|      0|    }
  465|  45.0k|    p->return_size = 0;
  466|  45.0k|    if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|  45.0k|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (466:9): [True: 45.0k, False: 0]
  ------------------
  467|  45.0k|#ifndef OPENSSL_SMALL_FOOTPRINT
  468|  45.0k|        p->return_size = sizeof(int32_t); /* Minimum expected size */
  469|  45.0k|        if (p->data == NULL)
  ------------------
  |  Branch (469:13): [True: 0, False: 45.0k]
  ------------------
  470|      0|            return 1;
  471|  45.0k|        switch (p->data_size) {
  ------------------
  |  Branch (471:17): [True: 0, False: 45.0k]
  ------------------
  472|  45.0k|        case sizeof(int32_t):
  ------------------
  |  Branch (472:9): [True: 45.0k, False: 0]
  ------------------
  473|  45.0k|            *(int32_t *)p->data = val;
  474|  45.0k|            return 1;
  475|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (475:9): [True: 0, False: 45.0k]
  ------------------
  476|      0|            p->return_size = sizeof(int64_t);
  477|      0|            *(int64_t *)p->data = (int64_t)val;
  478|      0|            return 1;
  479|  45.0k|        }
  480|      0|#endif
  481|      0|        return general_set_int(p, &val, sizeof(val));
  482|  45.0k|    } else if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER && val >= 0) {
  ------------------
  |  |  107|      0|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (482:16): [True: 0, False: 0]
  |  Branch (482:63): [True: 0, False: 0]
  ------------------
  483|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  484|      0|        p->return_size = sizeof(uint32_t); /* Minimum expected size */
  485|      0|        if (p->data == NULL)
  ------------------
  |  Branch (485:13): [True: 0, False: 0]
  ------------------
  486|      0|            return 1;
  487|      0|        switch (p->data_size) {
  ------------------
  |  Branch (487:17): [True: 0, False: 0]
  ------------------
  488|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (488:9): [True: 0, False: 0]
  ------------------
  489|      0|            *(uint32_t *)p->data = (uint32_t)val;
  490|      0|            return 1;
  491|      0|        case sizeof(uint64_t):
  ------------------
  |  Branch (491:9): [True: 0, False: 0]
  ------------------
  492|      0|            p->return_size = sizeof(uint64_t);
  493|      0|            *(uint64_t *)p->data = (uint64_t)val;
  494|      0|            return 1;
  495|      0|        }
  496|      0|#endif
  497|      0|        return general_set_int(p, &val, sizeof(val));
  498|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (498:16): [True: 0, False: 0]
  ------------------
  499|      0|#ifndef OPENSSL_SYS_UEFI
  500|      0|        p->return_size = sizeof(double);
  501|      0|        if (p->data == NULL)
  ------------------
  |  Branch (501:13): [True: 0, False: 0]
  ------------------
  502|      0|            return 1;
  503|      0|        switch (p->data_size) {
  ------------------
  |  Branch (503:17): [True: 0, False: 0]
  ------------------
  504|      0|        case sizeof(double):
  ------------------
  |  Branch (504:9): [True: 0, False: 0]
  ------------------
  505|      0|            shift = real_shift();
  506|      0|            if (shift < 8 * sizeof(val) - 1) {
  ------------------
  |  Branch (506:17): [True: 0, False: 0]
  ------------------
  507|      0|                u32 = val < 0 ? -val : val;
  ------------------
  |  Branch (507:23): [True: 0, False: 0]
  ------------------
  508|      0|                if ((u32 >> shift) != 0) {
  ------------------
  |  Branch (508:21): [True: 0, False: 0]
  ------------------
  509|      0|                    err_inexact;
  ------------------
  |  |   28|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  510|      0|                    return 0;
  511|      0|                }
  512|      0|            }
  513|      0|            *(double *)p->data = (double)val;
  514|      0|            return 1;
  515|      0|        }
  516|      0|        err_unsupported_real;
  ------------------
  |  |   39|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  517|      0|        return 0;
  518|      0|#endif
  519|      0|    }
  520|      0|    err_bad_type;
  ------------------
  |  |   35|  45.0k|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  521|      0|    return 0;
  522|  45.0k|}
OSSL_PARAM_get_uint64:
  826|      2|{
  827|      2|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (827:9): [True: 0, False: 2]
  |  Branch (827:24): [True: 0, False: 2]
  ------------------
  828|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  829|      0|        return 0;
  830|      0|    }
  831|       |
  832|      2|    if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|      2|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (832:9): [True: 2, False: 0]
  ------------------
  833|      2|#ifndef OPENSSL_SMALL_FOOTPRINT
  834|      2|        switch (p->data_size) {
  ------------------
  |  Branch (834:17): [True: 0, False: 2]
  ------------------
  835|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (835:9): [True: 0, False: 2]
  ------------------
  836|      0|            *val = *(const uint32_t *)p->data;
  837|      0|            return 1;
  838|      2|        case sizeof(uint64_t):
  ------------------
  |  Branch (838:9): [True: 2, False: 0]
  ------------------
  839|      2|            *val = *(const uint64_t *)p->data;
  840|      2|            return 1;
  841|      2|        }
  842|      0|#endif
  843|      0|        return general_get_uint(p, val, sizeof(*val));
  844|      2|    } else if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      0|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (844:16): [True: 0, False: 0]
  ------------------
  845|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  846|      0|        int32_t i32;
  847|      0|        int64_t i64;
  848|       |
  849|      0|        switch (p->data_size) {
  ------------------
  |  Branch (849:17): [True: 0, False: 0]
  ------------------
  850|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (850:9): [True: 0, False: 0]
  ------------------
  851|      0|            i32 = *(const int32_t *)p->data;
  852|      0|            if (i32 >= 0) {
  ------------------
  |  Branch (852:17): [True: 0, False: 0]
  ------------------
  853|      0|                *val = (uint64_t)i32;
  854|      0|                return 1;
  855|      0|            }
  856|      0|            err_unsigned_negative;
  ------------------
  |  |   22|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   23|      0|              CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED)
  ------------------
  857|      0|            return 0;
  858|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (858:9): [True: 0, False: 0]
  ------------------
  859|      0|            i64 = *(const int64_t *)p->data;
  860|      0|            if (i64 >= 0) {
  ------------------
  |  Branch (860:17): [True: 0, False: 0]
  ------------------
  861|      0|                *val = (uint64_t)i64;
  862|      0|                return 1;
  863|      0|            }
  864|      0|            err_unsigned_negative;
  ------------------
  |  |   22|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   23|      0|              CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED)
  ------------------
  865|      0|            return 0;
  866|      0|        }
  867|      0|#endif
  868|      0|        return general_get_uint(p, val, sizeof(*val));
  869|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (869:16): [True: 0, False: 0]
  ------------------
  870|      0|#ifndef OPENSSL_SYS_UEFI
  871|      0|        double d;
  872|       |
  873|      0|        switch (p->data_size) {
  ------------------
  |  Branch (873:17): [True: 0, False: 0]
  ------------------
  874|      0|        case sizeof(double):
  ------------------
  |  Branch (874:9): [True: 0, False: 0]
  ------------------
  875|      0|            d = *(const double *)p->data;
  876|      0|            if (d >= 0
  ------------------
  |  Branch (876:17): [True: 0, False: 0]
  ------------------
  877|       |                    /*
  878|       |                     * By subtracting 65535 (2^16-1) we cancel the low order
  879|       |                     * 15 bits of UINT64_MAX to avoid using imprecise floating
  880|       |                     * point values.
  881|       |                     */
  882|      0|                    && d < (double)(UINT64_MAX - 65535) + 65536.0
  ------------------
  |  Branch (882:24): [True: 0, False: 0]
  ------------------
  883|      0|                    && d == (uint64_t)d) {
  ------------------
  |  Branch (883:24): [True: 0, False: 0]
  ------------------
  884|      0|                *val = (uint64_t)d;
  885|      0|                return 1;
  886|      0|            }
  887|      0|            err_inexact;
  ------------------
  |  |   28|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  888|      0|            return 0;
  889|      0|        }
  890|      0|        err_unsupported_real;
  ------------------
  |  |   39|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  891|      0|        return 0;
  892|      0|#endif
  893|      0|    }
  894|      0|    err_bad_type;
  ------------------
  |  |   35|      2|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  895|      0|    return 0;
  896|      2|}
OSSL_PARAM_set_uint64:
  899|  52.6k|{
  900|  52.6k|    if (p == NULL) {
  ------------------
  |  Branch (900:9): [True: 0, False: 52.6k]
  ------------------
  901|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  902|      0|        return 0;
  903|      0|    }
  904|  52.6k|    p->return_size = 0;
  905|       |
  906|  52.6k|    if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) {
  ------------------
  |  |  107|  52.6k|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
  |  Branch (906:9): [True: 52.6k, False: 0]
  ------------------
  907|  52.6k|#ifndef OPENSSL_SMALL_FOOTPRINT
  908|  52.6k|        p->return_size = sizeof(uint64_t); /* Expected size */
  909|  52.6k|        if (p->data == NULL)
  ------------------
  |  Branch (909:13): [True: 0, False: 52.6k]
  ------------------
  910|      0|            return 1;
  911|  52.6k|        switch (p->data_size) {
  ------------------
  |  Branch (911:17): [True: 0, False: 52.6k]
  ------------------
  912|      0|        case sizeof(uint32_t):
  ------------------
  |  Branch (912:9): [True: 0, False: 52.6k]
  ------------------
  913|      0|            if (val <= UINT32_MAX) {
  ------------------
  |  Branch (913:17): [True: 0, False: 0]
  ------------------
  914|      0|                p->return_size = sizeof(uint32_t);
  915|      0|                *(uint32_t *)p->data = (uint32_t)val;
  916|      0|                return 1;
  917|      0|            }
  918|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  919|      0|            return 0;
  920|  52.6k|        case sizeof(uint64_t):
  ------------------
  |  Branch (920:9): [True: 52.6k, False: 0]
  ------------------
  921|  52.6k|            *(uint64_t *)p->data = val;
  922|  52.6k|            return 1;
  923|  52.6k|        }
  924|      0|#endif
  925|      0|        return general_set_uint(p, &val, sizeof(val));
  926|  52.6k|    } else if (p->data_type == OSSL_PARAM_INTEGER) {
  ------------------
  |  |  106|      0|# define OSSL_PARAM_INTEGER              1
  ------------------
  |  Branch (926:16): [True: 0, False: 0]
  ------------------
  927|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  928|      0|        p->return_size = sizeof(int64_t); /* Expected size */
  929|      0|        if (p->data == NULL)
  ------------------
  |  Branch (929:13): [True: 0, False: 0]
  ------------------
  930|      0|            return 1;
  931|      0|        switch (p->data_size) {
  ------------------
  |  Branch (931:17): [True: 0, False: 0]
  ------------------
  932|      0|        case sizeof(int32_t):
  ------------------
  |  Branch (932:9): [True: 0, False: 0]
  ------------------
  933|      0|            if (val <= INT32_MAX) {
  ------------------
  |  Branch (933:17): [True: 0, False: 0]
  ------------------
  934|      0|                p->return_size = sizeof(int32_t);
  935|      0|                *(int32_t *)p->data = (int32_t)val;
  936|      0|                return 1;
  937|      0|            }
  938|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  939|      0|            return 0;
  940|      0|        case sizeof(int64_t):
  ------------------
  |  Branch (940:9): [True: 0, False: 0]
  ------------------
  941|      0|            if (val <= INT64_MAX) {
  ------------------
  |  Branch (941:17): [True: 0, False: 0]
  ------------------
  942|      0|                *(int64_t *)p->data = (int64_t)val;
  943|      0|                return 1;
  944|      0|            }
  945|      0|            err_out_of_range;
  ------------------
  |  |   25|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   26|      0|              CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION)
  ------------------
  946|      0|            return 0;
  947|      0|        }
  948|      0|#endif
  949|      0|        return general_set_uint(p, &val, sizeof(val));
  950|      0|    } else if (p->data_type == OSSL_PARAM_REAL) {
  ------------------
  |  |  112|      0|# define OSSL_PARAM_REAL                 3
  ------------------
  |  Branch (950:16): [True: 0, False: 0]
  ------------------
  951|      0|#ifndef OPENSSL_SYS_UEFI
  952|      0|        p->return_size = sizeof(double);
  953|      0|        switch (p->data_size) {
  ------------------
  |  Branch (953:17): [True: 0, False: 0]
  ------------------
  954|      0|        case sizeof(double):
  ------------------
  |  Branch (954:9): [True: 0, False: 0]
  ------------------
  955|      0|            if ((val >> real_shift()) == 0) {
  ------------------
  |  Branch (955:17): [True: 0, False: 0]
  ------------------
  956|      0|                *(double *)p->data = (double)val;
  957|      0|                return 1;
  958|      0|            }
  959|      0|            err_inexact;
  ------------------
  |  |   28|      0|    ERR_raise(ERR_LIB_CRYPTO, \
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   29|      0|              CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY)
  ------------------
  960|      0|            return 0;
  961|      0|        }
  962|      0|        err_unsupported_real;
  ------------------
  |  |   39|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  963|      0|        return 0;
  964|      0|#endif
  965|      0|    }
  966|      0|    err_bad_type;
  ------------------
  |  |   35|  52.6k|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|    return 0;
  968|  52.6k|}
OSSL_PARAM_get_size_t:
  977|      2|{
  978|      2|#ifndef OPENSSL_SMALL_FOOTPRINT
  979|      2|    switch (sizeof(size_t)) {
  ------------------
  |  Branch (979:13): [Folded - Ignored]
  ------------------
  980|      0|    case sizeof(uint32_t):
  ------------------
  |  Branch (980:5): [True: 0, False: 2]
  ------------------
  981|      0|        return OSSL_PARAM_get_uint32(p, (uint32_t *)val);
  982|      2|    case sizeof(uint64_t):
  ------------------
  |  Branch (982:5): [True: 2, False: 0]
  ------------------
  983|      2|        return OSSL_PARAM_get_uint64(p, (uint64_t *)val);
  984|      2|    }
  985|      0|#endif
  986|      0|    return general_get_uint(p, val, sizeof(*val));
  987|      2|}
OSSL_PARAM_set_size_t:
  990|  52.6k|{
  991|  52.6k|#ifndef OPENSSL_SMALL_FOOTPRINT
  992|  52.6k|    switch (sizeof(size_t)) {
  ------------------
  |  Branch (992:13): [Folded - Ignored]
  ------------------
  993|      0|    case sizeof(uint32_t):
  ------------------
  |  Branch (993:5): [True: 0, False: 52.6k]
  ------------------
  994|      0|        return OSSL_PARAM_set_uint32(p, (uint32_t)val);
  995|  52.6k|    case sizeof(uint64_t):
  ------------------
  |  Branch (995:5): [True: 52.6k, False: 0]
  ------------------
  996|  52.6k|        return OSSL_PARAM_set_uint64(p, (uint64_t)val);
  997|  52.6k|    }
  998|      0|#endif
  999|      0|    return general_set_uint(p, &val, sizeof(val));
 1000|  52.6k|}
OSSL_PARAM_construct_size_t:
 1003|  52.6k|{
 1004|  52.6k|    return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
  ------------------
  |  |  107|  52.6k|# define OSSL_PARAM_UNSIGNED_INTEGER     2
  ------------------
 1005|  52.6k|                                sizeof(size_t));
 1006|  52.6k|}
OSSL_PARAM_construct_time_t:
 1035|      2|{
 1036|      2|    return ossl_param_construct(key, OSSL_PARAM_INTEGER, buf, sizeof(time_t));
  ------------------
  |  |  106|      2|# define OSSL_PARAM_INTEGER              1
  ------------------
 1037|      2|}
OSSL_PARAM_get_utf8_string:
 1327|  46.0k|{
 1328|  46.0k|    int ret = get_string_internal(p, (void **)val, &max_len, NULL,
 1329|  46.0k|                                  OSSL_PARAM_UTF8_STRING);
  ------------------
  |  |  117|  46.0k|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
 1330|       |
 1331|       |    /*
 1332|       |     * We try to ensure that the copied string is terminated with a
 1333|       |     * NUL byte.  That should be easy, just place a NUL byte at
 1334|       |     * |((char*)*val)[p->data_size]|.
 1335|       |     * Unfortunately, we have seen cases where |p->data_size| doesn't
 1336|       |     * correctly reflect the length of the string, and just happens
 1337|       |     * to be out of bounds according to |max_len|, so in that case, we
 1338|       |     * make the extra step of trying to find the true length of the
 1339|       |     * string that |p->data| points at, and use that as an index to
 1340|       |     * place the NUL byte in |*val|.
 1341|       |     */
 1342|  46.0k|    size_t data_length = p->data_size;
 1343|       |
 1344|  46.0k|    if (ret == 0)
  ------------------
  |  Branch (1344:9): [True: 0, False: 46.0k]
  ------------------
 1345|      0|        return 0;
 1346|  46.0k|    if (data_length >= max_len)
  ------------------
  |  Branch (1346:9): [True: 0, False: 46.0k]
  ------------------
 1347|      0|        data_length = OPENSSL_strnlen(p->data, data_length);
 1348|  46.0k|    if (data_length >= max_len) {
  ------------------
  |  Branch (1348:9): [True: 0, False: 46.0k]
  ------------------
 1349|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1350|      0|        return 0;            /* No space for a terminating NUL byte */
 1351|      0|    }
 1352|  46.0k|    (*val)[data_length] = '\0';
 1353|       |
 1354|  46.0k|    return ret;
 1355|  46.0k|}
OSSL_PARAM_construct_utf8_string:
 1419|  77.1k|{
 1420|  77.1k|    if (buf != NULL && bsize == 0)
  ------------------
  |  Branch (1420:9): [True: 77.1k, False: 0]
  |  Branch (1420:24): [True: 77.1k, False: 0]
  ------------------
 1421|  77.1k|        bsize = strlen(buf);
 1422|  77.1k|    return ossl_param_construct(key, OSSL_PARAM_UTF8_STRING, buf, bsize);
  ------------------
  |  |  117|  77.1k|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
 1423|  77.1k|}
OSSL_PARAM_construct_octet_string:
 1427|  46.0k|{
 1428|  46.0k|    return ossl_param_construct(key, OSSL_PARAM_OCTET_STRING, buf, bsize);
  ------------------
  |  |  123|  46.0k|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
 1429|  46.0k|}
OSSL_PARAM_get_utf8_ptr:
 1449|  62.1k|{
 1450|  62.1k|    return get_ptr_internal(p, (const void **)val, NULL, OSSL_PARAM_UTF8_PTR);
  ------------------
  |  |  141|  62.1k|# define OSSL_PARAM_UTF8_PTR             6
  ------------------
 1451|  62.1k|}
OSSL_PARAM_construct_end:
 1612|  61.0k|{
 1613|  61.0k|    OSSL_PARAM end = OSSL_PARAM_END;
  ------------------
  |  |   25|  61.0k|    { NULL, 0, NULL, 0, 0 }
  ------------------
 1614|       |
 1615|  61.0k|    return end;
 1616|  61.0k|}
OSSL_PARAM_get_utf8_string_ptr:
 1636|  62.1k|{
 1637|  62.1k|    int rv;
 1638|       |
 1639|  62.1k|    ERR_set_mark();
 1640|  62.1k|    rv = OSSL_PARAM_get_utf8_ptr(p, val);
 1641|  62.1k|    ERR_pop_to_mark();
 1642|       |
 1643|  62.1k|    return rv || get_string_ptr_internal(p, (const void **)val, NULL,
  ------------------
  |  Branch (1643:12): [True: 0, False: 62.1k]
  |  Branch (1643:18): [True: 62.1k, False: 0]
  ------------------
 1644|  62.1k|                                         OSSL_PARAM_UTF8_STRING);
  ------------------
  |  |  117|  62.1k|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
 1645|  62.1k|}
params.c:ossl_param_construct:
   69|   270k|{
   70|   270k|    OSSL_PARAM res;
   71|       |
   72|   270k|    res.key = key;
   73|   270k|    res.data_type = data_type;
   74|   270k|    res.data = data;
   75|   270k|    res.data_size = data_size;
   76|   270k|    res.return_size = OSSL_PARAM_UNMODIFIED;
  ------------------
  |  |   22|   270k|# define OSSL_PARAM_UNMODIFIED ((size_t)-1)
  ------------------
   77|   270k|    return res;
   78|   270k|}
params.c:get_string_internal:
 1279|  46.0k|{
 1280|  46.0k|    size_t sz, alloc_sz;
 1281|       |
 1282|  46.0k|    if ((val == NULL && used_len == NULL) || p == NULL) {
  ------------------
  |  Branch (1282:10): [True: 0, False: 46.0k]
  |  Branch (1282:25): [True: 0, False: 0]
  |  Branch (1282:46): [True: 0, False: 46.0k]
  ------------------
 1283|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1284|      0|        return 0;
 1285|      0|    }
 1286|  46.0k|    if (p->data_type != type) {
  ------------------
  |  Branch (1286:9): [True: 0, False: 46.0k]
  ------------------
 1287|      0|        err_bad_type;
  ------------------
  |  |   35|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1288|      0|        return 0;
 1289|      0|    }
 1290|       |
 1291|  46.0k|    sz = p->data_size;
 1292|       |    /*
 1293|       |     * If the input size is 0, or the input string needs NUL byte
 1294|       |     * termination, allocate an extra byte.
 1295|       |     */
 1296|  46.0k|    alloc_sz = sz + (type == OSSL_PARAM_UTF8_STRING || sz == 0);
  ------------------
  |  |  117|  92.1k|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (1296:22): [True: 46.0k, False: 0]
  |  Branch (1296:56): [True: 0, False: 0]
  ------------------
 1297|       |
 1298|  46.0k|    if (used_len != NULL)
  ------------------
  |  Branch (1298:9): [True: 0, False: 46.0k]
  ------------------
 1299|      0|        *used_len = sz;
 1300|       |
 1301|  46.0k|    if (p->data == NULL) {
  ------------------
  |  Branch (1301:9): [True: 0, False: 46.0k]
  ------------------
 1302|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1303|      0|        return 0;
 1304|      0|    }
 1305|       |
 1306|  46.0k|    if (val == NULL)
  ------------------
  |  Branch (1306:9): [True: 0, False: 46.0k]
  ------------------
 1307|      0|        return 1;
 1308|       |
 1309|  46.0k|    if (*val == NULL) {
  ------------------
  |  Branch (1309:9): [True: 46.0k, False: 0]
  ------------------
 1310|  46.0k|        char *const q = OPENSSL_malloc(alloc_sz);
  ------------------
  |  |   97|  46.0k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  46.0k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  46.0k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1311|       |
 1312|  46.0k|        if (q == NULL)
  ------------------
  |  Branch (1312:13): [True: 0, False: 46.0k]
  ------------------
 1313|      0|            return 0;
 1314|  46.0k|        *val = q;
 1315|  46.0k|        *max_len = alloc_sz;
 1316|  46.0k|    }
 1317|       |
 1318|  46.0k|    if (*max_len < sz) {
  ------------------
  |  Branch (1318:9): [True: 0, False: 46.0k]
  ------------------
 1319|      0|        err_too_small;
  ------------------
  |  |   33|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1320|      0|        return 0;
 1321|      0|    }
 1322|  46.0k|    memcpy(*val, p->data, sz);
 1323|  46.0k|    return 1;
 1324|  46.0k|}
params.c:get_ptr_internal:
 1433|  62.1k|{
 1434|  62.1k|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (1434:9): [True: 0, False: 62.1k]
  |  Branch (1434:24): [True: 0, False: 62.1k]
  ------------------
 1435|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1436|      0|        return 0;
 1437|      0|    }
 1438|  62.1k|    if (p->data_type != type) {
  ------------------
  |  Branch (1438:9): [True: 62.1k, False: 0]
  ------------------
 1439|  62.1k|        err_bad_type;
  ------------------
  |  |   35|  62.1k|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|  62.1k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|  62.1k|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|  62.1k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|  62.1k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|  62.1k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|  62.1k|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|  62.1k|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1440|  62.1k|        return 0;
 1441|  62.1k|    }
 1442|      0|    if (used_len != NULL)
  ------------------
  |  Branch (1442:9): [True: 0, False: 0]
  ------------------
 1443|      0|        *used_len = p->data_size;
 1444|      0|    *val = *(const void **)p->data;
 1445|      0|    return 1;
 1446|  62.1k|}
params.c:get_string_ptr_internal:
 1620|  62.1k|{
 1621|  62.1k|    if (val == NULL || p == NULL) {
  ------------------
  |  Branch (1621:9): [True: 0, False: 62.1k]
  |  Branch (1621:24): [True: 0, False: 62.1k]
  ------------------
 1622|      0|        err_null_argument;
  ------------------
  |  |   37|      0|    ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1623|      0|        return 0;
 1624|      0|    }
 1625|  62.1k|    if (p->data_type != type) {
  ------------------
  |  Branch (1625:9): [True: 0, False: 62.1k]
  ------------------
 1626|      0|        err_bad_type;
  ------------------
  |  |   35|      0|    ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE)
  |  |  ------------------
  |  |  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  |  |  ------------------
  |  |  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  405|      0|     ERR_set_error)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1627|      0|        return 0;
 1628|      0|    }
 1629|  62.1k|    if (used_len != NULL)
  ------------------
  |  Branch (1629:9): [True: 0, False: 62.1k]
  ------------------
 1630|      0|        *used_len = p->data_size;
 1631|  62.1k|    *val = p->data;
 1632|  62.1k|    return 1;
 1633|  62.1k|}

ossl_pw_clear_passphrase_data:
   17|  82.1k|{
   18|  82.1k|    if (data != NULL) {
  ------------------
  |  Branch (18:9): [True: 82.1k, False: 0]
  ------------------
   19|  82.1k|        if (data->type == is_expl_passphrase)
  ------------------
  |  Branch (19:13): [True: 0, False: 82.1k]
  ------------------
   20|      0|            OPENSSL_clear_free(data->_.expl_passphrase.passphrase_copy,
  ------------------
  |  |  105|      0|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   21|  82.1k|                               data->_.expl_passphrase.passphrase_len);
   22|  82.1k|        ossl_pw_clear_passphrase_cache(data);
   23|  82.1k|        memset(data, 0, sizeof(*data));
   24|  82.1k|    }
   25|  82.1k|}
ossl_pw_clear_passphrase_cache:
   28|   126k|{
   29|   126k|    OPENSSL_clear_free(data->cached_passphrase, data->cached_passphrase_len);
  ------------------
  |  |  105|   126k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   126k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   126k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   30|   126k|    data->cached_passphrase = NULL;
   31|   126k|}
ossl_pw_set_ossl_passphrase_cb:
   68|  1.60k|{
   69|  1.60k|    if (!ossl_assert(data != NULL && cb != NULL)) {
  ------------------
  |  |   52|  3.20k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 1.60k, False: 0]
  |  |  |  Branch (52:43): [True: 1.60k, False: 0]
  |  |  ------------------
  |  |   53|  1.60k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (69:9): [True: 0, False: 1.60k]
  ------------------
   70|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   71|      0|        return 0;
   72|      0|    }
   73|  1.60k|    ossl_pw_clear_passphrase_data(data);
   74|  1.60k|    data->type = is_ossl_passphrase;
   75|  1.60k|    data->_.ossl_passphrase.passphrase_cb = cb;
   76|  1.60k|    data->_.ossl_passphrase.passphrase_cbarg = cbarg;
   77|  1.60k|    return 1;
   78|  1.60k|}
ossl_pw_enable_passphrase_caching:
   95|  44.1k|{
   96|  44.1k|    data->flag_cache_passphrase = 1;
   97|  44.1k|    return 1;
   98|  44.1k|}

ossl_err_load_PEM_strings:
   68|      2|{
   69|      2|#ifndef OPENSSL_NO_ERR
   70|      2|    if (ERR_reason_error_string(PEM_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (70:9): [True: 2, False: 0]
  ------------------
   71|      2|        ERR_load_strings_const(PEM_str_reasons);
   72|      2|#endif
   73|      2|    return 1;
   74|      2|}

ossl_err_load_PKCS12_strings:
   56|      2|{
   57|      2|#ifndef OPENSSL_NO_ERR
   58|      2|    if (ERR_reason_error_string(PKCS12_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (58:9): [True: 2, False: 0]
  ------------------
   59|      2|        ERR_load_strings_const(PKCS12_str_reasons);
   60|      2|#endif
   61|      2|    return 1;
   62|      2|}

pk7_asn1.c:pk7_cb:
   35|   232k|{
   36|   232k|    ASN1_STREAM_ARG *sarg = exarg;
   37|   232k|    PKCS7 **pp7 = (PKCS7 **)pval;
   38|       |
   39|   232k|    switch (operation) {
  ------------------
  |  Branch (39:13): [True: 232k, False: 0]
  ------------------
   40|       |
   41|      0|    case ASN1_OP_STREAM_PRE:
  ------------------
  |  |  752|      0|# define ASN1_OP_STREAM_PRE      10
  ------------------
  |  Branch (41:5): [True: 0, False: 232k]
  ------------------
   42|      0|        if (PKCS7_stream(&sarg->boundary, *pp7) <= 0)
  ------------------
  |  Branch (42:13): [True: 0, False: 0]
  ------------------
   43|      0|            return 0;
   44|       |        /* fall through */
   45|      0|    case ASN1_OP_DETACHED_PRE:
  ------------------
  |  |  754|      0|# define ASN1_OP_DETACHED_PRE    12
  ------------------
  |  Branch (45:5): [True: 0, False: 232k]
  ------------------
   46|      0|        sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out);
   47|      0|        if (!sarg->ndef_bio)
  ------------------
  |  Branch (47:13): [True: 0, False: 0]
  ------------------
   48|      0|            return 0;
   49|      0|        break;
   50|       |
   51|      0|    case ASN1_OP_STREAM_POST:
  ------------------
  |  |  753|      0|# define ASN1_OP_STREAM_POST     11
  ------------------
  |  Branch (51:5): [True: 0, False: 232k]
  ------------------
   52|      0|    case ASN1_OP_DETACHED_POST:
  ------------------
  |  |  755|      0|# define ASN1_OP_DETACHED_POST   13
  ------------------
  |  Branch (52:5): [True: 0, False: 232k]
  ------------------
   53|      0|        if (PKCS7_dataFinal(*pp7, sarg->ndef_bio) <= 0)
  ------------------
  |  Branch (53:13): [True: 0, False: 0]
  ------------------
   54|      0|            return 0;
   55|      0|        break;
   56|       |
   57|   232k|    }
   58|   232k|    return 1;
   59|   232k|}
pk7_asn1.c:si_cb:
  139|  58.2k|{
  140|  58.2k|    if (operation == ASN1_OP_FREE_POST) {
  ------------------
  |  |  745|  58.2k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (140:9): [True: 10.5k, False: 47.7k]
  ------------------
  141|  10.5k|        PKCS7_SIGNER_INFO *si = (PKCS7_SIGNER_INFO *)*pval;
  142|  10.5k|        EVP_PKEY_free(si->pkey);
  143|  10.5k|    }
  144|  58.2k|    return 1;
  145|  58.2k|}
pk7_asn1.c:ri_cb:
  182|  49.2k|{
  183|  49.2k|    if (operation == ASN1_OP_FREE_POST) {
  ------------------
  |  |  745|  49.2k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (183:9): [True: 9.71k, False: 39.5k]
  ------------------
  184|  9.71k|        PKCS7_RECIP_INFO *ri = (PKCS7_RECIP_INFO *)*pval;
  185|  9.71k|        X509_free(ri->cert);
  186|  9.71k|    }
  187|  49.2k|    return 1;
  188|  49.2k|}

PKCS7_ctrl:
   21|      3|{
   22|      3|    int nid;
   23|      3|    long ret;
   24|       |
   25|      3|    nid = OBJ_obj2nid(p7->type);
   26|       |
   27|      3|    switch (cmd) {
   28|       |    /* NOTE(emilia): does not support detached digested data. */
   29|      0|    case PKCS7_OP_SET_DETACHED_SIGNATURE:
  ------------------
  |  |  249|      0|# define PKCS7_OP_SET_DETACHED_SIGNATURE 1
  ------------------
  |  Branch (29:5): [True: 0, False: 3]
  ------------------
   30|      0|        if (nid == NID_pkcs7_signed) {
  ------------------
  |  |  679|      0|#define NID_pkcs7_signed                22
  ------------------
  |  Branch (30:13): [True: 0, False: 0]
  ------------------
   31|      0|            ret = p7->detached = (int)larg;
   32|      0|            if (ret && PKCS7_type_is_data(p7->d.sign->contents)) {
  ------------------
  |  |  260|      0|# define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
  |  |  ------------------
  |  |  |  |  675|      0|#define NID_pkcs7_data          21
  |  |  ------------------
  |  |  |  Branch (260:34): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (32:17): [True: 0, False: 0]
  ------------------
   33|      0|                ASN1_OCTET_STRING *os;
   34|      0|                os = p7->d.sign->contents->d.data;
   35|      0|                ASN1_OCTET_STRING_free(os);
   36|      0|                p7->d.sign->contents->d.data = NULL;
   37|      0|            }
   38|      0|        } else {
   39|      0|            ERR_raise(ERR_LIB_PKCS7,
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   40|      0|                      PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE);
   41|      0|            ret = 0;
   42|      0|        }
   43|      0|        break;
   44|      3|    case PKCS7_OP_GET_DETACHED_SIGNATURE:
  ------------------
  |  |  250|      3|# define PKCS7_OP_GET_DETACHED_SIGNATURE 2
  ------------------
  |  Branch (44:5): [True: 3, False: 0]
  ------------------
   45|      3|        if (nid == NID_pkcs7_signed) {
  ------------------
  |  |  679|      3|#define NID_pkcs7_signed                22
  ------------------
  |  Branch (45:13): [True: 3, False: 0]
  ------------------
   46|      3|            if (p7->d.sign == NULL || p7->d.sign->contents->d.ptr == NULL)
  ------------------
  |  Branch (46:17): [True: 1, False: 2]
  |  Branch (46:39): [True: 1, False: 1]
  ------------------
   47|      2|                ret = 1;
   48|      1|            else
   49|      1|                ret = 0;
   50|       |
   51|      3|            p7->detached = ret;
   52|      3|        } else {
   53|      0|            ERR_raise(ERR_LIB_PKCS7,
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   54|      0|                      PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE);
   55|      0|            ret = 0;
   56|      0|        }
   57|       |
   58|      3|        break;
   59|      0|    default:
  ------------------
  |  Branch (59:5): [True: 0, False: 3]
  ------------------
   60|      0|        ERR_raise(ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_OPERATION);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   61|      0|        ret = 0;
   62|      3|    }
   63|      3|    return ret;
   64|      3|}

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

ossl_property_defns_free:
   52|      2|{
   53|      2|    LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns = vproperty_defns;
  ------------------
  |  |  135|      2|# define LHASH_OF(type) struct lhash_st_##type
  ------------------
   54|       |
   55|      2|    if (property_defns != NULL) {
  ------------------
  |  Branch (55:9): [True: 2, False: 0]
  ------------------
   56|      2|        lh_PROPERTY_DEFN_ELEM_doall(property_defns,
   57|      2|                                    &property_defn_free);
   58|      2|        lh_PROPERTY_DEFN_ELEM_free(property_defns);
   59|      2|    }
   60|      2|}
ossl_property_defns_new:
   62|      4|void *ossl_property_defns_new(OSSL_LIB_CTX *ctx) {
   63|      4|    return lh_PROPERTY_DEFN_ELEM_new(&property_defn_hash, &property_defn_cmp);
   64|      4|}
ossl_prop_defn_get:
   67|    206|{
   68|    206|    PROPERTY_DEFN_ELEM elem, *r;
   69|    206|    LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
  ------------------
  |  |  135|    206|# define LHASH_OF(type) struct lhash_st_##type
  ------------------
   70|       |
   71|    206|    property_defns = ossl_lib_ctx_get_data(ctx,
   72|    206|                                           OSSL_LIB_CTX_PROPERTY_DEFN_INDEX);
  ------------------
  |  |  100|    206|# define OSSL_LIB_CTX_PROPERTY_DEFN_INDEX            2
  ------------------
   73|    206|    if (!ossl_assert(property_defns != NULL) || !ossl_lib_ctx_read_lock(ctx))
  ------------------
  |  |   52|    412|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    412|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (73:9): [True: 0, False: 206]
  |  Branch (73:49): [True: 0, False: 206]
  ------------------
   74|      0|        return NULL;
   75|       |
   76|    206|    elem.prop = prop;
   77|    206|    r = lh_PROPERTY_DEFN_ELEM_retrieve(property_defns, &elem);
   78|    206|    ossl_lib_ctx_unlock(ctx);
   79|    206|    if (r == NULL || !ossl_assert(r->defn != NULL))
  ------------------
  |  |   52|    149|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    149|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (79:9): [True: 57, False: 149]
  |  Branch (79:22): [True: 0, False: 149]
  ------------------
   80|     57|        return NULL;
   81|    149|    return r->defn;
   82|    206|}
ossl_prop_defn_set:
   91|     57|{
   92|     57|    PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
   93|     57|    size_t len;
   94|     57|    LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
  ------------------
  |  |  135|     57|# define LHASH_OF(type) struct lhash_st_##type
  ------------------
   95|     57|    int res = 1;
   96|       |
   97|     57|    property_defns = ossl_lib_ctx_get_data(ctx,
   98|     57|                                           OSSL_LIB_CTX_PROPERTY_DEFN_INDEX);
  ------------------
  |  |  100|     57|# define OSSL_LIB_CTX_PROPERTY_DEFN_INDEX            2
  ------------------
   99|     57|    if (property_defns == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 57]
  ------------------
  100|      0|        return 0;
  101|       |
  102|     57|    if (prop == NULL)
  ------------------
  |  Branch (102:9): [True: 0, False: 57]
  ------------------
  103|      0|        return 1;
  104|       |
  105|     57|    if (!ossl_lib_ctx_write_lock(ctx))
  ------------------
  |  Branch (105:9): [True: 0, False: 57]
  ------------------
  106|      0|        return 0;
  107|     57|    elem.prop = prop;
  108|     57|    if (pl == NULL) {
  ------------------
  |  Branch (108:9): [True: 0, False: 57]
  ------------------
  109|      0|        lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem);
  110|      0|        goto end;
  111|      0|    }
  112|       |    /* check if property definition is in the cache already */
  113|     57|    if ((p = lh_PROPERTY_DEFN_ELEM_retrieve(property_defns, &elem)) != NULL) {
  ------------------
  |  Branch (113:9): [True: 0, False: 57]
  ------------------
  114|      0|        ossl_property_free(*pl);
  115|      0|        *pl = p->defn;
  116|      0|        goto end;
  117|      0|    }
  118|     57|    len = strlen(prop);
  119|     57|    p = OPENSSL_malloc(sizeof(*p) + len);
  ------------------
  |  |   97|     57|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     57|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     57|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  120|     57|    if (p != NULL) {
  ------------------
  |  Branch (120:9): [True: 57, False: 0]
  ------------------
  121|     57|        p->prop = p->body;
  122|     57|        p->defn = *pl;
  123|     57|        memcpy(p->body, prop, len + 1);
  124|     57|        old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p);
  125|     57|        if (!ossl_assert(old == NULL))
  ------------------
  |  |   52|     57|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|     57|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (125:13): [True: 0, False: 57]
  ------------------
  126|       |            /* This should not happen. An existing entry is handled above. */
  127|      0|            goto end;
  128|     57|        if (!lh_PROPERTY_DEFN_ELEM_error(property_defns))
  ------------------
  |  Branch (128:13): [True: 57, False: 0]
  ------------------
  129|     57|            goto end;
  130|     57|    }
  131|      0|    OPENSSL_free(p);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  132|      0|    res = 0;
  133|     57| end:
  134|     57|    ossl_lib_ctx_unlock(ctx);
  135|     57|    return res;
  136|      0|}
defn_cache.c:property_defn_free:
   46|     57|{
   47|     57|    ossl_property_free(elem->defn);
   48|     57|    OPENSSL_free(elem);
  ------------------
  |  |  107|     57|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     57|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     57|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   49|     57|}
defn_cache.c:property_defn_hash:
   35|    320|{
   36|    320|    return OPENSSL_LH_strhash(a->prop);
   37|    320|}
defn_cache.c:property_defn_cmp:
   41|    149|{
   42|    149|    return strcmp(a->prop, b->prop);
   43|    149|}

ossl_ctx_global_properties_free:
  112|      2|{
  113|      2|    OSSL_GLOBAL_PROPERTIES *globp = vglobp;
  114|       |
  115|      2|    if (globp != NULL) {
  ------------------
  |  Branch (115:9): [True: 2, False: 0]
  ------------------
  116|      2|        ossl_property_free(globp->list);
  117|      2|        OPENSSL_free(globp);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  118|      2|    }
  119|      2|}
ossl_ctx_global_properties_new:
  122|      4|{
  123|      4|    return OPENSSL_zalloc(sizeof(OSSL_GLOBAL_PROPERTIES));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  124|      4|}
ossl_ctx_global_properties:
  128|      5|{
  129|      5|    OSSL_GLOBAL_PROPERTIES *globp;
  130|       |
  131|      5|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
  132|      5|    if (loadconfig && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
  ------------------
  |  |  455|      0|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (132:9): [True: 0, False: 5]
  |  Branch (132:23): [True: 0, False: 0]
  ------------------
  133|      0|        return NULL;
  134|      5|#endif
  135|      5|    globp = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_GLOBAL_PROPERTIES);
  ------------------
  |  |  114|      5|# define OSSL_LIB_CTX_GLOBAL_PROPERTIES             14
  ------------------
  136|       |
  137|      5|    return globp != NULL ? &globp->list : NULL;
  ------------------
  |  Branch (137:12): [True: 5, False: 0]
  ------------------
  138|      5|}
ossl_method_store_new:
  241|     16|{
  242|     16|    OSSL_METHOD_STORE *res;
  243|       |
  244|     16|    res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |   99|     16|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  245|     16|    if (res != NULL) {
  ------------------
  |  Branch (245:9): [True: 16, False: 0]
  ------------------
  246|     16|        res->ctx = ctx;
  247|     16|        if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL
  ------------------
  |  Branch (247:13): [True: 0, False: 16]
  ------------------
  248|     16|            || (res->lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (248:16): [True: 0, False: 16]
  ------------------
  249|     16|            || (res->biglock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (249:16): [True: 0, False: 16]
  ------------------
  250|      0|            ossl_method_store_free(res);
  251|      0|            return NULL;
  252|      0|        }
  253|     16|    }
  254|     16|    return res;
  255|     16|}
ossl_method_store_free:
  258|      8|{
  259|      8|    if (store != NULL) {
  ------------------
  |  Branch (259:9): [True: 8, False: 0]
  ------------------
  260|      8|        if (store->algs != NULL)
  ------------------
  |  Branch (260:13): [True: 8, False: 0]
  ------------------
  261|      8|            ossl_sa_ALGORITHM_doall_arg(store->algs, &alg_cleanup, store);
  262|      8|        ossl_sa_ALGORITHM_free(store->algs);
  263|      8|        CRYPTO_THREAD_lock_free(store->lock);
  264|      8|        CRYPTO_THREAD_lock_free(store->biglock);
  265|      8|        OPENSSL_free(store);
  ------------------
  |  |  107|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  266|      8|    }
  267|      8|}
ossl_method_lock_store:
  270|  13.4k|{
  271|  13.4k|    return store != NULL ? CRYPTO_THREAD_write_lock(store->biglock) : 0;
  ------------------
  |  Branch (271:12): [True: 13.4k, False: 0]
  ------------------
  272|  13.4k|}
ossl_method_unlock_store:
  275|  13.4k|{
  276|  13.4k|    return store != NULL ? CRYPTO_THREAD_unlock(store->biglock) : 0;
  ------------------
  |  Branch (276:12): [True: 13.4k, False: 0]
  ------------------
  277|  13.4k|}
ossl_method_store_add:
  293|    206|{
  294|    206|    ALGORITHM *alg = NULL;
  295|    206|    IMPLEMENTATION *impl;
  296|    206|    int ret = 0;
  297|    206|    int i;
  298|       |
  299|    206|    if (nid <= 0 || method == NULL || store == NULL)
  ------------------
  |  Branch (299:9): [True: 0, False: 206]
  |  Branch (299:21): [True: 0, False: 206]
  |  Branch (299:39): [True: 0, False: 206]
  ------------------
  300|      0|        return 0;
  301|    206|    if (properties == NULL)
  ------------------
  |  Branch (301:9): [True: 0, False: 206]
  ------------------
  302|      0|        properties = "";
  303|       |
  304|    206|    if (!ossl_assert(prov != NULL))
  ------------------
  |  |   52|    206|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    206|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (304:9): [True: 0, False: 206]
  ------------------
  305|      0|        return 0;
  306|       |
  307|       |    /* Create new entry */
  308|    206|    impl = OPENSSL_malloc(sizeof(*impl));
  ------------------
  |  |   97|    206|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    206|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    206|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  309|    206|    if (impl == NULL)
  ------------------
  |  Branch (309:9): [True: 0, False: 206]
  ------------------
  310|      0|        return 0;
  311|    206|    impl->method.method = method;
  312|    206|    impl->method.up_ref = method_up_ref;
  313|    206|    impl->method.free = method_destruct;
  314|    206|    if (!ossl_method_up_ref(&impl->method)) {
  ------------------
  |  Branch (314:9): [True: 0, False: 206]
  ------------------
  315|      0|        OPENSSL_free(impl);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  316|      0|        return 0;
  317|      0|    }
  318|    206|    impl->provider = prov;
  319|       |
  320|       |    /* Insert into the hash table if required */
  321|    206|    if (!ossl_property_write_lock(store)) {
  ------------------
  |  Branch (321:9): [True: 0, False: 206]
  ------------------
  322|      0|        OPENSSL_free(impl);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  323|      0|        return 0;
  324|      0|    }
  325|    206|    ossl_method_cache_flush(store, nid);
  326|    206|    if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
  ------------------
  |  Branch (326:9): [True: 57, False: 149]
  ------------------
  327|     57|        impl->properties = ossl_parse_property(store->ctx, properties);
  328|     57|        if (impl->properties == NULL)
  ------------------
  |  Branch (328:13): [True: 0, False: 57]
  ------------------
  329|      0|            goto err;
  330|     57|        if (!ossl_prop_defn_set(store->ctx, properties, &impl->properties)) {
  ------------------
  |  Branch (330:13): [True: 0, False: 57]
  ------------------
  331|      0|            ossl_property_free(impl->properties);
  332|      0|            impl->properties = NULL;
  333|      0|            goto err;
  334|      0|        }
  335|     57|    }
  336|       |
  337|    206|    alg = ossl_method_store_retrieve(store, nid);
  338|    206|    if (alg == NULL) {
  ------------------
  |  Branch (338:9): [True: 74, False: 132]
  ------------------
  339|     74|        if ((alg = OPENSSL_zalloc(sizeof(*alg))) == NULL
  ------------------
  |  |   99|     74|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     74|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     74|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (339:13): [True: 0, False: 74]
  ------------------
  340|     74|                || (alg->impls = sk_IMPLEMENTATION_new_null()) == NULL
  ------------------
  |  Branch (340:20): [True: 0, False: 74]
  ------------------
  341|     74|                || (alg->cache = lh_QUERY_new(&query_hash, &query_cmp)) == NULL)
  ------------------
  |  Branch (341:20): [True: 0, False: 74]
  ------------------
  342|      0|            goto err;
  343|     74|        alg->nid = nid;
  344|     74|        if (!ossl_method_store_insert(store, alg))
  ------------------
  |  Branch (344:13): [True: 0, False: 74]
  ------------------
  345|      0|            goto err;
  346|     74|    }
  347|       |
  348|       |    /* Push onto stack if there isn't one there already */
  349|    860|    for (i = 0; i < sk_IMPLEMENTATION_num(alg->impls); i++) {
  ------------------
  |  Branch (349:17): [True: 654, False: 206]
  ------------------
  350|    654|        const IMPLEMENTATION *tmpimpl = sk_IMPLEMENTATION_value(alg->impls, i);
  351|       |
  352|    654|        if (tmpimpl->provider == impl->provider
  ------------------
  |  Branch (352:13): [True: 654, False: 0]
  ------------------
  353|    654|            && tmpimpl->properties == impl->properties)
  ------------------
  |  Branch (353:16): [True: 0, False: 654]
  ------------------
  354|      0|            break;
  355|    654|    }
  356|    206|    if (i == sk_IMPLEMENTATION_num(alg->impls)
  ------------------
  |  Branch (356:9): [True: 206, False: 0]
  ------------------
  357|    206|        && sk_IMPLEMENTATION_push(alg->impls, impl))
  ------------------
  |  Branch (357:12): [True: 206, False: 0]
  ------------------
  358|    206|        ret = 1;
  359|    206|    ossl_property_unlock(store);
  360|    206|    if (ret == 0)
  ------------------
  |  Branch (360:9): [True: 0, False: 206]
  ------------------
  361|      0|        impl_free(impl);
  362|    206|    return ret;
  363|       |
  364|      0|err:
  365|      0|    ossl_property_unlock(store);
  366|      0|    alg_cleanup(0, alg, NULL);
  367|      0|    impl_free(impl);
  368|      0|    return 0;
  369|    206|}
ossl_method_store_do_all:
  484|  6.74k|{
  485|  6.74k|    struct alg_do_each_data_st data;
  486|       |
  487|  6.74k|    data.fn = fn;
  488|  6.74k|    data.fnarg = fnarg;
  489|  6.74k|    if (store != NULL)
  ------------------
  |  Branch (489:9): [True: 6.74k, False: 0]
  ------------------
  490|  6.74k|        ossl_sa_ALGORITHM_doall_arg(store->algs, alg_do_each, &data);
  491|  6.74k|}
ossl_method_store_fetch:
  496|      5|{
  497|      5|    OSSL_PROPERTY_LIST **plp;
  498|      5|    ALGORITHM *alg;
  499|      5|    IMPLEMENTATION *impl, *best_impl = NULL;
  500|      5|    OSSL_PROPERTY_LIST *pq = NULL, *p2 = NULL;
  501|      5|    const OSSL_PROVIDER *prov = prov_rw != NULL ? *prov_rw : NULL;
  ------------------
  |  Branch (501:33): [True: 5, False: 0]
  ------------------
  502|      5|    int ret = 0;
  503|      5|    int j, best = -1, score, optional;
  504|       |
  505|      5|    if (nid <= 0 || method == NULL || store == NULL)
  ------------------
  |  Branch (505:9): [True: 0, False: 5]
  |  Branch (505:21): [True: 0, False: 5]
  |  Branch (505:39): [True: 0, False: 5]
  ------------------
  506|      0|        return 0;
  507|       |
  508|      5|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
  509|      5|    if (ossl_lib_ctx_is_default(store->ctx)
  ------------------
  |  Branch (509:9): [True: 5, False: 0]
  ------------------
  510|      5|            && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
  ------------------
  |  |  455|      5|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (510:16): [True: 0, False: 5]
  ------------------
  511|      0|        return 0;
  512|      5|#endif
  513|       |
  514|       |    /* This only needs to be a read lock, because the query won't create anything */
  515|      5|    if (!ossl_property_read_lock(store))
  ------------------
  |  Branch (515:9): [True: 0, False: 5]
  ------------------
  516|      0|        return 0;
  517|      5|    alg = ossl_method_store_retrieve(store, nid);
  518|      5|    if (alg == NULL) {
  ------------------
  |  Branch (518:9): [True: 0, False: 5]
  ------------------
  519|      0|        ossl_property_unlock(store);
  520|      0|        return 0;
  521|      0|    }
  522|       |
  523|      5|    if (prop_query != NULL)
  ------------------
  |  Branch (523:9): [True: 5, False: 0]
  ------------------
  524|      5|        p2 = pq = ossl_parse_query(store->ctx, prop_query, 0);
  525|      5|    plp = ossl_ctx_global_properties(store->ctx, 0);
  526|      5|    if (plp != NULL && *plp != NULL) {
  ------------------
  |  Branch (526:9): [True: 5, False: 0]
  |  Branch (526:24): [True: 0, False: 5]
  ------------------
  527|      0|        if (pq == NULL) {
  ------------------
  |  Branch (527:13): [True: 0, False: 0]
  ------------------
  528|      0|            pq = *plp;
  529|      0|        } else {
  530|      0|            p2 = ossl_property_merge(pq, *plp);
  531|      0|            ossl_property_free(pq);
  532|      0|            if (p2 == NULL)
  ------------------
  |  Branch (532:17): [True: 0, False: 0]
  ------------------
  533|      0|                goto fin;
  534|      0|            pq = p2;
  535|      0|        }
  536|      0|    }
  537|       |
  538|      5|    if (pq == NULL) {
  ------------------
  |  Branch (538:9): [True: 0, False: 5]
  ------------------
  539|      0|        for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) {
  ------------------
  |  Branch (539:21): [True: 0, False: 0]
  ------------------
  540|      0|            if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL
  ------------------
  |  Branch (540:17): [True: 0, False: 0]
  ------------------
  541|      0|                && (prov == NULL || impl->provider == prov)) {
  ------------------
  |  Branch (541:21): [True: 0, False: 0]
  |  Branch (541:37): [True: 0, False: 0]
  ------------------
  542|      0|                best_impl = impl;
  543|      0|                ret = 1;
  544|      0|                break;
  545|      0|            }
  546|      0|        }
  547|      0|        goto fin;
  548|      0|    }
  549|      5|    optional = ossl_property_has_optional(pq);
  550|      5|    for (j = 0; j < sk_IMPLEMENTATION_num(alg->impls); j++) {
  ------------------
  |  Branch (550:17): [True: 5, False: 0]
  ------------------
  551|      5|        if ((impl = sk_IMPLEMENTATION_value(alg->impls, j)) != NULL
  ------------------
  |  Branch (551:13): [True: 5, False: 0]
  ------------------
  552|      5|            && (prov == NULL || impl->provider == prov)) {
  ------------------
  |  Branch (552:17): [True: 5, False: 0]
  |  Branch (552:33): [True: 0, False: 0]
  ------------------
  553|      5|            score = ossl_property_match_count(pq, impl->properties);
  554|      5|            if (score > best) {
  ------------------
  |  Branch (554:17): [True: 5, False: 0]
  ------------------
  555|      5|                best_impl = impl;
  556|      5|                best = score;
  557|      5|                ret = 1;
  558|      5|                if (!optional)
  ------------------
  |  Branch (558:21): [True: 5, False: 0]
  ------------------
  559|      5|                    goto fin;
  560|      5|            }
  561|      5|        }
  562|      5|    }
  563|      5|fin:
  564|      5|    if (ret && ossl_method_up_ref(&best_impl->method)) {
  ------------------
  |  Branch (564:9): [True: 5, False: 0]
  |  Branch (564:16): [True: 5, False: 0]
  ------------------
  565|      5|        *method = best_impl->method.method;
  566|      5|        if (prov_rw != NULL)
  ------------------
  |  Branch (566:13): [True: 5, False: 0]
  ------------------
  567|      5|            *prov_rw = best_impl->provider;
  568|      5|    } else {
  569|      0|        ret = 0;
  570|      0|    }
  571|      5|    ossl_property_unlock(store);
  572|      5|    ossl_property_free(p2);
  573|      5|    return ret;
  574|      5|}
ossl_method_store_cache_flush_all:
  592|      8|{
  593|      8|    if (!ossl_property_write_lock(store))
  ------------------
  |  Branch (593:9): [True: 0, False: 8]
  ------------------
  594|      0|        return 0;
  595|      8|    ossl_sa_ALGORITHM_doall(store->algs, &impl_cache_flush_alg);
  596|      8|    store->cache_nelem = 0;
  597|      8|    ossl_property_unlock(store);
  598|      8|    return 1;
  599|      8|}
ossl_method_store_cache_get:
  674|  7.34k|{
  675|  7.34k|    ALGORITHM *alg;
  676|  7.34k|    QUERY elem, *r;
  677|  7.34k|    int res = 0;
  678|       |
  679|  7.34k|    if (nid <= 0 || store == NULL || prop_query == NULL)
  ------------------
  |  Branch (679:9): [True: 0, False: 7.34k]
  |  Branch (679:21): [True: 0, False: 7.34k]
  |  Branch (679:38): [True: 0, False: 7.34k]
  ------------------
  680|      0|        return 0;
  681|       |
  682|  7.34k|    if (!ossl_property_read_lock(store))
  ------------------
  |  Branch (682:9): [True: 0, False: 7.34k]
  ------------------
  683|      0|        return 0;
  684|  7.34k|    alg = ossl_method_store_retrieve(store, nid);
  685|  7.34k|    if (alg == NULL)
  ------------------
  |  Branch (685:9): [True: 1, False: 7.34k]
  ------------------
  686|      1|        goto err;
  687|       |
  688|  7.34k|    elem.query = prop_query;
  689|  7.34k|    elem.provider = prov;
  690|  7.34k|    r = lh_QUERY_retrieve(alg->cache, &elem);
  691|  7.34k|    if (r == NULL)
  ------------------
  |  Branch (691:9): [True: 3, False: 7.33k]
  ------------------
  692|      3|        goto err;
  693|  7.33k|    if (ossl_method_up_ref(&r->method)) {
  ------------------
  |  Branch (693:9): [True: 7.33k, False: 0]
  ------------------
  694|  7.33k|        *method = r->method.method;
  695|  7.33k|        res = 1;
  696|  7.33k|    }
  697|  7.34k|err:
  698|  7.34k|    ossl_property_unlock(store);
  699|  7.34k|    return res;
  700|  7.33k|}
ossl_method_store_cache_set:
  706|      5|{
  707|      5|    QUERY elem, *old, *p = NULL;
  708|      5|    ALGORITHM *alg;
  709|      5|    size_t len;
  710|      5|    int res = 1;
  711|       |
  712|      5|    if (nid <= 0 || store == NULL || prop_query == NULL)
  ------------------
  |  Branch (712:9): [True: 0, False: 5]
  |  Branch (712:21): [True: 0, False: 5]
  |  Branch (712:38): [True: 0, False: 5]
  ------------------
  713|      0|        return 0;
  714|       |
  715|      5|    if (!ossl_assert(prov != NULL))
  ------------------
  |  |   52|      5|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      5|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (715:9): [True: 0, False: 5]
  ------------------
  716|      0|        return 0;
  717|       |
  718|      5|    if (!ossl_property_write_lock(store))
  ------------------
  |  Branch (718:9): [True: 0, False: 5]
  ------------------
  719|      0|        return 0;
  720|      5|    if (store->cache_need_flush)
  ------------------
  |  Branch (720:9): [True: 0, False: 5]
  ------------------
  721|      0|        ossl_method_cache_flush_some(store);
  722|      5|    alg = ossl_method_store_retrieve(store, nid);
  723|      5|    if (alg == NULL)
  ------------------
  |  Branch (723:9): [True: 0, False: 5]
  ------------------
  724|      0|        goto err;
  725|       |
  726|      5|    if (method == NULL) {
  ------------------
  |  Branch (726:9): [True: 0, False: 5]
  ------------------
  727|      0|        elem.query = prop_query;
  728|      0|        elem.provider = prov;
  729|      0|        if ((old = lh_QUERY_delete(alg->cache, &elem)) != NULL) {
  ------------------
  |  Branch (729:13): [True: 0, False: 0]
  ------------------
  730|      0|            impl_cache_free(old);
  731|      0|            store->cache_nelem--;
  732|      0|        }
  733|      0|        goto end;
  734|      0|    }
  735|      5|    p = OPENSSL_malloc(sizeof(*p) + (len = strlen(prop_query)));
  ------------------
  |  |   97|      5|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  736|      5|    if (p != NULL) {
  ------------------
  |  Branch (736:9): [True: 5, False: 0]
  ------------------
  737|      5|        p->query = p->body;
  738|      5|        p->provider = prov;
  739|      5|        p->method.method = method;
  740|      5|        p->method.up_ref = method_up_ref;
  741|      5|        p->method.free = method_destruct;
  742|      5|        if (!ossl_method_up_ref(&p->method))
  ------------------
  |  Branch (742:13): [True: 0, False: 5]
  ------------------
  743|      0|            goto err;
  744|      5|        memcpy((char *)p->query, prop_query, len + 1);
  745|      5|        if ((old = lh_QUERY_insert(alg->cache, p)) != NULL) {
  ------------------
  |  Branch (745:13): [True: 0, False: 5]
  ------------------
  746|      0|            impl_cache_free(old);
  747|      0|            goto end;
  748|      0|        }
  749|      5|        if (!lh_QUERY_error(alg->cache)) {
  ------------------
  |  Branch (749:13): [True: 5, False: 0]
  ------------------
  750|      5|            if (++store->cache_nelem >= IMPL_CACHE_FLUSH_THRESHOLD)
  ------------------
  |  |   33|      5|#define IMPL_CACHE_FLUSH_THRESHOLD  500
  ------------------
  |  Branch (750:17): [True: 0, False: 5]
  ------------------
  751|      0|                store->cache_need_flush = 1;
  752|      5|            goto end;
  753|      5|        }
  754|      0|        ossl_method_free(&p->method);
  755|      0|    }
  756|      0|err:
  757|      0|    res = 0;
  758|      0|    OPENSSL_free(p);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  759|      5|end:
  760|      5|    ossl_property_unlock(store);
  761|      5|    return res;
  762|      0|}
property.c:alg_cleanup:
  223|     74|{
  224|     74|    OSSL_METHOD_STORE *store = arg;
  225|       |
  226|     74|    if (a != NULL) {
  ------------------
  |  Branch (226:9): [True: 74, False: 0]
  ------------------
  227|     74|        sk_IMPLEMENTATION_pop_free(a->impls, &impl_free);
  228|     74|        lh_QUERY_doall(a->cache, &impl_cache_free);
  229|     74|        lh_QUERY_free(a->cache);
  230|     74|        OPENSSL_free(a);
  ------------------
  |  |  107|     74|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     74|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     74|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  231|     74|    }
  232|     74|    if (store != NULL)
  ------------------
  |  Branch (232:9): [True: 74, False: 0]
  ------------------
  233|     74|        ossl_sa_ALGORITHM_set(store->algs, idx, NULL);
  234|     74|}
property.c:ossl_method_up_ref:
  160|  7.55k|{
  161|  7.55k|    return (*method->up_ref)(method->method);
  162|  7.55k|}
property.c:ossl_property_write_lock:
  175|    219|{
  176|    219|    return p != NULL ? CRYPTO_THREAD_write_lock(p->lock) : 0;
  ------------------
  |  Branch (176:12): [True: 219, False: 0]
  ------------------
  177|    219|}
property.c:ossl_method_store_retrieve:
  280|  7.76k|{
  281|  7.76k|    return ossl_sa_ALGORITHM_get(store->algs, nid);
  282|  7.76k|}
property.c:query_hash:
  185|  7.34k|{
  186|  7.34k|    return OPENSSL_LH_strhash(a->query);
  187|  7.34k|}
property.c:query_cmp:
  190|  7.33k|{
  191|  7.33k|    int res = strcmp(a->query, b->query);
  192|       |
  193|  7.33k|    if (res == 0 && a->provider != NULL && b->provider != NULL)
  ------------------
  |  Branch (193:9): [True: 7.33k, False: 0]
  |  Branch (193:21): [True: 7.33k, False: 0]
  |  Branch (193:44): [True: 0, False: 7.33k]
  ------------------
  194|      0|        res = b->provider > a->provider ? 1
  ------------------
  |  Branch (194:15): [True: 0, False: 0]
  ------------------
  195|      0|            : b->provider < a->provider ? -1
  ------------------
  |  Branch (195:15): [True: 0, False: 0]
  ------------------
  196|      0|            : 0;
  197|  7.33k|    return res;
  198|  7.33k|}
property.c:ossl_method_store_insert:
  285|     74|{
  286|     74|    return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg);
  287|     74|}
property.c:ossl_property_unlock:
  180|  7.56k|{
  181|  7.56k|    return p != 0 ? CRYPTO_THREAD_unlock(p->lock) : 0;
  ------------------
  |  Branch (181:12): [True: 7.56k, False: 0]
  ------------------
  182|  7.56k|}
property.c:impl_free:
  201|    206|{
  202|    206|    if (impl != NULL) {
  ------------------
  |  Branch (202:9): [True: 206, False: 0]
  ------------------
  203|    206|        ossl_method_free(&impl->method);
  204|    206|        OPENSSL_free(impl);
  ------------------
  |  |  107|    206|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    206|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    206|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  205|    206|    }
  206|    206|}
property.c:ossl_method_cache_flush_alg:
  578|    132|{
  579|    132|    store->cache_nelem -= lh_QUERY_num_items(alg->cache);
  580|    132|    impl_cache_flush_alg(0, alg);
  581|    132|}
property.c:alg_do_each:
  470|  83.8k|{
  471|  83.8k|    struct alg_do_each_data_st *data = arg;
  472|  83.8k|    int i, end = sk_IMPLEMENTATION_num(alg->impls);
  473|       |
  474|   818k|    for (i = 0; i < end; i++) {
  ------------------
  |  Branch (474:17): [True: 734k, False: 83.8k]
  ------------------
  475|   734k|        IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i);
  476|       |
  477|   734k|        alg_do_one(alg, impl, data->fn, data->fnarg);
  478|   734k|    }
  479|  83.8k|}
property.c:alg_do_one:
  460|   734k|{
  461|   734k|    fn(alg->nid, impl->method.method, fnarg);
  462|   734k|}
property.c:ossl_property_read_lock:
  170|  7.34k|{
  171|  7.34k|    return p != NULL ? CRYPTO_THREAD_read_lock(p->lock) : 0;
  ------------------
  |  Branch (171:12): [True: 7.34k, False: 0]
  ------------------
  172|  7.34k|}
property.c:ossl_method_cache_flush:
  584|    206|{
  585|    206|    ALGORITHM *alg = ossl_method_store_retrieve(store, nid);
  586|       |
  587|    206|    if (alg != NULL)
  ------------------
  |  Branch (587:9): [True: 132, False: 74]
  ------------------
  588|    132|        ossl_method_cache_flush_alg(store, alg);
  589|    206|}
property.c:impl_cache_flush_alg:
  217|    132|{
  218|    132|    lh_QUERY_doall(alg->cache, &impl_cache_free);
  219|    132|    lh_QUERY_flush(alg->cache);
  220|    132|}
property.c:impl_cache_free:
  209|      5|{
  210|      5|    if (elem != NULL) {
  ------------------
  |  Branch (210:9): [True: 5, False: 0]
  ------------------
  211|      5|        ossl_method_free(&elem->method);
  212|      5|        OPENSSL_free(elem);
  ------------------
  |  |  107|      5|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  213|      5|    }
  214|      5|}
property.c:ossl_method_free:
  165|    211|{
  166|    211|    (*method->free)(method->method);
  167|    211|}

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

ossl_parse_property:
  315|    212|{
  316|    212|    OSSL_PROPERTY_DEFINITION *prop = NULL;
  317|    212|    OSSL_PROPERTY_LIST *res = NULL;
  318|    212|    STACK_OF(OSSL_PROPERTY_DEFINITION) *sk;
  ------------------
  |  |   31|    212|# define STACK_OF(type) struct stack_st_##type
  ------------------
  319|    212|    const char *s = defn;
  320|    212|    int done;
  321|       |
  322|    212|    if (s == NULL || (sk = sk_OSSL_PROPERTY_DEFINITION_new(&pd_compare)) == NULL)
  ------------------
  |  Branch (322:9): [True: 0, False: 212]
  |  Branch (322:22): [True: 0, False: 212]
  ------------------
  323|      0|        return NULL;
  324|       |
  325|    212|    s = skip_space(s);
  326|    212|    done = *s == '\0';
  327|  1.02k|    while (!done) {
  ------------------
  |  Branch (327:12): [True: 811, False: 212]
  ------------------
  328|    811|        const char *start = s;
  329|       |
  330|    811|        prop = OPENSSL_malloc(sizeof(*prop));
  ------------------
  |  |   97|    811|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    811|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    811|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  331|    811|        if (prop == NULL)
  ------------------
  |  Branch (331:13): [True: 0, False: 811]
  ------------------
  332|      0|            goto err;
  333|    811|        memset(&prop->v, 0, sizeof(prop->v));
  334|    811|        prop->optional = 0;
  335|    811|        if (!parse_name(ctx, &s, 1, &prop->name_idx))
  ------------------
  |  Branch (335:13): [True: 0, False: 811]
  ------------------
  336|      0|            goto err;
  337|    811|        prop->oper = OSSL_PROPERTY_OPER_EQ;
  338|    811|        if (prop->name_idx == 0) {
  ------------------
  |  Branch (338:13): [True: 0, False: 811]
  ------------------
  339|      0|            ERR_raise_data(ERR_LIB_PROP, PROP_R_PARSE_FAILED,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_PROP, PROP_R_PARSE_FAILED,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                          ERR_raise_data(ERR_LIB_PROP, PROP_R_PARSE_FAILED,
  ------------------
  |  |   35|      0|# define PROP_R_PARSE_FAILED                              108
  ------------------
  340|      0|                           "Unknown name HERE-->%s", start);
  341|      0|            goto err;
  342|      0|        }
  343|    811|        if (match_ch(&s, '=')) {
  ------------------
  |  Branch (343:13): [True: 811, False: 0]
  ------------------
  344|    811|            if (!parse_value(ctx, &s, prop, 1)) {
  ------------------
  |  Branch (344:17): [True: 0, False: 811]
  ------------------
  345|      0|                ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                              ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                              ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
  ------------------
  |  |   34|      0|# define PROP_R_NO_VALUE                                  107
  ------------------
  346|      0|                               "HERE-->%s", start);
  347|      0|                goto err;
  348|      0|            }
  349|    811|        } else {
  350|       |            /* A name alone means a true Boolean */
  351|      0|            prop->type = OSSL_PROPERTY_TYPE_STRING;
  352|      0|            prop->v.str_val = OSSL_PROPERTY_TRUE;
  ------------------
  |  |   37|      0|#define OSSL_PROPERTY_TRUE      1
  ------------------
  353|      0|        }
  354|       |
  355|    811|        if (!sk_OSSL_PROPERTY_DEFINITION_push(sk, prop))
  ------------------
  |  Branch (355:13): [True: 0, False: 811]
  ------------------
  356|      0|            goto err;
  357|    811|        prop = NULL;
  358|    811|        done = !match_ch(&s, ',');
  359|    811|    }
  360|    212|    if (*s != '\0') {
  ------------------
  |  Branch (360:9): [True: 0, False: 212]
  ------------------
  361|      0|        ERR_raise_data(ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS,
  ------------------
  |  |   37|      0|# define PROP_R_TRAILING_CHARACTERS                       110
  ------------------
  362|      0|                       "HERE-->%s", s);
  363|      0|        goto err;
  364|      0|    }
  365|    212|    res = stack_to_property_list(ctx, sk);
  366|       |
  367|    212|err:
  368|    212|    OPENSSL_free(prop);
  ------------------
  |  |  107|    212|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    212|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    212|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  369|    212|    sk_OSSL_PROPERTY_DEFINITION_pop_free(sk, &pd_free);
  370|    212|    return res;
  371|    212|}
ossl_parse_query:
  375|      5|{
  376|      5|    STACK_OF(OSSL_PROPERTY_DEFINITION) *sk;
  ------------------
  |  |   31|      5|# define STACK_OF(type) struct stack_st_##type
  ------------------
  377|      5|    OSSL_PROPERTY_LIST *res = NULL;
  378|      5|    OSSL_PROPERTY_DEFINITION *prop = NULL;
  379|      5|    int done;
  380|       |
  381|      5|    if (s == NULL || (sk = sk_OSSL_PROPERTY_DEFINITION_new(&pd_compare)) == NULL)
  ------------------
  |  Branch (381:9): [True: 0, False: 5]
  |  Branch (381:22): [True: 0, False: 5]
  ------------------
  382|      0|        return NULL;
  383|       |
  384|      5|    s = skip_space(s);
  385|      5|    done = *s == '\0';
  386|      5|    while (!done) {
  ------------------
  |  Branch (386:12): [True: 0, False: 5]
  ------------------
  387|      0|        prop = OPENSSL_malloc(sizeof(*prop));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  388|      0|        if (prop == NULL)
  ------------------
  |  Branch (388:13): [True: 0, False: 0]
  ------------------
  389|      0|            goto err;
  390|      0|        memset(&prop->v, 0, sizeof(prop->v));
  391|       |
  392|      0|        if (match_ch(&s, '-')) {
  ------------------
  |  Branch (392:13): [True: 0, False: 0]
  ------------------
  393|      0|            prop->oper = OSSL_PROPERTY_OVERRIDE;
  394|      0|            prop->optional = 0;
  395|      0|            if (!parse_name(ctx, &s, 1, &prop->name_idx))
  ------------------
  |  Branch (395:17): [True: 0, False: 0]
  ------------------
  396|      0|                goto err;
  397|      0|            goto skip_value;
  398|      0|        }
  399|      0|        prop->optional = match_ch(&s, '?');
  400|      0|        if (!parse_name(ctx, &s, 1, &prop->name_idx))
  ------------------
  |  Branch (400:13): [True: 0, False: 0]
  ------------------
  401|      0|            goto err;
  402|       |
  403|      0|        if (match_ch(&s, '=')) {
  ------------------
  |  Branch (403:13): [True: 0, False: 0]
  ------------------
  404|      0|            prop->oper = OSSL_PROPERTY_OPER_EQ;
  405|      0|        } else if (MATCH(&s, "!=")) {
  ------------------
  |  |   42|      0|#define MATCH(s, m) match(s, m, sizeof(m) - 1)
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  406|      0|            prop->oper = OSSL_PROPERTY_OPER_NE;
  407|      0|        } else {
  408|       |            /* A name alone is a Boolean comparison for true */
  409|      0|            prop->oper = OSSL_PROPERTY_OPER_EQ;
  410|      0|            prop->type = OSSL_PROPERTY_TYPE_STRING;
  411|      0|            prop->v.str_val = OSSL_PROPERTY_TRUE;
  ------------------
  |  |   37|      0|#define OSSL_PROPERTY_TRUE      1
  ------------------
  412|      0|            goto skip_value;
  413|      0|        }
  414|      0|        if (!parse_value(ctx, &s, prop, create_values))
  ------------------
  |  Branch (414:13): [True: 0, False: 0]
  ------------------
  415|      0|            prop->type = OSSL_PROPERTY_TYPE_VALUE_UNDEFINED;
  416|       |
  417|      0|skip_value:
  418|      0|        if (!sk_OSSL_PROPERTY_DEFINITION_push(sk, prop))
  ------------------
  |  Branch (418:13): [True: 0, False: 0]
  ------------------
  419|      0|            goto err;
  420|      0|        prop = NULL;
  421|      0|        done = !match_ch(&s, ',');
  422|      0|    }
  423|      5|    if (*s != '\0') {
  ------------------
  |  Branch (423:9): [True: 0, False: 5]
  ------------------
  424|      0|        ERR_raise_data(ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS,
  ------------------
  |  |   37|      0|# define PROP_R_TRAILING_CHARACTERS                       110
  ------------------
  425|      0|                       "HERE-->%s", s);
  426|      0|        goto err;
  427|      0|    }
  428|      5|    res = stack_to_property_list(ctx, sk);
  429|       |
  430|      5|err:
  431|      5|    OPENSSL_free(prop);
  ------------------
  |  |  107|      5|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      5|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      5|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  432|      5|    sk_OSSL_PROPERTY_DEFINITION_pop_free(sk, &pd_free);
  433|      5|    return res;
  434|      5|}
ossl_property_match_count:
  442|      5|{
  443|      5|    const OSSL_PROPERTY_DEFINITION *const q = query->properties;
  444|      5|    const OSSL_PROPERTY_DEFINITION *const d = defn->properties;
  445|      5|    int i = 0, j = 0, matches = 0;
  446|      5|    OSSL_PROPERTY_OPER oper;
  447|       |
  448|      5|    while (i < query->num_properties) {
  ------------------
  |  Branch (448:12): [True: 0, False: 5]
  ------------------
  449|      0|        if ((oper = q[i].oper) == OSSL_PROPERTY_OVERRIDE) {
  ------------------
  |  Branch (449:13): [True: 0, False: 0]
  ------------------
  450|      0|            i++;
  451|      0|            continue;
  452|      0|        }
  453|      0|        if (j < defn->num_properties) {
  ------------------
  |  Branch (453:13): [True: 0, False: 0]
  ------------------
  454|      0|            if (q[i].name_idx > d[j].name_idx) {  /* skip defn, not in query */
  ------------------
  |  Branch (454:17): [True: 0, False: 0]
  ------------------
  455|      0|                j++;
  456|      0|                continue;
  457|      0|            }
  458|      0|            if (q[i].name_idx == d[j].name_idx) { /* both in defn and query */
  ------------------
  |  Branch (458:17): [True: 0, False: 0]
  ------------------
  459|      0|                const int eq = q[i].type == d[j].type
  ------------------
  |  Branch (459:32): [True: 0, False: 0]
  ------------------
  460|      0|                               && memcmp(&q[i].v, &d[j].v, sizeof(q[i].v)) == 0;
  ------------------
  |  Branch (460:35): [True: 0, False: 0]
  ------------------
  461|       |
  462|      0|                if ((eq && oper == OSSL_PROPERTY_OPER_EQ)
  ------------------
  |  Branch (462:22): [True: 0, False: 0]
  |  Branch (462:28): [True: 0, False: 0]
  ------------------
  463|      0|                    || (!eq && oper == OSSL_PROPERTY_OPER_NE))
  ------------------
  |  Branch (463:25): [True: 0, False: 0]
  |  Branch (463:32): [True: 0, False: 0]
  ------------------
  464|      0|                    matches++;
  465|      0|                else if (!q[i].optional)
  ------------------
  |  Branch (465:26): [True: 0, False: 0]
  ------------------
  466|      0|                    return -1;
  467|      0|                i++;
  468|      0|                j++;
  469|      0|                continue;
  470|      0|            }
  471|      0|        }
  472|       |
  473|       |        /*
  474|       |         * Handle the cases of a missing value and a query with no corresponding
  475|       |         * definition.  The former fails for any comparison except inequality,
  476|       |         * the latter is treated as a comparison against the Boolean false.
  477|       |         */
  478|      0|        if (q[i].type == OSSL_PROPERTY_TYPE_VALUE_UNDEFINED) {
  ------------------
  |  Branch (478:13): [True: 0, False: 0]
  ------------------
  479|      0|            if (oper == OSSL_PROPERTY_OPER_NE)
  ------------------
  |  Branch (479:17): [True: 0, False: 0]
  ------------------
  480|      0|                matches++;
  481|      0|            else if (!q[i].optional)
  ------------------
  |  Branch (481:22): [True: 0, False: 0]
  ------------------
  482|      0|                return -1;
  483|      0|        } else if (q[i].type != OSSL_PROPERTY_TYPE_STRING
  ------------------
  |  Branch (483:20): [True: 0, False: 0]
  ------------------
  484|      0|                   || (oper == OSSL_PROPERTY_OPER_EQ
  ------------------
  |  Branch (484:24): [True: 0, False: 0]
  ------------------
  485|      0|                       && q[i].v.str_val != OSSL_PROPERTY_FALSE)
  ------------------
  |  |   38|      0|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (485:27): [True: 0, False: 0]
  ------------------
  486|      0|                   || (oper == OSSL_PROPERTY_OPER_NE
  ------------------
  |  Branch (486:24): [True: 0, False: 0]
  ------------------
  487|      0|                       && q[i].v.str_val == OSSL_PROPERTY_FALSE)) {
  ------------------
  |  |   38|      0|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (487:27): [True: 0, False: 0]
  ------------------
  488|      0|            if (!q[i].optional)
  ------------------
  |  Branch (488:17): [True: 0, False: 0]
  ------------------
  489|      0|                return -1;
  490|      0|        } else {
  491|      0|            matches++;
  492|      0|        }
  493|      0|        i++;
  494|      0|    }
  495|      5|    return matches;
  496|      5|}
ossl_property_free:
  499|    219|{
  500|    219|    OPENSSL_free(p);
  ------------------
  |  |  107|    219|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    219|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    219|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  501|    219|}
ossl_property_parse_init:
  545|      4|{
  546|      4|    static const char *const predefined_names[] = {
  547|      4|        "provider",     /* Name of provider (default, legacy, fips) */
  548|      4|        "version",      /* Version number of this provider */
  549|      4|        "fips",         /* FIPS validated or FIPS supporting algorithm */
  550|      4|        "output",       /* Output type for encoders */
  551|      4|        "input",        /* Input type for decoders */
  552|      4|        "structure",    /* Structure name for encoders and decoders */
  553|      4|    };
  554|      4|    size_t i;
  555|       |
  556|     28|    for (i = 0; i < OSSL_NELEM(predefined_names); i++)
  ------------------
  |  |   14|     28|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (556:17): [True: 24, False: 4]
  ------------------
  557|     24|        if (ossl_property_name(ctx, predefined_names[i], 1) == 0)
  ------------------
  |  Branch (557:13): [True: 0, False: 24]
  ------------------
  558|      0|            goto err;
  559|       |
  560|       |    /*
  561|       |     * Pre-populate the two Boolean values. We must do them before any other
  562|       |     * values and in this order so that we get the same index as the global
  563|       |     * OSSL_PROPERTY_TRUE and OSSL_PROPERTY_FALSE values
  564|       |     */
  565|      4|    if ((ossl_property_value(ctx, "yes", 1) != OSSL_PROPERTY_TRUE)
  ------------------
  |  |   37|      4|#define OSSL_PROPERTY_TRUE      1
  ------------------
  |  Branch (565:9): [True: 0, False: 4]
  ------------------
  566|      4|        || (ossl_property_value(ctx, "no", 1) != OSSL_PROPERTY_FALSE))
  ------------------
  |  |   38|      4|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (566:12): [True: 0, False: 4]
  ------------------
  567|      0|        goto err;
  568|       |
  569|      4|    return 1;
  570|      0|err:
  571|      0|    return 0;
  572|      4|}
property_parse.c:pd_compare:
  258|    778|{
  259|    778|    const OSSL_PROPERTY_DEFINITION *pd1 = *p1;
  260|    778|    const OSSL_PROPERTY_DEFINITION *pd2 = *p2;
  261|       |
  262|    778|    if (pd1->name_idx < pd2->name_idx)
  ------------------
  |  Branch (262:9): [True: 778, False: 0]
  ------------------
  263|    778|        return -1;
  264|      0|    if (pd1->name_idx > pd2->name_idx)
  ------------------
  |  Branch (264:9): [True: 0, False: 0]
  ------------------
  265|      0|        return 1;
  266|      0|    return 0;
  267|      0|}
property_parse.c:skip_space:
   25|  3.24k|{
   26|  3.24k|    while (ossl_isspace(*s))
  ------------------
  |  |   82|  3.24k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|  3.24k|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (82:33): [True: 0, False: 3.24k]
  |  |  ------------------
  ------------------
   27|      0|        s++;
   28|  3.24k|    return s;
   29|  3.24k|}
property_parse.c:parse_name:
   57|    811|{
   58|    811|    char name[100];
   59|    811|    int err = 0;
   60|    811|    size_t i = 0;
   61|    811|    const char *s = *t;
   62|    811|    int user_name = 0;
   63|       |
   64|    811|    for (;;) {
   65|    811|        if (!ossl_isalpha(*s)) {
  ------------------
  |  |   71|    811|# define ossl_isalpha(c)        (ossl_ctype_check((c), CTYPE_MASK_alpha))
  |  |  ------------------
  |  |  |  |   40|    811|# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|    811|# define CTYPE_MASK_lower       0x1
  |  |  |  |  ------------------
  |  |  |  |               # define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   28|    811|# define CTYPE_MASK_upper       0x2
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (65:13): [True: 0, False: 811]
  ------------------
   66|      0|            ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                          ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER,
  ------------------
  |  |   30|      0|# define PROP_R_NOT_AN_IDENTIFIER                         103
  ------------------
   67|      0|                           "HERE-->%s", *t);
   68|      0|            return 0;
   69|      0|        }
   70|  5.35k|        do {
   71|  5.35k|            if (i < sizeof(name) - 1)
  ------------------
  |  Branch (71:17): [True: 5.35k, False: 0]
  ------------------
   72|  5.35k|                name[i++] = ossl_tolower(*s);
   73|      0|            else
   74|      0|                err = 1;
   75|  5.35k|        } while (*++s == '_' || ossl_isalnum(*s));
  ------------------
  |  |   70|  5.35k|# define ossl_isalnum(c)        (ossl_ctype_check((c), CTYPE_MASK_alnum))
  |  |  ------------------
  |  |  |  |   41|  5.35k|# define CTYPE_MASK_alnum   (CTYPE_MASK_alpha | CTYPE_MASK_digit)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  5.35k|# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   27|  5.35k|# define CTYPE_MASK_lower       0x1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               # define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   28|  5.35k|# define CTYPE_MASK_upper       0x2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define CTYPE_MASK_alnum   (CTYPE_MASK_alpha | CTYPE_MASK_digit)
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|  5.35k|# define CTYPE_MASK_digit       0x4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (70:33): [True: 4.54k, False: 811]
  |  |  ------------------
  ------------------
  |  Branch (75:18): [True: 0, False: 5.35k]
  ------------------
   76|    811|        if (*s != '.')
  ------------------
  |  Branch (76:13): [True: 811, False: 0]
  ------------------
   77|    811|            break;
   78|      0|        user_name = 1;
   79|      0|        if (i < sizeof(name) - 1)
  ------------------
  |  Branch (79:13): [True: 0, False: 0]
  ------------------
   80|      0|            name[i++] = *s;
   81|      0|        else
   82|      0|            err = 1;
   83|      0|        s++;
   84|      0|    }
   85|    811|    name[i] = '\0';
   86|    811|    if (err) {
  ------------------
  |  Branch (86:9): [True: 0, False: 811]
  ------------------
   87|      0|        ERR_raise_data(ERR_LIB_PROP, PROP_R_NAME_TOO_LONG, "HERE-->%s", *t);
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_NAME_TOO_LONG, "HERE-->%s", *t);
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_NAME_TOO_LONG, "HERE-->%s", *t);
  ------------------
  |  |   27|      0|# define PROP_R_NAME_TOO_LONG                             100
  ------------------
   88|      0|        return 0;
   89|      0|    }
   90|    811|    *t = skip_space(s);
   91|    811|    *idx = ossl_property_name(ctx, name, user_name && create);
  ------------------
  |  Branch (91:42): [True: 0, False: 811]
  |  Branch (91:55): [True: 0, False: 0]
  ------------------
   92|    811|    return 1;
   93|    811|}
property_parse.c:match_ch:
   32|  1.62k|{
   33|  1.62k|    const char *s = *t;
   34|       |
   35|  1.62k|    if (*s == m) {
  ------------------
  |  Branch (35:9): [True: 1.41k, False: 212]
  ------------------
   36|  1.41k|        *t = skip_space(s + 1);
   37|  1.41k|        return 1;
   38|  1.41k|    }
   39|    212|    return 0;
   40|  1.62k|}
property_parse.c:parse_value:
  227|    811|{
  228|    811|    const char *s = *t;
  229|    811|    int r = 0;
  230|       |
  231|    811|    if (*s == '"' || *s == '\'') {
  ------------------
  |  Branch (231:9): [True: 0, False: 811]
  |  Branch (231:22): [True: 0, False: 811]
  ------------------
  232|      0|        s++;
  233|      0|        r = parse_string(ctx, &s, s[-1], res, create);
  234|    811|    } else if (*s == '+') {
  ------------------
  |  Branch (234:16): [True: 0, False: 811]
  ------------------
  235|      0|        s++;
  236|      0|        r = parse_number(&s, res);
  237|    811|    } else if (*s == '-') {
  ------------------
  |  Branch (237:16): [True: 0, False: 811]
  ------------------
  238|      0|        s++;
  239|      0|        r = parse_number(&s, res);
  240|      0|        res->v.int_val = -res->v.int_val;
  241|    811|    } else if (*s == '0' && s[1] == 'x') {
  ------------------
  |  Branch (241:16): [True: 0, False: 811]
  |  Branch (241:29): [True: 0, False: 0]
  ------------------
  242|      0|        s += 2;
  243|      0|        r = parse_hex(&s, res);
  244|    811|    } else if (*s == '0' && ossl_isdigit(s[1])) {
  ------------------
  |  Branch (244:16): [True: 0, False: 811]
  |  Branch (244:29): [True: 0, False: 0]
  ------------------
  245|      0|        s++;
  246|      0|        r = parse_oct(&s, res);
  247|    811|    } else if (ossl_isdigit(*s)) {
  ------------------
  |  Branch (247:16): [True: 0, False: 811]
  ------------------
  248|      0|        return parse_number(t, res);
  249|    811|    } else if (ossl_isalpha(*s))
  ------------------
  |  |   71|    811|# define ossl_isalpha(c)        (ossl_ctype_check((c), CTYPE_MASK_alpha))
  |  |  ------------------
  |  |  |  |   40|    811|# define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|    811|# define CTYPE_MASK_lower       0x1
  |  |  |  |  ------------------
  |  |  |  |               # define CTYPE_MASK_alpha   (CTYPE_MASK_lower | CTYPE_MASK_upper)
  |  |  |  |  ------------------
  |  |  |  |  |  |   28|    811|# define CTYPE_MASK_upper       0x2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (71:33): [True: 811, False: 0]
  |  |  ------------------
  ------------------
  250|    811|        return parse_unquoted(ctx, t, res, create);
  251|      0|    if (r)
  ------------------
  |  Branch (251:9): [True: 0, False: 0]
  ------------------
  252|      0|        *t = s;
  253|      0|    return r;
  254|    811|}
property_parse.c:parse_unquoted:
  195|    811|{
  196|    811|    char v[1000];
  197|    811|    const char *s = *t;
  198|    811|    size_t i = 0;
  199|    811|    int err = 0;
  200|       |
  201|    811|    if (*s == '\0' || *s == ',')
  ------------------
  |  Branch (201:9): [True: 0, False: 811]
  |  Branch (201:23): [True: 0, False: 811]
  ------------------
  202|      0|        return 0;
  203|  6.03k|    while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
  ------------------
  |  |   80|  12.0k|# define ossl_isprint(c)        (ossl_ctype_check((c), CTYPE_MASK_print))
  |  |  ------------------
  |  |  |  |   35|  6.03k|# define CTYPE_MASK_print       0x100
  |  |  ------------------
  |  |  |  Branch (80:33): [True: 5.82k, False: 212]
  |  |  ------------------
  ------------------
                  while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
  ------------------
  |  |   82|  11.8k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|  5.82k|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  ------------------
  |  Branch (203:32): [True: 5.82k, False: 0]
  |  Branch (203:53): [True: 5.22k, False: 599]
  ------------------
  204|  5.22k|        if (i < sizeof(v) - 1)
  ------------------
  |  Branch (204:13): [True: 5.22k, False: 0]
  ------------------
  205|  5.22k|            v[i++] = ossl_tolower(*s);
  206|      0|        else
  207|      0|            err = 1;
  208|  5.22k|        s++;
  209|  5.22k|    }
  210|    811|    if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
  ------------------
  |  |   82|  1.62k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|    811|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  ------------------
  |  Branch (210:9): [True: 811, False: 0]
  |  Branch (210:30): [True: 599, False: 212]
  |  Branch (210:44): [True: 0, False: 599]
  ------------------
  211|      0|        ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
  ------------------
  |  |   28|      0|# define PROP_R_NOT_AN_ASCII_CHARACTER                    101
  ------------------
  212|      0|                       "HERE-->%s", s);
  213|      0|        return 0;
  214|      0|    }
  215|    811|    v[i] = 0;
  216|    811|    if (err)
  ------------------
  |  Branch (216:9): [True: 0, False: 811]
  ------------------
  217|      0|        ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                      ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
  ------------------
  |  |   36|      0|# define PROP_R_STRING_TOO_LONG                           109
  ------------------
  218|    811|    else if ((res->v.str_val = ossl_property_value(ctx, v, create)) == 0)
  ------------------
  |  Branch (218:14): [True: 0, False: 811]
  ------------------
  219|      0|        err = 1;
  220|    811|    *t = skip_space(s);
  221|    811|    res->type = OSSL_PROPERTY_TYPE_STRING;
  222|    811|    return !err;
  223|    811|}
property_parse.c:stack_to_property_list:
  283|    217|{
  284|    217|    const int n = sk_OSSL_PROPERTY_DEFINITION_num(sk);
  285|    217|    OSSL_PROPERTY_LIST *r;
  286|    217|    OSSL_PROPERTY_IDX prev_name_idx = 0;
  287|    217|    int i;
  288|       |
  289|    217|    r = OPENSSL_malloc(sizeof(*r)
  ------------------
  |  |   97|    434|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    217|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    217|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (97:23): [True: 5, False: 212]
  |  |  ------------------
  ------------------
  290|    217|                       + (n <= 0 ? 0 : n - 1) * sizeof(r->properties[0]));
  291|    217|    if (r != NULL) {
  ------------------
  |  Branch (291:9): [True: 217, False: 0]
  ------------------
  292|    217|        sk_OSSL_PROPERTY_DEFINITION_sort(sk);
  293|       |
  294|    217|        r->has_optional = 0;
  295|  1.02k|        for (i = 0; i < n; i++) {
  ------------------
  |  Branch (295:21): [True: 811, False: 217]
  ------------------
  296|    811|            r->properties[i] = *sk_OSSL_PROPERTY_DEFINITION_value(sk, i);
  297|    811|            r->has_optional |= r->properties[i].optional;
  298|       |
  299|       |            /* Check for duplicated names */
  300|    811|            if (i > 0 && r->properties[i].name_idx == prev_name_idx) {
  ------------------
  |  Branch (300:17): [True: 599, False: 212]
  |  Branch (300:26): [True: 0, False: 599]
  ------------------
  301|      0|                OPENSSL_free(r);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  302|      0|                ERR_raise_data(ERR_LIB_PROP, PROP_R_PARSE_FAILED,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                              ERR_raise_data(ERR_LIB_PROP, PROP_R_PARSE_FAILED,
  ------------------
  |  |  116|      0|# define ERR_LIB_PROP            55
  ------------------
                              ERR_raise_data(ERR_LIB_PROP, PROP_R_PARSE_FAILED,
  ------------------
  |  |   35|      0|# define PROP_R_PARSE_FAILED                              108
  ------------------
  303|      0|                               "Duplicated name `%s'",
  304|      0|                               ossl_property_name_str(ctx, prev_name_idx));
  305|      0|                return NULL;
  306|      0|            }
  307|    811|            prev_name_idx = r->properties[i].name_idx;
  308|    811|        }
  309|    217|        r->num_properties = n;
  310|    217|    }
  311|    217|    return r;
  312|    217|}
property_parse.c:pd_free:
  270|    811|{
  271|    811|    OPENSSL_free(pd);
  ------------------
  |  |  107|    811|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    811|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    811|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  272|    811|}

ossl_property_find_property:
   26|  69.9k|{
   27|  69.9k|    OSSL_PROPERTY_IDX name_idx;
   28|       |
   29|  69.9k|    if (list == NULL || name == NULL
  ------------------
  |  Branch (29:9): [True: 0, False: 69.9k]
  |  Branch (29:25): [True: 0, False: 69.9k]
  ------------------
   30|  69.9k|        || (name_idx = ossl_property_name(libctx, name, 0)) == 0)
  ------------------
  |  Branch (30:12): [True: 0, False: 69.9k]
  ------------------
   31|      0|        return NULL;
   32|       |
   33|  69.9k|    return ossl_bsearch(&name_idx, list->properties, list->num_properties,
   34|  69.9k|                        sizeof(*list->properties), &property_idx_cmp, 0);
   35|  69.9k|}
ossl_property_get_string_value:
   44|  63.3k|{
   45|  63.3k|    const char *value = NULL;
   46|       |
   47|  63.3k|    if (prop != NULL && prop->type == OSSL_PROPERTY_TYPE_STRING)
  ------------------
  |  Branch (47:9): [True: 63.3k, False: 0]
  |  Branch (47:25): [True: 63.3k, False: 0]
  ------------------
   48|  63.3k|        value = ossl_property_value_str(libctx, prop->v.str_val);
   49|  63.3k|    return value;
   50|  63.3k|}
ossl_property_has_optional:
   63|      5|{
   64|      5|    return query->has_optional ? 1 : 0;
  ------------------
  |  Branch (64:12): [True: 0, False: 5]
  ------------------
   65|      5|}
property_query.c:property_idx_cmp:
   15|   111k|{
   16|   111k|    OSSL_PROPERTY_IDX key = *(const OSSL_PROPERTY_IDX *)keyp;
   17|   111k|    const OSSL_PROPERTY_DEFINITION *defn =
   18|   111k|            (const OSSL_PROPERTY_DEFINITION *)compare;
   19|       |
   20|   111k|    return key - defn->name_idx;
   21|   111k|}

ossl_property_string_data_free:
   77|      2|{
   78|      2|    PROPERTY_STRING_DATA *propdata = vpropdata;
   79|       |
   80|      2|    if (propdata == NULL)
  ------------------
  |  Branch (80:9): [True: 0, False: 2]
  ------------------
   81|      0|        return;
   82|       |
   83|      2|    CRYPTO_THREAD_lock_free(propdata->lock);
   84|      2|    property_table_free(&propdata->prop_names);
   85|      2|    property_table_free(&propdata->prop_values);
   86|      2|#ifndef OPENSSL_SMALL_FOOTPRINT
   87|      2|    sk_OPENSSL_CSTRING_free(propdata->prop_namelist);
  ------------------
  |  |  238|      2|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
   88|      2|    sk_OPENSSL_CSTRING_free(propdata->prop_valuelist);
  ------------------
  |  |  238|      2|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
   89|      2|    propdata->prop_namelist = propdata->prop_valuelist = NULL;
   90|      2|#endif
   91|      2|    propdata->prop_name_idx = propdata->prop_value_idx = 0;
   92|       |
   93|      2|    OPENSSL_free(propdata);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|      2|}
ossl_property_string_data_new:
   96|      4|void *ossl_property_string_data_new(OSSL_LIB_CTX *ctx) {
   97|      4|    PROPERTY_STRING_DATA *propdata = OPENSSL_zalloc(sizeof(*propdata));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   98|       |
   99|      4|    if (propdata == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 4]
  ------------------
  100|      0|        return NULL;
  101|       |
  102|      4|    propdata->lock = CRYPTO_THREAD_lock_new();
  103|      4|    propdata->prop_names = lh_PROPERTY_STRING_new(&property_hash,
  104|      4|                                                  &property_cmp);
  105|      4|    propdata->prop_values = lh_PROPERTY_STRING_new(&property_hash,
  106|      4|                                                   &property_cmp);
  107|      4|#ifndef OPENSSL_SMALL_FOOTPRINT
  108|      4|    propdata->prop_namelist = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  235|      4|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  109|      4|    propdata->prop_valuelist = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  235|      4|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  110|      4|#endif
  111|      4|    if (propdata->lock == NULL
  ------------------
  |  Branch (111:9): [True: 0, False: 4]
  ------------------
  112|      4|#ifndef OPENSSL_SMALL_FOOTPRINT
  113|      4|            || propdata->prop_namelist == NULL
  ------------------
  |  Branch (113:16): [True: 0, False: 4]
  ------------------
  114|      4|            || propdata->prop_valuelist == NULL
  ------------------
  |  Branch (114:16): [True: 0, False: 4]
  ------------------
  115|      4|#endif
  116|      4|            || propdata->prop_names == NULL
  ------------------
  |  Branch (116:16): [True: 0, False: 4]
  ------------------
  117|      4|            || propdata->prop_values == NULL) {
  ------------------
  |  Branch (117:16): [True: 0, False: 4]
  ------------------
  118|      0|        ossl_property_string_data_free(propdata);
  119|      0|        return NULL;
  120|      0|    }
  121|      4|    return propdata;
  122|      4|}
ossl_property_name:
  253|  70.8k|{
  254|  70.8k|    return ossl_property_string(ctx, 1, create, s);
  255|  70.8k|}
ossl_property_value:
  264|    819|{
  265|    819|    return ossl_property_string(ctx, 0, create, s);
  266|    819|}
ossl_property_value_str:
  269|  63.3k|{
  270|  63.3k|    return ossl_property_str(0, ctx, idx);
  271|  63.3k|}
property_string.c:property_table_free:
   66|      4|{
   67|      4|    PROP_TABLE *t = *pt;
   68|       |
   69|      4|    if (t != NULL) {
  ------------------
  |  Branch (69:9): [True: 4, False: 0]
  ------------------
   70|      4|        lh_PROPERTY_STRING_doall(t, &property_free);
   71|      4|        lh_PROPERTY_STRING_free(t);
   72|      4|        *pt = NULL;
   73|      4|    }
   74|      4|}
property_string.c:property_free:
   61|     37|{
   62|     37|    OPENSSL_free(ps);
  ------------------
  |  |  107|     37|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     37|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     37|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   63|     37|}
property_string.c:property_hash:
   51|  71.7k|{
   52|  71.7k|    return OPENSSL_LH_strhash(a->s);
   53|  71.7k|}
property_string.c:property_cmp:
   56|  71.5k|{
   57|  71.5k|    return strcmp(a->s, b->s);
   58|  71.5k|}
property_string.c:ossl_property_string:
  144|  71.6k|{
  145|  71.6k|    PROPERTY_STRING p, *ps, *ps_new;
  146|  71.6k|    PROP_TABLE *t;
  147|  71.6k|    OSSL_PROPERTY_IDX *pidx;
  148|  71.6k|    PROPERTY_STRING_DATA *propdata
  149|  71.6k|        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_PROPERTY_STRING_INDEX);
  ------------------
  |  |  101|  71.6k|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  150|       |
  151|  71.6k|    if (propdata == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 71.6k]
  ------------------
  152|      0|        return 0;
  153|       |
  154|  71.6k|    t = name ? propdata->prop_names : propdata->prop_values;
  ------------------
  |  Branch (154:9): [True: 70.8k, False: 819]
  ------------------
  155|  71.6k|    p.s = s;
  156|  71.6k|    if (!CRYPTO_THREAD_read_lock(propdata->lock)) {
  ------------------
  |  Branch (156:9): [True: 0, False: 71.6k]
  ------------------
  157|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_UNABLE_TO_GET_READ_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  158|      0|        return 0;
  159|      0|    }
  160|  71.6k|    ps = lh_PROPERTY_STRING_retrieve(t, &p);
  161|  71.6k|    if (ps == NULL && create) {
  ------------------
  |  Branch (161:9): [True: 53, False: 71.5k]
  |  Branch (161:23): [True: 53, False: 0]
  ------------------
  162|     53|        CRYPTO_THREAD_unlock(propdata->lock);
  163|     53|        if (!CRYPTO_THREAD_write_lock(propdata->lock)) {
  ------------------
  |  Branch (163:13): [True: 0, False: 53]
  ------------------
  164|      0|            ERR_raise(ERR_LIB_CRYPTO, ERR_R_UNABLE_TO_GET_WRITE_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  165|      0|            return 0;
  166|      0|        }
  167|     53|        pidx = name ? &propdata->prop_name_idx : &propdata->prop_value_idx;
  ------------------
  |  Branch (167:16): [True: 24, False: 29]
  ------------------
  168|     53|        ps = lh_PROPERTY_STRING_retrieve(t, &p);
  169|     53|        if (ps == NULL && (ps_new = new_property_string(s, pidx)) != NULL) {
  ------------------
  |  Branch (169:13): [True: 53, False: 0]
  |  Branch (169:27): [True: 53, False: 0]
  ------------------
  170|     53|#ifndef OPENSSL_SMALL_FOOTPRINT
  171|     53|            STACK_OF(OPENSSL_CSTRING) *slist;
  ------------------
  |  |   31|     53|# define STACK_OF(type) struct stack_st_##type
  ------------------
  172|       |
  173|     53|            slist = name ? propdata->prop_namelist : propdata->prop_valuelist;
  ------------------
  |  Branch (173:21): [True: 24, False: 29]
  ------------------
  174|     53|            if (sk_OPENSSL_CSTRING_push(slist, ps_new->s) <= 0) {
  ------------------
  |  |  242|     53|#define sk_OPENSSL_CSTRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr))
  ------------------
  |  Branch (174:17): [True: 0, False: 53]
  ------------------
  175|      0|                property_free(ps_new);
  176|      0|                CRYPTO_THREAD_unlock(propdata->lock);
  177|      0|                return 0;
  178|      0|            }
  179|     53|#endif
  180|     53|            lh_PROPERTY_STRING_insert(t, ps_new);
  181|     53|            if (lh_PROPERTY_STRING_error(t)) {
  ------------------
  |  Branch (181:17): [True: 0, False: 53]
  ------------------
  182|       |                /*-
  183|       |                 * Undo the previous push which means also decrementing the
  184|       |                 * index and freeing the allocated storage.
  185|       |                 */
  186|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  187|      0|                sk_OPENSSL_CSTRING_pop(slist);
  ------------------
  |  |  244|      0|#define sk_OPENSSL_CSTRING_pop(sk) ((const char *)OPENSSL_sk_pop(ossl_check_OPENSSL_CSTRING_sk_type(sk)))
  ------------------
  188|      0|#endif
  189|      0|                property_free(ps_new);
  190|      0|                --*pidx;
  191|      0|                CRYPTO_THREAD_unlock(propdata->lock);
  192|      0|                return 0;
  193|      0|            }
  194|     53|            ps = ps_new;
  195|     53|        }
  196|     53|    }
  197|  71.6k|    CRYPTO_THREAD_unlock(propdata->lock);
  198|  71.6k|    return ps != NULL ? ps->idx : 0;
  ------------------
  |  Branch (198:12): [True: 71.6k, False: 0]
  ------------------
  199|  71.6k|}
property_string.c:new_property_string:
  126|     53|{
  127|     53|    const size_t l = strlen(s);
  128|     53|    PROPERTY_STRING *ps = OPENSSL_malloc(sizeof(*ps) + l);
  ------------------
  |  |   97|     53|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     53|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     53|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  129|       |
  130|     53|    if (ps != NULL) {
  ------------------
  |  Branch (130:9): [True: 53, False: 0]
  ------------------
  131|     53|        memcpy(ps->body, s, l + 1);
  132|     53|        ps->s = ps->body;
  133|     53|        ps->idx = ++*pidx;
  134|     53|        if (ps->idx == 0) {
  ------------------
  |  Branch (134:13): [True: 0, False: 53]
  ------------------
  135|      0|            OPENSSL_free(ps);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  136|      0|            return NULL;
  137|      0|        }
  138|     53|    }
  139|     53|    return ps;
  140|     53|}
property_string.c:ossl_property_str:
  218|  63.3k|{
  219|  63.3k|    const char *r;
  220|  63.3k|    PROPERTY_STRING_DATA *propdata
  221|  63.3k|        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_PROPERTY_STRING_INDEX);
  ------------------
  |  |  101|  63.3k|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  222|       |
  223|  63.3k|    if (propdata == NULL)
  ------------------
  |  Branch (223:9): [True: 0, False: 63.3k]
  ------------------
  224|      0|        return NULL;
  225|       |
  226|  63.3k|    if (!CRYPTO_THREAD_read_lock(propdata->lock)) {
  ------------------
  |  Branch (226:9): [True: 0, False: 63.3k]
  ------------------
  227|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_UNABLE_TO_GET_READ_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  228|      0|        return NULL;
  229|      0|    }
  230|       |#ifdef OPENSSL_SMALL_FOOTPRINT
  231|       |    {
  232|       |        struct find_str_st findstr;
  233|       |
  234|       |        findstr.str = NULL;
  235|       |        findstr.idx = idx;
  236|       |
  237|       |        lh_PROPERTY_STRING_doall_arg(name ? propdata->prop_names
  238|       |                                          : propdata->prop_values,
  239|       |                                     find_str_fn, &findstr);
  240|       |        r = findstr.str;
  241|       |    }
  242|       |#else
  243|  63.3k|    r = sk_OPENSSL_CSTRING_value(name ? propdata->prop_namelist
  ------------------
  |  |  233|   126k|#define sk_OPENSSL_CSTRING_value(sk, idx) ((const char *)OPENSSL_sk_value(ossl_check_const_OPENSSL_CSTRING_sk_type(sk), (idx)))
  |  |  ------------------
  |  |  |  Branch (233:116): [True: 0, False: 63.3k]
  |  |  ------------------
  ------------------
  244|  63.3k|                                      : propdata->prop_valuelist, idx - 1);
  245|  63.3k|#endif
  246|  63.3k|    CRYPTO_THREAD_unlock(propdata->lock);
  247|       |
  248|  63.3k|    return r;
  249|  63.3k|}

OSSL_PROVIDER_try_load_ex:
   20|      2|{
   21|      2|    OSSL_PROVIDER *prov = NULL, *actual;
   22|      2|    int isnew = 0;
   23|       |
   24|       |    /* Find it or create it */
   25|      2|    if ((prov = ossl_provider_find(libctx, name, 0)) == NULL) {
  ------------------
  |  Branch (25:9): [True: 2, False: 0]
  ------------------
   26|      2|        if ((prov = ossl_provider_new(libctx, name, NULL, params, 0)) == NULL)
  ------------------
  |  Branch (26:13): [True: 0, False: 2]
  ------------------
   27|      0|            return NULL;
   28|      2|        isnew = 1;
   29|      2|    }
   30|       |
   31|      2|    if (!ossl_provider_activate(prov, 1, 0)) {
  ------------------
  |  Branch (31:9): [True: 0, False: 2]
  ------------------
   32|      0|        ossl_provider_free(prov);
   33|      0|        return NULL;
   34|      0|    }
   35|       |
   36|      2|    actual = prov;
   37|      2|    if (isnew && !ossl_provider_add_to_store(prov, &actual, retain_fallbacks)) {
  ------------------
  |  Branch (37:9): [True: 2, False: 0]
  |  Branch (37:18): [True: 0, False: 2]
  ------------------
   38|      0|        ossl_provider_deactivate(prov, 1);
   39|      0|        ossl_provider_free(prov);
   40|      0|        return NULL;
   41|      0|    }
   42|      2|    if (actual != prov) {
  ------------------
  |  Branch (42:9): [True: 0, False: 2]
  ------------------
   43|      0|        if (!ossl_provider_activate(actual, 1, 0)) {
  ------------------
  |  Branch (43:13): [True: 0, False: 0]
  ------------------
   44|      0|            ossl_provider_free(actual);
   45|      0|            return NULL;
   46|      0|        }
   47|      0|    }
   48|       |
   49|      2|    return actual;
   50|      2|}
OSSL_PROVIDER_try_load:
   54|      2|{
   55|      2|    return OSSL_PROVIDER_try_load_ex(libctx, name, NULL, retain_fallbacks);
   56|      2|}
OSSL_PROVIDER_get0_provider_ctx:
  104|   866k|{
  105|   866k|    return ossl_provider_prov_ctx(prov);
  106|   866k|}
OSSL_PROVIDER_add_builtin:
  128|      2|{
  129|      2|    OSSL_PROVIDER_INFO entry;
  130|       |
  131|      2|    if (name == NULL || init_fn == NULL) {
  ------------------
  |  Branch (131:9): [True: 0, False: 2]
  |  Branch (131:25): [True: 0, False: 2]
  ------------------
  132|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  133|      0|        return 0;
  134|      0|    }
  135|      2|    memset(&entry, 0, sizeof(entry));
  136|      2|    entry.name = OPENSSL_strdup(name);
  ------------------
  |  |  111|      2|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  137|      2|    if (entry.name == NULL)
  ------------------
  |  Branch (137:9): [True: 0, False: 2]
  ------------------
  138|      0|        return 0;
  139|      2|    entry.init = init_fn;
  140|      2|    if (!ossl_provider_info_add_to_store(libctx, &entry)) {
  ------------------
  |  Branch (140:9): [True: 0, False: 2]
  ------------------
  141|      0|        ossl_provider_info_clear(&entry);
  142|      0|        return 0;
  143|      0|    }
  144|      2|    return 1;
  145|      2|}

ossl_child_prov_ctx_new:
   38|      4|{
   39|      4|    return OPENSSL_zalloc(sizeof(struct child_prov_globals));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      4|}
ossl_child_prov_ctx_free:
   43|      2|{
   44|      2|    struct child_prov_globals *gbl = vgbl;
   45|       |
   46|      2|    CRYPTO_THREAD_lock_free(gbl->lock);
   47|      2|    OPENSSL_free(gbl);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   48|      2|}

ossl_prov_conf_ctx_new:
   31|      4|{
   32|      4|    PROVIDER_CONF_GLOBAL *pcgbl = OPENSSL_zalloc(sizeof(*pcgbl));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   33|       |
   34|      4|    if (pcgbl == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 4]
  ------------------
   35|      0|        return NULL;
   36|       |
   37|      4|    pcgbl->lock = CRYPTO_THREAD_lock_new();
   38|      4|    if (pcgbl->lock == NULL) {
  ------------------
  |  Branch (38:9): [True: 0, False: 4]
  ------------------
   39|      0|        OPENSSL_free(pcgbl);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      0|        return NULL;
   41|      0|    }
   42|       |
   43|      4|    return pcgbl;
   44|      4|}
ossl_prov_conf_ctx_free:
   47|      2|{
   48|      2|    PROVIDER_CONF_GLOBAL *pcgbl = vpcgbl;
   49|       |
   50|      2|    sk_OSSL_PROVIDER_pop_free(pcgbl->activated_providers,
   51|      2|                              ossl_provider_free);
   52|       |
   53|      2|    OSSL_TRACE(CONF, "Cleaned up providers\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   54|      2|    CRYPTO_THREAD_lock_free(pcgbl->lock);
   55|      2|    OPENSSL_free(pcgbl);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      2|}

ossl_provider_info_clear:
  279|      2|{
  280|      2|    OPENSSL_free(info->name);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  281|      2|    OPENSSL_free(info->path);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  282|      2|    sk_INFOPAIR_pop_free(info->parameters, infopair_free);
  283|      2|}
ossl_provider_store_free:
  286|      2|{
  287|      2|    struct provider_store_st *store = vstore;
  288|      2|    size_t i;
  289|       |
  290|      2|    if (store == NULL)
  ------------------
  |  Branch (290:9): [True: 0, False: 2]
  ------------------
  291|      0|        return;
  292|      2|    store->freeing = 1;
  293|      2|    OPENSSL_free(store->default_path);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  294|      2|    sk_OSSL_PROVIDER_pop_free(store->providers, provider_deactivate_free);
  295|      2|#ifndef FIPS_MODULE
  296|      2|    sk_OSSL_PROVIDER_CHILD_CB_pop_free(store->child_cbs,
  297|      2|                                       ossl_provider_child_cb_free);
  298|      2|#endif
  299|      2|    CRYPTO_THREAD_lock_free(store->default_path_lock);
  300|      2|    CRYPTO_THREAD_lock_free(store->lock);
  301|      4|    for (i = 0; i < store->numprovinfo; i++)
  ------------------
  |  Branch (301:17): [True: 2, False: 2]
  ------------------
  302|      2|        ossl_provider_info_clear(&store->provinfo[i]);
  303|      2|    OPENSSL_free(store->provinfo);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  304|      2|    OPENSSL_free(store);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  305|      2|}
ossl_provider_store_new:
  308|      4|{
  309|      4|    struct provider_store_st *store = OPENSSL_zalloc(sizeof(*store));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  310|       |
  311|      4|    if (store == NULL
  ------------------
  |  Branch (311:9): [True: 0, False: 4]
  ------------------
  312|      4|        || (store->providers = sk_OSSL_PROVIDER_new(ossl_provider_cmp)) == NULL
  ------------------
  |  Branch (312:12): [True: 0, False: 4]
  ------------------
  313|      4|        || (store->default_path_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (313:12): [True: 0, False: 4]
  ------------------
  314|      4|#ifndef FIPS_MODULE
  315|      4|        || (store->child_cbs = sk_OSSL_PROVIDER_CHILD_CB_new_null()) == NULL
  ------------------
  |  Branch (315:12): [True: 0, False: 4]
  ------------------
  316|      4|#endif
  317|      4|        || (store->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (317:12): [True: 0, False: 4]
  ------------------
  318|      0|        ossl_provider_store_free(store);
  319|      0|        return NULL;
  320|      0|    }
  321|      4|    store->libctx = ctx;
  322|      4|    store->use_fallbacks = 1;
  323|       |
  324|      4|    return store;
  325|      4|}
ossl_provider_info_add_to_store:
  355|      2|{
  356|      2|    struct provider_store_st *store = get_provider_store(libctx);
  357|      2|    int ret = 0;
  358|       |
  359|      2|    if (entry->name == NULL) {
  ------------------
  |  Branch (359:9): [True: 0, False: 2]
  ------------------
  360|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  361|      0|        return 0;
  362|      0|    }
  363|       |
  364|      2|    if (store == NULL) {
  ------------------
  |  Branch (364:9): [True: 0, False: 2]
  ------------------
  365|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  366|      0|        return 0;
  367|      0|    }
  368|       |
  369|      2|    if (!CRYPTO_THREAD_write_lock(store->lock))
  ------------------
  |  Branch (369:9): [True: 0, False: 2]
  ------------------
  370|      0|        return 0;
  371|      2|    if (store->provinfosz == 0) {
  ------------------
  |  Branch (371:9): [True: 2, False: 0]
  ------------------
  372|      2|        store->provinfo = OPENSSL_zalloc(sizeof(*store->provinfo)
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  373|      2|                                         * BUILTINS_BLOCK_SIZE);
  374|      2|        if (store->provinfo == NULL)
  ------------------
  |  Branch (374:13): [True: 0, False: 2]
  ------------------
  375|      0|            goto err;
  376|      2|        store->provinfosz = BUILTINS_BLOCK_SIZE;
  ------------------
  |  |  351|      2|#define BUILTINS_BLOCK_SIZE     10
  ------------------
  377|      2|    } else if (store->numprovinfo == store->provinfosz) {
  ------------------
  |  Branch (377:16): [True: 0, False: 0]
  ------------------
  378|      0|        OSSL_PROVIDER_INFO *tmpbuiltins;
  379|      0|        size_t newsz = store->provinfosz + BUILTINS_BLOCK_SIZE;
  ------------------
  |  |  351|      0|#define BUILTINS_BLOCK_SIZE     10
  ------------------
  380|       |
  381|      0|        tmpbuiltins = OPENSSL_realloc(store->provinfo,
  ------------------
  |  |  101|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  382|      0|                                      sizeof(*store->provinfo) * newsz);
  383|      0|        if (tmpbuiltins == NULL)
  ------------------
  |  Branch (383:13): [True: 0, False: 0]
  ------------------
  384|      0|            goto err;
  385|      0|        store->provinfo = tmpbuiltins;
  386|      0|        store->provinfosz = newsz;
  387|      0|    }
  388|      2|    store->provinfo[store->numprovinfo] = *entry;
  389|      2|    store->numprovinfo++;
  390|       |
  391|      2|    ret = 1;
  392|      2| err:
  393|      2|    CRYPTO_THREAD_unlock(store->lock);
  394|      2|    return ret;
  395|      2|}
ossl_provider_find:
  399|      2|{
  400|      2|    struct provider_store_st *store = NULL;
  401|      2|    OSSL_PROVIDER *prov = NULL;
  402|       |
  403|      2|    if ((store = get_provider_store(libctx)) != NULL) {
  ------------------
  |  Branch (403:9): [True: 2, False: 0]
  ------------------
  404|      2|        OSSL_PROVIDER tmpl = { 0, };
  405|      2|        int i;
  406|       |
  407|      2|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
  408|       |        /*
  409|       |         * Make sure any providers are loaded from config before we try to find
  410|       |         * them.
  411|       |         */
  412|      2|        if (!noconfig) {
  ------------------
  |  Branch (412:13): [True: 2, False: 0]
  ------------------
  413|      2|            if (ossl_lib_ctx_is_default(libctx))
  ------------------
  |  Branch (413:17): [True: 2, False: 0]
  ------------------
  414|      2|                OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  455|      2|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  415|      2|        }
  416|      2|#endif
  417|       |
  418|      2|        tmpl.name = (char *)name;
  419|      2|        if (!CRYPTO_THREAD_write_lock(store->lock))
  ------------------
  |  Branch (419:13): [True: 0, False: 2]
  ------------------
  420|      0|            return NULL;
  421|      2|        sk_OSSL_PROVIDER_sort(store->providers);
  422|      2|        if ((i = sk_OSSL_PROVIDER_find(store->providers, &tmpl)) != -1)
  ------------------
  |  Branch (422:13): [True: 0, False: 2]
  ------------------
  423|      0|            prov = sk_OSSL_PROVIDER_value(store->providers, i);
  424|      2|        CRYPTO_THREAD_unlock(store->lock);
  425|      2|        if (prov != NULL && !ossl_provider_up_ref(prov))
  ------------------
  |  Branch (425:13): [True: 0, False: 2]
  |  Branch (425:29): [True: 0, False: 0]
  ------------------
  426|      0|            prov = NULL;
  427|      2|    }
  428|       |
  429|      2|    return prov;
  430|      2|}
ossl_provider_up_ref:
  477|    208|{
  478|    208|    int ref = 0;
  479|       |
  480|    208|    if (CRYPTO_UP_REF(&prov->refcnt, &ref) <= 0)
  ------------------
  |  Branch (480:9): [True: 0, False: 208]
  ------------------
  481|      0|        return 0;
  482|       |
  483|    208|#ifndef FIPS_MODULE
  484|    208|    if (prov->ischild) {
  ------------------
  |  Branch (484:9): [True: 0, False: 208]
  ------------------
  485|      0|        if (!ossl_provider_up_ref_parent(prov, 0)) {
  ------------------
  |  Branch (485:13): [True: 0, False: 0]
  ------------------
  486|      0|            ossl_provider_free(prov);
  487|      0|            return 0;
  488|      0|        }
  489|      0|    }
  490|    208|#endif
  491|       |
  492|    208|    return ref;
  493|    208|}
ossl_provider_new:
  522|      2|{
  523|      2|    struct provider_store_st *store = NULL;
  524|      2|    OSSL_PROVIDER_INFO template;
  525|      2|    OSSL_PROVIDER *prov = NULL;
  526|       |
  527|      2|    if ((store = get_provider_store(libctx)) == NULL)
  ------------------
  |  Branch (527:9): [True: 0, False: 2]
  ------------------
  528|      0|        return NULL;
  529|       |
  530|      2|    memset(&template, 0, sizeof(template));
  531|      2|    if (init_function == NULL) {
  ------------------
  |  Branch (531:9): [True: 2, False: 0]
  ------------------
  532|      2|        const OSSL_PROVIDER_INFO *p;
  533|      2|        size_t i;
  534|       |
  535|       |        /* Check if this is a predefined builtin provider */
  536|      8|        for (p = ossl_predefined_providers; p->name != NULL; p++) {
  ------------------
  |  Branch (536:45): [True: 6, False: 2]
  ------------------
  537|      6|            if (strcmp(p->name, name) == 0) {
  ------------------
  |  Branch (537:17): [True: 0, False: 6]
  ------------------
  538|      0|                template = *p;
  539|      0|                break;
  540|      0|            }
  541|      6|        }
  542|      2|        if (p->name == NULL) {
  ------------------
  |  Branch (542:13): [True: 2, False: 0]
  ------------------
  543|       |            /* Check if this is a user added provider */
  544|      2|            if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (544:17): [True: 0, False: 2]
  ------------------
  545|      0|                return NULL;
  546|      2|            for (i = 0, p = store->provinfo; i < store->numprovinfo; p++, i++) {
  ------------------
  |  Branch (546:46): [True: 2, False: 0]
  ------------------
  547|      2|                if (strcmp(p->name, name) == 0) {
  ------------------
  |  Branch (547:21): [True: 2, False: 0]
  ------------------
  548|      2|                    template = *p;
  549|      2|                    break;
  550|      2|                }
  551|      2|            }
  552|      2|            CRYPTO_THREAD_unlock(store->lock);
  553|      2|        }
  554|      2|    } else {
  555|      0|        template.init = init_function;
  556|      0|    }
  557|       |
  558|      2|    if (params != NULL) {
  ------------------
  |  Branch (558:9): [True: 0, False: 2]
  ------------------
  559|      0|        int i;
  560|       |
  561|      0|        template.parameters = sk_INFOPAIR_new_null();
  562|      0|        if (template.parameters == NULL)
  ------------------
  |  Branch (562:13): [True: 0, False: 0]
  ------------------
  563|      0|            return NULL;
  564|       |
  565|      0|        for (i = 0; params[i].key != NULL; i++) {
  ------------------
  |  Branch (565:21): [True: 0, False: 0]
  ------------------
  566|      0|            if (params[i].data_type != OSSL_PARAM_UTF8_STRING)
  ------------------
  |  |  117|      0|# define OSSL_PARAM_UTF8_STRING          4
  ------------------
  |  Branch (566:17): [True: 0, False: 0]
  ------------------
  567|      0|                continue;
  568|      0|            if (ossl_provider_info_add_parameter(&template, params[i].key,
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|      0|                                                 (char *)params[i].data) <= 0)
  570|      0|                return NULL;
  571|      0|        }
  572|      0|    }
  573|       |
  574|       |    /* provider_new() generates an error, so no need here */
  575|      2|    prov = provider_new(name, template.init, template.parameters);
  576|       |
  577|      2|    if (params != NULL) /* We copied the parameters, let's free them */
  ------------------
  |  Branch (577:9): [True: 0, False: 2]
  ------------------
  578|      0|        sk_INFOPAIR_pop_free(template.parameters, infopair_free);
  579|       |
  580|      2|    if (prov == NULL)
  ------------------
  |  Branch (580:9): [True: 0, False: 2]
  ------------------
  581|      0|        return NULL;
  582|       |
  583|      2|    prov->libctx = libctx;
  584|      2|#ifndef FIPS_MODULE
  585|      2|    prov->error_lib = ERR_get_next_error_library();
  586|      2|#endif
  587|       |
  588|       |    /*
  589|       |     * At this point, the provider is only partially "loaded".  To be
  590|       |     * fully "loaded", ossl_provider_activate() must also be called and it must
  591|       |     * then be added to the provider store.
  592|       |     */
  593|       |
  594|      2|    return prov;
  595|      2|}
ossl_provider_add_to_store:
  622|      2|{
  623|      2|    struct provider_store_st *store;
  624|      2|    int idx;
  625|      2|    OSSL_PROVIDER tmpl = { 0, };
  626|      2|    OSSL_PROVIDER *actualtmp = NULL;
  627|       |
  628|      2|    if (actualprov != NULL)
  ------------------
  |  Branch (628:9): [True: 2, False: 0]
  ------------------
  629|      2|        *actualprov = NULL;
  630|       |
  631|      2|    if ((store = get_provider_store(prov->libctx)) == NULL)
  ------------------
  |  Branch (631:9): [True: 0, False: 2]
  ------------------
  632|      0|        return 0;
  633|       |
  634|      2|    if (!CRYPTO_THREAD_write_lock(store->lock))
  ------------------
  |  Branch (634:9): [True: 0, False: 2]
  ------------------
  635|      0|        return 0;
  636|       |
  637|      2|    tmpl.name = (char *)prov->name;
  638|      2|    idx = sk_OSSL_PROVIDER_find(store->providers, &tmpl);
  639|      2|    if (idx == -1)
  ------------------
  |  Branch (639:9): [True: 2, False: 0]
  ------------------
  640|      2|        actualtmp = prov;
  641|      0|    else
  642|      0|        actualtmp = sk_OSSL_PROVIDER_value(store->providers, idx);
  643|       |
  644|      2|    if (idx == -1) {
  ------------------
  |  Branch (644:9): [True: 2, False: 0]
  ------------------
  645|      2|        if (sk_OSSL_PROVIDER_push(store->providers, prov) == 0)
  ------------------
  |  Branch (645:13): [True: 0, False: 2]
  ------------------
  646|      0|            goto err;
  647|      2|        prov->store = store;
  648|      2|        if (!create_provider_children(prov)) {
  ------------------
  |  Branch (648:13): [True: 0, False: 2]
  ------------------
  649|      0|            sk_OSSL_PROVIDER_delete_ptr(store->providers, prov);
  650|      0|            goto err;
  651|      0|        }
  652|      2|        if (!retain_fallbacks)
  ------------------
  |  Branch (652:13): [True: 0, False: 2]
  ------------------
  653|      0|            store->use_fallbacks = 0;
  654|      2|    }
  655|       |
  656|      2|    CRYPTO_THREAD_unlock(store->lock);
  657|       |
  658|      2|    if (actualprov != NULL) {
  ------------------
  |  Branch (658:9): [True: 2, False: 0]
  ------------------
  659|      2|        if (!ossl_provider_up_ref(actualtmp)) {
  ------------------
  |  Branch (659:13): [True: 0, False: 2]
  ------------------
  660|      0|            ERR_raise(ERR_LIB_CRYPTO, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  661|      0|            actualtmp = NULL;
  662|      0|            return 0;
  663|      0|        }
  664|      2|        *actualprov = actualtmp;
  665|      2|    }
  666|       |
  667|      2|    if (idx >= 0) {
  ------------------
  |  Branch (667:9): [True: 0, False: 2]
  ------------------
  668|       |        /*
  669|       |         * The provider is already in the store. Probably two threads
  670|       |         * independently initialised their own provider objects with the same
  671|       |         * name and raced to put them in the store. This thread lost. We
  672|       |         * deactivate the one we just created and use the one that already
  673|       |         * exists instead.
  674|       |         * If we get here then we know we did not create provider children
  675|       |         * above, so we inform ossl_provider_deactivate not to attempt to remove
  676|       |         * any.
  677|       |         */
  678|      0|        ossl_provider_deactivate(prov, 0);
  679|      0|        ossl_provider_free(prov);
  680|      0|    }
  681|      2|#ifndef FIPS_MODULE
  682|      2|    else {
  683|       |        /*
  684|       |         * This can be done outside the lock. We tolerate other threads getting
  685|       |         * the wrong result briefly when creating OSSL_DECODER_CTXs.
  686|       |         */
  687|      2|        ossl_decoder_cache_flush(prov->libctx);
  688|      2|    }
  689|      2|#endif
  690|       |
  691|      2|    return 1;
  692|       |
  693|      0| err:
  694|      0|    CRYPTO_THREAD_unlock(store->lock);
  695|      0|    return 0;
  696|      2|}
ossl_provider_free:
  699|    209|{
  700|    209|    if (prov != NULL) {
  ------------------
  |  Branch (700:9): [True: 209, False: 0]
  ------------------
  701|    209|        int ref = 0;
  702|       |
  703|    209|        CRYPTO_DOWN_REF(&prov->refcnt, &ref);
  704|       |
  705|       |        /*
  706|       |         * When the refcount drops to zero, we clean up the provider.
  707|       |         * Note that this also does teardown, which may seem late,
  708|       |         * considering that init happens on first activation.  However,
  709|       |         * there may be other structures hanging on to the provider after
  710|       |         * the last deactivation and may therefore need full access to the
  711|       |         * provider's services.  Therefore, we deinit late.
  712|       |         */
  713|    209|        if (ref == 0) {
  ------------------
  |  Branch (713:13): [True: 1, False: 208]
  ------------------
  714|      1|            if (prov->flag_initialized) {
  ------------------
  |  Branch (714:17): [True: 1, False: 0]
  ------------------
  715|      1|                ossl_provider_teardown(prov);
  716|      1|#ifndef OPENSSL_NO_ERR
  717|      1|# ifndef FIPS_MODULE
  718|      1|                if (prov->error_strings != NULL) {
  ------------------
  |  Branch (718:21): [True: 0, False: 1]
  ------------------
  719|      0|                    ERR_unload_strings(prov->error_lib, prov->error_strings);
  720|      0|                    OPENSSL_free(prov->error_strings);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  721|      0|                    prov->error_strings = NULL;
  722|      0|                }
  723|      1|# endif
  724|      1|#endif
  725|      1|                OPENSSL_free(prov->operation_bits);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  726|      1|                prov->operation_bits = NULL;
  727|      1|                prov->operation_bits_sz = 0;
  728|      1|                prov->flag_initialized = 0;
  729|      1|            }
  730|       |
  731|      1|#ifndef FIPS_MODULE
  732|       |            /*
  733|       |             * We deregister thread handling whether or not the provider was
  734|       |             * initialized. If init was attempted but was not successful then
  735|       |             * the provider may still have registered a thread handler.
  736|       |             */
  737|      1|            ossl_init_thread_deregister(prov);
  738|      1|            DSO_free(prov->module);
  739|      1|#endif
  740|      1|            OPENSSL_free(prov->name);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  741|      1|            OPENSSL_free(prov->path);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  742|      1|            sk_INFOPAIR_pop_free(prov->parameters, infopair_free);
  743|      1|            CRYPTO_THREAD_lock_free(prov->opbits_lock);
  744|      1|            CRYPTO_THREAD_lock_free(prov->flag_lock);
  745|       |#ifndef HAVE_ATOMICS
  746|       |            CRYPTO_THREAD_lock_free(prov->activatecnt_lock);
  747|       |#endif
  748|      1|            CRYPTO_FREE_REF(&prov->refcnt);
  749|      1|            OPENSSL_free(prov);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  750|      1|        }
  751|    208|#ifndef FIPS_MODULE
  752|    208|        else if (prov->ischild) {
  ------------------
  |  Branch (752:18): [True: 0, False: 208]
  ------------------
  753|      0|            ossl_provider_free_parent(prov, 0);
  754|      0|        }
  755|    209|#endif
  756|    209|    }
  757|    209|}
ossl_provider_activate:
 1295|      2|{
 1296|      2|    int count;
 1297|       |
 1298|      2|    if (prov == NULL)
  ------------------
  |  Branch (1298:9): [True: 0, False: 2]
  ------------------
 1299|      0|        return 0;
 1300|      2|#ifndef FIPS_MODULE
 1301|       |    /*
 1302|       |     * If aschild is true, then we only actually do the activation if the
 1303|       |     * provider is a child. If its not, this is still success.
 1304|       |     */
 1305|      2|    if (aschild && !prov->ischild)
  ------------------
  |  Branch (1305:9): [True: 0, False: 2]
  |  Branch (1305:20): [True: 0, False: 0]
  ------------------
 1306|      0|        return 1;
 1307|      2|#endif
 1308|      2|    if ((count = provider_activate(prov, 1, upcalls)) > 0)
  ------------------
  |  Branch (1308:9): [True: 2, False: 0]
  ------------------
 1309|      2|        return count == 1 ? provider_flush_store_cache(prov) : 1;
  ------------------
  |  Branch (1309:16): [True: 2, False: 0]
  ------------------
 1310|       |
 1311|      0|    return 0;
 1312|      2|}
ossl_provider_deactivate:
 1315|      3|{
 1316|      3|    int count;
 1317|       |
 1318|      3|    if (prov == NULL
  ------------------
  |  Branch (1318:9): [True: 0, False: 3]
  ------------------
 1319|      3|            || (count = provider_deactivate(prov, 1, removechildren)) < 0)
  ------------------
  |  Branch (1319:16): [True: 0, False: 3]
  ------------------
 1320|      0|        return 0;
 1321|      3|    return count == 0 ? provider_remove_store_methods(prov) : 1;
  ------------------
  |  Branch (1321:12): [True: 3, False: 0]
  ------------------
 1322|      3|}
ossl_provider_ctx:
 1325|  7.34k|{
 1326|  7.34k|    return prov != NULL ? prov->provctx : NULL;
  ------------------
  |  Branch (1326:12): [True: 7.34k, False: 0]
  ------------------
 1327|  7.34k|}
ossl_provider_doall_activated:
 1405|  6.74k|{
 1406|  6.74k|    int ret = 0, curr, max, ref = 0;
 1407|  6.74k|    struct provider_store_st *store = get_provider_store(ctx);
 1408|  6.74k|    STACK_OF(OSSL_PROVIDER) *provs = NULL;
  ------------------
  |  |   31|  6.74k|# define STACK_OF(type) struct stack_st_##type
  ------------------
 1409|       |
 1410|  6.74k|#if !defined(FIPS_MODULE) && !defined(OPENSSL_NO_AUTOLOAD_CONFIG)
 1411|       |    /*
 1412|       |     * Make sure any providers are loaded from config before we try to use
 1413|       |     * them.
 1414|       |     */
 1415|  6.74k|    if (ossl_lib_ctx_is_default(ctx))
  ------------------
  |  Branch (1415:9): [True: 6.74k, False: 0]
  ------------------
 1416|  6.74k|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
  ------------------
  |  |  455|  6.74k|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
 1417|  6.74k|#endif
 1418|       |
 1419|  6.74k|    if (store == NULL)
  ------------------
  |  Branch (1419:9): [True: 0, False: 6.74k]
  ------------------
 1420|      0|        return 1;
 1421|  6.74k|    if (!provider_activate_fallbacks(store))
  ------------------
  |  Branch (1421:9): [True: 0, False: 6.74k]
  ------------------
 1422|      0|        return 0;
 1423|       |
 1424|       |    /*
 1425|       |     * Under lock, grab a copy of the provider list and up_ref each
 1426|       |     * provider so that they don't disappear underneath us.
 1427|       |     */
 1428|  6.74k|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1428:9): [True: 0, False: 6.74k]
  ------------------
 1429|      0|        return 0;
 1430|  6.74k|    provs = sk_OSSL_PROVIDER_dup(store->providers);
 1431|  6.74k|    if (provs == NULL) {
  ------------------
  |  Branch (1431:9): [True: 0, False: 6.74k]
  ------------------
 1432|      0|        CRYPTO_THREAD_unlock(store->lock);
 1433|      0|        return 0;
 1434|      0|    }
 1435|  6.74k|    max = sk_OSSL_PROVIDER_num(provs);
 1436|       |    /*
 1437|       |     * We work backwards through the stack so that we can safely delete items
 1438|       |     * as we go.
 1439|       |     */
 1440|  20.2k|    for (curr = max - 1; curr >= 0; curr--) {
  ------------------
  |  Branch (1440:26): [True: 13.4k, False: 6.74k]
  ------------------
 1441|  13.4k|        OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(provs, curr);
 1442|       |
 1443|  13.4k|        if (!CRYPTO_THREAD_read_lock(prov->flag_lock))
  ------------------
  |  Branch (1443:13): [True: 0, False: 13.4k]
  ------------------
 1444|      0|            goto err_unlock;
 1445|  13.4k|        if (prov->flag_activated) {
  ------------------
  |  Branch (1445:13): [True: 13.4k, False: 0]
  ------------------
 1446|       |            /*
 1447|       |             * We call CRYPTO_UP_REF directly rather than ossl_provider_up_ref
 1448|       |             * to avoid upping the ref count on the parent provider, which we
 1449|       |             * must not do while holding locks.
 1450|       |             */
 1451|  13.4k|            if (CRYPTO_UP_REF(&prov->refcnt, &ref) <= 0) {
  ------------------
  |  Branch (1451:17): [True: 0, False: 13.4k]
  ------------------
 1452|      0|                CRYPTO_THREAD_unlock(prov->flag_lock);
 1453|      0|                goto err_unlock;
 1454|      0|            }
 1455|       |            /*
 1456|       |             * It's already activated, but we up the activated count to ensure
 1457|       |             * it remains activated until after we've called the user callback.
 1458|       |             * In theory this could mean the parent provider goes inactive,
 1459|       |             * whilst still activated in the child for a short period. That's ok.
 1460|       |             */
 1461|  13.4k|            if (!CRYPTO_atomic_add(&prov->activatecnt, 1, &ref,
  ------------------
  |  Branch (1461:17): [True: 0, False: 13.4k]
  ------------------
 1462|  13.4k|                                   prov->activatecnt_lock)) {
 1463|      0|                CRYPTO_DOWN_REF(&prov->refcnt, &ref);
 1464|      0|                CRYPTO_THREAD_unlock(prov->flag_lock);
 1465|      0|                goto err_unlock;
 1466|      0|            }
 1467|  13.4k|        } else {
 1468|      0|            sk_OSSL_PROVIDER_delete(provs, curr);
 1469|      0|            max--;
 1470|      0|        }
 1471|  13.4k|        CRYPTO_THREAD_unlock(prov->flag_lock);
 1472|  13.4k|    }
 1473|  6.74k|    CRYPTO_THREAD_unlock(store->lock);
 1474|       |
 1475|       |    /*
 1476|       |     * Now, we sweep through all providers not under lock
 1477|       |     */
 1478|  20.2k|    for (curr = 0; curr < max; curr++) {
  ------------------
  |  Branch (1478:20): [True: 13.4k, False: 6.74k]
  ------------------
 1479|  13.4k|        OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(provs, curr);
 1480|       |
 1481|  13.4k|        if (!cb(prov, cbdata)) {
  ------------------
  |  Branch (1481:13): [True: 0, False: 13.4k]
  ------------------
 1482|      0|            curr = -1;
 1483|      0|            goto finish;
 1484|      0|        }
 1485|  13.4k|    }
 1486|  6.74k|    curr = -1;
 1487|       |
 1488|  6.74k|    ret = 1;
 1489|  6.74k|    goto finish;
 1490|       |
 1491|      0| err_unlock:
 1492|      0|    CRYPTO_THREAD_unlock(store->lock);
 1493|  6.74k| finish:
 1494|       |    /*
 1495|       |     * The pop_free call doesn't do what we want on an error condition. We
 1496|       |     * either start from the first item in the stack, or part way through if
 1497|       |     * we only processed some of the items.
 1498|       |     */
 1499|  20.2k|    for (curr++; curr < max; curr++) {
  ------------------
  |  Branch (1499:18): [True: 13.4k, False: 6.74k]
  ------------------
 1500|  13.4k|        OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(provs, curr);
 1501|       |
 1502|  13.4k|        if (!CRYPTO_atomic_add(&prov->activatecnt, -1, &ref,
  ------------------
  |  Branch (1502:13): [True: 0, False: 13.4k]
  ------------------
 1503|  13.4k|                               prov->activatecnt_lock)) {
 1504|      0|            ret = 0;
 1505|      0|            continue;
 1506|      0|        }
 1507|  13.4k|        if (ref < 1) {
  ------------------
  |  Branch (1507:13): [True: 0, False: 13.4k]
  ------------------
 1508|       |            /*
 1509|       |             * Looks like we need to deactivate properly. We could just have
 1510|       |             * done this originally, but it involves taking a write lock so
 1511|       |             * we avoid it. We up the count again and do a full deactivation
 1512|       |             */
 1513|      0|            if (CRYPTO_atomic_add(&prov->activatecnt, 1, &ref,
  ------------------
  |  Branch (1513:17): [True: 0, False: 0]
  ------------------
 1514|      0|                                  prov->activatecnt_lock))
 1515|      0|                provider_deactivate(prov, 0, 1);
 1516|      0|            else
 1517|      0|                ret = 0;
 1518|      0|        }
 1519|       |        /*
 1520|       |         * As above where we did the up-ref, we don't call ossl_provider_free
 1521|       |         * to avoid making upcalls. There should always be at least one ref
 1522|       |         * to the provider in the store, so this should never drop to 0.
 1523|       |         */
 1524|  13.4k|        if (!CRYPTO_DOWN_REF(&prov->refcnt, &ref)) {
  ------------------
  |  Branch (1524:13): [True: 0, False: 13.4k]
  ------------------
 1525|      0|            ret = 0;
 1526|      0|            continue;
 1527|      0|        }
 1528|       |        /*
 1529|       |         * Not much we can do if this assert ever fails. So we don't use
 1530|       |         * ossl_assert here.
 1531|       |         */
 1532|  13.4k|        assert(ref > 0);
 1533|  13.4k|    }
 1534|  6.74k|    sk_OSSL_PROVIDER_free(provs);
 1535|  6.74k|    return ret;
 1536|  6.74k|}
ossl_provider_prov_ctx:
 1589|   866k|{
 1590|   866k|    if (prov != NULL)
  ------------------
  |  Branch (1590:9): [True: 866k, False: 0]
  ------------------
 1591|   866k|        return prov->provctx;
 1592|       |
 1593|      0|    return NULL;
 1594|   866k|}
ossl_provider_libctx:
 1605|   239k|{
 1606|   239k|    return prov != NULL ? prov->libctx : NULL;
  ------------------
  |  Branch (1606:12): [True: 232k, False: 7.33k]
  ------------------
 1607|   239k|}
ossl_provider_teardown:
 1611|      1|{
 1612|      1|    if (prov->teardown != NULL
  ------------------
  |  Branch (1612:9): [True: 1, False: 0]
  ------------------
 1613|      1|#ifndef FIPS_MODULE
 1614|      1|            && !prov->ischild
  ------------------
  |  Branch (1614:16): [True: 1, False: 0]
  ------------------
 1615|      1|#endif
 1616|      1|       )
 1617|      1|        prov->teardown(prov->provctx);
 1618|      1|}
ossl_provider_query_operation:
 1656|  13.4k|{
 1657|  13.4k|    const OSSL_ALGORITHM *res;
 1658|       |
 1659|  13.4k|    if (prov->query_operation == NULL)
  ------------------
  |  Branch (1659:9): [True: 0, False: 13.4k]
  ------------------
 1660|      0|        return NULL;
 1661|  13.4k|    res = prov->query_operation(prov->provctx, operation_id, no_cache);
 1662|       |#if defined(OPENSSL_NO_CACHED_FETCH)
 1663|       |    /* Forcing the non-caching of queries */
 1664|       |    if (no_cache != NULL)
 1665|       |        *no_cache = 1;
 1666|       |#endif
 1667|  13.4k|    return res;
 1668|  13.4k|}
ossl_provider_unquery_operation:
 1673|  13.4k|{
 1674|  13.4k|    if (prov->unquery_operation != NULL)
  ------------------
  |  Branch (1674:9): [True: 0, False: 13.4k]
  ------------------
 1675|      0|        prov->unquery_operation(prov->provctx, operation_id, algs);
 1676|  13.4k|}
ossl_provider_set_operation_bit:
 1679|     10|{
 1680|     10|    size_t byte = bitnum / 8;
 1681|     10|    unsigned char bit = (1 << (bitnum % 8)) & 0xFF;
 1682|       |
 1683|     10|    if (!CRYPTO_THREAD_write_lock(provider->opbits_lock))
  ------------------
  |  Branch (1683:9): [True: 0, False: 10]
  ------------------
 1684|      0|        return 0;
 1685|     10|    if (provider->operation_bits_sz <= byte) {
  ------------------
  |  Branch (1685:9): [True: 4, False: 6]
  ------------------
 1686|      4|        unsigned char *tmp = OPENSSL_realloc(provider->operation_bits,
  ------------------
  |  |  101|      4|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1687|      4|                                             byte + 1);
 1688|       |
 1689|      4|        if (tmp == NULL) {
  ------------------
  |  Branch (1689:13): [True: 0, False: 4]
  ------------------
 1690|      0|            CRYPTO_THREAD_unlock(provider->opbits_lock);
 1691|      0|            return 0;
 1692|      0|        }
 1693|      4|        provider->operation_bits = tmp;
 1694|      4|        memset(provider->operation_bits + provider->operation_bits_sz,
 1695|      4|               '\0', byte + 1 - provider->operation_bits_sz);
 1696|      4|        provider->operation_bits_sz = byte + 1;
 1697|      4|    }
 1698|     10|    provider->operation_bits[byte] |= bit;
 1699|     10|    CRYPTO_THREAD_unlock(provider->opbits_lock);
 1700|     10|    return 1;
 1701|     10|}
ossl_provider_test_operation_bit:
 1705|  13.4k|{
 1706|  13.4k|    size_t byte = bitnum / 8;
 1707|  13.4k|    unsigned char bit = (1 << (bitnum % 8)) & 0xFF;
 1708|       |
 1709|  13.4k|    if (!ossl_assert(result != NULL)) {
  ------------------
  |  |   52|  13.4k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  13.4k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1709:9): [True: 0, False: 13.4k]
  ------------------
 1710|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1711|      0|        return 0;
 1712|      0|    }
 1713|       |
 1714|  13.4k|    *result = 0;
 1715|  13.4k|    if (!CRYPTO_THREAD_read_lock(provider->opbits_lock))
  ------------------
  |  Branch (1715:9): [True: 0, False: 13.4k]
  ------------------
 1716|      0|        return 0;
 1717|  13.4k|    if (provider->operation_bits_sz > byte)
  ------------------
  |  Branch (1717:9): [True: 13.4k, False: 4]
  ------------------
 1718|  13.4k|        *result = ((provider->operation_bits[byte] & bit) != 0);
 1719|  13.4k|    CRYPTO_THREAD_unlock(provider->opbits_lock);
 1720|  13.4k|    return 1;
 1721|  13.4k|}
provider_core.c:provider_deactivate_free:
  235|      3|{
  236|      3|    if (prov->flag_activated)
  ------------------
  |  Branch (236:9): [True: 3, False: 0]
  ------------------
  237|      3|        ossl_provider_deactivate(prov, 1);
  238|      3|    ossl_provider_free(prov);
  239|      3|}
provider_core.c:get_provider_store:
  328|  6.76k|{
  329|  6.76k|    struct provider_store_st *store = NULL;
  330|       |
  331|  6.76k|    store = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_STORE_INDEX);
  ------------------
  |  |   99|  6.76k|# define OSSL_LIB_CTX_PROVIDER_STORE_INDEX           1
  ------------------
  332|  6.76k|    if (store == NULL)
  ------------------
  |  Branch (332:9): [True: 0, False: 6.76k]
  ------------------
  333|  6.76k|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  334|  6.76k|    return store;
  335|  6.76k|}
provider_core.c:provider_new:
  440|      3|{
  441|      3|    OSSL_PROVIDER *prov = NULL;
  442|       |
  443|      3|    if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL)
  ------------------
  |  |   99|      3|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (443:9): [True: 0, False: 3]
  ------------------
  444|      0|        return NULL;
  445|      3|    if (!CRYPTO_NEW_REF(&prov->refcnt, 1)) {
  ------------------
  |  Branch (445:9): [True: 0, False: 3]
  ------------------
  446|      0|        OPENSSL_free(prov);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  447|      0|        return NULL;
  448|      0|    }
  449|       |#ifndef HAVE_ATOMICS
  450|       |    if ((prov->activatecnt_lock = CRYPTO_THREAD_lock_new()) == NULL) {
  451|       |        ossl_provider_free(prov);
  452|       |        ERR_raise(ERR_LIB_CRYPTO, ERR_R_CRYPTO_LIB);
  453|       |        return NULL;
  454|       |    }
  455|       |#endif
  456|       |
  457|      3|    if ((prov->opbits_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (457:9): [True: 0, False: 3]
  ------------------
  458|      3|        || (prov->flag_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (458:12): [True: 0, False: 3]
  ------------------
  459|      3|        || (prov->parameters = sk_INFOPAIR_deep_copy(parameters,
  ------------------
  |  Branch (459:12): [True: 0, False: 3]
  ------------------
  460|      3|                                                     infopair_copy,
  461|      3|                                                     infopair_free)) == NULL) {
  462|      0|        ossl_provider_free(prov);
  463|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  464|      0|        return NULL;
  465|      0|    }
  466|      3|    if ((prov->name = OPENSSL_strdup(name)) == NULL) {
  ------------------
  |  |  111|      3|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      3|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      3|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (466:9): [True: 0, False: 3]
  ------------------
  467|      0|        ossl_provider_free(prov);
  468|      0|        return NULL;
  469|      0|    }
  470|       |
  471|      3|    prov->init_function = init_function;
  472|       |
  473|      3|    return prov;
  474|      3|}
provider_core.c:create_provider_children:
  599|      2|{
  600|      2|    int ret = 1;
  601|      2|#ifndef FIPS_MODULE
  602|      2|    struct provider_store_st *store = prov->store;
  603|      2|    OSSL_PROVIDER_CHILD_CB *child_cb;
  604|      2|    int i, max;
  605|       |
  606|      2|    max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs);
  607|      2|    for (i = 0; i < max; i++) {
  ------------------
  |  Branch (607:17): [True: 0, False: 2]
  ------------------
  608|       |        /*
  609|       |         * This is newly activated (activatecnt == 1), so we need to
  610|       |         * create child providers as necessary.
  611|       |         */
  612|      0|        child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i);
  613|      0|        ret &= child_cb->create_cb((OSSL_CORE_HANDLE *)prov, child_cb->cbdata);
  614|      0|    }
  615|      2|#endif
  616|       |
  617|      2|    return ret;
  618|      2|}
provider_core.c:provider_activate:
 1159|      3|{
 1160|      3|    int count = -1;
 1161|      3|    struct provider_store_st *store;
 1162|      3|    int ret = 1;
 1163|       |
 1164|      3|    store = prov->store;
 1165|       |    /*
 1166|       |    * If the provider hasn't been added to the store, then we don't need
 1167|       |    * any locks because we've not shared it with other threads.
 1168|       |    */
 1169|      3|    if (store == NULL) {
  ------------------
  |  Branch (1169:9): [True: 3, False: 0]
  ------------------
 1170|      3|        lock = 0;
 1171|      3|        if (!provider_init(prov))
  ------------------
  |  Branch (1171:13): [True: 0, False: 3]
  ------------------
 1172|      0|            return -1;
 1173|      3|    }
 1174|       |
 1175|      3|#ifndef FIPS_MODULE
 1176|      3|    if (prov->ischild && upcalls && !ossl_provider_up_ref_parent(prov, 1))
  ------------------
  |  Branch (1176:9): [True: 0, False: 3]
  |  Branch (1176:26): [True: 0, False: 0]
  |  Branch (1176:37): [True: 0, False: 0]
  ------------------
 1177|      0|        return -1;
 1178|      3|#endif
 1179|       |
 1180|      3|    if (lock && !CRYPTO_THREAD_read_lock(store->lock)) {
  ------------------
  |  Branch (1180:9): [True: 0, False: 3]
  |  Branch (1180:17): [True: 0, False: 0]
  ------------------
 1181|      0|#ifndef FIPS_MODULE
 1182|      0|        if (prov->ischild && upcalls)
  ------------------
  |  Branch (1182:13): [True: 0, False: 0]
  |  Branch (1182:30): [True: 0, False: 0]
  ------------------
 1183|      0|            ossl_provider_free_parent(prov, 1);
 1184|      0|#endif
 1185|      0|        return -1;
 1186|      0|    }
 1187|       |
 1188|      3|    if (lock && !CRYPTO_THREAD_write_lock(prov->flag_lock)) {
  ------------------
  |  Branch (1188:9): [True: 0, False: 3]
  |  Branch (1188:17): [True: 0, False: 0]
  ------------------
 1189|      0|        CRYPTO_THREAD_unlock(store->lock);
 1190|      0|#ifndef FIPS_MODULE
 1191|      0|        if (prov->ischild && upcalls)
  ------------------
  |  Branch (1191:13): [True: 0, False: 0]
  |  Branch (1191:30): [True: 0, False: 0]
  ------------------
 1192|      0|            ossl_provider_free_parent(prov, 1);
 1193|      0|#endif
 1194|      0|        return -1;
 1195|      0|    }
 1196|      3|    if (CRYPTO_atomic_add(&prov->activatecnt, 1, &count, prov->activatecnt_lock)) {
  ------------------
  |  Branch (1196:9): [True: 3, False: 0]
  ------------------
 1197|      3|        prov->flag_activated = 1;
 1198|       |
 1199|      3|        if (count == 1 && store != NULL) {
  ------------------
  |  Branch (1199:13): [True: 3, False: 0]
  |  Branch (1199:27): [True: 0, False: 3]
  ------------------
 1200|      0|            ret = create_provider_children(prov);
 1201|      0|        }
 1202|      3|    }
 1203|      3|    if (lock) {
  ------------------
  |  Branch (1203:9): [True: 0, False: 3]
  ------------------
 1204|      0|        CRYPTO_THREAD_unlock(prov->flag_lock);
 1205|      0|        CRYPTO_THREAD_unlock(store->lock);
 1206|       |        /*
 1207|       |         * This can be done outside the lock. We tolerate other threads getting
 1208|       |         * the wrong result briefly when creating OSSL_DECODER_CTXs.
 1209|       |         */
 1210|      0|#ifndef FIPS_MODULE
 1211|      0|        if (count == 1)
  ------------------
  |  Branch (1211:13): [True: 0, False: 0]
  ------------------
 1212|      0|            ossl_decoder_cache_flush(prov->libctx);
 1213|      0|#endif
 1214|      0|    }
 1215|       |
 1216|      3|    if (!ret)
  ------------------
  |  Branch (1216:9): [True: 0, False: 3]
  ------------------
 1217|      0|        return -1;
 1218|       |
 1219|      3|    return count;
 1220|      3|}
provider_core.c:provider_init:
  867|      3|{
  868|      3|    const OSSL_DISPATCH *provider_dispatch = NULL;
  869|      3|    void *tmp_provctx = NULL;    /* safety measure */
  870|      3|#ifndef OPENSSL_NO_ERR
  871|      3|# ifndef FIPS_MODULE
  872|      3|    OSSL_FUNC_provider_get_reason_strings_fn *p_get_reason_strings = NULL;
  873|      3|# endif
  874|      3|#endif
  875|      3|    int ok = 0;
  876|       |
  877|      3|    if (!ossl_assert(!prov->flag_initialized)) {
  ------------------
  |  |   52|      3|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      3|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (877:9): [True: 0, False: 3]
  ------------------
  878|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  879|      0|        goto end;
  880|      0|    }
  881|       |
  882|       |    /*
  883|       |     * If the init function isn't set, it indicates that this provider is
  884|       |     * a loadable module.
  885|       |     */
  886|      3|    if (prov->init_function == NULL) {
  ------------------
  |  Branch (886:9): [True: 0, False: 3]
  ------------------
  887|       |#ifdef FIPS_MODULE
  888|       |        goto end;
  889|       |#else
  890|      0|        if (prov->module == NULL) {
  ------------------
  |  Branch (890:13): [True: 0, False: 0]
  ------------------
  891|      0|            char *allocated_path = NULL;
  892|      0|            const char *module_path = NULL;
  893|      0|            char *merged_path = NULL;
  894|      0|            const char *load_dir = NULL;
  895|      0|            char *allocated_load_dir = NULL;
  896|      0|            struct provider_store_st *store;
  897|       |
  898|      0|            if ((prov->module = DSO_new()) == NULL) {
  ------------------
  |  Branch (898:17): [True: 0, False: 0]
  ------------------
  899|       |                /* DSO_new() generates an error already */
  900|      0|                goto end;
  901|      0|            }
  902|       |
  903|      0|            if ((store = get_provider_store(prov->libctx)) == NULL
  ------------------
  |  Branch (903:17): [True: 0, False: 0]
  ------------------
  904|      0|                    || !CRYPTO_THREAD_read_lock(store->default_path_lock))
  ------------------
  |  Branch (904:24): [True: 0, False: 0]
  ------------------
  905|      0|                goto end;
  906|       |
  907|      0|            if (store->default_path != NULL) {
  ------------------
  |  Branch (907:17): [True: 0, False: 0]
  ------------------
  908|      0|                allocated_load_dir = OPENSSL_strdup(store->default_path);
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  909|      0|                CRYPTO_THREAD_unlock(store->default_path_lock);
  910|      0|                if (allocated_load_dir == NULL)
  ------------------
  |  Branch (910:21): [True: 0, False: 0]
  ------------------
  911|      0|                    goto end;
  912|      0|                load_dir = allocated_load_dir;
  913|      0|            } else {
  914|      0|                CRYPTO_THREAD_unlock(store->default_path_lock);
  915|      0|            }
  916|       |
  917|      0|            if (load_dir == NULL) {
  ------------------
  |  Branch (917:17): [True: 0, False: 0]
  ------------------
  918|      0|                load_dir = ossl_safe_getenv("OPENSSL_MODULES");
  919|      0|                if (load_dir == NULL)
  ------------------
  |  Branch (919:21): [True: 0, False: 0]
  ------------------
  920|      0|                    load_dir = MODULESDIR;
  921|      0|            }
  922|       |
  923|      0|            DSO_ctrl(prov->module, DSO_CTRL_SET_FLAGS,
  ------------------
  |  |   19|      0|# define DSO_CTRL_SET_FLAGS      2
  ------------------
  924|      0|                     DSO_FLAG_NAME_TRANSLATION_EXT_ONLY, NULL);
  ------------------
  |  |   41|      0|# define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY      0x02
  ------------------
  925|       |
  926|      0|            module_path = prov->path;
  927|      0|            if (module_path == NULL)
  ------------------
  |  Branch (927:17): [True: 0, False: 0]
  ------------------
  928|      0|                module_path = allocated_path =
  929|      0|                    DSO_convert_filename(prov->module, prov->name);
  930|      0|            if (module_path != NULL)
  ------------------
  |  Branch (930:17): [True: 0, False: 0]
  ------------------
  931|      0|                merged_path = DSO_merge(prov->module, module_path, load_dir);
  932|       |
  933|      0|            if (merged_path == NULL
  ------------------
  |  Branch (933:17): [True: 0, False: 0]
  ------------------
  934|      0|                || (DSO_load(prov->module, merged_path, NULL, 0)) == NULL) {
  ------------------
  |  Branch (934:20): [True: 0, False: 0]
  ------------------
  935|      0|                DSO_free(prov->module);
  936|      0|                prov->module = NULL;
  937|      0|            }
  938|       |
  939|      0|            OPENSSL_free(merged_path);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  940|      0|            OPENSSL_free(allocated_path);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  941|      0|            OPENSSL_free(allocated_load_dir);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  942|      0|        }
  943|       |
  944|      0|        if (prov->module == NULL) {
  ------------------
  |  Branch (944:13): [True: 0, False: 0]
  ------------------
  945|       |            /* DSO has already recorded errors, this is just a tracepoint */
  946|      0|            ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_DSO_LIB,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                          ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_DSO_LIB,
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                          ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_DSO_LIB,
  ------------------
  |  |  335|      0|# define ERR_R_DSO_LIB          (ERR_LIB_DSO/* 37 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |   98|      0|# define ERR_LIB_DSO             37
  |  |  ------------------
  |  |               # define ERR_R_DSO_LIB          (ERR_LIB_DSO/* 37 */ | ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  947|      0|                           "name=%s", prov->name);
  948|      0|            goto end;
  949|      0|        }
  950|       |
  951|      0|        prov->init_function = (OSSL_provider_init_fn *)
  952|      0|            DSO_bind_func(prov->module, "OSSL_provider_init");
  953|      0|#endif
  954|      0|    }
  955|       |
  956|       |    /* Check for and call the initialise function for the provider. */
  957|      3|    if (prov->init_function == NULL) {
  ------------------
  |  Branch (957:9): [True: 0, False: 3]
  ------------------
  958|      0|        ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_UNSUPPORTED,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_UNSUPPORTED,
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                      ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_UNSUPPORTED,
  ------------------
  |  |  363|      0|# define ERR_R_UNSUPPORTED                       (268|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  959|      0|                       "name=%s, provider has no provider init function",
  960|      0|                       prov->name);
  961|      0|        goto end;
  962|      0|    }
  963|       |
  964|      3|    if (!prov->init_function((OSSL_CORE_HANDLE *)prov, core_dispatch,
  ------------------
  |  Branch (964:9): [True: 0, False: 3]
  ------------------
  965|      3|                             &provider_dispatch, &tmp_provctx)) {
  966|      0|        ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_INIT_FAIL,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_INIT_FAIL,
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                      ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_INIT_FAIL,
  ------------------
  |  |  356|      0|# define ERR_R_INIT_FAIL                         (261|ERR_R_FATAL)
  |  |  ------------------
  |  |  |  |  350|      0|# define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  236|      0|# define ERR_RFLAG_FATAL                (0x1 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|                       "name=%s", prov->name);
  968|      0|        goto end;
  969|      0|    }
  970|      3|    prov->provctx = tmp_provctx;
  971|      3|    prov->dispatch = provider_dispatch;
  972|       |
  973|     12|    for (; provider_dispatch->function_id != 0; provider_dispatch++) {
  ------------------
  |  Branch (973:12): [True: 9, False: 3]
  ------------------
  974|      9|        switch (provider_dispatch->function_id) {
  ------------------
  |  Branch (974:17): [True: 0, False: 9]
  ------------------
  975|      3|        case OSSL_FUNC_PROVIDER_TEARDOWN:
  ------------------
  |  |  229|      3|# define OSSL_FUNC_PROVIDER_TEARDOWN           1024
  ------------------
  |  Branch (975:9): [True: 3, False: 6]
  ------------------
  976|      3|            prov->teardown =
  977|      3|                OSSL_FUNC_provider_teardown(provider_dispatch);
  978|      3|            break;
  979|      1|        case OSSL_FUNC_PROVIDER_GETTABLE_PARAMS:
  ------------------
  |  |  231|      1|# define OSSL_FUNC_PROVIDER_GETTABLE_PARAMS    1025
  ------------------
  |  Branch (979:9): [True: 1, False: 8]
  ------------------
  980|      1|            prov->gettable_params =
  981|      1|                OSSL_FUNC_provider_gettable_params(provider_dispatch);
  982|      1|            break;
  983|      1|        case OSSL_FUNC_PROVIDER_GET_PARAMS:
  ------------------
  |  |  234|      1|# define OSSL_FUNC_PROVIDER_GET_PARAMS         1026
  ------------------
  |  Branch (983:9): [True: 1, False: 8]
  ------------------
  984|      1|            prov->get_params =
  985|      1|                OSSL_FUNC_provider_get_params(provider_dispatch);
  986|      1|            break;
  987|      0|        case OSSL_FUNC_PROVIDER_SELF_TEST:
  ------------------
  |  |  249|      0|# define OSSL_FUNC_PROVIDER_SELF_TEST          1031
  ------------------
  |  Branch (987:9): [True: 0, False: 9]
  ------------------
  988|      0|            prov->self_test =
  989|      0|                OSSL_FUNC_provider_self_test(provider_dispatch);
  990|      0|            break;
  991|      1|        case OSSL_FUNC_PROVIDER_GET_CAPABILITIES:
  ------------------
  |  |  246|      1|# define OSSL_FUNC_PROVIDER_GET_CAPABILITIES   1030
  ------------------
  |  Branch (991:9): [True: 1, False: 8]
  ------------------
  992|      1|            prov->get_capabilities =
  993|      1|                OSSL_FUNC_provider_get_capabilities(provider_dispatch);
  994|      1|            break;
  995|      3|        case OSSL_FUNC_PROVIDER_QUERY_OPERATION:
  ------------------
  |  |  237|      3|# define OSSL_FUNC_PROVIDER_QUERY_OPERATION    1027
  ------------------
  |  Branch (995:9): [True: 3, False: 6]
  ------------------
  996|      3|            prov->query_operation =
  997|      3|                OSSL_FUNC_provider_query_operation(provider_dispatch);
  998|      3|            break;
  999|      0|        case OSSL_FUNC_PROVIDER_UNQUERY_OPERATION:
  ------------------
  |  |  240|      0|# define OSSL_FUNC_PROVIDER_UNQUERY_OPERATION  1028
  ------------------
  |  Branch (999:9): [True: 0, False: 9]
  ------------------
 1000|      0|            prov->unquery_operation =
 1001|      0|                OSSL_FUNC_provider_unquery_operation(provider_dispatch);
 1002|      0|            break;
 1003|      0|#ifndef OPENSSL_NO_ERR
 1004|      0|# ifndef FIPS_MODULE
 1005|      0|        case OSSL_FUNC_PROVIDER_GET_REASON_STRINGS:
  ------------------
  |  |  243|      0|# define OSSL_FUNC_PROVIDER_GET_REASON_STRINGS 1029
  ------------------
  |  Branch (1005:9): [True: 0, False: 9]
  ------------------
 1006|      0|            p_get_reason_strings =
 1007|      0|                OSSL_FUNC_provider_get_reason_strings(provider_dispatch);
 1008|      0|            break;
 1009|      9|# endif
 1010|      9|#endif
 1011|      9|        }
 1012|      9|    }
 1013|       |
 1014|      3|#ifndef OPENSSL_NO_ERR
 1015|      3|# ifndef FIPS_MODULE
 1016|      3|    if (p_get_reason_strings != NULL) {
  ------------------
  |  Branch (1016:9): [True: 0, False: 3]
  ------------------
 1017|      0|        const OSSL_ITEM *reasonstrings = p_get_reason_strings(prov->provctx);
 1018|      0|        size_t cnt, cnt2;
 1019|       |
 1020|       |        /*
 1021|       |         * ERR_load_strings() handles ERR_STRING_DATA rather than OSSL_ITEM,
 1022|       |         * although they are essentially the same type.
 1023|       |         * Furthermore, ERR_load_strings() patches the array's error number
 1024|       |         * with the error library number, so we need to make a copy of that
 1025|       |         * array either way.
 1026|       |         */
 1027|      0|        cnt = 0;
 1028|      0|        while (reasonstrings[cnt].id != 0) {
  ------------------
  |  Branch (1028:16): [True: 0, False: 0]
  ------------------
 1029|      0|            if (ERR_GET_LIB(reasonstrings[cnt].id) != 0)
  ------------------
  |  Branch (1029:17): [True: 0, False: 0]
  ------------------
 1030|      0|                goto end;
 1031|      0|            cnt++;
 1032|      0|        }
 1033|      0|        cnt++;                   /* One for the terminating item */
 1034|       |
 1035|       |        /* Allocate one extra item for the "library" name */
 1036|      0|        prov->error_strings =
 1037|      0|            OPENSSL_zalloc(sizeof(ERR_STRING_DATA) * (cnt + 1));
  ------------------
  |  |   99|      0|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1038|      0|        if (prov->error_strings == NULL)
  ------------------
  |  Branch (1038:13): [True: 0, False: 0]
  ------------------
 1039|      0|            goto end;
 1040|       |
 1041|       |        /*
 1042|       |         * Set the "library" name.
 1043|       |         */
 1044|      0|        prov->error_strings[0].error = ERR_PACK(prov->error_lib, 0, 0);
  ------------------
  |  |  279|      0|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|      0|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|      0|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|      0|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|      0|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
 1045|      0|        prov->error_strings[0].string = prov->name;
 1046|       |        /*
 1047|       |         * Copy reasonstrings item 0..cnt-1 to prov->error_trings positions
 1048|       |         * 1..cnt.
 1049|       |         */
 1050|      0|        for (cnt2 = 1; cnt2 <= cnt; cnt2++) {
  ------------------
  |  Branch (1050:24): [True: 0, False: 0]
  ------------------
 1051|      0|            prov->error_strings[cnt2].error = (int)reasonstrings[cnt2-1].id;
 1052|      0|            prov->error_strings[cnt2].string = reasonstrings[cnt2-1].ptr;
 1053|      0|        }
 1054|       |
 1055|      0|        ERR_load_strings(prov->error_lib, prov->error_strings);
 1056|      0|    }
 1057|      3|# endif
 1058|      3|#endif
 1059|       |
 1060|       |    /* With this flag set, this provider has become fully "loaded". */
 1061|      3|    prov->flag_initialized = 1;
 1062|      3|    ok = 1;
 1063|       |
 1064|      3| end:
 1065|      3|    return ok;
 1066|      3|}
provider_core.c:core_get_libctx:
 2001|      1|{
 2002|       |    /*
 2003|       |     * We created this object originally and we know it is actually an
 2004|       |     * OSSL_PROVIDER *, so the cast is safe
 2005|       |     */
 2006|      1|    OSSL_PROVIDER *prov = (OSSL_PROVIDER *)handle;
 2007|       |
 2008|       |    /*
 2009|       |     * Using ossl_provider_libctx would be wrong as that returns
 2010|       |     * NULL for |prov| == NULL and NULL libctx has a special meaning
 2011|       |     * that does not apply here. Here |prov| == NULL can happen only in
 2012|       |     * case of a coding error.
 2013|       |     */
 2014|      1|    assert(prov != NULL);
 2015|      1|    return (OPENSSL_CORE_CTX *)prov->libctx;
 2016|      1|}
provider_core.c:provider_flush_store_cache:
 1223|      2|{
 1224|      2|    struct provider_store_st *store;
 1225|      2|    int freeing;
 1226|       |
 1227|      2|    if ((store = get_provider_store(prov->libctx)) == NULL)
  ------------------
  |  Branch (1227:9): [True: 0, False: 2]
  ------------------
 1228|      0|        return 0;
 1229|       |
 1230|      2|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1230:9): [True: 0, False: 2]
  ------------------
 1231|      0|        return 0;
 1232|      2|    freeing = store->freeing;
 1233|      2|    CRYPTO_THREAD_unlock(store->lock);
 1234|       |
 1235|      2|    if (!freeing) {
  ------------------
  |  Branch (1235:9): [True: 2, False: 0]
  ------------------
 1236|      2|        int acc
 1237|      2|            = evp_method_store_cache_flush(prov->libctx)
 1238|      2|#ifndef FIPS_MODULE
 1239|      2|            + ossl_encoder_store_cache_flush(prov->libctx)
 1240|      2|            + ossl_decoder_store_cache_flush(prov->libctx)
 1241|      2|            + ossl_store_loader_store_cache_flush(prov->libctx)
 1242|      2|#endif
 1243|      2|            ;
 1244|       |
 1245|      2|#ifndef FIPS_MODULE
 1246|      2|        return acc == 4;
 1247|       |#else
 1248|       |        return acc == 1;
 1249|       |#endif
 1250|      2|    }
 1251|      0|    return 1;
 1252|      2|}
provider_core.c:provider_deactivate:
 1076|      3|{
 1077|      3|    int count;
 1078|      3|    struct provider_store_st *store;
 1079|      3|#ifndef FIPS_MODULE
 1080|      3|    int freeparent = 0;
 1081|      3|#endif
 1082|      3|    int lock = 1;
 1083|       |
 1084|      3|    if (!ossl_assert(prov != NULL))
  ------------------
  |  |   52|      3|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|      3|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (1084:9): [True: 0, False: 3]
  ------------------
 1085|      0|        return -1;
 1086|       |
 1087|       |    /*
 1088|       |     * No need to lock if we've got no store because we've not been shared with
 1089|       |     * other threads.
 1090|       |     */
 1091|      3|    store = get_provider_store(prov->libctx);
 1092|      3|    if (store == NULL)
  ------------------
  |  Branch (1092:9): [True: 0, False: 3]
  ------------------
 1093|      0|        lock = 0;
 1094|       |
 1095|      3|    if (lock && !CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1095:9): [True: 3, False: 0]
  |  Branch (1095:17): [True: 0, False: 3]
  ------------------
 1096|      0|        return -1;
 1097|      3|    if (lock && !CRYPTO_THREAD_write_lock(prov->flag_lock)) {
  ------------------
  |  Branch (1097:9): [True: 3, False: 0]
  |  Branch (1097:17): [True: 0, False: 3]
  ------------------
 1098|      0|        CRYPTO_THREAD_unlock(store->lock);
 1099|      0|        return -1;
 1100|      0|    }
 1101|       |
 1102|      3|    CRYPTO_atomic_add(&prov->activatecnt, -1, &count, prov->activatecnt_lock);
 1103|      3|#ifndef FIPS_MODULE
 1104|      3|    if (count >= 1 && prov->ischild && upcalls) {
  ------------------
  |  Branch (1104:9): [True: 0, False: 3]
  |  Branch (1104:23): [True: 0, False: 0]
  |  Branch (1104:40): [True: 0, False: 0]
  ------------------
 1105|       |        /*
 1106|       |         * We have had a direct activation in this child libctx so we need to
 1107|       |         * now down the ref count in the parent provider. We do the actual down
 1108|       |         * ref outside of the flag_lock, since it could involve getting other
 1109|       |         * locks.
 1110|       |         */
 1111|      0|        freeparent = 1;
 1112|      0|    }
 1113|      3|#endif
 1114|       |
 1115|      3|    if (count < 1)
  ------------------
  |  Branch (1115:9): [True: 3, False: 0]
  ------------------
 1116|      3|        prov->flag_activated = 0;
 1117|      0|#ifndef FIPS_MODULE
 1118|      0|    else
 1119|      0|        removechildren = 0;
 1120|      3|#endif
 1121|       |
 1122|      3|#ifndef FIPS_MODULE
 1123|      3|    if (removechildren && store != NULL) {
  ------------------
  |  Branch (1123:9): [True: 3, False: 0]
  |  Branch (1123:27): [True: 3, False: 0]
  ------------------
 1124|      3|        int i, max = sk_OSSL_PROVIDER_CHILD_CB_num(store->child_cbs);
 1125|      3|        OSSL_PROVIDER_CHILD_CB *child_cb;
 1126|       |
 1127|      3|        for (i = 0; i < max; i++) {
  ------------------
  |  Branch (1127:21): [True: 0, False: 3]
  ------------------
 1128|      0|            child_cb = sk_OSSL_PROVIDER_CHILD_CB_value(store->child_cbs, i);
 1129|      0|            child_cb->remove_cb((OSSL_CORE_HANDLE *)prov, child_cb->cbdata);
 1130|      0|        }
 1131|      3|    }
 1132|      3|#endif
 1133|      3|    if (lock) {
  ------------------
  |  Branch (1133:9): [True: 3, False: 0]
  ------------------
 1134|      3|        CRYPTO_THREAD_unlock(prov->flag_lock);
 1135|      3|        CRYPTO_THREAD_unlock(store->lock);
 1136|       |        /*
 1137|       |         * This can be done outside the lock. We tolerate other threads getting
 1138|       |         * the wrong result briefly when creating OSSL_DECODER_CTXs.
 1139|       |         */
 1140|      3|#ifndef FIPS_MODULE
 1141|      3|        if (count < 1)
  ------------------
  |  Branch (1141:13): [True: 3, False: 0]
  ------------------
 1142|      3|            ossl_decoder_cache_flush(prov->libctx);
 1143|      3|#endif
 1144|      3|    }
 1145|      3|#ifndef FIPS_MODULE
 1146|      3|    if (freeparent)
  ------------------
  |  Branch (1146:9): [True: 0, False: 3]
  ------------------
 1147|      0|        ossl_provider_free_parent(prov, 1);
 1148|      3|#endif
 1149|       |
 1150|       |    /* We don't deinit here, that's done in ossl_provider_free() */
 1151|      3|    return count;
 1152|      3|}
provider_core.c:provider_remove_store_methods:
 1255|      3|{
 1256|      3|    struct provider_store_st *store;
 1257|      3|    int freeing;
 1258|       |
 1259|      3|    if ((store = get_provider_store(prov->libctx)) == NULL)
  ------------------
  |  Branch (1259:9): [True: 0, False: 3]
  ------------------
 1260|      0|        return 0;
 1261|       |
 1262|      3|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1262:9): [True: 0, False: 3]
  ------------------
 1263|      0|        return 0;
 1264|      3|    freeing = store->freeing;
 1265|      3|    CRYPTO_THREAD_unlock(store->lock);
 1266|       |
 1267|      3|    if (!freeing) {
  ------------------
  |  Branch (1267:9): [True: 0, False: 3]
  ------------------
 1268|      0|        int acc;
 1269|       |
 1270|      0|        if (!CRYPTO_THREAD_write_lock(prov->opbits_lock))
  ------------------
  |  Branch (1270:13): [True: 0, False: 0]
  ------------------
 1271|      0|            return 0;
 1272|      0|        OPENSSL_free(prov->operation_bits);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1273|      0|        prov->operation_bits = NULL;
 1274|      0|        prov->operation_bits_sz = 0;
 1275|      0|        CRYPTO_THREAD_unlock(prov->opbits_lock);
 1276|       |
 1277|      0|        acc = evp_method_store_remove_all_provided(prov)
 1278|      0|#ifndef FIPS_MODULE
 1279|      0|            + ossl_encoder_store_remove_all_provided(prov)
 1280|      0|            + ossl_decoder_store_remove_all_provided(prov)
 1281|      0|            + ossl_store_loader_store_remove_all_provided(prov)
 1282|      0|#endif
 1283|      0|            ;
 1284|       |
 1285|      0|#ifndef FIPS_MODULE
 1286|      0|        return acc == 4;
 1287|       |#else
 1288|       |        return acc == 1;
 1289|       |#endif
 1290|      0|    }
 1291|      3|    return 1;
 1292|      3|}
provider_core.c:provider_activate_fallbacks:
 1335|  6.74k|{
 1336|  6.74k|    int use_fallbacks;
 1337|  6.74k|    int activated_fallback_count = 0;
 1338|  6.74k|    int ret = 0;
 1339|  6.74k|    const OSSL_PROVIDER_INFO *p;
 1340|       |
 1341|  6.74k|    if (!CRYPTO_THREAD_read_lock(store->lock))
  ------------------
  |  Branch (1341:9): [True: 0, False: 6.74k]
  ------------------
 1342|      0|        return 0;
 1343|  6.74k|    use_fallbacks = store->use_fallbacks;
 1344|  6.74k|    CRYPTO_THREAD_unlock(store->lock);
 1345|  6.74k|    if (!use_fallbacks)
  ------------------
  |  Branch (1345:9): [True: 6.74k, False: 1]
  ------------------
 1346|  6.74k|        return 1;
 1347|       |
 1348|      1|    if (!CRYPTO_THREAD_write_lock(store->lock))
  ------------------
  |  Branch (1348:9): [True: 0, False: 1]
  ------------------
 1349|      0|        return 0;
 1350|       |    /* Check again, just in case another thread changed it */
 1351|      1|    use_fallbacks = store->use_fallbacks;
 1352|      1|    if (!use_fallbacks) {
  ------------------
  |  Branch (1352:9): [True: 0, False: 1]
  ------------------
 1353|      0|        CRYPTO_THREAD_unlock(store->lock);
 1354|      0|        return 1;
 1355|      0|    }
 1356|       |
 1357|      4|    for (p = ossl_predefined_providers; p->name != NULL; p++) {
  ------------------
  |  Branch (1357:41): [True: 3, False: 1]
  ------------------
 1358|      3|        OSSL_PROVIDER *prov = NULL;
 1359|       |
 1360|      3|        if (!p->is_fallback)
  ------------------
  |  Branch (1360:13): [True: 2, False: 1]
  ------------------
 1361|      2|            continue;
 1362|       |        /*
 1363|       |         * We use the internal constructor directly here,
 1364|       |         * otherwise we get a call loop
 1365|       |         */
 1366|      1|        prov = provider_new(p->name, p->init, NULL);
 1367|      1|        if (prov == NULL)
  ------------------
  |  Branch (1367:13): [True: 0, False: 1]
  ------------------
 1368|      0|            goto err;
 1369|      1|        prov->libctx = store->libctx;
 1370|      1|#ifndef FIPS_MODULE
 1371|      1|        prov->error_lib = ERR_get_next_error_library();
 1372|      1|#endif
 1373|       |
 1374|       |        /*
 1375|       |         * We are calling provider_activate while holding the store lock. This
 1376|       |         * means the init function will be called while holding a lock. Normally
 1377|       |         * we try to avoid calling a user callback while holding a lock.
 1378|       |         * However, fallbacks are never third party providers so we accept this.
 1379|       |         */
 1380|      1|        if (provider_activate(prov, 0, 0) < 0) {
  ------------------
  |  Branch (1380:13): [True: 0, False: 1]
  ------------------
 1381|      0|            ossl_provider_free(prov);
 1382|      0|            goto err;
 1383|      0|        }
 1384|      1|        prov->store = store;
 1385|      1|        if (sk_OSSL_PROVIDER_push(store->providers, prov) == 0) {
  ------------------
  |  Branch (1385:13): [True: 0, False: 1]
  ------------------
 1386|      0|            ossl_provider_free(prov);
 1387|      0|            goto err;
 1388|      0|        }
 1389|      1|        activated_fallback_count++;
 1390|      1|    }
 1391|       |
 1392|      1|    if (activated_fallback_count > 0) {
  ------------------
  |  Branch (1392:9): [True: 1, False: 0]
  ------------------
 1393|      1|        store->use_fallbacks = 0;
 1394|      1|        ret = 1;
 1395|      1|    }
 1396|      1| err:
 1397|      1|    CRYPTO_THREAD_unlock(store->lock);
 1398|      1|    return ret;
 1399|      1|}

ossl_err_load_RAND_strings:
  101|      2|{
  102|      2|#ifndef OPENSSL_NO_ERR
  103|      2|    if (ERR_reason_error_string(RAND_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (103:9): [True: 2, False: 0]
  ------------------
  104|      2|        ERR_load_strings_const(RAND_str_reasons);
  105|      2|#endif
  106|      2|    return 1;
  107|      2|}

ossl_rand_cleanup_int:
   80|      2|{
   81|      2|# ifndef OPENSSL_NO_DEPRECATED_3_0
   82|      2|    const RAND_METHOD *meth = default_RAND_meth;
   83|       |
   84|      2|    if (!rand_inited)
  ------------------
  |  Branch (84:9): [True: 1, False: 1]
  ------------------
   85|      1|        return;
   86|       |
   87|      1|    if (meth != NULL && meth->cleanup != NULL)
  ------------------
  |  Branch (87:9): [True: 1, False: 0]
  |  Branch (87:25): [True: 0, False: 1]
  ------------------
   88|      0|        meth->cleanup();
   89|      1|    RAND_set_rand_method(NULL);
   90|      1|# endif
   91|      1|    ossl_rand_pool_cleanup();
   92|      1|# ifndef OPENSSL_NO_ENGINE
   93|      1|    CRYPTO_THREAD_lock_free(rand_engine_lock);
   94|      1|    rand_engine_lock = NULL;
   95|      1|# endif
   96|      1|# ifndef OPENSSL_NO_DEPRECATED_3_0
   97|      1|    CRYPTO_THREAD_lock_free(rand_meth_lock);
   98|      1|    rand_meth_lock = NULL;
   99|      1|# endif
  100|      1|    ossl_release_default_drbg_ctx();
  101|      1|    rand_inited = 0;
  102|      1|}
RAND_set_rand_method:
  181|      1|{
  182|      1|    return rand_set_rand_method_internal(meth, NULL);
  183|      1|}
RAND_get_rand_method:
  186|  52.6k|{
  187|  52.6k|    const RAND_METHOD *tmp_meth = NULL;
  188|       |
  189|  52.6k|    if (!RUN_ONCE(&rand_init, do_rand_init))
  ------------------
  |  |  130|  52.6k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 52.6k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (189:9): [True: 0, False: 52.6k]
  ------------------
  190|      0|        return NULL;
  191|       |
  192|  52.6k|    if (!CRYPTO_THREAD_read_lock(rand_meth_lock))
  ------------------
  |  Branch (192:9): [True: 0, False: 52.6k]
  ------------------
  193|      0|        return NULL;
  194|  52.6k|    tmp_meth = default_RAND_meth;
  195|  52.6k|    CRYPTO_THREAD_unlock(rand_meth_lock);
  196|  52.6k|    if (tmp_meth != NULL)
  ------------------
  |  Branch (196:9): [True: 52.6k, False: 1]
  ------------------
  197|  52.6k|        return tmp_meth;
  198|       |
  199|      1|    if (!CRYPTO_THREAD_write_lock(rand_meth_lock))
  ------------------
  |  Branch (199:9): [True: 0, False: 1]
  ------------------
  200|      0|        return NULL;
  201|      1|    if (default_RAND_meth == NULL) {
  ------------------
  |  Branch (201:9): [True: 1, False: 0]
  ------------------
  202|      1|#  ifndef OPENSSL_NO_ENGINE
  203|      1|        ENGINE *e;
  204|       |
  205|       |        /* If we have an engine that can do RAND, use it. */
  206|      1|        if ((e = ENGINE_get_default_RAND()) != NULL
  ------------------
  |  Branch (206:13): [True: 0, False: 1]
  ------------------
  207|      1|                && (tmp_meth = ENGINE_get_RAND(e)) != NULL) {
  ------------------
  |  Branch (207:20): [True: 0, False: 0]
  ------------------
  208|      0|            funct_ref = e;
  209|      0|            default_RAND_meth = tmp_meth;
  210|      1|        } else {
  211|      1|            ENGINE_finish(e);
  212|      1|            default_RAND_meth = &ossl_rand_meth;
  213|      1|        }
  214|       |#  else
  215|       |        default_RAND_meth = &ossl_rand_meth;
  216|       |#  endif
  217|      1|    }
  218|      1|    tmp_meth = default_RAND_meth;
  219|      1|    CRYPTO_THREAD_unlock(rand_meth_lock);
  220|      1|    return tmp_meth;
  221|      1|}
RAND_priv_bytes_ex:
  335|  52.6k|{
  336|  52.6k|    EVP_RAND_CTX *rand;
  337|  52.6k|#if !defined(OPENSSL_NO_DEPRECATED_3_0) && !defined(FIPS_MODULE)
  338|  52.6k|    const RAND_METHOD *meth = RAND_get_rand_method();
  339|       |
  340|  52.6k|    if (meth != NULL && meth != RAND_OpenSSL()) {
  ------------------
  |  Branch (340:9): [True: 52.6k, False: 0]
  |  Branch (340:25): [True: 0, False: 52.6k]
  ------------------
  341|      0|        if (meth->bytes != NULL)
  ------------------
  |  Branch (341:13): [True: 0, False: 0]
  ------------------
  342|      0|            return meth->bytes(buf, num);
  343|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_FUNC_NOT_IMPLEMENTED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  344|      0|        return -1;
  345|      0|    }
  346|  52.6k|#endif
  347|       |
  348|  52.6k|    rand = RAND_get0_private(ctx);
  349|  52.6k|    if (rand != NULL)
  ------------------
  |  Branch (349:9): [True: 52.6k, False: 0]
  ------------------
  350|  52.6k|        return EVP_RAND_generate(rand, buf, num, strength, 0, NULL, 0);
  351|       |
  352|      0|    return 0;
  353|  52.6k|}
ossl_rand_ctx_new:
  453|      4|{
  454|      4|    RAND_GLOBAL *dgbl = OPENSSL_zalloc(sizeof(*dgbl));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  455|       |
  456|      4|    if (dgbl == NULL)
  ------------------
  |  Branch (456:9): [True: 0, False: 4]
  ------------------
  457|      0|        return NULL;
  458|       |
  459|      4|#ifndef FIPS_MODULE
  460|       |    /*
  461|       |     * We need to ensure that base libcrypto thread handling has been
  462|       |     * initialised.
  463|       |     */
  464|      4|     OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL);
  ------------------
  |  |   31|      4|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  465|      4|#endif
  466|       |
  467|      4|    dgbl->lock = CRYPTO_THREAD_lock_new();
  468|      4|    if (dgbl->lock == NULL)
  ------------------
  |  Branch (468:9): [True: 0, False: 4]
  ------------------
  469|      0|        goto err1;
  470|       |
  471|      4|    if (!CRYPTO_THREAD_init_local(&dgbl->private, NULL))
  ------------------
  |  Branch (471:9): [True: 0, False: 4]
  ------------------
  472|      0|        goto err1;
  473|       |
  474|      4|    if (!CRYPTO_THREAD_init_local(&dgbl->public, NULL))
  ------------------
  |  Branch (474:9): [True: 0, False: 4]
  ------------------
  475|      0|        goto err2;
  476|       |
  477|      4|    return dgbl;
  478|       |
  479|      0| err2:
  480|      0|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  481|      0| err1:
  482|      0|    CRYPTO_THREAD_lock_free(dgbl->lock);
  483|      0|    OPENSSL_free(dgbl);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  484|      0|    return NULL;
  485|      0|}
ossl_rand_ctx_free:
  488|      2|{
  489|      2|    RAND_GLOBAL *dgbl = vdgbl;
  490|       |
  491|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (491:9): [True: 0, False: 2]
  ------------------
  492|      0|        return;
  493|       |
  494|      2|    CRYPTO_THREAD_lock_free(dgbl->lock);
  495|      2|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  496|      2|    CRYPTO_THREAD_cleanup_local(&dgbl->public);
  497|      2|    EVP_RAND_CTX_free(dgbl->primary);
  498|      2|    EVP_RAND_CTX_free(dgbl->seed);
  499|      2|    OPENSSL_free(dgbl->rng_name);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  500|      2|    OPENSSL_free(dgbl->rng_cipher);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  501|      2|    OPENSSL_free(dgbl->rng_digest);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  502|      2|    OPENSSL_free(dgbl->rng_propq);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  503|      2|    OPENSSL_free(dgbl->seed_name);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  504|      2|    OPENSSL_free(dgbl->seed_propq);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  505|       |
  506|      2|    OPENSSL_free(dgbl);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  507|      2|}
RAND_get0_primary:
  625|      1|{
  626|      1|    RAND_GLOBAL *dgbl = rand_get_global(ctx);
  627|      1|    EVP_RAND_CTX *ret;
  628|       |
  629|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (629:9): [True: 0, False: 1]
  ------------------
  630|      0|        return NULL;
  631|       |
  632|      1|    if (!CRYPTO_THREAD_read_lock(dgbl->lock))
  ------------------
  |  Branch (632:9): [True: 0, False: 1]
  ------------------
  633|      0|        return NULL;
  634|       |
  635|      1|    ret = dgbl->primary;
  636|      1|    CRYPTO_THREAD_unlock(dgbl->lock);
  637|       |
  638|      1|    if (ret != NULL)
  ------------------
  |  Branch (638:9): [True: 0, False: 1]
  ------------------
  639|      0|        return ret;
  640|       |
  641|      1|    if (!CRYPTO_THREAD_write_lock(dgbl->lock))
  ------------------
  |  Branch (641:9): [True: 0, False: 1]
  ------------------
  642|      0|        return NULL;
  643|       |
  644|      1|    ret = dgbl->primary;
  645|      1|    if (ret != NULL) {
  ------------------
  |  Branch (645:9): [True: 0, False: 1]
  ------------------
  646|      0|        CRYPTO_THREAD_unlock(dgbl->lock);
  647|      0|        return ret;
  648|      0|    }
  649|       |
  650|      1|#ifndef FIPS_MODULE
  651|      1|    if (dgbl->seed == NULL) {
  ------------------
  |  Branch (651:9): [True: 1, False: 0]
  ------------------
  652|      1|        ERR_set_mark();
  653|      1|        dgbl->seed = rand_new_seed(ctx);
  654|      1|        ERR_pop_to_mark();
  655|      1|    }
  656|      1|#endif
  657|       |
  658|      1|    ret = dgbl->primary = rand_new_drbg(ctx, dgbl->seed,
  659|      1|                                        PRIMARY_RESEED_INTERVAL,
  ------------------
  |  |   23|      1|# define PRIMARY_RESEED_INTERVAL                 (1 << 8)
  ------------------
  660|      1|                                        PRIMARY_RESEED_TIME_INTERVAL, 1);
  ------------------
  |  |   25|      1|# define PRIMARY_RESEED_TIME_INTERVAL            (60 * 60) /* 1 hour */
  ------------------
  661|       |    /*
  662|       |    * The primary DRBG may be shared between multiple threads so we must
  663|       |    * enable locking.
  664|       |    */
  665|      1|    if (ret != NULL && !EVP_RAND_enable_locking(ret)) {
  ------------------
  |  Branch (665:9): [True: 1, False: 0]
  |  Branch (665:24): [True: 0, False: 1]
  ------------------
  666|      0|        ERR_raise(ERR_LIB_EVP, EVP_R_UNABLE_TO_ENABLE_LOCKING);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  667|      0|        EVP_RAND_CTX_free(ret);
  668|      0|        ret = dgbl->primary = NULL;
  669|      0|    }
  670|      1|    CRYPTO_THREAD_unlock(dgbl->lock);
  671|       |
  672|      1|    return ret;
  673|      1|}
RAND_get0_private:
  713|  52.6k|{
  714|  52.6k|    RAND_GLOBAL *dgbl = rand_get_global(ctx);
  715|  52.6k|    EVP_RAND_CTX *rand, *primary;
  716|       |
  717|  52.6k|    if (dgbl == NULL)
  ------------------
  |  Branch (717:9): [True: 0, False: 52.6k]
  ------------------
  718|      0|        return NULL;
  719|       |
  720|  52.6k|    rand = CRYPTO_THREAD_get_local(&dgbl->private);
  721|  52.6k|    if (rand == NULL) {
  ------------------
  |  Branch (721:9): [True: 1, False: 52.6k]
  ------------------
  722|      1|        primary = RAND_get0_primary(ctx);
  723|      1|        if (primary == NULL)
  ------------------
  |  Branch (723:13): [True: 0, False: 1]
  ------------------
  724|      0|            return NULL;
  725|       |
  726|      1|        ctx = ossl_lib_ctx_get_concrete(ctx);
  727|       |        /*
  728|       |         * If the public is also NULL then this is the first time we've
  729|       |         * used this thread.
  730|       |         */
  731|      1|        if (CRYPTO_THREAD_get_local(&dgbl->public) == NULL
  ------------------
  |  Branch (731:13): [True: 1, False: 0]
  ------------------
  732|      1|                && !ossl_init_thread_start(NULL, ctx, rand_delete_thread_state))
  ------------------
  |  Branch (732:20): [True: 0, False: 1]
  ------------------
  733|      0|            return NULL;
  734|      1|        rand = rand_new_drbg(ctx, primary, SECONDARY_RESEED_INTERVAL,
  ------------------
  |  |   24|      1|# define SECONDARY_RESEED_INTERVAL               (1 << 16)
  ------------------
  735|      1|                             SECONDARY_RESEED_TIME_INTERVAL, 0);
  ------------------
  |  |   26|      1|# define SECONDARY_RESEED_TIME_INTERVAL          (7 * 60)  /* 7 minutes */
  ------------------
  736|      1|        CRYPTO_THREAD_set_local(&dgbl->private, rand);
  737|      1|    }
  738|  52.6k|    return rand;
  739|  52.6k|}
RAND_set_DRBG_type:
  851|      2|{
  852|      2|    RAND_GLOBAL *dgbl = rand_get_global(ctx);
  853|       |
  854|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (854:9): [True: 0, False: 2]
  ------------------
  855|      0|        return 0;
  856|      2|    if (dgbl->primary != NULL) {
  ------------------
  |  Branch (856:9): [True: 0, False: 2]
  ------------------
  857|      0|        ERR_raise(ERR_LIB_CRYPTO, RAND_R_ALREADY_INSTANTIATED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  858|      0|        return 0;
  859|      0|    }
  860|      2|    return random_set_string(&dgbl->rng_name, drbg)
  ------------------
  |  Branch (860:12): [True: 2, False: 0]
  ------------------
  861|      2|        && random_set_string(&dgbl->rng_propq, propq)
  ------------------
  |  Branch (861:12): [True: 2, False: 0]
  ------------------
  862|      2|        && random_set_string(&dgbl->rng_cipher, cipher)
  ------------------
  |  Branch (862:12): [True: 2, False: 0]
  ------------------
  863|      2|        && random_set_string(&dgbl->rng_digest, digest);
  ------------------
  |  Branch (863:12): [True: 2, False: 0]
  ------------------
  864|      2|}
rand_lib.c:do_rand_init:
   48|      1|{
   49|      1|# ifndef OPENSSL_NO_ENGINE
   50|      1|    rand_engine_lock = CRYPTO_THREAD_lock_new();
   51|      1|    if (rand_engine_lock == NULL)
  ------------------
  |  Branch (51:9): [True: 0, False: 1]
  ------------------
   52|      0|        return 0;
   53|      1|# endif
   54|       |
   55|      1|# ifndef OPENSSL_NO_DEPRECATED_3_0
   56|      1|    rand_meth_lock = CRYPTO_THREAD_lock_new();
   57|      1|    if (rand_meth_lock == NULL)
  ------------------
  |  Branch (57:9): [True: 0, False: 1]
  ------------------
   58|      0|        goto err;
   59|      1|# endif
   60|       |
   61|      1|    if (!ossl_rand_pool_init())
  ------------------
  |  Branch (61:9): [True: 0, False: 1]
  ------------------
   62|      0|        goto err;
   63|       |
   64|      1|    rand_inited = 1;
   65|      1|    return 1;
   66|       |
   67|      0| err:
   68|      0|# ifndef OPENSSL_NO_DEPRECATED_3_0
   69|      0|    CRYPTO_THREAD_lock_free(rand_meth_lock);
   70|      0|    rand_meth_lock = NULL;
   71|      0|# endif
   72|      0|# ifndef OPENSSL_NO_ENGINE
   73|      0|    CRYPTO_THREAD_lock_free(rand_engine_lock);
   74|      0|    rand_engine_lock = NULL;
   75|      0|# endif
   76|      0|    return 0;
   77|      1|}
rand_lib.c:rand_set_rand_method_internal:
  165|      1|{
  166|      1|    if (!RUN_ONCE(&rand_init, do_rand_init))
  ------------------
  |  |  130|      1|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (166:9): [True: 0, False: 1]
  ------------------
  167|      0|        return 0;
  168|       |
  169|      1|    if (!CRYPTO_THREAD_write_lock(rand_meth_lock))
  ------------------
  |  Branch (169:9): [True: 0, False: 1]
  ------------------
  170|      0|        return 0;
  171|      1|#  ifndef OPENSSL_NO_ENGINE
  172|      1|    ENGINE_finish(funct_ref);
  173|      1|    funct_ref = e;
  174|      1|#  endif
  175|      1|    default_RAND_meth = meth;
  176|      1|    CRYPTO_THREAD_unlock(rand_meth_lock);
  177|      1|    return 1;
  178|      1|}
rand_lib.c:rand_get_global:
  510|  52.6k|{
  511|  52.6k|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DRBG_INDEX);
  ------------------
  |  |  103|  52.6k|# define OSSL_LIB_CTX_DRBG_INDEX                     5
  ------------------
  512|  52.6k|}
rand_lib.c:rand_new_seed:
  534|      1|{
  535|      1|    EVP_RAND *rand;
  536|      1|    RAND_GLOBAL *dgbl = rand_get_global(libctx);
  537|      1|    EVP_RAND_CTX *ctx;
  538|      1|    char *name;
  539|       |
  540|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (540:9): [True: 0, False: 1]
  ------------------
  541|      0|        return NULL;
  542|      1|    name = dgbl->seed_name != NULL ? dgbl->seed_name : "SEED-SRC";
  ------------------
  |  Branch (542:12): [True: 0, False: 1]
  ------------------
  543|      1|    rand = EVP_RAND_fetch(libctx, name, dgbl->seed_propq);
  544|      1|    if (rand == NULL) {
  ------------------
  |  Branch (544:9): [True: 0, False: 1]
  ------------------
  545|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_UNABLE_TO_FETCH_DRBG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  546|      0|        return NULL;
  547|      0|    }
  548|      1|    ctx = EVP_RAND_CTX_new(rand, NULL);
  549|      1|    EVP_RAND_free(rand);
  550|      1|    if (ctx == NULL) {
  ------------------
  |  Branch (550:9): [True: 0, False: 1]
  ------------------
  551|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_UNABLE_TO_CREATE_DRBG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  552|      0|        return NULL;
  553|      0|    }
  554|      1|    if (!EVP_RAND_instantiate(ctx, 0, 0, NULL, 0, NULL)) {
  ------------------
  |  Branch (554:9): [True: 0, False: 1]
  ------------------
  555|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_ERROR_INSTANTIATING_DRBG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  556|      0|        EVP_RAND_CTX_free(ctx);
  557|      0|        return NULL;
  558|      0|    }
  559|      1|    return ctx;
  560|      1|}
rand_lib.c:rand_new_drbg:
  566|      2|{
  567|      2|    EVP_RAND *rand;
  568|      2|    RAND_GLOBAL *dgbl = rand_get_global(libctx);
  569|      2|    EVP_RAND_CTX *ctx;
  570|      2|    OSSL_PARAM params[8], *p = params;
  571|      2|    const OSSL_PARAM *settables;
  572|      2|    char *name, *cipher;
  573|       |
  574|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (574:9): [True: 0, False: 2]
  ------------------
  575|      0|        return NULL;
  576|      2|    name = dgbl->rng_name != NULL ? dgbl->rng_name : "CTR-DRBG";
  ------------------
  |  Branch (576:12): [True: 2, False: 0]
  ------------------
  577|      2|    rand = EVP_RAND_fetch(libctx, name, dgbl->rng_propq);
  578|      2|    if (rand == NULL) {
  ------------------
  |  Branch (578:9): [True: 0, False: 2]
  ------------------
  579|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_UNABLE_TO_FETCH_DRBG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  580|      0|        return NULL;
  581|      0|    }
  582|      2|    ctx = EVP_RAND_CTX_new(rand, parent);
  583|      2|    EVP_RAND_free(rand);
  584|      2|    if (ctx == NULL) {
  ------------------
  |  Branch (584:9): [True: 0, False: 2]
  ------------------
  585|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_UNABLE_TO_CREATE_DRBG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  586|      0|        return NULL;
  587|      0|    }
  588|       |
  589|      2|    settables = EVP_RAND_CTX_settable_params(ctx);
  590|      2|    if (OSSL_PARAM_locate_const(settables, OSSL_DRBG_PARAM_CIPHER)) {
  ------------------
  |  |  202|      2|# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  112|      2|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  |  Branch (590:9): [True: 0, False: 2]
  ------------------
  591|      0|        cipher = dgbl->rng_cipher != NULL ? dgbl->rng_cipher : "AES-256-CTR";
  ------------------
  |  Branch (591:18): [True: 0, False: 0]
  ------------------
  592|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
  ------------------
  |  |  202|      0|# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  112|      0|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  593|      0|                                                cipher, 0);
  594|      0|    }
  595|      2|    if (dgbl->rng_digest != NULL
  ------------------
  |  Branch (595:9): [True: 0, False: 2]
  ------------------
  596|      2|            && OSSL_PARAM_locate_const(settables, OSSL_DRBG_PARAM_DIGEST))
  ------------------
  |  |  203|      0|# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
  |  |  ------------------
  |  |  |  |  113|      0|# define OSSL_ALG_PARAM_DIGEST "digest"
  |  |  ------------------
  ------------------
  |  Branch (596:16): [True: 0, False: 0]
  ------------------
  597|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST,
  ------------------
  |  |  203|      0|# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
  |  |  ------------------
  |  |  |  |  113|      0|# define OSSL_ALG_PARAM_DIGEST "digest"
  |  |  ------------------
  ------------------
  598|      0|                                                dgbl->rng_digest, 0);
  599|      2|    if (dgbl->rng_propq != NULL)
  ------------------
  |  Branch (599:9): [True: 0, False: 2]
  ------------------
  600|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_PROPERTIES,
  ------------------
  |  |  215|      0|# define OSSL_DRBG_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  116|      0|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  ------------------
  ------------------
  601|      0|                                                dgbl->rng_propq, 0);
  602|      2|    if (OSSL_PARAM_locate_const(settables, OSSL_ALG_PARAM_MAC))
  ------------------
  |  |  115|      2|# define OSSL_ALG_PARAM_MAC "mac"
  ------------------
  |  Branch (602:9): [True: 0, False: 2]
  ------------------
  603|      0|        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_ALG_PARAM_MAC, "HMAC", 0);
  ------------------
  |  |  115|      0|# define OSSL_ALG_PARAM_MAC "mac"
  ------------------
  604|      2|    if (OSSL_PARAM_locate_const(settables, OSSL_DRBG_PARAM_USE_DF))
  ------------------
  |  |  222|      2|# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
  ------------------
  |  Branch (604:9): [True: 0, False: 2]
  ------------------
  605|      0|        *p++ = OSSL_PARAM_construct_int(OSSL_DRBG_PARAM_USE_DF, &use_df);
  ------------------
  |  |  222|      0|# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
  ------------------
  606|      2|    *p++ = OSSL_PARAM_construct_uint(OSSL_DRBG_PARAM_RESEED_REQUESTS,
  ------------------
  |  |  218|      2|# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests"
  ------------------
  607|      2|                                     &reseed_interval);
  608|      2|    *p++ = OSSL_PARAM_construct_time_t(OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL,
  ------------------
  |  |  220|      2|# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval"
  ------------------
  609|      2|                                       &reseed_time_interval);
  610|      2|    *p = OSSL_PARAM_construct_end();
  611|      2|    if (!EVP_RAND_instantiate(ctx, 0, 0, NULL, 0, params)) {
  ------------------
  |  Branch (611:9): [True: 0, False: 2]
  ------------------
  612|      0|        ERR_raise(ERR_LIB_RAND, RAND_R_ERROR_INSTANTIATING_DRBG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  613|      0|        EVP_RAND_CTX_free(ctx);
  614|      0|        return NULL;
  615|      0|    }
  616|      2|    return ctx;
  617|      2|}
rand_lib.c:rand_delete_thread_state:
  515|      1|{
  516|      1|    OSSL_LIB_CTX *ctx = arg;
  517|      1|    RAND_GLOBAL *dgbl = rand_get_global(ctx);
  518|      1|    EVP_RAND_CTX *rand;
  519|       |
  520|      1|    if (dgbl == NULL)
  ------------------
  |  Branch (520:9): [True: 0, False: 1]
  ------------------
  521|      0|        return;
  522|       |
  523|      1|    rand = CRYPTO_THREAD_get_local(&dgbl->public);
  524|      1|    CRYPTO_THREAD_set_local(&dgbl->public, NULL);
  525|      1|    EVP_RAND_CTX_free(rand);
  526|       |
  527|      1|    rand = CRYPTO_THREAD_get_local(&dgbl->private);
  528|      1|    CRYPTO_THREAD_set_local(&dgbl->private, NULL);
  529|      1|    EVP_RAND_CTX_free(rand);
  530|      1|}
rand_lib.c:random_set_string:
  771|      8|{
  772|      8|    char *d = NULL;
  773|       |
  774|      8|    if (s != NULL) {
  ------------------
  |  Branch (774:9): [True: 2, False: 6]
  ------------------
  775|      2|        d = OPENSSL_strdup(s);
  ------------------
  |  |  111|      2|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  776|      2|        if (d == NULL)
  ------------------
  |  Branch (776:13): [True: 0, False: 2]
  ------------------
  777|      0|            return 0;
  778|      2|    }
  779|      8|    OPENSSL_free(*p);
  ------------------
  |  |  107|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  780|      8|    *p = d;
  781|      8|    return 1;
  782|      8|}

RAND_OpenSSL:
   63|  52.6k|{
   64|  52.6k|    return &ossl_rand_meth;
   65|  52.6k|}

rsa_ameth.c:rsa_pub_decode:
   77|  8.05k|{
   78|  8.05k|    const unsigned char *p;
   79|  8.05k|    int pklen;
   80|  8.05k|    X509_ALGOR *alg;
   81|  8.05k|    RSA *rsa = NULL;
   82|       |
   83|  8.05k|    if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &alg, pubkey))
  ------------------
  |  Branch (83:9): [True: 0, False: 8.05k]
  ------------------
   84|      0|        return 0;
   85|  8.05k|    if ((rsa = d2i_RSAPublicKey(NULL, &p, pklen)) == NULL)
  ------------------
  |  Branch (85:9): [True: 3.83k, False: 4.22k]
  ------------------
   86|  3.83k|        return 0;
   87|  4.22k|    if (!ossl_rsa_param_decode(rsa, alg)) {
  ------------------
  |  Branch (87:9): [True: 601, False: 3.62k]
  ------------------
   88|    601|        RSA_free(rsa);
   89|    601|        return 0;
   90|    601|    }
   91|       |
   92|  3.62k|    RSA_clear_flags(rsa, RSA_FLAG_TYPE_MASK);
  ------------------
  |  |  117|  3.62k|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
   93|  3.62k|    switch (pkey->ameth->pkey_id) {
   94|    148|    case EVP_PKEY_RSA:
  ------------------
  |  |   59|    148|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|    148|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
  |  Branch (94:5): [True: 148, False: 3.47k]
  ------------------
   95|    148|        RSA_set_flags(rsa, RSA_FLAG_TYPE_RSA);
  ------------------
  |  |  118|    148|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
   96|    148|        break;
   97|  3.47k|    case EVP_PKEY_RSA_PSS:
  ------------------
  |  |   61|  3.47k|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|  3.47k|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  |  Branch (97:5): [True: 3.47k, False: 148]
  ------------------
   98|  3.47k|        RSA_set_flags(rsa, RSA_FLAG_TYPE_RSASSAPSS);
  ------------------
  |  |  119|  3.47k|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
   99|  3.47k|        break;
  100|      0|    default:
  ------------------
  |  Branch (100:5): [True: 0, False: 3.62k]
  ------------------
  101|       |        /* Leave the type bits zero */
  102|      0|        break;
  103|  3.62k|    }
  104|       |
  105|  3.62k|    if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa)) {
  ------------------
  |  Branch (105:9): [True: 0, False: 3.62k]
  ------------------
  106|      0|        RSA_free(rsa);
  107|      0|        return 0;
  108|      0|    }
  109|  3.62k|    return 1;
  110|  3.62k|}
rsa_ameth.c:pkey_rsa_print:
  301|     28|{
  302|     28|    const RSA *x = pkey->pkey.rsa;
  303|     28|    char *str;
  304|     28|    const char *s;
  305|     28|    int ret = 0, mod_len = 0, ex_primes;
  306|       |
  307|     28|    if (x->n != NULL)
  ------------------
  |  Branch (307:9): [True: 28, False: 0]
  ------------------
  308|     28|        mod_len = BN_num_bits(x->n);
  309|     28|    ex_primes = sk_RSA_PRIME_INFO_num(x->prime_infos);
  310|       |
  311|     28|    if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (311:9): [True: 0, False: 28]
  ------------------
  312|      0|        goto err;
  313|       |
  314|     28|    if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ?  "RSA-PSS" : "RSA") <= 0)
  ------------------
  |  |  151|     28|#define pkey_is_pss(pkey) (pkey->ameth->pkey_id == EVP_PKEY_RSA_PSS)
  |  |  ------------------
  |  |  |  |   61|     28|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  |  |  ------------------
  |  |  |  |  |  |  583|     28|#define NID_rsassaPss           912
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (151:27): [True: 0, False: 28]
  |  |  ------------------
  ------------------
  |  Branch (314:9): [True: 0, False: 28]
  ------------------
  315|      0|        goto err;
  316|       |
  317|     28|    if (priv && x->d) {
  ------------------
  |  Branch (317:9): [True: 28, False: 0]
  |  Branch (317:17): [True: 28, False: 0]
  ------------------
  318|     28|        if (BIO_printf(bp, "Private-Key: (%d bit, %d primes)\n",
  ------------------
  |  Branch (318:13): [True: 0, False: 28]
  ------------------
  319|     28|                       mod_len, ex_primes <= 0 ? 2 : ex_primes + 2) <= 0)
  ------------------
  |  Branch (319:33): [True: 2, False: 26]
  ------------------
  320|      0|            goto err;
  321|     28|        str = "modulus:";
  322|     28|        s = "publicExponent:";
  323|     28|    } else {
  324|      0|        if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0)
  ------------------
  |  Branch (324:13): [True: 0, False: 0]
  ------------------
  325|      0|            goto err;
  326|      0|        str = "Modulus:";
  327|      0|        s = "Exponent:";
  328|      0|    }
  329|     28|    if (!ASN1_bn_print(bp, str, x->n, NULL, off))
  ------------------
  |  Branch (329:9): [True: 0, False: 28]
  ------------------
  330|      0|        goto err;
  331|     28|    if (!ASN1_bn_print(bp, s, x->e, NULL, off))
  ------------------
  |  Branch (331:9): [True: 0, False: 28]
  ------------------
  332|      0|        goto err;
  333|     28|    if (priv) {
  ------------------
  |  Branch (333:9): [True: 28, False: 0]
  ------------------
  334|     28|        int i;
  335|       |
  336|     28|        if (!ASN1_bn_print(bp, "privateExponent:", x->d, NULL, off))
  ------------------
  |  Branch (336:13): [True: 0, False: 28]
  ------------------
  337|      0|            goto err;
  338|     28|        if (!ASN1_bn_print(bp, "prime1:", x->p, NULL, off))
  ------------------
  |  Branch (338:13): [True: 0, False: 28]
  ------------------
  339|      0|            goto err;
  340|     28|        if (!ASN1_bn_print(bp, "prime2:", x->q, NULL, off))
  ------------------
  |  Branch (340:13): [True: 0, False: 28]
  ------------------
  341|      0|            goto err;
  342|     28|        if (!ASN1_bn_print(bp, "exponent1:", x->dmp1, NULL, off))
  ------------------
  |  Branch (342:13): [True: 0, False: 28]
  ------------------
  343|      0|            goto err;
  344|     28|        if (!ASN1_bn_print(bp, "exponent2:", x->dmq1, NULL, off))
  ------------------
  |  Branch (344:13): [True: 0, False: 28]
  ------------------
  345|      0|            goto err;
  346|     28|        if (!ASN1_bn_print(bp, "coefficient:", x->iqmp, NULL, off))
  ------------------
  |  Branch (346:13): [True: 0, False: 28]
  ------------------
  347|      0|            goto err;
  348|    995|        for (i = 0; i < sk_RSA_PRIME_INFO_num(x->prime_infos); i++) {
  ------------------
  |  Branch (348:21): [True: 967, False: 28]
  ------------------
  349|       |            /* print multi-prime info */
  350|    967|            BIGNUM *bn = NULL;
  351|    967|            RSA_PRIME_INFO *pinfo;
  352|    967|            int j;
  353|       |
  354|    967|            pinfo = sk_RSA_PRIME_INFO_value(x->prime_infos, i);
  355|  3.86k|            for (j = 0; j < 3; j++) {
  ------------------
  |  Branch (355:25): [True: 2.90k, False: 967]
  ------------------
  356|  2.90k|                if (!BIO_indent(bp, off, 128))
  ------------------
  |  Branch (356:21): [True: 0, False: 2.90k]
  ------------------
  357|      0|                    goto err;
  358|  2.90k|                switch (j) {
  359|    967|                case 0:
  ------------------
  |  Branch (359:17): [True: 967, False: 1.93k]
  ------------------
  360|    967|                    if (BIO_printf(bp, "prime%d:", i + 3) <= 0)
  ------------------
  |  Branch (360:25): [True: 0, False: 967]
  ------------------
  361|      0|                        goto err;
  362|    967|                    bn = pinfo->r;
  363|    967|                    break;
  364|    967|                case 1:
  ------------------
  |  Branch (364:17): [True: 967, False: 1.93k]
  ------------------
  365|    967|                    if (BIO_printf(bp, "exponent%d:", i + 3) <= 0)
  ------------------
  |  Branch (365:25): [True: 0, False: 967]
  ------------------
  366|      0|                        goto err;
  367|    967|                    bn = pinfo->d;
  368|    967|                    break;
  369|    967|                case 2:
  ------------------
  |  Branch (369:17): [True: 967, False: 1.93k]
  ------------------
  370|    967|                    if (BIO_printf(bp, "coefficient%d:", i + 3) <= 0)
  ------------------
  |  Branch (370:25): [True: 0, False: 967]
  ------------------
  371|      0|                        goto err;
  372|    967|                    bn = pinfo->t;
  373|    967|                    break;
  374|      0|                default:
  ------------------
  |  Branch (374:17): [True: 0, False: 2.90k]
  ------------------
  375|      0|                    break;
  376|  2.90k|                }
  377|  2.90k|                if (!ASN1_bn_print(bp, "", bn, NULL, off))
  ------------------
  |  Branch (377:21): [True: 0, False: 2.90k]
  ------------------
  378|      0|                    goto err;
  379|  2.90k|            }
  380|    967|        }
  381|     28|    }
  382|     28|    if (pkey_is_pss(pkey) && !rsa_pss_param_print(bp, 1, x->pss, off))
  ------------------
  |  |  151|     56|#define pkey_is_pss(pkey) (pkey->ameth->pkey_id == EVP_PKEY_RSA_PSS)
  |  |  ------------------
  |  |  |  |   61|     28|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  |  |  ------------------
  |  |  |  |  |  |  583|     28|#define NID_rsassaPss           912
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (151:27): [True: 0, False: 28]
  |  |  ------------------
  ------------------
  |  Branch (382:30): [True: 0, False: 0]
  ------------------
  383|      0|        goto err;
  384|     28|    ret = 1;
  385|     28| err:
  386|     28|    return ret;
  387|     28|}
rsa_ameth.c:rsa_priv_decode:
  174|      2|{
  175|      2|    int ret = 0;
  176|      2|    RSA *rsa = ossl_rsa_key_from_pkcs8(p8, NULL, NULL);
  177|       |
  178|      2|    if (rsa != NULL) {
  ------------------
  |  Branch (178:9): [True: 0, False: 2]
  ------------------
  179|      0|        ret = 1;
  180|      0|        EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa);
  181|      0|    }
  182|      2|    return ret;
  183|      2|}
rsa_ameth.c:rsa_priv_print:
  397|     28|{
  398|     28|    return pkey_rsa_print(bp, pkey, indent, 1);
  399|     28|}
rsa_ameth.c:int_rsa_free:
  201|  16.7k|{
  202|  16.7k|    RSA_free(pkey->pkey.rsa);
  203|  16.7k|}
rsa_ameth.c:old_rsa_priv_decode:
  131|  8.69k|{
  132|  8.69k|    RSA *rsa;
  133|       |
  134|  8.69k|    if ((rsa = d2i_RSAPrivateKey(NULL, pder, derlen)) == NULL)
  ------------------
  |  Branch (134:9): [True: 8.66k, False: 28]
  ------------------
  135|  8.66k|        return 0;
  136|     28|    EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa);
  137|     28|    return 1;
  138|  8.69k|}
rsa_ameth.c:old_rsa_priv_encode:
  141|     28|{
  142|     28|    return i2d_RSAPrivateKey(pkey->pkey.rsa, pder);
  143|     28|}

rsa_asn1.c:rsa_cb:
   30|   157k|{
   31|   157k|    if (operation == ASN1_OP_NEW_PRE) {
  ------------------
  |  |  742|   157k|# define ASN1_OP_NEW_PRE         0
  ------------------
  |  Branch (31:9): [True: 51.2k, False: 106k]
  ------------------
   32|  51.2k|        *pval = (ASN1_VALUE *)RSA_new();
   33|  51.2k|        if (*pval != NULL)
  ------------------
  |  Branch (33:13): [True: 51.2k, False: 0]
  ------------------
   34|  51.2k|            return 2;
   35|      0|        return 0;
   36|   106k|    } else if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|   106k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (36:16): [True: 46.6k, False: 59.8k]
  ------------------
   37|  46.6k|        RSA_free((RSA *)*pval);
   38|  46.6k|        *pval = NULL;
   39|  46.6k|        return 2;
   40|  59.8k|    } else if (operation == ASN1_OP_D2I_POST) {
  ------------------
  |  |  747|  59.8k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (40:16): [True: 5.10k, False: 54.7k]
  ------------------
   41|  5.10k|        if (((RSA *)*pval)->version != RSA_ASN1_VERSION_MULTI) {
  ------------------
  |  |   60|  5.10k|#  define RSA_ASN1_VERSION_MULTI          1
  ------------------
  |  Branch (41:13): [True: 4.48k, False: 616]
  ------------------
   42|       |            /* not a multi-prime key, skip */
   43|  4.48k|            return 1;
   44|  4.48k|        }
   45|    616|        return (ossl_rsa_multip_calc_product((RSA *)*pval) == 1) ? 2 : 0;
  ------------------
  |  Branch (45:16): [True: 610, False: 6]
  ------------------
   46|  5.10k|    }
   47|  54.7k|    return 1;
   48|   157k|}
rsa_asn1.c:rsa_pss_cb:
   79|  67.0k|{
   80|  67.0k|    if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|  67.0k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (80:9): [True: 12.7k, False: 54.3k]
  ------------------
   81|  12.7k|        RSA_PSS_PARAMS *pss = (RSA_PSS_PARAMS *)*pval;
   82|  12.7k|        X509_ALGOR_free(pss->maskHash);
   83|  12.7k|    }
   84|  67.0k|    return 1;
   85|  67.0k|}
rsa_asn1.c:rsa_oaep_cb:
  100|  46.2k|{
  101|  46.2k|    if (operation == ASN1_OP_FREE_PRE) {
  ------------------
  |  |  744|  46.2k|# define ASN1_OP_FREE_PRE        2
  ------------------
  |  Branch (101:9): [True: 9.23k, False: 37.0k]
  ------------------
  102|  9.23k|        RSA_OAEP_PARAMS *oaep = (RSA_OAEP_PARAMS *)*pval;
  103|  9.23k|        X509_ALGOR_free(oaep->maskHash);
  104|  9.23k|    }
  105|  46.2k|    return 1;
  106|  46.2k|}

ossl_rsa_todata:
  125|  3.98k|{
  126|  3.98k|    int ret = 0;
  127|  3.98k|    const BIGNUM *rsa_d = NULL, *rsa_n = NULL, *rsa_e = NULL;
  128|  3.98k|    STACK_OF(BIGNUM_const) *factors = sk_BIGNUM_const_new_null();
  ------------------
  |  |   31|  3.98k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  129|  3.98k|    STACK_OF(BIGNUM_const) *exps = sk_BIGNUM_const_new_null();
  ------------------
  |  |   31|  3.98k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  130|  3.98k|    STACK_OF(BIGNUM_const) *coeffs = sk_BIGNUM_const_new_null();
  ------------------
  |  |   31|  3.98k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  131|       |
  132|  3.98k|    if (rsa == NULL || factors == NULL || exps == NULL || coeffs == NULL)
  ------------------
  |  Branch (132:9): [True: 0, False: 3.98k]
  |  Branch (132:24): [True: 0, False: 3.98k]
  |  Branch (132:43): [True: 0, False: 3.98k]
  |  Branch (132:59): [True: 0, False: 3.98k]
  ------------------
  133|      0|        goto err;
  134|       |
  135|  3.98k|    RSA_get0_key(rsa, &rsa_n, &rsa_e, &rsa_d);
  136|  3.98k|    ossl_rsa_get0_all_params(rsa, factors, exps, coeffs);
  137|       |
  138|  3.98k|    if (!ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_RSA_N, rsa_n)
  ------------------
  |  |  414|  3.98k|# define OSSL_PKEY_PARAM_RSA_N "n"
  ------------------
  |  Branch (138:9): [True: 0, False: 3.98k]
  ------------------
  139|  3.98k|        || !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_RSA_E, rsa_e))
  ------------------
  |  |  389|  3.98k|# define OSSL_PKEY_PARAM_RSA_E "e"
  ------------------
  |  Branch (139:12): [True: 0, False: 3.98k]
  ------------------
  140|      0|        goto err;
  141|       |
  142|       |    /* Check private key data integrity */
  143|  3.98k|    if (include_private && rsa_d != NULL) {
  ------------------
  |  Branch (143:9): [True: 3.98k, False: 0]
  |  Branch (143:28): [True: 363, False: 3.62k]
  ------------------
  144|    363|        int numprimes = sk_BIGNUM_const_num(factors);
  145|    363|        int numexps = sk_BIGNUM_const_num(exps);
  146|    363|        int numcoeffs = sk_BIGNUM_const_num(coeffs);
  147|       |
  148|       |        /*
  149|       |         * It's permissible to have zero primes, i.e. no CRT params.
  150|       |         * Otherwise, there must be at least two, as many exponents,
  151|       |         * and one coefficient less.
  152|       |         */
  153|    363|        if (numprimes != 0
  ------------------
  |  Branch (153:13): [True: 363, False: 0]
  ------------------
  154|    363|            && (numprimes < 2 || numexps < 2 || numcoeffs < 1))
  ------------------
  |  Branch (154:17): [True: 0, False: 363]
  |  Branch (154:34): [True: 0, False: 363]
  |  Branch (154:49): [True: 0, False: 363]
  ------------------
  155|      0|            goto err;
  156|       |
  157|    363|        if (!ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_RSA_D,
  ------------------
  |  |  386|    363|# define OSSL_PKEY_PARAM_RSA_D "d"
  ------------------
  |  Branch (157:13): [True: 0, False: 363]
  ------------------
  158|    363|                                     rsa_d)
  159|    363|            || !ossl_param_build_set_multi_key_bn(bld, params,
  ------------------
  |  Branch (159:16): [True: 0, False: 363]
  ------------------
  160|    363|                                                  ossl_rsa_mp_factor_names,
  161|    363|                                                  factors)
  162|    363|            || !ossl_param_build_set_multi_key_bn(bld, params,
  ------------------
  |  Branch (162:16): [True: 0, False: 363]
  ------------------
  163|    363|                                                  ossl_rsa_mp_exp_names, exps)
  164|    363|            || !ossl_param_build_set_multi_key_bn(bld, params,
  ------------------
  |  Branch (164:16): [True: 0, False: 363]
  ------------------
  165|    363|                                                  ossl_rsa_mp_coeff_names,
  166|    363|                                                  coeffs))
  167|      0|        goto err;
  168|    363|    }
  169|       |
  170|       |#if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
  171|       |    /* The acvp test results are not meant for export so check for bld == NULL */
  172|       |    if (bld == NULL)
  173|       |        ossl_rsa_acvp_test_get_params(rsa, params);
  174|       |#endif
  175|  3.98k|    ret = 1;
  176|  3.98k| err:
  177|  3.98k|    sk_BIGNUM_const_free(factors);
  178|  3.98k|    sk_BIGNUM_const_free(exps);
  179|  3.98k|    sk_BIGNUM_const_free(coeffs);
  180|  3.98k|    return ret;
  181|  3.98k|}
ossl_rsa_pss_params_30_todata:
  185|  3.47k|{
  186|  3.47k|    if (!ossl_rsa_pss_params_30_is_unrestricted(pss)) {
  ------------------
  |  Branch (186:9): [True: 3.47k, False: 3]
  ------------------
  187|  3.47k|        int hashalg_nid = ossl_rsa_pss_params_30_hashalg(pss);
  188|  3.47k|        int maskgenalg_nid = ossl_rsa_pss_params_30_maskgenalg(pss);
  189|  3.47k|        int maskgenhashalg_nid = ossl_rsa_pss_params_30_maskgenhashalg(pss);
  190|  3.47k|        int saltlen = ossl_rsa_pss_params_30_saltlen(pss);
  191|  3.47k|        int default_hashalg_nid = ossl_rsa_pss_params_30_hashalg(NULL);
  192|  3.47k|        int default_maskgenalg_nid = ossl_rsa_pss_params_30_maskgenalg(NULL);
  193|  3.47k|        int default_maskgenhashalg_nid =
  194|  3.47k|                ossl_rsa_pss_params_30_maskgenhashalg(NULL);
  195|  3.47k|        const char *mdname =
  196|  3.47k|            (hashalg_nid == default_hashalg_nid
  ------------------
  |  Branch (196:14): [True: 3.47k, False: 0]
  ------------------
  197|  3.47k|             ? NULL : ossl_rsa_oaeppss_nid2name(hashalg_nid));
  198|  3.47k|        const char *mgfname =
  199|  3.47k|            (maskgenalg_nid == default_maskgenalg_nid
  ------------------
  |  Branch (199:14): [True: 3.47k, False: 0]
  ------------------
  200|  3.47k|             ? NULL : ossl_rsa_oaeppss_nid2name(maskgenalg_nid));
  201|  3.47k|        const char *mgf1mdname =
  202|  3.47k|            (maskgenhashalg_nid == default_maskgenhashalg_nid
  ------------------
  |  Branch (202:14): [True: 3.47k, False: 0]
  ------------------
  203|  3.47k|             ? NULL : ossl_rsa_oaeppss_nid2name(maskgenhashalg_nid));
  204|  3.47k|        const char *key_md = OSSL_PKEY_PARAM_RSA_DIGEST;
  ------------------
  |  |  387|  3.47k|# define OSSL_PKEY_PARAM_RSA_DIGEST OSSL_PKEY_PARAM_DIGEST
  |  |  ------------------
  |  |  |  |  322|  3.47k|# define OSSL_PKEY_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  3.47k|# define OSSL_ALG_PARAM_DIGEST "digest"
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  205|  3.47k|        const char *key_mgf = OSSL_PKEY_PARAM_RSA_MASKGENFUNC;
  ------------------
  |  |  412|  3.47k|# define OSSL_PKEY_PARAM_RSA_MASKGENFUNC OSSL_PKEY_PARAM_MASKGENFUNC
  |  |  ------------------
  |  |  |  |  367|  3.47k|# define OSSL_PKEY_PARAM_MASKGENFUNC "mgf"
  |  |  ------------------
  ------------------
  206|  3.47k|        const char *key_mgf1_md = OSSL_PKEY_PARAM_RSA_MGF1_DIGEST;
  ------------------
  |  |  413|  3.47k|# define OSSL_PKEY_PARAM_RSA_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
  |  |  ------------------
  |  |  |  |  369|  3.47k|# define OSSL_PKEY_PARAM_MGF1_DIGEST "mgf1-digest"
  |  |  ------------------
  ------------------
  207|  3.47k|        const char *key_saltlen = OSSL_PKEY_PARAM_RSA_PSS_SALTLEN;
  ------------------
  |  |  416|  3.47k|# define OSSL_PKEY_PARAM_RSA_PSS_SALTLEN "saltlen"
  ------------------
  208|       |
  209|       |        /*
  210|       |         * To ensure that the key isn't seen as unrestricted by the recipient,
  211|       |         * we make sure that at least one PSS-related parameter is passed, even
  212|       |         * if it has a default value; saltlen.
  213|       |         */
  214|  3.47k|        if ((mdname != NULL
  ------------------
  |  Branch (214:14): [True: 0, False: 3.47k]
  ------------------
  215|  3.47k|             && !ossl_param_build_set_utf8_string(bld, params, key_md, mdname))
  ------------------
  |  Branch (215:17): [True: 0, False: 0]
  ------------------
  216|  3.47k|            || (mgfname != NULL
  ------------------
  |  Branch (216:17): [True: 0, False: 3.47k]
  ------------------
  217|  3.47k|                && !ossl_param_build_set_utf8_string(bld, params,
  ------------------
  |  Branch (217:20): [True: 0, False: 0]
  ------------------
  218|      0|                                                     key_mgf, mgfname))
  219|  3.47k|            || (mgf1mdname != NULL
  ------------------
  |  Branch (219:17): [True: 0, False: 3.47k]
  ------------------
  220|  3.47k|                && !ossl_param_build_set_utf8_string(bld, params,
  ------------------
  |  Branch (220:20): [True: 0, False: 0]
  ------------------
  221|      0|                                                     key_mgf1_md, mgf1mdname))
  222|  3.47k|            || (!ossl_param_build_set_int(bld, params, key_saltlen, saltlen)))
  ------------------
  |  Branch (222:16): [True: 0, False: 3.47k]
  ------------------
  223|      0|            return 0;
  224|  3.47k|    }
  225|  3.47k|    return 1;
  226|  3.47k|}
ossl_rsa_is_foreign:
  332|  3.64k|{
  333|  3.64k|#ifndef FIPS_MODULE
  334|  3.64k|    if (rsa->engine != NULL || RSA_get_method(rsa) != RSA_PKCS1_OpenSSL())
  ------------------
  |  Branch (334:9): [True: 0, False: 3.64k]
  |  Branch (334:32): [True: 0, False: 3.64k]
  ------------------
  335|      0|        return 1;
  336|  3.64k|#endif
  337|  3.64k|    return 0;
  338|  3.64k|}
ossl_rsa_pss_decode:
  444|  3.47k|{
  445|  3.47k|    RSA_PSS_PARAMS *pss;
  446|       |
  447|  3.47k|    pss = ASN1_TYPE_unpack_sequence(ASN1_ITEM_rptr(RSA_PSS_PARAMS),
  ------------------
  |  |  426|  3.47k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  448|  3.47k|                                    alg->parameter);
  449|       |
  450|  3.47k|    if (pss == NULL)
  ------------------
  |  Branch (450:9): [True: 3, False: 3.47k]
  ------------------
  451|      3|        return NULL;
  452|       |
  453|  3.47k|    if (pss->maskGenAlgorithm != NULL) {
  ------------------
  |  Branch (453:9): [True: 0, False: 3.47k]
  ------------------
  454|      0|        pss->maskHash = ossl_x509_algor_mgf1_decode(pss->maskGenAlgorithm);
  455|      0|        if (pss->maskHash == NULL) {
  ------------------
  |  Branch (455:13): [True: 0, False: 0]
  ------------------
  456|      0|            RSA_PSS_PARAMS_free(pss);
  457|      0|            return NULL;
  458|      0|        }
  459|      0|    }
  460|       |
  461|  3.47k|    return pss;
  462|  3.47k|}
ossl_rsa_pss_get_param_unverified:
  506|  3.47k|{
  507|  3.47k|    RSA_PSS_PARAMS_30 pss_params;
  508|       |
  509|       |    /* Get the defaults from the ONE place */
  510|  3.47k|    (void)ossl_rsa_pss_params_30_set_defaults(&pss_params);
  511|       |
  512|  3.47k|    if (pss == NULL)
  ------------------
  |  Branch (512:9): [True: 0, False: 3.47k]
  ------------------
  513|      0|        return 0;
  514|  3.47k|    *pmd = ossl_x509_algor_get_md(pss->hashAlgorithm);
  515|  3.47k|    if (*pmd == NULL)
  ------------------
  |  Branch (515:9): [True: 0, False: 3.47k]
  ------------------
  516|      0|        return 0;
  517|  3.47k|    *pmgf1md = ossl_x509_algor_get_md(pss->maskHash);
  518|  3.47k|    if (*pmgf1md == NULL)
  ------------------
  |  Branch (518:9): [True: 0, False: 3.47k]
  ------------------
  519|      0|        return 0;
  520|  3.47k|    if (pss->saltLength)
  ------------------
  |  Branch (520:9): [True: 0, False: 3.47k]
  ------------------
  521|      0|        *psaltlen = ASN1_INTEGER_get(pss->saltLength);
  522|  3.47k|    else
  523|  3.47k|        *psaltlen = ossl_rsa_pss_params_30_saltlen(&pss_params);
  524|  3.47k|    if (pss->trailerField)
  ------------------
  |  Branch (524:9): [True: 0, False: 3.47k]
  ------------------
  525|      0|        *ptrailerField = ASN1_INTEGER_get(pss->trailerField);
  526|  3.47k|    else
  527|  3.47k|        *ptrailerField = ossl_rsa_pss_params_30_trailerfield(&pss_params);
  528|       |
  529|  3.47k|    return 1;
  530|  3.47k|}
ossl_rsa_param_decode:
  533|  4.22k|{
  534|  4.22k|    RSA_PSS_PARAMS *pss;
  535|  4.22k|    const ASN1_OBJECT *algoid;
  536|  4.22k|    const void *algp;
  537|  4.22k|    int algptype;
  538|       |
  539|  4.22k|    X509_ALGOR_get0(&algoid, &algptype, &algp, alg);
  540|  4.22k|    if (OBJ_obj2nid(algoid) != EVP_PKEY_RSA_PSS)
  ------------------
  |  |   61|  4.22k|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|  4.22k|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  |  Branch (540:9): [True: 149, False: 4.07k]
  ------------------
  541|    149|        return 1;
  542|  4.07k|    if (algptype == V_ASN1_UNDEF)
  ------------------
  |  |   60|  4.07k|# define V_ASN1_UNDEF                    -1
  ------------------
  |  Branch (542:9): [True: 3, False: 4.07k]
  ------------------
  543|      3|        return 1;
  544|  4.07k|    if (algptype != V_ASN1_SEQUENCE) {
  ------------------
  |  |   74|  4.07k|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (544:9): [True: 600, False: 3.47k]
  ------------------
  545|    600|        ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PSS_PARAMETERS);
  ------------------
  |  |  401|    600|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    600|    (ERR_new(),                                                 \
  |  |  |  |  404|    600|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    600|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    600|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    600|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    600|     ERR_set_error)
  |  |  ------------------
  ------------------
  546|    600|        return 0;
  547|    600|    }
  548|  3.47k|    if ((pss = ossl_rsa_pss_decode(alg)) == NULL
  ------------------
  |  Branch (548:9): [True: 3, False: 3.47k]
  ------------------
  549|  3.47k|        || !ossl_rsa_set0_pss_params(rsa, pss)) {
  ------------------
  |  Branch (549:12): [True: 0, False: 3.47k]
  ------------------
  550|      3|        RSA_PSS_PARAMS_free(pss);
  551|      3|        return 0;
  552|      3|    }
  553|  3.47k|    if (!ossl_rsa_sync_to_pss_params_30(rsa))
  ------------------
  |  Branch (553:9): [True: 0, False: 3.47k]
  ------------------
  554|      0|        return 0;
  555|  3.47k|    return 1;
  556|  3.47k|}
ossl_rsa_key_from_pkcs8:
  560|      6|{
  561|      6|    const unsigned char *p;
  562|      6|    RSA *rsa;
  563|      6|    int pklen;
  564|      6|    const X509_ALGOR *alg;
  565|       |
  566|      6|    if (!PKCS8_pkey_get0(NULL, &p, &pklen, &alg, p8inf))
  ------------------
  |  Branch (566:9): [True: 0, False: 6]
  ------------------
  567|      0|        return 0;
  568|      6|    rsa = d2i_RSAPrivateKey(NULL, &p, pklen);
  569|      6|    if (rsa == NULL) {
  ------------------
  |  Branch (569:9): [True: 2, False: 4]
  ------------------
  570|      2|        ERR_raise(ERR_LIB_RSA, ERR_R_RSA_LIB);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  571|      2|        return NULL;
  572|      2|    }
  573|      4|    if (!ossl_rsa_param_decode(rsa, alg)) {
  ------------------
  |  Branch (573:9): [True: 2, False: 2]
  ------------------
  574|      2|        RSA_free(rsa);
  575|      2|        return NULL;
  576|      2|    }
  577|       |
  578|      2|    RSA_clear_flags(rsa, RSA_FLAG_TYPE_MASK);
  ------------------
  |  |  117|      2|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  579|      2|    switch (OBJ_obj2nid(alg->algorithm)) {
  580|      1|    case EVP_PKEY_RSA:
  ------------------
  |  |   59|      1|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|      1|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
  |  Branch (580:5): [True: 1, False: 1]
  ------------------
  581|      1|        RSA_set_flags(rsa, RSA_FLAG_TYPE_RSA);
  ------------------
  |  |  118|      1|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
  582|      1|        break;
  583|      1|    case EVP_PKEY_RSA_PSS:
  ------------------
  |  |   61|      1|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|      1|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  |  Branch (583:5): [True: 1, False: 1]
  ------------------
  584|      1|        RSA_set_flags(rsa, RSA_FLAG_TYPE_RSASSAPSS);
  ------------------
  |  |  119|      1|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  585|      1|        break;
  586|      0|    default:
  ------------------
  |  Branch (586:5): [True: 0, False: 2]
  ------------------
  587|       |        /* Leave the type bits zero */
  588|      0|        break;
  589|      2|    }
  590|       |
  591|      2|    return rsa;
  592|      2|}
rsa_backend.c:ossl_rsa_sync_to_pss_params_30:
  465|  3.47k|{
  466|  3.47k|    const RSA_PSS_PARAMS *legacy_pss = NULL;
  467|  3.47k|    RSA_PSS_PARAMS_30 *pss = NULL;
  468|       |
  469|  3.47k|    if (rsa != NULL
  ------------------
  |  Branch (469:9): [True: 3.47k, False: 0]
  ------------------
  470|  3.47k|        && (legacy_pss = RSA_get0_pss_params(rsa)) != NULL
  ------------------
  |  Branch (470:12): [True: 3.47k, False: 0]
  ------------------
  471|  3.47k|        && (pss = ossl_rsa_get0_pss_params_30(rsa)) != NULL) {
  ------------------
  |  Branch (471:12): [True: 3.47k, False: 0]
  ------------------
  472|  3.47k|        const EVP_MD *md = NULL, *mgf1md = NULL;
  473|  3.47k|        int md_nid, mgf1md_nid, saltlen, trailerField;
  474|  3.47k|        RSA_PSS_PARAMS_30 pss_params;
  475|       |
  476|       |        /*
  477|       |         * We don't care about the validity of the fields here, we just
  478|       |         * want to synchronise values.  Verifying here makes it impossible
  479|       |         * to even read a key with invalid values, making it hard to test
  480|       |         * a bad situation.
  481|       |         *
  482|       |         * Other routines use ossl_rsa_pss_get_param(), so the values will
  483|       |         * be checked, eventually.
  484|       |         */
  485|  3.47k|        if (!ossl_rsa_pss_get_param_unverified(legacy_pss, &md, &mgf1md,
  ------------------
  |  Branch (485:13): [True: 0, False: 3.47k]
  ------------------
  486|  3.47k|                                               &saltlen, &trailerField))
  487|      0|            return 0;
  488|  3.47k|        md_nid = EVP_MD_get_type(md);
  489|  3.47k|        mgf1md_nid = EVP_MD_get_type(mgf1md);
  490|  3.47k|        if (!ossl_rsa_pss_params_30_set_defaults(&pss_params)
  ------------------
  |  Branch (490:13): [True: 0, False: 3.47k]
  ------------------
  491|  3.47k|            || !ossl_rsa_pss_params_30_set_hashalg(&pss_params, md_nid)
  ------------------
  |  Branch (491:16): [True: 0, False: 3.47k]
  ------------------
  492|  3.47k|            || !ossl_rsa_pss_params_30_set_maskgenhashalg(&pss_params,
  ------------------
  |  Branch (492:16): [True: 0, False: 3.47k]
  ------------------
  493|  3.47k|                                                          mgf1md_nid)
  494|  3.47k|            || !ossl_rsa_pss_params_30_set_saltlen(&pss_params, saltlen)
  ------------------
  |  Branch (494:16): [True: 0, False: 3.47k]
  ------------------
  495|  3.47k|            || !ossl_rsa_pss_params_30_set_trailerfield(&pss_params,
  ------------------
  |  Branch (495:16): [True: 0, False: 3.47k]
  ------------------
  496|  3.47k|                                                        trailerField))
  497|      0|            return 0;
  498|  3.47k|        *pss = pss_params;
  499|  3.47k|    }
  500|  3.47k|    return 1;
  501|  3.47k|}

RSA_bits:
   24|  3.98k|{
   25|  3.98k|    return BN_num_bits(r->n);
   26|  3.98k|}
RSA_size:
   29|  3.98k|{
   30|  3.98k|    return BN_num_bytes(r->n);
  ------------------
  |  |  189|  3.98k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
   31|  3.98k|}

ossl_err_load_RSA_strings:
  160|      2|{
  161|      2|#ifndef OPENSSL_NO_ERR
  162|      2|    if (ERR_reason_error_string(RSA_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (162:9): [True: 2, False: 0]
  ------------------
  163|      2|        ERR_load_strings_const(RSA_str_reasons);
  164|      2|#endif
  165|      2|    return 1;
  166|      2|}

RSA_new:
   35|  51.2k|{
   36|  51.2k|    return rsa_new_intern(NULL, NULL);
   37|  51.2k|}
RSA_get_method:
   40|  3.64k|{
   41|  3.64k|    return rsa->meth;
   42|  3.64k|}
RSA_free:
  137|   115k|{
  138|   115k|    int i;
  139|       |
  140|   115k|    if (r == NULL)
  ------------------
  |  Branch (140:9): [True: 60.4k, False: 54.8k]
  ------------------
  141|  60.4k|        return;
  142|       |
  143|  54.8k|    CRYPTO_DOWN_REF(&r->references, &i);
  144|  54.8k|    REF_PRINT_COUNT("RSA", r);
  ------------------
  |  |  289|  54.8k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  54.8k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  54.8k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  54.8k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  145|  54.8k|    if (i > 0)
  ------------------
  |  Branch (145:9): [True: 3.62k, False: 51.2k]
  ------------------
  146|  3.62k|        return;
  147|  51.2k|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|  51.2k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 51.2k]
  |  |  ------------------
  ------------------
  148|       |
  149|  51.2k|    if (r->meth != NULL && r->meth->finish != NULL)
  ------------------
  |  Branch (149:9): [True: 51.2k, False: 0]
  |  Branch (149:28): [True: 51.2k, False: 0]
  ------------------
  150|  51.2k|        r->meth->finish(r);
  151|  51.2k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
  152|  51.2k|    ENGINE_finish(r->engine);
  153|  51.2k|#endif
  154|       |
  155|  51.2k|#ifndef FIPS_MODULE
  156|  51.2k|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);
  ------------------
  |  |  227|  51.2k|# define CRYPTO_EX_INDEX_RSA              9
  ------------------
  157|  51.2k|#endif
  158|       |
  159|  51.2k|    CRYPTO_THREAD_lock_free(r->lock);
  160|  51.2k|    CRYPTO_FREE_REF(&r->references);
  161|       |
  162|  51.2k|    BN_free(r->n);
  163|  51.2k|    BN_free(r->e);
  164|  51.2k|    BN_clear_free(r->d);
  165|  51.2k|    BN_clear_free(r->p);
  166|  51.2k|    BN_clear_free(r->q);
  167|  51.2k|    BN_clear_free(r->dmp1);
  168|  51.2k|    BN_clear_free(r->dmq1);
  169|  51.2k|    BN_clear_free(r->iqmp);
  170|       |
  171|       |#if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
  172|       |    ossl_rsa_acvp_test_free(r->acvp_test);
  173|       |#endif
  174|       |
  175|  51.2k|#ifndef FIPS_MODULE
  176|  51.2k|    RSA_PSS_PARAMS_free(r->pss);
  177|  51.2k|    sk_RSA_PRIME_INFO_pop_free(r->prime_infos, ossl_rsa_multip_info_free);
  178|  51.2k|#endif
  179|  51.2k|    BN_BLINDING_free(r->blinding);
  180|  51.2k|    BN_BLINDING_free(r->mt_blinding);
  181|  51.2k|    OPENSSL_free(r);
  ------------------
  |  |  107|  51.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  51.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  51.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  182|  51.2k|}
RSA_up_ref:
  185|  3.62k|{
  186|  3.62k|    int i;
  187|       |
  188|  3.62k|    if (CRYPTO_UP_REF(&r->references, &i) <= 0)
  ------------------
  |  Branch (188:9): [True: 0, False: 3.62k]
  ------------------
  189|      0|        return 0;
  190|       |
  191|  3.62k|    REF_PRINT_COUNT("RSA", r);
  ------------------
  |  |  289|  3.62k|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|  3.62k|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|  3.62k|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|  3.62k|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  192|  3.62k|    REF_ASSERT_ISNT(i < 2);
  ------------------
  |  |  281|  3.62k|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 3.62k]
  |  |  ------------------
  ------------------
  193|  3.62k|    return i > 1 ? 1 : 0;
  ------------------
  |  Branch (193:12): [True: 3.62k, False: 0]
  ------------------
  194|  3.62k|}
ossl_rsa_set0_libctx:
  202|  3.98k|{
  203|  3.98k|    r->libctx = libctx;
  204|  3.98k|}
ossl_ifc_ffc_compute_security_bits:
  318|  3.73k|{
  319|  3.73k|    uint64_t x;
  320|  3.73k|    uint32_t lx;
  321|  3.73k|    uint16_t y, cap;
  322|       |
  323|       |    /*
  324|       |     * Look for common values as listed in standards.
  325|       |     * These values are not exactly equal to the results from the formulae in
  326|       |     * the standards but are defined to be canonical.
  327|       |     */
  328|  3.73k|    switch (n) {
  ------------------
  |  Branch (328:13): [True: 3.72k, False: 11]
  ------------------
  329|      1|    case 2048:      /* SP 800-56B rev 2 Appendix D and FIPS 140-2 IG 7.5 */
  ------------------
  |  Branch (329:5): [True: 1, False: 3.73k]
  ------------------
  330|      1|        return 112;
  331|      1|    case 3072:      /* SP 800-56B rev 2 Appendix D and FIPS 140-2 IG 7.5 */
  ------------------
  |  Branch (331:5): [True: 1, False: 3.73k]
  ------------------
  332|      1|        return 128;
  333|      1|    case 4096:      /* SP 800-56B rev 2 Appendix D */
  ------------------
  |  Branch (333:5): [True: 1, False: 3.73k]
  ------------------
  334|      1|        return 152;
  335|      3|    case 6144:      /* SP 800-56B rev 2 Appendix D */
  ------------------
  |  Branch (335:5): [True: 3, False: 3.73k]
  ------------------
  336|      3|        return 176;
  337|      1|    case 7680:      /* FIPS 140-2 IG 7.5 */
  ------------------
  |  Branch (337:5): [True: 1, False: 3.73k]
  ------------------
  338|      1|        return 192;
  339|      1|    case 8192:      /* SP 800-56B rev 2 Appendix D */
  ------------------
  |  Branch (339:5): [True: 1, False: 3.73k]
  ------------------
  340|      1|        return 200;
  341|      3|    case 15360:     /* FIPS 140-2 IG 7.5 */
  ------------------
  |  Branch (341:5): [True: 3, False: 3.73k]
  ------------------
  342|      3|        return 256;
  343|  3.73k|    }
  344|       |
  345|       |    /*
  346|       |     * The first incorrect result (i.e. not accurate or off by one low) occurs
  347|       |     * for n = 699668.  The true value here is 1200.  Instead of using this n
  348|       |     * as the check threshold, the smallest n such that the correct result is
  349|       |     * 1200 is used instead.
  350|       |     */
  351|  3.72k|    if (n >= 687737)
  ------------------
  |  Branch (351:9): [True: 0, False: 3.72k]
  ------------------
  352|      0|        return 1200;
  353|  3.72k|    if (n < 8)
  ------------------
  |  Branch (353:9): [True: 3.56k, False: 161]
  ------------------
  354|  3.56k|        return 0;
  355|       |
  356|       |    /*
  357|       |     * To ensure that the output is non-decreasing with respect to n,
  358|       |     * a cap needs to be applied to the two values where the function over
  359|       |     * estimates the strength (according to the above fast path).
  360|       |     */
  361|    161|    if (n <= 7680)
  ------------------
  |  Branch (361:9): [True: 116, False: 45]
  ------------------
  362|    116|        cap = 192;
  363|     45|    else if (n <= 15360)
  ------------------
  |  Branch (363:14): [True: 29, False: 16]
  ------------------
  364|     29|        cap = 256;
  365|     16|    else
  366|     16|        cap = 1200;
  367|       |
  368|    161|    x = n * (uint64_t)log_2;
  369|    161|    lx = ilog_e(x);
  370|    161|    y = (uint16_t)((mul2(c1_923, icbrt64(mul2(mul2(x, lx), lx))) - c4_690)
  371|    161|                   / log_2);
  372|    161|    y = (y + 4) & ~7;
  373|    161|    if (y > cap)
  ------------------
  |  Branch (373:9): [True: 7, False: 154]
  ------------------
  374|      7|        y = cap;
  375|    161|    return y;
  376|  3.72k|}
RSA_security_bits:
  381|  3.98k|{
  382|  3.98k|    int bits = BN_num_bits(rsa->n);
  383|       |
  384|  3.98k|#ifndef FIPS_MODULE
  385|  3.98k|    if (rsa->version == RSA_ASN1_VERSION_MULTI) {
  ------------------
  |  |   60|  3.98k|#  define RSA_ASN1_VERSION_MULTI          1
  ------------------
  |  Branch (385:9): [True: 283, False: 3.70k]
  ------------------
  386|       |        /* This ought to mean that we have private key at hand. */
  387|    283|        int ex_primes = sk_RSA_PRIME_INFO_num(rsa->prime_infos);
  388|       |
  389|    283|        if (ex_primes <= 0 || (ex_primes + 2) > ossl_rsa_multip_cap(bits))
  ------------------
  |  Branch (389:13): [True: 0, False: 283]
  |  Branch (389:31): [True: 247, False: 36]
  ------------------
  390|    247|            return 0;
  391|    283|    }
  392|  3.73k|#endif
  393|  3.73k|    return ossl_ifc_ffc_compute_security_bits(bits);
  394|  3.98k|}
RSA_get0_key:
  551|  4.34k|{
  552|  4.34k|    if (n != NULL)
  ------------------
  |  Branch (552:9): [True: 4.34k, False: 0]
  ------------------
  553|  4.34k|        *n = r->n;
  554|  4.34k|    if (e != NULL)
  ------------------
  |  Branch (554:9): [True: 4.34k, False: 0]
  ------------------
  555|  4.34k|        *e = r->e;
  556|  4.34k|    if (d != NULL)
  ------------------
  |  Branch (556:9): [True: 4.34k, False: 0]
  ------------------
  557|  4.34k|        *d = r->d;
  558|  4.34k|}
RSA_get_multi_prime_extra_count:
  570|    726|{
  571|    726|    int pnum;
  572|       |
  573|    726|    pnum = sk_RSA_PRIME_INFO_num(r->prime_infos);
  574|    726|    if (pnum <= 0)
  ------------------
  |  Branch (574:9): [True: 96, False: 630]
  ------------------
  575|     96|        pnum = 0;
  576|    726|    return pnum;
  577|    726|}
RSA_get0_n:
  641|  4.34k|{
  642|  4.34k|    return r->n;
  643|  4.34k|}
RSA_get0_d:
  651|    363|{
  652|    363|    return r->d;
  653|    363|}
RSA_get0_p:
  656|  5.07k|{
  657|  5.07k|    return r->p;
  658|  5.07k|}
RSA_get0_q:
  661|    726|{
  662|    726|    return r->q;
  663|    726|}
RSA_get0_dmp1:
  666|    726|{
  667|    726|    return r->dmp1;
  668|    726|}
RSA_get0_dmq1:
  671|    726|{
  672|    726|    return r->dmq1;
  673|    726|}
RSA_get0_iqmp:
  676|    726|{
  677|    726|    return r->iqmp;
  678|    726|}
RSA_get0_pss_params:
  681|  3.47k|{
  682|       |#ifdef FIPS_MODULE
  683|       |    return NULL;
  684|       |#else
  685|  3.47k|    return r->pss;
  686|  3.47k|#endif
  687|  3.47k|}
ossl_rsa_set0_pss_params:
  691|  3.47k|{
  692|       |#ifdef FIPS_MODULE
  693|       |    return 0;
  694|       |#else
  695|  3.47k|    RSA_PSS_PARAMS_free(r->pss);
  696|  3.47k|    r->pss = pss;
  697|  3.47k|    return 1;
  698|  3.47k|#endif
  699|  3.47k|}
ossl_rsa_get0_pss_params_30:
  703|  7.81k|{
  704|  7.81k|    return &r->pss_params;
  705|  7.81k|}
RSA_clear_flags:
  708|  3.62k|{
  709|  3.62k|    r->flags &= ~flags;
  710|  3.62k|}
RSA_test_flags:
  713|  12.6k|{
  714|  12.6k|    return r->flags & flags;
  715|  12.6k|}
RSA_set_flags:
  718|  3.62k|{
  719|  3.62k|    r->flags |= flags;
  720|  3.62k|}
ossl_rsa_get0_all_params:
  846|  4.34k|{
  847|  4.34k|#ifndef FIPS_MODULE
  848|  4.34k|    RSA_PRIME_INFO *pinfo;
  849|  4.34k|    int i, pnum;
  850|  4.34k|#endif
  851|       |
  852|  4.34k|    if (r == NULL)
  ------------------
  |  Branch (852:9): [True: 0, False: 4.34k]
  ------------------
  853|      0|        return 0;
  854|       |
  855|       |    /* If |p| is NULL, there are no CRT parameters */
  856|  4.34k|    if (RSA_get0_p(r) == NULL)
  ------------------
  |  Branch (856:9): [True: 3.62k, False: 726]
  ------------------
  857|  3.62k|        return 1;
  858|       |
  859|    726|    sk_BIGNUM_const_push(primes, RSA_get0_p(r));
  860|    726|    sk_BIGNUM_const_push(primes, RSA_get0_q(r));
  861|    726|    sk_BIGNUM_const_push(exps, RSA_get0_dmp1(r));
  862|    726|    sk_BIGNUM_const_push(exps, RSA_get0_dmq1(r));
  863|    726|    sk_BIGNUM_const_push(coeffs, RSA_get0_iqmp(r));
  864|       |
  865|    726|#ifndef FIPS_MODULE
  866|    726|    pnum = RSA_get_multi_prime_extra_count(r);
  867|  29.5k|    for (i = 0; i < pnum; i++) {
  ------------------
  |  Branch (867:17): [True: 28.7k, False: 726]
  ------------------
  868|  28.7k|        pinfo = sk_RSA_PRIME_INFO_value(r->prime_infos, i);
  869|  28.7k|        sk_BIGNUM_const_push(primes, pinfo->r);
  870|  28.7k|        sk_BIGNUM_const_push(exps, pinfo->d);
  871|  28.7k|        sk_BIGNUM_const_push(coeffs, pinfo->t);
  872|  28.7k|    }
  873|    726|#endif
  874|       |
  875|    726|    return 1;
  876|  4.34k|}
rsa_lib.c:rsa_new_intern:
   76|  51.2k|{
   77|  51.2k|    RSA *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|  51.2k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  51.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  51.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   78|       |
   79|  51.2k|    if (ret == NULL)
  ------------------
  |  Branch (79:9): [True: 0, False: 51.2k]
  ------------------
   80|      0|        return NULL;
   81|       |
   82|  51.2k|    ret->lock = CRYPTO_THREAD_lock_new();
   83|  51.2k|    if (ret->lock == NULL) {
  ------------------
  |  Branch (83:9): [True: 0, False: 51.2k]
  ------------------
   84|      0|        ERR_raise(ERR_LIB_RSA, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   85|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   86|      0|        return NULL;
   87|      0|    }
   88|       |
   89|  51.2k|    if (!CRYPTO_NEW_REF(&ret->references, 1)) {
  ------------------
  |  Branch (89:9): [True: 0, False: 51.2k]
  ------------------
   90|      0|        CRYPTO_THREAD_lock_free(ret->lock);
   91|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|      0|        return NULL;
   93|      0|    }
   94|       |
   95|  51.2k|    ret->libctx = libctx;
   96|  51.2k|    ret->meth = RSA_get_default_method();
   97|  51.2k|#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
   98|  51.2k|    ret->flags = ret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
  ------------------
  |  |  477|  51.2k|#  define RSA_FLAG_NON_FIPS_ALLOW                 0x0400
  ------------------
   99|  51.2k|    if (engine) {
  ------------------
  |  Branch (99:9): [True: 0, False: 51.2k]
  ------------------
  100|      0|        if (!ENGINE_init(engine)) {
  ------------------
  |  Branch (100:13): [True: 0, False: 0]
  ------------------
  101|      0|            ERR_raise(ERR_LIB_RSA, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  102|      0|            goto err;
  103|      0|        }
  104|      0|        ret->engine = engine;
  105|  51.2k|    } else {
  106|  51.2k|        ret->engine = ENGINE_get_default_RSA();
  107|  51.2k|    }
  108|  51.2k|    if (ret->engine) {
  ------------------
  |  Branch (108:9): [True: 0, False: 51.2k]
  ------------------
  109|      0|        ret->meth = ENGINE_get_RSA(ret->engine);
  110|      0|        if (ret->meth == NULL) {
  ------------------
  |  Branch (110:13): [True: 0, False: 0]
  ------------------
  111|      0|            ERR_raise(ERR_LIB_RSA, ERR_R_ENGINE_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  112|      0|            goto err;
  113|      0|        }
  114|      0|    }
  115|  51.2k|#endif
  116|       |
  117|  51.2k|    ret->flags = ret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
  ------------------
  |  |  477|  51.2k|#  define RSA_FLAG_NON_FIPS_ALLOW                 0x0400
  ------------------
  118|  51.2k|#ifndef FIPS_MODULE
  119|  51.2k|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data)) {
  ------------------
  |  |  227|  51.2k|# define CRYPTO_EX_INDEX_RSA              9
  ------------------
  |  Branch (119:9): [True: 0, False: 51.2k]
  ------------------
  120|      0|        goto err;
  121|      0|    }
  122|  51.2k|#endif
  123|       |
  124|  51.2k|    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
  ------------------
  |  Branch (124:9): [True: 51.2k, False: 0]
  |  Branch (124:38): [True: 0, False: 51.2k]
  ------------------
  125|      0|        ERR_raise(ERR_LIB_RSA, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  126|      0|        goto err;
  127|      0|    }
  128|       |
  129|  51.2k|    return ret;
  130|       |
  131|      0| err:
  132|      0|    RSA_free(ret);
  133|      0|    return NULL;
  134|  51.2k|}
rsa_lib.c:ilog_e:
  275|    161|{
  276|    161|    uint32_t i, r = 0;
  277|       |
  278|       |    /*
  279|       |     * Scale down the value into the range 1 .. 2.
  280|       |     *
  281|       |     * If fractional numbers need to be processed, another loop needs
  282|       |     * to go here that checks v < scale and if so multiplies it by 2 and
  283|       |     * reduces r by scale.  This also means making r signed.
  284|       |     */
  285|  1.50k|    while (v >= 2 * scale) {
  ------------------
  |  Branch (285:12): [True: 1.33k, False: 161]
  ------------------
  286|  1.33k|        v >>= 1;
  287|  1.33k|        r += scale;
  288|  1.33k|    }
  289|  3.05k|    for (i = scale / 2; i != 0; i /= 2) {
  ------------------
  |  Branch (289:25): [True: 2.89k, False: 161]
  ------------------
  290|  2.89k|        v = mul2(v, v);
  291|  2.89k|        if (v >= 2 * scale) {
  ------------------
  |  Branch (291:13): [True: 1.35k, False: 1.53k]
  ------------------
  292|  1.35k|            v >>= 1;
  293|  1.35k|            r += i;
  294|  1.35k|        }
  295|  2.89k|    }
  296|    161|    r = (r * (uint64_t)scale) / log_e;
  297|    161|    return r;
  298|    161|}
rsa_lib.c:mul2:
  239|  3.38k|{
  240|  3.38k|    return a * b / scale;
  241|  3.38k|}
rsa_lib.c:icbrt64:
  251|    161|{
  252|    161|    uint64_t r = 0;
  253|    161|    uint64_t b;
  254|    161|    int s;
  255|       |
  256|  3.70k|    for (s = 63; s >= 0; s -= 3) {
  ------------------
  |  Branch (256:18): [True: 3.54k, False: 161]
  ------------------
  257|  3.54k|        r <<= 1;
  258|  3.54k|        b = 3 * r * (r + 1) + 1;
  259|  3.54k|        if ((x >> s) >= b) {
  ------------------
  |  Branch (259:13): [True: 982, False: 2.56k]
  ------------------
  260|    982|            x -= b << s;
  261|    982|            r++;
  262|    982|        }
  263|  3.54k|    }
  264|    161|    return r * cbrt_scale;
  265|    161|}

ossl_rsa_multip_info_free_ex:
   16|  32.9k|{
   17|       |    /* free pp and pinfo only */
   18|  32.9k|    BN_clear_free(pinfo->pp);
   19|  32.9k|    OPENSSL_free(pinfo);
  ------------------
  |  |  107|  32.9k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  32.9k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  32.9k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   20|  32.9k|}
ossl_rsa_multip_info_free:
   23|  32.9k|{
   24|       |    /* free an RSA_PRIME_INFO structure */
   25|  32.9k|    BN_clear_free(pinfo->r);
   26|  32.9k|    BN_clear_free(pinfo->d);
   27|  32.9k|    BN_clear_free(pinfo->t);
   28|  32.9k|    ossl_rsa_multip_info_free_ex(pinfo);
   29|  32.9k|}
ossl_rsa_multip_calc_product:
   60|    616|{
   61|    616|    RSA_PRIME_INFO *pinfo;
   62|    616|    BIGNUM *p1 = NULL, *p2 = NULL;
   63|    616|    BN_CTX *ctx = NULL;
   64|    616|    int i, rv = 0, ex_primes;
   65|       |
   66|    616|    if ((ex_primes = sk_RSA_PRIME_INFO_num(rsa->prime_infos)) <= 0) {
  ------------------
  |  Branch (66:9): [True: 6, False: 610]
  ------------------
   67|       |        /* invalid */
   68|      6|        goto err;
   69|      6|    }
   70|       |
   71|    610|    if ((ctx = BN_CTX_new()) == NULL)
  ------------------
  |  Branch (71:9): [True: 0, False: 610]
  ------------------
   72|      0|        goto err;
   73|       |
   74|       |    /* calculate pinfo->pp = p * q for first 'extra' prime */
   75|    610|    p1 = rsa->p;
   76|    610|    p2 = rsa->q;
   77|       |
   78|  22.3k|    for (i = 0; i < ex_primes; i++) {
  ------------------
  |  Branch (78:17): [True: 21.7k, False: 610]
  ------------------
   79|  21.7k|        pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i);
   80|  21.7k|        if (pinfo->pp == NULL) {
  ------------------
  |  Branch (80:13): [True: 21.7k, False: 0]
  ------------------
   81|  21.7k|            pinfo->pp = BN_secure_new();
   82|  21.7k|            if (pinfo->pp == NULL)
  ------------------
  |  Branch (82:17): [True: 0, False: 21.7k]
  ------------------
   83|      0|                goto err;
   84|  21.7k|        }
   85|  21.7k|        if (!BN_mul(pinfo->pp, p1, p2, ctx))
  ------------------
  |  Branch (85:13): [True: 0, False: 21.7k]
  ------------------
   86|      0|            goto err;
   87|       |        /* save previous one */
   88|  21.7k|        p1 = pinfo->pp;
   89|  21.7k|        p2 = pinfo->r;
   90|  21.7k|    }
   91|       |
   92|    610|    rv = 1;
   93|    616| err:
   94|    616|    BN_CTX_free(ctx);
   95|    616|    return rv;
   96|    610|}
ossl_rsa_multip_cap:
   99|    283|{
  100|    283|    int cap = 5;
  101|       |
  102|    283|    if (bits < 1024)
  ------------------
  |  Branch (102:9): [True: 245, False: 38]
  ------------------
  103|    245|        cap = 2;
  104|     38|    else if (bits < 4096)
  ------------------
  |  Branch (104:14): [True: 24, False: 14]
  ------------------
  105|     24|        cap = 3;
  106|     14|    else if (bits < 8192)
  ------------------
  |  Branch (106:14): [True: 14, False: 0]
  ------------------
  107|     14|        cap = 4;
  108|       |
  109|    283|    if (cap > RSA_MAX_PRIME_NUM)
  ------------------
  |  |   16|    283|#define RSA_MAX_PRIME_NUM       5
  ------------------
  |  Branch (109:9): [True: 0, False: 283]
  ------------------
  110|      0|        cap = RSA_MAX_PRIME_NUM;
  ------------------
  |  |   16|      0|#define RSA_MAX_PRIME_NUM       5
  ------------------
  111|       |
  112|    283|    return cap;
  113|    283|}

RSA_get_default_method:
   85|  51.2k|{
   86|  51.2k|    return default_RSA_meth;
   87|  51.2k|}
RSA_PKCS1_OpenSSL:
   90|  3.64k|{
   91|  3.64k|    return &rsa_pkcs1_ossl_meth;
   92|  3.64k|}
rsa_ossl.c:rsa_ossl_init:
 1127|  51.2k|{
 1128|  51.2k|    rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE;
  ------------------
  |  |   65|  51.2k|#  define RSA_FLAG_CACHE_PUBLIC           0x0002
  ------------------
                  rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE;
  ------------------
  |  |   66|  51.2k|#  define RSA_FLAG_CACHE_PRIVATE          0x0004
  ------------------
 1129|  51.2k|    return 1;
 1130|  51.2k|}
rsa_ossl.c:rsa_ossl_finish:
 1133|  51.2k|{
 1134|  51.2k|#ifndef FIPS_MODULE
 1135|  51.2k|    int i;
 1136|  51.2k|    RSA_PRIME_INFO *pinfo;
 1137|       |
 1138|  84.1k|    for (i = 0; i < sk_RSA_PRIME_INFO_num(rsa->prime_infos); i++) {
  ------------------
  |  Branch (1138:17): [True: 32.9k, False: 51.2k]
  ------------------
 1139|  32.9k|        pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i);
 1140|  32.9k|        BN_MONT_CTX_free(pinfo->m);
 1141|  32.9k|    }
 1142|  51.2k|#endif
 1143|       |
 1144|  51.2k|    BN_MONT_CTX_free(rsa->_method_mod_n);
 1145|  51.2k|    BN_MONT_CTX_free(rsa->_method_mod_p);
 1146|  51.2k|    BN_MONT_CTX_free(rsa->_method_mod_q);
 1147|  51.2k|    return 1;
 1148|  51.2k|}

ossl_rsa_pss_params_30_set_defaults:
  305|  6.94k|{
  306|  6.94k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (306:9): [True: 0, False: 6.94k]
  ------------------
  307|      0|        return 0;
  308|  6.94k|    *rsa_pss_params = default_RSASSA_PSS_params;
  309|  6.94k|    return 1;
  310|  6.94k|}
ossl_rsa_pss_params_30_is_unrestricted:
  313|  3.83k|{
  314|  3.83k|    static RSA_PSS_PARAMS_30 pss_params_cmp = { 0, };
  315|       |
  316|  3.83k|    return rsa_pss_params == NULL
  ------------------
  |  Branch (316:12): [True: 0, False: 3.83k]
  ------------------
  317|  3.83k|        || memcmp(rsa_pss_params, &pss_params_cmp,
  ------------------
  |  Branch (317:12): [True: 365, False: 3.47k]
  ------------------
  318|  3.83k|                  sizeof(*rsa_pss_params)) == 0;
  319|  3.83k|}
ossl_rsa_pss_params_30_set_hashalg:
  330|  3.47k|{
  331|  3.47k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (331:9): [True: 0, False: 3.47k]
  ------------------
  332|      0|        return 0;
  333|  3.47k|    rsa_pss_params->hash_algorithm_nid = hashalg_nid;
  334|  3.47k|    return 1;
  335|  3.47k|}
ossl_rsa_pss_params_30_set_maskgenhashalg:
  339|  3.47k|{
  340|  3.47k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 3.47k]
  ------------------
  341|      0|        return 0;
  342|  3.47k|    rsa_pss_params->mask_gen.hash_algorithm_nid = maskgenhashalg_nid;
  343|  3.47k|    return 1;
  344|  3.47k|}
ossl_rsa_pss_params_30_set_saltlen:
  348|  3.47k|{
  349|  3.47k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (349:9): [True: 0, False: 3.47k]
  ------------------
  350|      0|        return 0;
  351|  3.47k|    rsa_pss_params->salt_len = saltlen;
  352|  3.47k|    return 1;
  353|  3.47k|}
ossl_rsa_pss_params_30_set_trailerfield:
  357|  3.47k|{
  358|  3.47k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (358:9): [True: 0, False: 3.47k]
  ------------------
  359|      0|        return 0;
  360|  3.47k|    rsa_pss_params->trailer_field = trailerfield;
  361|  3.47k|    return 1;
  362|  3.47k|}
ossl_rsa_pss_params_30_hashalg:
  365|  6.94k|{
  366|  6.94k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (366:9): [True: 3.47k, False: 3.47k]
  ------------------
  367|  3.47k|        return default_RSASSA_PSS_params.hash_algorithm_nid;
  368|  3.47k|    return rsa_pss_params->hash_algorithm_nid;
  369|  6.94k|}
ossl_rsa_pss_params_30_maskgenalg:
  372|  6.94k|{
  373|  6.94k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (373:9): [True: 3.47k, False: 3.47k]
  ------------------
  374|  3.47k|        return default_RSASSA_PSS_params.mask_gen.algorithm_nid;
  375|  3.47k|    return rsa_pss_params->mask_gen.algorithm_nid;
  376|  6.94k|}
ossl_rsa_pss_params_30_maskgenhashalg:
  379|  6.94k|{
  380|  6.94k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (380:9): [True: 3.47k, False: 3.47k]
  ------------------
  381|  3.47k|        return default_RSASSA_PSS_params.hash_algorithm_nid;
  382|  3.47k|    return rsa_pss_params->mask_gen.hash_algorithm_nid;
  383|  6.94k|}
ossl_rsa_pss_params_30_saltlen:
  386|  6.94k|{
  387|  6.94k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (387:9): [True: 2, False: 6.94k]
  ------------------
  388|      2|        return default_RSASSA_PSS_params.salt_len;
  389|  6.94k|    return rsa_pss_params->salt_len;
  390|  6.94k|}
ossl_rsa_pss_params_30_trailerfield:
  393|  3.47k|{
  394|  3.47k|    if (rsa_pss_params == NULL)
  ------------------
  |  Branch (394:9): [True: 2, False: 3.47k]
  ------------------
  395|      2|        return default_RSASSA_PSS_params.trailer_field;
  396|  3.47k|    return rsa_pss_params->trailer_field;
  397|  3.47k|}

ossl_rsa_oaeppss_nid2name:
   77|      2|{
   78|      2|    return nid2name(md, oaeppss_name_nid_map, OSSL_NELEM(oaeppss_name_nid_map));
  ------------------
  |  |   14|      2|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
   79|      2|}
ossl_rsa_mgf_nid2name:
   82|      1|{
   83|      1|    if (mgf == NID_mgf1)
  ------------------
  |  |  573|      1|#define NID_mgf1                911
  ------------------
  |  Branch (83:9): [True: 1, False: 0]
  ------------------
   84|      1|        return SN_mgf1;
  ------------------
  |  |  571|      1|#define SN_mgf1         "MGF1"
  ------------------
   85|      0|    return NULL;
   86|      1|}
rsa_schemes.c:nid2name:
   31|      2|{
   32|      2|    size_t i;
   33|       |
   34|      2|    for (i = 0; i < items_n; i++)
  ------------------
  |  Branch (34:17): [True: 2, False: 0]
  ------------------
   35|      2|        if (meth == (int)items[i].id)
  ------------------
  |  Branch (35:13): [True: 2, False: 0]
  ------------------
   36|      2|            return items[i].ptr;
   37|      0|    return NULL;
   38|      2|}

ossl_self_test_set_callback_new:
   37|      4|{
   38|      4|    SELF_TEST_CB *stcb;
   39|       |
   40|      4|    stcb = OPENSSL_zalloc(sizeof(*stcb));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   41|      4|    return stcb;
   42|      4|}
ossl_self_test_set_callback_free:
   45|      2|{
   46|      2|    OPENSSL_free(stcb);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   47|      2|}

ossl_sha3_reset:
   16|      4|{
   17|      4|    memset(ctx->A, 0, sizeof(ctx->A));
   18|      4|    ctx->bufsz = 0;
   19|      4|}
ossl_sha3_init:
   22|      2|{
   23|      2|    size_t bsz = SHA3_BLOCKSIZE(bitlen);
  ------------------
  |  |   21|      2|# define SHA3_BLOCKSIZE(bitlen) (KECCAK1600_WIDTH - bitlen * 2) / 8
  |  |  ------------------
  |  |  |  |   18|      2|# define KECCAK1600_WIDTH 1600
  |  |  ------------------
  ------------------
   24|       |
   25|      2|    if (bsz <= sizeof(ctx->buf)) {
  ------------------
  |  Branch (25:9): [True: 2, False: 0]
  ------------------
   26|      2|        ossl_sha3_reset(ctx);
   27|      2|        ctx->block_size = bsz;
   28|      2|        ctx->md_size = bitlen / 8;
   29|      2|        ctx->pad = pad;
   30|      2|        return 1;
   31|      2|    }
   32|       |
   33|      0|    return 0;
   34|      2|}
ossl_sha3_final:
   88|      2|{
   89|      2|    size_t bsz = ctx->block_size;
   90|      2|    size_t num = ctx->bufsz;
   91|       |
   92|      2|    if (ctx->md_size == 0)
  ------------------
  |  Branch (92:9): [True: 0, False: 2]
  ------------------
   93|      0|        return 1;
   94|       |
   95|       |    /*
   96|       |     * Pad the data with 10*1. Note that |num| can be |bsz - 1|
   97|       |     * in which case both byte operations below are performed on
   98|       |     * same byte...
   99|       |     */
  100|      2|    memset(ctx->buf + num, 0, bsz - num);
  101|      2|    ctx->buf[num] = ctx->pad;
  102|      2|    ctx->buf[bsz - 1] |= 0x80;
  103|       |
  104|      2|    (void)SHA3_absorb(ctx->A, ctx->buf, bsz, bsz);
  105|       |
  106|      2|    SHA3_squeeze(ctx->A, md, ctx->md_size, bsz);
  107|       |
  108|      2|    return 1;
  109|      2|}

SHA512_Init:
  133|      4|{
  134|      4|    c->h[0] = U64(0x6a09e667f3bcc908);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  135|      4|    c->h[1] = U64(0xbb67ae8584caa73b);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  136|      4|    c->h[2] = U64(0x3c6ef372fe94f82b);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  137|      4|    c->h[3] = U64(0xa54ff53a5f1d36f1);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  138|      4|    c->h[4] = U64(0x510e527fade682d1);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  139|      4|    c->h[5] = U64(0x9b05688c2b3e6c1f);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  140|      4|    c->h[6] = U64(0x1f83d9abfb41bd6b);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  141|      4|    c->h[7] = U64(0x5be0cd19137e2179);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  142|       |
  143|      4|    c->Nl = 0;
  144|      4|    c->Nh = 0;
  145|      4|    c->num = 0;
  146|      4|    c->md_len = SHA512_DIGEST_LENGTH;
  ------------------
  |  |   88|      4|# define SHA512_DIGEST_LENGTH    64
  ------------------
  147|      4|    return 1;
  148|      4|}
SHA512_Final:
  156|      4|{
  157|      4|    unsigned char *p = (unsigned char *)c->u.p;
  158|      4|    size_t n = c->num;
  159|       |
  160|      4|    p[n] = 0x80;                /* There always is a room for one */
  161|      4|    n++;
  162|      4|    if (n > (sizeof(c->u) - 16)) {
  ------------------
  |  Branch (162:9): [True: 0, False: 4]
  ------------------
  163|      0|        memset(p + n, 0, sizeof(c->u) - n);
  164|      0|        n = 0;
  165|      0|        sha512_block_data_order(c, p, 1);
  166|      0|    }
  167|       |
  168|      4|    memset(p + n, 0, sizeof(c->u) - 16 - n);
  169|       |#ifdef  B_ENDIAN
  170|       |    c->u.d[SHA_LBLOCK - 2] = c->Nh;
  171|       |    c->u.d[SHA_LBLOCK - 1] = c->Nl;
  172|       |#else
  173|      4|    p[sizeof(c->u) - 1] = (unsigned char)(c->Nl);
  174|      4|    p[sizeof(c->u) - 2] = (unsigned char)(c->Nl >> 8);
  175|      4|    p[sizeof(c->u) - 3] = (unsigned char)(c->Nl >> 16);
  176|      4|    p[sizeof(c->u) - 4] = (unsigned char)(c->Nl >> 24);
  177|      4|    p[sizeof(c->u) - 5] = (unsigned char)(c->Nl >> 32);
  178|      4|    p[sizeof(c->u) - 6] = (unsigned char)(c->Nl >> 40);
  179|      4|    p[sizeof(c->u) - 7] = (unsigned char)(c->Nl >> 48);
  180|      4|    p[sizeof(c->u) - 8] = (unsigned char)(c->Nl >> 56);
  181|      4|    p[sizeof(c->u) - 9] = (unsigned char)(c->Nh);
  182|      4|    p[sizeof(c->u) - 10] = (unsigned char)(c->Nh >> 8);
  183|      4|    p[sizeof(c->u) - 11] = (unsigned char)(c->Nh >> 16);
  184|      4|    p[sizeof(c->u) - 12] = (unsigned char)(c->Nh >> 24);
  185|      4|    p[sizeof(c->u) - 13] = (unsigned char)(c->Nh >> 32);
  186|      4|    p[sizeof(c->u) - 14] = (unsigned char)(c->Nh >> 40);
  187|      4|    p[sizeof(c->u) - 15] = (unsigned char)(c->Nh >> 48);
  188|      4|    p[sizeof(c->u) - 16] = (unsigned char)(c->Nh >> 56);
  189|      4|#endif
  190|       |
  191|      4|    sha512_block_data_order(c, p, 1);
  192|       |
  193|      4|    if (md == 0)
  ------------------
  |  Branch (193:9): [True: 0, False: 4]
  ------------------
  194|      0|        return 0;
  195|       |
  196|      4|    switch (c->md_len) {
  197|       |    /* Let compiler decide if it's appropriate to unroll... */
  198|      0|    case SHA224_DIGEST_LENGTH:
  ------------------
  |  |   85|      0|# define SHA224_DIGEST_LENGTH    28
  ------------------
  |  Branch (198:5): [True: 0, False: 4]
  ------------------
  199|      0|        for (n = 0; n < SHA224_DIGEST_LENGTH / 8; n++) {
  ------------------
  |  |   85|      0|# define SHA224_DIGEST_LENGTH    28
  ------------------
  |  Branch (199:21): [True: 0, False: 0]
  ------------------
  200|      0|            SHA_LONG64 t = c->h[n];
  ------------------
  |  |  107|      0|#   define SHA_LONG64 unsigned long long
  ------------------
  201|       |
  202|      0|            *(md++) = (unsigned char)(t >> 56);
  203|      0|            *(md++) = (unsigned char)(t >> 48);
  204|      0|            *(md++) = (unsigned char)(t >> 40);
  205|      0|            *(md++) = (unsigned char)(t >> 32);
  206|      0|            *(md++) = (unsigned char)(t >> 24);
  207|      0|            *(md++) = (unsigned char)(t >> 16);
  208|      0|            *(md++) = (unsigned char)(t >> 8);
  209|      0|            *(md++) = (unsigned char)(t);
  210|      0|        }
  211|       |        /*
  212|       |         * For 224 bits, there are four bytes left over that have to be
  213|       |         * processed separately.
  214|       |         */
  215|      0|        {
  216|      0|            SHA_LONG64 t = c->h[SHA224_DIGEST_LENGTH / 8];
  ------------------
  |  |  107|      0|#   define SHA_LONG64 unsigned long long
  ------------------
                          SHA_LONG64 t = c->h[SHA224_DIGEST_LENGTH / 8];
  ------------------
  |  |   85|      0|# define SHA224_DIGEST_LENGTH    28
  ------------------
  217|       |
  218|      0|            *(md++) = (unsigned char)(t >> 56);
  219|      0|            *(md++) = (unsigned char)(t >> 48);
  220|      0|            *(md++) = (unsigned char)(t >> 40);
  221|      0|            *(md++) = (unsigned char)(t >> 32);
  222|      0|        }
  223|      0|        break;
  224|      0|    case SHA256_DIGEST_LENGTH:
  ------------------
  |  |   86|      0|# define SHA256_DIGEST_LENGTH    32
  ------------------
  |  Branch (224:5): [True: 0, False: 4]
  ------------------
  225|      0|        for (n = 0; n < SHA256_DIGEST_LENGTH / 8; n++) {
  ------------------
  |  |   86|      0|# define SHA256_DIGEST_LENGTH    32
  ------------------
  |  Branch (225:21): [True: 0, False: 0]
  ------------------
  226|      0|            SHA_LONG64 t = c->h[n];
  ------------------
  |  |  107|      0|#   define SHA_LONG64 unsigned long long
  ------------------
  227|       |
  228|      0|            *(md++) = (unsigned char)(t >> 56);
  229|      0|            *(md++) = (unsigned char)(t >> 48);
  230|      0|            *(md++) = (unsigned char)(t >> 40);
  231|      0|            *(md++) = (unsigned char)(t >> 32);
  232|      0|            *(md++) = (unsigned char)(t >> 24);
  233|      0|            *(md++) = (unsigned char)(t >> 16);
  234|      0|            *(md++) = (unsigned char)(t >> 8);
  235|      0|            *(md++) = (unsigned char)(t);
  236|      0|        }
  237|      0|        break;
  238|      0|    case SHA384_DIGEST_LENGTH:
  ------------------
  |  |   87|      0|# define SHA384_DIGEST_LENGTH    48
  ------------------
  |  Branch (238:5): [True: 0, False: 4]
  ------------------
  239|      0|        for (n = 0; n < SHA384_DIGEST_LENGTH / 8; n++) {
  ------------------
  |  |   87|      0|# define SHA384_DIGEST_LENGTH    48
  ------------------
  |  Branch (239:21): [True: 0, False: 0]
  ------------------
  240|      0|            SHA_LONG64 t = c->h[n];
  ------------------
  |  |  107|      0|#   define SHA_LONG64 unsigned long long
  ------------------
  241|       |
  242|      0|            *(md++) = (unsigned char)(t >> 56);
  243|      0|            *(md++) = (unsigned char)(t >> 48);
  244|      0|            *(md++) = (unsigned char)(t >> 40);
  245|      0|            *(md++) = (unsigned char)(t >> 32);
  246|      0|            *(md++) = (unsigned char)(t >> 24);
  247|      0|            *(md++) = (unsigned char)(t >> 16);
  248|      0|            *(md++) = (unsigned char)(t >> 8);
  249|      0|            *(md++) = (unsigned char)(t);
  250|      0|        }
  251|      0|        break;
  252|      4|    case SHA512_DIGEST_LENGTH:
  ------------------
  |  |   88|      4|# define SHA512_DIGEST_LENGTH    64
  ------------------
  |  Branch (252:5): [True: 4, False: 0]
  ------------------
  253|     36|        for (n = 0; n < SHA512_DIGEST_LENGTH / 8; n++) {
  ------------------
  |  |   88|     36|# define SHA512_DIGEST_LENGTH    64
  ------------------
  |  Branch (253:21): [True: 32, False: 4]
  ------------------
  254|     32|            SHA_LONG64 t = c->h[n];
  ------------------
  |  |  107|     32|#   define SHA_LONG64 unsigned long long
  ------------------
  255|       |
  256|     32|            *(md++) = (unsigned char)(t >> 56);
  257|     32|            *(md++) = (unsigned char)(t >> 48);
  258|     32|            *(md++) = (unsigned char)(t >> 40);
  259|     32|            *(md++) = (unsigned char)(t >> 32);
  260|     32|            *(md++) = (unsigned char)(t >> 24);
  261|     32|            *(md++) = (unsigned char)(t >> 16);
  262|     32|            *(md++) = (unsigned char)(t >> 8);
  263|     32|            *(md++) = (unsigned char)(t);
  264|     32|        }
  265|      4|        break;
  266|       |    /* ... as well as make sure md_len is not abused. */
  267|      0|    default:
  ------------------
  |  Branch (267:5): [True: 0, False: 4]
  ------------------
  268|      0|        return 0;
  269|      4|    }
  270|       |
  271|      4|    return 1;
  272|      4|}
SHA512_Update:
  280|      4|{
  281|      4|    SHA_LONG64 l;
  ------------------
  |  |  107|      4|#   define SHA_LONG64 unsigned long long
  ------------------
  282|      4|    unsigned char *p = c->u.p;
  283|      4|    const unsigned char *data = (const unsigned char *)_data;
  284|       |
  285|      4|    if (len == 0)
  ------------------
  |  Branch (285:9): [True: 0, False: 4]
  ------------------
  286|      0|        return 1;
  287|       |
  288|      4|    l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff);
  ------------------
  |  |   75|      4|# define U64(C)     C##ULL
  ------------------
  289|      4|    if (l < c->Nl)
  ------------------
  |  Branch (289:9): [True: 0, False: 4]
  ------------------
  290|      0|        c->Nh++;
  291|      4|    if (sizeof(len) >= 8)
  ------------------
  |  Branch (291:9): [Folded - Ignored]
  ------------------
  292|      4|        c->Nh += (((SHA_LONG64) len) >> 61);
  293|      4|    c->Nl = l;
  294|       |
  295|      4|    if (c->num != 0) {
  ------------------
  |  Branch (295:9): [True: 0, False: 4]
  ------------------
  296|      0|        size_t n = sizeof(c->u) - c->num;
  297|       |
  298|      0|        if (len < n) {
  ------------------
  |  Branch (298:13): [True: 0, False: 0]
  ------------------
  299|      0|            memcpy(p + c->num, data, len), c->num += (unsigned int)len;
  300|      0|            return 1;
  301|      0|        } else {
  302|      0|            memcpy(p + c->num, data, n), c->num = 0;
  303|      0|            len -= n, data += n;
  304|      0|            sha512_block_data_order(c, p, 1);
  305|      0|        }
  306|      0|    }
  307|       |
  308|      4|    if (len >= sizeof(c->u)) {
  ------------------
  |  Branch (308:9): [True: 0, False: 4]
  ------------------
  309|       |#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
  310|       |        if ((size_t)data % sizeof(c->u.d[0]) != 0)
  311|       |            while (len >= sizeof(c->u))
  312|       |                memcpy(p, data, sizeof(c->u)),
  313|       |                sha512_block_data_order(c, p, 1),
  314|       |                len -= sizeof(c->u), data += sizeof(c->u);
  315|       |        else
  316|       |#endif
  317|      0|            sha512_block_data_order(c, data, len / sizeof(c->u)),
  318|      0|            data += len, len %= sizeof(c->u), data -= len;
  319|      0|    }
  320|       |
  321|      4|    if (len != 0)
  ------------------
  |  Branch (321:9): [True: 4, False: 0]
  ------------------
  322|      4|        memcpy(p, data, len), c->num = (int)len;
  323|       |
  324|      4|    return 1;
  325|      4|}

SHA1_Init:
   55|  7.33k|{
   56|  7.33k|    memset(c, 0, sizeof(*c));
   57|  7.33k|    c->h0 = INIT_DATA_h0;
  ------------------
  |  |   48|  7.33k|#define INIT_DATA_h0 0x67452301UL
  ------------------
   58|  7.33k|    c->h1 = INIT_DATA_h1;
  ------------------
  |  |   49|  7.33k|#define INIT_DATA_h1 0xefcdab89UL
  ------------------
   59|  7.33k|    c->h2 = INIT_DATA_h2;
  ------------------
  |  |   50|  7.33k|#define INIT_DATA_h2 0x98badcfeUL
  ------------------
   60|  7.33k|    c->h3 = INIT_DATA_h3;
  ------------------
  |  |   51|  7.33k|#define INIT_DATA_h3 0x10325476UL
  ------------------
   61|  7.33k|    c->h4 = INIT_DATA_h4;
  ------------------
  |  |   52|  7.33k|#define INIT_DATA_h4 0xc3d2e1f0UL
  ------------------
   62|  7.33k|    return 1;
   63|  7.33k|}

EVP_sm3:
   29|      2|{
   30|      2|    return &sm3_md;
   31|      2|}

ossl_sa_new:
   59|     16|{
   60|     16|    OPENSSL_SA *res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |   99|     16|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|       |
   62|     16|    return res;
   63|     16|}
ossl_sa_free:
  111|      8|{
  112|      8|    if (sa != NULL) {
  ------------------
  |  Branch (112:9): [True: 8, False: 0]
  ------------------
  113|      8|        sa_doall(sa, &sa_free_node, NULL, NULL);
  114|      8|        OPENSSL_free(sa);
  ------------------
  |  |  107|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  115|      8|    }
  116|      8|}
ossl_sa_doall:
  135|      8|{
  136|      8|    struct trampoline_st tramp;
  137|       |
  138|      8|    tramp.func = leaf;
  139|      8|    if (sa != NULL)
  ------------------
  |  Branch (139:9): [True: 8, False: 0]
  ------------------
  140|      8|        sa_doall(sa, NULL, &trampoline, &tramp);
  141|      8|}
ossl_sa_doall_arg:
  146|  6.74k|{
  147|  6.74k|    if (sa != NULL)
  ------------------
  |  Branch (147:9): [True: 6.74k, False: 0]
  ------------------
  148|  6.74k|        sa_doall(sa, NULL, leaf, arg);
  149|  6.74k|}
ossl_sa_get:
  157|  7.76k|{
  158|  7.76k|    int level;
  159|  7.76k|    void **p, *r = NULL;
  160|       |
  161|  7.76k|    if (sa == NULL || sa->nelem == 0)
  ------------------
  |  Branch (161:9): [True: 0, False: 7.76k]
  |  Branch (161:23): [True: 6, False: 7.75k]
  ------------------
  162|      6|        return NULL;
  163|       |
  164|  7.75k|    if (n <= sa->top) {
  ------------------
  |  Branch (164:9): [True: 7.68k, False: 72]
  ------------------
  165|  7.68k|        p = sa->nodes;
  166|  30.1k|        for (level = sa->levels - 1; p != NULL && level > 0; level--)
  ------------------
  |  Branch (166:38): [True: 30.0k, False: 49]
  |  Branch (166:51): [True: 22.4k, False: 7.63k]
  ------------------
  167|  22.4k|            p = (void **)p[(n >> (OPENSSL_SA_BLOCK_BITS * level))
  ------------------
  |  |   34|  22.4k|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
  168|  22.4k|                           & SA_BLOCK_MASK];
  ------------------
  |  |   46|  22.4k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|  22.4k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  22.4k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  169|  7.68k|        r = p == NULL ? NULL : p[n & SA_BLOCK_MASK];
  ------------------
  |  |   46|  7.63k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|  7.63k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  7.63k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (169:13): [True: 49, False: 7.63k]
  ------------------
  170|  7.68k|    }
  171|  7.75k|    return r;
  172|  7.76k|}
ossl_sa_set:
  180|    148|{
  181|    148|    int i, level = 1;
  182|    148|    ossl_uintmax_t n = posn;
  183|    148|    void **p;
  184|       |
  185|    148|    if (sa == NULL)
  ------------------
  |  Branch (185:9): [True: 0, False: 148]
  ------------------
  186|      0|        return 0;
  187|       |
  188|    500|    for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++)
  ------------------
  |  |   47|    500|#define SA_BLOCK_MAX_LEVELS     (((int)sizeof(ossl_uintmax_t) * 8 \
  |  |   48|    500|                                  + OPENSSL_SA_BLOCK_BITS - 1) \
  |  |  ------------------
  |  |  |  |   34|    500|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  |  |   49|    500|                                 / OPENSSL_SA_BLOCK_BITS)
  |  |  ------------------
  |  |  |  |   34|    500|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  ------------------
  |  Branch (188:21): [True: 500, False: 0]
  ------------------
  189|    500|        if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0)
  ------------------
  |  |   34|    500|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
  |  Branch (189:13): [True: 148, False: 352]
  ------------------
  190|    148|            break;
  191|       |
  192|    156|    for (;sa->levels < level; sa->levels++) {
  ------------------
  |  Branch (192:11): [True: 8, False: 148]
  ------------------
  193|      8|        p = alloc_node();
  194|      8|        if (p == NULL)
  ------------------
  |  Branch (194:13): [True: 0, False: 8]
  ------------------
  195|      0|            return 0;
  196|      8|        p[0] = sa->nodes;
  197|      8|        sa->nodes = p;
  198|      8|    }
  199|    148|    if (sa->top < posn)
  ------------------
  |  Branch (199:9): [True: 39, False: 109]
  ------------------
  200|     39|        sa->top = posn;
  201|       |
  202|    148|    p = sa->nodes;
  203|    500|    for (level = sa->levels - 1; level > 0; level--) {
  ------------------
  |  Branch (203:34): [True: 352, False: 148]
  ------------------
  204|    352|        i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK;
  ------------------
  |  |   34|    352|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
                      i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK;
  ------------------
  |  |   46|    352|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|    352|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|    352|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  205|    352|        if (p[i] == NULL && (p[i] = alloc_node()) == NULL)
  ------------------
  |  Branch (205:13): [True: 110, False: 242]
  |  Branch (205:29): [True: 0, False: 110]
  ------------------
  206|      0|            return 0;
  207|    352|        p = p[i];
  208|    352|    }
  209|    148|    p += posn & SA_BLOCK_MASK;
  ------------------
  |  |   46|    148|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|    148|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|    148|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|    148|    if (val == NULL && *p != NULL)
  ------------------
  |  Branch (210:9): [True: 74, False: 74]
  |  Branch (210:24): [True: 74, False: 0]
  ------------------
  211|     74|        sa->nelem--;
  212|     74|    else if (val != NULL && *p == NULL)
  ------------------
  |  Branch (212:14): [True: 74, False: 0]
  |  Branch (212:29): [True: 74, False: 0]
  ------------------
  213|     74|        sa->nelem++;
  214|    148|    *p = val;
  215|    148|    return 1;
  216|    148|}
sparse_array.c:sa_doall:
   67|  6.76k|{
   68|  6.76k|    int i[SA_BLOCK_MAX_LEVELS];
   69|  6.76k|    void *nodes[SA_BLOCK_MAX_LEVELS];
   70|  6.76k|    ossl_uintmax_t idx = 0;
   71|  6.76k|    int l = 0;
   72|       |
   73|  6.76k|    i[0] = 0;
   74|  6.76k|    nodes[0] = sa->nodes;
   75|   905k|    while (l >= 0) {
  ------------------
  |  Branch (75:12): [True: 899k, False: 6.76k]
  ------------------
   76|   899k|        const int n = i[l];
   77|   899k|        void ** const p = nodes[l];
   78|       |
   79|   899k|        if (n >= SA_BLOCK_MAX) {
  ------------------
  |  |   45|   899k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  ------------------
  |  |  |  |   34|   899k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  ------------------
  |  Branch (79:13): [True: 52.8k, False: 846k]
  ------------------
   80|  52.8k|            if (p != NULL && node != NULL)
  ------------------
  |  Branch (80:17): [True: 52.8k, False: 18]
  |  Branch (80:30): [True: 118, False: 52.7k]
  ------------------
   81|    118|                (*node)(p);
   82|  52.8k|            l--;
   83|  52.8k|            idx >>= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|  52.8k|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   84|   846k|        } else {
   85|   846k|            i[l] = n + 1;
   86|   846k|            if (p != NULL && p[n] != NULL) {
  ------------------
  |  Branch (86:17): [True: 846k, False: 288]
  |  Branch (86:30): [True: 130k, False: 716k]
  ------------------
   87|   130k|                idx = (idx & ~SA_BLOCK_MASK) | n;
  ------------------
  |  |   46|   130k|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|   130k|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|   130k|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   88|   130k|                if (l < sa->levels - 1) {
  ------------------
  |  Branch (88:21): [True: 46.1k, False: 83.9k]
  ------------------
   89|  46.1k|                    i[++l] = 0;
   90|  46.1k|                    nodes[l] = p[n];
   91|  46.1k|                    idx <<= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|  46.1k|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   92|  83.9k|                } else if (leaf != NULL) {
  ------------------
  |  Branch (92:28): [True: 83.9k, False: 0]
  ------------------
   93|  83.9k|                    (*leaf)(idx, p[n], arg);
   94|  83.9k|                }
   95|   130k|            }
   96|   846k|        }
   97|   899k|    }
   98|  6.76k|}
sparse_array.c:sa_free_node:
  101|    118|{
  102|    118|    OPENSSL_free(p);
  ------------------
  |  |  107|    118|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    118|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    118|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  103|    118|}
sparse_array.c:alloc_node:
  175|    118|{
  176|    118|    return OPENSSL_zalloc(SA_BLOCK_MAX * sizeof(void *));
  ------------------
  |  |   99|    118|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    118|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    118|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  177|    118|}

OPENSSL_sk_set_cmp_func:
   37|  1.92k|{
   38|  1.92k|    OPENSSL_sk_compfunc old = sk->comp;
   39|       |
   40|  1.92k|    if (sk->comp != c)
  ------------------
  |  Branch (40:9): [True: 1.92k, False: 0]
  ------------------
   41|  1.92k|        sk->sorted = 0;
   42|  1.92k|    sk->comp = c;
   43|       |
   44|  1.92k|    return old;
   45|  1.92k|}
OPENSSL_sk_dup:
   48|  6.74k|{
   49|  6.74k|    OPENSSL_STACK *ret;
   50|       |
   51|  6.74k|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   97|  6.74k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  6.74k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  6.74k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (51:9): [True: 0, False: 6.74k]
  ------------------
   52|      0|        goto err;
   53|       |
   54|  6.74k|    if (sk == NULL) {
  ------------------
  |  Branch (54:9): [True: 0, False: 6.74k]
  ------------------
   55|      0|        ret->num = 0;
   56|      0|        ret->sorted = 0;
   57|      0|        ret->comp = NULL;
   58|  6.74k|    } else {
   59|       |        /* direct structure assignment */
   60|  6.74k|        *ret = *sk;
   61|  6.74k|    }
   62|       |
   63|  6.74k|    if (sk == NULL || sk->num == 0) {
  ------------------
  |  Branch (63:9): [True: 0, False: 6.74k]
  |  Branch (63:23): [True: 0, False: 6.74k]
  ------------------
   64|       |        /* postpone |ret->data| allocation */
   65|      0|        ret->data = NULL;
   66|      0|        ret->num_alloc = 0;
   67|      0|        return ret;
   68|      0|    }
   69|       |
   70|       |    /* duplicate |sk->data| content */
   71|  6.74k|    ret->data = OPENSSL_malloc(sizeof(*ret->data) * sk->num_alloc);
  ------------------
  |  |   97|  6.74k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  6.74k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  6.74k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   72|  6.74k|    if (ret->data == NULL)
  ------------------
  |  Branch (72:9): [True: 0, False: 6.74k]
  ------------------
   73|      0|        goto err;
   74|  6.74k|    memcpy(ret->data, sk->data, sizeof(void *) * sk->num);
   75|  6.74k|    return ret;
   76|       |
   77|      0| err:
   78|      0|    OPENSSL_sk_free(ret);
   79|      0|    return NULL;
   80|  6.74k|}
OPENSSL_sk_deep_copy:
   85|  88.3k|{
   86|  88.3k|    OPENSSL_STACK *ret;
   87|  88.3k|    int i;
   88|       |
   89|  88.3k|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   97|  88.3k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  88.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  88.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (89:9): [True: 0, False: 88.3k]
  ------------------
   90|      0|        goto err;
   91|       |
   92|  88.3k|    if (sk == NULL) {
  ------------------
  |  Branch (92:9): [True: 3, False: 88.3k]
  ------------------
   93|      3|        ret->num = 0;
   94|      3|        ret->sorted = 0;
   95|      3|        ret->comp = NULL;
   96|  88.3k|    } else {
   97|       |        /* direct structure assignment */
   98|  88.3k|        *ret = *sk;
   99|  88.3k|    }
  100|       |
  101|  88.3k|    if (sk == NULL || sk->num == 0) {
  ------------------
  |  Branch (101:9): [True: 3, False: 88.3k]
  |  Branch (101:23): [True: 0, False: 88.3k]
  ------------------
  102|       |        /* postpone |ret| data allocation */
  103|      3|        ret->data = NULL;
  104|      3|        ret->num_alloc = 0;
  105|      3|        return ret;
  106|      3|    }
  107|       |
  108|  88.3k|    ret->num_alloc = sk->num > min_nodes ? sk->num : min_nodes;
  ------------------
  |  Branch (108:22): [True: 47.9k, False: 40.4k]
  ------------------
  109|  88.3k|    ret->data = OPENSSL_zalloc(sizeof(*ret->data) * ret->num_alloc);
  ------------------
  |  |   99|  88.3k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  88.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  88.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  110|  88.3k|    if (ret->data == NULL)
  ------------------
  |  Branch (110:9): [True: 0, False: 88.3k]
  ------------------
  111|      0|        goto err;
  112|       |
  113|   790k|    for (i = 0; i < ret->num; ++i) {
  ------------------
  |  Branch (113:17): [True: 701k, False: 88.3k]
  ------------------
  114|   701k|        if (sk->data[i] == NULL)
  ------------------
  |  Branch (114:13): [True: 0, False: 701k]
  ------------------
  115|      0|            continue;
  116|   701k|        if ((ret->data[i] = copy_func(sk->data[i])) == NULL) {
  ------------------
  |  Branch (116:13): [True: 0, False: 701k]
  ------------------
  117|      0|            while (--i >= 0)
  ------------------
  |  Branch (117:20): [True: 0, False: 0]
  ------------------
  118|      0|                if (ret->data[i] != NULL)
  ------------------
  |  Branch (118:21): [True: 0, False: 0]
  ------------------
  119|      0|                    free_func((void *)ret->data[i]);
  120|      0|            goto err;
  121|      0|        }
  122|   701k|    }
  123|  88.3k|    return ret;
  124|       |
  125|      0| err:
  126|      0|    OPENSSL_sk_free(ret);
  127|      0|    return NULL;
  128|  88.3k|}
OPENSSL_sk_new_null:
  131|  2.92M|{
  132|  2.92M|    return OPENSSL_sk_new_reserve(NULL, 0);
  133|  2.92M|}
OPENSSL_sk_new:
  136|    223|{
  137|    223|    return OPENSSL_sk_new_reserve(c, 0);
  138|    223|}
OPENSSL_sk_new_reserve:
  227|  2.92M|{
  228|  2.92M|    OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK));
  ------------------
  |  |   99|  2.92M|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.92M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.92M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  229|       |
  230|  2.92M|    if (st == NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 2.92M]
  ------------------
  231|      0|        return NULL;
  232|       |
  233|  2.92M|    st->comp = c;
  234|       |
  235|  2.92M|    if (n <= 0)
  ------------------
  |  Branch (235:9): [True: 2.92M, False: 0]
  ------------------
  236|  2.92M|        return st;
  237|       |
  238|      0|    if (!sk_reserve(st, n, 1)) {
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  ------------------
  239|      0|        OPENSSL_sk_free(st);
  240|      0|        return NULL;
  241|      0|    }
  242|       |
  243|      0|    return st;
  244|      0|}
OPENSSL_sk_insert:
  259|  6.04M|{
  260|  6.04M|    if (st == NULL) {
  ------------------
  |  Branch (260:9): [True: 0, False: 6.04M]
  ------------------
  261|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  262|      0|        return 0;
  263|      0|    }
  264|  6.04M|    if (st->num == max_nodes) {
  ------------------
  |  Branch (264:9): [True: 0, False: 6.04M]
  ------------------
  265|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  266|      0|        return 0;
  267|      0|    }
  268|       |
  269|  6.04M|    if (!sk_reserve(st, 1, 0))
  ------------------
  |  Branch (269:9): [True: 0, False: 6.04M]
  ------------------
  270|      0|        return 0;
  271|       |
  272|  6.04M|    if ((loc >= st->num) || (loc < 0)) {
  ------------------
  |  Branch (272:9): [True: 6.04M, False: 0]
  |  Branch (272:29): [True: 0, False: 0]
  ------------------
  273|  6.04M|        st->data[st->num] = data;
  274|  6.04M|    } else {
  275|      0|        memmove(&st->data[loc + 1], &st->data[loc],
  276|      0|                sizeof(st->data[0]) * (st->num - loc));
  277|      0|        st->data[loc] = data;
  278|      0|    }
  279|  6.04M|    st->num++;
  280|  6.04M|    st->sorted = 0;
  281|  6.04M|    return st->num;
  282|  6.04M|}
OPENSSL_sk_delete:
  310|      2|{
  311|      2|    if (st == NULL || loc < 0 || loc >= st->num)
  ------------------
  |  Branch (311:9): [True: 0, False: 2]
  |  Branch (311:23): [True: 0, False: 2]
  |  Branch (311:34): [True: 0, False: 2]
  ------------------
  312|      0|        return NULL;
  313|       |
  314|      2|    return internal_delete(st, loc);
  315|      2|}
OPENSSL_sk_find:
  383|      6|{
  384|      6|    return internal_find(st, data, OSSL_BSEARCH_FIRST_VALUE_ON_MATCH, NULL);
  ------------------
  |  |  150|      6|# define OSSL_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
  ------------------
  385|      6|}
OPENSSL_sk_push:
  398|  6.04M|{
  399|  6.04M|    if (st == NULL)
  ------------------
  |  Branch (399:9): [True: 0, False: 6.04M]
  ------------------
  400|      0|        return -1;
  401|  6.04M|    return OPENSSL_sk_insert(st, data, st->num);
  402|  6.04M|}
OPENSSL_sk_pop_free:
  432|  2.16M|{
  433|  2.16M|    int i;
  434|       |
  435|  2.16M|    if (st == NULL)
  ------------------
  |  Branch (435:9): [True: 298k, False: 1.86M]
  ------------------
  436|   298k|        return;
  437|  6.16M|    for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (437:17): [True: 4.29M, False: 1.86M]
  ------------------
  438|  4.29M|        if (st->data[i] != NULL)
  ------------------
  |  Branch (438:13): [True: 4.29M, False: 833]
  ------------------
  439|  4.29M|            func((char *)st->data[i]);
  440|  1.86M|    OPENSSL_sk_free(st);
  441|  1.86M|}
OPENSSL_sk_free:
  444|  13.0M|{
  445|  13.0M|    if (st == NULL)
  ------------------
  |  Branch (445:9): [True: 9.99M, False: 3.02M]
  ------------------
  446|  9.99M|        return;
  447|  3.02M|    OPENSSL_free(st->data);
  ------------------
  |  |  107|  3.02M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.02M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.02M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  448|  3.02M|    OPENSSL_free(st);
  ------------------
  |  |  107|  3.02M|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.02M|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.02M|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  449|  3.02M|}
OPENSSL_sk_num:
  452|  35.1M|{
  453|  35.1M|    return st == NULL ? -1 : st->num;
  ------------------
  |  Branch (453:12): [True: 19.2M, False: 15.9M]
  ------------------
  454|  35.1M|}
OPENSSL_sk_value:
  457|  12.9M|{
  458|  12.9M|    if (st == NULL || i < 0 || i >= st->num)
  ------------------
  |  Branch (458:9): [True: 0, False: 12.9M]
  |  Branch (458:23): [True: 0, False: 12.9M]
  |  Branch (458:32): [True: 0, False: 12.9M]
  ------------------
  459|      0|        return NULL;
  460|  12.9M|    return (void *)st->data[i];
  461|  12.9M|}
OPENSSL_sk_set:
  464|   239k|{
  465|   239k|    if (st == NULL) {
  ------------------
  |  Branch (465:9): [True: 0, False: 239k]
  ------------------
  466|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  467|      0|        return NULL;
  468|      0|    }
  469|   239k|    if (i < 0 || i >= st->num) {
  ------------------
  |  Branch (469:9): [True: 0, False: 239k]
  |  Branch (469:18): [True: 0, False: 239k]
  ------------------
  470|      0|        ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT,
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT,
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                      ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT,
  ------------------
  |  |  357|      0|# define ERR_R_PASSED_INVALID_ARGUMENT           (262|ERR_RFLAG_COMMON)
  |  |  ------------------
  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  ------------------
  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  471|      0|                       "i=%d", i);
  472|      0|        return NULL;
  473|      0|    }
  474|   239k|    st->data[i] = data;
  475|   239k|    st->sorted = 0;
  476|   239k|    return (void *)st->data[i];
  477|   239k|}
OPENSSL_sk_sort:
  480|    219|{
  481|    219|    if (st != NULL && !st->sorted && st->comp != NULL) {
  ------------------
  |  Branch (481:9): [True: 219, False: 0]
  |  Branch (481:23): [True: 219, False: 0]
  |  Branch (481:38): [True: 219, False: 0]
  ------------------
  482|    219|        if (st->num > 1)
  ------------------
  |  Branch (482:13): [True: 210, False: 9]
  ------------------
  483|    210|            qsort(st->data, st->num, sizeof(void *), st->comp);
  484|    219|        st->sorted = 1; /* empty or single-element stack is considered sorted */
  485|    219|    }
  486|    219|}
stack.c:sk_reserve:
  178|  6.04M|{
  179|  6.04M|    const void **tmpdata;
  180|  6.04M|    int num_alloc;
  181|       |
  182|       |    /* Check to see the reservation isn't exceeding the hard limit */
  183|  6.04M|    if (n > max_nodes - st->num) {
  ------------------
  |  Branch (183:9): [True: 0, False: 6.04M]
  ------------------
  184|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  185|      0|        return 0;
  186|      0|    }
  187|       |
  188|       |    /* Figure out the new size */
  189|  6.04M|    num_alloc = st->num + n;
  190|  6.04M|    if (num_alloc < min_nodes)
  ------------------
  |  Branch (190:9): [True: 204k, False: 5.84M]
  ------------------
  191|   204k|        num_alloc = min_nodes;
  192|       |
  193|       |    /* If |st->data| allocation was postponed */
  194|  6.04M|    if (st->data == NULL) {
  ------------------
  |  Branch (194:9): [True: 151k, False: 5.89M]
  ------------------
  195|       |        /*
  196|       |         * At this point, |st->num_alloc| and |st->num| are 0;
  197|       |         * so |num_alloc| value is |n| or |min_nodes| if greater than |n|.
  198|       |         */
  199|   151k|        if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL)
  ------------------
  |  |   99|   151k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   151k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   151k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (199:13): [True: 0, False: 151k]
  ------------------
  200|      0|            return 0;
  201|   151k|        st->num_alloc = num_alloc;
  202|   151k|        return 1;
  203|   151k|    }
  204|       |
  205|  5.89M|    if (!exact) {
  ------------------
  |  Branch (205:9): [True: 5.89M, False: 0]
  ------------------
  206|  5.89M|        if (num_alloc <= st->num_alloc)
  ------------------
  |  Branch (206:13): [True: 5.84M, False: 51.6k]
  ------------------
  207|  5.84M|            return 1;
  208|  51.6k|        num_alloc = compute_growth(num_alloc, st->num_alloc);
  209|  51.6k|        if (num_alloc == 0) {
  ------------------
  |  Branch (209:13): [True: 0, False: 51.6k]
  ------------------
  210|      0|            ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  211|      0|            return 0;
  212|      0|        }
  213|  51.6k|    } else if (num_alloc == st->num_alloc) {
  ------------------
  |  Branch (213:16): [True: 0, False: 0]
  ------------------
  214|      0|        return 1;
  215|      0|    }
  216|       |
  217|  51.6k|    tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
  ------------------
  |  |  101|  51.6k|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  51.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  51.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  218|  51.6k|    if (tmpdata == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 51.6k]
  ------------------
  219|      0|        return 0;
  220|       |
  221|  51.6k|    st->data = tmpdata;
  222|  51.6k|    st->num_alloc = num_alloc;
  223|  51.6k|    return 1;
  224|  51.6k|}
stack.c:compute_growth:
  160|  51.6k|{
  161|  51.6k|    int err = 0;
  162|       |
  163|   103k|    while (current < target) {
  ------------------
  |  Branch (163:12): [True: 51.6k, False: 51.6k]
  ------------------
  164|  51.6k|        if (current >= max_nodes)
  ------------------
  |  Branch (164:13): [True: 0, False: 51.6k]
  ------------------
  165|      0|            return 0;
  166|       |
  167|  51.6k|        current = safe_muldiv_int(current, 8, 5, &err);
  168|  51.6k|        if (err != 0)
  ------------------
  |  Branch (168:13): [True: 0, False: 51.6k]
  ------------------
  169|      0|            return 0;
  170|  51.6k|        if (current >= max_nodes)
  ------------------
  |  Branch (170:13): [True: 0, False: 51.6k]
  ------------------
  171|      0|            current = max_nodes;
  172|  51.6k|    }
  173|  51.6k|    return current;
  174|  51.6k|}
stack.c:internal_delete:
  285|      2|{
  286|      2|    const void *ret = st->data[loc];
  287|       |
  288|      2|    if (loc != st->num - 1)
  ------------------
  |  Branch (288:9): [True: 0, False: 2]
  ------------------
  289|      0|        memmove(&st->data[loc], &st->data[loc + 1],
  290|      0|                sizeof(st->data[0]) * (st->num - loc - 1));
  291|      2|    st->num--;
  292|       |
  293|      2|    return (void *)ret;
  294|      2|}
stack.c:internal_find:
  319|      6|{
  320|      6|    const void *r;
  321|      6|    int i, count = 0;
  322|      6|    int *pnum = pnum_matched;
  323|       |
  324|      6|    if (st == NULL || st->num == 0)
  ------------------
  |  Branch (324:9): [True: 0, False: 6]
  |  Branch (324:23): [True: 6, False: 0]
  ------------------
  325|      6|        return -1;
  326|       |
  327|      0|    if (pnum == NULL)
  ------------------
  |  Branch (327:9): [True: 0, False: 0]
  ------------------
  328|      0|        pnum = &count;
  329|       |
  330|      0|    if (st->comp == NULL) {
  ------------------
  |  Branch (330:9): [True: 0, False: 0]
  ------------------
  331|      0|        for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (331:21): [True: 0, False: 0]
  ------------------
  332|      0|            if (st->data[i] == data) {
  ------------------
  |  Branch (332:17): [True: 0, False: 0]
  ------------------
  333|      0|                *pnum = 1;
  334|      0|                return i;
  335|      0|            }
  336|      0|        *pnum = 0;
  337|      0|        return -1;
  338|      0|    }
  339|       |
  340|      0|    if (data == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 0]
  ------------------
  341|      0|        return -1;
  342|       |
  343|      0|    if (!st->sorted) {
  ------------------
  |  Branch (343:9): [True: 0, False: 0]
  ------------------
  344|      0|        int res = -1;
  345|       |
  346|      0|        for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (346:21): [True: 0, False: 0]
  ------------------
  347|      0|            if (st->comp(&data, st->data + i) == 0) {
  ------------------
  |  Branch (347:17): [True: 0, False: 0]
  ------------------
  348|      0|                if (res == -1)
  ------------------
  |  Branch (348:21): [True: 0, False: 0]
  ------------------
  349|      0|                    res = i;
  350|      0|                ++*pnum;
  351|       |                /* Check if only one result is wanted and exit if so */
  352|      0|                if (pnum_matched == NULL)
  ------------------
  |  Branch (352:21): [True: 0, False: 0]
  ------------------
  353|      0|                    return i;
  354|      0|            }
  355|      0|        if (res == -1)
  ------------------
  |  Branch (355:13): [True: 0, False: 0]
  ------------------
  356|      0|            *pnum = 0;
  357|      0|        return res;
  358|      0|    }
  359|       |
  360|      0|    if (pnum_matched != NULL)
  ------------------
  |  Branch (360:9): [True: 0, False: 0]
  ------------------
  361|      0|        ret_val_options |= OSSL_BSEARCH_FIRST_VALUE_ON_MATCH;
  ------------------
  |  |  150|      0|# define OSSL_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
  ------------------
  362|      0|    r = ossl_bsearch(&data, st->data, st->num, sizeof(void *), st->comp,
  363|      0|                     ret_val_options);
  364|       |
  365|      0|    if (pnum_matched != NULL) {
  ------------------
  |  Branch (365:9): [True: 0, False: 0]
  ------------------
  366|      0|        *pnum = 0;
  367|      0|        if (r != NULL) {
  ------------------
  |  Branch (367:13): [True: 0, False: 0]
  ------------------
  368|      0|            const void **p = (const void **)r;
  369|       |
  370|      0|            while (p < st->data + st->num) {
  ------------------
  |  Branch (370:20): [True: 0, False: 0]
  ------------------
  371|      0|                if (st->comp(&data, p) != 0)
  ------------------
  |  Branch (371:21): [True: 0, False: 0]
  ------------------
  372|      0|                    break;
  373|      0|                ++*pnum;
  374|      0|                ++p;
  375|      0|            }
  376|      0|        }
  377|      0|    }
  378|       |
  379|      0|    return r == NULL ? -1 : (int)((const void **)r - st->data);
  ------------------
  |  Branch (379:12): [True: 0, False: 0]
  ------------------
  380|      0|}

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

ossl_store_cleanup_int:
   14|      2|{
   15|      2|    ossl_store_destroy_loaders_int();
   16|      2|}

ossl_store_loader_store_cache_flush:
  386|      2|{
  387|      2|    OSSL_METHOD_STORE *store = get_loader_store(libctx);
  388|       |
  389|      2|    if (store != NULL)
  ------------------
  |  Branch (389:9): [True: 2, False: 0]
  ------------------
  390|      2|        return ossl_method_store_cache_flush_all(store);
  391|      0|    return 1;
  392|      2|}
store_meth.c:get_loader_store:
  106|      2|{
  107|      2|    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX);
  ------------------
  |  |  115|      2|# define OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX      15
  ------------------
  108|      2|}

ossl_store_destroy_loaders_int:
  281|      2|{
  282|      2|    lh_OSSL_STORE_LOADER_free(loader_register);
  283|      2|    loader_register = NULL;
  284|      2|    CRYPTO_THREAD_lock_free(registry_lock);
  285|      2|    registry_lock = NULL;
  286|      2|}

ossl_crypto_mutex_new:
   97|      4|{
   98|      4|    pthread_mutex_t *mutex;
   99|       |
  100|      4|    if ((mutex = OPENSSL_zalloc(sizeof(*mutex))) == NULL)
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (100:9): [True: 0, False: 4]
  ------------------
  101|      0|        return NULL;
  102|      4|    if (pthread_mutex_init(mutex, NULL) != 0) {
  ------------------
  |  Branch (102:9): [True: 0, False: 4]
  ------------------
  103|      0|        OPENSSL_free(mutex);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  104|      0|        return NULL;
  105|      0|    }
  106|      4|    return (CRYPTO_MUTEX *)mutex;
  107|      4|}
ossl_crypto_mutex_free:
  142|      2|{
  143|      2|    pthread_mutex_t **mutex_p;
  144|       |
  145|      2|    if (mutex == NULL)
  ------------------
  |  Branch (145:9): [True: 0, False: 2]
  ------------------
  146|      0|        return;
  147|       |
  148|      2|    mutex_p = (pthread_mutex_t **)mutex;
  149|      2|    if (*mutex_p != NULL)
  ------------------
  |  Branch (149:9): [True: 2, False: 0]
  ------------------
  150|      2|        pthread_mutex_destroy(*mutex_p);
  151|      2|    OPENSSL_free(*mutex_p);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  152|      2|    *mutex = NULL;
  153|      2|}
ossl_crypto_condvar_new:
  156|      4|{
  157|      4|    pthread_cond_t *cv_p;
  158|       |
  159|      4|    if ((cv_p = OPENSSL_zalloc(sizeof(*cv_p))) == NULL)
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (159:9): [True: 0, False: 4]
  ------------------
  160|      0|        return NULL;
  161|      4|    if (pthread_cond_init(cv_p, NULL) != 0) {
  ------------------
  |  Branch (161:9): [True: 0, False: 4]
  ------------------
  162|      0|        OPENSSL_free(cv_p);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|      0|        return NULL;
  164|      0|    }
  165|      4|    return (CRYPTO_CONDVAR *) cv_p;
  166|      4|}
ossl_crypto_condvar_free:
  220|      2|{
  221|      2|    pthread_cond_t **cv_p;
  222|       |
  223|      2|    if (cv == NULL)
  ------------------
  |  Branch (223:9): [True: 0, False: 2]
  ------------------
  224|      0|        return;
  225|       |
  226|      2|    cv_p = (pthread_cond_t **)cv;
  227|      2|    if (*cv_p != NULL)
  ------------------
  |  Branch (227:9): [True: 2, False: 0]
  ------------------
  228|      2|        pthread_cond_destroy(*cv_p);
  229|      2|    OPENSSL_free(*cv_p);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|      2|    *cv_p = NULL;
  231|      2|}

ossl_threads_ctx_new:
  128|      4|{
  129|      4|    struct openssl_threads_st *t = OPENSSL_zalloc(sizeof(*t));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  130|       |
  131|      4|    if (t == NULL)
  ------------------
  |  Branch (131:9): [True: 0, False: 4]
  ------------------
  132|      0|        return NULL;
  133|       |
  134|      4|    t->lock = ossl_crypto_mutex_new();
  135|      4|    t->cond_finished = ossl_crypto_condvar_new();
  136|       |
  137|      4|    if (t->lock == NULL || t->cond_finished == NULL)
  ------------------
  |  Branch (137:9): [True: 0, False: 4]
  |  Branch (137:28): [True: 0, False: 4]
  ------------------
  138|      0|        goto fail;
  139|       |
  140|      4|    return t;
  141|       |
  142|      0|fail:
  143|      0|    ossl_threads_ctx_free((void *)t);
  144|      0|    return NULL;
  145|      4|}
ossl_threads_ctx_free:
  148|      2|{
  149|      2|    OSSL_LIB_CTX_THREADS *t = (OSSL_LIB_CTX_THREADS *) vdata;
  150|       |
  151|      2|    if (t == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 2]
  ------------------
  152|      0|        return;
  153|       |
  154|      2|    ossl_crypto_mutex_free(&t->lock);
  155|      2|    ossl_crypto_condvar_free(&t->cond_finished);
  156|      2|    OPENSSL_free(t);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  157|      2|}

CRYPTO_THREAD_lock_new:
   46|   253k|{
   47|   253k|# ifdef USE_RWLOCK
   48|   253k|    CRYPTO_RWLOCK *lock;
   49|       |
   50|   253k|    if ((lock = CRYPTO_zalloc(sizeof(pthread_rwlock_t), NULL, 0)) == NULL)
  ------------------
  |  Branch (50:9): [True: 0, False: 253k]
  ------------------
   51|       |        /* Don't set error, to avoid recursion blowup. */
   52|      0|        return NULL;
   53|       |
   54|   253k|    if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (54:9): [True: 0, False: 253k]
  ------------------
   55|      0|        OPENSSL_free(lock);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      0|        return NULL;
   57|      0|    }
   58|       |# else
   59|       |    pthread_mutexattr_t attr;
   60|       |    CRYPTO_RWLOCK *lock;
   61|       |
   62|       |    if ((lock = CRYPTO_zalloc(sizeof(pthread_mutex_t), NULL, 0)) == NULL)
   63|       |        /* Don't set error, to avoid recursion blowup. */
   64|       |        return NULL;
   65|       |
   66|       |    /*
   67|       |     * We don't use recursive mutexes, but try to catch errors if we do.
   68|       |     */
   69|       |    pthread_mutexattr_init(&attr);
   70|       |#  if !defined (__TANDEM) && !defined (_SPT_MODEL_)
   71|       |#   if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
   72|       |    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
   73|       |#   endif
   74|       |#  else
   75|       |    /* The SPT Thread Library does not define MUTEX attributes. */
   76|       |#  endif
   77|       |
   78|       |    if (pthread_mutex_init(lock, &attr) != 0) {
   79|       |        pthread_mutexattr_destroy(&attr);
   80|       |        OPENSSL_free(lock);
   81|       |        return NULL;
   82|       |    }
   83|       |
   84|       |    pthread_mutexattr_destroy(&attr);
   85|       |# endif
   86|       |
   87|   253k|    return lock;
   88|   253k|}
CRYPTO_THREAD_read_lock:
   91|  21.2M|{
   92|  21.2M|# ifdef USE_RWLOCK
   93|  21.2M|    if (pthread_rwlock_rdlock(lock) != 0)
  ------------------
  |  Branch (93:9): [True: 0, False: 21.2M]
  ------------------
   94|      0|        return 0;
   95|       |# else
   96|       |    if (pthread_mutex_lock(lock) != 0) {
   97|       |        assert(errno != EDEADLK && errno != EBUSY);
   98|       |        return 0;
   99|       |    }
  100|       |# endif
  101|       |
  102|  21.2M|    return 1;
  103|  21.2M|}
CRYPTO_THREAD_write_lock:
  106|  16.5k|{
  107|  16.5k|# ifdef USE_RWLOCK
  108|  16.5k|    if (pthread_rwlock_wrlock(lock) != 0)
  ------------------
  |  Branch (108:9): [True: 0, False: 16.5k]
  ------------------
  109|      0|        return 0;
  110|       |# else
  111|       |    if (pthread_mutex_lock(lock) != 0) {
  112|       |        assert(errno != EDEADLK && errno != EBUSY);
  113|       |        return 0;
  114|       |    }
  115|       |# endif
  116|       |
  117|  16.5k|    return 1;
  118|  16.5k|}
CRYPTO_THREAD_unlock:
  121|  21.2M|{
  122|  21.2M|# ifdef USE_RWLOCK
  123|  21.2M|    if (pthread_rwlock_unlock(lock) != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 21.2M]
  ------------------
  124|      0|        return 0;
  125|       |# else
  126|       |    if (pthread_mutex_unlock(lock) != 0) {
  127|       |        assert(errno != EPERM);
  128|       |        return 0;
  129|       |    }
  130|       |# endif
  131|       |
  132|  21.2M|    return 1;
  133|  21.2M|}
CRYPTO_THREAD_lock_free:
  136|   253k|{
  137|   253k|    if (lock == NULL)
  ------------------
  |  Branch (137:9): [True: 12, False: 253k]
  ------------------
  138|     12|        return;
  139|       |
  140|   253k|# ifdef USE_RWLOCK
  141|   253k|    pthread_rwlock_destroy(lock);
  142|       |# else
  143|       |    pthread_mutex_destroy(lock);
  144|       |# endif
  145|   253k|    OPENSSL_free(lock);
  ------------------
  |  |  107|   253k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   253k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   253k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  146|       |
  147|   253k|    return;
  148|   253k|}
CRYPTO_THREAD_run_once:
  151|   106M|{
  152|   106M|    if (pthread_once(once, init) != 0)
  ------------------
  |  Branch (152:9): [True: 0, False: 106M]
  ------------------
  153|      0|        return 0;
  154|       |
  155|   106M|    return 1;
  156|   106M|}
CRYPTO_THREAD_init_local:
  159|     16|{
  160|     16|    if (pthread_key_create(key, cleanup) != 0)
  ------------------
  |  Branch (160:9): [True: 0, False: 16]
  ------------------
  161|      0|        return 0;
  162|       |
  163|     16|    return 1;
  164|     16|}
CRYPTO_THREAD_get_local:
  167|  61.1M|{
  168|  61.1M|    return pthread_getspecific(*key);
  169|  61.1M|}
CRYPTO_THREAD_set_local:
  172|     19|{
  173|     19|    if (pthread_setspecific(*key, val) != 0)
  ------------------
  |  Branch (173:9): [True: 0, False: 19]
  ------------------
  174|      0|        return 0;
  175|       |
  176|     19|    return 1;
  177|     19|}
CRYPTO_THREAD_cleanup_local:
  180|     12|{
  181|     12|    if (pthread_key_delete(*key) != 0)
  ------------------
  |  Branch (181:9): [True: 0, False: 12]
  ------------------
  182|      0|        return 0;
  183|       |
  184|     12|    return 1;
  185|     12|}
CRYPTO_atomic_add:
  198|  26.9k|{
  199|  26.9k|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  200|  26.9k|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (200:9): [Folded - Ignored]
  ------------------
  201|  26.9k|        *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL);
  202|  26.9k|        return 1;
  203|  26.9k|    }
  204|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  205|       |    /* This will work for all future Solaris versions. */
  206|       |    if (ret != NULL) {
  207|       |        *ret = atomic_add_int_nv((volatile unsigned int *)val, amount);
  208|       |        return 1;
  209|       |    }
  210|       |# endif
  211|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (211:9): [True: 0, False: 0]
  |  Branch (211:25): [True: 0, False: 0]
  ------------------
  212|      0|        return 0;
  213|       |
  214|      0|    *val += amount;
  215|      0|    *ret  = *val;
  216|       |
  217|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (217:9): [True: 0, False: 0]
  ------------------
  218|      0|        return 0;
  219|       |
  220|      0|    return 1;
  221|      0|}
CRYPTO_atomic_or:
  225|      6|{
  226|      6|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  227|      6|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (227:9): [Folded - Ignored]
  ------------------
  228|      6|        *ret = __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
  229|      6|        return 1;
  230|      6|    }
  231|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  232|       |    /* This will work for all future Solaris versions. */
  233|       |    if (ret != NULL) {
  234|       |        *ret = atomic_or_64_nv(val, op);
  235|       |        return 1;
  236|       |    }
  237|       |# endif
  238|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  |  Branch (238:25): [True: 0, False: 0]
  ------------------
  239|      0|        return 0;
  240|      0|    *val |= op;
  241|      0|    *ret  = *val;
  242|       |
  243|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (243:9): [True: 0, False: 0]
  ------------------
  244|      0|        return 0;
  245|       |
  246|      0|    return 1;
  247|      0|}
CRYPTO_atomic_load:
  250|  45.3M|{
  251|  45.3M|# if defined(__GNUC__) && defined(__ATOMIC_ACQUIRE) && !defined(BROKEN_CLANG_ATOMICS)
  252|  45.3M|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (252:9): [Folded - Ignored]
  ------------------
  253|  45.3M|        __atomic_load(val, ret, __ATOMIC_ACQUIRE);
  254|  45.3M|        return 1;
  255|  45.3M|    }
  256|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  257|       |    /* This will work for all future Solaris versions. */
  258|       |    if (ret != NULL) {
  259|       |        *ret = atomic_or_64_nv(val, 0);
  260|       |        return 1;
  261|       |    }
  262|       |# endif
  263|      0|    if (lock == NULL || !CRYPTO_THREAD_read_lock(lock))
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  |  Branch (263:25): [True: 0, False: 0]
  ------------------
  264|      0|        return 0;
  265|      0|    *ret  = *val;
  266|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (266:9): [True: 0, False: 0]
  ------------------
  267|      0|        return 0;
  268|       |
  269|      0|    return 1;
  270|      0|}

ossl_time_now:
   15|    643|{
   16|    643|    OSSL_TIME r;
   17|       |
   18|       |#if defined(_WIN32) && !defined(OPENSSL_SYS_UEFI)
   19|       |    SYSTEMTIME st;
   20|       |    union {
   21|       |        unsigned __int64 ul;
   22|       |        FILETIME ft;
   23|       |    } now;
   24|       |
   25|       |    GetSystemTime(&st);
   26|       |    SystemTimeToFileTime(&st, &now.ft);
   27|       |    /* re-bias to 1/1/1970 */
   28|       |# ifdef  __MINGW32__
   29|       |    now.ul -= 116444736000000000ULL;
   30|       |# else
   31|       |    now.ul -= 116444736000000000UI64;
   32|       |# endif
   33|       |    r.t = ((uint64_t)now.ul) * (OSSL_TIME_SECOND / 10000000);
   34|       |#else   /* defined(_WIN32) */
   35|    643|    struct timeval t;
   36|       |
   37|    643|    if (gettimeofday(&t, NULL) < 0) {
  ------------------
  |  Branch (37:9): [True: 0, False: 643]
  ------------------
   38|      0|        ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  ------------------
  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  ------------------
  |  |  405|      0|     ERR_set_error)
  ------------------
                      ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |   72|      0|# define ERR_LIB_SYS             2
  ------------------
                      ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
  ------------------
  |  |   30|      0|# define get_last_sys_error()    errno
  ------------------
   39|      0|                       "calling gettimeofday()");
   40|      0|        return ossl_time_zero();
   41|      0|    }
   42|    643|    if (t.tv_sec <= 0)
  ------------------
  |  Branch (42:9): [True: 0, False: 643]
  ------------------
   43|      0|        r.t = t.tv_usec <= 0 ? 0 : t.tv_usec * OSSL_TIME_US;
  ------------------
  |  |   36|      0|# define OSSL_TIME_US     (OSSL_TIME_MS     / 1000)
  |  |  ------------------
  |  |  |  |   33|      0|# define OSSL_TIME_MS     (OSSL_TIME_SECOND / 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (43:15): [True: 0, False: 0]
  ------------------
   44|    643|    else
   45|    643|        r.t = ((uint64_t)t.tv_sec * 1000000 + t.tv_usec) * OSSL_TIME_US;
  ------------------
  |  |   36|    643|# define OSSL_TIME_US     (OSSL_TIME_MS     / 1000)
  |  |  ------------------
  |  |  |  |   33|    643|# define OSSL_TIME_MS     (OSSL_TIME_SECOND / 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|    643|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   46|    643|#endif  /* defined(_WIN32) */
   47|    643|    return r;
   48|    643|}

ossl_trace_cleanup:
  338|      2|{
  339|       |#ifndef OPENSSL_NO_TRACE
  340|       |    int category;
  341|       |    BIO *channel = NULL;
  342|       |    const char *prefix = NULL;
  343|       |    const char *suffix = NULL;
  344|       |
  345|       |    for (category = 0; category < OSSL_TRACE_CATEGORY_NUM; category++) {
  346|       |        /* We force the TRACE category to be treated last */
  347|       |        if (category == OSSL_TRACE_CATEGORY_TRACE)
  348|       |            continue;
  349|       |        set_trace_data(category, 0, &channel, &prefix, &suffix,
  350|       |                       trace_attach_cb, trace_detach_cb);
  351|       |    }
  352|       |    set_trace_data(OSSL_TRACE_CATEGORY_TRACE, 0, &channel,
  353|       |                   &prefix, &suffix,
  354|       |                   trace_attach_cb, trace_detach_cb);
  355|       |    CRYPTO_THREAD_lock_free(trace_lock);
  356|       |#endif
  357|      2|}
OSSL_trace_set_channel:
  360|      2|{
  361|       |#ifndef OPENSSL_NO_TRACE
  362|       |    if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM)
  363|       |        return set_trace_data(category, SIMPLE_CHANNEL, &channel, NULL, NULL,
  364|       |                              trace_attach_cb, trace_detach_cb);
  365|       |#endif
  366|      2|    return 0;
  367|      2|}

PKCS7_to_TS_TST_INFO:
  205|      5|{
  206|      5|    PKCS7_SIGNED *pkcs7_signed;
  207|      5|    PKCS7 *enveloped;
  208|      5|    ASN1_TYPE *tst_info_wrapper;
  209|      5|    ASN1_OCTET_STRING *tst_info_der;
  210|      5|    const unsigned char *p;
  211|       |
  212|      5|    if (!PKCS7_type_is_signed(token)) {
  ------------------
  |  |  255|      5|# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
  |  |  ------------------
  |  |  |  |  679|      5|#define NID_pkcs7_signed                22
  |  |  ------------------
  ------------------
  |  Branch (212:9): [True: 2, False: 3]
  ------------------
  213|      2|        ERR_raise(ERR_LIB_TS, TS_R_BAD_PKCS7_TYPE);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  214|      2|        return NULL;
  215|      2|    }
  216|      3|    if (PKCS7_get_detached(token)) {
  ------------------
  |  |  266|      3|                PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
  |  |  ------------------
  |  |  |  |  250|      3|# define PKCS7_OP_GET_DETACHED_SIGNATURE 2
  |  |  ------------------
  |  |  |  Branch (266:17): [True: 2, False: 1]
  |  |  ------------------
  ------------------
  217|      2|        ERR_raise(ERR_LIB_TS, TS_R_DETACHED_CONTENT);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  218|      2|        return NULL;
  219|      2|    }
  220|      1|    pkcs7_signed = token->d.sign;
  221|      1|    enveloped = pkcs7_signed->contents;
  222|      1|    if (OBJ_obj2nid(enveloped->type) != NID_id_smime_ct_TSTInfo) {
  ------------------
  |  |  826|      1|#define NID_id_smime_ct_TSTInfo         207
  ------------------
  |  Branch (222:9): [True: 1, False: 0]
  ------------------
  223|      1|        ERR_raise(ERR_LIB_TS, TS_R_BAD_PKCS7_TYPE);
  ------------------
  |  |  401|      1|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
  224|      1|        return NULL;
  225|      1|    }
  226|      0|    tst_info_wrapper = enveloped->d.other;
  227|      0|    if (tst_info_wrapper->type != V_ASN1_OCTET_STRING) {
  ------------------
  |  |   66|      0|# define V_ASN1_OCTET_STRING             4
  ------------------
  |  Branch (227:9): [True: 0, False: 0]
  ------------------
  228|      0|        ERR_raise(ERR_LIB_TS, TS_R_BAD_TYPE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  229|      0|        return NULL;
  230|      0|    }
  231|      0|    tst_info_der = tst_info_wrapper->value.octet_string;
  232|      0|    p = tst_info_der->data;
  233|      0|    return d2i_TS_TST_INFO(NULL, &p, tst_info_der->length);
  234|      0|}
ts_asn1.c:ts_resp_cb:
  160|  46.6k|{
  161|  46.6k|    TS_RESP *ts_resp = (TS_RESP *)*pval;
  162|  46.6k|    if (op == ASN1_OP_NEW_POST) {
  ------------------
  |  |  743|  46.6k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (162:9): [True: 9.23k, False: 37.4k]
  ------------------
  163|  9.23k|        ts_resp->tst_info = NULL;
  164|  37.4k|    } else if (op == ASN1_OP_FREE_POST) {
  ------------------
  |  |  745|  37.4k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (164:16): [True: 9.23k, False: 28.1k]
  ------------------
  165|  9.23k|        TS_TST_INFO_free(ts_resp->tst_info);
  166|  28.1k|    } else if (op == ASN1_OP_D2I_POST) {
  ------------------
  |  |  747|  28.1k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (166:16): [True: 191, False: 28.0k]
  ------------------
  167|    191|        if (ts_resp_set_tst_info(ts_resp) == 0)
  ------------------
  |  Branch (167:13): [True: 85, False: 106]
  ------------------
  168|     85|            return 0;
  169|    191|    }
  170|  46.5k|    return 1;
  171|  46.6k|}
ts_asn1.c:ts_resp_set_tst_info:
  134|    191|{
  135|    191|    long status;
  136|       |
  137|    191|    status = ASN1_INTEGER_get(a->status_info->status);
  138|       |
  139|    191|    if (a->token) {
  ------------------
  |  Branch (139:9): [True: 83, False: 108]
  ------------------
  140|     83|        if (status != 0 && status != 1) {
  ------------------
  |  Branch (140:13): [True: 79, False: 4]
  |  Branch (140:28): [True: 78, False: 1]
  ------------------
  141|     78|            ERR_raise(ERR_LIB_TS, TS_R_TOKEN_PRESENT);
  ------------------
  |  |  401|     78|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     78|    (ERR_new(),                                                 \
  |  |  |  |  404|     78|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     78|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     78|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     78|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     78|     ERR_set_error)
  |  |  ------------------
  ------------------
  142|     78|            return 0;
  143|     78|        }
  144|      5|        TS_TST_INFO_free(a->tst_info);
  145|      5|        a->tst_info = PKCS7_to_TS_TST_INFO(a->token);
  146|      5|        if (!a->tst_info) {
  ------------------
  |  Branch (146:13): [True: 5, False: 0]
  ------------------
  147|      5|            ERR_raise(ERR_LIB_TS, TS_R_PKCS7_TO_TS_TST_INFO_FAILED);
  ------------------
  |  |  401|      5|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      5|    (ERR_new(),                                                 \
  |  |  |  |  404|      5|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      5|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      5|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      5|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      5|     ERR_set_error)
  |  |  ------------------
  ------------------
  148|      5|            return 0;
  149|      5|        }
  150|    108|    } else if (status == 0 || status == 1) {
  ------------------
  |  Branch (150:16): [True: 1, False: 107]
  |  Branch (150:31): [True: 1, False: 106]
  ------------------
  151|      2|        ERR_raise(ERR_LIB_TS, TS_R_TOKEN_NOT_PRESENT);
  ------------------
  |  |  401|      2|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      2|    (ERR_new(),                                                 \
  |  |  |  |  404|      2|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      2|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      2|     ERR_set_error)
  |  |  ------------------
  ------------------
  152|      2|        return 0;
  153|      2|    }
  154|       |
  155|    106|    return 1;
  156|    191|}

ossl_err_load_TS_strings:
   82|      2|{
   83|      2|# ifndef OPENSSL_NO_ERR
   84|      2|    if (ERR_reason_error_string(TS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (84:9): [True: 2, False: 0]
  ------------------
   85|      2|        ERR_load_strings_const(TS_str_reasons);
   86|      2|# endif
   87|      2|    return 1;
   88|      2|}

TS_ASN1_INTEGER_print_bio:
   20|    307|{
   21|    307|    BIGNUM *num_bn;
   22|    307|    int result = 0;
   23|    307|    char *hex;
   24|       |
   25|    307|    num_bn = ASN1_INTEGER_to_BN(num, NULL);
   26|    307|    if (num_bn == NULL)
  ------------------
  |  Branch (26:9): [True: 0, False: 307]
  ------------------
   27|      0|        return -1;
   28|    307|    if ((hex = BN_bn2hex(num_bn))) {
  ------------------
  |  Branch (28:9): [True: 307, False: 0]
  ------------------
   29|    307|        result = BIO_write(bio, "0x", 2) > 0;
   30|    307|        result = result && BIO_write(bio, hex, strlen(hex)) > 0;
  ------------------
  |  Branch (30:18): [True: 307, False: 0]
  |  Branch (30:28): [True: 307, False: 0]
  ------------------
   31|    307|        OPENSSL_free(hex);
  ------------------
  |  |  107|    307|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    307|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    307|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   32|    307|    }
   33|    307|    BN_free(num_bn);
   34|       |
   35|    307|    return result;
   36|    307|}
TS_OBJ_print_bio:
   39|     17|{
   40|     17|    char obj_txt[128];
   41|       |
   42|     17|    OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
   43|     17|    BIO_printf(bio, "%s\n", obj_txt);
   44|       |
   45|     17|    return 1;
   46|     17|}
TS_ext_print_bio:
   49|    714|{
   50|    714|    int i, critical, n;
   51|    714|    X509_EXTENSION *ex;
   52|    714|    ASN1_OBJECT *obj;
   53|       |
   54|    714|    BIO_printf(bio, "Extensions:\n");
   55|    714|    n = X509v3_get_ext_count(extensions);
   56|  19.3k|    for (i = 0; i < n; i++) {
  ------------------
  |  Branch (56:17): [True: 18.5k, False: 714]
  ------------------
   57|  18.5k|        ex = X509v3_get_ext(extensions, i);
   58|  18.5k|        obj = X509_EXTENSION_get_object(ex);
   59|  18.5k|        if (i2a_ASN1_OBJECT(bio, obj) < 0)
  ------------------
  |  Branch (59:13): [True: 0, False: 18.5k]
  ------------------
   60|      0|            return 0;
   61|  18.5k|        critical = X509_EXTENSION_get_critical(ex);
   62|  18.5k|        BIO_printf(bio, ":%s\n", critical ? " critical" : "");
  ------------------
  |  Branch (62:34): [True: 145, False: 18.4k]
  ------------------
   63|  18.5k|        if (!X509V3_EXT_print(bio, ex, 0, 4)) {
  ------------------
  |  Branch (63:13): [True: 7.60k, False: 10.9k]
  ------------------
   64|  7.60k|            BIO_printf(bio, "%4s", "");
   65|  7.60k|            ASN1_STRING_print(bio, X509_EXTENSION_get_data(ex));
   66|  7.60k|        }
   67|  18.5k|        BIO_write(bio, "\n", 1);
   68|  18.5k|    }
   69|       |
   70|    714|    return 1;
   71|    714|}
TS_X509_ALGOR_print_bio:
   74|    720|{
   75|    720|    int i = OBJ_obj2nid(alg->algorithm);
   76|    720|    return BIO_printf(bio, "Hash Algorithm: %s\n",
   77|    720|                      (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
  ------------------
  |  |   18|    720|#define NID_undef                       0
  ------------------
  |  Branch (77:23): [True: 695, False: 25]
  ------------------
   78|    720|}
TS_MSG_IMPRINT_print_bio:
   81|    720|{
   82|    720|    ASN1_OCTET_STRING *msg;
   83|       |
   84|    720|    TS_X509_ALGOR_print_bio(bio, a->hash_algo);
   85|       |
   86|    720|    BIO_printf(bio, "Message data:\n");
   87|    720|    msg = a->hashed_msg;
   88|    720|    BIO_dump_indent(bio, (const char *)ASN1_STRING_get0_data(msg),
   89|    720|                    ASN1_STRING_length(msg), 4);
   90|       |
   91|    720|    return 1;
   92|    720|}

TS_REQ_print_bio:
   19|    698|{
   20|    698|    int v;
   21|    698|    ASN1_OBJECT *policy_id;
   22|       |
   23|    698|    if (a == NULL)
  ------------------
  |  Branch (23:9): [True: 0, False: 698]
  ------------------
   24|      0|        return 0;
   25|       |
   26|    698|    v = TS_REQ_get_version(a);
   27|    698|    BIO_printf(bio, "Version: %d\n", v);
   28|       |
   29|    698|    TS_MSG_IMPRINT_print_bio(bio, a->msg_imprint);
   30|       |
   31|    698|    BIO_printf(bio, "Policy OID: ");
   32|    698|    policy_id = TS_REQ_get_policy_id(a);
   33|    698|    if (policy_id == NULL)
  ------------------
  |  Branch (33:9): [True: 697, False: 1]
  ------------------
   34|    697|        BIO_printf(bio, "unspecified\n");
   35|      1|    else
   36|      1|        TS_OBJ_print_bio(bio, policy_id);
   37|       |
   38|    698|    BIO_printf(bio, "Nonce: ");
   39|    698|    if (a->nonce == NULL)
  ------------------
  |  Branch (39:9): [True: 424, False: 274]
  ------------------
   40|    424|        BIO_printf(bio, "unspecified");
   41|    274|    else
   42|    274|        TS_ASN1_INTEGER_print_bio(bio, a->nonce);
   43|    698|    BIO_write(bio, "\n", 1);
   44|       |
   45|    698|    BIO_printf(bio, "Certificate required: %s\n",
   46|    698|               a->cert_req ? "yes" : "no");
  ------------------
  |  Branch (46:16): [True: 1, False: 697]
  ------------------
   47|       |
   48|    698|    TS_ext_print_bio(bio, a->extensions);
   49|       |
   50|    698|    return 1;
   51|    698|}

TS_REQ_get_version:
   23|    698|{
   24|    698|    return ASN1_INTEGER_get(a->version);
   25|    698|}
TS_REQ_get_policy_id:
   96|    698|{
   97|    698|    return a->policy_id;
   98|    698|}

TS_RESP_print_bio:
   29|    106|{
   30|    106|    BIO_printf(bio, "Status info:\n");
   31|    106|    TS_STATUS_INFO_print_bio(bio, a->status_info);
   32|       |
   33|    106|    BIO_printf(bio, "\nTST info:\n");
   34|    106|    if (a->tst_info != NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 106]
  ------------------
   35|      0|        TS_TST_INFO_print_bio(bio, a->tst_info);
   36|    106|    else
   37|    106|        BIO_printf(bio, "Not included.\n");
   38|       |
   39|    106|    return 1;
   40|    106|}
TS_STATUS_INFO_print_bio:
   43|    559|{
   44|    559|    static const char *status_map[] = {
   45|    559|        "Granted.",
   46|    559|        "Granted with modifications.",
   47|    559|        "Rejected.",
   48|    559|        "Waiting.",
   49|    559|        "Revocation warning.",
   50|    559|        "Revoked."
   51|    559|    };
   52|    559|    static const struct status_map_st failure_map[] = {
   53|    559|        {TS_INFO_BAD_ALG,
  ------------------
  |  |   56|    559|# define TS_INFO_BAD_ALG                 0
  ------------------
   54|    559|         "unrecognized or unsupported algorithm identifier"},
   55|    559|        {TS_INFO_BAD_REQUEST,
  ------------------
  |  |   57|    559|# define TS_INFO_BAD_REQUEST             2
  ------------------
   56|    559|         "transaction not permitted or supported"},
   57|    559|        {TS_INFO_BAD_DATA_FORMAT,
  ------------------
  |  |   58|    559|# define TS_INFO_BAD_DATA_FORMAT         5
  ------------------
   58|    559|         "the data submitted has the wrong format"},
   59|    559|        {TS_INFO_TIME_NOT_AVAILABLE,
  ------------------
  |  |   59|    559|# define TS_INFO_TIME_NOT_AVAILABLE      14
  ------------------
   60|    559|         "the TSA's time source is not available"},
   61|    559|        {TS_INFO_UNACCEPTED_POLICY,
  ------------------
  |  |   60|    559|# define TS_INFO_UNACCEPTED_POLICY       15
  ------------------
   62|    559|         "the requested TSA policy is not supported by the TSA"},
   63|    559|        {TS_INFO_UNACCEPTED_EXTENSION,
  ------------------
  |  |   61|    559|# define TS_INFO_UNACCEPTED_EXTENSION    16
  ------------------
   64|    559|         "the requested extension is not supported by the TSA"},
   65|    559|        {TS_INFO_ADD_INFO_NOT_AVAILABLE,
  ------------------
  |  |   62|    559|# define TS_INFO_ADD_INFO_NOT_AVAILABLE  17
  ------------------
   66|    559|         "the additional information requested could not be understood "
   67|    559|         "or is not available"},
   68|    559|        {TS_INFO_SYSTEM_FAILURE,
  ------------------
  |  |   63|    559|# define TS_INFO_SYSTEM_FAILURE          25
  ------------------
   69|    559|         "the request cannot be handled due to system failure"},
   70|    559|        {-1, NULL}
   71|    559|    };
   72|    559|    long status;
   73|    559|    int i, lines = 0;
   74|       |
   75|    559|    BIO_printf(bio, "Status: ");
   76|    559|    status = ASN1_INTEGER_get(a->status);
   77|    559|    if (0 <= status && status < (long)OSSL_NELEM(status_map))
  ------------------
  |  |   14|    205|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (77:9): [True: 205, False: 354]
  |  Branch (77:24): [True: 8, False: 197]
  ------------------
   78|      8|        BIO_printf(bio, "%s\n", status_map[status]);
   79|    551|    else
   80|    551|        BIO_printf(bio, "out of bounds\n");
   81|       |
   82|    559|    BIO_printf(bio, "Status description: ");
   83|  3.01k|    for (i = 0; i < sk_ASN1_UTF8STRING_num(a->text); ++i) {
  ------------------
  |  |  763|  3.01k|#define sk_ASN1_UTF8STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_UTF8STRING_sk_type(sk))
  ------------------
  |  Branch (83:17): [True: 2.45k, False: 559]
  ------------------
   84|  2.45k|        if (i > 0)
  ------------------
  |  Branch (84:13): [True: 2.29k, False: 158]
  ------------------
   85|  2.29k|            BIO_puts(bio, "\t");
   86|  2.45k|        ASN1_STRING_print_ex(bio, sk_ASN1_UTF8STRING_value(a->text, i), 0);
  ------------------
  |  |  764|  2.45k|#define sk_ASN1_UTF8STRING_value(sk, idx) ((ASN1_UTF8STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_UTF8STRING_sk_type(sk), (idx)))
  ------------------
   87|  2.45k|        BIO_puts(bio, "\n");
   88|  2.45k|    }
   89|    559|    if (i == 0)
  ------------------
  |  Branch (89:9): [True: 401, False: 158]
  ------------------
   90|    401|        BIO_printf(bio, "unspecified\n");
   91|       |
   92|    559|    BIO_printf(bio, "Failure info: ");
   93|    559|    if (a->failure_info != NULL)
  ------------------
  |  Branch (93:9): [True: 39, False: 520]
  ------------------
   94|     39|        lines = ts_status_map_print(bio, failure_map, a->failure_info);
   95|    559|    if (lines == 0)
  ------------------
  |  Branch (95:9): [True: 522, False: 37]
  ------------------
   96|    522|        BIO_printf(bio, "unspecified");
   97|    559|    BIO_printf(bio, "\n");
   98|       |
   99|    559|    return 1;
  100|    559|}
TS_TST_INFO_print_bio:
  119|     16|{
  120|     16|    int v;
  121|       |
  122|     16|    if (a == NULL)
  ------------------
  |  Branch (122:9): [True: 0, False: 16]
  ------------------
  123|      0|        return 0;
  124|       |
  125|     16|    v = ASN1_INTEGER_get(a->version);
  126|     16|    BIO_printf(bio, "Version: %d\n", v);
  127|       |
  128|     16|    BIO_printf(bio, "Policy OID: ");
  129|     16|    TS_OBJ_print_bio(bio, a->policy_id);
  130|       |
  131|     16|    TS_MSG_IMPRINT_print_bio(bio, a->msg_imprint);
  132|       |
  133|     16|    BIO_printf(bio, "Serial number: ");
  134|     16|    if (a->serial == NULL)
  ------------------
  |  Branch (134:9): [True: 0, False: 16]
  ------------------
  135|      0|        BIO_printf(bio, "unspecified");
  136|     16|    else
  137|     16|        TS_ASN1_INTEGER_print_bio(bio, a->serial);
  138|     16|    BIO_write(bio, "\n", 1);
  139|       |
  140|     16|    BIO_printf(bio, "Time stamp: ");
  141|     16|    ASN1_GENERALIZEDTIME_print(bio, a->time);
  142|     16|    BIO_write(bio, "\n", 1);
  143|       |
  144|     16|    BIO_printf(bio, "Accuracy: ");
  145|     16|    if (a->accuracy == NULL)
  ------------------
  |  Branch (145:9): [True: 9, False: 7]
  ------------------
  146|      9|        BIO_printf(bio, "unspecified");
  147|      7|    else
  148|      7|        ts_ACCURACY_print_bio(bio, a->accuracy);
  149|     16|    BIO_write(bio, "\n", 1);
  150|       |
  151|     16|    BIO_printf(bio, "Ordering: %s\n", a->ordering ? "yes" : "no");
  ------------------
  |  Branch (151:39): [True: 0, False: 16]
  ------------------
  152|       |
  153|     16|    BIO_printf(bio, "Nonce: ");
  154|     16|    if (a->nonce == NULL)
  ------------------
  |  Branch (154:9): [True: 6, False: 10]
  ------------------
  155|      6|        BIO_printf(bio, "unspecified");
  156|     10|    else
  157|     10|        TS_ASN1_INTEGER_print_bio(bio, a->nonce);
  158|     16|    BIO_write(bio, "\n", 1);
  159|       |
  160|     16|    BIO_printf(bio, "TSA: ");
  161|     16|    if (a->tsa == NULL)
  ------------------
  |  Branch (161:9): [True: 8, False: 8]
  ------------------
  162|      8|        BIO_printf(bio, "unspecified");
  163|      8|    else {
  164|      8|        STACK_OF(CONF_VALUE) *nval;
  ------------------
  |  |   31|      8|# define STACK_OF(type) struct stack_st_##type
  ------------------
  165|      8|        if ((nval = i2v_GENERAL_NAME(NULL, a->tsa, NULL)))
  ------------------
  |  Branch (165:13): [True: 7, False: 1]
  ------------------
  166|      7|            X509V3_EXT_val_prn(bio, nval, 0, 0);
  167|      8|        sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
  ------------------
  |  |   59|      8|#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
  ------------------
  168|      8|    }
  169|     16|    BIO_write(bio, "\n", 1);
  170|       |
  171|     16|    TS_ext_print_bio(bio, a->extensions);
  172|       |
  173|     16|    return 1;
  174|     16|}
ts_rsp_print.c:ts_status_map_print:
  104|     39|{
  105|     39|    int lines = 0;
  106|       |
  107|    351|    for (; a->bit >= 0; ++a) {
  ------------------
  |  Branch (107:12): [True: 312, False: 39]
  ------------------
  108|    312|        if (ASN1_BIT_STRING_get_bit(v, a->bit)) {
  ------------------
  |  Branch (108:13): [True: 91, False: 221]
  ------------------
  109|     91|            if (++lines > 1)
  ------------------
  |  Branch (109:17): [True: 54, False: 37]
  ------------------
  110|     54|                BIO_printf(bio, ", ");
  111|     91|            BIO_printf(bio, "%s", a->text);
  112|     91|        }
  113|    312|    }
  114|       |
  115|     39|    return lines;
  116|     39|}
ts_rsp_print.c:ts_ACCURACY_print_bio:
  177|      7|{
  178|      7|    if (a->seconds != NULL)
  ------------------
  |  Branch (178:9): [True: 2, False: 5]
  ------------------
  179|      2|        TS_ASN1_INTEGER_print_bio(bio, a->seconds);
  180|      5|    else
  181|      5|        BIO_printf(bio, "unspecified");
  182|      7|    BIO_printf(bio, " seconds, ");
  183|      7|    if (a->millis != NULL)
  ------------------
  |  Branch (183:9): [True: 3, False: 4]
  ------------------
  184|      3|        TS_ASN1_INTEGER_print_bio(bio, a->millis);
  185|      4|    else
  186|      4|        BIO_printf(bio, "unspecified");
  187|      7|    BIO_printf(bio, " millis, ");
  188|      7|    if (a->micros != NULL)
  ------------------
  |  Branch (188:9): [True: 2, False: 5]
  ------------------
  189|      2|        TS_ASN1_INTEGER_print_bio(bio, a->micros);
  190|      5|    else
  191|      5|        BIO_printf(bio, "unspecified");
  192|      7|    BIO_printf(bio, " micros");
  193|       |
  194|      7|    return 1;
  195|      7|}

ossl_err_load_UI_strings:
   41|      2|{
   42|      2|#ifndef OPENSSL_NO_ERR
   43|      2|    if (ERR_reason_error_string(UI_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (43:9): [True: 2, False: 0]
  ------------------
   44|      2|        ERR_load_strings_const(UI_str_reasons);
   45|      2|#endif
   46|      2|    return 1;
   47|      2|}

ossl_policy_cache_free:
  179|  85.3k|{
  180|  85.3k|    if (!cache)
  ------------------
  |  Branch (180:9): [True: 85.3k, False: 0]
  ------------------
  181|  85.3k|        return;
  182|      0|    ossl_policy_data_free(cache->anyPolicy);
  183|      0|    sk_X509_POLICY_DATA_pop_free(cache->data, ossl_policy_data_free);
  184|      0|    OPENSSL_free(cache);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  185|      0|}

OSSL_STACK_OF_X509_free:
   21|    434|{
   22|    434|    sk_X509_pop_free(certs, X509_free);
  ------------------
  |  |   93|    434|#define sk_X509_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_sk_type(sk),ossl_check_X509_freefunc_type(freefunc))
  ------------------
   23|    434|}

v3_admis.c:i2r_ADMISSION_SYNTAX:
  120|      3|{
  121|      3|    ADMISSION_SYNTAX *admission = (ADMISSION_SYNTAX *)in;
  122|      3|    int i, j, k;
  123|       |
  124|      3|    if (admission->admissionAuthority != NULL) {
  ------------------
  |  Branch (124:9): [True: 2, False: 1]
  ------------------
  125|      2|        if (BIO_printf(bp, "%*sadmissionAuthority:\n", ind, "") <= 0
  ------------------
  |  Branch (125:13): [True: 0, False: 2]
  ------------------
  126|      2|            || BIO_printf(bp, "%*s  ", ind, "") <= 0
  ------------------
  |  Branch (126:16): [True: 0, False: 2]
  ------------------
  127|      2|            || GENERAL_NAME_print(bp, admission->admissionAuthority) <= 0
  ------------------
  |  Branch (127:16): [True: 0, False: 2]
  ------------------
  128|      2|            || BIO_printf(bp, "\n") <= 0)
  ------------------
  |  Branch (128:16): [True: 0, False: 2]
  ------------------
  129|      0|            goto err;
  130|      2|    }
  131|       |
  132|      4|    for (i = 0; i < sk_ADMISSIONS_num(admission->contentsOfAdmissions); i++) {
  ------------------
  |  | 1375|      4|#define sk_ADMISSIONS_num(sk) OPENSSL_sk_num(ossl_check_const_ADMISSIONS_sk_type(sk))
  ------------------
  |  Branch (132:17): [True: 1, False: 3]
  ------------------
  133|      1|        ADMISSIONS* entry = sk_ADMISSIONS_value(admission->contentsOfAdmissions, i);
  ------------------
  |  | 1376|      1|#define sk_ADMISSIONS_value(sk, idx) ((ADMISSIONS *)OPENSSL_sk_value(ossl_check_const_ADMISSIONS_sk_type(sk), (idx)))
  ------------------
  134|       |
  135|      1|        if (BIO_printf(bp, "%*sEntry %0d:\n", ind, "", 1 + i) <= 0) goto err;
  ------------------
  |  Branch (135:13): [True: 0, False: 1]
  ------------------
  136|       |
  137|      1|        if (entry->admissionAuthority != NULL) {
  ------------------
  |  Branch (137:13): [True: 0, False: 1]
  ------------------
  138|      0|            if (BIO_printf(bp, "%*s  admissionAuthority:\n", ind, "") <= 0
  ------------------
  |  Branch (138:17): [True: 0, False: 0]
  ------------------
  139|      0|                || BIO_printf(bp, "%*s    ", ind, "") <= 0
  ------------------
  |  Branch (139:20): [True: 0, False: 0]
  ------------------
  140|      0|                || GENERAL_NAME_print(bp, entry->admissionAuthority) <= 0
  ------------------
  |  Branch (140:20): [True: 0, False: 0]
  ------------------
  141|      0|                || BIO_printf(bp, "\n") <= 0)
  ------------------
  |  Branch (141:20): [True: 0, False: 0]
  ------------------
  142|      0|                goto err;
  143|      0|        }
  144|       |
  145|      1|        if (entry->namingAuthority != NULL) {
  ------------------
  |  Branch (145:13): [True: 0, False: 1]
  ------------------
  146|      0|            if (i2r_NAMING_AUTHORITY(method, entry->namingAuthority, bp, ind) <= 0)
  ------------------
  |  Branch (146:17): [True: 0, False: 0]
  ------------------
  147|      0|                goto err;
  148|      0|        }
  149|       |
  150|      1|        for (j = 0; j < sk_PROFESSION_INFO_num(entry->professionInfos); j++) {
  ------------------
  |  | 1349|      1|#define sk_PROFESSION_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PROFESSION_INFO_sk_type(sk))
  ------------------
  |  Branch (150:21): [True: 0, False: 1]
  ------------------
  151|      0|            PROFESSION_INFO* pinfo = sk_PROFESSION_INFO_value(entry->professionInfos, j);
  ------------------
  |  | 1350|      0|#define sk_PROFESSION_INFO_value(sk, idx) ((PROFESSION_INFO *)OPENSSL_sk_value(ossl_check_const_PROFESSION_INFO_sk_type(sk), (idx)))
  ------------------
  152|       |
  153|      0|            if (BIO_printf(bp, "%*s  Profession Info Entry %0d:\n", ind, "", 1 + j) <= 0)
  ------------------
  |  Branch (153:17): [True: 0, False: 0]
  ------------------
  154|      0|                goto err;
  155|       |
  156|      0|            if (pinfo->registrationNumber != NULL) {
  ------------------
  |  Branch (156:17): [True: 0, False: 0]
  ------------------
  157|      0|                if (BIO_printf(bp, "%*s    registrationNumber: ", ind, "") <= 0
  ------------------
  |  Branch (157:21): [True: 0, False: 0]
  ------------------
  158|      0|                    || ASN1_STRING_print(bp, pinfo->registrationNumber) <= 0
  ------------------
  |  Branch (158:24): [True: 0, False: 0]
  ------------------
  159|      0|                    || BIO_printf(bp, "\n") <= 0)
  ------------------
  |  Branch (159:24): [True: 0, False: 0]
  ------------------
  160|      0|                    goto err;
  161|      0|            }
  162|       |
  163|      0|            if (pinfo->namingAuthority != NULL) {
  ------------------
  |  Branch (163:17): [True: 0, False: 0]
  ------------------
  164|      0|                if (i2r_NAMING_AUTHORITY(method, pinfo->namingAuthority, bp, ind + 2) <= 0)
  ------------------
  |  Branch (164:21): [True: 0, False: 0]
  ------------------
  165|      0|                    goto err;
  166|      0|            }
  167|       |
  168|      0|            if (pinfo->professionItems != NULL) {
  ------------------
  |  Branch (168:17): [True: 0, False: 0]
  ------------------
  169|       |
  170|      0|                if (BIO_printf(bp, "%*s    Info Entries:\n", ind, "") <= 0)
  ------------------
  |  Branch (170:21): [True: 0, False: 0]
  ------------------
  171|      0|                    goto err;
  172|      0|                for (k = 0; k < sk_ASN1_STRING_num(pinfo->professionItems); k++) {
  ------------------
  |  | 1310|      0|#define sk_ASN1_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_STRING_sk_type(sk))
  ------------------
  |  Branch (172:29): [True: 0, False: 0]
  ------------------
  173|      0|                    ASN1_STRING* val = sk_ASN1_STRING_value(pinfo->professionItems, k);
  ------------------
  |  | 1311|      0|#define sk_ASN1_STRING_value(sk, idx) ((ASN1_STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_STRING_sk_type(sk), (idx)))
  ------------------
  174|       |
  175|      0|                    if (BIO_printf(bp, "%*s      ", ind, "") <= 0
  ------------------
  |  Branch (175:25): [True: 0, False: 0]
  ------------------
  176|      0|                        || ASN1_STRING_print(bp, val) <= 0
  ------------------
  |  Branch (176:28): [True: 0, False: 0]
  ------------------
  177|      0|                        || BIO_printf(bp, "\n") <= 0)
  ------------------
  |  Branch (177:28): [True: 0, False: 0]
  ------------------
  178|      0|                        goto err;
  179|      0|                }
  180|      0|            }
  181|       |
  182|      0|            if (pinfo->professionOIDs != NULL) {
  ------------------
  |  Branch (182:17): [True: 0, False: 0]
  ------------------
  183|      0|                if (BIO_printf(bp, "%*s    Profession OIDs:\n", ind, "") <= 0)
  ------------------
  |  Branch (183:21): [True: 0, False: 0]
  ------------------
  184|      0|                    goto err;
  185|      0|                for (k = 0; k < sk_ASN1_OBJECT_num(pinfo->professionOIDs); k++) {
  ------------------
  |  |  635|      0|#define sk_ASN1_OBJECT_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_OBJECT_sk_type(sk))
  ------------------
  |  Branch (185:29): [True: 0, False: 0]
  ------------------
  186|      0|                    ASN1_OBJECT* obj = sk_ASN1_OBJECT_value(pinfo->professionOIDs, k);
  ------------------
  |  |  636|      0|#define sk_ASN1_OBJECT_value(sk, idx) ((ASN1_OBJECT *)OPENSSL_sk_value(ossl_check_const_ASN1_OBJECT_sk_type(sk), (idx)))
  ------------------
  187|      0|                    const char *ln = OBJ_nid2ln(OBJ_obj2nid(obj));
  188|      0|                    char objbuf[128];
  189|       |
  190|      0|                    OBJ_obj2txt(objbuf, sizeof(objbuf), obj, 1);
  191|      0|                    if (BIO_printf(bp, "%*s      %s%s%s%s\n", ind, "",
  ------------------
  |  Branch (191:25): [True: 0, False: 0]
  ------------------
  192|      0|                                   ln ? ln : "", ln ? " (" : "",
  ------------------
  |  Branch (192:36): [True: 0, False: 0]
  |  Branch (192:50): [True: 0, False: 0]
  ------------------
  193|      0|                                   objbuf, ln ? ")" : "") <= 0)
  ------------------
  |  Branch (193:44): [True: 0, False: 0]
  ------------------
  194|      0|                        goto err;
  195|      0|                }
  196|      0|            }
  197|      0|        }
  198|      1|    }
  199|      3|    return 1;
  200|       |
  201|      0|err:
  202|      0|    return 0;
  203|      3|}

v3_akid.c:i2v_AUTHORITY_KEYID:
   42|    717|{
   43|    717|    char *tmp = NULL;
   44|    717|    STACK_OF(CONF_VALUE) *origextlist = extlist, *tmpextlist;
  ------------------
  |  |   31|    717|# define STACK_OF(type) struct stack_st_##type
  ------------------
   45|       |
   46|    717|    if (akeyid->keyid) {
  ------------------
  |  Branch (46:9): [True: 276, False: 441]
  ------------------
   47|    276|        tmp = i2s_ASN1_OCTET_STRING(NULL, akeyid->keyid);
   48|    276|        if (tmp == NULL) {
  ------------------
  |  Branch (48:13): [True: 0, False: 276]
  ------------------
   49|      0|            ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   50|      0|            return NULL;
   51|      0|        }
   52|    276|        if (!X509V3_add_value((akeyid->issuer || akeyid->serial) ? "keyid" : NULL,
  ------------------
  |  Branch (52:13): [True: 0, False: 276]
  |  Branch (52:32): [True: 71, False: 205]
  |  Branch (52:50): [True: 1, False: 204]
  ------------------
   53|    276|                              tmp, &extlist)) {
   54|      0|            OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   55|      0|            ERR_raise(ERR_LIB_X509V3, ERR_R_X509_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   56|      0|            goto err;
   57|      0|        }
   58|    276|        OPENSSL_free(tmp);
  ------------------
  |  |  107|    276|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    276|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    276|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   59|    276|    }
   60|    717|    if (akeyid->issuer) {
  ------------------
  |  Branch (60:9): [True: 248, False: 469]
  ------------------
   61|    248|        tmpextlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
   62|    248|        if (tmpextlist == NULL) {
  ------------------
  |  Branch (62:13): [True: 1, False: 247]
  ------------------
   63|      1|            ERR_raise(ERR_LIB_X509V3, ERR_R_X509_LIB);
  ------------------
  |  |  401|      1|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
   64|      1|            goto err;
   65|      1|        }
   66|    247|        extlist = tmpextlist;
   67|    247|    }
   68|    716|    if (akeyid->serial) {
  ------------------
  |  Branch (68:9): [True: 261, False: 455]
  ------------------
   69|    261|        tmp = i2s_ASN1_OCTET_STRING(NULL, akeyid->serial);
   70|    261|        if (tmp == NULL) {
  ------------------
  |  Branch (70:13): [True: 0, False: 261]
  ------------------
   71|      0|            ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   72|      0|            goto err;
   73|      0|        }
   74|    261|        if (!X509V3_add_value("serial", tmp, &extlist)) {
  ------------------
  |  Branch (74:13): [True: 0, False: 261]
  ------------------
   75|      0|            OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   76|      0|            goto err;
   77|      0|        }
   78|    261|        OPENSSL_free(tmp);
  ------------------
  |  |  107|    261|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    261|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    261|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   79|    261|    }
   80|    716|    return extlist;
   81|      1| err:
   82|      1|    if (origextlist == NULL)
  ------------------
  |  Branch (82:9): [True: 1, False: 0]
  ------------------
   83|      1|        sk_CONF_VALUE_pop_free(extlist, X509V3_conf_free);
  ------------------
  |  |   59|      1|#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
  ------------------
   84|      1|    return NULL;
   85|    716|}

v3_bcons.c:i2v_BASIC_CONSTRAINTS:
   49|     36|{
   50|     36|    X509V3_add_value_bool("CA", bcons->ca, &extlist);
   51|     36|    X509V3_add_value_int("pathlen", bcons->pathlen, &extlist);
   52|     36|    return extlist;
   53|     36|}

i2v_ASN1_BIT_STRING:
   49|     49|{
   50|     49|    BIT_STRING_BITNAME *bnam;
   51|    490|    for (bnam = method->usr_data; bnam->lname; bnam++) {
  ------------------
  |  Branch (51:35): [True: 441, False: 49]
  ------------------
   52|    441|        if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum))
  ------------------
  |  Branch (52:13): [True: 342, False: 99]
  ------------------
   53|    342|            X509V3_add_value(bnam->lname, NULL, &ret);
   54|    441|    }
   55|     49|    return ret;
   56|     49|}

v3_cpols.c:i2r_certpol:
  416|    385|{
  417|    385|    int i;
  418|    385|    POLICYINFO *pinfo;
  419|       |    /* First print out the policy OIDs */
  420|    385|    for (i = 0; i < sk_POLICYINFO_num(pol); i++) {
  ------------------
  |  |  460|    385|#define sk_POLICYINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYINFO_sk_type(sk))
  ------------------
  |  Branch (420:17): [True: 0, False: 385]
  ------------------
  421|      0|        if (i > 0)
  ------------------
  |  Branch (421:13): [True: 0, False: 0]
  ------------------
  422|      0|            BIO_puts(out, "\n");
  423|      0|        pinfo = sk_POLICYINFO_value(pol, i);
  ------------------
  |  |  461|      0|#define sk_POLICYINFO_value(sk, idx) ((POLICYINFO *)OPENSSL_sk_value(ossl_check_const_POLICYINFO_sk_type(sk), (idx)))
  ------------------
  424|      0|        BIO_printf(out, "%*sPolicy: ", indent, "");
  425|      0|        i2a_ASN1_OBJECT(out, pinfo->policyid);
  426|      0|        if (pinfo->qualifiers) {
  ------------------
  |  Branch (426:13): [True: 0, False: 0]
  ------------------
  427|      0|            BIO_puts(out, "\n");
  428|      0|            print_qualifiers(out, pinfo->qualifiers, indent + 2);
  429|      0|        }
  430|      0|    }
  431|    385|    return 1;
  432|    385|}

DIST_POINT_set_dpname:
  491|  1.01k|{
  492|  1.01k|    int i;
  493|  1.01k|    STACK_OF(X509_NAME_ENTRY) *frag;
  ------------------
  |  |   31|  1.01k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  494|  1.01k|    X509_NAME_ENTRY *ne;
  495|       |
  496|  1.01k|    if (dpn == NULL || dpn->type != 1)
  ------------------
  |  Branch (496:9): [True: 222, False: 791]
  |  Branch (496:24): [True: 194, False: 597]
  ------------------
  497|    416|        return 1;
  498|    597|    frag = dpn->name.relativename;
  499|    597|    X509_NAME_free(dpn->dpname); /* just in case it was already set */
  500|    597|    dpn->dpname = X509_NAME_dup(iname);
  501|    597|    if (dpn->dpname == NULL)
  ------------------
  |  Branch (501:9): [True: 242, False: 355]
  ------------------
  502|    242|        return 0;
  503|  2.72k|    for (i = 0; i < sk_X509_NAME_ENTRY_num(frag); i++) {
  ------------------
  |  |  196|  2.72k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (503:17): [True: 2.37k, False: 354]
  ------------------
  504|  2.37k|        ne = sk_X509_NAME_ENTRY_value(frag, i);
  ------------------
  |  |  197|  2.37k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  505|  2.37k|        if (!X509_NAME_add_entry(dpn->dpname, ne, -1, i ? 0 : 1))
  ------------------
  |  Branch (505:13): [True: 1, False: 2.37k]
  |  Branch (505:55): [True: 2.09k, False: 283]
  ------------------
  506|      1|            goto err;
  507|  2.37k|    }
  508|       |    /* generate cached encoding of name */
  509|    354|    if (i2d_X509_NAME(dpn->dpname, NULL) >= 0)
  ------------------
  |  Branch (509:9): [True: 334, False: 20]
  ------------------
  510|    334|        return 1;
  511|       |
  512|     21| err:
  513|     21|    X509_NAME_free(dpn->dpname);
  514|     21|    dpn->dpname = NULL;
  515|     21|    return 0;
  516|    354|}
v3_crld.c:dpn_cb:
  302|   108k|{
  303|   108k|    DIST_POINT_NAME *dpn = (DIST_POINT_NAME *)*pval;
  304|       |
  305|   108k|    switch (operation) {
  ------------------
  |  Branch (305:13): [True: 69.5k, False: 39.2k]
  ------------------
  306|  19.6k|    case ASN1_OP_NEW_POST:
  ------------------
  |  |  743|  19.6k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (306:5): [True: 19.6k, False: 89.1k]
  ------------------
  307|  19.6k|        dpn->dpname = NULL;
  308|  19.6k|        break;
  309|       |
  310|  19.6k|    case ASN1_OP_FREE_POST:
  ------------------
  |  |  745|  19.6k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (310:5): [True: 19.6k, False: 89.1k]
  ------------------
  311|  19.6k|        X509_NAME_free(dpn->dpname);
  312|  19.6k|        break;
  313|   108k|    }
  314|   108k|    return 1;
  315|   108k|}
v3_crld.c:i2r_idp:
  445|  7.16k|{
  446|  7.16k|    ISSUING_DIST_POINT *idp = pidp;
  447|  7.16k|    if (idp->distpoint)
  ------------------
  |  Branch (447:9): [True: 5.18k, False: 1.98k]
  ------------------
  448|  5.18k|        print_distpoint(out, idp->distpoint, indent);
  449|  7.16k|    if (idp->onlyuser > 0)
  ------------------
  |  Branch (449:9): [True: 205, False: 6.96k]
  ------------------
  450|    205|        BIO_printf(out, "%*sOnly User Certificates\n", indent, "");
  451|  7.16k|    if (idp->onlyCA > 0)
  ------------------
  |  Branch (451:9): [True: 55, False: 7.11k]
  ------------------
  452|     55|        BIO_printf(out, "%*sOnly CA Certificates\n", indent, "");
  453|  7.16k|    if (idp->indirectCRL > 0)
  ------------------
  |  Branch (453:9): [True: 23, False: 7.14k]
  ------------------
  454|     23|        BIO_printf(out, "%*sIndirect CRL\n", indent, "");
  455|  7.16k|    if (idp->onlysomereasons)
  ------------------
  |  Branch (455:9): [True: 1.64k, False: 5.52k]
  ------------------
  456|  1.64k|        print_reasons(out, "Only Some Reasons", idp->onlysomereasons, indent);
  457|  7.16k|    if (idp->onlyattr > 0)
  ------------------
  |  Branch (457:9): [True: 42, False: 7.12k]
  ------------------
  458|     42|        BIO_printf(out, "%*sOnly Attribute Certificates\n", indent, "");
  459|  7.16k|    if (!idp->distpoint && (idp->onlyuser <= 0) && (idp->onlyCA <= 0)
  ------------------
  |  Branch (459:9): [True: 1.98k, False: 5.18k]
  |  Branch (459:28): [True: 1.78k, False: 205]
  |  Branch (459:52): [True: 1.72k, False: 55]
  ------------------
  460|  7.16k|        && (idp->indirectCRL <= 0) && !idp->onlysomereasons
  ------------------
  |  Branch (460:12): [True: 1.70k, False: 23]
  |  Branch (460:39): [True: 55, False: 1.64k]
  ------------------
  461|  7.16k|        && (idp->onlyattr <= 0))
  ------------------
  |  Branch (461:12): [True: 13, False: 42]
  ------------------
  462|     13|        BIO_printf(out, "%*s<EMPTY>\n", indent, "");
  463|       |
  464|  7.16k|    return 1;
  465|  7.16k|}
v3_crld.c:print_distpoint:
  429|  5.18k|{
  430|  5.18k|    if (dpn->type == 0) {
  ------------------
  |  Branch (430:9): [True: 446, False: 4.73k]
  ------------------
  431|    446|        BIO_printf(out, "%*sFull Name:\n", indent, "");
  432|    446|        print_gens(out, dpn->name.fullname, indent);
  433|  4.73k|    } else {
  434|  4.73k|        X509_NAME ntmp;
  435|  4.73k|        ntmp.entries = dpn->name.relativename;
  436|  4.73k|        BIO_printf(out, "%*sRelative Name:\n%*s", indent, "", indent + 2, "");
  437|  4.73k|        X509_NAME_print_ex(out, &ntmp, 0, XN_FLAG_ONELINE);
  ------------------
  |  |  350|  4.73k|# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
  |  |  ------------------
  |  |  |  |  515|  4.73k|# define ASN1_STRFLGS_RFC2253    (ASN1_STRFLGS_ESC_2253 | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  440|  4.73k|# define ASN1_STRFLGS_ESC_2253           1
  |  |  |  |  ------------------
  |  |  |  |  516|  4.73k|                                ASN1_STRFLGS_ESC_CTRL | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  441|  4.73k|# define ASN1_STRFLGS_ESC_CTRL           2
  |  |  |  |  ------------------
  |  |  |  |  517|  4.73k|                                ASN1_STRFLGS_ESC_MSB | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|  4.73k|# define ASN1_STRFLGS_ESC_MSB            4
  |  |  |  |  ------------------
  |  |  |  |  518|  4.73k|                                ASN1_STRFLGS_UTF8_CONVERT | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  474|  4.73k|# define ASN1_STRFLGS_UTF8_CONVERT       0x10
  |  |  |  |  ------------------
  |  |  |  |  519|  4.73k|                                ASN1_STRFLGS_DUMP_UNKNOWN | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  496|  4.73k|# define ASN1_STRFLGS_DUMP_UNKNOWN       0x100
  |  |  |  |  ------------------
  |  |  |  |  520|  4.73k|                                ASN1_STRFLGS_DUMP_DER)
  |  |  |  |  ------------------
  |  |  |  |  |  |  503|  4.73k|# define ASN1_STRFLGS_DUMP_DER           0x200
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  351|  4.73k|                        ASN1_STRFLGS_ESC_QUOTE | \
  |  |  ------------------
  |  |  |  |  454|  4.73k|# define ASN1_STRFLGS_ESC_QUOTE          8
  |  |  ------------------
  |  |  352|  4.73k|                        XN_FLAG_SEP_CPLUS_SPC | \
  |  |  ------------------
  |  |  |  |  313|  4.73k|# define XN_FLAG_SEP_CPLUS_SPC   (2 << 16)/* ,+ spaced: more readable */
  |  |  ------------------
  |  |  353|  4.73k|                        XN_FLAG_SPC_EQ | \
  |  |  ------------------
  |  |  |  |  328|  4.73k|# define XN_FLAG_SPC_EQ          (1 << 23)/* Put spaces round '=' */
  |  |  ------------------
  |  |  354|  4.73k|                        XN_FLAG_FN_SN)
  |  |  ------------------
  |  |  |  |  323|  4.73k|# define XN_FLAG_FN_SN           0/* Object short name */
  |  |  ------------------
  ------------------
  438|  4.73k|        BIO_puts(out, "\n");
  439|  4.73k|    }
  440|  5.18k|    return 1;
  441|  5.18k|}
v3_crld.c:print_gens:
  417|    456|{
  418|    456|    int i;
  419|  1.17k|    for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
  ------------------
  |  |  231|  1.17k|#define sk_GENERAL_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAME_sk_type(sk))
  ------------------
  |  Branch (419:17): [True: 723, False: 456]
  ------------------
  420|    723|        if (i > 0)
  ------------------
  |  Branch (420:13): [True: 280, False: 443]
  ------------------
  421|    280|            BIO_puts(out, "\n");
  422|    723|        BIO_printf(out, "%*s", indent + 2, "");
  423|    723|        GENERAL_NAME_print(out, sk_GENERAL_NAME_value(gens, i));
  ------------------
  |  |  232|    723|#define sk_GENERAL_NAME_value(sk, idx) ((GENERAL_NAME *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAME_sk_type(sk), (idx)))
  ------------------
  424|    723|    }
  425|    456|    return 1;
  426|    456|}
v3_crld.c:print_reasons:
  182|  1.64k|{
  183|  1.64k|    int first = 1;
  184|  1.64k|    const BIT_STRING_BITNAME *pbn;
  185|  1.64k|    BIO_printf(out, "%*s%s:\n%*s", indent, "", rname, indent + 2, "");
  186|  16.4k|    for (pbn = reason_flags; pbn->lname; pbn++) {
  ------------------
  |  Branch (186:30): [True: 14.8k, False: 1.64k]
  ------------------
  187|  14.8k|        if (ASN1_BIT_STRING_get_bit(rflags, pbn->bitnum)) {
  ------------------
  |  Branch (187:13): [True: 2.48k, False: 12.3k]
  ------------------
  188|  2.48k|            if (first)
  ------------------
  |  Branch (188:17): [True: 1.00k, False: 1.48k]
  ------------------
  189|  1.00k|                first = 0;
  190|  1.48k|            else
  191|  1.48k|                BIO_puts(out, ", ");
  192|  2.48k|            BIO_puts(out, pbn->lname);
  193|  2.48k|        }
  194|  14.8k|    }
  195|  1.64k|    if (first)
  ------------------
  |  Branch (195:9): [True: 640, False: 1.00k]
  ------------------
  196|    640|        BIO_puts(out, "<EMPTY>\n");
  197|  1.00k|    else
  198|  1.00k|        BIO_puts(out, "\n");
  199|  1.64k|    return 1;
  200|  1.64k|}
v3_crld.c:i2r_crldp:
  469|    351|{
  470|    351|    STACK_OF(DIST_POINT) *crld = pcrldp;
  ------------------
  |  |   31|    351|# define STACK_OF(type) struct stack_st_##type
  ------------------
  471|    351|    DIST_POINT *point;
  472|    351|    int i;
  473|  1.03k|    for (i = 0; i < sk_DIST_POINT_num(crld); i++) {
  ------------------
  |  |  323|  1.03k|#define sk_DIST_POINT_num(sk) OPENSSL_sk_num(ossl_check_const_DIST_POINT_sk_type(sk))
  ------------------
  |  Branch (473:17): [True: 683, False: 351]
  ------------------
  474|    683|        if (i > 0)
  ------------------
  |  Branch (474:13): [True: 335, False: 348]
  ------------------
  475|    335|            BIO_puts(out, "\n");
  476|    683|        point = sk_DIST_POINT_value(crld, i);
  ------------------
  |  |  324|    683|#define sk_DIST_POINT_value(sk, idx) ((DIST_POINT *)OPENSSL_sk_value(ossl_check_const_DIST_POINT_sk_type(sk), (idx)))
  ------------------
  477|    683|        if (point->distpoint)
  ------------------
  |  Branch (477:13): [True: 0, False: 683]
  ------------------
  478|      0|            print_distpoint(out, point->distpoint, indent);
  479|    683|        if (point->reasons)
  ------------------
  |  Branch (479:13): [True: 1, False: 682]
  ------------------
  480|      1|            print_reasons(out, "Reasons", point->reasons, indent);
  481|    683|        if (point->CRLissuer) {
  ------------------
  |  Branch (481:13): [True: 10, False: 673]
  ------------------
  482|     10|            BIO_printf(out, "%*sCRL Issuer:\n", indent, "");
  483|     10|            print_gens(out, point->CRLissuer, indent);
  484|     10|        }
  485|    683|    }
  486|    351|    return 1;
  487|    351|}

i2s_ASN1_ENUMERATED_TABLE:
   43|    179|{
   44|    179|    ENUMERATED_NAMES *enam;
   45|    179|    long strval;
   46|       |
   47|    179|    strval = ASN1_ENUMERATED_get(e);
   48|  1.45k|    for (enam = method->usr_data; enam->lname; enam++) {
  ------------------
  |  Branch (48:35): [True: 1.34k, False: 110]
  ------------------
   49|  1.34k|        if (strval == enam->bitnum)
  ------------------
  |  Branch (49:13): [True: 69, False: 1.28k]
  ------------------
   50|     69|            return OPENSSL_strdup(enam->lname);
  ------------------
  |  |  111|     69|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     69|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     69|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   51|  1.34k|    }
   52|    110|    return i2s_ASN1_ENUMERATED(method, e);
   53|    179|}

v3_extku.c:i2v_EXTENDED_KEY_USAGE:
   56|    330|{
   57|    330|    EXTENDED_KEY_USAGE *eku = a;
   58|    330|    int i;
   59|    330|    ASN1_OBJECT *obj;
   60|    330|    char obj_tmp[80];
   61|    443|    for (i = 0; i < sk_ASN1_OBJECT_num(eku); i++) {
  ------------------
  |  |  635|    443|#define sk_ASN1_OBJECT_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_OBJECT_sk_type(sk))
  ------------------
  |  Branch (61:17): [True: 113, False: 330]
  ------------------
   62|    113|        obj = sk_ASN1_OBJECT_value(eku, i);
  ------------------
  |  |  636|    113|#define sk_ASN1_OBJECT_value(sk, idx) ((ASN1_OBJECT *)OPENSSL_sk_value(ossl_check_const_ASN1_OBJECT_sk_type(sk), (idx)))
  ------------------
   63|    113|        i2t_ASN1_OBJECT(obj_tmp, 80, obj);
   64|    113|        X509V3_add_value(NULL, obj_tmp, &ext_list);
   65|    113|    }
   66|    330|    return ext_list;
   67|    330|}

X509V3_EXT_get_nid:
   53|  24.6k|{
   54|  24.6k|    X509V3_EXT_METHOD tmp;
   55|  24.6k|    const X509V3_EXT_METHOD *t = &tmp, *const *ret;
   56|  24.6k|    int idx;
   57|       |
   58|  24.6k|    if (nid < 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 24.6k]
  ------------------
   59|      0|        return NULL;
   60|  24.6k|    tmp.ext_nid = nid;
   61|  24.6k|    ret = OBJ_bsearch_ext(&t, standard_exts, STANDARD_EXTENSION_COUNT);
  ------------------
  |  |   79|  24.6k|#define STANDARD_EXTENSION_COUNT OSSL_NELEM(standard_exts)
  |  |  ------------------
  |  |  |  |   14|  24.6k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
   62|  24.6k|    if (ret)
  ------------------
  |  Branch (62:9): [True: 23.5k, False: 1.13k]
  ------------------
   63|  23.5k|        return *ret;
   64|  1.13k|    if (!ext_list)
  ------------------
  |  Branch (64:9): [True: 1.13k, False: 0]
  ------------------
   65|  1.13k|        return NULL;
   66|       |    /* Ideally, this would be done under a lock */
   67|      0|    sk_X509V3_EXT_METHOD_sort(ext_list);
  ------------------
  |  |  133|      0|#define sk_X509V3_EXT_METHOD_sort(sk) OPENSSL_sk_sort(ossl_check_X509V3_EXT_METHOD_sk_type(sk))
  ------------------
   68|      0|    idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp);
  ------------------
  |  |  130|      0|#define sk_X509V3_EXT_METHOD_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))
  ------------------
   69|       |    /* A failure to locate the item is handled by the value method */
   70|      0|    return sk_X509V3_EXT_METHOD_value(ext_list, idx);
  ------------------
  |  |  114|      0|#define sk_X509V3_EXT_METHOD_value(sk, idx) ((X509V3_EXT_METHOD *)OPENSSL_sk_value(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), (idx)))
  ------------------
   71|  1.13k|}
X509V3_EXT_get:
   74|  24.9k|{
   75|  24.9k|    int nid;
   76|  24.9k|    if ((nid = OBJ_obj2nid(X509_EXTENSION_get_object(ext))) == NID_undef)
  ------------------
  |  |   18|  24.9k|#define NID_undef                       0
  ------------------
  |  Branch (76:9): [True: 343, False: 24.6k]
  ------------------
   77|    343|        return NULL;
   78|  24.6k|    return X509V3_EXT_get_nid(nid);
   79|  24.9k|}
X509V3_EXT_d2i:
  131|  6.39k|{
  132|  6.39k|    const X509V3_EXT_METHOD *method;
  133|  6.39k|    const unsigned char *p;
  134|  6.39k|    ASN1_STRING *extvalue;
  135|  6.39k|    int extlen;
  136|       |
  137|  6.39k|    if ((method = X509V3_EXT_get(ext)) == NULL)
  ------------------
  |  Branch (137:9): [True: 0, False: 6.39k]
  ------------------
  138|      0|        return NULL;
  139|  6.39k|    extvalue = X509_EXTENSION_get_data(ext);
  140|  6.39k|    p = ASN1_STRING_get0_data(extvalue);
  141|  6.39k|    extlen = ASN1_STRING_length(extvalue);
  142|  6.39k|    if (method->it)
  ------------------
  |  Branch (142:9): [True: 6.39k, False: 0]
  ------------------
  143|  6.39k|        return ASN1_item_d2i(NULL, &p, extlen, ASN1_ITEM_ptr(method->it));
  ------------------
  |  |  421|  6.39k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  144|      0|    return method->d2i(NULL, &p, extlen);
  145|  6.39k|}
X509V3_get_d2i:
  165|  34.0k|{
  166|  34.0k|    int lastpos, i;
  167|  34.0k|    X509_EXTENSION *ex, *found_ex = NULL;
  168|       |
  169|  34.0k|    if (!x) {
  ------------------
  |  Branch (169:9): [True: 11.7k, False: 22.2k]
  ------------------
  170|  11.7k|        if (idx)
  ------------------
  |  Branch (170:13): [True: 0, False: 11.7k]
  ------------------
  171|      0|            *idx = -1;
  172|  11.7k|        if (crit)
  ------------------
  |  Branch (172:13): [True: 11.7k, False: 0]
  ------------------
  173|  11.7k|            *crit = -1;
  174|  11.7k|        return NULL;
  175|  11.7k|    }
  176|  22.2k|    if (idx)
  ------------------
  |  Branch (176:9): [True: 0, False: 22.2k]
  ------------------
  177|      0|        lastpos = *idx + 1;
  178|  22.2k|    else
  179|  22.2k|        lastpos = 0;
  180|  22.2k|    if (lastpos < 0)
  ------------------
  |  Branch (180:9): [True: 0, False: 22.2k]
  ------------------
  181|      0|        lastpos = 0;
  182|  50.0k|    for (i = lastpos; i < sk_X509_EXTENSION_num(x); i++) {
  ------------------
  |  |  227|  50.0k|#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
  ------------------
  |  Branch (182:23): [True: 28.1k, False: 21.9k]
  ------------------
  183|  28.1k|        ex = sk_X509_EXTENSION_value(x, i);
  ------------------
  |  |  228|  28.1k|#define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx)))
  ------------------
  184|  28.1k|        if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) == nid) {
  ------------------
  |  Branch (184:13): [True: 7.12k, False: 20.9k]
  ------------------
  185|  7.12k|            if (idx) {
  ------------------
  |  Branch (185:17): [True: 0, False: 7.12k]
  ------------------
  186|      0|                *idx = i;
  187|      0|                found_ex = ex;
  188|      0|                break;
  189|  7.12k|            } else if (found_ex) {
  ------------------
  |  Branch (189:24): [True: 364, False: 6.76k]
  ------------------
  190|       |                /* Found more than one */
  191|    364|                if (crit)
  ------------------
  |  Branch (191:21): [True: 364, False: 0]
  ------------------
  192|    364|                    *crit = -2;
  193|    364|                return NULL;
  194|    364|            }
  195|  6.76k|            found_ex = ex;
  196|  6.76k|        }
  197|  28.1k|    }
  198|  21.9k|    if (found_ex) {
  ------------------
  |  Branch (198:9): [True: 6.39k, False: 15.5k]
  ------------------
  199|       |        /* Found it */
  200|  6.39k|        if (crit)
  ------------------
  |  Branch (200:13): [True: 6.39k, False: 0]
  ------------------
  201|  6.39k|            *crit = X509_EXTENSION_get_critical(found_ex);
  202|  6.39k|        return X509V3_EXT_d2i(found_ex);
  203|  6.39k|    }
  204|       |
  205|       |    /* Extension not found */
  206|  15.5k|    if (idx)
  ------------------
  |  Branch (206:9): [True: 0, False: 15.5k]
  ------------------
  207|      0|        *idx = -1;
  208|  15.5k|    if (crit)
  ------------------
  |  Branch (208:9): [True: 15.5k, False: 0]
  ------------------
  209|  15.5k|        *crit = -1;
  210|  15.5k|    return NULL;
  211|  21.9k|}
v3_lib.c:ext_cmp:
   41|   123k|{
   42|   123k|    return ((*a)->ext_nid - (*b)->ext_nid);
   43|   123k|}

v3_ncons.c:i2r_NAME_CONSTRAINTS:
  184|    692|{
  185|    692|    NAME_CONSTRAINTS *ncons = a;
  186|    692|    do_i2r_name_constraints(method, ncons->permittedSubtrees,
  187|    692|                            bp, ind, "Permitted");
  188|    692|    if (ncons->permittedSubtrees && ncons->excludedSubtrees)
  ------------------
  |  Branch (188:9): [True: 669, False: 23]
  |  Branch (188:37): [True: 18, False: 651]
  ------------------
  189|     18|        BIO_puts(bp, "\n");
  190|    692|    do_i2r_name_constraints(method, ncons->excludedSubtrees,
  191|    692|                            bp, ind, "Excluded");
  192|    692|    return 1;
  193|    692|}
v3_ncons.c:do_i2r_name_constraints:
  198|  1.38k|{
  199|  1.38k|    GENERAL_SUBTREE *tree;
  200|  1.38k|    int i;
  201|  1.38k|    if (sk_GENERAL_SUBTREE_num(trees) > 0)
  ------------------
  |  |  531|  1.38k|#define sk_GENERAL_SUBTREE_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_SUBTREE_sk_type(sk))
  ------------------
  |  Branch (201:9): [True: 647, False: 737]
  ------------------
  202|    647|        BIO_printf(bp, "%*s%s:\n", ind, "", name);
  203|  2.09k|    for (i = 0; i < sk_GENERAL_SUBTREE_num(trees); i++) {
  ------------------
  |  |  531|  2.09k|#define sk_GENERAL_SUBTREE_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_SUBTREE_sk_type(sk))
  ------------------
  |  Branch (203:17): [True: 712, False: 1.38k]
  ------------------
  204|    712|        if (i > 0)
  ------------------
  |  Branch (204:13): [True: 65, False: 647]
  ------------------
  205|     65|            BIO_puts(bp, "\n");
  206|    712|        tree = sk_GENERAL_SUBTREE_value(trees, i);
  ------------------
  |  |  532|    712|#define sk_GENERAL_SUBTREE_value(sk, idx) ((GENERAL_SUBTREE *)OPENSSL_sk_value(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), (idx)))
  ------------------
  207|    712|        BIO_printf(bp, "%*s", ind + 2, "");
  208|    712|        if (tree->base->type == GEN_IPADD)
  ------------------
  |  |  175|    712|# define GEN_IPADD       7
  ------------------
  |  Branch (208:13): [True: 50, False: 662]
  ------------------
  209|     50|            print_nc_ipadd(bp, tree->base->d.ip);
  210|    662|        else
  211|    662|            GENERAL_NAME_print(bp, tree->base);
  212|    712|    }
  213|  1.38k|    return 1;
  214|  1.38k|}
v3_ncons.c:print_nc_ipadd:
  217|     50|{
  218|       |    /* ip->length should be 8 or 32 and len1 == len2 == 4 or len1 == len2 == 16 */
  219|     50|    int len1 = ip->length >= 16 ? 16 : ip->length >= 4 ? 4 : ip->length;
  ------------------
  |  Branch (219:16): [True: 3, False: 47]
  |  Branch (219:40): [True: 6, False: 41]
  ------------------
  220|     50|    int len2 = ip->length - len1;
  221|     50|    char *ip1 = ossl_ipaddr_to_asc(ip->data, len1);
  222|     50|    char *ip2 = ossl_ipaddr_to_asc(ip->data + len1, len2);
  223|     50|    int ret = ip1 != NULL && ip2 != NULL
  ------------------
  |  Branch (223:15): [True: 50, False: 0]
  |  Branch (223:30): [True: 50, False: 0]
  ------------------
  224|     50|        && BIO_printf(bp, "IP:%s/%s", ip1, ip2) > 0;
  ------------------
  |  Branch (224:12): [True: 50, False: 0]
  ------------------
  225|       |
  226|     50|    OPENSSL_free(ip1);
  ------------------
  |  |  107|     50|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     50|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     50|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  227|     50|    OPENSSL_free(ip2);
  ------------------
  |  |  107|     50|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     50|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     50|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  228|     50|    return ret;
  229|     50|}

v3_pcons.c:i2v_POLICY_CONSTRAINTS:
   46|    443|{
   47|    443|    POLICY_CONSTRAINTS *pcons = a;
   48|    443|    X509V3_add_value_int("Require Explicit Policy",
   49|    443|                         pcons->requireExplicitPolicy, &extlist);
   50|    443|    X509V3_add_value_int("Inhibit Policy Mapping",
   51|    443|                         pcons->inhibitPolicyMapping, &extlist);
   52|    443|    return extlist;
   53|    443|}

v3_pku.c:i2r_PKEY_USAGE_PERIOD:
   39|    223|{
   40|    223|    BIO_printf(out, "%*s", indent, "");
   41|    223|    if (usage->notBefore) {
  ------------------
  |  Branch (41:9): [True: 157, False: 66]
  ------------------
   42|    157|        BIO_write(out, "Not Before: ", 12);
   43|    157|        ASN1_GENERALIZEDTIME_print(out, usage->notBefore);
   44|    157|        if (usage->notAfter)
  ------------------
  |  Branch (44:13): [True: 66, False: 91]
  ------------------
   45|     66|            BIO_write(out, ", ", 2);
   46|    157|    }
   47|    223|    if (usage->notAfter) {
  ------------------
  |  Branch (47:9): [True: 113, False: 110]
  ------------------
   48|    113|        BIO_write(out, "Not After: ", 11);
   49|    113|        ASN1_GENERALIZEDTIME_print(out, usage->notAfter);
   50|    113|    }
   51|    223|    return 1;
   52|    223|}

v3_pmaps.c:i2v_POLICY_MAPPINGS:
   49|    129|{
   50|    129|    POLICY_MAPPINGS *pmaps = a;
   51|    129|    POLICY_MAPPING *pmap;
   52|    129|    int i;
   53|    129|    char obj_tmp1[80];
   54|    129|    char obj_tmp2[80];
   55|       |
   56|    129|    for (i = 0; i < sk_POLICY_MAPPING_num(pmaps); i++) {
  ------------------
  |  |  495|    129|#define sk_POLICY_MAPPING_num(sk) OPENSSL_sk_num(ossl_check_const_POLICY_MAPPING_sk_type(sk))
  ------------------
  |  Branch (56:17): [True: 0, False: 129]
  ------------------
   57|      0|        pmap = sk_POLICY_MAPPING_value(pmaps, i);
  ------------------
  |  |  496|      0|#define sk_POLICY_MAPPING_value(sk, idx) ((POLICY_MAPPING *)OPENSSL_sk_value(ossl_check_const_POLICY_MAPPING_sk_type(sk), (idx)))
  ------------------
   58|      0|        i2t_ASN1_OBJECT(obj_tmp1, 80, pmap->issuerDomainPolicy);
   59|      0|        i2t_ASN1_OBJECT(obj_tmp2, 80, pmap->subjectDomainPolicy);
   60|      0|        X509V3_add_value(obj_tmp1, obj_tmp2, &ext_list);
   61|      0|    }
   62|    129|    return ext_list;
   63|    129|}

X509V3_EXT_val_prn:
   26|  1.92k|{
   27|  1.92k|    int i;
   28|  1.92k|    CONF_VALUE *nval;
   29|  1.92k|    if (!val)
  ------------------
  |  Branch (29:9): [True: 0, False: 1.92k]
  ------------------
   30|      0|        return;
   31|  1.92k|    if (!ml || !sk_CONF_VALUE_num(val)) {
  ------------------
  |  |   45|    712|#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
  ------------------
  |  Branch (31:9): [True: 1.21k, False: 712]
  |  Branch (31:16): [True: 18, False: 694]
  ------------------
   32|  1.23k|        BIO_printf(out, "%*s", indent, "");
   33|  1.23k|        if (!sk_CONF_VALUE_num(val))
  ------------------
  |  |   45|  1.23k|#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
  ------------------
  |  Branch (33:13): [True: 25, False: 1.20k]
  ------------------
   34|     25|            BIO_puts(out, "<EMPTY>\n");
   35|  1.23k|    }
   36|  4.76k|    for (i = 0; i < sk_CONF_VALUE_num(val); i++) {
  ------------------
  |  |   45|  4.76k|#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
  ------------------
  |  Branch (36:17): [True: 2.84k, False: 1.92k]
  ------------------
   37|  2.84k|        if (ml) {
  ------------------
  |  Branch (37:13): [True: 697, False: 2.14k]
  ------------------
   38|    697|            if (i > 0)
  ------------------
  |  Branch (38:17): [True: 3, False: 694]
  ------------------
   39|      3|                BIO_printf(out, "\n");
   40|    697|            BIO_printf(out, "%*s", indent, "");
   41|    697|        }
   42|  2.14k|        else if (i > 0)
  ------------------
  |  Branch (42:18): [True: 942, False: 1.20k]
  ------------------
   43|    942|            BIO_printf(out, ", ");
   44|  2.84k|        nval = sk_CONF_VALUE_value(val, i);
  ------------------
  |  |   46|  2.84k|#define sk_CONF_VALUE_value(sk, idx) ((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type(sk), (idx)))
  ------------------
   45|  2.84k|        if (!nval->name)
  ------------------
  |  Branch (45:13): [True: 317, False: 2.52k]
  ------------------
   46|    317|            BIO_puts(out, nval->value);
   47|  2.52k|        else if (!nval->value)
  ------------------
  |  Branch (47:18): [True: 342, False: 2.18k]
  ------------------
   48|    342|            BIO_puts(out, nval->name);
   49|  2.18k|#ifndef CHARSET_EBCDIC
   50|  2.18k|        else
   51|  2.18k|            BIO_printf(out, "%s:%s", nval->name, nval->value);
   52|       |#else
   53|       |        else {
   54|       |            int len;
   55|       |            char *tmp;
   56|       |            len = strlen(nval->value) + 1;
   57|       |            tmp = OPENSSL_malloc(len);
   58|       |            if (tmp != NULL) {
   59|       |                ascii2ebcdic(tmp, nval->value, len);
   60|       |                BIO_printf(out, "%s:%s", nval->name, tmp);
   61|       |                OPENSSL_free(tmp);
   62|       |            }
   63|       |        }
   64|       |#endif
   65|  2.84k|    }
   66|  1.92k|}
X509V3_EXT_print:
   72|  18.5k|{
   73|  18.5k|    void *ext_str = NULL;
   74|  18.5k|    char *value = NULL;
   75|  18.5k|    ASN1_OCTET_STRING *extoct;
   76|  18.5k|    const unsigned char *p;
   77|  18.5k|    int extlen;
   78|  18.5k|    const X509V3_EXT_METHOD *method;
   79|  18.5k|    STACK_OF(CONF_VALUE) *nval = NULL;
  ------------------
  |  |   31|  18.5k|# define STACK_OF(type) struct stack_st_##type
  ------------------
   80|  18.5k|    int ok = 1;
   81|       |
   82|  18.5k|    extoct = X509_EXTENSION_get_data(ext);
   83|  18.5k|    p = ASN1_STRING_get0_data(extoct);
   84|  18.5k|    extlen = ASN1_STRING_length(extoct);
   85|       |
   86|  18.5k|    if ((method = X509V3_EXT_get(ext)) == NULL)
  ------------------
  |  Branch (86:9): [True: 1.48k, False: 17.1k]
  ------------------
   87|  1.48k|        return unknown_ext_print(out, p, extlen, flag, indent, 0);
   88|  17.1k|    if (method->it)
  ------------------
  |  Branch (88:9): [True: 17.1k, False: 0]
  ------------------
   89|  17.1k|        ext_str = ASN1_item_d2i(NULL, &p, extlen, ASN1_ITEM_ptr(method->it));
  ------------------
  |  |  421|  17.1k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
   90|      0|    else
   91|      0|        ext_str = method->d2i(NULL, &p, extlen);
   92|       |
   93|  17.1k|    if (!ext_str)
  ------------------
  |  Branch (93:9): [True: 3.63k, False: 13.4k]
  ------------------
   94|  3.63k|        return unknown_ext_print(out, p, extlen, flag, indent, 1);
   95|       |
   96|  13.4k|    if (method->i2s) {
  ------------------
  |  Branch (96:9): [True: 188, False: 13.2k]
  ------------------
   97|    188|        if ((value = method->i2s(method, ext_str)) == NULL) {
  ------------------
  |  Branch (97:13): [True: 0, False: 188]
  ------------------
   98|      0|            ok = 0;
   99|      0|            goto err;
  100|      0|        }
  101|    188|#ifndef CHARSET_EBCDIC
  102|    188|        BIO_printf(out, "%*s%s", indent, "", value);
  103|       |#else
  104|       |        {
  105|       |            int len;
  106|       |            char *tmp;
  107|       |            len = strlen(value) + 1;
  108|       |            tmp = OPENSSL_malloc(len);
  109|       |            if (tmp != NULL) {
  110|       |                ascii2ebcdic(tmp, value, len);
  111|       |                BIO_printf(out, "%*s%s", indent, "", tmp);
  112|       |                OPENSSL_free(tmp);
  113|       |            }
  114|       |        }
  115|       |#endif
  116|  13.2k|    } else if (method->i2v) {
  ------------------
  |  Branch (116:16): [True: 2.60k, False: 10.6k]
  ------------------
  117|  2.60k|        if ((nval = method->i2v(method, ext_str, NULL)) == NULL) {
  ------------------
  |  Branch (117:13): [True: 686, False: 1.91k]
  ------------------
  118|    686|            ok = 0;
  119|    686|            goto err;
  120|    686|        }
  121|  1.91k|        X509V3_EXT_val_prn(out, nval, indent,
  122|  1.91k|                           method->ext_flags & X509V3_EXT_MULTILINE);
  ------------------
  |  |  143|  1.91k|# define X509V3_EXT_MULTILINE    0x4
  ------------------
  123|  10.6k|    } else if (method->i2r) {
  ------------------
  |  Branch (123:16): [True: 10.6k, False: 0]
  ------------------
  124|  10.6k|        if (!method->i2r(method, ext_str, out, indent))
  ------------------
  |  Branch (124:13): [True: 1.80k, False: 8.88k]
  ------------------
  125|  1.80k|            ok = 0;
  126|  10.6k|    } else
  127|      0|        ok = 0;
  128|       |
  129|  13.4k| err:
  130|  13.4k|    sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
  ------------------
  |  |   59|  13.4k|#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
  ------------------
  131|  13.4k|    OPENSSL_free(value);
  ------------------
  |  |  107|  13.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  13.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  13.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  132|  13.4k|    if (method->it)
  ------------------
  |  Branch (132:9): [True: 13.4k, False: 0]
  ------------------
  133|  13.4k|        ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it));
  ------------------
  |  |  421|  13.4k|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  134|      0|    else
  135|      0|        method->ext_free(ext_str);
  136|  13.4k|    return ok;
  137|  13.4k|}
v3_prn.c:unknown_ext_print:
  181|  5.11k|{
  182|  5.11k|    switch (flag & X509V3_EXT_UNKNOWN_MASK) {
  ------------------
  |  |  752|  5.11k|# define X509V3_EXT_UNKNOWN_MASK         (0xfL << 16)
  ------------------
  183|       |
  184|  5.11k|    case X509V3_EXT_DEFAULT:
  ------------------
  |  |  754|  5.11k|# define X509V3_EXT_DEFAULT              0
  ------------------
  |  Branch (184:5): [True: 5.11k, False: 0]
  ------------------
  185|  5.11k|        return 0;
  186|       |
  187|      0|    case X509V3_EXT_ERROR_UNKNOWN:
  ------------------
  |  |  756|      0|# define X509V3_EXT_ERROR_UNKNOWN        (1L << 16)
  ------------------
  |  Branch (187:5): [True: 0, False: 5.11k]
  ------------------
  188|      0|        if (supported)
  ------------------
  |  Branch (188:13): [True: 0, False: 0]
  ------------------
  189|      0|            BIO_printf(out, "%*s<Parse Error>", indent, "");
  190|      0|        else
  191|      0|            BIO_printf(out, "%*s<Not Supported>", indent, "");
  192|      0|        return 1;
  193|       |
  194|      0|    case X509V3_EXT_PARSE_UNKNOWN:
  ------------------
  |  |  758|      0|# define X509V3_EXT_PARSE_UNKNOWN        (2L << 16)
  ------------------
  |  Branch (194:5): [True: 0, False: 5.11k]
  ------------------
  195|      0|        return ASN1_parse_dump(out, ext, extlen, indent, -1);
  196|      0|    case X509V3_EXT_DUMP_UNKNOWN:
  ------------------
  |  |  760|      0|# define X509V3_EXT_DUMP_UNKNOWN         (3L << 16)
  ------------------
  |  Branch (196:5): [True: 0, False: 5.11k]
  ------------------
  197|      0|        return BIO_dump_indent(out, (const char *)ext, extlen, indent);
  198|       |
  199|      0|    default:
  ------------------
  |  Branch (199:5): [True: 0, False: 5.11k]
  ------------------
  200|      0|        return 1;
  201|  5.11k|    }
  202|  5.11k|}

i2v_GENERAL_NAMES:
   54|  1.14k|{
   55|  1.14k|    int i;
   56|  1.14k|    GENERAL_NAME *gen;
   57|  1.14k|    STACK_OF(CONF_VALUE) *tmpret = NULL, *origret = ret;
  ------------------
  |  |   31|  1.14k|# define STACK_OF(type) struct stack_st_##type
  ------------------
   58|       |
   59|  2.76k|    for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
  ------------------
  |  |  231|  2.76k|#define sk_GENERAL_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAME_sk_type(sk))
  ------------------
  |  Branch (59:17): [True: 1.71k, False: 1.05k]
  ------------------
   60|  1.71k|        gen = sk_GENERAL_NAME_value(gens, i);
  ------------------
  |  |  232|  1.71k|#define sk_GENERAL_NAME_value(sk, idx) ((GENERAL_NAME *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAME_sk_type(sk), (idx)))
  ------------------
   61|       |        /*
   62|       |         * i2v_GENERAL_NAME allocates ret if it is NULL. If something goes
   63|       |         * wrong we need to free the stack - but only if it was empty when we
   64|       |         * originally entered this function.
   65|       |         */
   66|  1.71k|        tmpret = i2v_GENERAL_NAME(method, gen, ret);
   67|  1.71k|        if (tmpret == NULL) {
  ------------------
  |  Branch (67:13): [True: 94, False: 1.61k]
  ------------------
   68|     94|            if (origret == NULL)
  ------------------
  |  Branch (68:17): [True: 94, False: 0]
  ------------------
   69|     94|                sk_CONF_VALUE_pop_free(ret, X509V3_conf_free);
  ------------------
  |  |   59|     94|#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
  ------------------
   70|     94|            return NULL;
   71|     94|        }
   72|  1.61k|        ret = tmpret;
   73|  1.61k|    }
   74|  1.05k|    if (ret == NULL)
  ------------------
  |  Branch (74:9): [True: 25, False: 1.02k]
  ------------------
   75|     25|        return sk_CONF_VALUE_new_null();
  ------------------
  |  |   48|     25|#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null())
  ------------------
   76|  1.02k|    return ret;
   77|  1.05k|}
i2v_GENERAL_NAME:
   82|  1.72k|{
   83|  1.72k|    char othername[300];
   84|  1.72k|    char oline[256], *tmp;
   85|       |
   86|  1.72k|    switch (gen->type) {
  ------------------
  |  Branch (86:13): [True: 0, False: 1.72k]
  ------------------
   87|     25|    case GEN_OTHERNAME:
  ------------------
  |  |  168|     25|# define GEN_OTHERNAME   0
  ------------------
  |  Branch (87:5): [True: 25, False: 1.69k]
  ------------------
   88|     25|        switch (OBJ_obj2nid(gen->d.otherName->type_id)) {
   89|      0|        case NID_id_on_SmtpUTF8Mailbox:
  ------------------
  |  | 2038|      0|#define NID_id_on_SmtpUTF8Mailbox               1208
  ------------------
  |  Branch (89:9): [True: 0, False: 25]
  ------------------
   90|      0|            if (gen->d.otherName->value->type != V_ASN1_UTF8STRING
  ------------------
  |  |   73|      0|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (90:17): [True: 0, False: 0]
  ------------------
   91|      0|                    || !x509v3_add_len_value_uchar("othername: SmtpUTF8Mailbox:",
  ------------------
  |  Branch (91:24): [True: 0, False: 0]
  ------------------
   92|      0|                            gen->d.otherName->value->value.utf8string->data,
   93|      0|                            gen->d.otherName->value->value.utf8string->length,
   94|      0|                            &ret))
   95|      0|                return NULL;
   96|      0|            break;
   97|      0|        case NID_XmppAddr:
  ------------------
  |  | 2023|      0|#define NID_XmppAddr            1209
  ------------------
  |  Branch (97:9): [True: 0, False: 25]
  ------------------
   98|      0|            if (gen->d.otherName->value->type != V_ASN1_UTF8STRING
  ------------------
  |  |   73|      0|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (98:17): [True: 0, False: 0]
  ------------------
   99|      0|                    || !x509v3_add_len_value_uchar("othername: XmppAddr:",
  ------------------
  |  Branch (99:24): [True: 0, False: 0]
  ------------------
  100|      0|                            gen->d.otherName->value->value.utf8string->data,
  101|      0|                            gen->d.otherName->value->value.utf8string->length,
  102|      0|                            &ret))
  103|      0|                return NULL;
  104|      0|            break;
  105|      0|        case NID_SRVName:
  ------------------
  |  | 2028|      0|#define NID_SRVName             1210
  ------------------
  |  Branch (105:9): [True: 0, False: 25]
  ------------------
  106|      0|            if (gen->d.otherName->value->type != V_ASN1_IA5STRING
  ------------------
  |  |   81|      0|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (106:17): [True: 0, False: 0]
  ------------------
  107|      0|                    || !x509v3_add_len_value_uchar("othername: SRVName:",
  ------------------
  |  Branch (107:24): [True: 0, False: 0]
  ------------------
  108|      0|                            gen->d.otherName->value->value.ia5string->data,
  109|      0|                            gen->d.otherName->value->value.ia5string->length,
  110|      0|                            &ret))
  111|      0|                return NULL;
  112|      0|            break;
  113|      0|        case NID_ms_upn:
  ------------------
  |  | 1367|      0|#define NID_ms_upn              649
  ------------------
  |  Branch (113:9): [True: 0, False: 25]
  ------------------
  114|      0|            if (gen->d.otherName->value->type != V_ASN1_UTF8STRING
  ------------------
  |  |   73|      0|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|      0|                    || !x509v3_add_len_value_uchar("othername: UPN:",
  ------------------
  |  Branch (115:24): [True: 0, False: 0]
  ------------------
  116|      0|                            gen->d.otherName->value->value.utf8string->data,
  117|      0|                            gen->d.otherName->value->value.utf8string->length,
  118|      0|                            &ret))
  119|      0|                return NULL;
  120|      0|            break;
  121|      0|        case NID_NAIRealm:
  ------------------
  |  | 2033|      0|#define NID_NAIRealm            1211
  ------------------
  |  Branch (121:9): [True: 0, False: 25]
  ------------------
  122|      0|            if (gen->d.otherName->value->type != V_ASN1_UTF8STRING
  ------------------
  |  |   73|      0|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (122:17): [True: 0, False: 0]
  ------------------
  123|      0|                    || !x509v3_add_len_value_uchar("othername: NAIRealm:",
  ------------------
  |  Branch (123:24): [True: 0, False: 0]
  ------------------
  124|      0|                            gen->d.otherName->value->value.utf8string->data,
  125|      0|                            gen->d.otherName->value->value.utf8string->length,
  126|      0|                            &ret))
  127|      0|                return NULL;
  128|      0|            break;
  129|     25|        default:
  ------------------
  |  Branch (129:9): [True: 25, False: 0]
  ------------------
  130|     25|            if (OBJ_obj2txt(oline, sizeof(oline), gen->d.otherName->type_id, 0) > 0) 
  ------------------
  |  Branch (130:17): [True: 25, False: 0]
  ------------------
  131|     25|                BIO_snprintf(othername, sizeof(othername), "othername: %s:",
  132|     25|                             oline);
  133|      0|            else
  134|      0|                OPENSSL_strlcpy(othername, "othername:", sizeof(othername));
  135|       |
  136|       |            /* check if the value is something printable */
  137|     25|            if (gen->d.otherName->value->type == V_ASN1_IA5STRING) {
  ------------------
  |  |   81|     25|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (137:17): [True: 6, False: 19]
  ------------------
  138|      6|                if (x509v3_add_len_value_uchar(othername,
  ------------------
  |  Branch (138:21): [True: 6, False: 0]
  ------------------
  139|      6|                             gen->d.otherName->value->value.ia5string->data,
  140|      6|                             gen->d.otherName->value->value.ia5string->length,
  141|      6|                             &ret)) 
  142|      6|                    return ret;
  143|      6|            }
  144|     19|            if (gen->d.otherName->value->type == V_ASN1_UTF8STRING) {
  ------------------
  |  |   73|     19|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (144:17): [True: 1, False: 18]
  ------------------
  145|      1|                if (x509v3_add_len_value_uchar(othername,
  ------------------
  |  Branch (145:21): [True: 1, False: 0]
  ------------------
  146|      1|                             gen->d.otherName->value->value.utf8string->data,
  147|      1|                             gen->d.otherName->value->value.utf8string->length,
  148|      1|                             &ret)) 
  149|      1|                    return ret;
  150|      1|            }
  151|     18|            if (!X509V3_add_value(othername, "<unsupported>", &ret))
  ------------------
  |  Branch (151:17): [True: 0, False: 18]
  ------------------
  152|      0|                return NULL;
  153|     18|            break;
  154|     25|        }
  155|     18|        break;
  156|       |
  157|     70|    case GEN_X400:
  ------------------
  |  |  171|     70|# define GEN_X400        3
  ------------------
  |  Branch (157:5): [True: 70, False: 1.65k]
  ------------------
  158|     70|        if (!X509V3_add_value("X400Name", "<unsupported>", &ret))
  ------------------
  |  Branch (158:13): [True: 0, False: 70]
  ------------------
  159|      0|            return NULL;
  160|     70|        break;
  161|       |
  162|     70|    case GEN_EDIPARTY:
  ------------------
  |  |  173|      0|# define GEN_EDIPARTY    5
  ------------------
  |  Branch (162:5): [True: 0, False: 1.72k]
  ------------------
  163|      0|        if (!X509V3_add_value("EdiPartyName", "<unsupported>", &ret))
  ------------------
  |  Branch (163:13): [True: 0, False: 0]
  ------------------
  164|      0|            return NULL;
  165|      0|        break;
  166|       |
  167|    622|    case GEN_EMAIL:
  ------------------
  |  |  169|    622|# define GEN_EMAIL       1
  ------------------
  |  Branch (167:5): [True: 622, False: 1.09k]
  ------------------
  168|    622|        if (!x509v3_add_len_value_uchar("email", gen->d.ia5->data,
  ------------------
  |  Branch (168:13): [True: 11, False: 611]
  ------------------
  169|    622|                                        gen->d.ia5->length, &ret))
  170|     11|            return NULL;
  171|    611|        break;
  172|       |
  173|    611|    case GEN_DNS:
  ------------------
  |  |  170|     92|# define GEN_DNS         2
  ------------------
  |  Branch (173:5): [True: 92, False: 1.62k]
  ------------------
  174|     92|        if (!x509v3_add_len_value_uchar("DNS", gen->d.ia5->data,
  ------------------
  |  Branch (174:13): [True: 18, False: 74]
  ------------------
  175|     92|                                        gen->d.ia5->length, &ret))
  176|     18|            return NULL;
  177|     74|        break;
  178|       |
  179|    331|    case GEN_URI:
  ------------------
  |  |  174|    331|# define GEN_URI         6
  ------------------
  |  Branch (179:5): [True: 331, False: 1.38k]
  ------------------
  180|    331|        if (!x509v3_add_len_value_uchar("URI", gen->d.ia5->data,
  ------------------
  |  Branch (180:13): [True: 66, False: 265]
  ------------------
  181|    331|                                        gen->d.ia5->length, &ret))
  182|     66|            return NULL;
  183|    265|        break;
  184|       |
  185|    265|    case GEN_DIRNAME:
  ------------------
  |  |  172|     30|# define GEN_DIRNAME     4
  ------------------
  |  Branch (185:5): [True: 30, False: 1.69k]
  ------------------
  186|     30|        if (X509_NAME_oneline(gen->d.dirn, oline, sizeof(oline)) == NULL
  ------------------
  |  Branch (186:13): [True: 0, False: 30]
  ------------------
  187|     30|                || !X509V3_add_value("DirName", oline, &ret))
  ------------------
  |  Branch (187:20): [True: 0, False: 30]
  ------------------
  188|      0|            return NULL;
  189|     30|        break;
  190|       |
  191|    403|    case GEN_IPADD:
  ------------------
  |  |  175|    403|# define GEN_IPADD       7
  ------------------
  |  Branch (191:5): [True: 403, False: 1.31k]
  ------------------
  192|    403|        tmp = ossl_ipaddr_to_asc(gen->d.ip->data, gen->d.ip->length);
  193|    403|        if (tmp == NULL || !X509V3_add_value("IP Address", tmp, &ret))
  ------------------
  |  Branch (193:13): [True: 0, False: 403]
  |  Branch (193:28): [True: 0, False: 403]
  ------------------
  194|      0|            ret = NULL;
  195|    403|        OPENSSL_free(tmp);
  ------------------
  |  |  107|    403|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    403|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    403|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  196|    403|        break;
  197|       |
  198|    147|    case GEN_RID:
  ------------------
  |  |  176|    147|# define GEN_RID         8
  ------------------
  |  Branch (198:5): [True: 147, False: 1.57k]
  ------------------
  199|    147|        i2t_ASN1_OBJECT(oline, 256, gen->d.rid);
  200|    147|        if (!X509V3_add_value("Registered ID", oline, &ret))
  ------------------
  |  Branch (200:13): [True: 0, False: 147]
  ------------------
  201|      0|            return NULL;
  202|    147|        break;
  203|  1.72k|    }
  204|  1.61k|    return ret;
  205|  1.72k|}
GENERAL_NAME_print:
  208|  1.38k|{
  209|  1.38k|    char *tmp;
  210|  1.38k|    int nid;
  211|       |
  212|  1.38k|    switch (gen->type) {
  ------------------
  |  Branch (212:13): [True: 0, False: 1.38k]
  ------------------
  213|      0|    case GEN_OTHERNAME:
  ------------------
  |  |  168|      0|# define GEN_OTHERNAME   0
  ------------------
  |  Branch (213:5): [True: 0, False: 1.38k]
  ------------------
  214|      0|        nid = OBJ_obj2nid(gen->d.otherName->type_id);
  215|       |        /* Validate the types are as we expect before we use them */
  216|      0|        if ((nid == NID_SRVName
  ------------------
  |  | 2028|      0|#define NID_SRVName             1210
  ------------------
  |  Branch (216:14): [True: 0, False: 0]
  ------------------
  217|      0|             && gen->d.otherName->value->type != V_ASN1_IA5STRING)
  ------------------
  |  |   81|      0|# define V_ASN1_IA5STRING                22
  ------------------
  |  Branch (217:17): [True: 0, False: 0]
  ------------------
  218|      0|                || (nid != NID_SRVName
  ------------------
  |  | 2028|      0|#define NID_SRVName             1210
  ------------------
  |  Branch (218:21): [True: 0, False: 0]
  ------------------
  219|      0|                    && gen->d.otherName->value->type != V_ASN1_UTF8STRING)) {
  ------------------
  |  |   73|      0|# define V_ASN1_UTF8STRING               12
  ------------------
  |  Branch (219:24): [True: 0, False: 0]
  ------------------
  220|      0|            BIO_printf(out, "othername:<unsupported>");
  221|      0|            break;
  222|      0|        }
  223|       |
  224|      0|        switch (nid) {
  225|      0|        case NID_id_on_SmtpUTF8Mailbox:
  ------------------
  |  | 2038|      0|#define NID_id_on_SmtpUTF8Mailbox               1208
  ------------------
  |  Branch (225:9): [True: 0, False: 0]
  ------------------
  226|      0|            BIO_printf(out, "othername:SmtpUTF8Mailbox:%.*s",
  227|      0|                       gen->d.otherName->value->value.utf8string->length,
  228|      0|                       gen->d.otherName->value->value.utf8string->data);
  229|      0|            break;
  230|      0|        case NID_XmppAddr:
  ------------------
  |  | 2023|      0|#define NID_XmppAddr            1209
  ------------------
  |  Branch (230:9): [True: 0, False: 0]
  ------------------
  231|      0|            BIO_printf(out, "othername:XmppAddr:%.*s",
  232|      0|                       gen->d.otherName->value->value.utf8string->length,
  233|      0|                       gen->d.otherName->value->value.utf8string->data);
  234|      0|            break;
  235|      0|        case NID_SRVName:
  ------------------
  |  | 2028|      0|#define NID_SRVName             1210
  ------------------
  |  Branch (235:9): [True: 0, False: 0]
  ------------------
  236|      0|            BIO_printf(out, "othername:SRVName:%.*s",
  237|      0|                       gen->d.otherName->value->value.ia5string->length,
  238|      0|                       gen->d.otherName->value->value.ia5string->data);
  239|      0|            break;
  240|      0|        case NID_ms_upn:
  ------------------
  |  | 1367|      0|#define NID_ms_upn              649
  ------------------
  |  Branch (240:9): [True: 0, False: 0]
  ------------------
  241|      0|            BIO_printf(out, "othername:UPN:%.*s",
  242|      0|                       gen->d.otherName->value->value.utf8string->length,
  243|      0|                       gen->d.otherName->value->value.utf8string->data);
  244|      0|            break;
  245|      0|        case NID_NAIRealm:
  ------------------
  |  | 2033|      0|#define NID_NAIRealm            1211
  ------------------
  |  Branch (245:9): [True: 0, False: 0]
  ------------------
  246|      0|            BIO_printf(out, "othername:NAIRealm:%.*s",
  247|      0|                       gen->d.otherName->value->value.utf8string->length,
  248|      0|                       gen->d.otherName->value->value.utf8string->data);
  249|      0|            break;
  250|      0|        default:
  ------------------
  |  Branch (250:9): [True: 0, False: 0]
  ------------------
  251|      0|            BIO_printf(out, "othername:<unsupported>");
  252|      0|            break;
  253|      0|        }
  254|      0|        break;
  255|       |
  256|     10|    case GEN_X400:
  ------------------
  |  |  171|     10|# define GEN_X400        3
  ------------------
  |  Branch (256:5): [True: 10, False: 1.37k]
  ------------------
  257|     10|        BIO_printf(out, "X400Name:<unsupported>");
  258|     10|        break;
  259|       |
  260|      0|    case GEN_EDIPARTY:
  ------------------
  |  |  173|      0|# define GEN_EDIPARTY    5
  ------------------
  |  Branch (260:5): [True: 0, False: 1.38k]
  ------------------
  261|       |        /* Maybe fix this: it is supported now */
  262|      0|        BIO_printf(out, "EdiPartyName:<unsupported>");
  263|      0|        break;
  264|       |
  265|    643|    case GEN_EMAIL:
  ------------------
  |  |  169|    643|# define GEN_EMAIL       1
  ------------------
  |  Branch (265:5): [True: 643, False: 744]
  ------------------
  266|    643|        BIO_printf(out, "email:");
  267|    643|        ASN1_STRING_print(out, gen->d.ia5);
  268|    643|        break;
  269|       |
  270|     26|    case GEN_DNS:
  ------------------
  |  |  170|     26|# define GEN_DNS         2
  ------------------
  |  Branch (270:5): [True: 26, False: 1.36k]
  ------------------
  271|     26|        BIO_printf(out, "DNS:");
  272|     26|        ASN1_STRING_print(out, gen->d.ia5);
  273|     26|        break;
  274|       |
  275|     63|    case GEN_URI:
  ------------------
  |  |  174|     63|# define GEN_URI         6
  ------------------
  |  Branch (275:5): [True: 63, False: 1.32k]
  ------------------
  276|     63|        BIO_printf(out, "URI:");
  277|     63|        ASN1_STRING_print(out, gen->d.ia5);
  278|     63|        break;
  279|       |
  280|    417|    case GEN_DIRNAME:
  ------------------
  |  |  172|    417|# define GEN_DIRNAME     4
  ------------------
  |  Branch (280:5): [True: 417, False: 970]
  ------------------
  281|    417|        BIO_printf(out, "DirName:");
  282|    417|        X509_NAME_print_ex(out, gen->d.dirn, 0, XN_FLAG_ONELINE);
  ------------------
  |  |  350|    417|# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
  |  |  ------------------
  |  |  |  |  515|    417|# define ASN1_STRFLGS_RFC2253    (ASN1_STRFLGS_ESC_2253 | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  440|    417|# define ASN1_STRFLGS_ESC_2253           1
  |  |  |  |  ------------------
  |  |  |  |  516|    417|                                ASN1_STRFLGS_ESC_CTRL | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  441|    417|# define ASN1_STRFLGS_ESC_CTRL           2
  |  |  |  |  ------------------
  |  |  |  |  517|    417|                                ASN1_STRFLGS_ESC_MSB | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|    417|# define ASN1_STRFLGS_ESC_MSB            4
  |  |  |  |  ------------------
  |  |  |  |  518|    417|                                ASN1_STRFLGS_UTF8_CONVERT | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  474|    417|# define ASN1_STRFLGS_UTF8_CONVERT       0x10
  |  |  |  |  ------------------
  |  |  |  |  519|    417|                                ASN1_STRFLGS_DUMP_UNKNOWN | \
  |  |  |  |  ------------------
  |  |  |  |  |  |  496|    417|# define ASN1_STRFLGS_DUMP_UNKNOWN       0x100
  |  |  |  |  ------------------
  |  |  |  |  520|    417|                                ASN1_STRFLGS_DUMP_DER)
  |  |  |  |  ------------------
  |  |  |  |  |  |  503|    417|# define ASN1_STRFLGS_DUMP_DER           0x200
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  351|    417|                        ASN1_STRFLGS_ESC_QUOTE | \
  |  |  ------------------
  |  |  |  |  454|    417|# define ASN1_STRFLGS_ESC_QUOTE          8
  |  |  ------------------
  |  |  352|    417|                        XN_FLAG_SEP_CPLUS_SPC | \
  |  |  ------------------
  |  |  |  |  313|    417|# define XN_FLAG_SEP_CPLUS_SPC   (2 << 16)/* ,+ spaced: more readable */
  |  |  ------------------
  |  |  353|    417|                        XN_FLAG_SPC_EQ | \
  |  |  ------------------
  |  |  |  |  328|    417|# define XN_FLAG_SPC_EQ          (1 << 23)/* Put spaces round '=' */
  |  |  ------------------
  |  |  354|    417|                        XN_FLAG_FN_SN)
  |  |  ------------------
  |  |  |  |  323|    417|# define XN_FLAG_FN_SN           0/* Object short name */
  |  |  ------------------
  ------------------
  283|    417|        break;
  284|       |
  285|     13|    case GEN_IPADD:
  ------------------
  |  |  175|     13|# define GEN_IPADD       7
  ------------------
  |  Branch (285:5): [True: 13, False: 1.37k]
  ------------------
  286|     13|        tmp = ossl_ipaddr_to_asc(gen->d.ip->data, gen->d.ip->length);
  287|     13|        if (tmp == NULL)
  ------------------
  |  Branch (287:13): [True: 0, False: 13]
  ------------------
  288|      0|            return 0;
  289|     13|        BIO_printf(out, "IP Address:%s", tmp);
  290|     13|        OPENSSL_free(tmp);
  ------------------
  |  |  107|     13|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     13|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     13|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  291|     13|        break;
  292|       |
  293|    215|    case GEN_RID:
  ------------------
  |  |  176|    215|# define GEN_RID         8
  ------------------
  |  Branch (293:5): [True: 215, False: 1.17k]
  ------------------
  294|    215|        BIO_printf(out, "Registered ID:");
  295|    215|        i2a_ASN1_OBJECT(out, gen->d.rid);
  296|    215|        break;
  297|  1.38k|    }
  298|  1.38k|    return 1;
  299|  1.38k|}

i2s_ASN1_OCTET_STRING:
   29|    546|{
   30|    546|    return OPENSSL_buf2hexstr(oct->data, oct->length);
   31|    546|}

X509V3_add_value:
   82|  1.89k|{
   83|  1.89k|    return x509v3_add_len_value(name, value,
   84|  1.89k|                                value != NULL ? strlen((const char *)value) : 0,
  ------------------
  |  Branch (84:33): [True: 1.55k, False: 342]
  ------------------
   85|  1.89k|                                extlist);
   86|  1.89k|}
x509v3_add_len_value_uchar:
   98|  1.05k|{
   99|  1.05k|    return x509v3_add_len_value(name, (const char *)value, vallen, extlist);
  100|  1.05k|}
X509V3_conf_free:
  105|  2.85k|{
  106|  2.85k|    if (!conf)
  ------------------
  |  Branch (106:9): [True: 0, False: 2.85k]
  ------------------
  107|      0|        return;
  108|  2.85k|    OPENSSL_free(conf->name);
  ------------------
  |  |  107|  2.85k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.85k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.85k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  109|  2.85k|    OPENSSL_free(conf->value);
  ------------------
  |  |  107|  2.85k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.85k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.85k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  110|  2.85k|    OPENSSL_free(conf->section);
  ------------------
  |  |  107|  2.85k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.85k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.85k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  111|  2.85k|    OPENSSL_free(conf);
  ------------------
  |  |  107|  2.85k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.85k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.85k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  112|  2.85k|}
X509V3_add_value_bool:
  116|     36|{
  117|     36|    if (asn1_bool)
  ------------------
  |  Branch (117:9): [True: 1, False: 35]
  ------------------
  118|      1|        return X509V3_add_value(name, "TRUE", extlist);
  119|     35|    return X509V3_add_value(name, "FALSE", extlist);
  120|     36|}
i2s_ASN1_ENUMERATED:
  167|    110|{
  168|    110|    BIGNUM *bntmp = NULL;
  169|    110|    char *strtmp = NULL;
  170|       |
  171|    110|    if (!a)
  ------------------
  |  Branch (171:9): [True: 0, False: 110]
  ------------------
  172|      0|        return NULL;
  173|    110|    if ((bntmp = ASN1_ENUMERATED_to_BN(a, NULL)) == NULL)
  ------------------
  |  Branch (173:9): [True: 0, False: 110]
  ------------------
  174|    110|        ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  175|    110|    else if ((strtmp = bignum_to_string(bntmp)) == NULL)
  ------------------
  |  Branch (175:14): [True: 0, False: 110]
  ------------------
  176|    110|        ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  177|    110|    BN_free(bntmp);
  178|    110|    return strtmp;
  179|    110|}
i2s_ASN1_INTEGER:
  182|  13.5k|{
  183|  13.5k|    BIGNUM *bntmp = NULL;
  184|  13.5k|    char *strtmp = NULL;
  185|       |
  186|  13.5k|    if (!a)
  ------------------
  |  Branch (186:9): [True: 0, False: 13.5k]
  ------------------
  187|      0|        return NULL;
  188|  13.5k|    if ((bntmp = ASN1_INTEGER_to_BN(a, NULL)) == NULL)
  ------------------
  |  Branch (188:9): [True: 73, False: 13.4k]
  ------------------
  189|  13.5k|        ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|     73|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     73|    (ERR_new(),                                                 \
  |  |  |  |  404|     73|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     73|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     73|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     73|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     73|     ERR_set_error)
  |  |  ------------------
  ------------------
  190|  13.4k|    else if ((strtmp = bignum_to_string(bntmp)) == NULL)
  ------------------
  |  Branch (190:14): [True: 0, False: 13.4k]
  ------------------
  191|  13.4k|        ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  192|  13.5k|    BN_free(bntmp);
  193|  13.5k|    return strtmp;
  194|  13.5k|}
X509V3_add_value_int:
  253|    922|{
  254|    922|    char *strtmp;
  255|    922|    int ret;
  256|       |
  257|    922|    if (!aint)
  ------------------
  |  Branch (257:9): [True: 719, False: 203]
  ------------------
  258|    719|        return 1;
  259|    203|    if ((strtmp = i2s_ASN1_INTEGER(NULL, aint)) == NULL)
  ------------------
  |  Branch (259:9): [True: 0, False: 203]
  ------------------
  260|      0|        return 0;
  261|    203|    ret = X509V3_add_value(name, strtmp, extlist);
  262|    203|    OPENSSL_free(strtmp);
  ------------------
  |  |  107|    203|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    203|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    203|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  263|    203|    return ret;
  264|    203|}
ossl_ipaddr_to_asc:
 1039|    516|{
 1040|       |    /*
 1041|       |     * 40 is enough space for the longest IPv6 address + nul terminator byte
 1042|       |     * XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX\0
 1043|       |     */
 1044|    516|    char buf[40], *out;
 1045|    516|    int i = 0, remain = 0, bytes = 0;
 1046|       |
 1047|    516|    switch (len) {
 1048|    307|    case 4: /* IPv4 */
  ------------------
  |  Branch (1048:5): [True: 307, False: 209]
  ------------------
 1049|    307|        BIO_snprintf(buf, sizeof(buf), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
 1050|    307|        break;
 1051|     10|    case 16: /* IPv6 */
  ------------------
  |  Branch (1051:5): [True: 10, False: 506]
  ------------------
 1052|     10|        for (out = buf, i = 8, remain = sizeof(buf);
 1053|     90|             i-- > 0 && bytes >= 0;
  ------------------
  |  Branch (1053:14): [True: 80, False: 10]
  |  Branch (1053:25): [True: 80, False: 0]
  ------------------
 1054|     80|             remain -= bytes, out += bytes) {
 1055|     80|            const char *template = (i > 0 ? "%X:" : "%X");
  ------------------
  |  Branch (1055:37): [True: 70, False: 10]
  ------------------
 1056|       |
 1057|     80|            bytes = BIO_snprintf(out, remain, template, p[0] << 8 | p[1]);
 1058|     80|            p += 2;
 1059|     80|        }
 1060|     10|        break;
 1061|    199|    default:
  ------------------
  |  Branch (1061:5): [True: 199, False: 317]
  ------------------
 1062|    199|        BIO_snprintf(buf, sizeof(buf), "<invalid length=%d>", len);
 1063|    199|        break;
 1064|    516|    }
 1065|    516|    return OPENSSL_strdup(buf);
  ------------------
  |  |  111|    516|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    516|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    516|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
 1066|    516|}
v3_utl.c:x509v3_add_len_value:
   42|  2.95k|{
   43|  2.95k|    CONF_VALUE *vtmp = NULL;
   44|  2.95k|    char *tname = NULL, *tvalue = NULL;
   45|  2.95k|    int sk_allocated = (*extlist == NULL);
   46|       |
   47|  2.95k|    if (name != NULL && (tname = OPENSSL_strdup(name)) == NULL)
  ------------------
  |  |  111|  2.63k|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.63k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.63k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (47:9): [True: 2.63k, False: 317]
  |  Branch (47:25): [True: 0, False: 2.63k]
  ------------------
   48|      0|        goto err;
   49|  2.95k|    if (value != NULL) {
  ------------------
  |  Branch (49:9): [True: 2.60k, False: 342]
  ------------------
   50|       |        /* We don't allow embedded NUL characters */
   51|  2.60k|        if (memchr(value, 0, vallen) != NULL)
  ------------------
  |  Branch (51:13): [True: 95, False: 2.51k]
  ------------------
   52|     95|            goto err;
   53|  2.51k|        tvalue = OPENSSL_strndup(value, vallen);
  ------------------
  |  |  113|  2.51k|        CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.51k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.51k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   54|  2.51k|        if (tvalue == NULL)
  ------------------
  |  Branch (54:13): [True: 0, False: 2.51k]
  ------------------
   55|      0|            goto err;
   56|  2.51k|    }
   57|  2.85k|    if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL)
  ------------------
  |  |   97|  2.85k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.85k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.85k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (57:9): [True: 0, False: 2.85k]
  ------------------
   58|      0|        goto err;
   59|  2.85k|    if (sk_allocated && (*extlist = sk_CONF_VALUE_new_null()) == NULL) {
  ------------------
  |  |   48|  1.91k|#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null())
  ------------------
  |  Branch (59:9): [True: 1.91k, False: 946]
  |  Branch (59:25): [True: 0, False: 1.91k]
  ------------------
   60|      0|        ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   61|      0|        goto err;
   62|      0|    }
   63|  2.85k|    vtmp->section = NULL;
   64|  2.85k|    vtmp->name = tname;
   65|  2.85k|    vtmp->value = tvalue;
   66|  2.85k|    if (!sk_CONF_VALUE_push(*extlist, vtmp))
  ------------------
  |  |   55|  2.85k|#define sk_CONF_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
  ------------------
  |  Branch (66:9): [True: 0, False: 2.85k]
  ------------------
   67|      0|        goto err;
   68|  2.85k|    return 1;
   69|     95| err:
   70|     95|    if (sk_allocated) {
  ------------------
  |  Branch (70:9): [True: 84, False: 11]
  ------------------
   71|     84|        sk_CONF_VALUE_free(*extlist);
  ------------------
  |  |   51|     84|#define sk_CONF_VALUE_free(sk) OPENSSL_sk_free(ossl_check_CONF_VALUE_sk_type(sk))
  ------------------
   72|     84|        *extlist = NULL;
   73|     84|    }
   74|     95|    OPENSSL_free(vtmp);
  ------------------
  |  |  107|     95|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     95|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     95|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   75|     95|    OPENSSL_free(tname);
  ------------------
  |  |  107|     95|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     95|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     95|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   76|     95|    OPENSSL_free(tvalue);
  ------------------
  |  |  107|     95|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     95|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     95|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|     95|    return 0;
   78|  2.85k|}
v3_utl.c:bignum_to_string:
  131|  13.6k|{
  132|  13.6k|    char *tmp, *ret;
  133|  13.6k|    size_t len;
  134|       |
  135|       |    /*
  136|       |     * Display large numbers in hex and small numbers in decimal. Converting to
  137|       |     * decimal takes quadratic time and is no more useful than hex for large
  138|       |     * numbers.
  139|       |     */
  140|  13.6k|    if (BN_num_bits(bn) < 128)
  ------------------
  |  Branch (140:9): [True: 12.6k, False: 947]
  ------------------
  141|  12.6k|        return BN_bn2dec(bn);
  142|       |
  143|    947|    tmp = BN_bn2hex(bn);
  144|    947|    if (tmp == NULL)
  ------------------
  |  Branch (144:9): [True: 0, False: 947]
  ------------------
  145|      0|        return NULL;
  146|       |
  147|    947|    len = strlen(tmp) + 3;
  148|    947|    ret = OPENSSL_malloc(len);
  ------------------
  |  |   97|    947|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    947|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    947|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  149|    947|    if (ret == NULL) {
  ------------------
  |  Branch (149:9): [True: 0, False: 947]
  ------------------
  150|      0|        OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  151|      0|        return NULL;
  152|      0|    }
  153|       |
  154|       |    /* Prepend "0x", but place it after the "-" if negative. */
  155|    947|    if (tmp[0] == '-') {
  ------------------
  |  Branch (155:9): [True: 394, False: 553]
  ------------------
  156|    394|        OPENSSL_strlcpy(ret, "-0x", len);
  157|    394|        OPENSSL_strlcat(ret, tmp + 1, len);
  158|    553|    } else {
  159|    553|        OPENSSL_strlcpy(ret, "0x", len);
  160|    553|        OPENSSL_strlcat(ret, tmp, len);
  161|    553|    }
  162|    947|    OPENSSL_free(tmp);
  ------------------
  |  |  107|    947|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    947|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    947|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|    947|    return ret;
  164|    947|}

ossl_err_load_X509V3_strings:
  144|      2|{
  145|      2|#ifndef OPENSSL_NO_ERR
  146|      2|    if (ERR_reason_error_string(X509V3_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (146:9): [True: 2, False: 0]
  ------------------
  147|      2|        ERR_load_strings_const(X509V3_str_reasons);
  148|      2|#endif
  149|      2|    return 1;
  150|      2|}

X509_get_default_cert_area:
   21|      2|{
   22|      2|    return X509_CERT_AREA;
  ------------------
  |  |   84|      2|#  define X509_CERT_AREA          OPENSSLDIR
  ------------------
   23|      2|}

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

X509_CRL_get_ext_d2i:
   51|  29.3k|{
   52|  29.3k|    return X509V3_get_d2i(x->crl.extensions, nid, crit, idx);
   53|  29.3k|}
X509_REVOKED_get_ext_d2i:
  151|  4.74k|{
  152|  4.74k|    return X509V3_get_d2i(x->extensions, nid, crit, idx);
  153|  4.74k|}

X509_NAME_oneline:
   26|  2.59k|{
   27|  2.59k|    const X509_NAME_ENTRY *ne;
   28|  2.59k|    int i;
   29|  2.59k|    int n, lold, l, l1, l2, num, j, type;
   30|  2.59k|    int prev_set = -1;
   31|  2.59k|    const char *s;
   32|  2.59k|    char *p;
   33|  2.59k|    unsigned char *q;
   34|  2.59k|    BUF_MEM *b = NULL;
   35|  2.59k|    static const char hex[17] = "0123456789ABCDEF";
   36|  2.59k|    int gs_doit[4];
   37|  2.59k|    char tmp_buf[80];
   38|       |#ifdef CHARSET_EBCDIC
   39|       |    unsigned char ebcdic_buf[1024];
   40|       |#endif
   41|       |
   42|  2.59k|    if (buf == NULL) {
  ------------------
  |  Branch (42:9): [True: 2.56k, False: 30]
  ------------------
   43|  2.56k|        if ((b = BUF_MEM_new()) == NULL)
  ------------------
  |  Branch (43:13): [True: 0, False: 2.56k]
  ------------------
   44|      0|            goto buferr;
   45|  2.56k|        if (!BUF_MEM_grow(b, 200))
  ------------------
  |  Branch (45:13): [True: 0, False: 2.56k]
  ------------------
   46|      0|            goto buferr;
   47|  2.56k|        b->data[0] = '\0';
   48|  2.56k|        len = 200;
   49|  2.56k|    } else if (len == 0) {
  ------------------
  |  Branch (49:16): [True: 0, False: 30]
  ------------------
   50|      0|        return NULL;
   51|      0|    }
   52|  2.59k|    if (a == NULL) {
  ------------------
  |  Branch (52:9): [True: 0, False: 2.59k]
  ------------------
   53|      0|        if (b) {
  ------------------
  |  Branch (53:13): [True: 0, False: 0]
  ------------------
   54|      0|            buf = b->data;
   55|      0|            OPENSSL_free(b);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      0|        }
   57|      0|        strncpy(buf, "NO X509_NAME", len);
   58|      0|        buf[len - 1] = '\0';
   59|      0|        return buf;
   60|      0|    }
   61|       |
   62|  2.59k|    len--;                      /* space for '\0' */
   63|  2.59k|    l = 0;
   64|  87.0k|    for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
  ------------------
  |  |  196|  87.0k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (64:17): [True: 84.5k, False: 2.53k]
  ------------------
   65|  84.5k|        ne = sk_X509_NAME_ENTRY_value(a->entries, i);
  ------------------
  |  |  197|  84.5k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
   66|  84.5k|        n = OBJ_obj2nid(ne->object);
   67|  84.5k|        if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
  ------------------
  |  |   18|  84.5k|#define NID_undef                       0
  ------------------
  |  Branch (67:13): [True: 50.8k, False: 33.6k]
  |  Branch (67:33): [True: 0, False: 33.6k]
  ------------------
   68|  50.8k|            i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
   69|  50.8k|            s = tmp_buf;
   70|  50.8k|        }
   71|  84.5k|        l1 = strlen(s);
   72|       |
   73|  84.5k|        type = ne->value->type;
   74|  84.5k|        num = ne->value->length;
   75|  84.5k|        if (num > NAME_ONELINE_MAX) {
  ------------------
  |  |   23|  84.5k|#define NAME_ONELINE_MAX    (1024 * 1024)
  ------------------
  |  Branch (75:13): [True: 0, False: 84.5k]
  ------------------
   76|      0|            ERR_raise(ERR_LIB_X509, X509_R_NAME_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   77|      0|            goto end;
   78|      0|        }
   79|  84.5k|        q = ne->value->data;
   80|       |#ifdef CHARSET_EBCDIC
   81|       |        if (type == V_ASN1_GENERALSTRING ||
   82|       |            type == V_ASN1_VISIBLESTRING ||
   83|       |            type == V_ASN1_PRINTABLESTRING ||
   84|       |            type == V_ASN1_TELETEXSTRING ||
   85|       |            type == V_ASN1_IA5STRING) {
   86|       |            if (num > (int)sizeof(ebcdic_buf))
   87|       |                num = sizeof(ebcdic_buf);
   88|       |            ascii2ebcdic(ebcdic_buf, q, num);
   89|       |            q = ebcdic_buf;
   90|       |        }
   91|       |#endif
   92|       |
   93|  84.5k|        if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
  ------------------
  |  |   87|  84.5k|# define V_ASN1_GENERALSTRING            27 /**/
  ------------------
  |  Branch (93:13): [True: 0, False: 84.5k]
  |  Branch (93:47): [True: 0, False: 0]
  ------------------
   94|      0|            gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
   95|      0|            for (j = 0; j < num; j++)
  ------------------
  |  Branch (95:25): [True: 0, False: 0]
  ------------------
   96|      0|                if (q[j] != 0)
  ------------------
  |  Branch (96:21): [True: 0, False: 0]
  ------------------
   97|      0|                    gs_doit[j & 3] = 1;
   98|       |
   99|      0|            if (gs_doit[0] | gs_doit[1] | gs_doit[2])
  ------------------
  |  Branch (99:17): [True: 0, False: 0]
  ------------------
  100|      0|                gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
  101|      0|            else {
  102|      0|                gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
  103|      0|                gs_doit[3] = 1;
  104|      0|            }
  105|      0|        } else
  106|  84.5k|            gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
  107|       |
  108|  47.6M|        for (l2 = j = 0; j < num; j++) {
  ------------------
  |  Branch (108:26): [True: 47.5M, False: 84.5k]
  ------------------
  109|  47.5M|            if (!gs_doit[j & 3])
  ------------------
  |  Branch (109:17): [True: 0, False: 47.5M]
  ------------------
  110|      0|                continue;
  111|  47.5M|            l2++;
  112|  47.5M|            if (q[j] == '/' || q[j] == '+')
  ------------------
  |  Branch (112:17): [True: 115k, False: 47.4M]
  |  Branch (112:32): [True: 102k, False: 47.3M]
  ------------------
  113|   217k|                l2++; /* char needs to be escaped */
  114|  47.3M|            else if ((ossl_toascii(q[j]) < ossl_toascii(' ')) ||
  ------------------
  |  |   56|  47.3M|#  define ossl_toascii(c)       (c)
  ------------------
                          else if ((ossl_toascii(q[j]) < ossl_toascii(' ')) ||
  ------------------
  |  |   56|  47.3M|#  define ossl_toascii(c)       (c)
  ------------------
  |  Branch (114:22): [True: 6.27M, False: 41.0M]
  ------------------
  115|  47.3M|                     (ossl_toascii(q[j]) > ossl_toascii('~')))
  ------------------
  |  |   56|  41.0M|#  define ossl_toascii(c)       (c)
  ------------------
                                   (ossl_toascii(q[j]) > ossl_toascii('~')))
  ------------------
  |  |   56|  41.0M|#  define ossl_toascii(c)       (c)
  ------------------
  |  Branch (115:22): [True: 38.4M, False: 2.56M]
  ------------------
  116|  44.7M|                l2 += 3;
  117|  47.5M|        }
  118|       |
  119|  84.5k|        lold = l;
  120|  84.5k|        l += 1 + l1 + 1 + l2;
  121|  84.5k|        if (l > NAME_ONELINE_MAX) {
  ------------------
  |  |   23|  84.5k|#define NAME_ONELINE_MAX    (1024 * 1024)
  ------------------
  |  Branch (121:13): [True: 45, False: 84.4k]
  ------------------
  122|     45|            ERR_raise(ERR_LIB_X509, X509_R_NAME_TOO_LONG);
  ------------------
  |  |  401|     45|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     45|    (ERR_new(),                                                 \
  |  |  |  |  404|     45|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     45|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     45|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     45|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     45|     ERR_set_error)
  |  |  ------------------
  ------------------
  123|     45|            goto end;
  124|     45|        }
  125|  84.4k|        if (b != NULL) {
  ------------------
  |  Branch (125:13): [True: 84.4k, False: 41]
  ------------------
  126|  84.4k|            if (!BUF_MEM_grow(b, l + 1))
  ------------------
  |  Branch (126:17): [True: 0, False: 84.4k]
  ------------------
  127|      0|                goto buferr;
  128|  84.4k|            p = &(b->data[lold]);
  129|  84.4k|        } else if (l > len) {
  ------------------
  |  Branch (129:20): [True: 20, False: 21]
  ------------------
  130|     20|            break;
  131|     20|        } else
  132|     21|            p = &(buf[lold]);
  133|  84.4k|        *(p++) = prev_set == ne->set ? '+' : '/';
  ------------------
  |  Branch (133:18): [True: 83.1k, False: 1.32k]
  ------------------
  134|  84.4k|        memcpy(p, s, (unsigned int)l1);
  135|  84.4k|        p += l1;
  136|  84.4k|        *(p++) = '=';
  137|       |
  138|  84.4k|#ifndef CHARSET_EBCDIC          /* q was assigned above already. */
  139|  84.4k|        q = ne->value->data;
  140|  84.4k|#endif
  141|       |
  142|  15.5M|        for (j = 0; j < num; j++) {
  ------------------
  |  Branch (142:21): [True: 15.4M, False: 84.4k]
  ------------------
  143|  15.4M|            if (!gs_doit[j & 3])
  ------------------
  |  Branch (143:17): [True: 0, False: 15.4M]
  ------------------
  144|      0|                continue;
  145|  15.4M|#ifndef CHARSET_EBCDIC
  146|  15.4M|            n = q[j];
  147|  15.4M|            if ((n < ' ') || (n > '~')) {
  ------------------
  |  Branch (147:17): [True: 3.53M, False: 11.8M]
  |  Branch (147:30): [True: 10.4M, False: 1.45M]
  ------------------
  148|  13.9M|                *(p++) = '\\';
  149|  13.9M|                *(p++) = 'x';
  150|  13.9M|                *(p++) = hex[(n >> 4) & 0x0f];
  151|  13.9M|                *(p++) = hex[n & 0x0f];
  152|  13.9M|            } else {
  153|  1.45M|                if (n == '/' || n == '+')
  ------------------
  |  Branch (153:21): [True: 73.5k, False: 1.38M]
  |  Branch (153:33): [True: 93.6k, False: 1.28M]
  ------------------
  154|   167k|                    *(p++) = '\\';
  155|  1.45M|                *(p++) = n;
  156|  1.45M|            }
  157|       |#else
  158|       |            n = os_toascii[q[j]];
  159|       |            if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
  160|       |                *(p++) = '\\';
  161|       |                *(p++) = 'x';
  162|       |                *(p++) = hex[(n >> 4) & 0x0f];
  163|       |                *(p++) = hex[n & 0x0f];
  164|       |            } else {
  165|       |                if (n == os_toascii['/'] || n == os_toascii['+'])
  166|       |                    *(p++) = '\\';
  167|       |                *(p++) = q[j];
  168|       |            }
  169|       |#endif
  170|  15.4M|        }
  171|  84.4k|        *p = '\0';
  172|  84.4k|        prev_set = ne->set;
  173|  84.4k|    }
  174|  2.55k|    if (b != NULL) {
  ------------------
  |  Branch (174:9): [True: 2.52k, False: 30]
  ------------------
  175|  2.52k|        p = b->data;
  176|  2.52k|        OPENSSL_free(b);
  ------------------
  |  |  107|  2.52k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.52k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.52k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  177|  2.52k|    } else
  178|     30|        p = buf;
  179|  2.55k|    if (i == 0)
  ------------------
  |  Branch (179:9): [True: 1.72k, False: 828]
  ------------------
  180|  1.72k|        *p = '\0';
  181|  2.55k|    return p;
  182|      0| buferr:
  183|      0|    ERR_raise(ERR_LIB_X509, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  184|     45| end:
  185|     45|    BUF_MEM_free(b);
  186|     45|    return NULL;
  187|      0|}

X509_verify_cert_error_string:
   22|    359|{
   23|    359|    switch ((int)n) {
   24|    336|    case X509_V_OK:
  ------------------
  |  |  303|    336|# define X509_V_OK                                       0
  ------------------
  |  Branch (24:5): [True: 336, False: 23]
  ------------------
   25|    336|        return "ok";
   26|      0|    case X509_V_ERR_UNSPECIFIED:
  ------------------
  |  |  304|      0|# define X509_V_ERR_UNSPECIFIED                          1
  ------------------
  |  Branch (26:5): [True: 0, False: 359]
  ------------------
   27|      0|        return "unspecified certificate verification error";
   28|      0|    case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
  ------------------
  |  |  305|      0|# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT            2
  ------------------
  |  Branch (28:5): [True: 0, False: 359]
  ------------------
   29|      0|        return "unable to get issuer certificate";
   30|      0|    case X509_V_ERR_UNABLE_TO_GET_CRL:
  ------------------
  |  |  306|      0|# define X509_V_ERR_UNABLE_TO_GET_CRL                    3
  ------------------
  |  Branch (30:5): [True: 0, False: 359]
  ------------------
   31|      0|        return "unable to get certificate CRL";
   32|      0|    case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE:
  ------------------
  |  |  307|      0|# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE     4
  ------------------
  |  Branch (32:5): [True: 0, False: 359]
  ------------------
   33|      0|        return "unable to decrypt certificate's signature";
   34|      0|    case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE:
  ------------------
  |  |  308|      0|# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE      5
  ------------------
  |  Branch (34:5): [True: 0, False: 359]
  ------------------
   35|      0|        return "unable to decrypt CRL's signature";
   36|      0|    case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
  ------------------
  |  |  309|      0|# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY   6
  ------------------
  |  Branch (36:5): [True: 0, False: 359]
  ------------------
   37|      0|        return "unable to decode issuer public key";
   38|      0|    case X509_V_ERR_CERT_SIGNATURE_FAILURE:
  ------------------
  |  |  310|      0|# define X509_V_ERR_CERT_SIGNATURE_FAILURE               7
  ------------------
  |  Branch (38:5): [True: 0, False: 359]
  ------------------
   39|      0|        return "certificate signature failure";
   40|      0|    case X509_V_ERR_CRL_SIGNATURE_FAILURE:
  ------------------
  |  |  311|      0|# define X509_V_ERR_CRL_SIGNATURE_FAILURE                8
  ------------------
  |  Branch (40:5): [True: 0, False: 359]
  ------------------
   41|      0|        return "CRL signature failure";
   42|      0|    case X509_V_ERR_CERT_NOT_YET_VALID:
  ------------------
  |  |  312|      0|# define X509_V_ERR_CERT_NOT_YET_VALID                   9
  ------------------
  |  Branch (42:5): [True: 0, False: 359]
  ------------------
   43|      0|        return "certificate is not yet valid";
   44|      0|    case X509_V_ERR_CERT_HAS_EXPIRED:
  ------------------
  |  |  313|      0|# define X509_V_ERR_CERT_HAS_EXPIRED                     10
  ------------------
  |  Branch (44:5): [True: 0, False: 359]
  ------------------
   45|      0|        return "certificate has expired";
   46|      0|    case X509_V_ERR_CRL_NOT_YET_VALID:
  ------------------
  |  |  314|      0|# define X509_V_ERR_CRL_NOT_YET_VALID                    11
  ------------------
  |  Branch (46:5): [True: 0, False: 359]
  ------------------
   47|      0|        return "CRL is not yet valid";
   48|      0|    case X509_V_ERR_CRL_HAS_EXPIRED:
  ------------------
  |  |  315|      0|# define X509_V_ERR_CRL_HAS_EXPIRED                      12
  ------------------
  |  Branch (48:5): [True: 0, False: 359]
  ------------------
   49|      0|        return "CRL has expired";
   50|      0|    case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
  ------------------
  |  |  316|      0|# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD       13
  ------------------
  |  Branch (50:5): [True: 0, False: 359]
  ------------------
   51|      0|        return "format error in certificate's notBefore field";
   52|      0|    case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
  ------------------
  |  |  317|      0|# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD        14
  ------------------
  |  Branch (52:5): [True: 0, False: 359]
  ------------------
   53|      0|        return "format error in certificate's notAfter field";
   54|      0|    case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD:
  ------------------
  |  |  318|      0|# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD       15
  ------------------
  |  Branch (54:5): [True: 0, False: 359]
  ------------------
   55|      0|        return "format error in CRL's lastUpdate field";
   56|      0|    case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD:
  ------------------
  |  |  319|      0|# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD       16
  ------------------
  |  Branch (56:5): [True: 0, False: 359]
  ------------------
   57|      0|        return "format error in CRL's nextUpdate field";
   58|      0|    case X509_V_ERR_OUT_OF_MEM:
  ------------------
  |  |  320|      0|# define X509_V_ERR_OUT_OF_MEM                           17
  ------------------
  |  Branch (58:5): [True: 0, False: 359]
  ------------------
   59|      0|        return "out of memory";
   60|      0|    case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
  ------------------
  |  |  321|      0|# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT          18
  ------------------
  |  Branch (60:5): [True: 0, False: 359]
  ------------------
   61|      0|        return "self-signed certificate";
   62|      0|    case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
  ------------------
  |  |  322|      0|# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN            19
  ------------------
  |  Branch (62:5): [True: 0, False: 359]
  ------------------
   63|      0|        return "self-signed certificate in certificate chain";
   64|      0|    case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
  ------------------
  |  |  323|      0|# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY    20
  ------------------
  |  Branch (64:5): [True: 0, False: 359]
  ------------------
   65|      0|        return "unable to get local issuer certificate";
   66|      0|    case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
  ------------------
  |  |  324|      0|# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE      21
  ------------------
  |  Branch (66:5): [True: 0, False: 359]
  ------------------
   67|      0|        return "unable to verify the first certificate";
   68|      0|    case X509_V_ERR_CERT_CHAIN_TOO_LONG:
  ------------------
  |  |  325|      0|# define X509_V_ERR_CERT_CHAIN_TOO_LONG                  22
  ------------------
  |  Branch (68:5): [True: 0, False: 359]
  ------------------
   69|      0|        return "certificate chain too long";
   70|      0|    case X509_V_ERR_CERT_REVOKED:
  ------------------
  |  |  326|      0|# define X509_V_ERR_CERT_REVOKED                         23
  ------------------
  |  Branch (70:5): [True: 0, False: 359]
  ------------------
   71|      0|        return "certificate revoked";
   72|      0|    case X509_V_ERR_NO_ISSUER_PUBLIC_KEY:
  ------------------
  |  |  327|      0|# define X509_V_ERR_NO_ISSUER_PUBLIC_KEY                 24
  ------------------
  |  Branch (72:5): [True: 0, False: 359]
  ------------------
   73|      0|        return "issuer certificate doesn't have a public key";
   74|      0|    case X509_V_ERR_PATH_LENGTH_EXCEEDED:
  ------------------
  |  |  328|      0|# define X509_V_ERR_PATH_LENGTH_EXCEEDED                 25
  ------------------
  |  Branch (74:5): [True: 0, False: 359]
  ------------------
   75|      0|        return "path length constraint exceeded";
   76|      0|    case X509_V_ERR_INVALID_PURPOSE:
  ------------------
  |  |  329|      0|# define X509_V_ERR_INVALID_PURPOSE                      26
  ------------------
  |  Branch (76:5): [True: 0, False: 359]
  ------------------
   77|      0|        return "unsuitable certificate purpose";
   78|      0|    case X509_V_ERR_CERT_UNTRUSTED:
  ------------------
  |  |  330|      0|# define X509_V_ERR_CERT_UNTRUSTED                       27
  ------------------
  |  Branch (78:5): [True: 0, False: 359]
  ------------------
   79|      0|        return "certificate not trusted";
   80|      0|    case X509_V_ERR_CERT_REJECTED:
  ------------------
  |  |  331|      0|# define X509_V_ERR_CERT_REJECTED                        28
  ------------------
  |  Branch (80:5): [True: 0, False: 359]
  ------------------
   81|      0|        return "certificate rejected";
   82|      0|    case X509_V_ERR_SUBJECT_ISSUER_MISMATCH:
  ------------------
  |  |  334|      0|# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH              29
  ------------------
  |  Branch (82:5): [True: 0, False: 359]
  ------------------
   83|      0|        return "subject issuer mismatch";
   84|      0|    case X509_V_ERR_AKID_SKID_MISMATCH:
  ------------------
  |  |  335|      0|# define X509_V_ERR_AKID_SKID_MISMATCH                   30
  ------------------
  |  Branch (84:5): [True: 0, False: 359]
  ------------------
   85|      0|        return "authority and subject key identifier mismatch";
   86|      0|    case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH:
  ------------------
  |  |  336|      0|# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH          31
  ------------------
  |  Branch (86:5): [True: 0, False: 359]
  ------------------
   87|      0|        return "authority and issuer serial number mismatch";
   88|      0|    case X509_V_ERR_KEYUSAGE_NO_CERTSIGN:
  ------------------
  |  |  337|      0|# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN                 32
  ------------------
  |  Branch (88:5): [True: 0, False: 359]
  ------------------
   89|      0|        return "key usage does not include certificate signing";
   90|      0|    case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER:
  ------------------
  |  |  338|      0|# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER             33
  ------------------
  |  Branch (90:5): [True: 0, False: 359]
  ------------------
   91|      0|        return "unable to get CRL issuer certificate";
   92|      0|    case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION:
  ------------------
  |  |  339|      0|# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION         34
  ------------------
  |  Branch (92:5): [True: 0, False: 359]
  ------------------
   93|      0|        return "unhandled critical extension";
   94|      1|    case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN:
  ------------------
  |  |  340|      1|# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN                 35
  ------------------
  |  Branch (94:5): [True: 1, False: 358]
  ------------------
   95|      1|        return "key usage does not include CRL signing";
   96|      0|    case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION:
  ------------------
  |  |  341|      0|# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION     36
  ------------------
  |  Branch (96:5): [True: 0, False: 359]
  ------------------
   97|      0|        return "unhandled critical CRL extension";
   98|      0|    case X509_V_ERR_INVALID_NON_CA:
  ------------------
  |  |  342|      0|# define X509_V_ERR_INVALID_NON_CA                       37
  ------------------
  |  Branch (98:5): [True: 0, False: 359]
  ------------------
   99|      0|        return "invalid non-CA certificate (has CA markings)";
  100|      0|    case X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED:
  ------------------
  |  |  343|      0|# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED           38
  ------------------
  |  Branch (100:5): [True: 0, False: 359]
  ------------------
  101|      0|        return "proxy path length constraint exceeded";
  102|      0|    case X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE:
  ------------------
  |  |  344|      0|# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE        39
  ------------------
  |  Branch (102:5): [True: 0, False: 359]
  ------------------
  103|      0|        return "key usage does not include digital signature";
  104|      0|    case X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED:
  ------------------
  |  |  345|      0|# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED       40
  ------------------
  |  Branch (104:5): [True: 0, False: 359]
  ------------------
  105|      0|        return
  106|      0|            "proxy certificates not allowed, please set the appropriate flag";
  107|      0|    case X509_V_ERR_INVALID_EXTENSION:
  ------------------
  |  |  346|      0|# define X509_V_ERR_INVALID_EXTENSION                    41
  ------------------
  |  Branch (107:5): [True: 0, False: 359]
  ------------------
  108|      0|        return "invalid or inconsistent certificate extension";
  109|      0|    case X509_V_ERR_INVALID_POLICY_EXTENSION:
  ------------------
  |  |  347|      0|# define X509_V_ERR_INVALID_POLICY_EXTENSION             42
  ------------------
  |  Branch (109:5): [True: 0, False: 359]
  ------------------
  110|      0|        return "invalid or inconsistent certificate policy extension";
  111|      0|    case X509_V_ERR_NO_EXPLICIT_POLICY:
  ------------------
  |  |  348|      0|# define X509_V_ERR_NO_EXPLICIT_POLICY                   43
  ------------------
  |  Branch (111:5): [True: 0, False: 359]
  ------------------
  112|      0|        return "no explicit policy";
  113|      0|    case X509_V_ERR_DIFFERENT_CRL_SCOPE:
  ------------------
  |  |  349|      0|# define X509_V_ERR_DIFFERENT_CRL_SCOPE                  44
  ------------------
  |  Branch (113:5): [True: 0, False: 359]
  ------------------
  114|      0|        return "different CRL scope";
  115|      0|    case X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE:
  ------------------
  |  |  350|      0|# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE        45
  ------------------
  |  Branch (115:5): [True: 0, False: 359]
  ------------------
  116|      0|        return "unsupported extension feature";
  117|      0|    case X509_V_ERR_UNNESTED_RESOURCE:
  ------------------
  |  |  351|      0|# define X509_V_ERR_UNNESTED_RESOURCE                    46
  ------------------
  |  Branch (117:5): [True: 0, False: 359]
  ------------------
  118|      0|        return "RFC 3779 resource not subset of parent's resources";
  119|      0|    case X509_V_ERR_PERMITTED_VIOLATION:
  ------------------
  |  |  352|      0|# define X509_V_ERR_PERMITTED_VIOLATION                  47
  ------------------
  |  Branch (119:5): [True: 0, False: 359]
  ------------------
  120|      0|        return "permitted subtree violation";
  121|      0|    case X509_V_ERR_EXCLUDED_VIOLATION:
  ------------------
  |  |  353|      0|# define X509_V_ERR_EXCLUDED_VIOLATION                   48
  ------------------
  |  Branch (121:5): [True: 0, False: 359]
  ------------------
  122|      0|        return "excluded subtree violation";
  123|      0|    case X509_V_ERR_SUBTREE_MINMAX:
  ------------------
  |  |  354|      0|# define X509_V_ERR_SUBTREE_MINMAX                       49
  ------------------
  |  Branch (123:5): [True: 0, False: 359]
  ------------------
  124|      0|        return "name constraints minimum and maximum not supported";
  125|      0|    case X509_V_ERR_APPLICATION_VERIFICATION:
  ------------------
  |  |  356|      0|# define X509_V_ERR_APPLICATION_VERIFICATION             50
  ------------------
  |  Branch (125:5): [True: 0, False: 359]
  ------------------
  126|      0|        return "application verification failure";
  127|      0|    case X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE:
  ------------------
  |  |  357|      0|# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE          51
  ------------------
  |  Branch (127:5): [True: 0, False: 359]
  ------------------
  128|      0|        return "unsupported name constraint type";
  129|      0|    case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX:
  ------------------
  |  |  358|      0|# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX        52
  ------------------
  |  Branch (129:5): [True: 0, False: 359]
  ------------------
  130|      0|        return "unsupported or invalid name constraint syntax";
  131|      0|    case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX:
  ------------------
  |  |  359|      0|# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX              53
  ------------------
  |  Branch (131:5): [True: 0, False: 359]
  ------------------
  132|      0|        return "unsupported or invalid name syntax";
  133|      0|    case X509_V_ERR_CRL_PATH_VALIDATION_ERROR:
  ------------------
  |  |  360|      0|# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR            54
  ------------------
  |  Branch (133:5): [True: 0, False: 359]
  ------------------
  134|      0|        return "CRL path validation error";
  135|      0|    case X509_V_ERR_PATH_LOOP:
  ------------------
  |  |  362|      0|# define X509_V_ERR_PATH_LOOP                            55
  ------------------
  |  Branch (135:5): [True: 0, False: 359]
  ------------------
  136|      0|        return "path loop";
  137|      0|    case X509_V_ERR_SUITE_B_INVALID_VERSION:
  ------------------
  |  |  364|      0|# define X509_V_ERR_SUITE_B_INVALID_VERSION              56
  ------------------
  |  Branch (137:5): [True: 0, False: 359]
  ------------------
  138|      0|        return "Suite B: certificate version invalid";
  139|      0|    case X509_V_ERR_SUITE_B_INVALID_ALGORITHM:
  ------------------
  |  |  365|      0|# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM            57
  ------------------
  |  Branch (139:5): [True: 0, False: 359]
  ------------------
  140|      0|        return "Suite B: invalid public key algorithm";
  141|      0|    case X509_V_ERR_SUITE_B_INVALID_CURVE:
  ------------------
  |  |  366|      0|# define X509_V_ERR_SUITE_B_INVALID_CURVE                58
  ------------------
  |  Branch (141:5): [True: 0, False: 359]
  ------------------
  142|      0|        return "Suite B: invalid ECC curve";
  143|      0|    case X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM:
  ------------------
  |  |  367|      0|# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM  59
  ------------------
  |  Branch (143:5): [True: 0, False: 359]
  ------------------
  144|      0|        return "Suite B: invalid signature algorithm";
  145|      0|    case X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED:
  ------------------
  |  |  368|      0|# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED              60
  ------------------
  |  Branch (145:5): [True: 0, False: 359]
  ------------------
  146|      0|        return "Suite B: curve not allowed for this LOS";
  147|      0|    case X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256:
  ------------------
  |  |  369|      0|# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61
  ------------------
  |  Branch (147:5): [True: 0, False: 359]
  ------------------
  148|      0|        return "Suite B: cannot sign P-384 with P-256";
  149|      0|    case X509_V_ERR_HOSTNAME_MISMATCH:
  ------------------
  |  |  371|      0|# define X509_V_ERR_HOSTNAME_MISMATCH                    62
  ------------------
  |  Branch (149:5): [True: 0, False: 359]
  ------------------
  150|      0|        return "hostname mismatch";
  151|      0|    case X509_V_ERR_EMAIL_MISMATCH:
  ------------------
  |  |  372|      0|# define X509_V_ERR_EMAIL_MISMATCH                       63
  ------------------
  |  Branch (151:5): [True: 0, False: 359]
  ------------------
  152|      0|        return "email address mismatch";
  153|      0|    case X509_V_ERR_IP_ADDRESS_MISMATCH:
  ------------------
  |  |  373|      0|# define X509_V_ERR_IP_ADDRESS_MISMATCH                  64
  ------------------
  |  Branch (153:5): [True: 0, False: 359]
  ------------------
  154|      0|        return "IP address mismatch";
  155|      0|    case X509_V_ERR_DANE_NO_MATCH:
  ------------------
  |  |  375|      0|# define X509_V_ERR_DANE_NO_MATCH                        65
  ------------------
  |  Branch (155:5): [True: 0, False: 359]
  ------------------
  156|      0|        return "no matching DANE TLSA records";
  157|      0|    case X509_V_ERR_EE_KEY_TOO_SMALL:
  ------------------
  |  |  377|      0|# define X509_V_ERR_EE_KEY_TOO_SMALL                     66
  ------------------
  |  Branch (157:5): [True: 0, False: 359]
  ------------------
  158|      0|        return "EE certificate key too weak";
  159|      0|    case X509_V_ERR_CA_KEY_TOO_SMALL:
  ------------------
  |  |  378|      0|# define X509_V_ERR_CA_KEY_TOO_SMALL                     67
  ------------------
  |  Branch (159:5): [True: 0, False: 359]
  ------------------
  160|      0|        return "CA certificate key too weak";
  161|      0|    case X509_V_ERR_CA_MD_TOO_WEAK:
  ------------------
  |  |  379|      0|# define X509_V_ERR_CA_MD_TOO_WEAK                       68
  ------------------
  |  Branch (161:5): [True: 0, False: 359]
  ------------------
  162|      0|        return "CA signature digest algorithm too weak";
  163|      0|    case X509_V_ERR_INVALID_CALL:
  ------------------
  |  |  381|      0|# define X509_V_ERR_INVALID_CALL                         69
  ------------------
  |  Branch (163:5): [True: 0, False: 359]
  ------------------
  164|      0|        return "invalid certificate verification context";
  165|      0|    case X509_V_ERR_STORE_LOOKUP:
  ------------------
  |  |  383|      0|# define X509_V_ERR_STORE_LOOKUP                         70
  ------------------
  |  Branch (165:5): [True: 0, False: 359]
  ------------------
  166|      0|        return "issuer certificate lookup error";
  167|      0|    case X509_V_ERR_NO_VALID_SCTS:
  ------------------
  |  |  385|      0|# define X509_V_ERR_NO_VALID_SCTS                        71
  ------------------
  |  Branch (167:5): [True: 0, False: 359]
  ------------------
  168|      0|        return "Certificate Transparency required, but no valid SCTs found";
  169|      0|    case X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION:
  ------------------
  |  |  387|      0|# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION         72
  ------------------
  |  Branch (169:5): [True: 0, False: 359]
  ------------------
  170|      0|        return "proxy subject name violation";
  171|      0|    case X509_V_ERR_OCSP_VERIFY_NEEDED:
  ------------------
  |  |  389|      0|# define X509_V_ERR_OCSP_VERIFY_NEEDED                   73  /* Need OCSP verification */
  ------------------
  |  Branch (171:5): [True: 0, False: 359]
  ------------------
  172|      0|        return "OCSP verification needed";
  173|      0|    case X509_V_ERR_OCSP_VERIFY_FAILED:
  ------------------
  |  |  390|      0|# define X509_V_ERR_OCSP_VERIFY_FAILED                   74  /* Couldn't verify cert through OCSP */
  ------------------
  |  Branch (173:5): [True: 0, False: 359]
  ------------------
  174|      0|        return "OCSP verification failed";
  175|      0|    case X509_V_ERR_OCSP_CERT_UNKNOWN:
  ------------------
  |  |  391|      0|# define X509_V_ERR_OCSP_CERT_UNKNOWN                    75  /* Certificate wasn't recognized by the OCSP responder */
  ------------------
  |  Branch (175:5): [True: 0, False: 359]
  ------------------
  176|      0|        return "OCSP unknown cert";
  177|      0|    case X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM:
  ------------------
  |  |  393|      0|# define X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM      76
  ------------------
  |  Branch (177:5): [True: 0, False: 359]
  ------------------
  178|      0|        return "Cannot find certificate signature algorithm";
  179|      0|    case X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH:
  ------------------
  |  |  394|      0|# define X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH         77
  ------------------
  |  Branch (179:5): [True: 0, False: 359]
  ------------------
  180|      0|        return "subject signature algorithm and issuer public key algorithm mismatch";
  181|      0|    case X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY:
  ------------------
  |  |  397|      0|# define X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY    78
  ------------------
  |  Branch (181:5): [True: 0, False: 359]
  ------------------
  182|      0|        return "cert info signature and signature algorithm mismatch";
  183|      0|    case X509_V_ERR_INVALID_CA:
  ------------------
  |  |  398|      0|# define X509_V_ERR_INVALID_CA                           79
  ------------------
  |  Branch (183:5): [True: 0, False: 359]
  ------------------
  184|      0|        return "invalid CA certificate";
  185|      0|    case X509_V_ERR_PATHLEN_INVALID_FOR_NON_CA:
  ------------------
  |  |  399|      0|# define X509_V_ERR_PATHLEN_INVALID_FOR_NON_CA           80
  ------------------
  |  Branch (185:5): [True: 0, False: 359]
  ------------------
  186|      0|        return "Path length invalid for non-CA cert";
  187|      0|    case X509_V_ERR_PATHLEN_WITHOUT_KU_KEY_CERT_SIGN:
  ------------------
  |  |  400|      0|# define X509_V_ERR_PATHLEN_WITHOUT_KU_KEY_CERT_SIGN     81
  ------------------
  |  Branch (187:5): [True: 0, False: 359]
  ------------------
  188|      0|        return "Path length given without key usage keyCertSign";
  189|      0|    case X509_V_ERR_KU_KEY_CERT_SIGN_INVALID_FOR_NON_CA:
  ------------------
  |  |  401|      0|# define X509_V_ERR_KU_KEY_CERT_SIGN_INVALID_FOR_NON_CA  82
  ------------------
  |  Branch (189:5): [True: 0, False: 359]
  ------------------
  190|      0|        return "Key usage keyCertSign invalid for non-CA cert";
  191|      0|    case X509_V_ERR_ISSUER_NAME_EMPTY:
  ------------------
  |  |  402|      0|# define X509_V_ERR_ISSUER_NAME_EMPTY                    83
  ------------------
  |  Branch (191:5): [True: 0, False: 359]
  ------------------
  192|      0|        return "Issuer name empty";
  193|      0|    case X509_V_ERR_SUBJECT_NAME_EMPTY:
  ------------------
  |  |  403|      0|# define X509_V_ERR_SUBJECT_NAME_EMPTY                   84
  ------------------
  |  Branch (193:5): [True: 0, False: 359]
  ------------------
  194|      0|        return "Subject name empty";
  195|      0|    case X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER:
  ------------------
  |  |  404|      0|# define X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER     85
  ------------------
  |  Branch (195:5): [True: 0, False: 359]
  ------------------
  196|      0|        return "Missing Authority Key Identifier";
  197|      0|    case X509_V_ERR_MISSING_SUBJECT_KEY_IDENTIFIER:
  ------------------
  |  |  405|      0|# define X509_V_ERR_MISSING_SUBJECT_KEY_IDENTIFIER       86
  ------------------
  |  Branch (197:5): [True: 0, False: 359]
  ------------------
  198|      0|        return "Missing Subject Key Identifier";
  199|      0|    case X509_V_ERR_EMPTY_SUBJECT_ALT_NAME:
  ------------------
  |  |  406|      0|# define X509_V_ERR_EMPTY_SUBJECT_ALT_NAME               87
  ------------------
  |  Branch (199:5): [True: 0, False: 359]
  ------------------
  200|      0|        return "Empty Subject Alternative Name extension";
  201|      0|    case X509_V_ERR_CA_BCONS_NOT_CRITICAL:
  ------------------
  |  |  408|      0|# define X509_V_ERR_CA_BCONS_NOT_CRITICAL                89
  ------------------
  |  Branch (201:5): [True: 0, False: 359]
  ------------------
  202|      0|        return "Basic Constraints of CA cert not marked critical";
  203|      0|    case X509_V_ERR_EMPTY_SUBJECT_SAN_NOT_CRITICAL:
  ------------------
  |  |  407|      0|# define X509_V_ERR_EMPTY_SUBJECT_SAN_NOT_CRITICAL       88
  ------------------
  |  Branch (203:5): [True: 0, False: 359]
  ------------------
  204|      0|        return "Subject empty and Subject Alt Name extension not critical";
  205|      0|    case X509_V_ERR_AUTHORITY_KEY_IDENTIFIER_CRITICAL:
  ------------------
  |  |  409|      0|# define X509_V_ERR_AUTHORITY_KEY_IDENTIFIER_CRITICAL    90
  ------------------
  |  Branch (205:5): [True: 0, False: 359]
  ------------------
  206|      0|        return "Authority Key Identifier marked critical";
  207|      0|    case X509_V_ERR_SUBJECT_KEY_IDENTIFIER_CRITICAL:
  ------------------
  |  |  410|      0|# define X509_V_ERR_SUBJECT_KEY_IDENTIFIER_CRITICAL      91
  ------------------
  |  Branch (207:5): [True: 0, False: 359]
  ------------------
  208|      0|        return "Subject Key Identifier marked critical";
  209|      0|    case X509_V_ERR_CA_CERT_MISSING_KEY_USAGE:
  ------------------
  |  |  411|      0|# define X509_V_ERR_CA_CERT_MISSING_KEY_USAGE            92
  ------------------
  |  Branch (209:5): [True: 0, False: 359]
  ------------------
  210|      0|        return "CA cert does not include key usage extension";
  211|      0|    case X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3:
  ------------------
  |  |  412|      0|# define X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3         93
  ------------------
  |  Branch (211:5): [True: 0, False: 359]
  ------------------
  212|      0|        return "Using cert extension requires at least X509v3";
  213|      0|    case X509_V_ERR_EC_KEY_EXPLICIT_PARAMS:
  ------------------
  |  |  413|      0|# define X509_V_ERR_EC_KEY_EXPLICIT_PARAMS               94
  ------------------
  |  Branch (213:5): [True: 0, False: 359]
  ------------------
  214|      0|        return "Certificate public key has explicit ECC parameters";
  215|      0|    case X509_V_ERR_RPK_UNTRUSTED:
  ------------------
  |  |  414|      0|# define X509_V_ERR_RPK_UNTRUSTED                        95
  ------------------
  |  Branch (215:5): [True: 0, False: 359]
  ------------------
  216|      0|        return "Raw public key untrusted, no trusted keys configured";
  217|       |
  218|       |        /*
  219|       |         * Entries must be kept consistent with include/openssl/x509_vfy.h.in
  220|       |         * and with doc/man3/X509_STORE_CTX_get_error.pod
  221|       |         */
  222|       |
  223|     22|    default:
  ------------------
  |  Branch (223:5): [True: 22, False: 337]
  ------------------
  224|       |        /* Printing an error number into a static buffer is not thread-safe */
  225|     22|        return "unknown certificate verification error";
  226|    359|    }
  227|    359|}

X509v3_get_ext_count:
   21|    714|{
   22|    714|    int ret;
   23|       |
   24|    714|    if (x == NULL)
  ------------------
  |  Branch (24:9): [True: 24, False: 690]
  ------------------
   25|     24|        return 0;
   26|    690|    ret = sk_X509_EXTENSION_num(x);
  ------------------
  |  |  227|    690|#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
  ------------------
   27|    690|    return ret > 0 ? ret : 0;
  ------------------
  |  Branch (27:12): [True: 689, False: 1]
  ------------------
   28|    714|}
X509v3_get_ext:
   82|  18.5k|{
   83|  18.5k|    if (x == NULL || sk_X509_EXTENSION_num(x) <= loc || loc < 0)
  ------------------
  |  |  227|  18.5k|#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
  ------------------
  |  Branch (83:9): [True: 0, False: 18.5k]
  |  Branch (83:22): [True: 0, False: 18.5k]
  |  Branch (83:57): [True: 0, False: 18.5k]
  ------------------
   84|      0|        return NULL;
   85|  18.5k|    else
   86|  18.5k|        return sk_X509_EXTENSION_value(x, loc);
  ------------------
  |  |  228|  18.5k|#define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx)))
  ------------------
   87|  18.5k|}
X509_EXTENSION_get_object:
  221|  78.4k|{
  222|  78.4k|    if (ex == NULL)
  ------------------
  |  Branch (222:9): [True: 0, False: 78.4k]
  ------------------
  223|      0|        return NULL;
  224|  78.4k|    return ex->object;
  225|  78.4k|}
X509_EXTENSION_get_data:
  228|  32.6k|{
  229|  32.6k|    if (ex == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 32.6k]
  ------------------
  230|      0|        return NULL;
  231|  32.6k|    return &ex->value;
  232|  32.6k|}
X509_EXTENSION_get_critical:
  235|  32.3k|{
  236|  32.3k|    if (ex == NULL)
  ------------------
  |  Branch (236:9): [True: 0, False: 32.3k]
  ------------------
  237|      0|        return 0;
  238|  32.3k|    if (ex->critical > 0)
  ------------------
  |  Branch (238:9): [True: 2.99k, False: 29.3k]
  ------------------
  239|  2.99k|        return 1;
  240|  29.3k|    return 0;
  241|  32.3k|}

X509_CRL_get_issuer:
  114|  1.01k|{
  115|  1.01k|    return crl->crl.issuer;
  116|  1.01k|}
X509_CRL_get_REVOKED:
  124|  7.33k|{
  125|  7.33k|    return crl->crl.revoked;
  126|  7.33k|}

X509_NAME_entry_count:
   51|  5.15k|{
   52|  5.15k|    int ret;
   53|       |
   54|  5.15k|    if (name == NULL)
  ------------------
  |  Branch (54:9): [True: 0, False: 5.15k]
  ------------------
   55|      0|        return 0;
   56|  5.15k|    ret = sk_X509_NAME_ENTRY_num(name->entries);
  ------------------
  |  |  196|  5.15k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
   57|  5.15k|    return ret > 0 ? ret : 0;
  ------------------
  |  Branch (57:12): [True: 4.73k, False: 418]
  ------------------
   58|  5.15k|}
X509_NAME_get_entry:
   93|  5.78k|{
   94|  5.78k|    if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc
  ------------------
  |  |  196|  5.78k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (94:9): [True: 0, False: 5.78k]
  |  Branch (94:25): [True: 0, False: 5.78k]
  ------------------
   95|  5.78k|        || loc < 0)
  ------------------
  |  Branch (95:12): [True: 0, False: 5.78k]
  ------------------
   96|      0|        return NULL;
   97|       |
   98|  5.78k|    return sk_X509_NAME_ENTRY_value(name->entries, loc);
  ------------------
  |  |  197|  5.78k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
   99|  5.78k|}
X509_NAME_add_entry:
  190|  2.37k|{
  191|  2.37k|    X509_NAME_ENTRY *new_name = NULL;
  192|  2.37k|    int n, i, inc;
  193|  2.37k|    STACK_OF(X509_NAME_ENTRY) *sk;
  ------------------
  |  |   31|  2.37k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  194|       |
  195|  2.37k|    if (name == NULL)
  ------------------
  |  Branch (195:9): [True: 0, False: 2.37k]
  ------------------
  196|      0|        return 0;
  197|  2.37k|    sk = name->entries;
  198|  2.37k|    n = sk_X509_NAME_ENTRY_num(sk);
  ------------------
  |  |  196|  2.37k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  199|  2.37k|    if (loc > n)
  ------------------
  |  Branch (199:9): [True: 0, False: 2.37k]
  ------------------
  200|      0|        loc = n;
  201|  2.37k|    else if (loc < 0)
  ------------------
  |  Branch (201:14): [True: 2.37k, False: 0]
  ------------------
  202|  2.37k|        loc = n;
  203|  2.37k|    inc = (set == 0);
  204|  2.37k|    name->modified = 1;
  205|       |
  206|  2.37k|    if (set == -1) {
  ------------------
  |  Branch (206:9): [True: 0, False: 2.37k]
  ------------------
  207|      0|        if (loc == 0) {
  ------------------
  |  Branch (207:13): [True: 0, False: 0]
  ------------------
  208|      0|            set = 0;
  209|      0|            inc = 1;
  210|      0|        } else {
  211|      0|            set = sk_X509_NAME_ENTRY_value(sk, loc - 1)->set;
  ------------------
  |  |  197|      0|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  212|      0|        }
  213|  2.37k|    } else {                    /* if (set >= 0) */
  214|       |
  215|  2.37k|        if (loc >= n) {
  ------------------
  |  Branch (215:13): [True: 2.37k, False: 0]
  ------------------
  216|  2.37k|            if (loc != 0)
  ------------------
  |  Branch (216:17): [True: 2.25k, False: 123]
  ------------------
  217|  2.25k|                set = sk_X509_NAME_ENTRY_value(sk, loc - 1)->set + 1;
  ------------------
  |  |  197|  2.25k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  218|    123|            else
  219|    123|                set = 0;
  220|  2.37k|        } else
  221|      0|            set = sk_X509_NAME_ENTRY_value(sk, loc)->set;
  ------------------
  |  |  197|      0|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  222|  2.37k|    }
  223|       |
  224|  2.37k|    if ((new_name = X509_NAME_ENTRY_dup(ne)) == NULL)
  ------------------
  |  Branch (224:9): [True: 1, False: 2.37k]
  ------------------
  225|      1|        goto err;
  226|  2.37k|    new_name->set = set;
  227|  2.37k|    if (!sk_X509_NAME_ENTRY_insert(sk, new_name, loc)) {
  ------------------
  |  |  211|  2.37k|#define sk_X509_NAME_ENTRY_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr), (idx))
  ------------------
  |  Branch (227:9): [True: 0, False: 2.37k]
  ------------------
  228|      0|        ERR_raise(ERR_LIB_X509, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  229|      0|        goto err;
  230|      0|    }
  231|  2.37k|    if (inc) {
  ------------------
  |  Branch (231:9): [True: 2.09k, False: 282]
  ------------------
  232|  2.09k|        n = sk_X509_NAME_ENTRY_num(sk);
  ------------------
  |  |  196|  2.09k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  233|  2.09k|        for (i = loc + 1; i < n; i++)
  ------------------
  |  Branch (233:27): [True: 0, False: 2.09k]
  ------------------
  234|      0|            sk_X509_NAME_ENTRY_value(sk, i)->set += 1;
  ------------------
  |  |  197|      0|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  235|  2.09k|    }
  236|  2.37k|    return 1;
  237|      1| err:
  238|      1|    X509_NAME_ENTRY_free(new_name);
  239|      1|    return 0;
  240|  2.37k|}
X509_NAME_ENTRY_get_object:
  343|  5.78k|{
  344|  5.78k|    if (ne == NULL)
  ------------------
  |  Branch (344:9): [True: 0, False: 5.78k]
  ------------------
  345|      0|        return NULL;
  346|  5.78k|    return ne->object;
  347|  5.78k|}
X509_NAME_ENTRY_get_data:
  350|  5.78k|{
  351|  5.78k|    if (ne == NULL)
  ------------------
  |  Branch (351:9): [True: 0, False: 5.78k]
  ------------------
  352|      0|        return NULL;
  353|  5.78k|    return ne->value;
  354|  5.78k|}
X509_NAME_ENTRY_set:
  357|  6.84k|{
  358|  6.84k|    return ne->set;
  359|  6.84k|}

X509_CRL_digest:
  575|  7.33k|{
  576|  7.33k|    if (type == NULL) {
  ------------------
  |  Branch (576:9): [True: 0, False: 7.33k]
  ------------------
  577|      0|        ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  578|      0|        return 0;
  579|      0|    }
  580|  7.33k|    if (EVP_MD_is_a(type, SN_sha1)
  ------------------
  |  | 2306|  7.33k|#define SN_sha1         "SHA1"
  ------------------
  |  Branch (580:9): [True: 7.33k, False: 0]
  ------------------
  581|  7.33k|            && (data->flags & EXFLAG_SET) != 0
  ------------------
  |  |  651|  7.33k|# define EXFLAG_SET              0x100
  ------------------
  |  Branch (581:16): [True: 0, False: 7.33k]
  ------------------
  582|  7.33k|            && (data->flags & EXFLAG_NO_FINGERPRINT) == 0) {
  ------------------
  |  |  663|      0|# define EXFLAG_NO_FINGERPRINT   0x100000
  ------------------
  |  Branch (582:16): [True: 0, False: 0]
  ------------------
  583|       |        /* Asking for SHA1; always computed in CRL d2i. */
  584|      0|        if (len != NULL)
  ------------------
  |  Branch (584:13): [True: 0, False: 0]
  ------------------
  585|      0|            *len = sizeof(data->sha1_hash);
  586|      0|        memcpy(md, data->sha1_hash, sizeof(data->sha1_hash));
  587|      0|        return 1;
  588|      0|    }
  589|  7.33k|    return
  590|  7.33k|        ossl_asn1_item_digest_ex(ASN1_ITEM_rptr(X509_CRL), type, (char *)data,
  ------------------
  |  |  426|  7.33k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  591|  7.33k|                                 md, len, data->libctx, data->propq);
  592|  7.33k|}
i2d_PKCS8_PRIV_KEY_INFO_bio:
  752|     35|{
  753|     35|    return ASN1_i2d_bio_of(PKCS8_PRIV_KEY_INFO, i2d_PKCS8_PRIV_KEY_INFO, bp,
  ------------------
  |  |  970|     35|    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
  |  |  ------------------
  |  |  |  |  360|     35|    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:22): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  971|     35|                  out, \
  |  |  972|     35|                  CHECKED_PTR_OF(const type, x)))
  |  |  ------------------
  |  |  |  |  364|     35|    ((void*) (1 ? p : (type*)0))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:15): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  754|     35|                           p8inf);
  755|     35|}

x_crl.c:crl_inf_cb:
   49|   129k|{
   50|   129k|    X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
   51|       |
   52|   129k|    if (!a || !a->revoked)
  ------------------
  |  Branch (52:9): [True: 9.23k, False: 120k]
  |  Branch (52:15): [True: 116k, False: 3.90k]
  ------------------
   53|   125k|        return 1;
   54|  3.90k|    switch (operation) {
  ------------------
  |  Branch (54:13): [True: 1.97k, False: 1.92k]
  ------------------
   55|       |        /*
   56|       |         * Just set cmp function here. We don't sort because that would
   57|       |         * affect the output of X509_CRL_print().
   58|       |         */
   59|  1.92k|    case ASN1_OP_D2I_POST:
  ------------------
  |  |  747|  1.92k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (59:5): [True: 1.92k, False: 1.97k]
  ------------------
   60|  1.92k|        (void)sk_X509_REVOKED_set_cmp_func(a->revoked, X509_REVOKED_cmp);
  ------------------
  |  |  129|  1.92k|#define sk_X509_REVOKED_set_cmp_func(sk, cmp) ((sk_X509_REVOKED_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_REVOKED_sk_type(sk), ossl_check_X509_REVOKED_compfunc_type(cmp)))
  ------------------
   61|  1.92k|        break;
   62|  3.90k|    }
   63|  3.90k|    return 1;
   64|  3.90k|}
x_crl.c:crl_cb:
  160|   113k|{
  161|   113k|    X509_CRL *crl = (X509_CRL *)*pval;
  162|   113k|    STACK_OF(X509_EXTENSION) *exts;
  ------------------
  |  |   31|   113k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  163|   113k|    X509_EXTENSION *ext;
  164|   113k|    int idx, i;
  165|       |
  166|   113k|    switch (operation) {
  ------------------
  |  Branch (166:13): [True: 56.5k, False: 57.3k]
  ------------------
  167|  16.6k|    case ASN1_OP_D2I_PRE:
  ------------------
  |  |  746|  16.6k|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (167:5): [True: 16.6k, False: 97.1k]
  ------------------
  168|  16.6k|        if (crl->meth->crl_free) {
  ------------------
  |  Branch (168:13): [True: 0, False: 16.6k]
  ------------------
  169|      0|            if (!crl->meth->crl_free(crl))
  ------------------
  |  Branch (169:17): [True: 0, False: 0]
  ------------------
  170|      0|                return 0;
  171|      0|        }
  172|  16.6k|        AUTHORITY_KEYID_free(crl->akid);
  173|  16.6k|        ISSUING_DIST_POINT_free(crl->idp);
  174|  16.6k|        ASN1_INTEGER_free(crl->crl_number);
  175|  16.6k|        ASN1_INTEGER_free(crl->base_crl_number);
  176|  16.6k|        sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free);
  ------------------
  |  |  278|  16.6k|#define sk_GENERAL_NAMES_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAMES_sk_type(sk),ossl_check_GENERAL_NAMES_freefunc_type(freefunc))
  ------------------
  177|       |        /* fall through */
  178|       |
  179|  33.3k|    case ASN1_OP_NEW_POST:
  ------------------
  |  |  743|  33.3k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (179:5): [True: 16.6k, False: 97.1k]
  ------------------
  180|  33.3k|        crl->idp = NULL;
  181|  33.3k|        crl->akid = NULL;
  182|  33.3k|        crl->flags = 0;
  183|  33.3k|        crl->idp_flags = 0;
  184|  33.3k|        crl->idp_reasons = CRLDP_ALL_REASONS;
  ------------------
  |  |  301|  33.3k|# define CRLDP_ALL_REASONS       0x807f
  ------------------
  185|  33.3k|        crl->meth = default_crl_method;
  186|  33.3k|        crl->meth_data = NULL;
  187|  33.3k|        crl->issuers = NULL;
  188|  33.3k|        crl->crl_number = NULL;
  189|  33.3k|        crl->base_crl_number = NULL;
  190|  33.3k|        break;
  191|       |
  192|  7.33k|    case ASN1_OP_D2I_POST:
  ------------------
  |  |  747|  7.33k|# define ASN1_OP_D2I_POST        5
  ------------------
  |  Branch (192:5): [True: 7.33k, False: 106k]
  ------------------
  193|  7.33k|        if (!X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL))
  ------------------
  |  Branch (193:13): [True: 0, False: 7.33k]
  ------------------
  194|      0|            crl->flags |= EXFLAG_NO_FINGERPRINT;
  ------------------
  |  |  663|      0|# define EXFLAG_NO_FINGERPRINT   0x100000
  ------------------
  195|  7.33k|        crl->idp = X509_CRL_get_ext_d2i(crl,
  196|  7.33k|                                        NID_issuing_distribution_point, &i,
  ------------------
  |  | 2694|  7.33k|#define NID_issuing_distribution_point          770
  ------------------
  197|  7.33k|                                        NULL);
  198|  7.33k|        if (crl->idp != NULL) {
  ------------------
  |  Branch (198:13): [True: 1.01k, False: 6.32k]
  ------------------
  199|  1.01k|            if (!setup_idp(crl, crl->idp))
  ------------------
  |  Branch (199:17): [True: 263, False: 750]
  ------------------
  200|    263|                crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|    263|# define EXFLAG_INVALID          0x80
  ------------------
  201|  1.01k|        }
  202|  6.32k|        else if (i != -1) {
  ------------------
  |  Branch (202:18): [True: 975, False: 5.34k]
  ------------------
  203|    975|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|    975|# define EXFLAG_INVALID          0x80
  ------------------
  204|    975|        }
  205|       |
  206|  7.33k|        crl->akid = X509_CRL_get_ext_d2i(crl,
  207|  7.33k|                                         NID_authority_key_identifier, &i,
  ------------------
  |  | 2729|  7.33k|#define NID_authority_key_identifier            90
  ------------------
  208|  7.33k|                                         NULL);
  209|  7.33k|        if (crl->akid == NULL && i != -1)
  ------------------
  |  Branch (209:13): [True: 7.32k, False: 9]
  |  Branch (209:34): [True: 1.87k, False: 5.45k]
  ------------------
  210|  1.87k|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|  1.87k|# define EXFLAG_INVALID          0x80
  ------------------
  211|       |
  212|  7.33k|        crl->crl_number = X509_CRL_get_ext_d2i(crl,
  213|  7.33k|                                               NID_crl_number, &i, NULL);
  ------------------
  |  | 2674|  7.33k|#define NID_crl_number          88
  ------------------
  214|  7.33k|        if (crl->crl_number == NULL && i != -1)
  ------------------
  |  Branch (214:13): [True: 7.17k, False: 155]
  |  Branch (214:40): [True: 201, False: 6.97k]
  ------------------
  215|    201|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|    201|# define EXFLAG_INVALID          0x80
  ------------------
  216|       |
  217|  7.33k|        crl->base_crl_number = X509_CRL_get_ext_d2i(crl,
  218|  7.33k|                                                    NID_delta_crl, &i,
  ------------------
  |  | 2689|  7.33k|#define NID_delta_crl           140
  ------------------
  219|  7.33k|                                                    NULL);
  220|  7.33k|        if (crl->base_crl_number == NULL && i != -1)
  ------------------
  |  Branch (220:13): [True: 7.17k, False: 164]
  |  Branch (220:45): [True: 210, False: 6.96k]
  ------------------
  221|    210|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|    210|# define EXFLAG_INVALID          0x80
  ------------------
  222|       |        /* Delta CRLs must have CRL number */
  223|  7.33k|        if (crl->base_crl_number && !crl->crl_number)
  ------------------
  |  Branch (223:13): [True: 164, False: 7.17k]
  |  Branch (223:37): [True: 34, False: 130]
  ------------------
  224|     34|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|     34|# define EXFLAG_INVALID          0x80
  ------------------
  225|       |
  226|       |        /*
  227|       |         * See if we have any unhandled critical CRL extensions and indicate
  228|       |         * this in a flag. We only currently handle IDP so anything else
  229|       |         * critical sets the flag. This code accesses the X509_CRL structure
  230|       |         * directly: applications shouldn't do this.
  231|       |         */
  232|       |
  233|  7.33k|        exts = crl->crl.extensions;
  234|       |
  235|  13.2k|        for (idx = 0; idx < sk_X509_EXTENSION_num(exts); idx++) {
  ------------------
  |  |  227|  13.2k|#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
  ------------------
  |  Branch (235:23): [True: 6.04k, False: 7.22k]
  ------------------
  236|  6.04k|            int nid;
  237|  6.04k|            ext = sk_X509_EXTENSION_value(exts, idx);
  ------------------
  |  |  228|  6.04k|#define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx)))
  ------------------
  238|  6.04k|            nid = OBJ_obj2nid(X509_EXTENSION_get_object(ext));
  239|  6.04k|            if (nid == NID_freshest_crl)
  ------------------
  |  | 2769|  6.04k|#define NID_freshest_crl                857
  ------------------
  |  Branch (239:17): [True: 210, False: 5.83k]
  ------------------
  240|    210|                crl->flags |= EXFLAG_FRESHEST;
  ------------------
  |  |  656|    210|# define EXFLAG_FRESHEST         0x1000
  ------------------
  241|  6.04k|            if (X509_EXTENSION_get_critical(ext)) {
  ------------------
  |  Branch (241:17): [True: 612, False: 5.43k]
  ------------------
  242|       |                /* We handle IDP and deltas */
  243|    612|                if ((nid == NID_issuing_distribution_point)
  ------------------
  |  | 2694|    612|#define NID_issuing_distribution_point          770
  ------------------
  |  Branch (243:21): [True: 417, False: 195]
  ------------------
  244|    612|                    || (nid == NID_authority_key_identifier)
  ------------------
  |  | 2729|    195|#define NID_authority_key_identifier            90
  ------------------
  |  Branch (244:24): [True: 76, False: 119]
  ------------------
  245|    612|                    || (nid == NID_delta_crl))
  ------------------
  |  | 2689|    119|#define NID_delta_crl           140
  ------------------
  |  Branch (245:24): [True: 12, False: 107]
  ------------------
  246|    505|                    continue;
  247|    107|                crl->flags |= EXFLAG_CRITICAL;
  ------------------
  |  |  652|    107|# define EXFLAG_CRITICAL         0x200
  ------------------
  248|    107|                break;
  249|    612|            }
  250|  6.04k|        }
  251|       |
  252|  7.33k|        if (!crl_set_issuers(crl))
  ------------------
  |  Branch (252:13): [True: 0, False: 7.33k]
  ------------------
  253|      0|            return 0;
  254|       |
  255|  7.33k|        if (crl->meth->crl_init) {
  ------------------
  |  Branch (255:13): [True: 0, False: 7.33k]
  ------------------
  256|      0|            if (crl->meth->crl_init(crl) == 0)
  ------------------
  |  Branch (256:17): [True: 0, False: 0]
  ------------------
  257|      0|                return 0;
  258|      0|        }
  259|       |
  260|  7.33k|        crl->flags |= EXFLAG_SET;
  ------------------
  |  |  651|  7.33k|# define EXFLAG_SET              0x100
  ------------------
  261|  7.33k|        break;
  262|       |
  263|  16.6k|    case ASN1_OP_FREE_POST:
  ------------------
  |  |  745|  16.6k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (263:5): [True: 16.6k, False: 97.1k]
  ------------------
  264|  16.6k|        if (crl->meth != NULL && crl->meth->crl_free != NULL) {
  ------------------
  |  Branch (264:13): [True: 16.6k, False: 0]
  |  Branch (264:34): [True: 0, False: 16.6k]
  ------------------
  265|      0|            if (!crl->meth->crl_free(crl))
  ------------------
  |  Branch (265:17): [True: 0, False: 0]
  ------------------
  266|      0|                return 0;
  267|      0|        }
  268|  16.6k|        AUTHORITY_KEYID_free(crl->akid);
  269|  16.6k|        ISSUING_DIST_POINT_free(crl->idp);
  270|  16.6k|        ASN1_INTEGER_free(crl->crl_number);
  271|  16.6k|        ASN1_INTEGER_free(crl->base_crl_number);
  272|  16.6k|        sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free);
  ------------------
  |  |  278|  16.6k|#define sk_GENERAL_NAMES_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAMES_sk_type(sk),ossl_check_GENERAL_NAMES_freefunc_type(freefunc))
  ------------------
  273|  16.6k|        OPENSSL_free(crl->propq);
  ------------------
  |  |  107|  16.6k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  16.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  16.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  274|  16.6k|        break;
  275|      0|    case ASN1_OP_DUP_POST:
  ------------------
  |  |  757|      0|# define ASN1_OP_DUP_POST        15
  ------------------
  |  Branch (275:5): [True: 0, False: 113k]
  ------------------
  276|      0|        {
  277|      0|            X509_CRL *old = exarg;
  278|       |
  279|      0|            if (!ossl_x509_crl_set0_libctx(crl, old->libctx, old->propq))
  ------------------
  |  Branch (279:17): [True: 0, False: 0]
  ------------------
  280|      0|                return 0;
  281|      0|        }
  282|      0|        break;
  283|   113k|    }
  284|   113k|    return 1;
  285|   113k|}
x_crl.c:setup_idp:
  290|  1.01k|{
  291|  1.01k|    int idp_only = 0;
  292|       |
  293|       |    /* Set various flags according to IDP */
  294|  1.01k|    crl->idp_flags |= IDP_PRESENT;
  ------------------
  |  |  593|  1.01k|# define IDP_PRESENT     0x1
  ------------------
  295|  1.01k|    if (idp->onlyuser > 0) {
  ------------------
  |  Branch (295:9): [True: 12, False: 1.00k]
  ------------------
  296|     12|        idp_only++;
  297|     12|        crl->idp_flags |= IDP_ONLYUSER;
  ------------------
  |  |  597|     12|# define IDP_ONLYUSER    0x4
  ------------------
  298|     12|    }
  299|  1.01k|    if (idp->onlyCA > 0) {
  ------------------
  |  Branch (299:9): [True: 18, False: 995]
  ------------------
  300|     18|        idp_only++;
  301|     18|        crl->idp_flags |= IDP_ONLYCA;
  ------------------
  |  |  599|     18|# define IDP_ONLYCA      0x8
  ------------------
  302|     18|    }
  303|  1.01k|    if (idp->onlyattr > 0) {
  ------------------
  |  Branch (303:9): [True: 12, False: 1.00k]
  ------------------
  304|     12|        idp_only++;
  305|     12|        crl->idp_flags |= IDP_ONLYATTR;
  ------------------
  |  |  601|     12|# define IDP_ONLYATTR    0x10
  ------------------
  306|     12|    }
  307|       |
  308|  1.01k|    if (idp_only > 1)
  ------------------
  |  Branch (308:9): [True: 12, False: 1.00k]
  ------------------
  309|     12|        crl->idp_flags |= IDP_INVALID;
  ------------------
  |  |  595|     12|# define IDP_INVALID     0x2
  ------------------
  310|       |
  311|  1.01k|    if (idp->indirectCRL > 0)
  ------------------
  |  Branch (311:9): [True: 40, False: 973]
  ------------------
  312|     40|        crl->idp_flags |= IDP_INDIRECT;
  ------------------
  |  |  603|     40|# define IDP_INDIRECT    0x20
  ------------------
  313|       |
  314|  1.01k|    if (idp->onlysomereasons) {
  ------------------
  |  Branch (314:9): [True: 75, False: 938]
  ------------------
  315|     75|        crl->idp_flags |= IDP_REASONS;
  ------------------
  |  |  605|     75|# define IDP_REASONS     0x40
  ------------------
  316|     75|        if (idp->onlysomereasons->length > 0)
  ------------------
  |  Branch (316:13): [True: 67, False: 8]
  ------------------
  317|     67|            crl->idp_reasons = idp->onlysomereasons->data[0];
  318|     75|        if (idp->onlysomereasons->length > 1)
  ------------------
  |  Branch (318:13): [True: 67, False: 8]
  ------------------
  319|     67|            crl->idp_reasons |= (idp->onlysomereasons->data[1] << 8);
  320|     75|        crl->idp_reasons &= CRLDP_ALL_REASONS;
  ------------------
  |  |  301|     75|# define CRLDP_ALL_REASONS       0x807f
  ------------------
  321|     75|    }
  322|       |
  323|  1.01k|    return DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl));
  324|  1.01k|}
x_crl.c:crl_set_issuers:
   83|  7.33k|{
   84|       |
   85|  7.33k|    int i, j;
   86|  7.33k|    GENERAL_NAMES *gens, *gtmp;
   87|  7.33k|    STACK_OF(X509_REVOKED) *revoked;
  ------------------
  |  |   31|  7.33k|# define STACK_OF(type) struct stack_st_##type
  ------------------
   88|       |
   89|  7.33k|    revoked = X509_CRL_get_REVOKED(crl);
   90|       |
   91|  7.33k|    gens = NULL;
   92|  9.07k|    for (i = 0; i < sk_X509_REVOKED_num(revoked); i++) {
  ------------------
  |  |  105|  9.07k|#define sk_X509_REVOKED_num(sk) OPENSSL_sk_num(ossl_check_const_X509_REVOKED_sk_type(sk))
  ------------------
  |  Branch (92:17): [True: 2.90k, False: 6.16k]
  ------------------
   93|  2.90k|        X509_REVOKED *rev = sk_X509_REVOKED_value(revoked, i);
  ------------------
  |  |  106|  2.90k|#define sk_X509_REVOKED_value(sk, idx) ((X509_REVOKED *)OPENSSL_sk_value(ossl_check_const_X509_REVOKED_sk_type(sk), (idx)))
  ------------------
   94|  2.90k|        STACK_OF(X509_EXTENSION) *exts;
  ------------------
  |  |   31|  2.90k|# define STACK_OF(type) struct stack_st_##type
  ------------------
   95|  2.90k|        ASN1_ENUMERATED *reason;
   96|  2.90k|        X509_EXTENSION *ext;
   97|       |
   98|  2.90k|        gtmp = X509_REVOKED_get_ext_d2i(rev,
   99|  2.90k|                                        NID_certificate_issuer, &j, NULL);
  ------------------
  |  | 2699|  2.90k|#define NID_certificate_issuer          771
  ------------------
  100|  2.90k|        if (gtmp == NULL && j != -1) {
  ------------------
  |  Branch (100:13): [True: 2.85k, False: 57]
  |  Branch (100:29): [True: 1.07k, False: 1.78k]
  ------------------
  101|  1.07k|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|  1.07k|# define EXFLAG_INVALID          0x80
  ------------------
  102|  1.07k|            return 1;
  103|  1.07k|        }
  104|       |
  105|  1.83k|        if (gtmp != NULL) {
  ------------------
  |  Branch (105:13): [True: 57, False: 1.78k]
  ------------------
  106|     57|            if (crl->issuers == NULL) {
  ------------------
  |  Branch (106:17): [True: 15, False: 42]
  ------------------
  107|     15|                crl->issuers = sk_GENERAL_NAMES_new_null();
  ------------------
  |  |  267|     15|#define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_null())
  ------------------
  108|     15|                if (crl->issuers == NULL) {
  ------------------
  |  Branch (108:21): [True: 0, False: 15]
  ------------------
  109|      0|                    GENERAL_NAMES_free(gtmp);
  110|      0|                    return 0;
  111|      0|                }
  112|     15|            }
  113|     57|            if (!sk_GENERAL_NAMES_push(crl->issuers, gtmp)) {
  ------------------
  |  |  274|     57|#define sk_GENERAL_NAMES_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))
  ------------------
  |  Branch (113:17): [True: 0, False: 57]
  ------------------
  114|      0|                GENERAL_NAMES_free(gtmp);
  115|      0|                return 0;
  116|      0|            }
  117|     57|            gens = gtmp;
  118|     57|        }
  119|  1.83k|        rev->issuer = gens;
  120|       |
  121|  1.83k|        reason = X509_REVOKED_get_ext_d2i(rev, NID_crl_reason, &j, NULL);
  ------------------
  |  | 2679|  1.83k|#define NID_crl_reason          141
  ------------------
  122|  1.83k|        if (reason == NULL && j != -1) {
  ------------------
  |  Branch (122:13): [True: 900, False: 939]
  |  Branch (122:31): [True: 98, False: 802]
  ------------------
  123|     98|            crl->flags |= EXFLAG_INVALID;
  ------------------
  |  |  649|     98|# define EXFLAG_INVALID          0x80
  ------------------
  124|     98|            return 1;
  125|     98|        }
  126|       |
  127|  1.74k|        if (reason != NULL) {
  ------------------
  |  Branch (127:13): [True: 939, False: 802]
  ------------------
  128|    939|            rev->reason = ASN1_ENUMERATED_get(reason);
  129|    939|            ASN1_ENUMERATED_free(reason);
  130|    939|        } else
  131|    802|            rev->reason = CRL_REASON_NONE;
  ------------------
  |  |  303|    802|# define CRL_REASON_NONE                         -1
  ------------------
  132|       |
  133|       |        /* Check for critical CRL entry extensions */
  134|       |
  135|  1.74k|        exts = rev->extensions;
  136|       |
  137|  2.40k|        for (j = 0; j < sk_X509_EXTENSION_num(exts); j++) {
  ------------------
  |  |  227|  2.40k|#define sk_X509_EXTENSION_num(sk) OPENSSL_sk_num(ossl_check_const_X509_EXTENSION_sk_type(sk))
  ------------------
  |  Branch (137:21): [True: 1.29k, False: 1.11k]
  ------------------
  138|  1.29k|            ext = sk_X509_EXTENSION_value(exts, j);
  ------------------
  |  |  228|  1.29k|#define sk_X509_EXTENSION_value(sk, idx) ((X509_EXTENSION *)OPENSSL_sk_value(ossl_check_const_X509_EXTENSION_sk_type(sk), (idx)))
  ------------------
  139|  1.29k|            if (X509_EXTENSION_get_critical(ext)) {
  ------------------
  |  Branch (139:17): [True: 684, False: 610]
  ------------------
  140|    684|                if (OBJ_obj2nid(X509_EXTENSION_get_object(ext))
  ------------------
  |  Branch (140:21): [True: 56, False: 628]
  ------------------
  141|    684|                    == NID_certificate_issuer)
  ------------------
  |  | 2699|    684|#define NID_certificate_issuer          771
  ------------------
  142|     56|                    continue;
  143|    628|                crl->flags |= EXFLAG_CRITICAL;
  ------------------
  |  |  652|    628|# define EXFLAG_CRITICAL         0x200
  ------------------
  144|    628|                break;
  145|    684|            }
  146|  1.29k|        }
  147|       |
  148|  1.74k|    }
  149|       |
  150|  6.16k|    return 1;
  151|       |
  152|  7.33k|}

X509_NAME_print:
  504|  2.56k|{
  505|  2.56k|    char *s, *c, *b;
  506|  2.56k|    int i;
  507|       |
  508|  2.56k|    b = X509_NAME_oneline(name, NULL, 0);
  509|  2.56k|    if (b == NULL)
  ------------------
  |  Branch (509:9): [True: 45, False: 2.52k]
  ------------------
  510|     45|        return 0;
  511|  2.52k|    if (*b == '\0') {
  ------------------
  |  Branch (511:9): [True: 1.70k, False: 819]
  ------------------
  512|  1.70k|        OPENSSL_free(b);
  ------------------
  |  |  107|  1.70k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.70k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.70k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  513|  1.70k|        return 1;
  514|  1.70k|    }
  515|    819|    s = b + 1;                  /* skip the first slash */
  516|       |
  517|    819|    c = s;
  518|  52.9M|    for (;;) {
  519|  52.9M|        if (((*s == '/') &&
  ------------------
  |  Branch (519:14): [True: 48.8k, False: 52.9M]
  ------------------
  520|  52.9M|             (ossl_isupper(s[1]) && ((s[2] == '=') ||
  ------------------
  |  Branch (520:15): [True: 12.0k, False: 36.8k]
  |  Branch (520:38): [True: 85, False: 11.9k]
  ------------------
  521|  12.0k|                                (ossl_isupper(s[2]) && (s[3] == '='))
  ------------------
  |  Branch (521:34): [True: 284, False: 11.6k]
  |  Branch (521:56): [True: 164, False: 120]
  ------------------
  522|  52.9M|              ))) || (*s == '\0'))
  ------------------
  |  Branch (522:22): [True: 819, False: 52.9M]
  ------------------
  523|  1.06k|        {
  524|  1.06k|            i = s - c;
  525|  1.06k|            if (BIO_write(bp, c, i) != i)
  ------------------
  |  Branch (525:17): [True: 0, False: 1.06k]
  ------------------
  526|      0|                goto err;
  527|  1.06k|            c = s + 1;          /* skip following slash */
  528|  1.06k|            if (*s != '\0') {
  ------------------
  |  Branch (528:17): [True: 249, False: 819]
  ------------------
  529|    249|                if (BIO_write(bp, ", ", 2) != 2)
  ------------------
  |  Branch (529:21): [True: 0, False: 249]
  ------------------
  530|      0|                    goto err;
  531|    249|            }
  532|  1.06k|        }
  533|  52.9M|        if (*s == '\0')
  ------------------
  |  Branch (533:13): [True: 819, False: 52.9M]
  ------------------
  534|    819|            break;
  535|  52.9M|        s++;
  536|  52.9M|    }
  537|       |
  538|    819|    OPENSSL_free(b);
  ------------------
  |  |  107|    819|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    819|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    819|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  539|    819|    return 1;
  540|      0| err:
  541|      0|    ERR_raise(ERR_LIB_X509, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  542|      0|    OPENSSL_free(b);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  543|      0|    return 0;
  544|    819|}
x_name.c:x509_name_ex_new:
   91|   271k|{
   92|   271k|    X509_NAME *ret = OPENSSL_zalloc(sizeof(*ret));
  ------------------
  |  |   99|   271k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   271k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   271k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|       |
   94|   271k|    if (ret == NULL)
  ------------------
  |  Branch (94:9): [True: 0, False: 271k]
  ------------------
   95|      0|        return 0;
   96|   271k|    if ((ret->entries = sk_X509_NAME_ENTRY_new_null()) == NULL) {
  ------------------
  |  |  199|   271k|#define sk_X509_NAME_ENTRY_new_null() ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_null())
  ------------------
  |  Branch (96:9): [True: 0, False: 271k]
  ------------------
   97|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   98|      0|        goto err;
   99|      0|    }
  100|   271k|    if ((ret->bytes = BUF_MEM_new()) == NULL) {
  ------------------
  |  Branch (100:9): [True: 0, False: 271k]
  ------------------
  101|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  102|      0|        goto err;
  103|      0|    }
  104|   271k|    ret->modified = 1;
  105|   271k|    *val = (ASN1_VALUE *)ret;
  106|   271k|    return 1;
  107|       |
  108|      0| err:
  109|      0|    if (ret) {
  ------------------
  |  Branch (109:9): [True: 0, False: 0]
  ------------------
  110|      0|        sk_X509_NAME_ENTRY_free(ret->entries);
  ------------------
  |  |  202|      0|#define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  111|      0|        OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  112|      0|    }
  113|      0|    return 0;
  114|   271k|}
x_name.c:x509_name_ex_free:
  117|   271k|{
  118|   271k|    X509_NAME *a;
  119|       |
  120|   271k|    if (pval == NULL || *pval == NULL)
  ------------------
  |  Branch (120:9): [True: 0, False: 271k]
  |  Branch (120:25): [True: 0, False: 271k]
  ------------------
  121|      0|        return;
  122|   271k|    a = (X509_NAME *)*pval;
  123|       |
  124|   271k|    BUF_MEM_free(a->bytes);
  125|   271k|    sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free);
  ------------------
  |  |  210|   271k|#define sk_X509_NAME_ENTRY_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_ENTRY_sk_type(sk),ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc))
  ------------------
  126|   271k|    OPENSSL_free(a->canon_enc);
  ------------------
  |  |  107|   271k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   271k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   271k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  127|   271k|    OPENSSL_free(a);
  ------------------
  |  |  107|   271k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   271k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   271k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  128|   271k|    *pval = NULL;
  129|   271k|}
x_name.c:x509_name_ex_d2i:
  145|   121k|{
  146|   121k|    const unsigned char *p = *in, *q;
  147|   121k|    union {
  148|   121k|        STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
  149|   121k|        ASN1_VALUE *a;
  150|   121k|    } intname = {
  151|   121k|        NULL
  152|   121k|    };
  153|   121k|    union {
  154|   121k|        X509_NAME *x;
  155|   121k|        ASN1_VALUE *a;
  156|   121k|    } nm = {
  157|   121k|        NULL
  158|   121k|    };
  159|   121k|    int i, j, ret;
  160|   121k|    STACK_OF(X509_NAME_ENTRY) *entries;
  ------------------
  |  |   31|   121k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  161|   121k|    X509_NAME_ENTRY *entry;
  162|       |
  163|   121k|    if (len > X509_NAME_MAX)
  ------------------
  |  |   24|   121k|#define X509_NAME_MAX (1024 * 1024)
  ------------------
  |  Branch (163:9): [True: 0, False: 121k]
  ------------------
  164|      0|        len = X509_NAME_MAX;
  ------------------
  |  |   24|      0|#define X509_NAME_MAX (1024 * 1024)
  ------------------
  165|   121k|    q = p;
  166|       |
  167|       |    /* Get internal representation of Name */
  168|   121k|    ret = ASN1_item_ex_d2i(&intname.a,
  169|   121k|                           &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL),
  ------------------
  |  |  426|   121k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  170|   121k|                           tag, aclass, opt, ctx);
  171|       |
  172|   121k|    if (ret <= 0)
  ------------------
  |  Branch (172:9): [True: 39.1k, False: 82.7k]
  ------------------
  173|  39.1k|        return ret;
  174|       |
  175|  82.7k|    if (*val)
  ------------------
  |  Branch (175:9): [True: 78.0k, False: 4.71k]
  ------------------
  176|  78.0k|        x509_name_ex_free(val, NULL);
  177|  82.7k|    if (!x509_name_ex_new(&nm.a, NULL))
  ------------------
  |  Branch (177:9): [True: 0, False: 82.7k]
  ------------------
  178|      0|        goto err;
  179|       |    /* We've decoded it: now cache encoding */
  180|  82.7k|    if (!BUF_MEM_grow(nm.x->bytes, p - q))
  ------------------
  |  Branch (180:9): [True: 0, False: 82.7k]
  ------------------
  181|      0|        goto err;
  182|  82.7k|    memcpy(nm.x->bytes->data, q, p - q);
  183|       |
  184|       |    /* Convert internal representation to X509_NAME structure */
  185|  2.10M|    for (i = 0; i < sk_STACK_OF_X509_NAME_ENTRY_num(intname.s); i++) {
  ------------------
  |  Branch (185:17): [True: 2.01M, False: 82.7k]
  ------------------
  186|  2.01M|        entries = sk_STACK_OF_X509_NAME_ENTRY_value(intname.s, i);
  187|  2.25M|        for (j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
  ------------------
  |  |  196|  2.25M|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (187:21): [True: 239k, False: 2.01M]
  ------------------
  188|   239k|            entry = sk_X509_NAME_ENTRY_value(entries, j);
  ------------------
  |  |  197|   239k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  189|   239k|            entry->set = i;
  190|   239k|            if (!sk_X509_NAME_ENTRY_push(nm.x->entries, entry))
  ------------------
  |  |  206|   239k|#define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  ------------------
  |  Branch (190:17): [True: 0, False: 239k]
  ------------------
  191|      0|                goto err;
  192|   239k|            (void)sk_X509_NAME_ENTRY_set(entries, j, NULL);
  ------------------
  |  |  212|   239k|#define sk_X509_NAME_ENTRY_set(sk, idx, ptr) ((X509_NAME_ENTRY *)OPENSSL_sk_set(ossl_check_X509_NAME_ENTRY_sk_type(sk), (idx), ossl_check_X509_NAME_ENTRY_type(ptr)))
  ------------------
  193|   239k|        }
  194|  2.01M|    }
  195|  82.7k|    ret = x509_name_canon(nm.x);
  196|  82.7k|    if (!ret)
  ------------------
  |  Branch (196:9): [True: 645, False: 82.1k]
  ------------------
  197|    645|        goto err;
  198|  82.1k|    sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
  199|  82.1k|                                         local_sk_X509_NAME_ENTRY_free);
  200|  82.1k|    nm.x->modified = 0;
  201|  82.1k|    *val = nm.a;
  202|  82.1k|    *in = p;
  203|  82.1k|    return ret;
  204|       |
  205|    645| err:
  206|    645|    if (nm.x != NULL)
  ------------------
  |  Branch (206:9): [True: 645, False: 0]
  ------------------
  207|    645|        X509_NAME_free(nm.x);
  208|    645|    sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
  209|    645|                                         local_sk_X509_NAME_ENTRY_pop_free);
  210|    645|    ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR);
  ------------------
  |  |  401|    645|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    645|    (ERR_new(),                                                 \
  |  |  |  |  404|    645|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    645|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    645|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    645|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    645|     ERR_set_error)
  |  |  ------------------
  ------------------
  211|    645|    return 0;
  212|  82.7k|}
x_name.c:x509_name_canon:
  311|  83.0k|{
  312|  83.0k|    unsigned char *p;
  313|  83.0k|    STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname;
  ------------------
  |  |   31|  83.0k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  314|  83.0k|    STACK_OF(X509_NAME_ENTRY) *entries = NULL;
  ------------------
  |  |   31|  83.0k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  315|  83.0k|    X509_NAME_ENTRY *entry, *tmpentry = NULL;
  316|  83.0k|    int i, set = -1, ret = 0, len;
  317|       |
  318|  83.0k|    OPENSSL_free(a->canon_enc);
  ------------------
  |  |  107|  83.0k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  83.0k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  83.0k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  319|  83.0k|    a->canon_enc = NULL;
  320|       |    /* Special case: empty X509_NAME => null encoding */
  321|  83.0k|    if (sk_X509_NAME_ENTRY_num(a->entries) == 0) {
  ------------------
  |  |  196|  83.0k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (321:9): [True: 80.3k, False: 2.66k]
  ------------------
  322|  80.3k|        a->canon_enclen = 0;
  323|  80.3k|        return 1;
  324|  80.3k|    }
  325|  2.66k|    intname = sk_STACK_OF_X509_NAME_ENTRY_new_null();
  326|  2.66k|    if (intname == NULL) {
  ------------------
  |  Branch (326:9): [True: 0, False: 2.66k]
  ------------------
  327|      0|        ERR_raise(ERR_LIB_X509, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  328|      0|        goto err;
  329|      0|    }
  330|   358k|    for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
  ------------------
  |  |  196|   358k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (330:17): [True: 356k, False: 1.99k]
  ------------------
  331|   356k|        entry = sk_X509_NAME_ENTRY_value(a->entries, i);
  ------------------
  |  |  197|   356k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  332|   356k|        if (entry->set != set) {
  ------------------
  |  Branch (332:13): [True: 6.90k, False: 349k]
  ------------------
  333|  6.90k|            entries = sk_X509_NAME_ENTRY_new_null();
  ------------------
  |  |  199|  6.90k|#define sk_X509_NAME_ENTRY_new_null() ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_null())
  ------------------
  334|  6.90k|            if (entries == NULL)
  ------------------
  |  Branch (334:17): [True: 0, False: 6.90k]
  ------------------
  335|      0|                goto err;
  336|  6.90k|            if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries)) {
  ------------------
  |  Branch (336:17): [True: 0, False: 6.90k]
  ------------------
  337|      0|                sk_X509_NAME_ENTRY_free(entries);
  ------------------
  |  |  202|      0|#define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  338|      0|                ERR_raise(ERR_LIB_X509, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  339|      0|                goto err;
  340|      0|            }
  341|  6.90k|            set = entry->set;
  342|  6.90k|        }
  343|   356k|        tmpentry = X509_NAME_ENTRY_new();
  344|   356k|        if (tmpentry == NULL) {
  ------------------
  |  Branch (344:13): [True: 0, False: 356k]
  ------------------
  345|      0|            ERR_raise(ERR_LIB_X509, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  346|      0|            goto err;
  347|      0|        }
  348|   356k|        tmpentry->object = OBJ_dup(entry->object);
  349|   356k|        if (tmpentry->object == NULL) {
  ------------------
  |  Branch (349:13): [True: 0, False: 356k]
  ------------------
  350|      0|            ERR_raise(ERR_LIB_X509, ERR_R_OBJ_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  351|      0|            goto err;
  352|      0|        }
  353|   356k|        if (!asn1_string_canon(tmpentry->value, entry->value))
  ------------------
  |  Branch (353:13): [True: 665, False: 356k]
  ------------------
  354|    665|            goto err;
  355|   356k|        if (!sk_X509_NAME_ENTRY_push(entries, tmpentry)) {
  ------------------
  |  |  206|   356k|#define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  ------------------
  |  Branch (355:13): [True: 0, False: 356k]
  ------------------
  356|      0|            ERR_raise(ERR_LIB_X509, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  357|      0|            goto err;
  358|      0|        }
  359|   356k|        tmpentry = NULL;
  360|   356k|    }
  361|       |
  362|       |    /* Finally generate encoding */
  363|  1.99k|    len = i2d_name_canon(intname, NULL);
  364|  1.99k|    if (len < 0)
  ------------------
  |  Branch (364:9): [True: 0, False: 1.99k]
  ------------------
  365|      0|        goto err;
  366|  1.99k|    a->canon_enclen = len;
  367|       |
  368|  1.99k|    p = OPENSSL_malloc(a->canon_enclen);
  ------------------
  |  |   97|  1.99k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.99k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.99k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  369|  1.99k|    if (p == NULL)
  ------------------
  |  Branch (369:9): [True: 0, False: 1.99k]
  ------------------
  370|      0|        goto err;
  371|       |
  372|  1.99k|    a->canon_enc = p;
  373|       |
  374|  1.99k|    i2d_name_canon(intname, &p);
  375|       |
  376|  1.99k|    ret = 1;
  377|       |
  378|  2.66k| err:
  379|  2.66k|    X509_NAME_ENTRY_free(tmpentry);
  380|  2.66k|    sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname,
  381|  2.66k|                                         local_sk_X509_NAME_ENTRY_pop_free);
  382|  2.66k|    return ret;
  383|  1.99k|}
x_name.c:asn1_string_canon:
  393|   356k|{
  394|   356k|    unsigned char *to, *from;
  395|   356k|    int len, i;
  396|       |
  397|       |    /* If type not in bitmask just copy string across */
  398|   356k|    if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON)) {
  ------------------
  |  |  388|   356k|        (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \
  |  |  ------------------
  |  |  |  |  117|   356k|# define B_ASN1_UTF8STRING       0x2000
  |  |  ------------------
  |  |                       (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \
  |  |  ------------------
  |  |  |  |  115|   356k|# define B_ASN1_BMPSTRING        0x0800
  |  |  ------------------
  |  |                       (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \
  |  |  ------------------
  |  |  |  |  112|   356k|# define B_ASN1_UNIVERSALSTRING  0x0100
  |  |  ------------------
  |  |  389|   356k|        | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \
  |  |  ------------------
  |  |  |  |  103|   356k|# define B_ASN1_PRINTABLESTRING  0x0002
  |  |  ------------------
  |  |                       | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \
  |  |  ------------------
  |  |  |  |  104|   356k|# define B_ASN1_T61STRING        0x0004
  |  |  ------------------
  |  |                       | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \
  |  |  ------------------
  |  |  |  |  107|   356k|# define B_ASN1_IA5STRING        0x0010
  |  |  ------------------
  |  |  390|   356k|        | B_ASN1_VISIBLESTRING)
  |  |  ------------------
  |  |  |  |  110|   356k|# define B_ASN1_VISIBLESTRING    0x0040
  |  |  ------------------
  ------------------
  |  Branch (398:9): [True: 141k, False: 215k]
  ------------------
  399|   141k|        if (!ASN1_STRING_copy(out, in))
  ------------------
  |  Branch (399:13): [True: 0, False: 141k]
  ------------------
  400|      0|            return 0;
  401|   141k|        return 1;
  402|   141k|    }
  403|       |
  404|   215k|    out->type = V_ASN1_UTF8STRING;
  ------------------
  |  |   73|   215k|# define V_ASN1_UTF8STRING               12
  ------------------
  405|   215k|    out->length = ASN1_STRING_to_UTF8(&out->data, in);
  406|   215k|    if (out->length == -1)
  ------------------
  |  Branch (406:9): [True: 665, False: 214k]
  ------------------
  407|    665|        return 0;
  408|       |
  409|   214k|    to = out->data;
  410|   214k|    from = to;
  411|       |
  412|   214k|    len = out->length;
  413|       |
  414|       |    /*
  415|       |     * Convert string in place to canonical form. Ultimately we may need to
  416|       |     * handle a wider range of characters but for now ignore anything with
  417|       |     * MSB set and rely on the ossl_isspace() to fail on bad characters without
  418|       |     * needing isascii or range checks as well.
  419|       |     */
  420|       |
  421|       |    /* Ignore leading spaces */
  422|   215k|    while (len > 0 && ossl_isspace(*from)) {
  ------------------
  |  |   82|  2.19k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|  2.19k|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (82:33): [True: 637, False: 1.55k]
  |  |  ------------------
  ------------------
  |  Branch (422:12): [True: 2.19k, False: 213k]
  ------------------
  423|    637|        from++;
  424|    637|        len--;
  425|    637|    }
  426|       |
  427|   214k|    to = from + len;
  428|       |
  429|       |    /* Ignore trailing spaces */
  430|   215k|    while (len > 0 && ossl_isspace(to[-1])) {
  ------------------
  |  |   82|  1.87k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|  1.87k|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (82:33): [True: 319, False: 1.55k]
  |  |  ------------------
  ------------------
  |  Branch (430:12): [True: 1.87k, False: 213k]
  ------------------
  431|    319|        to--;
  432|    319|        len--;
  433|    319|    }
  434|       |
  435|   214k|    to = out->data;
  436|       |
  437|   214k|    i = 0;
  438|  6.68M|    while (i < len) {
  ------------------
  |  Branch (438:12): [True: 6.47M, False: 214k]
  ------------------
  439|       |        /* If not ASCII set just copy across */
  440|  6.47M|        if (!ossl_isascii(*from)) {
  ------------------
  |  |   75|  6.47M|# define ossl_isascii(c)        (((c) & ~127) == 0)
  ------------------
  |  Branch (440:13): [True: 6.25M, False: 222k]
  ------------------
  441|  6.25M|            *to++ = *from++;
  442|  6.25M|            i++;
  443|  6.25M|        }
  444|       |        /* Collapse multiple spaces */
  445|   222k|        else if (ossl_isspace(*from)) {
  ------------------
  |  |   82|   222k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|   222k|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (82:33): [True: 5.94k, False: 216k]
  |  |  ------------------
  ------------------
  446|       |            /* Copy one space across */
  447|  5.94k|            *to++ = ' ';
  448|       |            /*
  449|       |             * Ignore subsequent spaces. Note: don't need to check len here
  450|       |             * because we know the last character is a non-space so we can't
  451|       |             * overflow.
  452|       |             */
  453|  7.76k|            do {
  454|  7.76k|                from++;
  455|  7.76k|                i++;
  456|  7.76k|            }
  457|  7.76k|            while (ossl_isspace(*from));
  ------------------
  |  |   82|  7.76k|# define ossl_isspace(c)        (ossl_ctype_check((c), CTYPE_MASK_space))
  |  |  ------------------
  |  |  |  |   30|  7.76k|# define CTYPE_MASK_space       0x8
  |  |  ------------------
  |  |  |  Branch (82:33): [True: 1.81k, False: 5.94k]
  |  |  ------------------
  ------------------
  458|   216k|        } else {
  459|   216k|            *to++ = ossl_tolower(*from);
  460|   216k|            from++;
  461|   216k|            i++;
  462|   216k|        }
  463|  6.47M|    }
  464|       |
  465|   214k|    out->length = to - out->data;
  466|       |
  467|   214k|    return 1;
  468|       |
  469|   215k|}
x_name.c:i2d_name_canon:
  473|  3.99k|{
  474|  3.99k|    int i, len, ltmp;
  475|  3.99k|    const ASN1_VALUE *v;
  476|  3.99k|    STACK_OF(ASN1_VALUE) *intname = (STACK_OF(ASN1_VALUE) *)_intname;
  ------------------
  |  |   31|  3.99k|# define STACK_OF(type) struct stack_st_##type
  ------------------
  477|       |
  478|  3.99k|    len = 0;
  479|  16.2k|    for (i = 0; i < sk_ASN1_VALUE_num(intname); i++) {
  ------------------
  |  |  898|  16.2k|#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk))
  ------------------
  |  Branch (479:17): [True: 12.2k, False: 3.99k]
  ------------------
  480|  12.2k|        v = sk_ASN1_VALUE_value(intname, i);
  ------------------
  |  |  899|  12.2k|#define sk_ASN1_VALUE_value(sk, idx) ((ASN1_VALUE *)OPENSSL_sk_value(ossl_check_const_ASN1_VALUE_sk_type(sk), (idx)))
  ------------------
  481|  12.2k|        ltmp = ASN1_item_ex_i2d(&v, in,
  482|  12.2k|                                ASN1_ITEM_rptr(X509_NAME_ENTRIES), -1, -1);
  ------------------
  |  |  426|  12.2k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  483|  12.2k|        if (ltmp < 0)
  ------------------
  |  Branch (483:13): [True: 0, False: 12.2k]
  ------------------
  484|      0|            return ltmp;
  485|  12.2k|        len += ltmp;
  486|  12.2k|    }
  487|  3.99k|    return len;
  488|  3.99k|}
x_name.c:local_sk_X509_NAME_ENTRY_free:
  132|   617k|{
  133|   617k|    sk_X509_NAME_ENTRY_free(ne);
  ------------------
  |  |  202|   617k|#define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  134|   617k|}
x_name.c:local_sk_X509_NAME_ENTRY_pop_free:
  137|  1.40M|{
  138|  1.40M|    sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
  ------------------
  |  |  210|  1.40M|#define sk_X509_NAME_ENTRY_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_NAME_ENTRY_sk_type(sk),ossl_check_X509_NAME_ENTRY_freefunc_type(freefunc))
  ------------------
  139|  1.40M|}
x_name.c:x509_name_ex_i2d:
  216|  16.0k|{
  217|  16.0k|    int ret;
  218|  16.0k|    X509_NAME *a = (X509_NAME *)*val;
  219|       |
  220|  16.0k|    if (a->modified) {
  ------------------
  |  Branch (220:9): [True: 282, False: 15.7k]
  ------------------
  221|    282|        ret = x509_name_encode(a);
  222|    282|        if (ret < 0)
  ------------------
  |  Branch (222:13): [True: 0, False: 282]
  ------------------
  223|      0|            return ret;
  224|    282|        ret = x509_name_canon(a);
  225|    282|        if (!ret)
  ------------------
  |  Branch (225:13): [True: 20, False: 262]
  ------------------
  226|     20|            return -1;
  227|    282|    }
  228|  16.0k|    ret = a->bytes->length;
  229|  16.0k|    if (out != NULL) {
  ------------------
  |  Branch (229:9): [True: 2.93k, False: 13.1k]
  ------------------
  230|  2.93k|        memcpy(*out, a->bytes->data, ret);
  231|  2.93k|        *out += ret;
  232|  2.93k|    }
  233|  16.0k|    return ret;
  234|  16.0k|}
x_name.c:x509_name_encode:
  237|    282|{
  238|    282|    union {
  239|    282|        STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
  240|    282|        const ASN1_VALUE *a;
  241|    282|    } intname = {
  242|    282|        NULL
  243|    282|    };
  244|    282|    int len;
  245|    282|    unsigned char *p;
  246|    282|    STACK_OF(X509_NAME_ENTRY) *entries = NULL;
  ------------------
  |  |   31|    282|# define STACK_OF(type) struct stack_st_##type
  ------------------
  247|    282|    X509_NAME_ENTRY *entry;
  248|    282|    int i, set = -1;
  249|       |
  250|    282|    intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
  251|    282|    if (!intname.s)
  ------------------
  |  Branch (251:9): [True: 0, False: 282]
  ------------------
  252|      0|        goto cerr;
  253|   117k|    for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
  ------------------
  |  |  196|   117k|#define sk_X509_NAME_ENTRY_num(sk) OPENSSL_sk_num(ossl_check_const_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  |  Branch (253:17): [True: 117k, False: 282]
  ------------------
  254|   117k|        entry = sk_X509_NAME_ENTRY_value(a->entries, i);
  ------------------
  |  |  197|   117k|#define sk_X509_NAME_ENTRY_value(sk, idx) ((X509_NAME_ENTRY *)OPENSSL_sk_value(ossl_check_const_X509_NAME_ENTRY_sk_type(sk), (idx)))
  ------------------
  255|   117k|        if (entry->set != set) {
  ------------------
  |  Branch (255:13): [True: 2.81k, False: 114k]
  ------------------
  256|  2.81k|            entries = sk_X509_NAME_ENTRY_new_null();
  ------------------
  |  |  199|  2.81k|#define sk_X509_NAME_ENTRY_new_null() ((STACK_OF(X509_NAME_ENTRY) *)OPENSSL_sk_new_null())
  ------------------
  257|  2.81k|            if (!entries)
  ------------------
  |  Branch (257:17): [True: 0, False: 2.81k]
  ------------------
  258|      0|                goto cerr;
  259|  2.81k|            if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, entries)) {
  ------------------
  |  Branch (259:17): [True: 0, False: 2.81k]
  ------------------
  260|      0|                sk_X509_NAME_ENTRY_free(entries);
  ------------------
  |  |  202|      0|#define sk_X509_NAME_ENTRY_free(sk) OPENSSL_sk_free(ossl_check_X509_NAME_ENTRY_sk_type(sk))
  ------------------
  261|      0|                goto cerr;
  262|      0|            }
  263|  2.81k|            set = entry->set;
  264|  2.81k|        }
  265|   117k|        if (!sk_X509_NAME_ENTRY_push(entries, entry))
  ------------------
  |  |  206|   117k|#define sk_X509_NAME_ENTRY_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_NAME_ENTRY_sk_type(sk), ossl_check_X509_NAME_ENTRY_type(ptr))
  ------------------
  |  Branch (265:13): [True: 0, False: 117k]
  ------------------
  266|      0|            goto cerr;
  267|   117k|    }
  268|    282|    len = ASN1_item_ex_i2d(&intname.a, NULL,
  269|    282|                           ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
  ------------------
  |  |  426|    282|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  270|    282|    if (!BUF_MEM_grow(a->bytes, len)) {
  ------------------
  |  Branch (270:9): [True: 0, False: 282]
  ------------------
  271|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_BUF_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|        goto err;
  273|      0|    }
  274|    282|    p = (unsigned char *)a->bytes->data;
  275|    282|    ASN1_item_ex_i2d(&intname.a,
  276|    282|                     &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
  ------------------
  |  |  426|    282|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  277|    282|    sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
  278|    282|                                         local_sk_X509_NAME_ENTRY_free);
  279|    282|    a->modified = 0;
  280|    282|    return len;
  281|      0| cerr:
  282|      0|    ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  283|      0| err:
  284|      0|    sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
  285|      0|                                         local_sk_X509_NAME_ENTRY_free);
  286|      0|    return -1;
  287|      0|}
x_name.c:x509_name_ex_print:
  292|  2.56k|{
  293|  2.56k|    if (X509_NAME_print_ex(out, (const X509_NAME *)*pval,
  ------------------
  |  Branch (293:9): [True: 45, False: 2.52k]
  ------------------
  294|  2.56k|                           indent, pctx->nm_flags) <= 0)
  295|     45|        return 0;
  296|  2.52k|    return 2;
  297|  2.56k|}

ossl_d2i_X509_PUBKEY_INTERNAL:
   71|  41.3k|{
   72|  41.3k|    X509_PUBKEY *xpub = OPENSSL_zalloc(sizeof(*xpub));
  ------------------
  |  |   99|  41.3k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  41.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  41.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   73|       |
   74|  41.3k|    if (xpub == NULL)
  ------------------
  |  Branch (74:9): [True: 0, False: 41.3k]
  ------------------
   75|      0|        return NULL;
   76|  41.3k|    return (X509_PUBKEY *)ASN1_item_d2i_ex((ASN1_VALUE **)&xpub, pp, len,
   77|  41.3k|                                           ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL),
  ------------------
  |  |  426|  41.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
   78|  41.3k|                                           libctx, propq);
   79|  41.3k|}
ossl_X509_PUBKEY_INTERNAL_free:
   82|  72.3k|{
   83|  72.3k|    ASN1_item_free((ASN1_VALUE *)xpub, ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL));
  ------------------
  |  |  426|  72.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
   84|  72.3k|}
X509_PUBKEY_get0:
  456|  30.4k|{
  457|  30.4k|    if (key == NULL) {
  ------------------
  |  Branch (457:9): [True: 0, False: 30.4k]
  ------------------
  458|      0|        ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  459|      0|        return NULL;
  460|      0|    }
  461|       |
  462|  30.4k|    if (key->pkey == NULL) {
  ------------------
  |  Branch (462:9): [True: 16.8k, False: 13.5k]
  ------------------
  463|       |        /* We failed to decode the key when we loaded it, or it was never set */
  464|  16.8k|        ERR_raise(ERR_LIB_EVP, EVP_R_DECODE_ERROR);
  ------------------
  |  |  401|  16.8k|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|  16.8k|    (ERR_new(),                                                 \
  |  |  |  |  404|  16.8k|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  16.8k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  16.8k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|  16.8k|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|  16.8k|     ERR_set_error)
  |  |  ------------------
  ------------------
  465|  16.8k|        return NULL;
  466|  16.8k|    }
  467|       |
  468|  13.5k|    return key->pkey;
  469|  30.4k|}
X509_PUBKEY_get:
  472|  30.4k|{
  473|  30.4k|    EVP_PKEY *ret = X509_PUBKEY_get0(key);
  474|       |
  475|  30.4k|    if (ret != NULL && !EVP_PKEY_up_ref(ret)) {
  ------------------
  |  Branch (475:9): [True: 13.5k, False: 16.8k]
  |  Branch (475:24): [True: 0, False: 13.5k]
  ------------------
  476|      0|        ERR_raise(ERR_LIB_X509, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  477|      0|        ret = NULL;
  478|      0|    }
  479|  30.4k|    return ret;
  480|  30.4k|}
ossl_d2i_PUBKEY_legacy:
  536|  32.4k|{
  537|  32.4k|    return d2i_PUBKEY_int(a, pp, length, NULL, NULL, 1, d2i_X509_PUBKEY);
  538|  32.4k|}
d2i_PUBKEY_ex:
  542|      1|{
  543|      1|    return d2i_PUBKEY_int(a, pp, length, libctx, propq, 0, d2i_X509_PUBKEY);
  544|      1|}
d2i_RSA_PUBKEY:
  606|  8.05k|{
  607|  8.05k|    EVP_PKEY *pkey;
  608|  8.05k|    RSA *key = NULL;
  609|  8.05k|    const unsigned char *q;
  610|       |
  611|  8.05k|    q = *pp;
  612|  8.05k|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  613|  8.05k|    if (pkey == NULL)
  ------------------
  |  Branch (613:9): [True: 4.43k, False: 3.62k]
  ------------------
  614|  4.43k|        return NULL;
  615|  3.62k|    key = EVP_PKEY_get1_RSA(pkey);
  616|  3.62k|    EVP_PKEY_free(pkey);
  617|  3.62k|    if (key == NULL)
  ------------------
  |  Branch (617:9): [True: 0, False: 3.62k]
  ------------------
  618|      0|        return NULL;
  619|  3.62k|    *pp = q;
  620|  3.62k|    if (a != NULL) {
  ------------------
  |  Branch (620:9): [True: 0, False: 3.62k]
  ------------------
  621|      0|        RSA_free(*a);
  622|      0|        *a = key;
  623|      0|    }
  624|  3.62k|    return key;
  625|  3.62k|}
ossl_d2i_DH_PUBKEY:
  647|    137|{
  648|    137|    EVP_PKEY *pkey;
  649|    137|    DH *key = NULL;
  650|    137|    const unsigned char *q;
  651|       |
  652|    137|    q = *pp;
  653|    137|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  654|    137|    if (pkey == NULL)
  ------------------
  |  Branch (654:9): [True: 77, False: 60]
  ------------------
  655|     77|        return NULL;
  656|     60|    if (EVP_PKEY_get_id(pkey) == EVP_PKEY_DH)
  ------------------
  |  |   67|     60|# define EVP_PKEY_DH     NID_dhKeyAgreement
  |  |  ------------------
  |  |  |  |  621|     60|#define NID_dhKeyAgreement              28
  |  |  ------------------
  ------------------
  |  Branch (656:9): [True: 60, False: 0]
  ------------------
  657|     60|        key = EVP_PKEY_get1_DH(pkey);
  658|     60|    EVP_PKEY_free(pkey);
  659|     60|    if (key == NULL)
  ------------------
  |  Branch (659:9): [True: 0, False: 60]
  ------------------
  660|      0|        return NULL;
  661|     60|    *pp = q;
  662|     60|    if (a != NULL) {
  ------------------
  |  Branch (662:9): [True: 0, False: 60]
  ------------------
  663|      0|        DH_free(*a);
  664|      0|        *a = key;
  665|      0|    }
  666|     60|    return key;
  667|     60|}
ossl_d2i_DHx_PUBKEY:
  688|  2.81k|{
  689|  2.81k|    EVP_PKEY *pkey;
  690|  2.81k|    DH *key = NULL;
  691|  2.81k|    const unsigned char *q;
  692|       |
  693|  2.81k|    q = *pp;
  694|  2.81k|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  695|  2.81k|    if (pkey == NULL)
  ------------------
  |  Branch (695:9): [True: 2.81k, False: 1]
  ------------------
  696|  2.81k|        return NULL;
  697|      1|    if (EVP_PKEY_get_id(pkey) == EVP_PKEY_DHX)
  ------------------
  |  |   68|      1|# define EVP_PKEY_DHX    NID_dhpublicnumber
  |  |  ------------------
  |  |  |  | 5295|      1|#define NID_dhpublicnumber              920
  |  |  ------------------
  ------------------
  |  Branch (697:9): [True: 1, False: 0]
  ------------------
  698|      1|        key = EVP_PKEY_get1_DH(pkey);
  699|      1|    EVP_PKEY_free(pkey);
  700|      1|    if (key == NULL)
  ------------------
  |  Branch (700:9): [True: 0, False: 1]
  ------------------
  701|      0|        return NULL;
  702|      1|    *pp = q;
  703|      1|    if (a != NULL) {
  ------------------
  |  Branch (703:9): [True: 0, False: 1]
  ------------------
  704|      0|        DH_free(*a);
  705|      0|        *a = key;
  706|      0|    }
  707|      1|    return key;
  708|      1|}
d2i_DSA_PUBKEY:
  731|  4.29k|{
  732|  4.29k|    EVP_PKEY *pkey;
  733|  4.29k|    DSA *key = NULL;
  734|  4.29k|    const unsigned char *q;
  735|       |
  736|  4.29k|    q = *pp;
  737|  4.29k|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  738|  4.29k|    if (pkey == NULL)
  ------------------
  |  Branch (738:9): [True: 4.27k, False: 18]
  ------------------
  739|  4.27k|        return NULL;
  740|     18|    key = EVP_PKEY_get1_DSA(pkey);
  741|     18|    EVP_PKEY_free(pkey);
  742|     18|    if (key == NULL)
  ------------------
  |  Branch (742:9): [True: 0, False: 18]
  ------------------
  743|      0|        return NULL;
  744|     18|    *pp = q;
  745|     18|    if (a != NULL) {
  ------------------
  |  Branch (745:9): [True: 0, False: 18]
  ------------------
  746|      0|        DSA_free(*a);
  747|      0|        *a = key;
  748|      0|    }
  749|     18|    return key;
  750|     18|}
ossl_d2i_DSA_PUBKEY:
  754|  4.29k|{
  755|  4.29k|    DSA *key = NULL;
  756|  4.29k|    const unsigned char *data;
  757|  4.29k|    const BIGNUM *p, *q, *g;
  758|       |
  759|  4.29k|    data = *pp;
  760|  4.29k|    key = d2i_DSA_PUBKEY(NULL, &data, length);
  761|  4.29k|    if (key == NULL)
  ------------------
  |  Branch (761:9): [True: 4.27k, False: 18]
  ------------------
  762|  4.27k|        return NULL;
  763|     18|    DSA_get0_pqg(key, &p, &q, &g);
  764|     18|    if (p == NULL || q == NULL || g == NULL) {
  ------------------
  |  Branch (764:9): [True: 8, False: 10]
  |  Branch (764:22): [True: 0, False: 10]
  |  Branch (764:35): [True: 0, False: 10]
  ------------------
  765|      8|        DSA_free(key);
  766|      8|        return NULL;
  767|      8|    }
  768|     10|    *pp = data;
  769|     10|    if (a != NULL) {
  ------------------
  |  Branch (769:9): [True: 0, False: 10]
  ------------------
  770|      0|        DSA_free(*a);
  771|      0|        *a = key;
  772|      0|    }
  773|     10|    return key;
  774|     18|}
d2i_EC_PUBKEY:
  797|  17.1k|{
  798|  17.1k|    EVP_PKEY *pkey;
  799|  17.1k|    EC_KEY *key = NULL;
  800|  17.1k|    const unsigned char *q;
  801|  17.1k|    int type;
  802|       |
  803|  17.1k|    q = *pp;
  804|  17.1k|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  805|  17.1k|    if (pkey == NULL)
  ------------------
  |  Branch (805:9): [True: 7.29k, False: 9.85k]
  ------------------
  806|  7.29k|        return NULL;
  807|  9.85k|    type = EVP_PKEY_get_id(pkey);
  808|  9.85k|    if (type == EVP_PKEY_EC || type == EVP_PKEY_SM2)
  ------------------
  |  |   69|  9.85k|# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
  |  |  ------------------
  |  |  |  |  178|  19.7k|#define NID_X9_62_id_ecPublicKey                408
  |  |  ------------------
  ------------------
                  if (type == EVP_PKEY_EC || type == EVP_PKEY_SM2)
  ------------------
  |  |   70|     10|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|     10|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  |  Branch (808:9): [True: 9.84k, False: 10]
  |  Branch (808:32): [True: 10, False: 0]
  ------------------
  809|  9.85k|        key = EVP_PKEY_get1_EC_KEY(pkey);
  810|  9.85k|    EVP_PKEY_free(pkey);
  811|  9.85k|    if (key == NULL)
  ------------------
  |  Branch (811:9): [True: 0, False: 9.85k]
  ------------------
  812|      0|        return NULL;
  813|  9.85k|    *pp = q;
  814|  9.85k|    if (a != NULL) {
  ------------------
  |  Branch (814:9): [True: 0, False: 9.85k]
  ------------------
  815|      0|        EC_KEY_free(*a);
  816|      0|        *a = key;
  817|      0|    }
  818|  9.85k|    return key;
  819|  9.85k|}
ossl_d2i_ED25519_PUBKEY:
  842|      9|{
  843|      9|    EVP_PKEY *pkey;
  844|      9|    ECX_KEY *key = NULL;
  845|      9|    const unsigned char *q;
  846|       |
  847|      9|    q = *pp;
  848|      9|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  849|      9|    if (pkey == NULL)
  ------------------
  |  Branch (849:9): [True: 6, False: 3]
  ------------------
  850|      6|        return NULL;
  851|      3|    key = ossl_evp_pkey_get1_ED25519(pkey);
  852|      3|    EVP_PKEY_free(pkey);
  853|      3|    if (key == NULL)
  ------------------
  |  Branch (853:9): [True: 0, False: 3]
  ------------------
  854|      0|        return NULL;
  855|      3|    *pp = q;
  856|      3|    if (a != NULL) {
  ------------------
  |  Branch (856:9): [True: 0, False: 3]
  ------------------
  857|      0|        ossl_ecx_key_free(*a);
  858|      0|        *a = key;
  859|      0|    }
  860|      3|    return key;
  861|      3|}
ossl_d2i_ED448_PUBKEY:
  883|      8|{
  884|      8|    EVP_PKEY *pkey;
  885|      8|    ECX_KEY *key = NULL;
  886|      8|    const unsigned char *q;
  887|       |
  888|      8|    q = *pp;
  889|      8|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  890|      8|    if (pkey == NULL)
  ------------------
  |  Branch (890:9): [True: 7, False: 1]
  ------------------
  891|      7|        return NULL;
  892|      1|    if (EVP_PKEY_get_id(pkey) == EVP_PKEY_ED448)
  ------------------
  |  |   81|      1|# define EVP_PKEY_ED448 NID_ED448
  |  |  ------------------
  |  |  |  | 5504|      1|#define NID_ED448               1088
  |  |  ------------------
  ------------------
  |  Branch (892:9): [True: 1, False: 0]
  ------------------
  893|      1|        key = ossl_evp_pkey_get1_ED448(pkey);
  894|      1|    EVP_PKEY_free(pkey);
  895|      1|    if (key == NULL)
  ------------------
  |  Branch (895:9): [True: 0, False: 1]
  ------------------
  896|      0|        return NULL;
  897|      1|    *pp = q;
  898|      1|    if (a != NULL) {
  ------------------
  |  Branch (898:9): [True: 0, False: 1]
  ------------------
  899|      0|        ossl_ecx_key_free(*a);
  900|      0|        *a = key;
  901|      0|    }
  902|      1|    return key;
  903|      1|}
ossl_d2i_X25519_PUBKEY:
  925|      7|{
  926|      7|    EVP_PKEY *pkey;
  927|      7|    ECX_KEY *key = NULL;
  928|      7|    const unsigned char *q;
  929|       |
  930|      7|    q = *pp;
  931|      7|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  932|      7|    if (pkey == NULL)
  ------------------
  |  Branch (932:9): [True: 4, False: 3]
  ------------------
  933|      4|        return NULL;
  934|      3|    if (EVP_PKEY_get_id(pkey) == EVP_PKEY_X25519)
  ------------------
  |  |   78|      3|# define EVP_PKEY_X25519 NID_X25519
  |  |  ------------------
  |  |  |  | 5492|      3|#define NID_X25519              1034
  |  |  ------------------
  ------------------
  |  Branch (934:9): [True: 3, False: 0]
  ------------------
  935|      3|        key = ossl_evp_pkey_get1_X25519(pkey);
  936|      3|    EVP_PKEY_free(pkey);
  937|      3|    if (key == NULL)
  ------------------
  |  Branch (937:9): [True: 0, False: 3]
  ------------------
  938|      0|        return NULL;
  939|      3|    *pp = q;
  940|      3|    if (a != NULL) {
  ------------------
  |  Branch (940:9): [True: 0, False: 3]
  ------------------
  941|      0|        ossl_ecx_key_free(*a);
  942|      0|        *a = key;
  943|      0|    }
  944|      3|    return key;
  945|      3|}
ossl_d2i_X448_PUBKEY:
  967|      6|{
  968|      6|    EVP_PKEY *pkey;
  969|      6|    ECX_KEY *key = NULL;
  970|      6|    const unsigned char *q;
  971|       |
  972|      6|    q = *pp;
  973|      6|    pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length);
  974|      6|    if (pkey == NULL)
  ------------------
  |  Branch (974:9): [True: 5, False: 1]
  ------------------
  975|      5|        return NULL;
  976|      1|    if (EVP_PKEY_get_id(pkey) == EVP_PKEY_X448)
  ------------------
  |  |   80|      1|# define EVP_PKEY_X448 NID_X448
  |  |  ------------------
  |  |  |  | 5496|      1|#define NID_X448                1035
  |  |  ------------------
  ------------------
  |  Branch (976:9): [True: 1, False: 0]
  ------------------
  977|      1|        key = ossl_evp_pkey_get1_X448(pkey);
  978|      1|    EVP_PKEY_free(pkey);
  979|      1|    if (key == NULL)
  ------------------
  |  Branch (979:9): [True: 0, False: 1]
  ------------------
  980|      0|        return NULL;
  981|      1|    *pp = q;
  982|      1|    if (a != NULL) {
  ------------------
  |  Branch (982:9): [True: 0, False: 1]
  ------------------
  983|      0|        ossl_ecx_key_free(*a);
  984|      0|        *a = key;
  985|      0|    }
  986|      1|    return key;
  987|      1|}
X509_PUBKEY_get0_param:
 1031|  61.4k|{
 1032|  61.4k|    if (ppkalg)
  ------------------
  |  Branch (1032:9): [True: 0, False: 61.4k]
  ------------------
 1033|      0|        *ppkalg = pub->algor->algorithm;
 1034|  61.4k|    if (pk) {
  ------------------
  |  Branch (1034:9): [True: 30.4k, False: 31.0k]
  ------------------
 1035|  30.4k|        *pk = pub->public_key->data;
 1036|  30.4k|        *ppklen = pub->public_key->length;
 1037|  30.4k|    }
 1038|  61.4k|    if (pa)
  ------------------
  |  Branch (1038:9): [True: 61.4k, False: 0]
  ------------------
 1039|  61.4k|        *pa = pub->algor;
 1040|  61.4k|    return 1;
 1041|  61.4k|}
ossl_x509_PUBKEY_get0_libctx:
 1073|  17.1k|{
 1074|  17.1k|    if (plibctx)
  ------------------
  |  Branch (1074:9): [True: 17.1k, False: 0]
  ------------------
 1075|  17.1k|        *plibctx = key->libctx;
 1076|  17.1k|    if (ppropq)
  ------------------
  |  Branch (1076:9): [True: 17.1k, False: 0]
  ------------------
 1077|  17.1k|        *ppropq = key->propq;
 1078|  17.1k|    return 1;
 1079|  17.1k|}
x_pubkey.c:x509_pubkey_ex_i2d:
  240|  1.23k|{
  241|  1.23k|    return ASN1_item_ex_i2d(pval, out, ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL),
  ------------------
  |  |  426|  1.23k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  242|  1.23k|                            tag, aclass);
  243|  1.23k|}
x_pubkey.c:x509_pubkey_ex_print:
  247|    621|{
  248|    621|    return ASN1_item_print(out, *pval, indent,
  249|    621|                           ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL), pctx);
  ------------------
  |  |  426|    621|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  250|    621|}
x_pubkey.c:x509_pubkey_ex_new_ex:
  113|   100k|{
  114|   100k|    X509_PUBKEY *ret;
  115|       |
  116|   100k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|   100k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   100k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   100k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (116:9): [True: 0, False: 100k]
  ------------------
  117|      0|        return 0;
  118|   100k|    if (!x509_pubkey_ex_populate((ASN1_VALUE **)&ret, NULL)
  ------------------
  |  Branch (118:9): [True: 0, False: 100k]
  ------------------
  119|   100k|        || !x509_pubkey_set0_libctx(ret, libctx, propq)) {
  ------------------
  |  Branch (119:12): [True: 0, False: 100k]
  ------------------
  120|      0|        x509_pubkey_ex_free((ASN1_VALUE **)&ret, NULL);
  121|      0|        ret = NULL;
  122|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_X509_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  123|   100k|    } else {
  124|   100k|        *pval = (ASN1_VALUE *)ret;
  125|   100k|    }
  126|       |
  127|   100k|    return ret != NULL;
  128|   100k|}
x_pubkey.c:x509_pubkey_ex_populate:
  101|   189k|{
  102|   189k|    X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval;
  103|       |
  104|   189k|    return (pubkey->algor != NULL
  ------------------
  |  Branch (104:13): [True: 56.0k, False: 133k]
  ------------------
  105|   189k|            || (pubkey->algor = X509_ALGOR_new()) != NULL)
  ------------------
  |  Branch (105:16): [True: 133k, False: 0]
  ------------------
  106|   189k|        && (pubkey->public_key != NULL
  ------------------
  |  Branch (106:13): [True: 56.0k, False: 133k]
  ------------------
  107|   189k|            || (pubkey->public_key = ASN1_BIT_STRING_new()) != NULL);
  ------------------
  |  Branch (107:16): [True: 133k, False: 0]
  ------------------
  108|   189k|}
x_pubkey.c:x509_pubkey_ex_d2i_ex:
  135|  88.5k|{
  136|  88.5k|    const unsigned char *in_saved = *in;
  137|  88.5k|    size_t publen;
  138|  88.5k|    X509_PUBKEY *pubkey;
  139|  88.5k|    int ret;
  140|  88.5k|    OSSL_DECODER_CTX *dctx = NULL;
  141|  88.5k|    unsigned char *tmpbuf = NULL;
  142|       |
  143|  88.5k|    if (*pval == NULL && !x509_pubkey_ex_new_ex(pval, it, libctx, propq))
  ------------------
  |  Branch (143:9): [True: 11.7k, False: 76.8k]
  |  Branch (143:26): [True: 0, False: 11.7k]
  ------------------
  144|      0|        return 0;
  145|  88.5k|    if (!x509_pubkey_ex_populate(pval, NULL)) {
  ------------------
  |  Branch (145:9): [True: 0, False: 88.5k]
  ------------------
  146|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_X509_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  147|      0|        return 0;
  148|      0|    }
  149|       |
  150|       |    /* This ensures that |*in| advances properly no matter what */
  151|  88.5k|    if ((ret = ASN1_item_ex_d2i(pval, in, len,
  ------------------
  |  Branch (151:9): [True: 24.3k, False: 64.1k]
  ------------------
  152|  88.5k|                                ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL),
  ------------------
  |  |  426|  88.5k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  153|  88.5k|                                tag, aclass, opt, ctx)) <= 0)
  154|  24.3k|        return ret;
  155|       |
  156|  64.1k|    publen = *in - in_saved;
  157|  64.1k|    if (!ossl_assert(publen > 0)) {
  ------------------
  |  |   52|  64.1k|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|  64.1k|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (157:9): [True: 0, False: 64.1k]
  ------------------
  158|      0|        ERR_raise(ERR_LIB_ASN1, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  159|      0|        return 0;
  160|      0|    }
  161|       |
  162|  64.1k|    pubkey = (X509_PUBKEY *)*pval;
  163|  64.1k|    EVP_PKEY_free(pubkey->pkey);
  164|  64.1k|    pubkey->pkey = NULL;
  165|       |
  166|       |    /*
  167|       |     * Opportunistically decode the key but remove any non fatal errors
  168|       |     * from the queue. Subsequent explicit attempts to decode/use the key
  169|       |     * will return an appropriate error.
  170|       |     */
  171|  64.1k|    ERR_set_mark();
  172|       |
  173|       |    /*
  174|       |     * Try to decode with legacy method first.  This ensures that engines
  175|       |     * aren't overridden by providers.
  176|       |     */
  177|  64.1k|    if ((ret = x509_pubkey_decode(&pubkey->pkey, pubkey)) == -1) {
  ------------------
  |  Branch (177:9): [True: 0, False: 64.1k]
  ------------------
  178|       |        /* -1 indicates a fatal error, like malloc failure */
  179|      0|        ERR_clear_last_mark();
  180|      0|        goto end;
  181|      0|    }
  182|       |
  183|       |    /* Try to decode it into an EVP_PKEY with OSSL_DECODER */
  184|  64.1k|    if (ret <= 0 && !pubkey->flag_force_legacy) {
  ------------------
  |  Branch (184:9): [True: 50.5k, False: 13.5k]
  |  Branch (184:21): [True: 33.7k, False: 16.8k]
  ------------------
  185|  33.7k|        const unsigned char *p;
  186|  33.7k|        char txtoidname[OSSL_MAX_NAME_SIZE];
  187|  33.7k|        size_t slen = publen;
  188|       |
  189|       |        /*
  190|       |        * The decoders don't know how to handle anything other than Universal
  191|       |        * class so we modify the data accordingly.
  192|       |        */
  193|  33.7k|        if (aclass != V_ASN1_UNIVERSAL) {
  ------------------
  |  |   47|  33.7k|# define V_ASN1_UNIVERSAL                0x00
  ------------------
  |  Branch (193:13): [True: 0, False: 33.7k]
  ------------------
  194|      0|            tmpbuf = OPENSSL_memdup(in_saved, publen);
  ------------------
  |  |  109|      0|        CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  195|      0|            if (tmpbuf == NULL)
  ------------------
  |  Branch (195:17): [True: 0, False: 0]
  ------------------
  196|      0|                return 0;
  197|      0|            in_saved = tmpbuf;
  198|      0|            *tmpbuf = V_ASN1_CONSTRUCTED | V_ASN1_SEQUENCE;
  ------------------
  |  |   52|      0|# define V_ASN1_CONSTRUCTED              0x20
  ------------------
                          *tmpbuf = V_ASN1_CONSTRUCTED | V_ASN1_SEQUENCE;
  ------------------
  |  |   74|      0|# define V_ASN1_SEQUENCE                 16
  ------------------
  199|      0|        }
  200|  33.7k|        p = in_saved;
  201|       |
  202|  33.7k|        if (OBJ_obj2txt(txtoidname, sizeof(txtoidname),
  ------------------
  |  Branch (202:13): [True: 0, False: 33.7k]
  ------------------
  203|  33.7k|                        pubkey->algor->algorithm, 0) <= 0) {
  204|      0|            ERR_clear_last_mark();
  205|      0|            goto end;
  206|      0|        }
  207|  33.7k|        if ((dctx =
  ------------------
  |  Branch (207:13): [True: 33.7k, False: 0]
  ------------------
  208|  33.7k|             OSSL_DECODER_CTX_new_for_pkey(&pubkey->pkey,
  209|  33.7k|                                           "DER", "SubjectPublicKeyInfo",
  210|  33.7k|                                           txtoidname, EVP_PKEY_PUBLIC_KEY,
  ------------------
  |  |   89|  33.7k|    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |   87|  33.7k|    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
  |  |  |  |  ------------------
  |  |  |  |  |  |  549|  33.7k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  544|  33.7k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  550|  33.7k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  545|  33.7k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  543|  33.7k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  211|  33.7k|                                           pubkey->libctx,
  212|  33.7k|                                           pubkey->propq)) != NULL)
  213|       |            /*
  214|       |             * As said higher up, we're being opportunistic.  In other words,
  215|       |             * we don't care if we fail.
  216|       |             */
  217|  33.7k|            if (OSSL_DECODER_from_data(dctx, &p, &slen)) {
  ------------------
  |  Branch (217:17): [True: 13.5k, False: 20.1k]
  ------------------
  218|  13.5k|                if (slen != 0) {
  ------------------
  |  Branch (218:21): [True: 0, False: 13.5k]
  ------------------
  219|       |                    /*
  220|       |                     * If we successfully decoded then we *must* consume all the
  221|       |                     * bytes.
  222|       |                     */
  223|      0|                    ERR_clear_last_mark();
  224|      0|                    ERR_raise(ERR_LIB_ASN1, EVP_R_DECODE_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  225|      0|                    goto end;
  226|      0|                }
  227|  13.5k|            }
  228|  33.7k|    }
  229|       |
  230|  64.1k|    ERR_pop_to_mark();
  231|  64.1k|    ret = 1;
  232|  64.1k| end:
  233|  64.1k|    OSSL_DECODER_CTX_free(dctx);
  234|  64.1k|    OPENSSL_free(tmpbuf);
  ------------------
  |  |  107|  64.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  64.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  64.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  235|  64.1k|    return ret;
  236|  64.1k|}
x_pubkey.c:x509_pubkey_set0_libctx:
   49|   133k|{
   50|   133k|    if (x != NULL) {
  ------------------
  |  Branch (50:9): [True: 133k, False: 0]
  ------------------
   51|   133k|        x->libctx = libctx;
   52|   133k|        OPENSSL_free(x->propq);
  ------------------
  |  |  107|   133k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   133k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   133k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   53|   133k|        x->propq = NULL;
   54|   133k|        if (propq != NULL) {
  ------------------
  |  Branch (54:13): [True: 0, False: 133k]
  ------------------
   55|      0|            x->propq = OPENSSL_strdup(propq);
  ------------------
  |  |  111|      0|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      0|            if (x->propq == NULL)
  ------------------
  |  Branch (56:17): [True: 0, False: 0]
  ------------------
   57|      0|                return 0;
   58|      0|        }
   59|   133k|    }
   60|   133k|    return 1;
   61|   133k|}
x_pubkey.c:x509_pubkey_ex_free:
   87|   108k|{
   88|   108k|    X509_PUBKEY *pubkey;
   89|       |
   90|   108k|    if (pval != NULL && (pubkey = (X509_PUBKEY *)*pval) != NULL) {
  ------------------
  |  Branch (90:9): [True: 108k, False: 0]
  |  Branch (90:25): [True: 108k, False: 0]
  ------------------
   91|   108k|        X509_ALGOR_free(pubkey->algor);
   92|   108k|        ASN1_BIT_STRING_free(pubkey->public_key);
   93|   108k|        EVP_PKEY_free(pubkey->pkey);
   94|   108k|        OPENSSL_free(pubkey->propq);
  ------------------
  |  |  107|   108k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   108k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   108k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   95|   108k|        OPENSSL_free(pubkey);
  ------------------
  |  |  107|   108k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   108k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   108k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   96|   108k|        *pval = NULL;
   97|   108k|    }
   98|   108k|}
x_pubkey.c:x509_pubkey_decode:
  405|  64.1k|{
  406|  64.1k|    EVP_PKEY *pkey;
  407|  64.1k|    int nid;
  408|       |
  409|  64.1k|    nid = OBJ_obj2nid(key->algor->algorithm);
  410|  64.1k|    if (!key->flag_force_legacy) {
  ------------------
  |  Branch (410:9): [True: 33.7k, False: 30.4k]
  ------------------
  411|  33.7k|#ifndef OPENSSL_NO_ENGINE
  412|  33.7k|        ENGINE *e = NULL;
  413|       |
  414|  33.7k|        e = ENGINE_get_pkey_meth_engine(nid);
  415|  33.7k|        if (e == NULL)
  ------------------
  |  Branch (415:13): [True: 33.7k, False: 0]
  ------------------
  416|  33.7k|            return 0;
  417|      0|        ENGINE_finish(e);
  418|       |#else
  419|       |        return 0;
  420|       |#endif
  421|      0|    }
  422|       |
  423|  30.4k|    pkey = EVP_PKEY_new();
  424|  30.4k|    if (pkey == NULL) {
  ------------------
  |  Branch (424:9): [True: 0, False: 30.4k]
  ------------------
  425|      0|        ERR_raise(ERR_LIB_X509, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  426|      0|        return -1;
  427|      0|    }
  428|       |
  429|  30.4k|    if (!EVP_PKEY_set_type(pkey, nid)) {
  ------------------
  |  Branch (429:9): [True: 0, False: 30.4k]
  ------------------
  430|      0|        ERR_raise(ERR_LIB_X509, X509_R_UNSUPPORTED_ALGORITHM);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  431|      0|        goto error;
  432|      0|    }
  433|       |
  434|  30.4k|    if (pkey->ameth->pub_decode) {
  ------------------
  |  Branch (434:9): [True: 30.4k, False: 0]
  ------------------
  435|       |        /*
  436|       |         * Treat any failure of pub_decode as a decode error. In
  437|       |         * future we could have different return codes for decode
  438|       |         * errors and fatal errors such as malloc failure.
  439|       |         */
  440|  30.4k|        if (!pkey->ameth->pub_decode(pkey, key))
  ------------------
  |  Branch (440:13): [True: 16.8k, False: 13.5k]
  ------------------
  441|  16.8k|            goto error;
  442|  30.4k|    } else {
  443|      0|        ERR_raise(ERR_LIB_X509, X509_R_METHOD_NOT_SUPPORTED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  444|      0|        goto error;
  445|      0|    }
  446|       |
  447|  13.5k|    *ppkey = pkey;
  448|  13.5k|    return 1;
  449|       |
  450|  16.8k| error:
  451|  16.8k|    EVP_PKEY_free(pkey);
  452|  16.8k|    return 0;
  453|  30.4k|}
x_pubkey.c:d2i_PUBKEY_int:
  494|  32.4k|{
  495|  32.4k|    X509_PUBKEY *xpk, *xpk2 = NULL, **pxpk = NULL;
  496|  32.4k|    EVP_PKEY *pktmp = NULL;
  497|  32.4k|    const unsigned char *q;
  498|       |
  499|  32.4k|    q = *pp;
  500|       |
  501|       |    /*
  502|       |     * If libctx or propq are non-NULL, we take advantage of the reuse
  503|       |     * feature.  It's not generally recommended, but is safe enough for
  504|       |     * newly created structures.
  505|       |     */
  506|  32.4k|    if (libctx != NULL || propq != NULL || force_legacy) {
  ------------------
  |  Branch (506:9): [True: 0, False: 32.4k]
  |  Branch (506:27): [True: 0, False: 32.4k]
  |  Branch (506:44): [True: 32.4k, False: 1]
  ------------------
  507|  32.4k|        xpk2 = OPENSSL_zalloc(sizeof(*xpk2));
  ------------------
  |  |   99|  32.4k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  32.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  32.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  508|  32.4k|        if (xpk2 == NULL)
  ------------------
  |  Branch (508:13): [True: 0, False: 32.4k]
  ------------------
  509|      0|            return NULL;
  510|  32.4k|        if (!x509_pubkey_set0_libctx(xpk2, libctx, propq))
  ------------------
  |  Branch (510:13): [True: 0, False: 32.4k]
  ------------------
  511|      0|            goto end;
  512|  32.4k|        xpk2->flag_force_legacy = !!force_legacy;
  513|  32.4k|        pxpk = &xpk2;
  514|  32.4k|    }
  515|  32.4k|    xpk = d2i_x509_pubkey(pxpk, &q, length);
  516|  32.4k|    if (xpk == NULL)
  ------------------
  |  Branch (516:9): [True: 2.04k, False: 30.4k]
  ------------------
  517|  2.04k|        goto end;
  518|  30.4k|    pktmp = X509_PUBKEY_get(xpk);
  519|  30.4k|    X509_PUBKEY_free(xpk);
  520|  30.4k|    xpk2 = NULL;                 /* We know that xpk == xpk2 */
  521|  30.4k|    if (pktmp == NULL)
  ------------------
  |  Branch (521:9): [True: 16.8k, False: 13.5k]
  ------------------
  522|  16.8k|        goto end;
  523|  13.5k|    *pp = q;
  524|  13.5k|    if (a != NULL) {
  ------------------
  |  Branch (524:9): [True: 0, False: 13.5k]
  ------------------
  525|      0|        EVP_PKEY_free(*a);
  526|      0|        *a = pktmp;
  527|      0|    }
  528|  32.4k| end:
  529|  32.4k|    X509_PUBKEY_free(xpk2);
  530|  32.4k|    return pktmp;
  531|  13.5k|}

x_req.c:rinf_cb:
   37|  85.0k|{
   38|  85.0k|    X509_REQ_INFO *rinf = (X509_REQ_INFO *)*pval;
   39|       |
   40|  85.0k|    if (operation == ASN1_OP_NEW_POST) {
  ------------------
  |  |  743|  85.0k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (40:9): [True: 18.4k, False: 66.6k]
  ------------------
   41|  18.4k|        rinf->attributes = sk_X509_ATTRIBUTE_new_null();
  ------------------
  |  |  259|  18.4k|#define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)OPENSSL_sk_new_null())
  ------------------
   42|  18.4k|        if (!rinf->attributes)
  ------------------
  |  Branch (42:13): [True: 0, False: 18.4k]
  ------------------
   43|      0|            return 0;
   44|  18.4k|    }
   45|  85.0k|    return 1;
   46|  85.0k|}
x_req.c:req_cb:
   50|  46.1k|{
   51|  46.1k|    X509_REQ *ret = (X509_REQ *)*pval;
   52|       |
   53|  46.1k|    switch (operation) {
  ------------------
  |  Branch (53:13): [True: 18.4k, False: 27.6k]
  ------------------
   54|  9.23k|    case ASN1_OP_D2I_PRE:
  ------------------
  |  |  746|  9.23k|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (54:5): [True: 9.23k, False: 36.9k]
  ------------------
   55|  9.23k|        ASN1_OCTET_STRING_free(ret->distinguishing_id);
   56|       |        /* fall through */
   57|  18.4k|    case ASN1_OP_NEW_POST:
  ------------------
  |  |  743|  18.4k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (57:5): [True: 9.23k, False: 36.9k]
  ------------------
   58|  18.4k|        ret->distinguishing_id = NULL;
   59|  18.4k|        break;
   60|       |
   61|  9.23k|    case ASN1_OP_FREE_POST:
  ------------------
  |  |  745|  9.23k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (61:5): [True: 9.23k, False: 36.9k]
  ------------------
   62|  9.23k|        ASN1_OCTET_STRING_free(ret->distinguishing_id);
   63|  9.23k|        OPENSSL_free(ret->propq);
  ------------------
  |  |  107|  9.23k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  9.23k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  9.23k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   64|  9.23k|        break;
   65|      0|    case ASN1_OP_DUP_POST:
  ------------------
  |  |  757|      0|# define ASN1_OP_DUP_POST        15
  ------------------
  |  Branch (65:5): [True: 0, False: 46.1k]
  ------------------
   66|      0|        {
   67|      0|            X509_REQ *old = exarg;
   68|       |
   69|      0|            if (!ossl_x509_req_set0_libctx(ret, old->libctx, old->propq))
  ------------------
  |  Branch (69:17): [True: 0, False: 0]
  ------------------
   70|      0|                return 0;
   71|      0|            if (old->req_info.pubkey != NULL) {
  ------------------
  |  Branch (71:17): [True: 0, False: 0]
  ------------------
   72|      0|                EVP_PKEY *pkey = X509_PUBKEY_get0(old->req_info.pubkey);
   73|       |
   74|      0|                if (pkey != NULL) {
  ------------------
  |  Branch (74:21): [True: 0, False: 0]
  ------------------
   75|      0|                    pkey = EVP_PKEY_dup(pkey);
   76|      0|                    if (pkey == NULL) {
  ------------------
  |  Branch (76:25): [True: 0, False: 0]
  ------------------
   77|      0|                        ERR_raise(ERR_LIB_X509, ERR_R_EVP_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   78|      0|                        return 0;
   79|      0|                    }
   80|      0|                    if (!X509_PUBKEY_set(&ret->req_info.pubkey, pkey)) {
  ------------------
  |  Branch (80:25): [True: 0, False: 0]
  ------------------
   81|      0|                        EVP_PKEY_free(pkey);
   82|      0|                        ERR_raise(ERR_LIB_X509, ERR_R_INTERNAL_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   83|      0|                        return 0;
   84|      0|                    }
   85|      0|                    EVP_PKEY_free(pkey);
   86|      0|                }
   87|      0|            }
   88|      0|        }
   89|      0|        break;
   90|      0|    case ASN1_OP_GET0_LIBCTX:
  ------------------
  |  |  758|      0|# define ASN1_OP_GET0_LIBCTX     16
  ------------------
  |  Branch (90:5): [True: 0, False: 46.1k]
  ------------------
   91|      0|        {
   92|      0|            OSSL_LIB_CTX **libctx = exarg;
   93|       |
   94|      0|            *libctx = ret->libctx;
   95|      0|        }
   96|      0|        break;
   97|      0|    case ASN1_OP_GET0_PROPQ:
  ------------------
  |  |  759|      0|# define ASN1_OP_GET0_PROPQ      17
  ------------------
  |  Branch (97:5): [True: 0, False: 46.1k]
  ------------------
   98|      0|        {
   99|      0|            const char **propq = exarg;
  100|       |
  101|      0|            *propq = ret->propq;
  102|      0|        }
  103|      0|        break;
  104|  46.1k|    }
  105|       |
  106|  46.1k|    return 1;
  107|  46.1k|}

x_x509.c:x509_cb:
   38|   245k|{
   39|   245k|    X509 *ret = (X509 *)*pval;
   40|       |
   41|   245k|    switch (operation) {
   42|       |
   43|  42.6k|    case ASN1_OP_D2I_PRE:
  ------------------
  |  |  746|  42.6k|# define ASN1_OP_D2I_PRE         4
  ------------------
  |  Branch (43:5): [True: 42.6k, False: 203k]
  ------------------
   44|  42.6k|        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
  ------------------
  |  |  221|  42.6k|# define CRYPTO_EX_INDEX_X509             3
  ------------------
   45|  42.6k|        X509_CERT_AUX_free(ret->aux);
   46|  42.6k|        ASN1_OCTET_STRING_free(ret->skid);
   47|  42.6k|        AUTHORITY_KEYID_free(ret->akid);
   48|  42.6k|        CRL_DIST_POINTS_free(ret->crldp);
   49|  42.6k|        ossl_policy_cache_free(ret->policy_cache);
   50|  42.6k|        GENERAL_NAMES_free(ret->altname);
   51|  42.6k|        NAME_CONSTRAINTS_free(ret->nc);
   52|  42.6k|#ifndef OPENSSL_NO_RFC3779
   53|  42.6k|        sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
  ------------------
  |  | 1223|  42.6k|#define sk_IPAddressFamily_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressFamily_sk_type(sk),ossl_check_IPAddressFamily_freefunc_type(freefunc))
  ------------------
   54|  42.6k|        ASIdentifiers_free(ret->rfc3779_asid);
   55|  42.6k|#endif
   56|  42.6k|        ASN1_OCTET_STRING_free(ret->distinguishing_id);
   57|       |
   58|       |        /* fall through */
   59|       |
   60|  85.3k|    case ASN1_OP_NEW_POST:
  ------------------
  |  |  743|  85.3k|# define ASN1_OP_NEW_POST        1
  ------------------
  |  Branch (60:5): [True: 42.6k, False: 203k]
  ------------------
   61|  85.3k|        ret->ex_cached = 0;
   62|  85.3k|        ret->ex_kusage = 0;
   63|  85.3k|        ret->ex_xkusage = 0;
   64|  85.3k|        ret->ex_nscert = 0;
   65|  85.3k|        ret->ex_flags = 0;
   66|  85.3k|        ret->ex_pathlen = -1;
   67|  85.3k|        ret->ex_pcpathlen = -1;
   68|  85.3k|        ret->skid = NULL;
   69|  85.3k|        ret->akid = NULL;
   70|  85.3k|        ret->policy_cache = NULL;
   71|  85.3k|        ret->altname = NULL;
   72|  85.3k|        ret->nc = NULL;
   73|  85.3k|#ifndef OPENSSL_NO_RFC3779
   74|  85.3k|        ret->rfc3779_addr = NULL;
   75|  85.3k|        ret->rfc3779_asid = NULL;
   76|  85.3k|#endif
   77|  85.3k|        ret->distinguishing_id = NULL;
   78|  85.3k|        ret->aux = NULL;
   79|  85.3k|        ret->crldp = NULL;
   80|  85.3k|        if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data))
  ------------------
  |  |  221|  85.3k|# define CRYPTO_EX_INDEX_X509             3
  ------------------
  |  Branch (80:13): [True: 0, False: 85.3k]
  ------------------
   81|      0|            return 0;
   82|  85.3k|        break;
   83|       |
   84|  85.3k|    case ASN1_OP_FREE_POST:
  ------------------
  |  |  745|  42.6k|# define ASN1_OP_FREE_POST       3
  ------------------
  |  Branch (84:5): [True: 42.6k, False: 203k]
  ------------------
   85|  42.6k|        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
  ------------------
  |  |  221|  42.6k|# define CRYPTO_EX_INDEX_X509             3
  ------------------
   86|  42.6k|        X509_CERT_AUX_free(ret->aux);
   87|  42.6k|        ASN1_OCTET_STRING_free(ret->skid);
   88|  42.6k|        AUTHORITY_KEYID_free(ret->akid);
   89|  42.6k|        CRL_DIST_POINTS_free(ret->crldp);
   90|  42.6k|        ossl_policy_cache_free(ret->policy_cache);
   91|  42.6k|        GENERAL_NAMES_free(ret->altname);
   92|  42.6k|        NAME_CONSTRAINTS_free(ret->nc);
   93|  42.6k|#ifndef OPENSSL_NO_RFC3779
   94|  42.6k|        sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
  ------------------
  |  | 1223|  42.6k|#define sk_IPAddressFamily_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressFamily_sk_type(sk),ossl_check_IPAddressFamily_freefunc_type(freefunc))
  ------------------
   95|  42.6k|        ASIdentifiers_free(ret->rfc3779_asid);
   96|  42.6k|#endif
   97|  42.6k|        ASN1_OCTET_STRING_free(ret->distinguishing_id);
   98|  42.6k|        OPENSSL_free(ret->propq);
  ------------------
  |  |  107|  42.6k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  42.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  42.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   99|  42.6k|        break;
  100|       |
  101|      0|    case ASN1_OP_DUP_POST:
  ------------------
  |  |  757|      0|# define ASN1_OP_DUP_POST        15
  ------------------
  |  Branch (101:5): [True: 0, False: 245k]
  ------------------
  102|      0|        {
  103|      0|            X509 *old = exarg;
  104|       |
  105|      0|            if (!ossl_x509_set0_libctx(ret, old->libctx, old->propq))
  ------------------
  |  Branch (105:17): [True: 0, False: 0]
  ------------------
  106|      0|                return 0;
  107|      0|        }
  108|      0|        break;
  109|      0|    case ASN1_OP_GET0_LIBCTX:
  ------------------
  |  |  758|      0|# define ASN1_OP_GET0_LIBCTX     16
  ------------------
  |  Branch (109:5): [True: 0, False: 245k]
  ------------------
  110|      0|        {
  111|      0|            OSSL_LIB_CTX **libctx = exarg;
  112|       |
  113|      0|            *libctx = ret->libctx;
  114|      0|        }
  115|      0|        break;
  116|       |
  117|      0|    case ASN1_OP_GET0_PROPQ:
  ------------------
  |  |  759|      0|# define ASN1_OP_GET0_PROPQ      17
  ------------------
  |  Branch (117:5): [True: 0, False: 245k]
  ------------------
  118|      0|        {
  119|      0|            const char **propq = exarg;
  120|       |
  121|      0|            *propq = ret->propq;
  122|      0|        }
  123|      0|        break;
  124|       |
  125|   117k|    default:
  ------------------
  |  Branch (125:5): [True: 117k, False: 128k]
  ------------------
  126|   117k|        break;
  127|   245k|    }
  128|       |
  129|   245k|    return 1;
  130|   245k|}

FuzzerInitialize:
  286|      2|{
  287|      2|    FuzzerSetRand();
  288|      2|    pctx = ASN1_PCTX_new();
  289|      2|    ASN1_PCTX_set_flags(pctx, ASN1_PCTX_FLAGS_SHOW_ABSENT |
  ------------------
  |  | 1050|      2|# define ASN1_PCTX_FLAGS_SHOW_ABSENT             0x001
  ------------------
  290|      2|        ASN1_PCTX_FLAGS_SHOW_SEQUENCE | ASN1_PCTX_FLAGS_SHOW_SSOF |
  ------------------
  |  | 1052|      2|# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE           0x002
  ------------------
                      ASN1_PCTX_FLAGS_SHOW_SEQUENCE | ASN1_PCTX_FLAGS_SHOW_SSOF |
  ------------------
  |  | 1054|      2|# define ASN1_PCTX_FLAGS_SHOW_SSOF               0x004
  ------------------
  291|      2|        ASN1_PCTX_FLAGS_SHOW_TYPE | ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME);
  ------------------
  |  | 1056|      2|# define ASN1_PCTX_FLAGS_SHOW_TYPE               0x008
  ------------------
                      ASN1_PCTX_FLAGS_SHOW_TYPE | ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME);
  ------------------
  |  | 1064|      2|# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME  0x080
  ------------------
  292|      2|    ASN1_PCTX_set_str_flags(pctx, ASN1_STRFLGS_UTF8_CONVERT |
  ------------------
  |  |  474|      2|# define ASN1_STRFLGS_UTF8_CONVERT       0x10
  ------------------
  293|      2|        ASN1_STRFLGS_SHOW_TYPE | ASN1_STRFLGS_DUMP_ALL);
  ------------------
  |  |  485|      2|# define ASN1_STRFLGS_SHOW_TYPE          0x40
  ------------------
                      ASN1_STRFLGS_SHOW_TYPE | ASN1_STRFLGS_DUMP_ALL);
  ------------------
  |  |  495|      2|# define ASN1_STRFLGS_DUMP_ALL           0x80
  ------------------
  294|       |
  295|      2|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  450|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  296|      2|    OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
  ------------------
  |  | 2653|      2|# define OPENSSL_INIT_LOAD_SSL_STRINGS       0x00200000L
  ------------------
  297|      2|    ERR_clear_error();
  298|      2|    CRYPTO_free_ex_index(0, -1);
  299|       |
  300|      2|    return 1;
  301|      2|}
FuzzerTestOneInput:
  304|  11.7k|{
  305|  11.7k|    int n;
  306|       |
  307|       |
  308|  1.68M|    for (n = 0; item_type[n] != NULL; ++n) {
  ------------------
  |  Branch (308:17): [True: 1.67M, False: 11.7k]
  ------------------
  309|  1.67M|        const uint8_t *b = buf;
  310|  1.67M|        unsigned char *der = NULL;
  311|  1.67M|        const ASN1_ITEM *i = ASN1_ITEM_ptr(item_type[n]);
  ------------------
  |  |  421|  1.67M|# define ASN1_ITEM_ptr(iptr) (iptr())
  ------------------
  312|  1.67M|        ASN1_VALUE *o = ASN1_item_d2i(NULL, &b, len, i);
  313|       |
  314|  1.67M|        if (o != NULL) {
  ------------------
  |  Branch (314:13): [True: 42.9k, False: 1.63M]
  ------------------
  315|  42.9k|            BIO *bio = BIO_new(BIO_s_null());
  316|  42.9k|            if (bio != NULL) {
  ------------------
  |  Branch (316:17): [True: 42.9k, False: 0]
  ------------------
  317|  42.9k|                ASN1_item_print(bio, o, 4, i, pctx);
  318|  42.9k|                BIO_free(bio);
  319|  42.9k|            }
  320|  42.9k|            if (ASN1_item_i2d(o, &der, i) > 0) {
  ------------------
  |  Branch (320:17): [True: 42.8k, False: 16]
  ------------------
  321|  42.8k|                OPENSSL_free(der);
  ------------------
  |  |  107|  42.8k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  42.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  42.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  322|  42.8k|            }
  323|  42.9k|            ASN1_item_free(o, i);
  324|  42.9k|        }
  325|  1.67M|    }
  326|       |
  327|  11.7k|#ifndef OPENSSL_NO_TS
  328|  11.7k|    DO_TEST(TS_REQ, d2i_TS_REQ, i2d_TS_REQ, TS_REQ_print_bio);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 698, False: 11.0k]
  |  |  ------------------
  |  |  218|    698|        int len2; \
  |  |  219|    698|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|    698|        \
  |  |  221|    698|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 698, False: 0]
  |  |  ------------------
  |  |  222|    698|            PRINT(bio, type); \
  |  |  223|    698|            BIO_free(bio); \
  |  |  224|    698|        } \
  |  |  225|    698|        len2 = I2D(type, &der); \
  |  |  226|    698|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 698, False: 0]
  |  |  ------------------
  |  |  227|    698|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|    698|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    698|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    698|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    698|        TYPE ## _free(type); \
  |  |  229|    698|    } \
  |  |  230|  11.7k|}
  ------------------
  329|  11.7k|    DO_TEST(TS_MSG_IMPRINT, d2i_TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT, TS_MSG_IMPRINT_print_bio);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 6, False: 11.7k]
  |  |  ------------------
  |  |  218|      6|        int len2; \
  |  |  219|      6|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|      6|        \
  |  |  221|      6|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 6, False: 0]
  |  |  ------------------
  |  |  222|      6|            PRINT(bio, type); \
  |  |  223|      6|            BIO_free(bio); \
  |  |  224|      6|        } \
  |  |  225|      6|        len2 = I2D(type, &der); \
  |  |  226|      6|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 6, False: 0]
  |  |  ------------------
  |  |  227|      6|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|      6|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      6|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      6|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      6|        TYPE ## _free(type); \
  |  |  229|      6|    } \
  |  |  230|  11.7k|}
  ------------------
  330|  11.7k|    DO_TEST(TS_RESP, d2i_TS_RESP, i2d_TS_RESP, TS_RESP_print_bio);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 106, False: 11.6k]
  |  |  ------------------
  |  |  218|    106|        int len2; \
  |  |  219|    106|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|    106|        \
  |  |  221|    106|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 106, False: 0]
  |  |  ------------------
  |  |  222|    106|            PRINT(bio, type); \
  |  |  223|    106|            BIO_free(bio); \
  |  |  224|    106|        } \
  |  |  225|    106|        len2 = I2D(type, &der); \
  |  |  226|    106|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 106, False: 0]
  |  |  ------------------
  |  |  227|    106|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|    106|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    106|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    106|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    106|        TYPE ## _free(type); \
  |  |  229|    106|    } \
  |  |  230|  11.7k|}
  ------------------
  331|  11.7k|    DO_TEST(TS_STATUS_INFO, d2i_TS_STATUS_INFO, i2d_TS_STATUS_INFO, TS_STATUS_INFO_print_bio);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 453, False: 11.2k]
  |  |  ------------------
  |  |  218|    453|        int len2; \
  |  |  219|    453|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|    453|        \
  |  |  221|    453|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 453, False: 0]
  |  |  ------------------
  |  |  222|    453|            PRINT(bio, type); \
  |  |  223|    453|            BIO_free(bio); \
  |  |  224|    453|        } \
  |  |  225|    453|        len2 = I2D(type, &der); \
  |  |  226|    453|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 453, False: 0]
  |  |  ------------------
  |  |  227|    453|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|    453|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    453|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    453|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    453|        TYPE ## _free(type); \
  |  |  229|    453|    } \
  |  |  230|  11.7k|}
  ------------------
  332|  11.7k|    DO_TEST(TS_TST_INFO, d2i_TS_TST_INFO, i2d_TS_TST_INFO, TS_TST_INFO_print_bio);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 16, False: 11.7k]
  |  |  ------------------
  |  |  218|     16|        int len2; \
  |  |  219|     16|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|     16|        \
  |  |  221|     16|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 16, False: 0]
  |  |  ------------------
  |  |  222|     16|            PRINT(bio, type); \
  |  |  223|     16|            BIO_free(bio); \
  |  |  224|     16|        } \
  |  |  225|     16|        len2 = I2D(type, &der); \
  |  |  226|     16|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 16, False: 0]
  |  |  ------------------
  |  |  227|     16|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|     16|        TYPE ## _free(type); \
  |  |  229|     16|    } \
  |  |  230|  11.7k|}
  ------------------
  333|  11.7k|    DO_TEST_NO_PRINT(TS_ACCURACY, d2i_TS_ACCURACY, i2d_TS_ACCURACY);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 284, False: 11.4k]
  |  |  ------------------
  |  |  275|    284|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|    284|        \
  |  |  277|    284|        BIO_free(bio); \
  |  |  278|    284|        I2D(type, &der); \
  |  |  279|    284|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|    284|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    284|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    284|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|    284|        TYPE ## _free(type); \
  |  |  281|    284|    } \
  |  |  282|  11.7k|}
  ------------------
  334|  11.7k|#endif
  335|  11.7k|    DO_TEST_NO_PRINT(ESS_ISSUER_SERIAL, d2i_ESS_ISSUER_SERIAL, i2d_ESS_ISSUER_SERIAL);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 4, False: 11.7k]
  |  |  ------------------
  |  |  275|      4|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|      4|        \
  |  |  277|      4|        BIO_free(bio); \
  |  |  278|      4|        I2D(type, &der); \
  |  |  279|      4|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|      4|        TYPE ## _free(type); \
  |  |  281|      4|    } \
  |  |  282|  11.7k|}
  ------------------
  336|  11.7k|    DO_TEST_NO_PRINT(ESS_CERT_ID, d2i_ESS_CERT_ID, i2d_ESS_CERT_ID);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 24, False: 11.6k]
  |  |  ------------------
  |  |  275|     24|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     24|        \
  |  |  277|     24|        BIO_free(bio); \
  |  |  278|     24|        I2D(type, &der); \
  |  |  279|     24|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     24|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     24|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     24|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     24|        TYPE ## _free(type); \
  |  |  281|     24|    } \
  |  |  282|  11.7k|}
  ------------------
  337|  11.7k|    DO_TEST_NO_PRINT(ESS_SIGNING_CERT, d2i_ESS_SIGNING_CERT, i2d_ESS_SIGNING_CERT);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 16, False: 11.7k]
  |  |  ------------------
  |  |  275|     16|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     16|        \
  |  |  277|     16|        BIO_free(bio); \
  |  |  278|     16|        I2D(type, &der); \
  |  |  279|     16|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     16|        TYPE ## _free(type); \
  |  |  281|     16|    } \
  |  |  282|  11.7k|}
  ------------------
  338|  11.7k|    DO_TEST_NO_PRINT(ESS_CERT_ID_V2, d2i_ESS_CERT_ID_V2, i2d_ESS_CERT_ID_V2);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 30, False: 11.6k]
  |  |  ------------------
  |  |  275|     30|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     30|        \
  |  |  277|     30|        BIO_free(bio); \
  |  |  278|     30|        I2D(type, &der); \
  |  |  279|     30|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     30|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     30|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     30|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     30|        TYPE ## _free(type); \
  |  |  281|     30|    } \
  |  |  282|  11.7k|}
  ------------------
  339|  11.7k|    DO_TEST_NO_PRINT(ESS_SIGNING_CERT_V2, d2i_ESS_SIGNING_CERT_V2, i2d_ESS_SIGNING_CERT_V2);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 16, False: 11.7k]
  |  |  ------------------
  |  |  275|     16|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     16|        \
  |  |  277|     16|        BIO_free(bio); \
  |  |  278|     16|        I2D(type, &der); \
  |  |  279|     16|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     16|        TYPE ## _free(type); \
  |  |  281|     16|    } \
  |  |  282|  11.7k|}
  ------------------
  340|  11.7k|#if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0)
  341|  11.7k|    DO_TEST_NO_PRINT(DH, d2i_DHparams, i2d_DHparams);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 62, False: 11.6k]
  |  |  ------------------
  |  |  275|     62|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     62|        \
  |  |  277|     62|        BIO_free(bio); \
  |  |  278|     62|        I2D(type, &der); \
  |  |  279|     62|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     62|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     62|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     62|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     62|        TYPE ## _free(type); \
  |  |  281|     62|    } \
  |  |  282|  11.7k|}
  ------------------
  342|  11.7k|    DO_TEST_NO_PRINT(DH, d2i_DHxparams, i2d_DHxparams);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 50, False: 11.6k]
  |  |  ------------------
  |  |  275|     50|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     50|        \
  |  |  277|     50|        BIO_free(bio); \
  |  |  278|     50|        I2D(type, &der); \
  |  |  279|     50|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     50|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     50|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     50|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     50|        TYPE ## _free(type); \
  |  |  281|     50|    } \
  |  |  282|  11.7k|}
  ------------------
  343|  11.7k|#endif
  344|  11.7k|#ifndef OPENSSL_NO_DSA
  345|  11.7k|    DO_TEST_NO_PRINT(DSA_SIG, d2i_DSA_SIG, i2d_DSA_SIG);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 16, False: 11.7k]
  |  |  ------------------
  |  |  275|     16|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     16|        \
  |  |  277|     16|        BIO_free(bio); \
  |  |  278|     16|        I2D(type, &der); \
  |  |  279|     16|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     16|        TYPE ## _free(type); \
  |  |  281|     16|    } \
  |  |  282|  11.7k|}
  ------------------
  346|  11.7k|# ifndef OPENSSL_NO_DEPRECATED_3_0
  347|  11.7k|    DO_TEST_NO_PRINT(DSA, d2i_DSAPrivateKey, i2d_DSAPrivateKey);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 48, False: 11.6k]
  |  |  ------------------
  |  |  275|     48|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     48|        \
  |  |  277|     48|        BIO_free(bio); \
  |  |  278|     48|        I2D(type, &der); \
  |  |  279|     48|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     48|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     48|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     48|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     48|        TYPE ## _free(type); \
  |  |  281|     48|    } \
  |  |  282|  11.7k|}
  ------------------
  348|  11.7k|    DO_TEST_NO_PRINT(DSA, d2i_DSAPublicKey, i2d_DSAPublicKey);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 4, False: 11.7k]
  |  |  ------------------
  |  |  275|      4|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|      4|        \
  |  |  277|      4|        BIO_free(bio); \
  |  |  278|      4|        I2D(type, &der); \
  |  |  279|      4|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|      4|        TYPE ## _free(type); \
  |  |  281|      4|    } \
  |  |  282|  11.7k|}
  ------------------
  349|  11.7k|    DO_TEST_NO_PRINT(DSA, d2i_DSAparams, i2d_DSAparams);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 18, False: 11.7k]
  |  |  ------------------
  |  |  275|     18|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     18|        \
  |  |  277|     18|        BIO_free(bio); \
  |  |  278|     18|        I2D(type, &der); \
  |  |  279|     18|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     18|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     18|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     18|        TYPE ## _free(type); \
  |  |  281|     18|    } \
  |  |  282|  11.7k|}
  ------------------
  350|  11.7k|# endif
  351|  11.7k|#endif
  352|  11.7k|#ifndef OPENSSL_NO_DEPRECATED_3_0
  353|  11.7k|    DO_TEST_NO_PRINT(RSA, d2i_RSAPublicKey, i2d_RSAPublicKey);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 46, False: 11.6k]
  |  |  ------------------
  |  |  275|     46|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     46|        \
  |  |  277|     46|        BIO_free(bio); \
  |  |  278|     46|        I2D(type, &der); \
  |  |  279|     46|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     46|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     46|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     46|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     46|        TYPE ## _free(type); \
  |  |  281|     46|    } \
  |  |  282|  11.7k|}
  ------------------
  354|  11.7k|#endif
  355|  11.7k|#ifndef OPENSSL_NO_EC
  356|  11.7k|# ifndef OPENSSL_NO_DEPRECATED_3_0
  357|  11.7k|    DO_TEST_PRINT_OFFSET(EC_GROUP, d2i_ECPKParameters, i2d_ECPKParameters, ECPKParameters_print);
  ------------------
  |  |  232|  11.7k|#define DO_TEST_PRINT_OFFSET(TYPE, D2I, I2D, PRINT) { \
  |  |  233|  11.7k|    const unsigned char *p = buf; \
  |  |  234|  11.7k|    unsigned char *der = NULL; \
  |  |  235|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  236|  11.7k|    \
  |  |  237|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (237:9): [True: 72, False: 11.6k]
  |  |  ------------------
  |  |  238|     72|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  239|     72|        \
  |  |  240|     72|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (240:13): [True: 72, False: 0]
  |  |  ------------------
  |  |  241|     72|            PRINT(bio, type, 0); \
  |  |  242|     72|            BIO_free(bio); \
  |  |  243|     72|        } \
  |  |  244|     72|        I2D(type, &der); \
  |  |  245|     72|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     72|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     72|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     72|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  246|     72|        TYPE ## _free(type); \
  |  |  247|     72|    } \
  |  |  248|  11.7k|}
  ------------------
  358|  11.7k|    DO_TEST_PRINT_OFFSET(EC_KEY, d2i_ECPrivateKey, i2d_ECPrivateKey, EC_KEY_print);
  ------------------
  |  |  232|  11.7k|#define DO_TEST_PRINT_OFFSET(TYPE, D2I, I2D, PRINT) { \
  |  |  233|  11.7k|    const unsigned char *p = buf; \
  |  |  234|  11.7k|    unsigned char *der = NULL; \
  |  |  235|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  236|  11.7k|    \
  |  |  237|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (237:9): [True: 587, False: 11.1k]
  |  |  ------------------
  |  |  238|    587|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  239|    587|        \
  |  |  240|    587|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (240:13): [True: 587, False: 0]
  |  |  ------------------
  |  |  241|    587|            PRINT(bio, type, 0); \
  |  |  242|    587|            BIO_free(bio); \
  |  |  243|    587|        } \
  |  |  244|    587|        I2D(type, &der); \
  |  |  245|    587|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|    587|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    587|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    587|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  246|    587|        TYPE ## _free(type); \
  |  |  247|    587|    } \
  |  |  248|  11.7k|}
  ------------------
  359|  11.7k|    DO_TEST(EC_KEY, d2i_ECParameters, i2d_ECParameters, ECParameters_print);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 72, False: 11.6k]
  |  |  ------------------
  |  |  218|     72|        int len2; \
  |  |  219|     72|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|     72|        \
  |  |  221|     72|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 72, False: 0]
  |  |  ------------------
  |  |  222|     72|            PRINT(bio, type); \
  |  |  223|     72|            BIO_free(bio); \
  |  |  224|     72|        } \
  |  |  225|     72|        len2 = I2D(type, &der); \
  |  |  226|     72|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 72, False: 0]
  |  |  ------------------
  |  |  227|     72|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     72|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     72|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     72|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|     72|        TYPE ## _free(type); \
  |  |  229|     72|    } \
  |  |  230|  11.7k|}
  ------------------
  360|  11.7k|    DO_TEST_NO_PRINT(ECDSA_SIG, d2i_ECDSA_SIG, i2d_ECDSA_SIG);
  ------------------
  |  |  269|  11.7k|#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
  |  |  270|  11.7k|    const unsigned char *p = buf; \
  |  |  271|  11.7k|    unsigned char *der = NULL; \
  |  |  272|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  273|  11.7k|    \
  |  |  274|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (274:9): [True: 16, False: 11.7k]
  |  |  ------------------
  |  |  275|     16|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  276|     16|        \
  |  |  277|     16|        BIO_free(bio); \
  |  |  278|     16|        I2D(type, &der); \
  |  |  279|     16|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     16|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     16|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|     16|        TYPE ## _free(type); \
  |  |  281|     16|    } \
  |  |  282|  11.7k|}
  ------------------
  361|  11.7k|# endif
  362|  11.7k|#endif
  363|  11.7k|    DO_TEST_PRINT_PCTX(EVP_PKEY, d2i_AutoPrivateKey, i2d_PrivateKey, EVP_PKEY_print_private);
  ------------------
  |  |  250|  11.7k|#define DO_TEST_PRINT_PCTX(TYPE, D2I, I2D, PRINT) { \
  |  |  251|  11.7k|    const unsigned char *p = buf; \
  |  |  252|  11.7k|    unsigned char *der = NULL; \
  |  |  253|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  254|  11.7k|    \
  |  |  255|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (255:9): [True: 1.55k, False: 10.1k]
  |  |  ------------------
  |  |  256|  1.55k|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  257|  1.55k|        \
  |  |  258|  1.55k|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (258:13): [True: 1.55k, False: 0]
  |  |  ------------------
  |  |  259|  1.55k|            PRINT(bio, type, 0, pctx); \
  |  |  260|  1.55k|            BIO_free(bio); \
  |  |  261|  1.55k|        } \
  |  |  262|  1.55k|        I2D(type, &der); \
  |  |  263|  1.55k|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|  1.55k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|  1.55k|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|  1.55k|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  264|  1.55k|        TYPE ## _free(type); \
  |  |  265|  1.55k|    } \
  |  |  266|  11.7k|}
  ------------------
  364|  11.7k|    DO_TEST(SSL_SESSION, d2i_SSL_SESSION, i2d_SSL_SESSION, SSL_SESSION_print);
  ------------------
  |  |  212|  11.7k|#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
  |  |  213|  11.7k|    const unsigned char *p = buf; \
  |  |  214|  11.7k|    unsigned char *der = NULL; \
  |  |  215|  11.7k|    TYPE *type = D2I(NULL, &p, len); \
  |  |  216|  11.7k|    \
  |  |  217|  11.7k|    if (type != NULL) { \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 363, False: 11.3k]
  |  |  ------------------
  |  |  218|    363|        int len2; \
  |  |  219|    363|        BIO *bio = BIO_new(BIO_s_null()); \
  |  |  220|    363|        \
  |  |  221|    363|        if (bio != NULL) { \
  |  |  ------------------
  |  |  |  Branch (221:13): [True: 363, False: 0]
  |  |  ------------------
  |  |  222|    363|            PRINT(bio, type); \
  |  |  223|    363|            BIO_free(bio); \
  |  |  224|    363|        } \
  |  |  225|    363|        len2 = I2D(type, &der); \
  |  |  226|    363|        if (len2 != 0) {} \
  |  |  ------------------
  |  |  |  Branch (226:13): [True: 363, False: 0]
  |  |  ------------------
  |  |  227|    363|        OPENSSL_free(der); \
  |  |  ------------------
  |  |  |  |  107|    363|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    363|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    363|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    363|        TYPE ## _free(type); \
  |  |  229|    363|    } \
  |  |  230|  11.7k|}
  ------------------
  365|       |
  366|  11.7k|    ERR_clear_error();
  367|       |
  368|  11.7k|    return 0;
  369|  11.7k|}

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

FuzzerSetRand:
  158|      2|{
  159|      2|    if (!OSSL_PROVIDER_add_builtin(NULL, "fuzz-rand", fuzz_rand_provider_init)
  ------------------
  |  Branch (159:9): [True: 0, False: 2]
  ------------------
  160|      2|        || !RAND_set_DRBG_type(NULL, "fuzz", NULL, NULL, NULL)
  ------------------
  |  Branch (160:12): [True: 0, False: 2]
  ------------------
  161|      2|        || (r_prov = OSSL_PROVIDER_try_load(NULL, "fuzz-rand", 1)) == NULL)
  ------------------
  |  Branch (161:12): [True: 0, False: 2]
  ------------------
  162|      0|        exit(1);
  163|      2|}
fuzz_rand.c:fuzz_rand_provider_init:
  147|      2|{
  148|      2|    *provctx = OSSL_LIB_CTX_new();
  149|      2|    if (*provctx == NULL)
  ------------------
  |  Branch (149:9): [True: 0, False: 2]
  ------------------
  150|      0|        return 0;
  151|      2|    *out = fuzz_rand_method;
  152|      2|    return 1;
  153|      2|}
fuzz_rand.c:fuzz_rand_query:
  128|  6.74k|{
  129|  6.74k|    *no_cache = 0;
  130|  6.74k|    switch (operation_id) {
  ------------------
  |  Branch (130:13): [True: 6.74k, False: 2]
  ------------------
  131|      2|    case OSSL_OP_RAND:
  ------------------
  |  |  258|      2|# define OSSL_OP_RAND                                5
  ------------------
  |  Branch (131:5): [True: 2, False: 6.74k]
  ------------------
  132|      2|        return fuzz_rand_rand;
  133|  6.74k|    }
  134|  6.74k|    return NULL;
  135|  6.74k|}
fuzz_rand.c:fuzz_rand_newctx:
   27|      2|{
   28|      2|    int *st = OPENSSL_malloc(sizeof(*st));
  ------------------
  |  |   97|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   29|       |
   30|      2|    if (st != NULL)
  ------------------
  |  Branch (30:9): [True: 2, False: 0]
  ------------------
   31|      2|        *st = EVP_RAND_STATE_UNINITIALISED;
  ------------------
  |  | 1292|      2|# define EVP_RAND_STATE_UNINITIALISED    0
  ------------------
   32|      2|    return st;
   33|      2|}
fuzz_rand.c:fuzz_rand_freectx:
   36|      2|{
   37|      2|    OPENSSL_free(vrng);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   38|      2|}
fuzz_rand.c:fuzz_rand_instantiate:
   46|      2|{
   47|      2|    *(int *)vrng = EVP_RAND_STATE_READY;
  ------------------
  |  | 1293|      2|# define EVP_RAND_STATE_READY            1
  ------------------
   48|      2|    return 1;
   49|      2|}
fuzz_rand.c:fuzz_rand_generate:
   63|  52.6k|{
   64|  52.6k|    unsigned char val = 1;
   65|  52.6k|    size_t i;
   66|       |
   67|  2.26M|    for (i = 0; i < outlen; i++)
  ------------------
  |  Branch (67:17): [True: 2.20M, False: 52.6k]
  ------------------
   68|  2.20M|        out[i] = val++;
   69|  52.6k|    return 1;
   70|  52.6k|}
fuzz_rand.c:fuzz_rand_enable_locking:
   73|      1|{
   74|      1|    return 1;
   75|      1|}
fuzz_rand.c:fuzz_rand_get_ctx_params:
   78|  52.6k|{
   79|  52.6k|    OSSL_PARAM *p;
   80|       |
   81|  52.6k|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STATE);
  ------------------
  |  |  444|  52.6k|# define OSSL_RAND_PARAM_STATE "state"
  ------------------
   82|  52.6k|    if (p != NULL && !OSSL_PARAM_set_int(p, *(int *)vrng))
  ------------------
  |  Branch (82:9): [True: 0, False: 52.6k]
  |  Branch (82:22): [True: 0, False: 0]
  ------------------
   83|      0|        return 0;
   84|       |
   85|  52.6k|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STRENGTH);
  ------------------
  |  |  445|  52.6k|# define OSSL_RAND_PARAM_STRENGTH "strength"
  ------------------
   86|  52.6k|    if (p != NULL && !OSSL_PARAM_set_int(p, 500))
  ------------------
  |  Branch (86:9): [True: 0, False: 52.6k]
  |  Branch (86:22): [True: 0, False: 0]
  ------------------
   87|      0|        return 0;
   88|       |
   89|  52.6k|    p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_MAX_REQUEST);
  ------------------
  |  |  443|  52.6k|# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
  ------------------
   90|  52.6k|    if (p != NULL && !OSSL_PARAM_set_size_t(p, INT_MAX))
  ------------------
  |  Branch (90:9): [True: 52.6k, False: 0]
  |  Branch (90:22): [True: 0, False: 52.6k]
  ------------------
   91|      0|        return 0;
   92|  52.6k|    return 1;
   93|  52.6k|}

EVP_aria_128_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_128_cfb128:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_128_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_128_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_192_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_192_cfb128:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_192_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_192_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_256_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_256_cfb128:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_256_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_256_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_128_cfb1:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_192_cfb1:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_256_cfb1:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_128_cfb8:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_192_cfb8:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_aria_256_cfb8:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_bf_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_bf_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_bf_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_bf_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_cast5_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_cast5_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_cast5_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_cast5_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_cfb1:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_cfb8:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede3_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede3_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede3_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede3_cfb1:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_des_ede3_cfb8:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_idea_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_idea_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_idea_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_idea_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc2_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc2_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc2_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc2_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc5_32_12_16_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc5_32_12_16_cfb64:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc5_32_12_16_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_rc5_32_12_16_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_seed_cbc:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_seed_cfb128:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_seed_ofb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
EVP_seed_ecb:
  455|      2|const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }

SHA1_Update:
  155|  7.33k|{
  156|  7.33k|    const unsigned char *data = data_;
  157|  7.33k|    unsigned char *p;
  158|  7.33k|    HASH_LONG l;
  ------------------
  |  |   19|  7.33k|#define HASH_LONG               SHA_LONG
  |  |  ------------------
  |  |  |  |   34|  7.33k|#  define SHA_LONG unsigned int
  |  |  ------------------
  ------------------
  159|  7.33k|    size_t n;
  160|       |
  161|  7.33k|    if (len == 0)
  ------------------
  |  Branch (161:9): [True: 0, False: 7.33k]
  ------------------
  162|      0|        return 1;
  163|       |
  164|  7.33k|    l = (c->Nl + (((HASH_LONG) len) << 3)) & 0xffffffffUL;
  165|  7.33k|    if (l < c->Nl)              /* overflow */
  ------------------
  |  Branch (165:9): [True: 0, False: 7.33k]
  ------------------
  166|      0|        c->Nh++;
  167|  7.33k|    c->Nh += (HASH_LONG) (len >> 29); /* might cause compiler warning on
  168|       |                                       * 16-bit */
  169|  7.33k|    c->Nl = l;
  170|       |
  171|  7.33k|    n = c->num;
  172|  7.33k|    if (n != 0) {
  ------------------
  |  Branch (172:9): [True: 0, False: 7.33k]
  ------------------
  173|      0|        p = (unsigned char *)c->data;
  174|       |
  175|      0|        if (len >= HASH_CBLOCK || len + n >= HASH_CBLOCK) {
  ------------------
  |  |   21|      0|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|      0|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      if (len >= HASH_CBLOCK || len + n >= HASH_CBLOCK) {
  ------------------
  |  |   21|      0|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|      0|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (175:13): [True: 0, False: 0]
  |  Branch (175:35): [True: 0, False: 0]
  ------------------
  176|      0|            memcpy(p + n, data, HASH_CBLOCK - n);
  ------------------
  |  |   21|      0|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|      0|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  177|      0|            HASH_BLOCK_DATA_ORDER(c, p, 1);
  ------------------
  |  |   35|      0|#define HASH_BLOCK_DATA_ORDER           sha1_block_data_order
  ------------------
  178|      0|            n = HASH_CBLOCK - n;
  ------------------
  |  |   21|      0|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|      0|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  179|      0|            data += n;
  180|      0|            len -= n;
  181|      0|            c->num = 0;
  182|       |            /*
  183|       |             * We use memset rather than OPENSSL_cleanse() here deliberately.
  184|       |             * Using OPENSSL_cleanse() here could be a performance issue. It
  185|       |             * will get properly cleansed on finalisation so this isn't a
  186|       |             * security problem.
  187|       |             */
  188|      0|            memset(p, 0, HASH_CBLOCK); /* keep it zeroed */
  ------------------
  |  |   21|      0|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|      0|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  189|      0|        } else {
  190|      0|            memcpy(p + n, data, len);
  191|      0|            c->num += (unsigned int)len;
  192|      0|            return 1;
  193|      0|        }
  194|      0|    }
  195|       |
  196|  7.33k|    n = len / HASH_CBLOCK;
  ------------------
  |  |   21|  7.33k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  7.33k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  7.33k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  197|  7.33k|    if (n > 0) {
  ------------------
  |  Branch (197:9): [True: 3.34k, False: 3.98k]
  ------------------
  198|  3.34k|        HASH_BLOCK_DATA_ORDER(c, data, n);
  ------------------
  |  |   35|  3.34k|#define HASH_BLOCK_DATA_ORDER           sha1_block_data_order
  ------------------
  199|  3.34k|        n *= HASH_CBLOCK;
  ------------------
  |  |   21|  3.34k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  3.34k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  3.34k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  200|  3.34k|        data += n;
  201|  3.34k|        len -= n;
  202|  3.34k|    }
  203|       |
  204|  7.33k|    if (len != 0) {
  ------------------
  |  Branch (204:9): [True: 6.76k, False: 571]
  ------------------
  205|  6.76k|        p = (unsigned char *)c->data;
  206|  6.76k|        c->num = (unsigned int)len;
  207|  6.76k|        memcpy(p, data, len);
  208|  6.76k|    }
  209|  7.33k|    return 1;
  210|  7.33k|}
SHA1_Final:
  218|  7.33k|{
  219|  7.33k|    unsigned char *p = (unsigned char *)c->data;
  220|  7.33k|    size_t n = c->num;
  221|       |
  222|  7.33k|    p[n] = 0x80;                /* there is always room for one */
  223|  7.33k|    n++;
  224|       |
  225|  7.33k|    if (n > (HASH_CBLOCK - 8)) {
  ------------------
  |  |   21|  7.33k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  7.33k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  7.33k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (225:9): [True: 2.37k, False: 4.96k]
  ------------------
  226|  2.37k|        memset(p + n, 0, HASH_CBLOCK - n);
  ------------------
  |  |   21|  2.37k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  2.37k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  2.37k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  227|  2.37k|        n = 0;
  228|  2.37k|        HASH_BLOCK_DATA_ORDER(c, p, 1);
  ------------------
  |  |   35|  2.37k|#define HASH_BLOCK_DATA_ORDER           sha1_block_data_order
  ------------------
  229|  2.37k|    }
  230|  7.33k|    memset(p + n, 0, HASH_CBLOCK - 8 - n);
  ------------------
  |  |   21|  7.33k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  7.33k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  7.33k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  231|       |
  232|  7.33k|    p += HASH_CBLOCK - 8;
  ------------------
  |  |   21|  7.33k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  7.33k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  7.33k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  233|  7.33k|# if   defined(DATA_ORDER_IS_BIG_ENDIAN)
  234|  7.33k|    (void)HOST_l2c(c->Nh, p);
  ------------------
  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  134|  7.33k|                         l)
  ------------------
  235|  7.33k|    (void)HOST_l2c(c->Nl, p);
  ------------------
  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  134|  7.33k|                         l)
  ------------------
  236|       |# elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
  237|       |    (void)HOST_l2c(c->Nl, p);
  238|       |    (void)HOST_l2c(c->Nh, p);
  239|       |# endif
  240|  7.33k|    p -= HASH_CBLOCK;
  ------------------
  |  |   21|  7.33k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  7.33k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  7.33k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  7.33k|    HASH_BLOCK_DATA_ORDER(c, p, 1);
  ------------------
  |  |   35|  7.33k|#define HASH_BLOCK_DATA_ORDER           sha1_block_data_order
  ------------------
  242|  7.33k|    c->num = 0;
  243|  7.33k|    OPENSSL_cleanse(p, HASH_CBLOCK);
  ------------------
  |  |   21|  7.33k|#define HASH_CBLOCK             SHA_CBLOCK
  |  |  ------------------
  |  |  |  |   37|  7.33k|#  define SHA_CBLOCK      (SHA_LBLOCK*4)/* SHA treats input data as a
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  7.33k|#  define SHA_LBLOCK      16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  244|       |
  245|       |# ifndef HASH_MAKE_STRING
  246|       |#  error "HASH_MAKE_STRING must be defined!"
  247|       |# else
  248|  7.33k|    HASH_MAKE_STRING(c, md);
  ------------------
  |  |   22|  7.33k|#define HASH_MAKE_STRING(c,s)   do {    \
  |  |   23|  7.33k|        unsigned long ll;               \
  |  |   24|  7.33k|        ll=(c)->h0; (void)HOST_l2c(ll,(s));     \
  |  |  ------------------
  |  |  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  |  |  134|  7.33k|                         l)
  |  |  ------------------
  |  |   25|  7.33k|        ll=(c)->h1; (void)HOST_l2c(ll,(s));     \
  |  |  ------------------
  |  |  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  |  |  134|  7.33k|                         l)
  |  |  ------------------
  |  |   26|  7.33k|        ll=(c)->h2; (void)HOST_l2c(ll,(s));     \
  |  |  ------------------
  |  |  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  |  |  134|  7.33k|                         l)
  |  |  ------------------
  |  |   27|  7.33k|        ll=(c)->h3; (void)HOST_l2c(ll,(s));     \
  |  |  ------------------
  |  |  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  |  |  134|  7.33k|                         l)
  |  |  ------------------
  |  |   28|  7.33k|        ll=(c)->h4; (void)HOST_l2c(ll,(s));     \
  |  |  ------------------
  |  |  |  |  130|  7.33k|#  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \
  |  |  |  |  131|  7.33k|                         *((c)++)=(unsigned char)(((l)>>16)&0xff),      \
  |  |  |  |  132|  7.33k|                         *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \
  |  |  |  |  133|  7.33k|                         *((c)++)=(unsigned char)(((l)    )&0xff),      \
  |  |  |  |  134|  7.33k|                         l)
  |  |  ------------------
  |  |   29|  7.33k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (29:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  249|  7.33k|# endif
  250|       |
  251|  7.33k|    return 1;
  252|  7.33k|}

property.c:ossl_sa_ALGORITHM_new:
   27|     16|    { \
   28|     16|        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
   29|     16|    } \
property.c:ossl_sa_ALGORITHM_doall_arg:
   56|  6.74k|    { \
   57|  6.74k|        ossl_sa_doall_arg((OPENSSL_SA *)sa, \
   58|  6.74k|                          (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
   59|  6.74k|    } \
property.c:ossl_sa_ALGORITHM_set:
   68|    148|    { \
   69|    148|        return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val); \
   70|    148|    } \
property.c:ossl_sa_ALGORITHM_free:
   32|      8|    { \
   33|      8|        ossl_sa_free((OPENSSL_SA *)sa); \
   34|      8|    } \
property.c:ossl_sa_ALGORITHM_get:
   62|  7.76k|    { \
   63|  7.76k|        return (type *)ossl_sa_get((OPENSSL_SA *)sa, n); \
   64|  7.76k|    } \
property.c:ossl_sa_ALGORITHM_doall:
   48|      8|    { \
   49|      8|        ossl_sa_doall((OPENSSL_SA *)sa, \
   50|      8|                      (void (*)(ossl_uintmax_t, void *))leaf); \
   51|      8|    } \

bio_print.c:ossl_assert_int:
   45|  1.23G|{
   46|  1.23G|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 1.23G]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  1.23G|    return expr;
   50|  1.23G|}
decoder_lib.c:ossl_assert_int:
   45|   227k|{
   46|   227k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 227k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|   227k|    return expr;
   50|   227k|}
decoder_meth.c:ossl_assert_int:
   45|   603k|{
   46|   603k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 603k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|   603k|    return expr;
   50|   603k|}
encoder_lib.c:ossl_assert_int:
   45|   129k|{
   46|   129k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 129k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|   129k|    return expr;
   50|   129k|}
encoder_meth.c:ossl_assert_int:
   45|   820k|{
   46|   820k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 820k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|   820k|    return expr;
   50|   820k|}
encoder_pkey.c:ossl_assert_int:
   45|  6.38k|{
   46|  6.38k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 6.38k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  6.38k|    return expr;
   50|  6.38k|}
evp_fetch.c:ossl_assert_int:
   45|  22.4k|{
   46|  22.4k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 22.4k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  22.4k|    return expr;
   50|  22.4k|}
p_lib.c:ossl_assert_int:
   45|   260k|{
   46|   260k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 260k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|   260k|    return expr;
   50|   260k|}
core_fetch.c:ossl_assert_int:
   45|  13.5k|{
   46|  13.5k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 13.5k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  13.5k|    return expr;
   50|  13.5k|}
core_namemap.c:ossl_assert_int:
   45|    206|{
   46|    206|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 206]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    206|    return expr;
   50|    206|}
packet.c:ossl_assert_int:
   45|   210k|{
   46|   210k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 210k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|   210k|    return expr;
   50|   210k|}
passphrase.c:ossl_assert_int:
   45|  1.60k|{
   46|  1.60k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 1.60k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  1.60k|    return expr;
   50|  1.60k|}
provider_core.c:ossl_assert_int:
   45|  13.4k|{
   46|  13.4k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 13.4k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  13.4k|    return expr;
   50|  13.4k|}
defn_cache.c:ossl_assert_int:
   45|    412|{
   46|    412|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 412]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    412|    return expr;
   50|    412|}
property.c:ossl_assert_int:
   45|    211|{
   46|    211|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 211]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    211|    return expr;
   50|    211|}
x_pubkey.c:ossl_assert_int:
   45|  64.1k|{
   46|  64.1k|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 64.1k]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|  64.1k|    return expr;
   50|  64.1k|}
der_rsa_key.c:ossl_assert_int:
   45|      2|{
   46|      2|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 2]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|      2|    return expr;
   50|      2|}

bn_lib.c:constant_time_msb:
  101|  6.18M|{
  102|  6.18M|    return 0 - (a >> (sizeof(a) * 8 - 1));
  103|  6.18M|}
bn_lib.c:constant_time_eq_int:
  213|  6.18M|{
  214|  6.18M|    return constant_time_eq((unsigned)(a), (unsigned)(b));
  215|  6.18M|}
bn_lib.c:constant_time_eq:
  192|  6.18M|{
  193|  6.18M|    return constant_time_is_zero(a ^ b);
  194|  6.18M|}
bn_lib.c:constant_time_is_zero:
  166|  6.18M|{
  167|  6.18M|    return constant_time_msb(~a & (a - 1));
  168|  6.18M|}
bn_exp.c:constant_time_eq_int:
  213|  1.21M|{
  214|  1.21M|    return constant_time_eq((unsigned)(a), (unsigned)(b));
  215|  1.21M|}
bn_exp.c:constant_time_eq:
  192|  1.21M|{
  193|  1.21M|    return constant_time_is_zero(a ^ b);
  194|  1.21M|}
bn_exp.c:constant_time_is_zero:
  166|  1.21M|{
  167|  1.21M|    return constant_time_msb(~a & (a - 1));
  168|  1.21M|}
bn_exp.c:constant_time_msb:
  101|  1.21M|{
  102|  1.21M|    return 0 - (a >> (sizeof(a) * 8 - 1));
  103|  1.21M|}
rsaz_exp.c:constant_time_select_64:
  317|      8|{
  318|      8|    return (value_barrier_64(mask) & a) | (value_barrier_64(~mask) & b);
  319|      8|}
rsaz_exp.c:value_barrier_64:
  254|     16|{
  255|     16|#if !defined(OPENSSL_NO_ASM) && defined(__GNUC__)
  256|     16|    uint64_t r;
  257|     16|    __asm__("" : "=r"(r) : "0"(a));
  258|       |#else
  259|       |    volatile uint64_t r = a;
  260|       |#endif
  261|     16|    return r;
  262|     16|}
curve448.c:constant_time_lookup:
  399|    720|{
  400|    720|    size_t i, j;
  401|    720|    const unsigned char *tablec = (const unsigned char *)table;
  402|    720|    unsigned char *outc = (unsigned char *)out;
  403|    720|    unsigned char mask;
  404|       |
  405|    720|    memset(out, 0, rowsize);
  406|       |
  407|       |    /* Note idx may underflow - but that is well defined */
  408|  12.2k|    for (i = 0; i < numrows; i++, idx--) {
  ------------------
  |  Branch (408:17): [True: 11.5k, False: 720]
  ------------------
  409|  11.5k|        mask = (unsigned char)constant_time_is_zero_s(idx);
  410|  2.22M|        for (j = 0; j < rowsize; j++)
  ------------------
  |  Branch (410:21): [True: 2.21M, False: 11.5k]
  ------------------
  411|  2.21M|            *(outc + j) |= constant_time_select_8(mask, *(tablec++), 0);
  412|  11.5k|    }
  413|    720|}
curve448.c:constant_time_is_zero_s:
  171|  11.5k|{
  172|  11.5k|    return constant_time_msb_s(~a & (a - 1));
  173|  11.5k|}
curve448.c:constant_time_msb_s:
  117|  11.5k|{
  118|  11.5k|    return 0 - (a >> (sizeof(a) * 8 - 1));
  119|  11.5k|}
curve448.c:constant_time_select_8:
  293|  2.21M|{
  294|  2.21M|    return (unsigned char)constant_time_select(mask, a, b);
  295|  2.21M|}
curve448.c:constant_time_select:
  279|  2.21M|{
  280|  2.21M|    return (value_barrier(mask) & a) | (value_barrier(~mask) & b);
  281|  2.21M|}
curve448.c:value_barrier:
  230|  4.42M|{
  231|  4.42M|#if !defined(OPENSSL_NO_ASM) && defined(__GNUC__)
  232|  4.42M|    unsigned int r;
  233|  4.42M|    __asm__("" : "=r"(r) : "0"(a));
  234|       |#else
  235|       |    volatile unsigned int r = a;
  236|       |#endif
  237|  4.42M|    return r;
  238|  4.42M|}
curve448.c:constant_time_select_64:
  317|  5.76k|{
  318|  5.76k|    return (value_barrier_64(mask) & a) | (value_barrier_64(~mask) & b);
  319|  5.76k|}
curve448.c:value_barrier_64:
  254|  11.5k|{
  255|  11.5k|#if !defined(OPENSSL_NO_ASM) && defined(__GNUC__)
  256|  11.5k|    uint64_t r;
  257|  11.5k|    __asm__("" : "=r"(r) : "0"(a));
  258|       |#else
  259|       |    volatile uint64_t r = a;
  260|       |#endif
  261|  11.5k|    return r;
  262|  11.5k|}
curve448.c:constant_time_cond_swap_64:
  353|  5.76k|{
  354|  5.76k|    uint64_t xor = *a ^ *b;
  355|       |
  356|  5.76k|    xor &= mask;
  357|  5.76k|    *a ^= xor;
  358|  5.76k|    *b ^= xor;
  359|  5.76k|}
f_generic.c:constant_time_is_zero_64:
  186|      8|{
  187|      8|    return constant_time_msb_64(~a & (a - 1));
  188|      8|}
f_generic.c:constant_time_msb_64:
  112|      8|{
  113|      8|    return 0 - (a >> 63);
  114|      8|}
scalar.c:constant_time_is_zero_64:
  186|      2|{
  187|      2|    return constant_time_msb_64(~a & (a - 1));
  188|      2|}
scalar.c:constant_time_msb_64:
  112|      2|{
  113|      2|    return 0 - (a >> 63);
  114|      2|}

asn1_dsa.c:PACKET_get_1:
  302|  57.0k|{
  303|  57.0k|    if (!PACKET_peek_1(pkt, data))
  ------------------
  |  Branch (303:9): [True: 882, False: 56.1k]
  ------------------
  304|    882|        return 0;
  305|       |
  306|  56.1k|    packet_forward(pkt, 1);
  307|       |
  308|  56.1k|    return 1;
  309|  57.0k|}
asn1_dsa.c:PACKET_peek_1:
  291|  57.0k|{
  292|  57.0k|    if (!PACKET_remaining(pkt))
  ------------------
  |  Branch (292:9): [True: 882, False: 56.1k]
  ------------------
  293|    882|        return 0;
  294|       |
  295|  56.1k|    *data = *pkt->curr;
  296|       |
  297|  56.1k|    return 1;
  298|  57.0k|}
asn1_dsa.c:packet_forward:
   31|  66.1k|{
   32|  66.1k|    pkt->curr += len;
   33|  66.1k|    pkt->remaining -= len;
   34|  66.1k|}
asn1_dsa.c:PACKET_get_sub_packet:
  123|  8.06k|{
  124|  8.06k|    if (!PACKET_peek_sub_packet(pkt, subpkt, len))
  ------------------
  |  Branch (124:9): [True: 28, False: 8.03k]
  ------------------
  125|     28|        return 0;
  126|       |
  127|  8.03k|    packet_forward(pkt, len);
  128|       |
  129|  8.03k|    return 1;
  130|  8.06k|}
asn1_dsa.c:PACKET_peek_sub_packet:
  109|  8.06k|{
  110|  8.06k|    if (PACKET_remaining(pkt) < len)
  ------------------
  |  Branch (110:9): [True: 28, False: 8.03k]
  ------------------
  111|     28|        return 0;
  112|       |
  113|  8.03k|    return PACKET_buf_init(subpkt, pkt->curr, len);
  114|  8.06k|}
asn1_dsa.c:PACKET_get_length_prefixed_1:
  516|    152|{
  517|    152|    unsigned int length;
  518|    152|    const unsigned char *data;
  519|    152|    PACKET tmp = *pkt;
  520|    152|    if (!PACKET_get_1(&tmp, &length) ||
  ------------------
  |  Branch (520:9): [True: 4, False: 148]
  ------------------
  521|    152|        !PACKET_get_bytes(&tmp, &data, (size_t)length)) {
  ------------------
  |  Branch (521:9): [True: 30, False: 118]
  ------------------
  522|     34|        return 0;
  523|     34|    }
  524|       |
  525|    118|    *pkt = tmp;
  526|    118|    subpkt->curr = data;
  527|    118|    subpkt->remaining = length;
  528|       |
  529|    118|    return 1;
  530|    152|}
asn1_dsa.c:PACKET_get_bytes:
  383|  1.09k|{
  384|  1.09k|    if (!PACKET_peek_bytes(pkt, data, len))
  ------------------
  |  Branch (384:9): [True: 108, False: 990]
  ------------------
  385|    108|        return 0;
  386|       |
  387|    990|    packet_forward(pkt, len);
  388|       |
  389|    990|    return 1;
  390|  1.09k|}
asn1_dsa.c:PACKET_peek_bytes:
  365|  1.09k|{
  366|  1.09k|    if (PACKET_remaining(pkt) < len)
  ------------------
  |  Branch (366:9): [True: 108, False: 990]
  ------------------
  367|    108|        return 0;
  368|       |
  369|    990|    *data = pkt->curr;
  370|       |
  371|    990|    return 1;
  372|  1.09k|}
asn1_dsa.c:PACKET_get_length_prefixed_2:
  564|    954|{
  565|    954|    unsigned int length;
  566|    954|    const unsigned char *data;
  567|    954|    PACKET tmp = *pkt;
  568|       |
  569|    954|    if (!PACKET_get_net_2(&tmp, &length) ||
  ------------------
  |  Branch (569:9): [True: 4, False: 950]
  ------------------
  570|    954|        !PACKET_get_bytes(&tmp, &data, (size_t)length)) {
  ------------------
  |  Branch (570:9): [True: 78, False: 872]
  ------------------
  571|     82|        return 0;
  572|     82|    }
  573|       |
  574|    872|    *pkt = tmp;
  575|    872|    subpkt->curr = data;
  576|    872|    subpkt->remaining = length;
  577|       |
  578|    872|    return 1;
  579|    954|}
asn1_dsa.c:PACKET_get_net_2:
  151|    954|{
  152|    954|    if (!PACKET_peek_net_2(pkt, data))
  ------------------
  |  Branch (152:9): [True: 4, False: 950]
  ------------------
  153|      4|        return 0;
  154|       |
  155|    950|    packet_forward(pkt, 2);
  156|       |
  157|    950|    return 1;
  158|    954|}
asn1_dsa.c:PACKET_peek_net_2:
  138|    954|{
  139|    954|    if (PACKET_remaining(pkt) < 2)
  ------------------
  |  Branch (139:9): [True: 4, False: 950]
  ------------------
  140|      4|        return 0;
  141|       |
  142|    950|    *data = ((unsigned int)(*pkt->curr)) << 8;
  143|    950|    *data |= *(pkt->curr + 1);
  144|       |
  145|    950|    return 1;
  146|    954|}
asn1_dsa.c:PACKET_remaining:
   40|  72.2k|{
   41|  72.2k|    return pkt->remaining;
   42|  72.2k|}
asn1_dsa.c:PACKET_data:
   60|  2.28k|{
   61|  2.28k|    return pkt->curr;
   62|  2.28k|}
asn1_dsa.c:PACKET_buf_init:
   72|  31.4k|{
   73|       |    /* Sanity check for negative values. */
   74|  31.4k|    if (len > (size_t)(SIZE_MAX / 2))
  ------------------
  |  Branch (74:9): [True: 0, False: 31.4k]
  ------------------
   75|      0|        return 0;
   76|       |
   77|  31.4k|    pkt->curr = buf;
   78|  31.4k|    pkt->remaining = len;
   79|  31.4k|    return 1;
   80|  31.4k|}

ssl_sess.c:CRYPTO_NEW_REF:
  268|    434|{
  269|    434|    refcnt->val = n;
  270|    434|    return 1;
  271|    434|}
ssl_sess.c:CRYPTO_FREE_REF:
  273|    434|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|    434|{
  275|    434|}
ssl_sess.c:CRYPTO_DOWN_REF:
   50|    434|{
   51|    434|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|    434|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 434, False: 0]
  ------------------
   53|    434|        atomic_thread_fence(memory_order_acquire);
   54|    434|    return 1;
   55|    434|}
tasn_utl.c:CRYPTO_NEW_REF:
  268|  68.5k|{
  269|  68.5k|    refcnt->val = n;
  270|  68.5k|    return 1;
  271|  68.5k|}
tasn_utl.c:CRYPTO_FREE_REF:
  273|  68.5k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  68.5k|{
  275|  68.5k|}
tasn_utl.c:CRYPTO_DOWN_REF:
   50|  68.5k|{
   51|  68.5k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  68.5k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 68.5k, False: 0]
  ------------------
   53|  68.5k|        atomic_thread_fence(memory_order_acquire);
   54|  68.5k|    return 1;
   55|  68.5k|}
bio_lib.c:CRYPTO_NEW_REF:
  268|  8.82M|{
  269|  8.82M|    refcnt->val = n;
  270|  8.82M|    return 1;
  271|  8.82M|}
bio_lib.c:CRYPTO_FREE_REF:
  273|  8.82M|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  8.82M|{
  275|  8.82M|}
bio_lib.c:CRYPTO_DOWN_REF:
   50|  8.90M|{
   51|  8.90M|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  8.90M|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 8.82M, False: 78.2k]
  ------------------
   53|  8.82M|        atomic_thread_fence(memory_order_acquire);
   54|  8.90M|    return 1;
   55|  8.90M|}
bio_lib.c:CRYPTO_UP_REF:
   34|  78.2k|{
   35|  78.2k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  78.2k|    return 1;
   37|  78.2k|}
dh_lib.c:CRYPTO_NEW_REF:
  268|  33.1k|{
  269|  33.1k|    refcnt->val = n;
  270|  33.1k|    return 1;
  271|  33.1k|}
dh_lib.c:CRYPTO_DOWN_REF:
   50|  33.1k|{
   51|  33.1k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  33.1k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 33.1k, False: 61]
  ------------------
   53|  33.1k|        atomic_thread_fence(memory_order_acquire);
   54|  33.1k|    return 1;
   55|  33.1k|}
dh_lib.c:CRYPTO_FREE_REF:
  273|  33.1k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  33.1k|{
  275|  33.1k|}
dh_lib.c:CRYPTO_UP_REF:
   34|     61|{
   35|     61|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|     61|    return 1;
   37|     61|}
dsa_lib.c:CRYPTO_NEW_REF:
  268|  45.7k|{
  269|  45.7k|    refcnt->val = n;
  270|  45.7k|    return 1;
  271|  45.7k|}
dsa_lib.c:CRYPTO_DOWN_REF:
   50|  45.7k|{
   51|  45.7k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  45.7k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 45.7k, False: 18]
  ------------------
   53|  45.7k|        atomic_thread_fence(memory_order_acquire);
   54|  45.7k|    return 1;
   55|  45.7k|}
dsa_lib.c:CRYPTO_FREE_REF:
  273|  45.7k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  45.7k|{
  275|  45.7k|}
dsa_lib.c:CRYPTO_UP_REF:
   34|     18|{
   35|     18|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|     18|    return 1;
   37|     18|}
ec_key.c:CRYPTO_DOWN_REF:
   50|  41.0k|{
   51|  41.0k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  41.0k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 31.1k, False: 9.85k]
  ------------------
   53|  31.1k|        atomic_thread_fence(memory_order_acquire);
   54|  41.0k|    return 1;
   55|  41.0k|}
ec_key.c:CRYPTO_FREE_REF:
  273|  31.1k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  31.1k|{
  275|  31.1k|}
ec_key.c:CRYPTO_UP_REF:
   34|  9.85k|{
   35|  9.85k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  9.85k|    return 1;
   37|  9.85k|}
ec_kmeth.c:CRYPTO_NEW_REF:
  268|  31.1k|{
  269|  31.1k|    refcnt->val = n;
  270|  31.1k|    return 1;
  271|  31.1k|}
decoder_meth.c:CRYPTO_UP_REF:
   34|   453k|{
   35|   453k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|   453k|    return 1;
   37|   453k|}
decoder_meth.c:CRYPTO_DOWN_REF:
   50|   453k|{
   51|   453k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|   453k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 40, False: 453k]
  ------------------
   53|     40|        atomic_thread_fence(memory_order_acquire);
   54|   453k|    return 1;
   55|   453k|}
decoder_meth.c:CRYPTO_FREE_REF:
  273|     40|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|     40|{
  275|     40|}
decoder_meth.c:CRYPTO_NEW_REF:
  268|     40|{
  269|     40|    refcnt->val = n;
  270|     40|    return 1;
  271|     40|}
encoder_meth.c:CRYPTO_UP_REF:
   34|  34.8k|{
   35|  34.8k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  34.8k|    return 1;
   37|  34.8k|}
encoder_meth.c:CRYPTO_DOWN_REF:
   50|  34.9k|{
   51|  34.9k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  34.9k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 115, False: 34.8k]
  ------------------
   53|    115|        atomic_thread_fence(memory_order_acquire);
   54|  34.9k|    return 1;
   55|  34.9k|}
encoder_meth.c:CRYPTO_FREE_REF:
  273|    115|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|    115|{
  275|    115|}
encoder_meth.c:CRYPTO_NEW_REF:
  268|    115|{
  269|    115|    refcnt->val = n;
  270|    115|    return 1;
  271|    115|}
digest.c:CRYPTO_NEW_REF:
  268|     27|{
  269|     27|    refcnt->val = n;
  270|     27|    return 1;
  271|     27|}
digest.c:CRYPTO_UP_REF:
   34|  14.7k|{
   35|  14.7k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  14.7k|    return 1;
   37|  14.7k|}
digest.c:CRYPTO_DOWN_REF:
   50|  14.7k|{
   51|  14.7k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  14.7k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 27, False: 14.7k]
  ------------------
   53|     27|        atomic_thread_fence(memory_order_acquire);
   54|  14.7k|    return 1;
   55|  14.7k|}
evp_lib.c:CRYPTO_FREE_REF:
  273|     27|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|     27|{
  275|     27|}
keymgmt_meth.c:CRYPTO_NEW_REF:
  268|     18|{
  269|     18|    refcnt->val = n;
  270|     18|    return 1;
  271|     18|}
keymgmt_meth.c:CRYPTO_UP_REF:
   34|   279k|{
   35|   279k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|   279k|    return 1;
   37|   279k|}
keymgmt_meth.c:CRYPTO_DOWN_REF:
   50|   279k|{
   51|   279k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|   279k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 18, False: 279k]
  ------------------
   53|     18|        atomic_thread_fence(memory_order_acquire);
   54|   279k|    return 1;
   55|   279k|}
keymgmt_meth.c:CRYPTO_FREE_REF:
  273|     18|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|     18|{
  275|     18|}
p_lib.c:CRYPTO_NEW_REF:
  268|  54.8k|{
  269|  54.8k|    refcnt->val = n;
  270|  54.8k|    return 1;
  271|  54.8k|}
p_lib.c:CRYPTO_FREE_REF:
  273|  54.8k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  54.8k|{
  275|  54.8k|}
p_lib.c:CRYPTO_UP_REF:
   34|  13.5k|{
   35|  13.5k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  13.5k|    return 1;
   37|  13.5k|}
p_lib.c:CRYPTO_DOWN_REF:
   50|  68.4k|{
   51|  68.4k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  68.4k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 54.8k, False: 13.5k]
  ------------------
   53|  54.8k|        atomic_thread_fence(memory_order_acquire);
   54|  68.4k|    return 1;
   55|  68.4k|}
provider_core.c:CRYPTO_UP_REF:
   34|  13.7k|{
   35|  13.7k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  13.7k|    return 1;
   37|  13.7k|}
provider_core.c:CRYPTO_NEW_REF:
  268|      3|{
  269|      3|    refcnt->val = n;
  270|      3|    return 1;
  271|      3|}
provider_core.c:CRYPTO_DOWN_REF:
   50|  13.7k|{
   51|  13.7k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  13.7k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 1, False: 13.7k]
  ------------------
   53|      1|        atomic_thread_fence(memory_order_acquire);
   54|  13.7k|    return 1;
   55|  13.7k|}
provider_core.c:CRYPTO_FREE_REF:
  273|      1|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|      1|{
  275|      1|}
rsa_lib.c:CRYPTO_NEW_REF:
  268|  51.2k|{
  269|  51.2k|    refcnt->val = n;
  270|  51.2k|    return 1;
  271|  51.2k|}
rsa_lib.c:CRYPTO_DOWN_REF:
   50|  54.8k|{
   51|  54.8k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|  54.8k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 51.2k, False: 3.62k]
  ------------------
   53|  51.2k|        atomic_thread_fence(memory_order_acquire);
   54|  54.8k|    return 1;
   55|  54.8k|}
rsa_lib.c:CRYPTO_FREE_REF:
  273|  51.2k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  51.2k|{
  275|  51.2k|}
rsa_lib.c:CRYPTO_UP_REF:
   34|  3.62k|{
   35|  3.62k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|  3.62k|    return 1;
   37|  3.62k|}
ossl_core_bio.c:CRYPTO_UP_REF:
   34|   267k|{
   35|   267k|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|   267k|    return 1;
   37|   267k|}
ossl_core_bio.c:CRYPTO_DOWN_REF:
   50|   346k|{
   51|   346k|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|   346k|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 78.2k, False: 267k]
  ------------------
   53|  78.2k|        atomic_thread_fence(memory_order_acquire);
   54|   346k|    return 1;
   55|   346k|}
ossl_core_bio.c:CRYPTO_FREE_REF:
  273|  78.2k|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|  78.2k|{
  275|  78.2k|}
ossl_core_bio.c:CRYPTO_NEW_REF:
  268|  78.2k|{
  269|  78.2k|    refcnt->val = n;
  270|  78.2k|    return 1;
  271|  78.2k|}
ecx_key.c:CRYPTO_NEW_REF:
  268|     22|{
  269|     22|    refcnt->val = n;
  270|     22|    return 1;
  271|     22|}
ecx_key.c:CRYPTO_FREE_REF:
  273|     22|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|     22|{
  275|     22|}
ecx_key.c:CRYPTO_DOWN_REF:
   50|     30|{
   51|     30|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|     30|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 22, False: 8]
  ------------------
   53|     22|        atomic_thread_fence(memory_order_acquire);
   54|     30|    return 1;
   55|     30|}
ecx_key.c:CRYPTO_UP_REF:
   34|      8|{
   35|      8|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|      8|    return 1;
   37|      8|}
evp_rand.c:CRYPTO_UP_REF:
   34|     16|{
   35|     16|    *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1;
   36|     16|    return 1;
   37|     16|}
evp_rand.c:CRYPTO_NEW_REF:
  268|      9|{
  269|      9|    refcnt->val = n;
  270|      9|    return 1;
  271|      9|}
evp_rand.c:CRYPTO_FREE_REF:
  273|      9|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|      9|{
  275|      9|}
evp_rand.c:CRYPTO_DOWN_REF:
   50|     25|{
   51|     25|    *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1;
   52|     25|    if (*ret == 0)
  ------------------
  |  Branch (52:9): [True: 9, False: 16]
  ------------------
   53|      9|        atomic_thread_fence(memory_order_acquire);
   54|     25|    return 1;
   55|     25|}

ssl_sess.c:safe_add_time:
   49|    800|    {                                                                        \
   50|    800|        type r;                                                              \
   51|    800|                                                                             \
   52|    800|        if (!__builtin_add_overflow(a, b, &r))                               \
  ------------------
  |  Branch (52:13): [True: 681, False: 119]
  ------------------
   53|    800|            return r;                                                        \
   54|    800|        *err |= 1;                                                           \
   55|    119|        return a + b;                                                            \
   56|    800|    }
stack.c:safe_muldiv_int:
  322|  51.6k|    {                                                                        \
  323|  51.6k|        int e2 = 0;                                                          \
  324|  51.6k|        type q, r, x, y;                                                     \
  325|  51.6k|                                                                             \
  326|  51.6k|        if (c == 0) {                                                        \
  ------------------
  |  Branch (326:13): [True: 0, False: 51.6k]
  ------------------
  327|      0|            *err |= 1;                                                       \
  328|      0|            return a == 0 || b == 0 ? 0 : max;                               \
  ------------------
  |  Branch (328:20): [True: 0, False: 0]
  |  Branch (328:30): [True: 0, False: 0]
  ------------------
  329|      0|        }                                                                    \
  330|  51.6k|        x = safe_mul_ ## type_name(a, b, &e2);                               \
  331|  51.6k|        if (!e2)                                                             \
  ------------------
  |  Branch (331:13): [True: 51.6k, False: 0]
  ------------------
  332|  51.6k|            return safe_div_ ## type_name(x, c, err);                        \
  333|  51.6k|        if (b > a) {                                                         \
  ------------------
  |  Branch (333:13): [True: 0, False: 0]
  ------------------
  334|      0|            x = b;                                                           \
  335|      0|            b = a;                                                           \
  336|      0|            a = x;                                                           \
  337|      0|        }                                                                    \
  338|      0|        q = safe_div_ ## type_name(a, c, err);                               \
  339|      0|        r = safe_mod_ ## type_name(a, c, err);                               \
  340|      0|        x = safe_mul_ ## type_name(r, b, err);                               \
  341|      0|        y = safe_mul_ ## type_name(q, b, err);                               \
  342|      0|        q = safe_div_ ## type_name(x, c, err);                               \
  343|      0|        return safe_add_ ## type_name(y, q, err);                            \
  344|  51.6k|    }
stack.c:safe_mul_int:
  136|  51.6k|    {                                                                        \
  137|  51.6k|        type r;                                                              \
  138|  51.6k|                                                                             \
  139|  51.6k|        if (!__builtin_mul_overflow(a, b, &r))                               \
  ------------------
  |  Branch (139:13): [True: 51.6k, False: 0]
  ------------------
  140|  51.6k|            return r;                                                        \
  141|  51.6k|        *err |= 1;                                                           \
  142|      0|        return (a < 0) ^ (b < 0) ? min : max;                                \
  ------------------
  |  Branch (142:16): [True: 0, False: 0]
  ------------------
  143|  51.6k|    }
stack.c:safe_div_int:
  199|  51.6k|    {                                                                        \
  200|  51.6k|        if (b == 0) {                                                        \
  ------------------
  |  Branch (200:13): [True: 0, False: 51.6k]
  ------------------
  201|      0|            *err |= 1;                                                       \
  202|      0|            return a < 0 ? min : max;                                        \
  ------------------
  |  Branch (202:20): [True: 0, False: 0]
  ------------------
  203|      0|        }                                                                    \
  204|  51.6k|        if (b == -1 && a == min) {                                           \
  ------------------
  |  Branch (204:13): [True: 0, False: 51.6k]
  |  Branch (204:24): [True: 0, False: 0]
  ------------------
  205|      0|            *err |= 1;                                                       \
  206|      0|            return max;                                                      \
  207|      0|        }                                                                    \
  208|  51.6k|        return a / b;                                                        \
  209|  51.6k|    }

ssl_init.c:ossl_init_ssl_base_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
ssl_init.c:ossl_init_load_ssl_strings_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
ssl_ciph.c:do_load_builtin_compressions_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
conf_mod.c:do_init_module_list_lock_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
do_engine_lock_init_ossl_:
   41|      1|    {                                           \
   42|      1|        init##_ossl_ret_ = init();              \
   43|      1|    }                                           \
err.c:do_err_strings_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
err.c:err_do_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
context.c:default_context_do_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_base_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_register_atexit_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_load_crypto_nodelete_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_load_crypto_strings_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_add_all_ciphers_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_add_all_digests_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_config_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
initthread.c:create_global_tevent_register_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
o_names.c:o_names_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
obj_dat.c:obj_lock_initialise_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \
rand_lib.c:do_rand_init_ossl_:
   73|      1|    {                                           \
   74|      1|        init##_ossl_ret_ = init();              \
   75|      1|    }                                           \

ssl_asn1.c:ossl_time_to_time_t:
  114|    363|{
  115|    363|    return (time_t)(t.t / OSSL_TIME_SECOND);
  ------------------
  |  |   30|    363|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  ------------------
  116|    363|}
ssl_asn1.c:ossl_time2ticks:
   61|    363|{
   62|    363|    return t.t;
   63|    363|}
ssl_asn1.c:ossl_time_from_time_t:
  121|    157|{
  122|    157|    OSSL_TIME ot;
  123|       |
  124|    157|    ot.t = t;
  125|    157|    ot.t *= OSSL_TIME_SECOND;
  ------------------
  |  |   30|    157|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  ------------------
  126|    157|    return ot;
  127|    157|}
ssl_asn1.c:ossl_ticks2time:
   51|    366|{
   52|    366|    OSSL_TIME r;
   53|       |
   54|    366|    r.t = ticks;
   55|    366|    return r;
   56|    366|}
ssl_sess.c:ossl_time_add:
  163|    800|{
  164|    800|    OSSL_TIME r;
  165|    800|    int err = 0;
  166|       |
  167|    800|    r.t = safe_add_time(a.t, b.t, &err);
  168|    800|    return err ? ossl_time_infinite() : r;
  ------------------
  |  Branch (168:12): [True: 119, False: 681]
  ------------------
  169|    800|}
ssl_sess.c:ossl_time_infinite:
   77|    119|{
   78|    119|    return ossl_ticks2time(~(uint64_t)0);
   79|    119|}
ssl_sess.c:ossl_ticks2time:
   51|    553|{
   52|    553|    OSSL_TIME r;
   53|       |
   54|    553|    r.t = ticks;
   55|    553|    return r;
   56|    553|}
ssl_txt.c:ossl_time_is_zero:
  143|    718|{
  144|    718|    return ossl_time_compare(t, ossl_time_zero()) == 0;
  145|    718|}
ssl_txt.c:ossl_time_compare:
  132|    718|{
  133|    718|    if (a.t > b.t)
  ------------------
  |  Branch (133:9): [True: 716, False: 2]
  ------------------
  134|    716|        return 1;
  135|      2|    if (a.t < b.t)
  ------------------
  |  Branch (135:9): [True: 0, False: 2]
  ------------------
  136|      0|        return -1;
  137|      2|    return 0;
  138|      2|}
ssl_txt.c:ossl_time_zero:
   71|    718|{
   72|    718|    return ossl_ticks2time(0);
   73|    718|}
ssl_txt.c:ossl_ticks2time:
   51|    718|{
   52|    718|    OSSL_TIME r;
   53|       |
   54|    718|    r.t = ticks;
   55|    718|    return r;
   56|    718|}
ssl_txt.c:ossl_time_to_time_t:
  114|    358|{
  115|    358|    return (time_t)(t.t / OSSL_TIME_SECOND);
  ------------------
  |  |   30|    358|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  ------------------
  116|    358|}
ssl_txt.c:ossl_time2ticks:
   61|    358|{
   62|    358|    return t.t;
   63|    358|}

a_utf8.c:is_unicode_surrogate:
   22|  74.0k|{
   23|  74.0k|    return value >= SURROGATE_MIN && value <= SURROGATE_MAX;
  ------------------
  |  Branch (23:12): [True: 34.2k, False: 39.7k]
  |  Branch (23:38): [True: 46, False: 34.1k]
  ------------------
   24|  74.0k|}
a_mbstr.c:is_unicode_valid:
   27|  3.35M|{
   28|  3.35M|    return value <= UNICODE_MAX && !is_unicode_surrogate(value);
  ------------------
  |  Branch (28:12): [True: 3.35M, False: 47]
  |  Branch (28:36): [True: 3.35M, False: 13]
  ------------------
   29|  3.35M|}
a_mbstr.c:is_unicode_surrogate:
   22|  3.35M|{
   23|  3.35M|    return value >= SURROGATE_MIN && value <= SURROGATE_MAX;
  ------------------
  |  Branch (23:12): [True: 774, False: 3.35M]
  |  Branch (23:38): [True: 13, False: 761]
  ------------------
   24|  3.35M|}

ssl_asn1.c:i2d_SSL_SESSION_ASN1:
  848|    363|        { \
  849|    363|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, \
  850|    363|                                     ASN1_ITEM_rptr(stname)); \
  ------------------
  |  |  426|    363|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  851|    363|        }
ssl_asn1.c:d2i_SSL_SESSION_ASN1:
  843|  11.7k|        { \
  844|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \
  845|  11.7k|                                               ASN1_ITEM_rptr(stname)); \
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  846|  11.7k|        } \
ssl_asn1.c:SSL_SESSION_ASN1_it:
  178|  23.8k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  23.8k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  23.8k|        { \
  |  |  |  |   96|  23.8k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  23.8k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  23.8k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  23.8k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  23.8k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  23.8k|                tname##_seq_tt,\
  182|  23.8k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  23.8k|                NULL,\
  184|  23.8k|                sizeof(stname),\
  185|  23.8k|                #stname \
  186|  23.8k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  23.8k|                }; \
  |  |  103|  23.8k|        return &local_it; \
  |  |  104|  23.8k|        }
  ------------------
ASN1_TIME_it:
  770|   514k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|   514k|        { \
  |  |   96|   514k|                static const ASN1_ITEM local_it = {
  ------------------
  771|   514k|                                        ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
  ------------------
  |  |   85|   514k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  772|   514k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|   514k|                }; \
  |  |  103|   514k|        return &local_it; \
  |  |  104|   514k|        }
  ------------------
NETSCAPE_CERT_SEQUENCE_it:
  247|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  11.7k|                tname##_seq_tt,\
  251|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  11.7k|                &tname##_aux,\
  253|  11.7k|                sizeof(stname),\
  254|  11.7k|                #tname \
  255|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PBEPARAM_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PBE2PARAM_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PBKDF2PARAM_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS8_PRIV_KEY_INFO_it:
  247|   197k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   197k|        { \
  |  |   96|   197k|                static const ASN1_ITEM local_it = {
  ------------------
  248|   197k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   197k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|   197k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   197k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|   197k|                tname##_seq_tt,\
  251|   197k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|   197k|                &tname##_aux,\
  253|   197k|                sizeof(stname),\
  254|   197k|                #tname \
  255|   197k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   197k|                }; \
  |  |  103|   197k|        return &local_it; \
  |  |  104|   197k|        }
  ------------------
d2i_PKCS8_PRIV_KEY_INFO:
  826|   103k|        { \
  827|   103k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|   103k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|   103k|        } \
i2d_PKCS8_PRIV_KEY_INFO:
  830|     74|        { \
  831|     74|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     74|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     74|        }
PKCS8_PRIV_KEY_INFO_new:
  812|    189|        { \
  813|    189|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|    189|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|    189|        } \
PKCS8_PRIV_KEY_INFO_free:
  816|  82.4k|        { \
  817|  82.4k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  82.4k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  82.4k|        }
ASN1_OCTET_STRING_it:
  764|  1.96M|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  1.96M|        { \
  |  |   96|  1.96M|                static const ASN1_ITEM local_it = {
  ------------------
  765|  1.96M|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  1.96M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  1.96M|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  1.96M|                }; \
  |  |  103|  1.96M|        return &local_it; \
  |  |  104|  1.96M|        }
  ------------------
d2i_ASN1_OCTET_STRING:
  826|   110k|        { \
  827|   110k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|   110k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|   110k|        } \
i2d_ASN1_OCTET_STRING:
  830|     13|        { \
  831|     13|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     13|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     13|        }
ASN1_INTEGER_it:
  764|  2.92M|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  2.92M|        { \
  |  |   96|  2.92M|                static const ASN1_ITEM local_it = {
  ------------------
  765|  2.92M|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  2.92M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  2.92M|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  2.92M|                }; \
  |  |  103|  2.92M|        return &local_it; \
  |  |  104|  2.92M|        }
  ------------------
d2i_ASN1_INTEGER:
  826|   311k|        { \
  827|   311k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|   311k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|   311k|        } \
i2d_ASN1_INTEGER:
  830|     25|        { \
  831|     25|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     25|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     25|        }
ASN1_ENUMERATED_it:
  764|  76.8k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  76.8k|        { \
  |  |   96|  76.8k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  76.8k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  76.8k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  76.8k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  76.8k|                }; \
  |  |  103|  76.8k|        return &local_it; \
  |  |  104|  76.8k|        }
  ------------------
d2i_ASN1_ENUMERATED:
  826|  8.09k|        { \
  827|  8.09k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  8.09k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  8.09k|        } \
ASN1_BIT_STRING_it:
  764|  1.39M|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  1.39M|        { \
  |  |   96|  1.39M|                static const ASN1_ITEM local_it = {
  ------------------
  765|  1.39M|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  1.39M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  1.39M|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  1.39M|                }; \
  |  |  103|  1.39M|        return &local_it; \
  |  |  104|  1.39M|        }
  ------------------
ASN1_UTF8STRING_it:
  764|  89.3k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  89.3k|        { \
  |  |   96|  89.3k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  89.3k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  89.3k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  89.3k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  89.3k|                }; \
  |  |  103|  89.3k|        return &local_it; \
  |  |  104|  89.3k|        }
  ------------------
ASN1_PRINTABLESTRING_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_T61STRING_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_IA5STRING_it:
  764|   244k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|   244k|        { \
  |  |   96|   244k|                static const ASN1_ITEM local_it = {
  ------------------
  765|   244k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|   244k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|   244k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|   244k|                }; \
  |  |  103|   244k|        return &local_it; \
  |  |  104|   244k|        }
  ------------------
ASN1_GENERALSTRING_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_UTCTIME_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_GENERALIZEDTIME_it:
  764|   259k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|   259k|        { \
  |  |   96|   259k|                static const ASN1_ITEM local_it = {
  ------------------
  765|   259k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|   259k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|   259k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|   259k|                }; \
  |  |  103|   259k|        return &local_it; \
  |  |  104|   259k|        }
  ------------------
ASN1_VISIBLESTRING_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_UNIVERSALSTRING_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_BMPSTRING_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_NULL_it:
  764|  64.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  64.7k|        { \
  |  |   96|  64.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  64.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  64.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  64.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  64.7k|                }; \
  |  |  103|  64.7k|        return &local_it; \
  |  |  104|  64.7k|        }
  ------------------
ASN1_OBJECT_it:
  764|  6.53M|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  6.53M|        { \
  |  |   96|  6.53M|                static const ASN1_ITEM local_it = {
  ------------------
  765|  6.53M|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  6.53M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  6.53M|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  6.53M|                }; \
  |  |  103|  6.53M|        return &local_it; \
  |  |  104|  6.53M|        }
  ------------------
ASN1_ANY_it:
  764|  13.3M|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  13.3M|        { \
  |  |   96|  13.3M|                static const ASN1_ITEM local_it = {
  ------------------
  765|  13.3M|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  13.3M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  13.3M|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  13.3M|                }; \
  |  |  103|  13.3M|        return &local_it; \
  |  |  104|  13.3M|        }
  ------------------
ASN1_SEQUENCE_it:
  764|  62.0k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  62.0k|        { \
  |  |   96|  62.0k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  62.0k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  62.0k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  62.0k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  62.0k|                }; \
  |  |  103|  62.0k|        return &local_it; \
  |  |  104|  62.0k|        }
  ------------------
i2d_ASN1_TYPE:
  830|    860|        { \
  831|    860|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    860|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    860|        }
ASN1_TYPE_new:
  812|  2.63M|        { \
  813|  2.63M|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  2.63M|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|  2.63M|        } \
ASN1_TYPE_free:
  816|   958k|        { \
  817|   958k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|   958k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|   958k|        }
ASN1_PRINTABLE_it:
  770|  3.73M|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  3.73M|        { \
  |  |   96|  3.73M|                static const ASN1_ITEM local_it = {
  ------------------
  771|  3.73M|                                        ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
  ------------------
  |  |   85|  3.73M|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  772|  3.73M|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  3.73M|                }; \
  |  |  103|  3.73M|        return &local_it; \
  |  |  104|  3.73M|        }
  ------------------
DISPLAYTEXT_it:
  770|  80.2k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  80.2k|        { \
  |  |   96|  80.2k|                static const ASN1_ITEM local_it = {
  ------------------
  771|  80.2k|                                        ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
  ------------------
  |  |   85|  80.2k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  772|  80.2k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  80.2k|                }; \
  |  |  103|  80.2k|        return &local_it; \
  |  |  104|  80.2k|        }
  ------------------
DIRECTORYSTRING_it:
  770|  68.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  68.7k|        { \
  |  |   96|  68.7k|                static const ASN1_ITEM local_it = {
  ------------------
  771|  68.7k|                                        ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
  ------------------
  |  |   85|  68.7k|# define ASN1_ITYPE_MSTRING              0x5
  ------------------
  772|  68.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  68.7k|                }; \
  |  |  103|  68.7k|        return &local_it; \
  |  |  104|  68.7k|        }
  ------------------
ASN1_BOOLEAN_it:
  764|   293k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|   293k|        { \
  |  |   96|   293k|                static const ASN1_ITEM local_it = {
  ------------------
  765|   293k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|   293k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|   293k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|   293k|                }; \
  |  |  103|   293k|        return &local_it; \
  |  |  104|   293k|        }
  ------------------
ASN1_TBOOLEAN_it:
  764|  11.7k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  765|  11.7k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|  11.7k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
ASN1_FBOOLEAN_it:
  764|   441k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|   441k|        { \
  |  |   96|   441k|                static const ASN1_ITEM local_it = {
  ------------------
  765|   441k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|   441k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|   441k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|   441k|                }; \
  |  |  103|   441k|        return &local_it; \
  |  |  104|   441k|        }
  ------------------
ASN1_OCTET_STRING_NDEF_it:
  764|   127k|                                ASN1_ITEM_start(itname) \
  ------------------
  |  |   95|   127k|        { \
  |  |   96|   127k|                static const ASN1_ITEM local_it = {
  ------------------
  765|   127k|                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
  ------------------
  |  |   80|   127k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  766|   127k|                                ASN1_ITEM_end(itname)
  ------------------
  |  |  102|   127k|                }; \
  |  |  103|   127k|        return &local_it; \
  |  |  104|   127k|        }
  ------------------
ASN1_SEQUENCE_ANY_it:
  113|  21.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  21.9k|        { \
  |  |   96|  21.9k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  21.9k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  21.9k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  21.9k|                -1,\
  116|  21.9k|                &tname##_item_tt,\
  117|  21.9k|                0,\
  118|  21.9k|                NULL,\
  119|  21.9k|                0,\
  120|  21.9k|                #tname \
  121|  21.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  21.9k|                }; \
  |  |  103|  21.9k|        return &local_it; \
  |  |  104|  21.9k|        }
  ------------------
ASN1_SET_ANY_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
d2i_ASN1_SEQUENCE_ANY:
  826|  10.2k|        { \
  827|  10.2k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  10.2k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  10.2k|        } \
X509_ALGOR_it:
  166|  1.96M|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  1.96M|        { \
  |  |   96|  1.96M|                static const ASN1_ITEM local_it = {
  ------------------
  167|  1.96M|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  1.96M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  1.96M|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  1.96M|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  1.96M|                tname##_seq_tt,\
  170|  1.96M|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  1.96M|                NULL,\
  172|  1.96M|                sizeof(stname),\
  173|  1.96M|                #tname \
  174|  1.96M|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  1.96M|                }; \
  |  |  103|  1.96M|        return &local_it; \
  |  |  104|  1.96M|        }
  ------------------
X509_ALGORS_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
X509_ALGOR_new:
  812|   133k|        { \
  813|   133k|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|   133k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|   133k|        } \
X509_ALGOR_free:
  816|   130k|        { \
  817|   130k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|   130k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|   130k|        }
X509_SIG_it:
  166|  39.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.3k|        { \
  |  |   96|  39.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.3k|                tname##_seq_tt,\
  170|  39.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.3k|                NULL,\
  172|  39.3k|                sizeof(stname),\
  173|  39.3k|                #tname \
  174|  39.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.3k|                }; \
  |  |  103|  39.3k|        return &local_it; \
  |  |  104|  39.3k|        }
  ------------------
NETSCAPE_SPKAC_it:
  166|  39.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.3k|        { \
  |  |   96|  39.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.3k|                tname##_seq_tt,\
  170|  39.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.3k|                NULL,\
  172|  39.3k|                sizeof(stname),\
  173|  39.3k|                #tname \
  174|  39.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.3k|                }; \
  |  |  103|  39.3k|        return &local_it; \
  |  |  104|  39.3k|        }
  ------------------
NETSCAPE_SPKI_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
X509_VAL_it:
  166|   148k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   148k|        { \
  |  |   96|   148k|                static const ASN1_ITEM local_it = {
  ------------------
  167|   148k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   148k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|   148k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   148k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|   148k|                tname##_seq_tt,\
  170|   148k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|   148k|                NULL,\
  172|   148k|                sizeof(stname),\
  173|   148k|                #tname \
  174|   148k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   148k|                }; \
  |  |  103|   148k|        return &local_it; \
  |  |  104|   148k|        }
  ------------------
CMS_IssuerAndSerialNumber_it:
  166|  8.35k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  8.35k|        { \
  |  |   96|  8.35k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  8.35k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  8.35k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  8.35k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  8.35k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  8.35k|                tname##_seq_tt,\
  170|  8.35k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  8.35k|                NULL,\
  172|  8.35k|                sizeof(stname),\
  173|  8.35k|                #tname \
  174|  8.35k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  8.35k|                }; \
  |  |  103|  8.35k|        return &local_it; \
  |  |  104|  8.35k|        }
  ------------------
CMS_CertificateChoices_it:
  320|  25.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  25.5k|        { \
  |  |   96|  25.5k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  25.5k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  25.5k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  25.5k|                offsetof(stname,selname) ,\
  323|  25.5k|                tname##_ch_tt,\
  324|  25.5k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  25.5k|                NULL,\
  326|  25.5k|                sizeof(stname),\
  327|  25.5k|                #stname \
  328|  25.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  25.5k|                }; \
  |  |  103|  25.5k|        return &local_it; \
  |  |  104|  25.5k|        }
  ------------------
CMS_SignerInfo_it:
  247|  6.06k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  6.06k|        { \
  |  |   96|  6.06k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  6.06k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  6.06k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  6.06k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  6.06k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  6.06k|                tname##_seq_tt,\
  251|  6.06k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  6.06k|                &tname##_aux,\
  253|  6.06k|                sizeof(stname),\
  254|  6.06k|                #tname \
  255|  6.06k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  6.06k|                }; \
  |  |  103|  6.06k|        return &local_it; \
  |  |  104|  6.06k|        }
  ------------------
CMS_RevocationInfoChoice_it:
  320|  9.64k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  9.64k|        { \
  |  |   96|  9.64k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  9.64k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  9.64k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  9.64k|                offsetof(stname,selname) ,\
  323|  9.64k|                tname##_ch_tt,\
  324|  9.64k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  9.64k|                NULL,\
  326|  9.64k|                sizeof(stname),\
  327|  9.64k|                #stname \
  328|  9.64k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  9.64k|                }; \
  |  |  103|  9.64k|        return &local_it; \
  |  |  104|  9.64k|        }
  ------------------
CMS_SignedData_it:
  218|  2.10k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  2.10k|        { \
  |  |   96|  2.10k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  2.10k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  2.10k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  2.10k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  2.10k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  2.10k|                tname##_seq_tt,\
  222|  2.10k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  2.10k|                NULL,\
  224|  2.10k|                sizeof(tname),\
  225|  2.10k|                #tname \
  226|  2.10k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  2.10k|                }; \
  |  |  103|  2.10k|        return &local_it; \
  |  |  104|  2.10k|        }
  ------------------
CMS_KeyTransRecipientInfo_it:
  166|  5.39k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  5.39k|        { \
  |  |   96|  5.39k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  5.39k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  5.39k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  5.39k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  5.39k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  5.39k|                tname##_seq_tt,\
  170|  5.39k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  5.39k|                NULL,\
  172|  5.39k|                sizeof(stname),\
  173|  5.39k|                #tname \
  174|  5.39k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  5.39k|                }; \
  |  |  103|  5.39k|        return &local_it; \
  |  |  104|  5.39k|        }
  ------------------
CMS_OtherKeyAttribute_it:
  166|    626|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|    626|        { \
  |  |   96|    626|                static const ASN1_ITEM local_it = {
  ------------------
  167|    626|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|    626|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|    626|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|    626|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|    626|                tname##_seq_tt,\
  170|    626|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|    626|                NULL,\
  172|    626|                sizeof(stname),\
  173|    626|                #tname \
  174|    626|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|    626|                }; \
  |  |  103|    626|        return &local_it; \
  |  |  104|    626|        }
  ------------------
CMS_RecipientKeyIdentifier_it:
  166|      6|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|      6|        { \
  |  |   96|      6|                static const ASN1_ITEM local_it = {
  ------------------
  167|      6|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|      6|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|      6|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|      6|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|      6|                tname##_seq_tt,\
  170|      6|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|      6|                NULL,\
  172|      6|                sizeof(stname),\
  173|      6|                #tname \
  174|      6|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|      6|                }; \
  |  |  103|      6|        return &local_it; \
  |  |  104|      6|        }
  ------------------
CMS_RecipientEncryptedKey_it:
  247|  2.60k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  2.60k|        { \
  |  |   96|  2.60k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  2.60k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  2.60k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  2.60k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  2.60k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  2.60k|                tname##_seq_tt,\
  251|  2.60k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  2.60k|                &tname##_aux,\
  253|  2.60k|                sizeof(stname),\
  254|  2.60k|                #tname \
  255|  2.60k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  2.60k|                }; \
  |  |  103|  2.60k|        return &local_it; \
  |  |  104|  2.60k|        }
  ------------------
CMS_OriginatorPublicKey_it:
  166|      4|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|      4|        { \
  |  |   96|      4|                static const ASN1_ITEM local_it = {
  ------------------
  167|      4|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|      4|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|      4|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|      4|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|      4|                tname##_seq_tt,\
  170|      4|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|      4|                NULL,\
  172|      4|                sizeof(stname),\
  173|      4|                #tname \
  174|      4|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|      4|                }; \
  |  |  103|      4|        return &local_it; \
  |  |  104|      4|        }
  ------------------
CMS_KeyAgreeRecipientInfo_it:
  247|  9.85k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  9.85k|        { \
  |  |   96|  9.85k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  9.85k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  9.85k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  9.85k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  9.85k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  9.85k|                tname##_seq_tt,\
  251|  9.85k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  9.85k|                &tname##_aux,\
  253|  9.85k|                sizeof(stname),\
  254|  9.85k|                #tname \
  255|  9.85k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  9.85k|                }; \
  |  |  103|  9.85k|        return &local_it; \
  |  |  104|  9.85k|        }
  ------------------
CMS_KEKRecipientInfo_it:
  166|  3.97k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  3.97k|        { \
  |  |   96|  3.97k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  3.97k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  3.97k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  3.97k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  3.97k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  3.97k|                tname##_seq_tt,\
  170|  3.97k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  3.97k|                NULL,\
  172|  3.97k|                sizeof(stname),\
  173|  3.97k|                #tname \
  174|  3.97k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  3.97k|                }; \
  |  |  103|  3.97k|        return &local_it; \
  |  |  104|  3.97k|        }
  ------------------
CMS_PasswordRecipientInfo_it:
  166|  8.24k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  8.24k|        { \
  |  |   96|  8.24k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  8.24k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  8.24k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  8.24k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  8.24k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  8.24k|                tname##_seq_tt,\
  170|  8.24k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  8.24k|                NULL,\
  172|  8.24k|                sizeof(stname),\
  173|  8.24k|                #tname \
  174|  8.24k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  8.24k|                }; \
  |  |  103|  8.24k|        return &local_it; \
  |  |  104|  8.24k|        }
  ------------------
CMS_RecipientInfo_it:
  344|  15.0k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  15.0k|        { \
  |  |   96|  15.0k|                static const ASN1_ITEM local_it = {
  ------------------
  345|  15.0k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  15.0k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  346|  15.0k|                offsetof(stname,selname) ,\
  347|  15.0k|                tname##_ch_tt,\
  348|  15.0k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  349|  15.0k|                &tname##_aux,\
  350|  15.0k|                sizeof(stname),\
  351|  15.0k|                #stname \
  352|  15.0k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  15.0k|                }; \
  |  |  103|  15.0k|        return &local_it; \
  |  |  104|  15.0k|        }
  ------------------
CMS_EnvelopedData_it:
  218|     20|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     20|        { \
  |  |   96|     20|                static const ASN1_ITEM local_it = {
  ------------------
  219|     20|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|     20|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|     20|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     20|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|     20|                tname##_seq_tt,\
  222|     20|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|     20|                NULL,\
  224|     20|                sizeof(tname),\
  225|     20|                #tname \
  226|     20|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     20|                }; \
  |  |  103|     20|        return &local_it; \
  |  |  104|     20|        }
  ------------------
CMS_DigestedData_it:
  218|      6|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|      6|        { \
  |  |   96|      6|                static const ASN1_ITEM local_it = {
  ------------------
  219|      6|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|      6|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|      6|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|      6|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|      6|                tname##_seq_tt,\
  222|      6|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|      6|                NULL,\
  224|      6|                sizeof(tname),\
  225|      6|                #tname \
  226|      6|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|      6|                }; \
  |  |  103|      6|        return &local_it; \
  |  |  104|      6|        }
  ------------------
CMS_EncryptedData_it:
  218|     18|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     18|        { \
  |  |   96|     18|                static const ASN1_ITEM local_it = {
  ------------------
  219|     18|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|     18|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|     18|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     18|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|     18|                tname##_seq_tt,\
  222|     18|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|     18|                NULL,\
  224|     18|                sizeof(tname),\
  225|     18|                #tname \
  226|     18|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     18|                }; \
  |  |  103|     18|        return &local_it; \
  |  |  104|     18|        }
  ------------------
CMS_AuthEnvelopedData_it:
  218|      3|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|      3|        { \
  |  |   96|      3|                static const ASN1_ITEM local_it = {
  ------------------
  219|      3|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|      3|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|      3|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|      3|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|      3|                tname##_seq_tt,\
  222|      3|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|      3|                NULL,\
  224|      3|                sizeof(tname),\
  225|      3|                #tname \
  226|      3|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|      3|                }; \
  |  |  103|      3|        return &local_it; \
  |  |  104|      3|        }
  ------------------
CMS_CompressedData_it:
  218|     11|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     11|        { \
  |  |   96|     11|                static const ASN1_ITEM local_it = {
  ------------------
  219|     11|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|     11|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|     11|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     11|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|     11|                tname##_seq_tt,\
  222|     11|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|     11|                NULL,\
  224|     11|                sizeof(tname),\
  225|     11|                #tname \
  226|     11|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     11|                }; \
  |  |  103|     11|        return &local_it; \
  |  |  104|     11|        }
  ------------------
CMS_ContentInfo_it:
  270|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  271|  11.7k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  11.7k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  272|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  273|  11.7k|                tname##_seq_tt,\
  274|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  275|  11.7k|                &tname##_aux,\
  276|  11.7k|                sizeof(stname),\
  277|  11.7k|                #stname \
  278|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
CMS_ReceiptRequest_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
cms_asn1.c:CMS_OtherCertificateFormat_it:
  178|    764|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|    764|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|    764|        { \
  |  |  |  |   96|    764|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|    764|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|    764|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|    764|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|    764|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|    764|                tname##_seq_tt,\
  182|    764|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|    764|                NULL,\
  184|    764|                sizeof(stname),\
  185|    764|                #stname \
  186|    764|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|    764|                }; \
  |  |  103|    764|        return &local_it; \
  |  |  104|    764|        }
  ------------------
cms_asn1.c:CMS_SignerIdentifier_it:
  332|  7.88k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  7.88k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  7.88k|        { \
  |  |  |  |   96|  7.88k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  333|  7.88k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  7.88k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  334|  7.88k|                offsetof(stname,selname) ,\
  335|  7.88k|                tname##_ch_tt,\
  336|  7.88k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  337|  7.88k|                NULL,\
  338|  7.88k|                sizeof(stname),\
  339|  7.88k|                #stname \
  340|  7.88k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  7.88k|                }; \
  |  |  103|  7.88k|        return &local_it; \
  |  |  104|  7.88k|        }
  ------------------
cms_asn1.c:CMS_OtherRevocationInfoFormat_it:
  178|     86|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|     86|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|     86|        { \
  |  |  |  |   96|     86|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|     86|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     86|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|     86|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     86|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|     86|                tname##_seq_tt,\
  182|     86|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|     86|                NULL,\
  184|     86|                sizeof(stname),\
  185|     86|                #stname \
  186|     86|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     86|                }; \
  |  |  103|     86|        return &local_it; \
  |  |  104|     86|        }
  ------------------
cms_asn1.c:CMS_EncapsulatedContentInfo_it:
  229|  3.98k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  3.98k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  3.98k|        { \
  |  |  |  |   96|  3.98k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  230|  3.98k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  3.98k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  231|  3.98k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  3.98k|# define V_ASN1_SEQUENCE                 16
  ------------------
  232|  3.98k|                tname##_seq_tt,\
  233|  3.98k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  234|  3.98k|                NULL,\
  235|  3.98k|                sizeof(tname),\
  236|  3.98k|                #tname \
  237|  3.98k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  3.98k|                }; \
  |  |  103|  3.98k|        return &local_it; \
  |  |  104|  3.98k|        }
  ------------------
cms_asn1.c:CMS_KeyAgreeRecipientIdentifier_it:
  332|    815|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|    815|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|    815|        { \
  |  |  |  |   96|    815|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  333|    815|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|    815|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  334|    815|                offsetof(stname,selname) ,\
  335|    815|                tname##_ch_tt,\
  336|    815|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  337|    815|                NULL,\
  338|    815|                sizeof(stname),\
  339|    815|                #stname \
  340|    815|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|    815|                }; \
  |  |  103|    815|        return &local_it; \
  |  |  104|    815|        }
  ------------------
cms_asn1.c:CMS_OriginatorIdentifierOrKey_it:
  332|  8.39k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  8.39k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  8.39k|        { \
  |  |  |  |   96|  8.39k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  333|  8.39k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  8.39k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  334|  8.39k|                offsetof(stname,selname) ,\
  335|  8.39k|                tname##_ch_tt,\
  336|  8.39k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  337|  8.39k|                NULL,\
  338|  8.39k|                sizeof(stname),\
  339|  8.39k|                #stname \
  340|  8.39k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  8.39k|                }; \
  |  |  103|  8.39k|        return &local_it; \
  |  |  104|  8.39k|        }
  ------------------
cms_asn1.c:CMS_KEKIdentifier_it:
  178|    481|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|    481|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|    481|        { \
  |  |  |  |   96|    481|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|    481|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|    481|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|    481|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|    481|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|    481|                tname##_seq_tt,\
  182|    481|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|    481|                NULL,\
  184|    481|                sizeof(stname),\
  185|    481|                #stname \
  186|    481|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|    481|                }; \
  |  |  103|    481|        return &local_it; \
  |  |  104|    481|        }
  ------------------
cms_asn1.c:CMS_OtherRecipientInfo_it:
  178|  1.46k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  1.46k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  1.46k|        { \
  |  |  |  |   96|  1.46k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  1.46k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  1.46k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  1.46k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  1.46k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  1.46k|                tname##_seq_tt,\
  182|  1.46k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  1.46k|                NULL,\
  184|  1.46k|                sizeof(stname),\
  185|  1.46k|                #stname \
  186|  1.46k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  1.46k|                }; \
  |  |  103|  1.46k|        return &local_it; \
  |  |  104|  1.46k|        }
  ------------------
cms_asn1.c:CMS_OriginatorInfo_it:
  178|  1.68k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  1.68k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  1.68k|        { \
  |  |  |  |   96|  1.68k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  1.68k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  1.68k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  1.68k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  1.68k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  1.68k|                tname##_seq_tt,\
  182|  1.68k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  1.68k|                NULL,\
  184|  1.68k|                sizeof(stname),\
  185|  1.68k|                #stname \
  186|  1.68k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  1.68k|                }; \
  |  |  103|  1.68k|        return &local_it; \
  |  |  104|  1.68k|        }
  ------------------
cms_asn1.c:CMS_EncryptedContentInfo_it:
  229|     35|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|     35|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|     35|        { \
  |  |  |  |   96|     35|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  230|     35|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|     35|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  231|     35|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     35|# define V_ASN1_SEQUENCE                 16
  ------------------
  232|     35|                tname##_seq_tt,\
  233|     35|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  234|     35|                NULL,\
  235|     35|                sizeof(tname),\
  236|     35|                #tname \
  237|     35|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     35|                }; \
  |  |  103|     35|        return &local_it; \
  |  |  104|     35|        }
  ------------------
cms_asn1.c:CMS_ContentInfo_adb:
  463|  30.9k|        { \
  464|  30.9k|        static const ASN1_ADB internal_adb = \
  465|  30.9k|                {\
  466|  30.9k|                flags,\
  467|  30.9k|                offsetof(name, field),\
  468|  30.9k|                adb_cb,\
  469|  30.9k|                name##_adbtbl,\
  470|  30.9k|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|  30.9k|                def,\
  472|  30.9k|                none\
  473|  30.9k|                }; \
  474|  30.9k|                return (const ASN1_ITEM *) &internal_adb; \
  475|  30.9k|        } \
cms_asn1.c:CMS_AuthenticatedData_it:
  229|    887|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|    887|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|    887|        { \
  |  |  |  |   96|    887|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  230|    887|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|    887|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  231|    887|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|    887|# define V_ASN1_SEQUENCE                 16
  ------------------
  232|    887|                tname##_seq_tt,\
  233|    887|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  234|    887|                NULL,\
  235|    887|                sizeof(tname),\
  236|    887|                #tname \
  237|    887|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|    887|                }; \
  |  |  103|    887|        return &local_it; \
  |  |  104|    887|        }
  ------------------
cms_asn1.c:CMS_ReceiptsFrom_it:
  332|  18.5k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  18.5k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  18.5k|        { \
  |  |  |  |   96|  18.5k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  333|  18.5k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  18.5k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  334|  18.5k|                offsetof(stname,selname) ,\
  335|  18.5k|                tname##_ch_tt,\
  336|  18.5k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  337|  18.5k|                NULL,\
  338|  18.5k|                sizeof(stname),\
  339|  18.5k|                #stname \
  340|  18.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  18.5k|                }; \
  |  |  103|  18.5k|        return &local_it; \
  |  |  104|  18.5k|        }
  ------------------
DHparams_it:
  247|  23.6k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  23.6k|        { \
  |  |   96|  23.6k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  23.6k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  23.6k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  23.6k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  23.6k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  23.6k|                tname##_seq_tt,\
  251|  23.6k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  23.6k|                &tname##_aux,\
  253|  23.6k|                sizeof(stname),\
  254|  23.6k|                #tname \
  255|  23.6k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  23.6k|                }; \
  |  |  103|  23.6k|        return &local_it; \
  |  |  104|  23.6k|        }
  ------------------
d2i_DHparams:
  826|  11.8k|        { \
  827|  11.8k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.8k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.8k|        } \
i2d_DHparams:
  830|     62|        { \
  831|     62|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     62|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     62|        }
d2i_int_dhx:
  826|  14.5k|        { \
  827|  14.5k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  14.5k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  14.5k|        } \
i2d_int_dhx:
  830|     75|        { \
  831|     75|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     75|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     75|        }
dh_asn1.c:DHxparams_it:
  178|  14.5k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  14.5k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  14.5k|        { \
  |  |  |  |   96|  14.5k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  14.5k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  14.5k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  14.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  14.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  14.5k|                tname##_seq_tt,\
  182|  14.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  14.5k|                NULL,\
  184|  14.5k|                sizeof(stname),\
  185|  14.5k|                #stname \
  186|  14.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  14.5k|                }; \
  |  |  103|  14.5k|        return &local_it; \
  |  |  104|  14.5k|        }
  ------------------
dh_asn1.c:DHvparams_it:
  178|  37.4k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  37.4k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  37.4k|        { \
  |  |  |  |   96|  37.4k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  37.4k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  37.4k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  37.4k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  37.4k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  37.4k|                tname##_seq_tt,\
  182|  37.4k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  37.4k|                NULL,\
  184|  37.4k|                sizeof(stname),\
  185|  37.4k|                #stname \
  186|  37.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  37.4k|                }; \
  |  |  103|  37.4k|        return &local_it; \
  |  |  104|  37.4k|        }
  ------------------
d2i_DSAPrivateKey:
  826|  27.0k|        { \
  827|  27.0k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  27.0k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  27.0k|        } \
i2d_DSAPrivateKey:
  830|    611|        { \
  831|    611|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    611|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    611|        }
d2i_DSAparams:
  826|  12.3k|        { \
  827|  12.3k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  12.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  12.3k|        } \
i2d_DSAparams:
  830|     18|        { \
  831|     18|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     18|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     18|        }
d2i_DSAPublicKey:
  826|  15.7k|        { \
  827|  15.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  15.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  15.7k|        } \
i2d_DSAPublicKey:
  830|      4|        { \
  831|      4|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|      4|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|      4|        }
dsa_asn1.c:DSAPrivateKey_it:
  258|  27.6k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  27.6k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  27.6k|        { \
  |  |  |  |   96|  27.6k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  259|  27.6k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  27.6k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  260|  27.6k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  27.6k|# define V_ASN1_SEQUENCE                 16
  ------------------
  261|  27.6k|                tname##_seq_tt,\
  262|  27.6k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  263|  27.6k|                &tname##_aux,\
  264|  27.6k|                sizeof(stname),\
  265|  27.6k|                #stname \
  266|  27.6k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  27.6k|                }; \
  |  |  103|  27.6k|        return &local_it; \
  |  |  104|  27.6k|        }
  ------------------
dsa_asn1.c:DSAparams_it:
  258|  12.3k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  12.3k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  12.3k|        { \
  |  |  |  |   96|  12.3k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  259|  12.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  12.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  260|  12.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  12.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  261|  12.3k|                tname##_seq_tt,\
  262|  12.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  263|  12.3k|                &tname##_aux,\
  264|  12.3k|                sizeof(stname),\
  265|  12.3k|                #stname \
  266|  12.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  12.3k|                }; \
  |  |  103|  12.3k|        return &local_it; \
  |  |  104|  12.3k|        }
  ------------------
dsa_asn1.c:DSAPublicKey_it:
  258|  15.7k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  15.7k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  15.7k|        { \
  |  |  |  |   96|  15.7k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  259|  15.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  15.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  260|  15.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  15.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  261|  15.7k|                tname##_seq_tt,\
  262|  15.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  263|  15.7k|                &tname##_aux,\
  264|  15.7k|                sizeof(stname),\
  265|  15.7k|                #stname \
  266|  15.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  15.7k|                }; \
  |  |  103|  15.7k|        return &local_it; \
  |  |  104|  15.7k|        }
  ------------------
ECPARAMETERS_it:
  166|  83.0k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  83.0k|        { \
  |  |   96|  83.0k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  83.0k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  83.0k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  83.0k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  83.0k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  83.0k|                tname##_seq_tt,\
  170|  83.0k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  83.0k|                NULL,\
  172|  83.0k|                sizeof(stname),\
  173|  83.0k|                #tname \
  174|  83.0k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  83.0k|                }; \
  |  |  103|  83.0k|        return &local_it; \
  |  |  104|  83.0k|        }
  ------------------
ECPARAMETERS_new:
  812|    225|        { \
  813|    225|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|    225|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|    225|        } \
ECPKPARAMETERS_it:
  320|   154k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   154k|        { \
  |  |   96|   154k|                static const ASN1_ITEM local_it = {
  ------------------
  321|   154k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|   154k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|   154k|                offsetof(stname,selname) ,\
  323|   154k|                tname##_ch_tt,\
  324|   154k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|   154k|                NULL,\
  326|   154k|                sizeof(stname),\
  327|   154k|                #stname \
  328|   154k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   154k|                }; \
  |  |  103|   154k|        return &local_it; \
  |  |  104|   154k|        }
  ------------------
d2i_ECPKPARAMETERS:
  826|  26.9k|        { \
  827|  26.9k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  26.9k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  26.9k|        } \
i2d_ECPKPARAMETERS:
  830|    197|        { \
  831|    197|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    197|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    197|        }
ECPKPARAMETERS_new:
  812|  1.05k|        { \
  813|  1.05k|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  1.05k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|  1.05k|        } \
ECPKPARAMETERS_free:
  816|  27.1k|        { \
  817|  27.1k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  27.1k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  27.1k|        }
d2i_EC_PRIVATEKEY:
  826|  34.4k|        { \
  827|  34.4k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  34.4k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  34.4k|        } \
i2d_EC_PRIVATEKEY:
  830|    852|        { \
  831|    852|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    852|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    852|        }
EC_PRIVATEKEY_new:
  812|  1.30k|        { \
  813|  1.30k|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  1.30k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|  1.30k|        } \
EC_PRIVATEKEY_free:
  816|  3.56k|        { \
  817|  3.56k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  3.56k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  3.56k|        }
ec_asn1.c:X9_62_PENTANOMIAL_it:
  178|     23|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|     23|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|     23|        { \
  |  |  |  |   96|     23|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|     23|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     23|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|     23|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     23|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|     23|                tname##_seq_tt,\
  182|     23|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|     23|                NULL,\
  184|     23|                sizeof(stname),\
  185|     23|                #stname \
  186|     23|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     23|                }; \
  |  |  103|     23|        return &local_it; \
  |  |  104|     23|        }
  ------------------
ec_asn1.c:X9_62_CHARACTERISTIC_TWO_it:
  178|     78|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|     78|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|     78|        { \
  |  |  |  |   96|     78|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|     78|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     78|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|     78|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     78|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|     78|                tname##_seq_tt,\
  182|     78|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|     78|                NULL,\
  184|     78|                sizeof(stname),\
  185|     78|                #stname \
  186|     78|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     78|                }; \
  |  |  103|     78|        return &local_it; \
  |  |  104|     78|        }
  ------------------
ec_asn1.c:X9_62_CHARACTERISTIC_TWO_adb:
  463|     92|        { \
  464|     92|        static const ASN1_ADB internal_adb = \
  465|     92|                {\
  466|     92|                flags,\
  467|     92|                offsetof(name, field),\
  468|     92|                adb_cb,\
  469|     92|                name##_adbtbl,\
  470|     92|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|     92|                def,\
  472|     92|                none\
  473|     92|                }; \
  474|     92|                return (const ASN1_ITEM *) &internal_adb; \
  475|     92|        } \
ec_asn1.c:X9_62_FIELDID_it:
  178|   102k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|   102k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|   102k|        { \
  |  |  |  |   96|   102k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|   102k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   102k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|   102k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   102k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|   102k|                tname##_seq_tt,\
  182|   102k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|   102k|                NULL,\
  184|   102k|                sizeof(stname),\
  185|   102k|                #stname \
  186|   102k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   102k|                }; \
  |  |  103|   102k|        return &local_it; \
  |  |  104|   102k|        }
  ------------------
ec_asn1.c:X9_62_FIELDID_adb:
  463|   101k|        { \
  464|   101k|        static const ASN1_ADB internal_adb = \
  465|   101k|                {\
  466|   101k|                flags,\
  467|   101k|                offsetof(name, field),\
  468|   101k|                adb_cb,\
  469|   101k|                name##_adbtbl,\
  470|   101k|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|   101k|                def,\
  472|   101k|                none\
  473|   101k|                }; \
  474|   101k|                return (const ASN1_ITEM *) &internal_adb; \
  475|   101k|        } \
ec_asn1.c:X9_62_CURVE_it:
  178|  90.7k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  90.7k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  90.7k|        { \
  |  |  |  |   96|  90.7k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  90.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  90.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  90.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  90.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  90.7k|                tname##_seq_tt,\
  182|  90.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  90.7k|                NULL,\
  184|  90.7k|                sizeof(stname),\
  185|  90.7k|                #stname \
  186|  90.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  90.7k|                }; \
  |  |  103|  90.7k|        return &local_it; \
  |  |  104|  90.7k|        }
  ------------------
ec_asn1.c:EC_PRIVATEKEY_it:
  178|  40.2k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  40.2k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  40.2k|        { \
  |  |  |  |   96|  40.2k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  40.2k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  40.2k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  40.2k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  40.2k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  40.2k|                tname##_seq_tt,\
  182|  40.2k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  40.2k|                NULL,\
  184|  40.2k|                sizeof(stname),\
  185|  40.2k|                #stname \
  186|  40.2k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  40.2k|                }; \
  |  |  103|  40.2k|        return &local_it; \
  |  |  104|  40.2k|        }
  ------------------
d2i_ESS_ISSUER_SERIAL:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_ESS_ISSUER_SERIAL:
  830|      4|        { \
  831|      4|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|      4|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|      4|        }
ESS_ISSUER_SERIAL_free:
  816|      4|        { \
  817|      4|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|      4|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|      4|        }
d2i_ESS_CERT_ID:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_ESS_CERT_ID:
  830|     24|        { \
  831|     24|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     24|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     24|        }
ESS_CERT_ID_free:
  816|     24|        { \
  817|     24|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|     24|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|     24|        }
ESS_SIGNING_CERT_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
d2i_ESS_SIGNING_CERT:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_ESS_SIGNING_CERT:
  830|     16|        { \
  831|     16|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     16|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     16|        }
ESS_SIGNING_CERT_free:
  816|     16|        { \
  817|     16|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|     16|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|     16|        }
d2i_ESS_CERT_ID_V2:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_ESS_CERT_ID_V2:
  830|     30|        { \
  831|     30|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     30|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     30|        }
ESS_CERT_ID_V2_free:
  816|     30|        { \
  817|     30|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|     30|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|     30|        }
ESS_SIGNING_CERT_V2_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
d2i_ESS_SIGNING_CERT_V2:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_ESS_SIGNING_CERT_V2:
  830|     16|        { \
  831|     16|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     16|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     16|        }
ESS_SIGNING_CERT_V2_free:
  816|     16|        { \
  817|     16|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|     16|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|     16|        }
ess_asn1.c:ESS_ISSUER_SERIAL_it:
  178|  82.5k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  82.5k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  82.5k|        { \
  |  |  |  |   96|  82.5k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  82.5k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  82.5k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  82.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  82.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  82.5k|                tname##_seq_tt,\
  182|  82.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  82.5k|                NULL,\
  184|  82.5k|                sizeof(stname),\
  185|  82.5k|                #stname \
  186|  82.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  82.5k|                }; \
  |  |  103|  82.5k|        return &local_it; \
  |  |  104|  82.5k|        }
  ------------------
ess_asn1.c:ESS_CERT_ID_it:
  178|  28.1k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  28.1k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  28.1k|        { \
  |  |  |  |   96|  28.1k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  28.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  28.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  28.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  28.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  28.1k|                tname##_seq_tt,\
  182|  28.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  28.1k|                NULL,\
  184|  28.1k|                sizeof(stname),\
  185|  28.1k|                #stname \
  186|  28.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  28.1k|                }; \
  |  |  103|  28.1k|        return &local_it; \
  |  |  104|  28.1k|        }
  ------------------
ess_asn1.c:ESS_CERT_ID_V2_it:
  178|  28.1k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  28.1k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  28.1k|        { \
  |  |  |  |   96|  28.1k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  28.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  28.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  28.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  28.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  28.1k|                tname##_seq_tt,\
  182|  28.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  28.1k|                NULL,\
  184|  28.1k|                sizeof(stname),\
  185|  28.1k|                #stname \
  186|  28.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  28.1k|                }; \
  |  |  103|  28.1k|        return &local_it; \
  |  |  104|  28.1k|        }
  ------------------
OCSP_SIGNATURE_it:
  166|  39.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.4k|        { \
  |  |   96|  39.4k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.4k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.4k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.4k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.4k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.4k|                tname##_seq_tt,\
  170|  39.4k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.4k|                NULL,\
  172|  39.4k|                sizeof(stname),\
  173|  39.4k|                #tname \
  174|  39.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.4k|                }; \
  |  |  103|  39.4k|        return &local_it; \
  |  |  104|  39.4k|        }
  ------------------
OCSP_CERTID_it:
  166|  68.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  68.3k|        { \
  |  |   96|  68.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  68.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  68.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  68.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  68.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  68.3k|                tname##_seq_tt,\
  170|  68.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  68.3k|                NULL,\
  172|  68.3k|                sizeof(stname),\
  173|  68.3k|                #tname \
  174|  68.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  68.3k|                }; \
  |  |  103|  68.3k|        return &local_it; \
  |  |  104|  68.3k|        }
  ------------------
OCSP_ONEREQ_it:
  166|  34.8k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  34.8k|        { \
  |  |   96|  34.8k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  34.8k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  34.8k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  34.8k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  34.8k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  34.8k|                tname##_seq_tt,\
  170|  34.8k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  34.8k|                NULL,\
  172|  34.8k|                sizeof(stname),\
  173|  34.8k|                #tname \
  174|  34.8k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  34.8k|                }; \
  |  |  103|  34.8k|        return &local_it; \
  |  |  104|  34.8k|        }
  ------------------
OCSP_REQINFO_it:
  166|  39.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.3k|        { \
  |  |   96|  39.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.3k|                tname##_seq_tt,\
  170|  39.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.3k|                NULL,\
  172|  39.3k|                sizeof(stname),\
  173|  39.3k|                #tname \
  174|  39.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.3k|                }; \
  |  |  103|  39.3k|        return &local_it; \
  |  |  104|  39.3k|        }
  ------------------
OCSP_REQUEST_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
OCSP_RESPBYTES_it:
  166|  39.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.4k|        { \
  |  |   96|  39.4k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.4k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.4k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.4k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.4k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.4k|                tname##_seq_tt,\
  170|  39.4k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.4k|                NULL,\
  172|  39.4k|                sizeof(stname),\
  173|  39.4k|                #tname \
  174|  39.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.4k|                }; \
  |  |  103|  39.4k|        return &local_it; \
  |  |  104|  39.4k|        }
  ------------------
OCSP_RESPONSE_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
OCSP_RESPID_it:
  320|  59.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  59.4k|        { \
  |  |   96|  59.4k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  59.4k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  59.4k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  59.4k|                offsetof(stname,selname) ,\
  323|  59.4k|                tname##_ch_tt,\
  324|  59.4k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  59.4k|                NULL,\
  326|  59.4k|                sizeof(stname),\
  327|  59.4k|                #stname \
  328|  59.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  59.4k|                }; \
  |  |  103|  59.4k|        return &local_it; \
  |  |  104|  59.4k|        }
  ------------------
OCSP_REVOKEDINFO_it:
  166|  23.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  23.1k|        { \
  |  |   96|  23.1k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  23.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  23.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  23.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  23.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  23.1k|                tname##_seq_tt,\
  170|  23.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  23.1k|                NULL,\
  172|  23.1k|                sizeof(stname),\
  173|  23.1k|                #tname \
  174|  23.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  23.1k|                }; \
  |  |  103|  23.1k|        return &local_it; \
  |  |  104|  23.1k|        }
  ------------------
OCSP_CERTSTATUS_it:
  320|  30.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  30.1k|        { \
  |  |   96|  30.1k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  30.1k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  30.1k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  30.1k|                offsetof(stname,selname) ,\
  323|  30.1k|                tname##_ch_tt,\
  324|  30.1k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  30.1k|                NULL,\
  326|  30.1k|                sizeof(stname),\
  327|  30.1k|                #stname \
  328|  30.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  30.1k|                }; \
  |  |  103|  30.1k|        return &local_it; \
  |  |  104|  30.1k|        }
  ------------------
OCSP_SINGLERESP_it:
  166|  30.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  30.1k|        { \
  |  |   96|  30.1k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  30.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  30.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  30.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  30.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  30.1k|                tname##_seq_tt,\
  170|  30.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  30.1k|                NULL,\
  172|  30.1k|                sizeof(stname),\
  173|  30.1k|                #tname \
  174|  30.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  30.1k|                }; \
  |  |  103|  30.1k|        return &local_it; \
  |  |  104|  30.1k|        }
  ------------------
OCSP_RESPDATA_it:
  166|  39.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.3k|        { \
  |  |   96|  39.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.3k|                tname##_seq_tt,\
  170|  39.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.3k|                NULL,\
  172|  39.3k|                sizeof(stname),\
  173|  39.3k|                #tname \
  174|  39.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.3k|                }; \
  |  |  103|  39.3k|        return &local_it; \
  |  |  104|  39.3k|        }
  ------------------
OCSP_BASICRESP_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
OCSP_CRLID_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
OCSP_SERVICELOC_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS12_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS12_MAC_DATA_it:
  166|  39.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.4k|        { \
  |  |   96|  39.4k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.4k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.4k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.4k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.4k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.4k|                tname##_seq_tt,\
  170|  39.4k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.4k|                NULL,\
  172|  39.4k|                sizeof(stname),\
  173|  39.4k|                #tname \
  174|  39.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.4k|                }; \
  |  |  103|  39.4k|        return &local_it; \
  |  |  104|  39.4k|        }
  ------------------
PKCS12_BAGS_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS12_SAFEBAG_it:
  166|  43.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  43.7k|        { \
  |  |   96|  43.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  43.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  43.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  43.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  43.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  43.7k|                tname##_seq_tt,\
  170|  43.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  43.7k|                NULL,\
  172|  43.7k|                sizeof(stname),\
  173|  43.7k|                #tname \
  174|  43.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  43.7k|                }; \
  |  |  103|  43.7k|        return &local_it; \
  |  |  104|  43.7k|        }
  ------------------
PKCS12_SAFEBAGS_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS12_AUTHSAFES_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
p12_asn.c:PKCS12_BAGS_adb:
  463|  31.2k|        { \
  464|  31.2k|        static const ASN1_ADB internal_adb = \
  465|  31.2k|                {\
  466|  31.2k|                flags,\
  467|  31.2k|                offsetof(name, field),\
  468|  31.2k|                adb_cb,\
  469|  31.2k|                name##_adbtbl,\
  470|  31.2k|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|  31.2k|                def,\
  472|  31.2k|                none\
  473|  31.2k|                }; \
  474|  31.2k|                return (const ASN1_ITEM *) &internal_adb; \
  475|  31.2k|        } \
p12_asn.c:PKCS12_SAFEBAG_adb:
  463|  53.1k|        { \
  464|  53.1k|        static const ASN1_ADB internal_adb = \
  465|  53.1k|                {\
  466|  53.1k|                flags,\
  467|  53.1k|                offsetof(name, field),\
  468|  53.1k|                adb_cb,\
  469|  53.1k|                name##_adbtbl,\
  470|  53.1k|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|  53.1k|                def,\
  472|  53.1k|                none\
  473|  53.1k|                }; \
  474|  53.1k|                return (const ASN1_ITEM *) &internal_adb; \
  475|  53.1k|        } \
PKCS7_it:
  270|   142k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   142k|        { \
  |  |   96|   142k|                static const ASN1_ITEM local_it = {
  ------------------
  271|   142k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|   142k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  272|   142k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   142k|# define V_ASN1_SEQUENCE                 16
  ------------------
  273|   142k|                tname##_seq_tt,\
  274|   142k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  275|   142k|                &tname##_aux,\
  276|   142k|                sizeof(stname),\
  277|   142k|                #stname \
  278|   142k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   142k|                }; \
  |  |  103|   142k|        return &local_it; \
  |  |  104|   142k|        }
  ------------------
PKCS7_SIGNED_it:
  218|  14.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  14.5k|        { \
  |  |   96|  14.5k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  14.5k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  14.5k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  14.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  14.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  14.5k|                tname##_seq_tt,\
  222|  14.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  14.5k|                NULL,\
  224|  14.5k|                sizeof(tname),\
  225|  14.5k|                #tname \
  226|  14.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  14.5k|                }; \
  |  |  103|  14.5k|        return &local_it; \
  |  |  104|  14.5k|        }
  ------------------
PKCS7_SIGNER_INFO_it:
  247|  36.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  36.7k|        { \
  |  |   96|  36.7k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  36.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  36.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  36.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  36.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  36.7k|                tname##_seq_tt,\
  251|  36.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  36.7k|                &tname##_aux,\
  253|  36.7k|                sizeof(stname),\
  254|  36.7k|                #tname \
  255|  36.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  36.7k|                }; \
  |  |  103|  36.7k|        return &local_it; \
  |  |  104|  36.7k|        }
  ------------------
PKCS7_ISSUER_AND_SERIAL_it:
  166|  64.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  64.7k|        { \
  |  |   96|  64.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  64.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  64.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  64.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  64.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  64.7k|                tname##_seq_tt,\
  170|  64.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  64.7k|                NULL,\
  172|  64.7k|                sizeof(stname),\
  173|  64.7k|                #tname \
  174|  64.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  64.7k|                }; \
  |  |  103|  64.7k|        return &local_it; \
  |  |  104|  64.7k|        }
  ------------------
PKCS7_ENVELOPE_it:
  218|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  11.7k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  11.7k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  11.7k|                tname##_seq_tt,\
  222|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  11.7k|                NULL,\
  224|  11.7k|                sizeof(tname),\
  225|  11.7k|                #tname \
  226|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS7_RECIP_INFO_it:
  247|  31.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  31.3k|        { \
  |  |   96|  31.3k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  31.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  31.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  31.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  31.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  31.3k|                tname##_seq_tt,\
  251|  31.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  31.3k|                &tname##_aux,\
  253|  31.3k|                sizeof(stname),\
  254|  31.3k|                #tname \
  255|  31.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  31.3k|                }; \
  |  |  103|  31.3k|        return &local_it; \
  |  |  104|  31.3k|        }
  ------------------
PKCS7_ENC_CONTENT_it:
  218|  70.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  70.3k|        { \
  |  |   96|  70.3k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  70.3k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  70.3k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  70.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  70.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  70.3k|                tname##_seq_tt,\
  222|  70.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  70.3k|                NULL,\
  224|  70.3k|                sizeof(tname),\
  225|  70.3k|                #tname \
  226|  70.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  70.3k|                }; \
  |  |  103|  70.3k|        return &local_it; \
  |  |  104|  70.3k|        }
  ------------------
PKCS7_SIGN_ENVELOPE_it:
  218|  11.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.9k|        { \
  |  |   96|  11.9k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  11.9k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  11.9k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  11.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  11.9k|                tname##_seq_tt,\
  222|  11.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  11.9k|                NULL,\
  224|  11.9k|                sizeof(tname),\
  225|  11.9k|                #tname \
  226|  11.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.9k|                }; \
  |  |  103|  11.9k|        return &local_it; \
  |  |  104|  11.9k|        }
  ------------------
PKCS7_ENCRYPT_it:
  218|  11.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.9k|        { \
  |  |   96|  11.9k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  11.9k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  11.9k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  11.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  11.9k|                tname##_seq_tt,\
  222|  11.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  11.9k|                NULL,\
  224|  11.9k|                sizeof(tname),\
  225|  11.9k|                #tname \
  226|  11.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.9k|                }; \
  |  |  103|  11.9k|        return &local_it; \
  |  |  104|  11.9k|        }
  ------------------
PKCS7_DIGEST_it:
  218|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  219|  11.7k|                ASN1_ITYPE_NDEF_SEQUENCE,\
  ------------------
  |  |   86|  11.7k|# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
  ------------------
  220|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  221|  11.7k|                tname##_seq_tt,\
  222|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  223|  11.7k|                NULL,\
  224|  11.7k|                sizeof(tname),\
  225|  11.7k|                #tname \
  226|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS7_ATTR_SIGN_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
PKCS7_ATTR_VERIFY_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
pk7_asn1.c:PKCS7_adb:
  463|   147k|        { \
  464|   147k|        static const ASN1_ADB internal_adb = \
  465|   147k|                {\
  466|   147k|                flags,\
  467|   147k|                offsetof(name, field),\
  468|   147k|                adb_cb,\
  469|   147k|                name##_adbtbl,\
  470|   147k|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|   147k|                def,\
  472|   147k|                none\
  473|   147k|                }; \
  474|   147k|                return (const ASN1_ITEM *) &internal_adb; \
  475|   147k|        } \
RSA_PRIME_INFO_it:
  166|   141k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   141k|        { \
  |  |   96|   141k|                static const ASN1_ITEM local_it = {
  ------------------
  167|   141k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   141k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|   141k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   141k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|   141k|                tname##_seq_tt,\
  170|   141k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|   141k|                NULL,\
  172|   141k|                sizeof(stname),\
  173|   141k|                #tname \
  174|   141k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   141k|                }; \
  |  |  103|   141k|        return &local_it; \
  |  |  104|   141k|        }
  ------------------
RSAPrivateKey_it:
  247|  34.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  34.4k|        { \
  |  |   96|  34.4k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  34.4k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  34.4k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  34.4k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  34.4k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  34.4k|                tname##_seq_tt,\
  251|  34.4k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  34.4k|                &tname##_aux,\
  253|  34.4k|                sizeof(stname),\
  254|  34.4k|                #tname \
  255|  34.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  34.4k|                }; \
  |  |  103|  34.4k|        return &local_it; \
  |  |  104|  34.4k|        }
  ------------------
RSAPublicKey_it:
  247|  31.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  31.5k|        { \
  |  |   96|  31.5k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  31.5k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  31.5k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  31.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  31.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  31.5k|                tname##_seq_tt,\
  251|  31.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  31.5k|                &tname##_aux,\
  253|  31.5k|                sizeof(stname),\
  254|  31.5k|                #tname \
  255|  31.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  31.5k|                }; \
  |  |  103|  31.5k|        return &local_it; \
  |  |  104|  31.5k|        }
  ------------------
RSA_PSS_PARAMS_it:
  247|  69.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  69.9k|        { \
  |  |   96|  69.9k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  69.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  69.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  69.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  69.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  69.9k|                tname##_seq_tt,\
  251|  69.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  69.9k|                &tname##_aux,\
  253|  69.9k|                sizeof(stname),\
  254|  69.9k|                #tname \
  255|  69.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  69.9k|                }; \
  |  |  103|  69.9k|        return &local_it; \
  |  |  104|  69.9k|        }
  ------------------
RSA_PSS_PARAMS_free:
  816|  54.7k|        { \
  817|  54.7k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  54.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  54.7k|        }
RSA_OAEP_PARAMS_it:
  247|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  11.7k|                tname##_seq_tt,\
  251|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  11.7k|                &tname##_aux,\
  253|  11.7k|                sizeof(stname),\
  254|  11.7k|                #tname \
  255|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
d2i_RSAPrivateKey:
  826|  22.3k|        { \
  827|  22.3k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  22.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  22.3k|        } \
i2d_RSAPrivateKey:
  830|    391|        { \
  831|    391|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    391|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    391|        }
d2i_RSAPublicKey:
  826|  19.7k|        { \
  827|  19.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  19.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  19.7k|        } \
i2d_RSAPublicKey:
  830|     46|        { \
  831|     46|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     46|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     46|        }
d2i_TS_MSG_IMPRINT:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_TS_MSG_IMPRINT:
  830|      6|        { \
  831|      6|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|      6|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|      6|        }
TS_MSG_IMPRINT_free:
  816|      6|        { \
  817|      6|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|      6|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|      6|        }
d2i_TS_REQ:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_TS_REQ:
  830|    698|        { \
  831|    698|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    698|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    698|        }
TS_REQ_free:
  816|    698|        { \
  817|    698|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|    698|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|    698|        }
d2i_TS_ACCURACY:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_TS_ACCURACY:
  830|    284|        { \
  831|    284|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    284|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    284|        }
TS_ACCURACY_free:
  816|    284|        { \
  817|    284|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|    284|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|    284|        }
d2i_TS_TST_INFO:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_TS_TST_INFO:
  830|     16|        { \
  831|     16|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|     16|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|     16|        }
TS_TST_INFO_free:
  816|  9.25k|        { \
  817|  9.25k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  9.25k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  9.25k|        }
d2i_TS_STATUS_INFO:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_TS_STATUS_INFO:
  830|    453|        { \
  831|    453|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    453|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    453|        }
TS_STATUS_INFO_free:
  816|    453|        { \
  817|    453|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|    453|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|    453|        }
d2i_TS_RESP:
  826|  11.7k|        { \
  827|  11.7k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  11.7k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  11.7k|        } \
i2d_TS_RESP:
  830|    106|        { \
  831|    106|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    106|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    106|        }
TS_RESP_free:
  816|    106|        { \
  817|    106|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|    106|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|    106|        }
ts_asn1.c:TS_MSG_IMPRINT_it:
  178|  53.9k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  53.9k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  53.9k|        { \
  |  |  |  |   96|  53.9k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  53.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  53.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  53.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  53.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  53.9k|                tname##_seq_tt,\
  182|  53.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  53.9k|                NULL,\
  184|  53.9k|                sizeof(stname),\
  185|  53.9k|                #stname \
  186|  53.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  53.9k|                }; \
  |  |  103|  53.9k|        return &local_it; \
  |  |  104|  53.9k|        }
  ------------------
ts_asn1.c:TS_REQ_it:
  178|  13.1k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  13.1k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  13.1k|        { \
  |  |  |  |   96|  13.1k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  13.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  13.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  13.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  13.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  13.1k|                tname##_seq_tt,\
  182|  13.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  13.1k|                NULL,\
  184|  13.1k|                sizeof(stname),\
  185|  13.1k|                #stname \
  186|  13.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  13.1k|                }; \
  |  |  103|  13.1k|        return &local_it; \
  |  |  104|  13.1k|        }
  ------------------
ts_asn1.c:TS_ACCURACY_it:
  178|  40.0k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  40.0k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  40.0k|        { \
  |  |  |  |   96|  40.0k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  40.0k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  40.0k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  40.0k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  40.0k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  40.0k|                tname##_seq_tt,\
  182|  40.0k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  40.0k|                NULL,\
  184|  40.0k|                sizeof(stname),\
  185|  40.0k|                #stname \
  186|  40.0k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  40.0k|                }; \
  |  |  103|  40.0k|        return &local_it; \
  |  |  104|  40.0k|        }
  ------------------
ts_asn1.c:TS_TST_INFO_it:
  178|  20.9k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  20.9k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  20.9k|        { \
  |  |  |  |   96|  20.9k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  20.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  20.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  20.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  20.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  20.9k|                tname##_seq_tt,\
  182|  20.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  20.9k|                NULL,\
  184|  20.9k|                sizeof(stname),\
  185|  20.9k|                #stname \
  186|  20.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  20.9k|                }; \
  |  |  103|  20.9k|        return &local_it; \
  |  |  104|  20.9k|        }
  ------------------
ts_asn1.c:TS_STATUS_INFO_it:
  178|  40.6k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  40.6k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  40.6k|        { \
  |  |  |  |   96|  40.6k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|  40.6k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  40.6k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|  40.6k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  40.6k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|  40.6k|                tname##_seq_tt,\
  182|  40.6k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|  40.6k|                NULL,\
  184|  40.6k|                sizeof(stname),\
  185|  40.6k|                #stname \
  186|  40.6k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  40.6k|                }; \
  |  |  103|  40.6k|        return &local_it; \
  |  |  104|  40.6k|        }
  ------------------
ts_asn1.c:TS_RESP_it:
  258|  11.9k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  11.9k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  11.9k|        { \
  |  |  |  |   96|  11.9k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  259|  11.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  260|  11.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  261|  11.9k|                tname##_seq_tt,\
  262|  11.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  263|  11.9k|                &tname##_aux,\
  264|  11.9k|                sizeof(stname),\
  265|  11.9k|                #stname \
  266|  11.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.9k|                }; \
  |  |  103|  11.9k|        return &local_it; \
  |  |  104|  11.9k|        }
  ------------------
IPAddressRange_it:
  166|  43.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  43.9k|        { \
  |  |   96|  43.9k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  43.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  43.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  43.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  43.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  43.9k|                tname##_seq_tt,\
  170|  43.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  43.9k|                NULL,\
  172|  43.9k|                sizeof(stname),\
  173|  43.9k|                #tname \
  174|  43.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  43.9k|                }; \
  |  |  103|  43.9k|        return &local_it; \
  |  |  104|  43.9k|        }
  ------------------
IPAddressOrRange_it:
  320|  32.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  32.5k|        { \
  |  |   96|  32.5k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  32.5k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  32.5k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  32.5k|                offsetof(stname,selname) ,\
  323|  32.5k|                tname##_ch_tt,\
  324|  32.5k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  32.5k|                NULL,\
  326|  32.5k|                sizeof(stname),\
  327|  32.5k|                #stname \
  328|  32.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  32.5k|                }; \
  |  |  103|  32.5k|        return &local_it; \
  |  |  104|  32.5k|        }
  ------------------
IPAddressChoice_it:
  320|  30.2k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  30.2k|        { \
  |  |   96|  30.2k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  30.2k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  30.2k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  30.2k|                offsetof(stname,selname) ,\
  323|  30.2k|                tname##_ch_tt,\
  324|  30.2k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  30.2k|                NULL,\
  326|  30.2k|                sizeof(stname),\
  327|  30.2k|                #stname \
  328|  30.2k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  30.2k|                }; \
  |  |  103|  30.2k|        return &local_it; \
  |  |  104|  30.2k|        }
  ------------------
IPAddressFamily_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
AUTHORITY_KEYID_it:
  166|   134k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   134k|        { \
  |  |   96|   134k|                static const ASN1_ITEM local_it = {
  ------------------
  167|   134k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   134k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|   134k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   134k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|   134k|                tname##_seq_tt,\
  170|   134k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|   134k|                NULL,\
  172|   134k|                sizeof(stname),\
  173|   134k|                #tname \
  174|   134k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   134k|                }; \
  |  |  103|   134k|        return &local_it; \
  |  |  104|   134k|        }
  ------------------
AUTHORITY_KEYID_free:
  816|   118k|        { \
  817|   118k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|   118k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|   118k|        }
ASRange_it:
  166|  44.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  44.1k|        { \
  |  |   96|  44.1k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  44.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  44.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  44.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  44.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  44.1k|                tname##_seq_tt,\
  170|  44.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  44.1k|                NULL,\
  172|  44.1k|                sizeof(stname),\
  173|  44.1k|                #tname \
  174|  44.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  44.1k|                }; \
  |  |  103|  44.1k|        return &local_it; \
  |  |  104|  44.1k|        }
  ------------------
ASIdOrRange_it:
  320|  48.8k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  48.8k|        { \
  |  |   96|  48.8k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  48.8k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  48.8k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  48.8k|                offsetof(stname,selname) ,\
  323|  48.8k|                tname##_ch_tt,\
  324|  48.8k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  48.8k|                NULL,\
  326|  48.8k|                sizeof(stname),\
  327|  48.8k|                #stname \
  328|  48.8k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  48.8k|                }; \
  |  |  103|  48.8k|        return &local_it; \
  |  |  104|  48.8k|        }
  ------------------
ASIdentifierChoice_it:
  320|  76.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  76.4k|        { \
  |  |   96|  76.4k|                static const ASN1_ITEM local_it = {
  ------------------
  321|  76.4k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|  76.4k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|  76.4k|                offsetof(stname,selname) ,\
  323|  76.4k|                tname##_ch_tt,\
  324|  76.4k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|  76.4k|                NULL,\
  326|  76.4k|                sizeof(stname),\
  327|  76.4k|                #stname \
  328|  76.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  76.4k|                }; \
  |  |  103|  76.4k|        return &local_it; \
  |  |  104|  76.4k|        }
  ------------------
ASIdentifiers_it:
  166|  97.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  97.1k|        { \
  |  |   96|  97.1k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  97.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  97.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  97.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  97.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  97.1k|                tname##_seq_tt,\
  170|  97.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  97.1k|                NULL,\
  172|  97.1k|                sizeof(stname),\
  173|  97.1k|                #tname \
  174|  97.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  97.1k|                }; \
  |  |  103|  97.1k|        return &local_it; \
  |  |  104|  97.1k|        }
  ------------------
ASIdentifiers_free:
  816|  85.3k|        { \
  817|  85.3k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  85.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  85.3k|        }
BASIC_CONSTRAINTS_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
CERTIFICATEPOLICIES_it:
  113|  12.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  12.5k|        { \
  |  |   96|  12.5k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  12.5k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  12.5k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  12.5k|                -1,\
  116|  12.5k|                &tname##_item_tt,\
  117|  12.5k|                0,\
  118|  12.5k|                NULL,\
  119|  12.5k|                0,\
  120|  12.5k|                #tname \
  121|  12.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  12.5k|                }; \
  |  |  103|  12.5k|        return &local_it; \
  |  |  104|  12.5k|        }
  ------------------
POLICYINFO_it:
  166|  69.8k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  69.8k|        { \
  |  |   96|  69.8k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  69.8k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  69.8k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  69.8k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  69.8k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  69.8k|                tname##_seq_tt,\
  170|  69.8k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  69.8k|                NULL,\
  172|  69.8k|                sizeof(stname),\
  173|  69.8k|                #tname \
  174|  69.8k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  69.8k|                }; \
  |  |  103|  69.8k|        return &local_it; \
  |  |  104|  69.8k|        }
  ------------------
POLICYQUALINFO_it:
  166|  33.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  33.7k|        { \
  |  |   96|  33.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  33.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  33.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  33.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  33.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  33.7k|                tname##_seq_tt,\
  170|  33.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  33.7k|                NULL,\
  172|  33.7k|                sizeof(stname),\
  173|  33.7k|                #tname \
  174|  33.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  33.7k|                }; \
  |  |  103|  33.7k|        return &local_it; \
  |  |  104|  33.7k|        }
  ------------------
USERNOTICE_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
NOTICEREF_it:
  166|  55.8k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  55.8k|        { \
  |  |   96|  55.8k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  55.8k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  55.8k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  55.8k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  55.8k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  55.8k|                tname##_seq_tt,\
  170|  55.8k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  55.8k|                NULL,\
  172|  55.8k|                sizeof(stname),\
  173|  55.8k|                #tname \
  174|  55.8k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  55.8k|                }; \
  |  |  103|  55.8k|        return &local_it; \
  |  |  104|  55.8k|        }
  ------------------
v3_cpols.c:POLICYQUALINFO_adb:
  463|  34.4k|        { \
  464|  34.4k|        static const ASN1_ADB internal_adb = \
  465|  34.4k|                {\
  466|  34.4k|                flags,\
  467|  34.4k|                offsetof(name, field),\
  468|  34.4k|                adb_cb,\
  469|  34.4k|                name##_adbtbl,\
  470|  34.4k|                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
  471|  34.4k|                def,\
  472|  34.4k|                none\
  473|  34.4k|                }; \
  474|  34.4k|                return (const ASN1_ITEM *) &internal_adb; \
  475|  34.4k|        } \
DIST_POINT_NAME_it:
  344|   171k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   171k|        { \
  |  |   96|   171k|                static const ASN1_ITEM local_it = {
  ------------------
  345|   171k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|   171k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  346|   171k|                offsetof(stname,selname) ,\
  347|   171k|                tname##_ch_tt,\
  348|   171k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  349|   171k|                &tname##_aux,\
  350|   171k|                sizeof(stname),\
  351|   171k|                #stname \
  352|   171k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   171k|                }; \
  |  |  103|   171k|        return &local_it; \
  |  |  104|   171k|        }
  ------------------
DIST_POINT_it:
  166|  50.2k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  50.2k|        { \
  |  |   96|  50.2k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  50.2k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  50.2k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  50.2k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  50.2k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  50.2k|                tname##_seq_tt,\
  170|  50.2k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  50.2k|                NULL,\
  172|  50.2k|                sizeof(stname),\
  173|  50.2k|                #tname \
  174|  50.2k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  50.2k|                }; \
  |  |  103|  50.2k|        return &local_it; \
  |  |  104|  50.2k|        }
  ------------------
CRL_DIST_POINTS_it:
  113|  99.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  99.1k|        { \
  |  |   96|  99.1k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  99.1k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  99.1k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  99.1k|                -1,\
  116|  99.1k|                &tname##_item_tt,\
  117|  99.1k|                0,\
  118|  99.1k|                NULL,\
  119|  99.1k|                0,\
  120|  99.1k|                #tname \
  121|  99.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  99.1k|                }; \
  |  |  103|  99.1k|        return &local_it; \
  |  |  104|  99.1k|        }
  ------------------
CRL_DIST_POINTS_free:
  816|  85.3k|        { \
  817|  85.3k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  85.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  85.3k|        }
ISSUING_DIST_POINT_it:
  166|  62.4k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  62.4k|        { \
  |  |   96|  62.4k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  62.4k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  62.4k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  62.4k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  62.4k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  62.4k|                tname##_seq_tt,\
  170|  62.4k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  62.4k|                NULL,\
  172|  62.4k|                sizeof(stname),\
  173|  62.4k|                #tname \
  174|  62.4k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  62.4k|                }; \
  |  |  103|  62.4k|        return &local_it; \
  |  |  104|  62.4k|        }
  ------------------
ISSUING_DIST_POINT_free:
  816|  33.3k|        { \
  817|  33.3k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  33.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  33.3k|        }
EXTENDED_KEY_USAGE_it:
  113|  12.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  12.5k|        { \
  |  |   96|  12.5k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  12.5k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  12.5k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  12.5k|                -1,\
  116|  12.5k|                &tname##_item_tt,\
  117|  12.5k|                0,\
  118|  12.5k|                NULL,\
  119|  12.5k|                0,\
  120|  12.5k|                #tname \
  121|  12.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  12.5k|                }; \
  |  |  103|  12.5k|        return &local_it; \
  |  |  104|  12.5k|        }
  ------------------
OTHERNAME_it:
  166|  68.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  68.5k|        { \
  |  |   96|  68.5k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  68.5k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  68.5k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  68.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  68.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  68.5k|                tname##_seq_tt,\
  170|  68.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  68.5k|                NULL,\
  172|  68.5k|                sizeof(stname),\
  173|  68.5k|                #tname \
  174|  68.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  68.5k|                }; \
  |  |  103|  68.5k|        return &local_it; \
  |  |  104|  68.5k|        }
  ------------------
EDIPARTYNAME_it:
  166|  53.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  53.9k|        { \
  |  |   96|  53.9k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  53.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  53.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  53.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  53.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  53.9k|                tname##_seq_tt,\
  170|  53.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  53.9k|                NULL,\
  172|  53.9k|                sizeof(stname),\
  173|  53.9k|                #tname \
  174|  53.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  53.9k|                }; \
  |  |  103|  53.9k|        return &local_it; \
  |  |  104|  53.9k|        }
  ------------------
GENERAL_NAME_it:
  320|   283k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   283k|        { \
  |  |   96|   283k|                static const ASN1_ITEM local_it = {
  ------------------
  321|   283k|                ASN1_ITYPE_CHOICE,\
  ------------------
  |  |   82|   283k|# define ASN1_ITYPE_CHOICE               0x2
  ------------------
  322|   283k|                offsetof(stname,selname) ,\
  323|   283k|                tname##_ch_tt,\
  324|   283k|                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
  325|   283k|                NULL,\
  326|   283k|                sizeof(stname),\
  327|   283k|                #stname \
  328|   283k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   283k|                }; \
  |  |  103|   283k|        return &local_it; \
  |  |  104|   283k|        }
  ------------------
GENERAL_NAMES_it:
  113|   113k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   113k|        { \
  |  |   96|   113k|                static const ASN1_ITEM local_it = {
  ------------------
  114|   113k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|   113k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|   113k|                -1,\
  116|   113k|                &tname##_item_tt,\
  117|   113k|                0,\
  118|   113k|                NULL,\
  119|   113k|                0,\
  120|   113k|                #tname \
  121|   113k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   113k|                }; \
  |  |  103|   113k|        return &local_it; \
  |  |  104|   113k|        }
  ------------------
GENERAL_NAMES_free:
  816|  85.4k|        { \
  817|  85.4k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  85.4k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  85.4k|        }
ACCESS_DESCRIPTION_it:
  166|  39.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.9k|        { \
  |  |   96|  39.9k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  39.9k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.9k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  39.9k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.9k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  39.9k|                tname##_seq_tt,\
  170|  39.9k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  39.9k|                NULL,\
  172|  39.9k|                sizeof(stname),\
  173|  39.9k|                #tname \
  174|  39.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.9k|                }; \
  |  |  103|  39.9k|        return &local_it; \
  |  |  104|  39.9k|        }
  ------------------
AUTHORITY_INFO_ACCESS_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
GENERAL_SUBTREE_it:
  166|  35.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  35.7k|        { \
  |  |   96|  35.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  35.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  35.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  35.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  35.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  35.7k|                tname##_seq_tt,\
  170|  35.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  35.7k|                NULL,\
  172|  35.7k|                sizeof(stname),\
  173|  35.7k|                #tname \
  174|  35.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  35.7k|                }; \
  |  |  103|  35.7k|        return &local_it; \
  |  |  104|  35.7k|        }
  ------------------
NAME_CONSTRAINTS_it:
  166|  98.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  98.5k|        { \
  |  |   96|  98.5k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  98.5k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  98.5k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  98.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  98.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  98.5k|                tname##_seq_tt,\
  170|  98.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  98.5k|                NULL,\
  172|  98.5k|                sizeof(stname),\
  173|  98.5k|                #tname \
  174|  98.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  98.5k|                }; \
  |  |  103|  98.5k|        return &local_it; \
  |  |  104|  98.5k|        }
  ------------------
NAME_CONSTRAINTS_free:
  816|  85.3k|        { \
  817|  85.3k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  85.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  85.3k|        }
PROXY_POLICY_it:
  166|  38.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  38.3k|        { \
  |  |   96|  38.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  38.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  38.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  38.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  38.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  38.3k|                tname##_seq_tt,\
  170|  38.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  38.3k|                NULL,\
  172|  38.3k|                sizeof(stname),\
  173|  38.3k|                #tname \
  174|  38.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  38.3k|                }; \
  |  |  103|  38.3k|        return &local_it; \
  |  |  104|  38.3k|        }
  ------------------
PROXY_CERT_INFO_EXTENSION_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
POLICY_CONSTRAINTS_it:
  166|  12.6k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  12.6k|        { \
  |  |   96|  12.6k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  12.6k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  12.6k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  12.6k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  12.6k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  12.6k|                tname##_seq_tt,\
  170|  12.6k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  12.6k|                NULL,\
  172|  12.6k|                sizeof(stname),\
  173|  12.6k|                #tname \
  174|  12.6k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  12.6k|                }; \
  |  |  103|  12.6k|        return &local_it; \
  |  |  104|  12.6k|        }
  ------------------
PKEY_USAGE_PERIOD_it:
  166|  12.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  12.1k|        { \
  |  |   96|  12.1k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  12.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  12.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  12.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  12.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  12.1k|                tname##_seq_tt,\
  170|  12.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  12.1k|                NULL,\
  172|  12.1k|                sizeof(stname),\
  173|  12.1k|                #tname \
  174|  12.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  12.1k|                }; \
  |  |  103|  12.1k|        return &local_it; \
  |  |  104|  12.1k|        }
  ------------------
POLICY_MAPPING_it:
  166|  31.5k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  31.5k|        { \
  |  |   96|  31.5k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  31.5k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  31.5k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  31.5k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  31.5k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  31.5k|                tname##_seq_tt,\
  170|  31.5k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  31.5k|                NULL,\
  172|  31.5k|                sizeof(stname),\
  173|  31.5k|                #tname \
  174|  31.5k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  31.5k|                }; \
  |  |  103|  31.5k|        return &local_it; \
  |  |  104|  31.5k|        }
  ------------------
POLICY_MAPPINGS_it:
  113|  11.9k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.9k|        { \
  |  |   96|  11.9k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.9k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.9k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.9k|                -1,\
  116|  11.9k|                &tname##_item_tt,\
  117|  11.9k|                0,\
  118|  11.9k|                NULL,\
  119|  11.9k|                0,\
  120|  11.9k|                #tname \
  121|  11.9k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.9k|                }; \
  |  |  103|  11.9k|        return &local_it; \
  |  |  104|  11.9k|        }
  ------------------
SXNETID_it:
  166|  24.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  24.3k|        { \
  |  |   96|  24.3k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  24.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  24.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  24.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  24.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  24.3k|                tname##_seq_tt,\
  170|  24.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  24.3k|                NULL,\
  172|  24.3k|                sizeof(stname),\
  173|  24.3k|                #tname \
  174|  24.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  24.3k|                }; \
  |  |  103|  24.3k|        return &local_it; \
  |  |  104|  24.3k|        }
  ------------------
SXNET_it:
  166|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  11.7k|                tname##_seq_tt,\
  170|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  11.7k|                NULL,\
  172|  11.7k|                sizeof(stname),\
  173|  11.7k|                #tname \
  174|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
X509_ATTRIBUTE_it:
  166|   158k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   158k|        { \
  |  |   96|   158k|                static const ASN1_ITEM local_it = {
  ------------------
  167|   158k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   158k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|   158k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   158k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|   158k|                tname##_seq_tt,\
  170|   158k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|   158k|                NULL,\
  172|   158k|                sizeof(stname),\
  173|   158k|                #tname \
  174|   158k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   158k|                }; \
  |  |  103|   158k|        return &local_it; \
  |  |  104|   158k|        }
  ------------------
X509_REVOKED_it:
  166|  43.8k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  43.8k|        { \
  |  |   96|  43.8k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  43.8k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  43.8k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  43.8k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  43.8k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  43.8k|                tname##_seq_tt,\
  170|  43.8k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  43.8k|                NULL,\
  172|  43.8k|                sizeof(stname),\
  173|  43.8k|                #tname \
  174|  43.8k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  43.8k|                }; \
  |  |  103|  43.8k|        return &local_it; \
  |  |  104|  43.8k|        }
  ------------------
X509_CRL_INFO_it:
  247|  85.0k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  85.0k|        { \
  |  |   96|  85.0k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  85.0k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  85.0k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  85.0k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  85.0k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  85.0k|                tname##_seq_tt,\
  251|  85.0k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  85.0k|                &tname##_aux,\
  253|  85.0k|                sizeof(stname),\
  254|  85.0k|                #tname \
  255|  85.0k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  85.0k|                }; \
  |  |  103|  85.0k|        return &local_it; \
  |  |  104|  85.0k|        }
  ------------------
X509_CRL_it:
  247|  53.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  53.7k|        { \
  |  |   96|  53.7k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  53.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  53.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  53.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  53.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  53.7k|                tname##_seq_tt,\
  251|  53.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  53.7k|                &tname##_aux,\
  253|  53.7k|                sizeof(stname),\
  254|  53.7k|                #tname \
  255|  53.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  53.7k|                }; \
  |  |  103|  53.7k|        return &local_it; \
  |  |  104|  53.7k|        }
  ------------------
X509_EXTENSION_it:
  166|   313k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   313k|        { \
  |  |   96|   313k|                static const ASN1_ITEM local_it = {
  ------------------
  167|   313k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   313k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|   313k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   313k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|   313k|                tname##_seq_tt,\
  170|   313k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|   313k|                NULL,\
  172|   313k|                sizeof(stname),\
  173|   313k|                #tname \
  174|   313k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   313k|                }; \
  |  |  103|   313k|        return &local_it; \
  |  |  104|   313k|        }
  ------------------
X509_EXTENSIONS_it:
  113|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  114|  11.7k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  11.7k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  115|  11.7k|                -1,\
  116|  11.7k|                &tname##_item_tt,\
  117|  11.7k|                0,\
  118|  11.7k|                NULL,\
  119|  11.7k|                0,\
  120|  11.7k|                #tname \
  121|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
X509_NAME_ENTRY_it:
  166|  2.44M|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  2.44M|        { \
  |  |   96|  2.44M|                static const ASN1_ITEM local_it = {
  ------------------
  167|  2.44M|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  2.44M|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  2.44M|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  2.44M|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  2.44M|                tname##_seq_tt,\
  170|  2.44M|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  2.44M|                NULL,\
  172|  2.44M|                sizeof(stname),\
  173|  2.44M|                #tname \
  174|  2.44M|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  2.44M|                }; \
  |  |  103|  2.44M|        return &local_it; \
  |  |  104|  2.44M|        }
  ------------------
X509_NAME_ENTRY_new:
  812|   356k|        { \
  813|   356k|                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|   356k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  814|   356k|        } \
X509_NAME_ENTRY_free:
  816|   600k|        { \
  817|   600k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|   600k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|   600k|        }
X509_NAME_ENTRY_dup:
  855|  2.37k|        { \
  856|  2.37k|        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
  ------------------
  |  |  426|  2.37k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  857|  2.37k|        }
X509_NAME_it:
  775|   543k|        ASN1_ITEM_start(sname) \
  ------------------
  |  |   95|   543k|        { \
  |  |   96|   543k|                static const ASN1_ITEM local_it = {
  ------------------
  776|   543k|                ASN1_ITYPE_EXTERN, \
  ------------------
  |  |   84|   543k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  777|   543k|                tag, \
  778|   543k|                NULL, \
  779|   543k|                0, \
  780|   543k|                &fptrs, \
  781|   543k|                0, \
  782|   543k|                #sname \
  783|   543k|        ASN1_ITEM_end(sname)
  ------------------
  |  |  102|   543k|                }; \
  |  |  103|   543k|        return &local_it; \
  |  |  104|   543k|        }
  ------------------
i2d_X509_NAME:
  830|    354|        { \
  831|    354|                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|    354|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  832|    354|        }
X509_NAME_free:
  816|  20.8k|        { \
  817|  20.8k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  20.8k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  20.8k|        }
X509_NAME_dup:
  855|    597|        { \
  856|    597|        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
  ------------------
  |  |  426|    597|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  857|    597|        }
x_name.c:X509_NAME_INTERNAL_it:
  124|   122k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|   122k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|   122k|        { \
  |  |  |  |   96|   122k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  125|   122k|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|   122k|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  126|   122k|                -1,\
  127|   122k|                &tname##_item_tt,\
  128|   122k|                0,\
  129|   122k|                NULL,\
  130|   122k|                0,\
  131|   122k|                #tname \
  132|   122k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   122k|                }; \
  |  |  103|   122k|        return &local_it; \
  |  |  104|   122k|        }
  ------------------
x_name.c:X509_NAME_ENTRIES_it:
  124|  2.38M|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|  2.38M|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|  2.38M|        { \
  |  |  |  |   96|  2.38M|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  125|  2.38M|                ASN1_ITYPE_PRIMITIVE,\
  ------------------
  |  |   80|  2.38M|# define ASN1_ITYPE_PRIMITIVE            0x0
  ------------------
  126|  2.38M|                -1,\
  127|  2.38M|                &tname##_item_tt,\
  128|  2.38M|                0,\
  129|  2.38M|                NULL,\
  130|  2.38M|                0,\
  131|  2.38M|                #tname \
  132|  2.38M|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  2.38M|                }; \
  |  |  103|  2.38M|        return &local_it; \
  |  |  104|  2.38M|        }
  ------------------
X509_PUBKEY_it:
  775|   329k|        ASN1_ITEM_start(sname) \
  ------------------
  |  |   95|   329k|        { \
  |  |   96|   329k|                static const ASN1_ITEM local_it = {
  ------------------
  776|   329k|                ASN1_ITYPE_EXTERN, \
  ------------------
  |  |   84|   329k|# define ASN1_ITYPE_EXTERN               0x4
  ------------------
  777|   329k|                tag, \
  778|   329k|                NULL, \
  779|   329k|                0, \
  780|   329k|                &fptrs, \
  781|   329k|                0, \
  782|   329k|                #sname \
  783|   329k|        ASN1_ITEM_end(sname)
  ------------------
  |  |  102|   329k|                }; \
  |  |  103|   329k|        return &local_it; \
  |  |  104|   329k|        }
  ------------------
d2i_X509_PUBKEY:
  826|  32.4k|        { \
  827|  32.4k|                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
  ------------------
  |  |  426|  32.4k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  828|  32.4k|        } \
X509_PUBKEY_free:
  816|  62.9k|        { \
  817|  62.9k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  62.9k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  62.9k|        }
x_pubkey.c:X509_PUBKEY_INTERNAL_it:
  178|   204k|        static_ASN1_ITEM_start(tname) \
  ------------------
  |  |   99|   204k|        static ASN1_ITEM_start(itname)
  |  |  ------------------
  |  |  |  |   95|   204k|        { \
  |  |  |  |   96|   204k|                static const ASN1_ITEM local_it = {
  |  |  ------------------
  ------------------
  179|   204k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   204k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  180|   204k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   204k|# define V_ASN1_SEQUENCE                 16
  ------------------
  181|   204k|                tname##_seq_tt,\
  182|   204k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  183|   204k|                NULL,\
  184|   204k|                sizeof(stname),\
  185|   204k|                #stname \
  186|   204k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   204k|                }; \
  |  |  103|   204k|        return &local_it; \
  |  |  104|   204k|        }
  ------------------
X509_REQ_INFO_it:
  247|  39.3k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  39.3k|        { \
  |  |   96|  39.3k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  39.3k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  39.3k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  39.3k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  39.3k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  39.3k|                tname##_seq_tt,\
  251|  39.3k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  39.3k|                &tname##_aux,\
  253|  39.3k|                sizeof(stname),\
  254|  39.3k|                #tname \
  255|  39.3k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  39.3k|                }; \
  |  |  103|  39.3k|        return &local_it; \
  |  |  104|  39.3k|        }
  ------------------
X509_REQ_it:
  247|  11.7k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  11.7k|        { \
  |  |   96|  11.7k|                static const ASN1_ITEM local_it = {
  ------------------
  248|  11.7k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  11.7k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|  11.7k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  11.7k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|  11.7k|                tname##_seq_tt,\
  251|  11.7k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|  11.7k|                &tname##_aux,\
  253|  11.7k|                sizeof(stname),\
  254|  11.7k|                #tname \
  255|  11.7k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  11.7k|                }; \
  |  |  103|  11.7k|        return &local_it; \
  |  |  104|  11.7k|        }
  ------------------
X509_CINF_it:
  247|   140k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   140k|        { \
  |  |   96|   140k|                static const ASN1_ITEM local_it = {
  ------------------
  248|   140k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   140k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|   140k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   140k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|   140k|                tname##_seq_tt,\
  251|   140k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|   140k|                &tname##_aux,\
  253|   140k|                sizeof(stname),\
  254|   140k|                #tname \
  255|   140k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   140k|                }; \
  |  |  103|   140k|        return &local_it; \
  |  |  104|   140k|        }
  ------------------
X509_it:
  247|   170k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|   170k|        { \
  |  |   96|   170k|                static const ASN1_ITEM local_it = {
  ------------------
  248|   170k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|   170k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  249|   170k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|   170k|# define V_ASN1_SEQUENCE                 16
  ------------------
  250|   170k|                tname##_seq_tt,\
  251|   170k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  252|   170k|                &tname##_aux,\
  253|   170k|                sizeof(stname),\
  254|   170k|                #tname \
  255|   170k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|   170k|                }; \
  |  |  103|   170k|        return &local_it; \
  |  |  104|   170k|        }
  ------------------
X509_free:
  816|  11.8k|        { \
  817|  11.8k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  11.8k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  11.8k|        }
X509_CERT_AUX_it:
  166|  97.1k|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|  97.1k|        { \
  |  |   96|  97.1k|                static const ASN1_ITEM local_it = {
  ------------------
  167|  97.1k|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|  97.1k|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|  97.1k|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|  97.1k|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|  97.1k|                tname##_seq_tt,\
  170|  97.1k|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|  97.1k|                NULL,\
  172|  97.1k|                sizeof(stname),\
  173|  97.1k|                #tname \
  174|  97.1k|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|  97.1k|                }; \
  |  |  103|  97.1k|        return &local_it; \
  |  |  104|  97.1k|        }
  ------------------
X509_CERT_AUX_free:
  816|  85.3k|        { \
  817|  85.3k|                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
  ------------------
  |  |  426|  85.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  ------------------
  818|  85.3k|        }
NAMING_AUTHORITY_it:
  166|     31|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     31|        { \
  |  |   96|     31|                static const ASN1_ITEM local_it = {
  ------------------
  167|     31|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     31|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|     31|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     31|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|     31|                tname##_seq_tt,\
  170|     31|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|     31|                NULL,\
  172|     31|                sizeof(stname),\
  173|     31|                #tname \
  174|     31|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     31|                }; \
  |  |  103|     31|        return &local_it; \
  |  |  104|     31|        }
  ------------------
PROFESSION_INFO_it:
  166|     11|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     11|        { \
  |  |   96|     11|                static const ASN1_ITEM local_it = {
  ------------------
  167|     11|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     11|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|     11|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     11|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|     11|                tname##_seq_tt,\
  170|     11|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|     11|                NULL,\
  172|     11|                sizeof(stname),\
  173|     11|                #tname \
  174|     11|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     11|                }; \
  |  |  103|     11|        return &local_it; \
  |  |  104|     11|        }
  ------------------
ADMISSIONS_it:
  166|     23|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     23|        { \
  |  |   96|     23|                static const ASN1_ITEM local_it = {
  ------------------
  167|     23|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     23|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|     23|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     23|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|     23|                tname##_seq_tt,\
  170|     23|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|     23|                NULL,\
  172|     23|                sizeof(stname),\
  173|     23|                #tname \
  174|     23|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     23|                }; \
  |  |  103|     23|        return &local_it; \
  |  |  104|     23|        }
  ------------------
ADMISSION_SYNTAX_it:
  166|     12|        ASN1_ITEM_start(tname) \
  ------------------
  |  |   95|     12|        { \
  |  |   96|     12|                static const ASN1_ITEM local_it = {
  ------------------
  167|     12|                ASN1_ITYPE_SEQUENCE,\
  ------------------
  |  |   81|     12|# define ASN1_ITYPE_SEQUENCE             0x1
  ------------------
  168|     12|                V_ASN1_SEQUENCE,\
  ------------------
  |  |   74|     12|# define V_ASN1_SEQUENCE                 16
  ------------------
  169|     12|                tname##_seq_tt,\
  170|     12|                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  171|     12|                NULL,\
  172|     12|                sizeof(stname),\
  173|     12|                #tname \
  174|     12|        ASN1_ITEM_end(tname)
  ------------------
  |  |  102|     12|                }; \
  |  |  103|     12|        return &local_it; \
  |  |  104|     12|        }
  ------------------

decoder_meth.c:OSSL_FUNC_decoder_newctx:
   51|     40|    {                                                                   \
   52|     40|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     40|    }
decoder_meth.c:OSSL_FUNC_decoder_freectx:
   51|     40|    {                                                                   \
   52|     40|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     40|    }
decoder_meth.c:OSSL_FUNC_decoder_set_ctx_params:
   51|     37|    {                                                                   \
   52|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     37|    }
decoder_meth.c:OSSL_FUNC_decoder_settable_ctx_params:
   51|     37|    {                                                                   \
   52|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     37|    }
decoder_meth.c:OSSL_FUNC_decoder_does_selection:
   51|     37|    {                                                                   \
   52|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     37|    }
decoder_meth.c:OSSL_FUNC_decoder_decode:
   51|     40|    {                                                                   \
   52|     40|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     40|    }
decoder_meth.c:OSSL_FUNC_decoder_export_object:
   51|     37|    {                                                                   \
   52|     37|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     37|    }
encoder_meth.c:OSSL_FUNC_encoder_newctx:
   51|    115|    {                                                                   \
   52|    115|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    115|    }
encoder_meth.c:OSSL_FUNC_encoder_freectx:
   51|    115|    {                                                                   \
   52|    115|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    115|    }
encoder_meth.c:OSSL_FUNC_encoder_set_ctx_params:
   51|    100|    {                                                                   \
   52|    100|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    100|    }
encoder_meth.c:OSSL_FUNC_encoder_settable_ctx_params:
   51|    100|    {                                                                   \
   52|    100|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    100|    }
encoder_meth.c:OSSL_FUNC_encoder_does_selection:
   51|    104|    {                                                                   \
   52|    104|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    104|    }
encoder_meth.c:OSSL_FUNC_encoder_encode:
   51|    115|    {                                                                   \
   52|    115|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    115|    }
encoder_meth.c:OSSL_FUNC_encoder_import_object:
   51|    115|    {                                                                   \
   52|    115|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    115|    }
encoder_meth.c:OSSL_FUNC_encoder_free_object:
   51|    115|    {                                                                   \
   52|    115|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|    115|    }
digest.c:OSSL_FUNC_digest_newctx:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_init:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_update:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_final:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_freectx:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_dupctx:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_get_params:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_set_ctx_params:
   51|      7|    {                                                                   \
   52|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      7|    }
digest.c:OSSL_FUNC_digest_gettable_params:
   51|     27|    {                                                                   \
   52|     27|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     27|    }
digest.c:OSSL_FUNC_digest_settable_ctx_params:
   51|      7|    {                                                                   \
   52|      7|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      7|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_new:
   51|     18|    {                                                                   \
   52|     18|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     18|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_init:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_set_template:
   51|      5|    {                                                                   \
   52|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      5|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_set_params:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_settable_params:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gen_cleanup:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_free:
   51|     18|    {                                                                   \
   52|     18|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     18|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_load:
   51|     11|    {                                                                   \
   52|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     11|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_get_params:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_gettable_params:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_set_params:
   51|     12|    {                                                                   \
   52|     12|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     12|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_settable_params:
   51|     12|    {                                                                   \
   52|     12|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     12|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_query_operation_name:
   51|      4|    {                                                                   \
   52|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      4|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_has:
   51|     18|    {                                                                   \
   52|     18|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     18|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_dup:
   51|     11|    {                                                                   \
   52|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     11|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_validate:
   51|     11|    {                                                                   \
   52|     11|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     11|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_match:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_import:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_import_types:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_export:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
keymgmt_meth.c:OSSL_FUNC_keymgmt_export_types:
   51|     15|    {                                                                   \
   52|     15|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|     15|    }
provider_core.c:OSSL_FUNC_provider_teardown:
   51|      3|    {                                                                   \
   52|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      3|    }
provider_core.c:OSSL_FUNC_provider_gettable_params:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_core.c:OSSL_FUNC_provider_get_params:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_core.c:OSSL_FUNC_provider_get_capabilities:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_core.c:OSSL_FUNC_provider_query_operation:
   51|      3|    {                                                                   \
   52|      3|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      3|    }
defltprov.c:OSSL_FUNC_core_gettable_params:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
defltprov.c:OSSL_FUNC_core_get_params:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
defltprov.c:OSSL_FUNC_core_get_libctx:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_new_file:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_new_membuf:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_read_ex:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_write_ex:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_gets:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_puts:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_ctrl:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_up_ref:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_free:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
bio_prov.c:OSSL_FUNC_BIO_vprintf:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_seeding.c:OSSL_FUNC_get_entropy:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_seeding.c:OSSL_FUNC_cleanup_entropy:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_seeding.c:OSSL_FUNC_get_nonce:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
provider_seeding.c:OSSL_FUNC_cleanup_nonce:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
evp_rand.c:OSSL_FUNC_rand_newctx:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_freectx:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_instantiate:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_uninstantiate:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_generate:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_reseed:
   51|      5|    {                                                                   \
   52|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      5|    }
evp_rand.c:OSSL_FUNC_rand_nonce:
   51|      1|    {                                                                   \
   52|      1|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      1|    }
evp_rand.c:OSSL_FUNC_rand_enable_locking:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_lock:
   51|      5|    {                                                                   \
   52|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      5|    }
evp_rand.c:OSSL_FUNC_rand_unlock:
   51|      5|    {                                                                   \
   52|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      5|    }
evp_rand.c:OSSL_FUNC_rand_gettable_ctx_params:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_settable_ctx_params:
   51|      4|    {                                                                   \
   52|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      4|    }
evp_rand.c:OSSL_FUNC_rand_get_ctx_params:
   51|      6|    {                                                                   \
   52|      6|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      6|    }
evp_rand.c:OSSL_FUNC_rand_set_ctx_params:
   51|      4|    {                                                                   \
   52|      4|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      4|    }
evp_rand.c:OSSL_FUNC_rand_verify_zeroization:
   51|      5|    {                                                                   \
   52|      5|        return (OSSL_FUNC_##name##_fn *)opf->function;                  \
   53|      5|    }

conf_mod.c:ERR_GET_REASON:
  256|      2|{
  257|      2|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|      2|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|      2|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|      2|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|      2|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|      2|}
ecp_oct.c:ERR_GET_LIB:
  242|  1.60k|{
  243|  1.60k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  1.60k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  1.60k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 1.60k]
  |  |  ------------------
  ------------------
  244|      0|        return ERR_LIB_SYS;
  ------------------
  |  |   72|      0|# define ERR_LIB_SYS             2
  ------------------
  245|  1.60k|    return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  226|  1.60k|# define ERR_LIB_OFFSET                 23L
  ------------------
                  return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  227|  1.60k|# define ERR_LIB_MASK                   0xFF
  ------------------
  246|  1.60k|}
ecp_oct.c:ERR_GET_REASON:
  256|  1.60k|{
  257|  1.60k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  1.60k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  1.60k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 1.60k]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|  1.60k|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|  1.60k|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|  1.60k|}
err.c:ERR_GET_LIB:
  242|  9.55k|{
  243|  9.55k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  9.55k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  9.55k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 9.55k]
  |  |  ------------------
  ------------------
  244|      0|        return ERR_LIB_SYS;
  ------------------
  |  |   72|      0|# define ERR_LIB_SYS             2
  ------------------
  245|  9.55k|    return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  226|  9.55k|# define ERR_LIB_OFFSET                 23L
  ------------------
                  return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  227|  9.55k|# define ERR_LIB_MASK                   0xFF
  ------------------
  246|  9.55k|}
err.c:ERR_GET_REASON:
  256|     70|{
  257|     70|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|     70|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|     70|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 70]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|     70|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|     70|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|     70|}
a_d2i_fp.c:ERR_GET_REASON:
  256|  4.07M|{
  257|  4.07M|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  4.07M|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  4.07M|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 4.07M]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|  4.07M|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|  4.07M|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|  4.07M|}
ec2_oct.c:ERR_GET_LIB:
  242|  1.76k|{
  243|  1.76k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  1.76k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  1.76k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 1.76k]
  |  |  ------------------
  ------------------
  244|      0|        return ERR_LIB_SYS;
  ------------------
  |  |   72|      0|# define ERR_LIB_SYS             2
  ------------------
  245|  1.76k|    return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  226|  1.76k|# define ERR_LIB_OFFSET                 23L
  ------------------
                  return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  227|  1.76k|# define ERR_LIB_MASK                   0xFF
  ------------------
  246|  1.76k|}
ec2_oct.c:ERR_GET_REASON:
  256|  1.76k|{
  257|  1.76k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  1.76k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  1.76k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 1.76k]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|  1.76k|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|  1.76k|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|  1.76k|}
conf_def.c:ERR_GET_REASON:
  256|      2|{
  257|      2|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|      2|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|      2|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|      2|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|      2|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|      2|}

decoder_pkey.c:lh_DECODER_CACHE_ENTRY_new:
  210|      4|    { \
  211|      4|        return (LHASH_OF(type) *) \
  212|      4|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  213|      4|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_doall:
  261|      4|    { \
  262|      4|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  263|      4|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_free:
  216|      2|    { \
  217|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      2|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_flush:
  221|      2|    { \
  222|      2|        OPENSSL_LH_flush((OPENSSL_LHASH *)lh); \
  223|      2|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_retrieve:
  236|  45.7k|    { \
  237|  45.7k|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  238|  45.7k|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_insert:
  226|    268|    { \
  227|    268|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  228|    268|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_error:
  241|    268|    { \
  242|    268|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  243|    268|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_type:
  162|  9.48k|    { \
  163|  9.48k|        return (OPENSSL_LHASH *)lh; \
  164|  9.48k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_hashfunc_type:
  172|      2|    { \
  173|      2|        return (OPENSSL_LH_HASHFUNC)hfn; \
  174|      2|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_compfunc_type:
  167|      2|    { \
  168|      2|        return (OPENSSL_LH_COMPFUNC)cmp; \
  169|      2|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_plain_type:
  147|  9.34k|    { \
  148|  9.34k|        return ptr; \
  149|  9.34k|    } \
err.c:ossl_check_const_ERR_STRING_DATA_lh_plain_type:
  152|    140|    { \
  153|    140|        return ptr; \
  154|    140|    } \
core_namemap.c:lh_NAMENUM_ENTRY_num_items:
  246|  18.1k|    { \
  247|  18.1k|        return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \
  248|  18.1k|    } \
core_namemap.c:lh_NAMENUM_ENTRY_doall_DOALL_NAMES_DATA:
  289|  18.1k|    { \
  290|  18.1k|        OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, \
  291|  18.1k|                             (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \
  292|  18.1k|    } \
core_namemap.c:lh_NAMENUM_ENTRY_retrieve:
  236|   218k|    { \
  237|   218k|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  238|   218k|    } \
core_namemap.c:lh_NAMENUM_ENTRY_insert:
  226|    310|    { \
  227|    310|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  228|    310|    } \
core_namemap.c:lh_NAMENUM_ENTRY_error:
  241|    310|    { \
  242|    310|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  243|    310|    } \
core_namemap.c:lh_NAMENUM_ENTRY_new:
  210|      4|    { \
  211|      4|        return (LHASH_OF(type) *) \
  212|      4|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  213|      4|    } \
core_namemap.c:lh_NAMENUM_ENTRY_doall:
  261|      2|    { \
  262|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  263|      2|    } \
core_namemap.c:lh_NAMENUM_ENTRY_free:
  216|      2|    { \
  217|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      2|    } \
o_names.c:lh_OBJ_NAME_new:
  210|      2|    { \
  211|      2|        return (LHASH_OF(type) *) \
  212|      2|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  213|      2|    } \
o_names.c:lh_OBJ_NAME_retrieve:
  236|    388|    { \
  237|    388|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  238|    388|    } \
o_names.c:lh_OBJ_NAME_insert:
  226|    848|    { \
  227|    848|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  228|    848|    } \
o_names.c:lh_OBJ_NAME_error:
  241|    484|    { \
  242|    484|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  243|    484|    } \
o_names.c:lh_OBJ_NAME_delete:
  231|    484|    { \
  232|    484|        return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \
  233|    484|    } \
o_names.c:lh_OBJ_NAME_doall_OBJ_DOALL:
  289|      2|    { \
  290|      2|        OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, \
  291|      2|                             (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \
  292|      2|    } \
o_names.c:lh_OBJ_NAME_get_down_load:
  251|      8|    { \
  252|      8|        return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \
  253|      8|    } \
o_names.c:lh_OBJ_NAME_set_down_load:
  256|     14|    { \
  257|     14|        OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \
  258|     14|    } \
o_names.c:lh_OBJ_NAME_doall:
  261|      8|    { \
  262|      8|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  263|      8|    } \
o_names.c:lh_OBJ_NAME_free:
  216|      2|    { \
  217|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_doall:
  261|      2|    { \
  262|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  263|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_free:
  216|      2|    { \
  217|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_new:
  210|      4|    { \
  211|      4|        return (LHASH_OF(type) *) \
  212|      4|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  213|      4|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_retrieve:
  236|    263|    { \
  237|    263|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  238|    263|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_insert:
  226|     57|    { \
  227|     57|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  228|     57|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_error:
  241|     57|    { \
  242|     57|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  243|     57|    } \
property.c:lh_QUERY_doall:
  261|    206|    { \
  262|    206|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  263|    206|    } \
property.c:lh_QUERY_free:
  216|     74|    { \
  217|     74|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|     74|    } \
property.c:lh_QUERY_new:
  210|     74|    { \
  211|     74|        return (LHASH_OF(type) *) \
  212|     74|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  213|     74|    } \
property.c:lh_QUERY_num_items:
  246|    132|    { \
  247|    132|        return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \
  248|    132|    } \
property.c:lh_QUERY_flush:
  221|    132|    { \
  222|    132|        OPENSSL_LH_flush((OPENSSL_LHASH *)lh); \
  223|    132|    } \
property.c:lh_QUERY_retrieve:
  236|  7.34k|    { \
  237|  7.34k|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  238|  7.34k|    } \
property.c:lh_QUERY_insert:
  226|      5|    { \
  227|      5|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  228|      5|    } \
property.c:lh_QUERY_error:
  241|      5|    { \
  242|      5|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  243|      5|    } \
property_string.c:lh_PROPERTY_STRING_doall:
  261|      4|    { \
  262|      4|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  263|      4|    } \
property_string.c:lh_PROPERTY_STRING_free:
  216|      4|    { \
  217|      4|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      4|    } \
property_string.c:lh_PROPERTY_STRING_new:
  210|      8|    { \
  211|      8|        return (LHASH_OF(type) *) \
  212|      8|            OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
  213|      8|    } \
property_string.c:lh_PROPERTY_STRING_retrieve:
  236|  71.6k|    { \
  237|  71.6k|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  238|  71.6k|    } \
property_string.c:lh_PROPERTY_STRING_insert:
  226|     53|    { \
  227|     53|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  228|     53|    } \
property_string.c:lh_PROPERTY_STRING_error:
  241|     53|    { \
  242|     53|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  243|     53|    } \
store_register.c:lh_OSSL_STORE_LOADER_free:
  216|      2|    { \
  217|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      2|    } \

OBJ_bsearch_ssl_cipher_id:
  143|    644|      { \
  144|    644|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  145|    644|                                        nm##_cmp_BSEARCH_CMP_FN); \
  146|    644|      } \
ssl_lib.c:ssl_cipher_id_cmp_BSEARCH_CMP_FN:
  137|  2.53k|      { \
  138|  2.53k|      type1 const *a = a_; \
  139|  2.53k|      type2 const *b = b_; \
  140|  2.53k|      return nm##_cmp(a,b); \
  141|  2.53k|      } \
ameth_lib.c:OBJ_bsearch_ameth:
  129|  65.7k|      { \
  130|  65.7k|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  131|  65.7k|                                        nm##_cmp_BSEARCH_CMP_FN); \
  132|  65.7k|      } \
ameth_lib.c:ameth_cmp_BSEARCH_CMP_FN:
  123|   160k|      { \
  124|   160k|      type1 const *a = a_; \
  125|   160k|      type2 const *b = b_; \
  126|   160k|      return nm##_cmp(a,b); \
  127|   160k|      } \
obj_dat.c:OBJ_bsearch_obj:
  129|  2.89M|      { \
  130|  2.89M|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  131|  2.89M|                                        nm##_cmp_BSEARCH_CMP_FN); \
  132|  2.89M|      } \
obj_dat.c:obj_cmp_BSEARCH_CMP_FN:
  123|  29.2M|      { \
  124|  29.2M|      type1 const *a = a_; \
  125|  29.2M|      type2 const *b = b_; \
  126|  29.2M|      return nm##_cmp(a,b); \
  127|  29.2M|      } \
v3_lib.c:OBJ_bsearch_ext:
  129|  24.6k|      { \
  130|  24.6k|      return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
  131|  24.6k|                                        nm##_cmp_BSEARCH_CMP_FN); \
  132|  24.6k|      } \
v3_lib.c:ext_cmp_BSEARCH_CMP_FN:
  123|   123k|      { \
  124|   123k|      type1 const *a = a_; \
  125|   123k|      type2 const *b = b_; \
  126|   123k|      return nm##_cmp(a,b); \
  127|   123k|      } \

ssl_ciph.c:ossl_check_SSL_COMP_compfunc_type:
   52|      2|    { \
   53|      2|        return (OPENSSL_sk_compfunc)cmp; \
   54|      2|    } \
ssl_ciph.c:ossl_check_SSL_COMP_sk_type:
   48|      4|    { \
   49|      4|        return (OPENSSL_STACK *)sk; \
   50|      4|    } \
ssl_ciph.c:ossl_check_SSL_COMP_type:
   40|      2|    { \
   41|      2|        return ptr; \
   42|      2|    } \
ssl_ciph.c:ossl_check_SSL_COMP_freefunc_type:
   60|      2|    { \
   61|      2|        return (OPENSSL_sk_freefunc)fr; \
   62|      2|    }
d2i_pr.c:ossl_check_const_ASN1_TYPE_sk_type:
   44|  29.9k|    { \
   45|  29.9k|        return (const OPENSSL_STACK *)sk; \
   46|  29.9k|    } \
d2i_pr.c:ossl_check_ASN1_TYPE_sk_type:
   48|  10.2k|    { \
   49|  10.2k|        return (OPENSSL_STACK *)sk; \
   50|  10.2k|    } \
d2i_pr.c:ossl_check_ASN1_TYPE_freefunc_type:
   60|  10.2k|    { \
   61|  10.2k|        return (OPENSSL_sk_freefunc)fr; \
   62|  10.2k|    }
tasn_dec.c:ossl_check_const_ASN1_VALUE_sk_type:
   44|  14.6k|    { \
   45|  14.6k|        return (const OPENSSL_STACK *)sk; \
   46|  14.6k|    } \
tasn_dec.c:ossl_check_ASN1_VALUE_sk_type:
   48|  5.17M|    { \
   49|  5.17M|        return (OPENSSL_STACK *)sk; \
   50|  5.17M|    } \
tasn_dec.c:ossl_check_ASN1_VALUE_type:
   40|  5.17M|    { \
   41|  5.17M|        return ptr; \
   42|  5.17M|    } \
tasn_enc.c:sk_const_ASN1_VALUE_num:
   70|  7.28M|    { \
   71|  7.28M|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  7.28M|    } \
tasn_enc.c:sk_const_ASN1_VALUE_value:
   74|  6.18M|    { \
   75|  6.18M|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  6.18M|    } \
tasn_enc.c:sk_const_ASN1_VALUE_set:
  135|    183|    { \
  136|    183|        return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \
  137|    183|    } \
tasn_fre.c:ossl_check_const_ASN1_VALUE_sk_type:
   44|  5.36M|    { \
   45|  5.36M|        return (const OPENSSL_STACK *)sk; \
   46|  5.36M|    } \
tasn_fre.c:ossl_check_ASN1_VALUE_sk_type:
   48|  1.38M|    { \
   49|  1.38M|        return (OPENSSL_STACK *)sk; \
   50|  1.38M|    } \
tasn_prn.c:sk_const_ASN1_VALUE_num:
   70|   356k|    { \
   71|   356k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|   356k|    } \
tasn_prn.c:sk_const_ASN1_VALUE_value:
   74|   337k|    { \
   75|   337k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|   337k|    } \
conf_mod.c:sk_CONF_MODULE_num:
   70|      4|    { \
   71|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      4|    } \
conf_mod.c:sk_CONF_MODULE_free:
   94|      2|    { \
   95|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      2|    } \
conf_mod.c:sk_CONF_IMODULE_num:
   70|      2|    { \
   71|      2|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      2|    } \
conf_mod.c:sk_CONF_IMODULE_free:
   94|      4|    { \
   95|      4|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      4|    } \
decoder_lib.c:sk_OSSL_DECODER_INSTANCE_new_null:
   82|     27|    { \
   83|     27|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|     27|    } \
decoder_lib.c:sk_OSSL_DECODER_INSTANCE_push:
  111|    168|    { \
  112|    168|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|    168|    } \
decoder_lib.c:sk_OSSL_DECODER_new_null:
   82|     27|    { \
   83|     27|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|     27|    } \
decoder_lib.c:sk_OSSL_DECODER_push:
  111|  1.08k|    { \
  112|  1.08k|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|  1.08k|    } \
decoder_lib.c:sk_OSSL_DECODER_num:
   70|     27|    { \
   71|     27|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|     27|    } \
decoder_lib.c:sk_OSSL_DECODER_INSTANCE_num:
   70|  88.4k|    { \
   71|  88.4k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  88.4k|    } \
decoder_lib.c:sk_OSSL_DECODER_INSTANCE_value:
   74|   495k|    { \
   75|   495k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|   495k|    } \
decoder_lib.c:sk_OSSL_DECODER_value:
   74|  13.4k|    { \
   75|  13.4k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  13.4k|    } \
decoder_lib.c:sk_OSSL_DECODER_pop_free:
  127|     27|    { \
  128|     27|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|     27|    } \
decoder_meth.c:sk_OSSL_DECODER_INSTANCE_pop_free:
  127|  45.7k|    { \
  128|  45.7k|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|  45.7k|    } \
decoder_pkey.c:sk_EVP_KEYMGMT_new_null:
   82|    268|    { \
   83|    268|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|    268|    } \
decoder_pkey.c:sk_EVP_KEYMGMT_push:
  111|     46|    { \
  112|     46|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|     46|    } \
decoder_pkey.c:sk_EVP_KEYMGMT_num:
   70|  20.4k|    { \
   71|  20.4k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  20.4k|    } \
decoder_pkey.c:sk_EVP_KEYMGMT_value:
   74|  17.8k|    { \
   75|  17.8k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  17.8k|    } \
decoder_pkey.c:sk_EVP_KEYMGMT_pop_free:
  127|  44.4k|    { \
  128|  44.4k|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|  44.4k|    } \
decoder_pkey.c:sk_OSSL_DECODER_INSTANCE_deep_copy:
  165|  44.1k|    { \
  166|  44.1k|        return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \
  167|  44.1k|                                            (OPENSSL_sk_copyfunc)copyfunc, \
  168|  44.1k|                                            (OPENSSL_sk_freefunc)freefunc); \
  169|  44.1k|    } \
decoder_pkey.c:sk_EVP_KEYMGMT_deep_copy:
  165|  44.1k|    { \
  166|  44.1k|        return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \
  167|  44.1k|                                            (OPENSSL_sk_copyfunc)copyfunc, \
  168|  44.1k|                                            (OPENSSL_sk_freefunc)freefunc); \
  169|  44.1k|    } \
encoder_lib.c:sk_OSSL_ENCODER_INSTANCE_new_null:
   82|  3.08k|    { \
   83|  3.08k|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|  3.08k|    } \
encoder_lib.c:sk_OSSL_ENCODER_INSTANCE_push:
  111|  34.7k|    { \
  112|  34.7k|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|  34.7k|    } \
encoder_lib.c:sk_OSSL_ENCODER_INSTANCE_num:
   70|  10.7k|    { \
   71|  10.7k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  10.7k|    } \
encoder_lib.c:sk_OSSL_ENCODER_INSTANCE_value:
   74|  34.7k|    { \
   75|  34.7k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  34.7k|    } \
encoder_meth.c:sk_OSSL_ENCODER_INSTANCE_value:
   74|  34.7k|    { \
   75|  34.7k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  34.7k|    } \
encoder_meth.c:sk_OSSL_ENCODER_INSTANCE_pop_free:
  127|  3.19k|    { \
  128|  3.19k|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|  3.19k|    } \
encoder_pkey.c:ossl_check_OPENSSL_CSTRING_type:
   40|  21.9k|    { \
   41|  21.9k|        return ptr; \
   42|  21.9k|    } \
encoder_pkey.c:ossl_check_OPENSSL_CSTRING_sk_type:
   48|  25.0k|    { \
   49|  25.0k|        return (OPENSSL_STACK *)sk; \
   50|  25.0k|    } \
encoder_pkey.c:ossl_check_const_OPENSSL_CSTRING_sk_type:
   44|   380k|    { \
   45|   380k|        return (const OPENSSL_STACK *)sk; \
   46|   380k|    } \
keymgmt_lib.c:sk_OP_CACHE_ELEM_pop_free:
  127|  54.8k|    { \
  128|  54.8k|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|  54.8k|    } \
p_lib.c:ossl_check_X509_ATTRIBUTE_sk_type:
   48|  54.8k|    { \
   49|  54.8k|        return (OPENSSL_STACK *)sk; \
   50|  54.8k|    } \
p_lib.c:ossl_check_X509_ATTRIBUTE_freefunc_type:
   60|  54.8k|    { \
   61|  54.8k|        return (OPENSSL_sk_freefunc)fr; \
   62|  54.8k|    }
ex_data.c:sk_EX_CALLBACK_pop_free:
  127|     36|    { \
  128|     36|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|     36|    } \
ex_data.c:sk_EX_CALLBACK_num:
   70|  18.2M|    { \
   71|  18.2M|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  18.2M|    } \
ex_data.c:ossl_check_void_sk_type:
   48|  9.12M|    { \
   49|  9.12M|        return (OPENSSL_STACK *)sk; \
   50|  9.12M|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_new_null:
   82|      2|    { \
   83|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_free:
   94|      2|    { \
   95|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_push:
  111|      2|    { \
  112|      2|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_num:
   70|      5|    { \
   71|      5|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      5|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_value:
   74|      2|    { \
   75|      2|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_delete:
  102|      2|    { \
  103|      2|        return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \
  104|      2|    } \
param_build_set.c:sk_BIGNUM_const_num:
   70|  1.08k|    { \
   71|  1.08k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  1.08k|    } \
provider_conf.c:sk_OSSL_PROVIDER_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
provider_core.c:sk_INFOPAIR_pop_free:
  127|      3|    { \
  128|      3|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      3|    } \
provider_core.c:sk_OSSL_PROVIDER_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_new:
   78|      4|    { \
   79|      4|        return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
   80|      4|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_new_null:
   82|      4|    { \
   83|      4|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|      4|    } \
provider_core.c:sk_OSSL_PROVIDER_sort:
  151|      2|    { \
  152|      2|        OPENSSL_sk_sort((OPENSSL_STACK *)sk); \
  153|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_find:
  139|      4|    { \
  140|      4|        return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \
  141|      4|    } \
provider_core.c:sk_OSSL_PROVIDER_value:
   74|  40.4k|    { \
   75|  40.4k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  40.4k|    } \
provider_core.c:sk_INFOPAIR_deep_copy:
  165|      3|    { \
  166|      3|        return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \
  167|      3|                                            (OPENSSL_sk_copyfunc)copyfunc, \
  168|      3|                                            (OPENSSL_sk_freefunc)freefunc); \
  169|      3|    } \
provider_core.c:sk_OSSL_PROVIDER_push:
  111|      3|    { \
  112|      3|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|      3|    } \
provider_core.c:sk_OSSL_PROVIDER_dup:
  159|  6.74k|    { \
  160|  6.74k|        return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
  161|  6.74k|    } \
provider_core.c:sk_OSSL_PROVIDER_num:
   70|  6.74k|    { \
   71|  6.74k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  6.74k|    } \
provider_core.c:sk_OSSL_PROVIDER_free:
   94|  6.74k|    { \
   95|  6.74k|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|  6.74k|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_num:
   70|      5|    { \
   71|      5|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      5|    } \
o_names.c:sk_NAME_FUNCS_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
obj_xref.c:sk_nid_triple_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
obj_xref.c:sk_nid_triple_free:
   94|      2|    { \
   95|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      2|    } \
property.c:sk_IMPLEMENTATION_pop_free:
  127|     74|    { \
  128|     74|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|     74|    } \
property.c:sk_IMPLEMENTATION_new_null:
   82|     74|    { \
   83|     74|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|     74|    } \
property.c:sk_IMPLEMENTATION_num:
   70|  84.8k|    { \
   71|  84.8k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  84.8k|    } \
property.c:sk_IMPLEMENTATION_value:
   74|   735k|    { \
   75|   735k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|   735k|    } \
property.c:sk_IMPLEMENTATION_push:
  111|    206|    { \
  112|    206|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|    206|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_new:
   78|    217|    { \
   79|    217|        return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
   80|    217|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_push:
  111|    811|    { \
  112|    811|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|    811|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_num:
   70|    217|    { \
   71|    217|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|    217|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_sort:
  151|    217|    { \
  152|    217|        OPENSSL_sk_sort((OPENSSL_STACK *)sk); \
  153|    217|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_value:
   74|    811|    { \
   75|    811|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|    811|    } \
property_parse.c:sk_OSSL_PROPERTY_DEFINITION_pop_free:
  127|    217|    { \
  128|    217|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|    217|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_sk_type:
   48|     57|    { \
   49|     57|        return (OPENSSL_STACK *)sk; \
   50|     57|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_type:
   40|     53|    { \
   41|     53|        return ptr; \
   42|     53|    } \
property_string.c:ossl_check_const_OPENSSL_CSTRING_sk_type:
   44|  63.3k|    { \
   45|  63.3k|        return (const OPENSSL_STACK *)sk; \
   46|  63.3k|    } \
rsa_ameth.c:sk_RSA_PRIME_INFO_num:
   70|  1.02k|    { \
   71|  1.02k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  1.02k|    } \
rsa_ameth.c:sk_RSA_PRIME_INFO_value:
   74|    967|    { \
   75|    967|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|    967|    } \
rsa_backend.c:sk_BIGNUM_const_new_null:
   82|  11.9k|    { \
   83|  11.9k|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|  11.9k|    } \
rsa_backend.c:sk_BIGNUM_const_num:
   70|  1.08k|    { \
   71|  1.08k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  1.08k|    } \
rsa_backend.c:sk_BIGNUM_const_free:
   94|  11.9k|    { \
   95|  11.9k|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|  11.9k|    } \
rsa_lib.c:sk_RSA_PRIME_INFO_pop_free:
  127|  51.2k|    { \
  128|  51.2k|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|  51.2k|    } \
rsa_lib.c:sk_RSA_PRIME_INFO_num:
   70|  1.00k|    { \
   71|  1.00k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  1.00k|    } \
rsa_lib.c:sk_RSA_PRIME_INFO_value:
   74|  28.7k|    { \
   75|  28.7k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  28.7k|    } \
rsa_lib.c:sk_BIGNUM_const_push:
  111|  89.9k|    { \
  112|  89.9k|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|  89.9k|    } \
rsa_mp.c:sk_RSA_PRIME_INFO_num:
   70|    616|    { \
   71|    616|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|    616|    } \
rsa_mp.c:sk_RSA_PRIME_INFO_value:
   74|  21.7k|    { \
   75|  21.7k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  21.7k|    } \
rsa_ossl.c:sk_RSA_PRIME_INFO_num:
   70|  84.1k|    { \
   71|  84.1k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  84.1k|    } \
rsa_ossl.c:sk_RSA_PRIME_INFO_value:
   74|  32.9k|    { \
   75|  32.9k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  32.9k|    } \
ts_rsp_print.c:ossl_check_const_ASN1_UTF8STRING_sk_type:
   44|  5.46k|    { \
   45|  5.46k|        return (const OPENSSL_STACK *)sk; \
   46|  5.46k|    } \
ts_rsp_print.c:ossl_check_CONF_VALUE_sk_type:
   48|      8|    { \
   49|      8|        return (OPENSSL_STACK *)sk; \
   50|      8|    } \
ts_rsp_print.c:ossl_check_CONF_VALUE_freefunc_type:
   60|      8|    { \
   61|      8|        return (OPENSSL_sk_freefunc)fr; \
   62|      8|    }
t_x509.c:ossl_check_X509_sk_type:
   48|    434|    { \
   49|    434|        return (OPENSSL_STACK *)sk; \
   50|    434|    } \
t_x509.c:ossl_check_X509_freefunc_type:
   60|    434|    { \
   61|    434|        return (OPENSSL_sk_freefunc)fr; \
   62|    434|    }
v3_cpols.c:ossl_check_const_POLICYINFO_sk_type:
   44|    385|    { \
   45|    385|        return (const OPENSSL_STACK *)sk; \
   46|    385|    } \
v3_crld.c:ossl_check_const_GENERAL_NAME_sk_type:
   44|  1.90k|    { \
   45|  1.90k|        return (const OPENSSL_STACK *)sk; \
   46|  1.90k|    } \
v3_crld.c:ossl_check_const_DIST_POINT_sk_type:
   44|  1.71k|    { \
   45|  1.71k|        return (const OPENSSL_STACK *)sk; \
   46|  1.71k|    } \
v3_crld.c:ossl_check_const_X509_NAME_ENTRY_sk_type:
   44|  5.10k|    { \
   45|  5.10k|        return (const OPENSSL_STACK *)sk; \
   46|  5.10k|    } \
v3_extku.c:ossl_check_const_ASN1_OBJECT_sk_type:
   44|    556|    { \
   45|    556|        return (const OPENSSL_STACK *)sk; \
   46|    556|    } \
v3_lib.c:ossl_check_const_X509_EXTENSION_sk_type:
   44|  78.1k|    { \
   45|  78.1k|        return (const OPENSSL_STACK *)sk; \
   46|  78.1k|    } \
v3_ncons.c:ossl_check_const_GENERAL_SUBTREE_sk_type:
   44|  4.19k|    { \
   45|  4.19k|        return (const OPENSSL_STACK *)sk; \
   46|  4.19k|    } \
v3_pmaps.c:ossl_check_const_POLICY_MAPPING_sk_type:
   44|    129|    { \
   45|    129|        return (const OPENSSL_STACK *)sk; \
   46|    129|    } \
v3_prn.c:ossl_check_const_CONF_VALUE_sk_type:
   44|  9.55k|    { \
   45|  9.55k|        return (const OPENSSL_STACK *)sk; \
   46|  9.55k|    } \
v3_prn.c:ossl_check_CONF_VALUE_sk_type:
   48|  13.4k|    { \
   49|  13.4k|        return (OPENSSL_STACK *)sk; \
   50|  13.4k|    } \
v3_prn.c:ossl_check_CONF_VALUE_freefunc_type:
   60|  13.4k|    { \
   61|  13.4k|        return (OPENSSL_sk_freefunc)fr; \
   62|  13.4k|    }
v3_san.c:ossl_check_const_GENERAL_NAME_sk_type:
   44|  4.47k|    { \
   45|  4.47k|        return (const OPENSSL_STACK *)sk; \
   46|  4.47k|    } \
v3_san.c:ossl_check_CONF_VALUE_sk_type:
   48|     94|    { \
   49|     94|        return (OPENSSL_STACK *)sk; \
   50|     94|    } \
v3_san.c:ossl_check_CONF_VALUE_freefunc_type:
   60|     94|    { \
   61|     94|        return (OPENSSL_sk_freefunc)fr; \
   62|     94|    }
v3_utl.c:ossl_check_CONF_VALUE_type:
   40|  2.85k|    { \
   41|  2.85k|        return ptr; \
   42|  2.85k|    } \
v3_utl.c:ossl_check_CONF_VALUE_sk_type:
   48|  2.94k|    { \
   49|  2.94k|        return (OPENSSL_STACK *)sk; \
   50|  2.94k|    } \
x509_obj.c:ossl_check_const_X509_NAME_ENTRY_sk_type:
   44|   171k|    { \
   45|   171k|        return (const OPENSSL_STACK *)sk; \
   46|   171k|    } \
x509_v3.c:ossl_check_const_X509_EXTENSION_sk_type:
   44|  37.8k|    { \
   45|  37.8k|        return (const OPENSSL_STACK *)sk; \
   46|  37.8k|    } \
x509name.c:ossl_check_const_X509_NAME_ENTRY_sk_type:
   44|  23.4k|    { \
   45|  23.4k|        return (const OPENSSL_STACK *)sk; \
   46|  23.4k|    } \
x509name.c:ossl_check_X509_NAME_ENTRY_sk_type:
   48|  2.37k|    { \
   49|  2.37k|        return (OPENSSL_STACK *)sk; \
   50|  2.37k|    } \
x509name.c:ossl_check_X509_NAME_ENTRY_type:
   40|  2.37k|    { \
   41|  2.37k|        return ptr; \
   42|  2.37k|    } \
x_crl.c:ossl_check_GENERAL_NAMES_sk_type:
   48|  33.3k|    { \
   49|  33.3k|        return (OPENSSL_STACK *)sk; \
   50|  33.3k|    } \
x_crl.c:ossl_check_GENERAL_NAMES_freefunc_type:
   60|  33.3k|    { \
   61|  33.3k|        return (OPENSSL_sk_freefunc)fr; \
   62|  33.3k|    }
x_crl.c:ossl_check_const_X509_EXTENSION_sk_type:
   44|  23.0k|    { \
   45|  23.0k|        return (const OPENSSL_STACK *)sk; \
   46|  23.0k|    } \
x_crl.c:ossl_check_const_X509_REVOKED_sk_type:
   44|  11.9k|    { \
   45|  11.9k|        return (const OPENSSL_STACK *)sk; \
   46|  11.9k|    } \
x_crl.c:ossl_check_GENERAL_NAMES_type:
   40|     57|    { \
   41|     57|        return ptr; \
   42|     57|    } \
x_crl.c:ossl_check_X509_REVOKED_compfunc_type:
   52|  1.92k|    { \
   53|  1.92k|        return (OPENSSL_sk_compfunc)cmp; \
   54|  1.92k|    } \
x_crl.c:ossl_check_X509_REVOKED_sk_type:
   48|  1.92k|    { \
   49|  1.92k|        return (OPENSSL_STACK *)sk; \
   50|  1.92k|    } \
x_name.c:ossl_check_X509_NAME_ENTRY_sk_type:
   48|  3.25M|    { \
   49|  3.25M|        return (OPENSSL_STACK *)sk; \
   50|  3.25M|    } \
x_name.c:ossl_check_X509_NAME_ENTRY_freefunc_type:
   60|  1.68M|    { \
   61|  1.68M|        return (OPENSSL_sk_freefunc)fr; \
   62|  1.68M|    }
x_name.c:sk_STACK_OF_X509_NAME_ENTRY_num:
   70|  2.10M|    { \
   71|  2.10M|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  2.10M|    } \
x_name.c:sk_STACK_OF_X509_NAME_ENTRY_value:
   74|  2.01M|    { \
   75|  2.01M|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  2.01M|    } \
x_name.c:ossl_check_const_X509_NAME_ENTRY_sk_type:
   44|  3.53M|    { \
   45|  3.53M|        return (const OPENSSL_STACK *)sk; \
   46|  3.53M|    } \
x_name.c:ossl_check_X509_NAME_ENTRY_type:
   40|   952k|    { \
   41|   952k|        return ptr; \
   42|   952k|    } \
x_name.c:sk_STACK_OF_X509_NAME_ENTRY_new_null:
   82|  2.94k|    { \
   83|  2.94k|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|  2.94k|    } \
x_name.c:sk_STACK_OF_X509_NAME_ENTRY_push:
  111|  9.71k|    { \
  112|  9.71k|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|  9.71k|    } \
x_name.c:ossl_check_const_ASN1_VALUE_sk_type:
   44|  28.4k|    { \
   45|  28.4k|        return (const OPENSSL_STACK *)sk; \
   46|  28.4k|    } \
x_name.c:sk_STACK_OF_X509_NAME_ENTRY_pop_free:
  127|  85.7k|    { \
  128|  85.7k|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|  85.7k|    } \
x_x509.c:ossl_check_IPAddressFamily_sk_type:
   48|  85.3k|    { \
   49|  85.3k|        return (OPENSSL_STACK *)sk; \
   50|  85.3k|    } \
x_x509.c:ossl_check_IPAddressFamily_freefunc_type:
   60|  85.3k|    { \
   61|  85.3k|        return (OPENSSL_sk_freefunc)fr; \
   62|  85.3k|    }
encode_key2text.c:sk_BIGNUM_const_new_null:
   82|  1.08k|    { \
   83|  1.08k|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|  1.08k|    } \
encode_key2text.c:sk_BIGNUM_const_num:
   70|  15.1k|    { \
   71|  15.1k|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|  15.1k|    } \
encode_key2text.c:sk_BIGNUM_const_value:
   74|  44.9k|    { \
   75|  44.9k|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|  44.9k|    } \
encode_key2text.c:sk_BIGNUM_const_free:
   94|  1.08k|    { \
   95|  1.08k|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|  1.08k|    } \
evp_pbe.c:sk_EVP_PBE_CTL_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
v3_admis.c:ossl_check_const_ADMISSIONS_sk_type:
   44|      5|    { \
   45|      5|        return (const OPENSSL_STACK *)sk; \
   46|      5|    } \
v3_admis.c:ossl_check_const_PROFESSION_INFO_sk_type:
   44|      1|    { \
   45|      1|        return (const OPENSSL_STACK *)sk; \
   46|      1|    } \
v3_akid.c:ossl_check_CONF_VALUE_sk_type:
   48|      1|    { \
   49|      1|        return (OPENSSL_STACK *)sk; \
   50|      1|    } \
v3_akid.c:ossl_check_CONF_VALUE_freefunc_type:
   60|      1|    { \
   61|      1|        return (OPENSSL_sk_freefunc)fr; \
   62|      1|    }

ossl_prov_bio_from_dispatch:
   27|      1|{
   28|     48|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (28:12): [True: 47, False: 1]
  ------------------
   29|     47|        switch (fns->function_id) {
  ------------------
  |  Branch (29:17): [True: 37, False: 10]
  ------------------
   30|      1|        case OSSL_FUNC_BIO_NEW_FILE:
  ------------------
  |  |  148|      1|#define OSSL_FUNC_BIO_NEW_FILE                40
  ------------------
  |  Branch (30:9): [True: 1, False: 46]
  ------------------
   31|      1|            if (c_bio_new_file == NULL)
  ------------------
  |  Branch (31:17): [True: 1, False: 0]
  ------------------
   32|      1|                c_bio_new_file = OSSL_FUNC_BIO_new_file(fns);
   33|      1|            break;
   34|      1|        case OSSL_FUNC_BIO_NEW_MEMBUF:
  ------------------
  |  |  149|      1|#define OSSL_FUNC_BIO_NEW_MEMBUF              41
  ------------------
  |  Branch (34:9): [True: 1, False: 46]
  ------------------
   35|      1|            if (c_bio_new_membuf == NULL)
  ------------------
  |  Branch (35:17): [True: 1, False: 0]
  ------------------
   36|      1|                c_bio_new_membuf = OSSL_FUNC_BIO_new_membuf(fns);
   37|      1|            break;
   38|      1|        case OSSL_FUNC_BIO_READ_EX:
  ------------------
  |  |  150|      1|#define OSSL_FUNC_BIO_READ_EX                 42
  ------------------
  |  Branch (38:9): [True: 1, False: 46]
  ------------------
   39|      1|            if (c_bio_read_ex == NULL)
  ------------------
  |  Branch (39:17): [True: 1, False: 0]
  ------------------
   40|      1|                c_bio_read_ex = OSSL_FUNC_BIO_read_ex(fns);
   41|      1|            break;
   42|      1|        case OSSL_FUNC_BIO_WRITE_EX:
  ------------------
  |  |  151|      1|#define OSSL_FUNC_BIO_WRITE_EX                43
  ------------------
  |  Branch (42:9): [True: 1, False: 46]
  ------------------
   43|      1|            if (c_bio_write_ex == NULL)
  ------------------
  |  Branch (43:17): [True: 1, False: 0]
  ------------------
   44|      1|                c_bio_write_ex = OSSL_FUNC_BIO_write_ex(fns);
   45|      1|            break;
   46|      1|        case OSSL_FUNC_BIO_GETS:
  ------------------
  |  |  157|      1|#define OSSL_FUNC_BIO_GETS                    49
  ------------------
  |  Branch (46:9): [True: 1, False: 46]
  ------------------
   47|      1|            if (c_bio_gets == NULL)
  ------------------
  |  Branch (47:17): [True: 1, False: 0]
  ------------------
   48|      1|                c_bio_gets = OSSL_FUNC_BIO_gets(fns);
   49|      1|            break;
   50|      1|        case OSSL_FUNC_BIO_PUTS:
  ------------------
  |  |  156|      1|#define OSSL_FUNC_BIO_PUTS                    48
  ------------------
  |  Branch (50:9): [True: 1, False: 46]
  ------------------
   51|      1|            if (c_bio_puts == NULL)
  ------------------
  |  Branch (51:17): [True: 1, False: 0]
  ------------------
   52|      1|                c_bio_puts = OSSL_FUNC_BIO_puts(fns);
   53|      1|            break;
   54|      1|        case OSSL_FUNC_BIO_CTRL:
  ------------------
  |  |  158|      1|#define OSSL_FUNC_BIO_CTRL                    50
  ------------------
  |  Branch (54:9): [True: 1, False: 46]
  ------------------
   55|      1|            if (c_bio_ctrl == NULL)
  ------------------
  |  Branch (55:17): [True: 1, False: 0]
  ------------------
   56|      1|                c_bio_ctrl = OSSL_FUNC_BIO_ctrl(fns);
   57|      1|            break;
   58|      1|        case OSSL_FUNC_BIO_UP_REF:
  ------------------
  |  |  152|      1|#define OSSL_FUNC_BIO_UP_REF                  44
  ------------------
  |  Branch (58:9): [True: 1, False: 46]
  ------------------
   59|      1|            if (c_bio_up_ref == NULL)
  ------------------
  |  Branch (59:17): [True: 1, False: 0]
  ------------------
   60|      1|                c_bio_up_ref = OSSL_FUNC_BIO_up_ref(fns);
   61|      1|            break;
   62|      1|        case OSSL_FUNC_BIO_FREE:
  ------------------
  |  |  153|      1|#define OSSL_FUNC_BIO_FREE                    45
  ------------------
  |  Branch (62:9): [True: 1, False: 46]
  ------------------
   63|      1|            if (c_bio_free == NULL)
  ------------------
  |  Branch (63:17): [True: 1, False: 0]
  ------------------
   64|      1|                c_bio_free = OSSL_FUNC_BIO_free(fns);
   65|      1|            break;
   66|      1|        case OSSL_FUNC_BIO_VPRINTF:
  ------------------
  |  |  154|      1|#define OSSL_FUNC_BIO_VPRINTF                 46
  ------------------
  |  Branch (66:9): [True: 1, False: 46]
  ------------------
   67|      1|            if (c_bio_vprintf == NULL)
  ------------------
  |  Branch (67:17): [True: 1, False: 0]
  ------------------
   68|      1|                c_bio_vprintf = OSSL_FUNC_BIO_vprintf(fns);
   69|      1|            break;
   70|     47|        }
   71|     47|    }
   72|       |
   73|      1|    return 1;
   74|      1|}
ossl_prov_bio_read_ex:
   92|   120M|{
   93|   120M|    if (c_bio_read_ex == NULL)
  ------------------
  |  Branch (93:9): [True: 0, False: 120M]
  ------------------
   94|      0|        return 0;
   95|   120M|    return c_bio_read_ex(bio, data, data_len, bytes_read);
   96|   120M|}
ossl_prov_bio_write_ex:
  100|  1.42M|{
  101|  1.42M|    if (c_bio_write_ex == NULL)
  ------------------
  |  Branch (101:9): [True: 0, False: 1.42M]
  ------------------
  102|      0|        return 0;
  103|  1.42M|    return c_bio_write_ex(bio, data, data_len, written);
  104|  1.42M|}
ossl_prov_bio_up_ref:
  128|   267k|{
  129|   267k|    if (c_bio_up_ref == NULL)
  ------------------
  |  Branch (129:9): [True: 0, False: 267k]
  ------------------
  130|      0|        return 0;
  131|   267k|    return c_bio_up_ref(bio);
  132|   267k|}
ossl_prov_bio_free:
  135|   267k|{
  136|   267k|    if (c_bio_free == NULL)
  ------------------
  |  Branch (136:9): [True: 0, False: 267k]
  ------------------
  137|      0|        return 0;
  138|   267k|    return c_bio_free(bio);
  139|   267k|}
ossl_bio_prov_init_bio_method:
  207|      1|{
  208|      1|    BIO_METHOD *corebiometh = NULL;
  209|       |
  210|      1|    corebiometh = BIO_meth_new(BIO_TYPE_CORE_TO_PROV, "BIO to Core filter");
  ------------------
  |  |   69|      1|# define BIO_TYPE_CORE_TO_PROV   (25|BIO_TYPE_SOURCE_SINK)
  |  |  ------------------
  |  |  |  |   41|      1|# define BIO_TYPE_SOURCE_SINK    0x0400
  |  |  ------------------
  ------------------
  211|      1|    if (corebiometh == NULL
  ------------------
  |  Branch (211:9): [True: 0, False: 1]
  ------------------
  212|      1|            || !BIO_meth_set_write_ex(corebiometh, bio_core_write_ex)
  ------------------
  |  Branch (212:16): [True: 0, False: 1]
  ------------------
  213|      1|            || !BIO_meth_set_read_ex(corebiometh, bio_core_read_ex)
  ------------------
  |  Branch (213:16): [True: 0, False: 1]
  ------------------
  214|      1|            || !BIO_meth_set_puts(corebiometh, bio_core_puts)
  ------------------
  |  Branch (214:16): [True: 0, False: 1]
  ------------------
  215|      1|            || !BIO_meth_set_gets(corebiometh, bio_core_gets)
  ------------------
  |  Branch (215:16): [True: 0, False: 1]
  ------------------
  216|      1|            || !BIO_meth_set_ctrl(corebiometh, bio_core_ctrl)
  ------------------
  |  Branch (216:16): [True: 0, False: 1]
  ------------------
  217|      1|            || !BIO_meth_set_create(corebiometh, bio_core_new)
  ------------------
  |  Branch (217:16): [True: 0, False: 1]
  ------------------
  218|      1|            || !BIO_meth_set_destroy(corebiometh, bio_core_free)) {
  ------------------
  |  Branch (218:16): [True: 0, False: 1]
  ------------------
  219|      0|        BIO_meth_free(corebiometh);
  220|      0|        return NULL;
  221|      0|    }
  222|       |
  223|      1|    return corebiometh;
  224|      1|}
ossl_bio_new_from_core_bio:
  227|   267k|{
  228|   267k|    BIO *outbio;
  229|   267k|    BIO_METHOD *corebiometh = ossl_prov_ctx_get0_core_bio_method(provctx);
  230|       |
  231|   267k|    if (corebiometh == NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 267k]
  ------------------
  232|      0|        return NULL;
  233|       |
  234|   267k|    if ((outbio = BIO_new(corebiometh)) == NULL)
  ------------------
  |  Branch (234:9): [True: 0, False: 267k]
  ------------------
  235|      0|        return NULL;
  236|   267k|    if (!ossl_prov_bio_up_ref(corebio)) {
  ------------------
  |  Branch (236:9): [True: 0, False: 267k]
  ------------------
  237|      0|        BIO_free(outbio);
  238|      0|        return NULL;
  239|      0|    }
  240|   267k|    BIO_set_data(outbio, corebio);
  241|   267k|    return outbio;
  242|   267k|}
bio_prov.c:bio_core_write_ex:
  172|  1.42M|{
  173|  1.42M|    return ossl_prov_bio_write_ex(BIO_get_data(bio), data, data_len, written);
  174|  1.42M|}
bio_prov.c:bio_core_read_ex:
  166|   120M|{
  167|   120M|    return ossl_prov_bio_read_ex(BIO_get_data(bio), data, data_len, bytes_read);
  168|   120M|}
bio_prov.c:bio_core_new:
  192|   267k|{
  193|   267k|    BIO_set_init(bio, 1);
  194|       |
  195|   267k|    return 1;
  196|   267k|}
bio_prov.c:bio_core_free:
  199|   267k|{
  200|   267k|    BIO_set_init(bio, 0);
  201|   267k|    ossl_prov_bio_free(BIO_get_data(bio));
  202|       |
  203|   267k|    return 1;
  204|   267k|}

ossl_DER_w_RSASSA_PSS_params:
  285|      2|{
  286|      2|    int hashalg_nid, default_hashalg_nid;
  287|      2|    int saltlen, default_saltlen;
  288|      2|    int trailerfield, default_trailerfield;
  289|      2|    const unsigned char *hashalg = NULL;
  290|      2|    size_t hashalg_sz = 0;
  291|       |
  292|       |    /*
  293|       |     * For an unrestricted key, this function should not have been called;
  294|       |     * the caller must be in control, because unrestricted keys are permitted
  295|       |     * in some situations (when encoding the public key in a SubjectKeyInfo,
  296|       |     * for example) while not in others, and this function doesn't know the
  297|       |     * intent.  Therefore, we assert that here, the PSS parameters must show
  298|       |     * that the key is restricted.
  299|       |     */
  300|      2|    if (!ossl_assert(pss != NULL
  ------------------
  |  |   52|      4|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |  ------------------
  |  |  |  Branch (52:43): [True: 2, False: 0]
  |  |  |  Branch (52:43): [True: 2, False: 0]
  |  |  ------------------
  |  |   53|      2|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (300:9): [True: 0, False: 2]
  ------------------
  301|      2|                     && !ossl_rsa_pss_params_30_is_unrestricted(pss)))
  302|      0|        return 0;
  303|       |
  304|      2|    hashalg_nid = ossl_rsa_pss_params_30_hashalg(pss);
  305|      2|    saltlen = ossl_rsa_pss_params_30_saltlen(pss);
  306|      2|    trailerfield = ossl_rsa_pss_params_30_trailerfield(pss);
  307|       |
  308|      2|    if (saltlen < 0) {
  ------------------
  |  Branch (308:9): [True: 0, False: 2]
  ------------------
  309|      0|        ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_SALT_LENGTH);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  310|      0|        return 0;
  311|      0|    }
  312|      2|    if (trailerfield != 1) {
  ------------------
  |  Branch (312:9): [True: 0, False: 2]
  ------------------
  313|      0|        ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_TRAILER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  314|      0|        return 0;
  315|      0|    }
  316|       |
  317|       |    /* Getting default values */
  318|      2|    default_hashalg_nid = ossl_rsa_pss_params_30_hashalg(NULL);
  319|      2|    default_saltlen = ossl_rsa_pss_params_30_saltlen(NULL);
  320|      2|    default_trailerfield = ossl_rsa_pss_params_30_trailerfield(NULL);
  321|       |
  322|       |    /*
  323|       |     * From https://tools.ietf.org/html/rfc8017#appendix-A.2.1:
  324|       |     *
  325|       |     * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
  326|       |     *     { OID id-sha1       PARAMETERS NULL }|
  327|       |     *     { OID id-sha224     PARAMETERS NULL }|
  328|       |     *     { OID id-sha256     PARAMETERS NULL }|
  329|       |     *     { OID id-sha384     PARAMETERS NULL }|
  330|       |     *     { OID id-sha512     PARAMETERS NULL }|
  331|       |     *     { OID id-sha512-224 PARAMETERS NULL }|
  332|       |     *     { OID id-sha512-256 PARAMETERS NULL },
  333|       |     *     ...  -- Allows for future expansion --
  334|       |     * }
  335|       |     */
  336|      2|    switch (hashalg_nid) {
  337|      2|        OAEP_PSS_MD_CASE(sha1, hashalg);
  ------------------
  |  |  278|      2|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 2, False: 0]
  |  |  ------------------
  |  |  279|      2|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      2|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      2|        break;
  ------------------
  338|      0|        OAEP_PSS_MD_CASE(sha224, hashalg);
  ------------------
  |  |  278|      0|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  279|      0|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      0|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      0|        break;
  ------------------
  339|      0|        OAEP_PSS_MD_CASE(sha256, hashalg);
  ------------------
  |  |  278|      0|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  279|      0|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      0|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      0|        break;
  ------------------
  340|      0|        OAEP_PSS_MD_CASE(sha384, hashalg);
  ------------------
  |  |  278|      0|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  279|      0|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      0|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      0|        break;
  ------------------
  341|      0|        OAEP_PSS_MD_CASE(sha512, hashalg);
  ------------------
  |  |  278|      0|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  279|      0|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      0|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      0|        break;
  ------------------
  342|      0|        OAEP_PSS_MD_CASE(sha512_224, hashalg);
  ------------------
  |  |  278|      0|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  279|      0|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      0|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      0|        break;
  ------------------
  343|      0|        OAEP_PSS_MD_CASE(sha512_256, hashalg);
  ------------------
  |  |  278|      0|    case NID_##name:                                                    \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  279|      0|        var = ossl_der_aid_##name##Identifier;                          \
  |  |  280|      0|        var##_sz = sizeof(ossl_der_aid_##name##Identifier);             \
  |  |  281|      0|        break;
  ------------------
  344|      0|    default:
  ------------------
  |  Branch (344:5): [True: 0, False: 2]
  ------------------
  345|      0|        return 0;
  346|      2|    }
  347|       |
  348|      2|    return ossl_DER_w_begin_sequence(pkt, tag)
  ------------------
  |  Branch (348:12): [True: 2, False: 0]
  ------------------
  349|      2|        && (trailerfield == default_trailerfield
  ------------------
  |  Branch (349:13): [True: 2, False: 0]
  ------------------
  350|      2|            || ossl_DER_w_uint32(pkt, 3, (uint32_t)trailerfield))
  ------------------
  |  Branch (350:16): [True: 0, False: 0]
  ------------------
  351|      2|        && (saltlen == default_saltlen || ossl_DER_w_uint32(pkt, 2, (uint32_t)saltlen))
  ------------------
  |  Branch (351:13): [True: 2, False: 0]
  |  Branch (351:43): [True: 0, False: 0]
  ------------------
  352|      2|        && DER_w_MaskGenAlgorithm(pkt, 1, pss)
  ------------------
  |  Branch (352:12): [True: 2, False: 0]
  ------------------
  353|      2|        && (hashalg_nid == default_hashalg_nid
  ------------------
  |  Branch (353:13): [True: 2, False: 0]
  ------------------
  354|      2|            || ossl_DER_w_precompiled(pkt, 0, hashalg, hashalg_sz))
  ------------------
  |  Branch (354:16): [True: 0, False: 0]
  ------------------
  355|      2|        && ossl_DER_w_end_sequence(pkt, tag);
  ------------------
  |  Branch (355:12): [True: 2, False: 0]
  ------------------
  356|      2|}
der_rsa_key.c:DER_w_MaskGenAlgorithm:
  249|      2|{
  250|      2|    if (pss != NULL && ossl_rsa_pss_params_30_maskgenalg(pss) == NID_mgf1) {
  ------------------
  |  |  573|      2|#define NID_mgf1                911
  ------------------
  |  Branch (250:9): [True: 2, False: 0]
  |  Branch (250:24): [True: 2, False: 0]
  ------------------
  251|      2|        int maskgenhashalg_nid = ossl_rsa_pss_params_30_maskgenhashalg(pss);
  252|      2|        const unsigned char *maskgenalg = NULL;
  253|      2|        size_t maskgenalg_sz = 0;
  254|       |
  255|      2|        switch (maskgenhashalg_nid) {
  256|      2|        case NID_sha1:
  ------------------
  |  | 2308|      2|#define NID_sha1                64
  ------------------
  |  Branch (256:9): [True: 2, False: 0]
  ------------------
  257|      2|            break;
  258|      0|            MGF1_SHA_CASE(224, maskgenalg);
  ------------------
  |  |  237|      0|    case NID_sha##bits:                                         \
  |  |  ------------------
  |  |  |  Branch (237:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      0|        var = der_aid_mgf1SHA##bits##Identifier;                \
  |  |  239|      0|        var##_sz = sizeof(der_aid_mgf1SHA##bits##Identifier);   \
  |  |  240|      0|        break;
  ------------------
  259|      0|            MGF1_SHA_CASE(256, maskgenalg);
  ------------------
  |  |  237|      0|    case NID_sha##bits:                                         \
  |  |  ------------------
  |  |  |  Branch (237:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      0|        var = der_aid_mgf1SHA##bits##Identifier;                \
  |  |  239|      0|        var##_sz = sizeof(der_aid_mgf1SHA##bits##Identifier);   \
  |  |  240|      0|        break;
  ------------------
  260|      0|            MGF1_SHA_CASE(384, maskgenalg);
  ------------------
  |  |  237|      0|    case NID_sha##bits:                                         \
  |  |  ------------------
  |  |  |  Branch (237:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      0|        var = der_aid_mgf1SHA##bits##Identifier;                \
  |  |  239|      0|        var##_sz = sizeof(der_aid_mgf1SHA##bits##Identifier);   \
  |  |  240|      0|        break;
  ------------------
  261|      0|            MGF1_SHA_CASE(512, maskgenalg);
  ------------------
  |  |  237|      0|    case NID_sha##bits:                                         \
  |  |  ------------------
  |  |  |  Branch (237:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      0|        var = der_aid_mgf1SHA##bits##Identifier;                \
  |  |  239|      0|        var##_sz = sizeof(der_aid_mgf1SHA##bits##Identifier);   \
  |  |  240|      0|        break;
  ------------------
  262|      0|            MGF1_SHA_CASE(512_224, maskgenalg);
  ------------------
  |  |  237|      0|    case NID_sha##bits:                                         \
  |  |  ------------------
  |  |  |  Branch (237:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      0|        var = der_aid_mgf1SHA##bits##Identifier;                \
  |  |  239|      0|        var##_sz = sizeof(der_aid_mgf1SHA##bits##Identifier);   \
  |  |  240|      0|        break;
  ------------------
  263|      0|            MGF1_SHA_CASE(512_256, maskgenalg);
  ------------------
  |  |  237|      0|    case NID_sha##bits:                                         \
  |  |  ------------------
  |  |  |  Branch (237:5): [True: 0, False: 2]
  |  |  ------------------
  |  |  238|      0|        var = der_aid_mgf1SHA##bits##Identifier;                \
  |  |  239|      0|        var##_sz = sizeof(der_aid_mgf1SHA##bits##Identifier);   \
  |  |  240|      0|        break;
  ------------------
  264|      0|        default:
  ------------------
  |  Branch (264:9): [True: 0, False: 2]
  ------------------
  265|      0|            return 0;
  266|      2|        }
  267|       |
  268|       |        /* If there is none (or it was the default), we write nothing */
  269|      2|        if (maskgenalg == NULL)
  ------------------
  |  Branch (269:13): [True: 2, False: 0]
  ------------------
  270|      2|            return 1;
  271|       |
  272|      0|        return ossl_DER_w_precompiled(pkt, tag, maskgenalg, maskgenalg_sz);
  273|      2|    }
  274|      0|    return 0;
  275|      2|}

ossl_prov_ctx_new:
   15|      1|{
   16|      1|    return OPENSSL_zalloc(sizeof(PROV_CTX));
  ------------------
  |  |   99|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   17|      1|}
ossl_prov_ctx_free:
   20|      1|{
   21|      1|    OPENSSL_free(ctx);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   22|      1|}
ossl_prov_ctx_set0_libctx:
   25|      1|{
   26|      1|    if (ctx != NULL)
  ------------------
  |  Branch (26:9): [True: 1, False: 0]
  ------------------
   27|      1|        ctx->libctx = libctx;
   28|      1|}
ossl_prov_ctx_set0_handle:
   31|      1|{
   32|      1|    if (ctx != NULL)
  ------------------
  |  Branch (32:9): [True: 1, False: 0]
  ------------------
   33|      1|        ctx->handle = handle;
   34|      1|}
ossl_prov_ctx_set0_core_bio_method:
   37|      1|{
   38|      1|    if (ctx != NULL)
  ------------------
  |  Branch (38:9): [True: 1, False: 0]
  ------------------
   39|      1|        ctx->corebiometh = corebiometh;
   40|      1|}
ossl_prov_ctx_get0_libctx:
   43|  85.1k|{
   44|  85.1k|    if (ctx == NULL)
  ------------------
  |  Branch (44:9): [True: 0, False: 85.1k]
  ------------------
   45|      0|        return NULL;
   46|  85.1k|    return ctx->libctx;
   47|  85.1k|}
ossl_prov_ctx_get0_core_bio_method:
   57|   267k|{
   58|   267k|    if (ctx == NULL)
  ------------------
  |  Branch (58:9): [True: 0, False: 267k]
  ------------------
   59|      0|        return NULL;
   60|   267k|    return ctx->corebiometh;
   61|   267k|}

ossl_err_load_PROV_strings:
  230|      2|{
  231|      2|#ifndef OPENSSL_NO_ERR
  232|      2|    if (ERR_reason_error_string(PROV_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (232:9): [True: 2, False: 0]
  ------------------
  233|      2|        ERR_load_strings_const(PROV_str_reasons);
  234|      2|#endif
  235|      2|    return 1;
  236|      2|}

ossl_prov_seeding_from_dispatch:
   19|      1|{
   20|     48|    for (; fns->function_id != 0; fns++) {
  ------------------
  |  Branch (20:12): [True: 47, False: 1]
  ------------------
   21|       |        /*
   22|       |         * We do not support the scenario of an application linked against
   23|       |         * multiple versions of libcrypto (e.g. one static and one dynamic), but
   24|       |         * sharing a single fips.so. We do a simple sanity check here.
   25|       |         */
   26|     47|#define set_func(c, f) \
   27|     47|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
   28|     47|        switch (fns->function_id) {
  ------------------
  |  Branch (28:17): [True: 43, False: 4]
  ------------------
   29|      1|        case OSSL_FUNC_GET_ENTROPY:
  ------------------
  |  |  184|      1|#define OSSL_FUNC_GET_ENTROPY                101
  ------------------
  |  Branch (29:9): [True: 1, False: 46]
  ------------------
   30|      1|            set_func(c_get_entropy, OSSL_FUNC_get_entropy(fns));
  ------------------
  |  |   27|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (27:14): [True: 1, False: 0]
  |  |  |  Branch (27:41): [True: 0, False: 0]
  |  |  |  Branch (27:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   31|      1|            break;
   32|      1|        case OSSL_FUNC_CLEANUP_ENTROPY:
  ------------------
  |  |  185|      1|#define OSSL_FUNC_CLEANUP_ENTROPY            102
  ------------------
  |  Branch (32:9): [True: 1, False: 46]
  ------------------
   33|      1|            set_func(c_cleanup_entropy, OSSL_FUNC_cleanup_entropy(fns));
  ------------------
  |  |   27|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (27:14): [True: 1, False: 0]
  |  |  |  Branch (27:41): [True: 0, False: 0]
  |  |  |  Branch (27:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   34|      1|            break;
   35|      1|        case OSSL_FUNC_GET_NONCE:
  ------------------
  |  |  186|      1|#define OSSL_FUNC_GET_NONCE                  103
  ------------------
  |  Branch (35:9): [True: 1, False: 46]
  ------------------
   36|      1|            set_func(c_get_nonce, OSSL_FUNC_get_nonce(fns));
  ------------------
  |  |   27|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (27:14): [True: 1, False: 0]
  |  |  |  Branch (27:41): [True: 0, False: 0]
  |  |  |  Branch (27:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   37|      1|            break;
   38|      1|        case OSSL_FUNC_CLEANUP_NONCE:
  ------------------
  |  |  187|      1|#define OSSL_FUNC_CLEANUP_NONCE              104
  ------------------
  |  Branch (38:9): [True: 1, False: 46]
  ------------------
   39|      1|            set_func(c_cleanup_nonce, OSSL_FUNC_cleanup_nonce(fns));
  ------------------
  |  |   27|      1|    do { if (c == NULL) c = f; else if (c != f) return 0; } while (0)
  |  |  ------------------
  |  |  |  Branch (27:14): [True: 1, False: 0]
  |  |  |  Branch (27:41): [True: 0, False: 0]
  |  |  |  Branch (27:68): [Folded - Ignored]
  |  |  ------------------
  ------------------
   40|      1|            break;
   41|     47|        }
   42|     47|#undef set_func
   43|     47|    }
   44|      1|    return 1;
   45|      1|}

ossl_prov_cache_exported_algorithms:
  342|      1|{
  343|      1|    int i, j;
  344|       |
  345|      1|    if (out[0].algorithm_names == NULL) {
  ------------------
  |  Branch (345:9): [True: 1, False: 0]
  ------------------
  346|    131|        for (i = j = 0; in[i].alg.algorithm_names != NULL; ++i) {
  ------------------
  |  Branch (346:25): [True: 130, False: 1]
  ------------------
  347|    130|            if (in[i].capable == NULL || in[i].capable())
  ------------------
  |  Branch (347:17): [True: 126, False: 4]
  |  Branch (347:42): [True: 4, False: 0]
  ------------------
  348|    130|                out[j++] = in[i].alg;
  349|    130|        }
  350|      1|        out[j++] = in[i].alg;
  351|      1|    }
  352|      1|}

ossl_default_provider_init:
  578|      1|{
  579|      1|    OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL;
  580|      1|    BIO_METHOD *corebiometh;
  581|       |
  582|      1|    if (!ossl_prov_bio_from_dispatch(in)
  ------------------
  |  Branch (582:9): [True: 0, False: 1]
  ------------------
  583|      1|            || !ossl_prov_seeding_from_dispatch(in))
  ------------------
  |  Branch (583:16): [True: 0, False: 1]
  ------------------
  584|      0|        return 0;
  585|     48|    for (; in->function_id != 0; in++) {
  ------------------
  |  Branch (585:12): [True: 47, False: 1]
  ------------------
  586|     47|        switch (in->function_id) {
  587|      1|        case OSSL_FUNC_CORE_GETTABLE_PARAMS:
  ------------------
  |  |   63|      1|# define OSSL_FUNC_CORE_GETTABLE_PARAMS        1
  ------------------
  |  Branch (587:9): [True: 1, False: 46]
  ------------------
  588|      1|            c_gettable_params = OSSL_FUNC_core_gettable_params(in);
  589|      1|            break;
  590|      1|        case OSSL_FUNC_CORE_GET_PARAMS:
  ------------------
  |  |   66|      1|# define OSSL_FUNC_CORE_GET_PARAMS             2
  ------------------
  |  Branch (590:9): [True: 1, False: 46]
  ------------------
  591|      1|            c_get_params = OSSL_FUNC_core_get_params(in);
  592|      1|            break;
  593|      1|        case OSSL_FUNC_CORE_GET_LIBCTX:
  ------------------
  |  |   73|      1|# define OSSL_FUNC_CORE_GET_LIBCTX             4
  ------------------
  |  Branch (593:9): [True: 1, False: 46]
  ------------------
  594|      1|            c_get_libctx = OSSL_FUNC_core_get_libctx(in);
  595|      1|            break;
  596|     44|        default:
  ------------------
  |  Branch (596:9): [True: 44, False: 3]
  ------------------
  597|       |            /* Just ignore anything we don't understand */
  598|     44|            break;
  599|     47|        }
  600|     47|    }
  601|       |
  602|      1|    if (c_get_libctx == NULL)
  ------------------
  |  Branch (602:9): [True: 0, False: 1]
  ------------------
  603|      0|        return 0;
  604|       |
  605|       |    /*
  606|       |     * We want to make sure that all calls from this provider that requires
  607|       |     * a library context use the same context as the one used to call our
  608|       |     * functions.  We do that by passing it along in the provider context.
  609|       |     *
  610|       |     * This only works for built-in providers.  Most providers should
  611|       |     * create their own library context.
  612|       |     */
  613|      1|    if ((*provctx = ossl_prov_ctx_new()) == NULL
  ------------------
  |  Branch (613:9): [True: 0, False: 1]
  ------------------
  614|      1|            || (corebiometh = ossl_bio_prov_init_bio_method()) == NULL) {
  ------------------
  |  Branch (614:16): [True: 0, False: 1]
  ------------------
  615|      0|        ossl_prov_ctx_free(*provctx);
  616|      0|        *provctx = NULL;
  617|      0|        return 0;
  618|      0|    }
  619|      1|    ossl_prov_ctx_set0_libctx(*provctx,
  620|      1|                                       (OSSL_LIB_CTX *)c_get_libctx(handle));
  621|      1|    ossl_prov_ctx_set0_handle(*provctx, handle);
  622|      1|    ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);
  623|       |
  624|      1|    *out = deflt_dispatch_table;
  625|      1|    ossl_prov_cache_exported_algorithms(deflt_ciphers, exported_ciphers);
  626|       |
  627|      1|    return 1;
  628|      1|}
defltprov.c:deflt_teardown:
  556|      1|{
  557|      1|    BIO_meth_free(ossl_prov_ctx_get0_core_bio_method(provctx));
  558|      1|    ossl_prov_ctx_free(provctx);
  559|      1|}
defltprov.c:deflt_query:
  521|  6.74k|{
  522|  6.74k|    *no_cache = 0;
  523|  6.74k|    switch (operation_id) {
  ------------------
  |  Branch (523:13): [True: 0, False: 6.74k]
  ------------------
  524|      3|    case OSSL_OP_DIGEST:
  ------------------
  |  |  254|      3|# define OSSL_OP_DIGEST                              1
  ------------------
  |  Branch (524:5): [True: 3, False: 6.74k]
  ------------------
  525|      3|        return deflt_digests;
  526|      0|    case OSSL_OP_CIPHER:
  ------------------
  |  |  255|      0|# define OSSL_OP_CIPHER                              2   /* Symmetric Ciphers */
  ------------------
  |  Branch (526:5): [True: 0, False: 6.74k]
  ------------------
  527|      0|        return exported_ciphers;
  528|      0|    case OSSL_OP_MAC:
  ------------------
  |  |  256|      0|# define OSSL_OP_MAC                                 3
  ------------------
  |  Branch (528:5): [True: 0, False: 6.74k]
  ------------------
  529|      0|        return deflt_macs;
  530|      0|    case OSSL_OP_KDF:
  ------------------
  |  |  257|      0|# define OSSL_OP_KDF                                 4
  ------------------
  |  Branch (530:5): [True: 0, False: 6.74k]
  ------------------
  531|      0|        return deflt_kdfs;
  532|      2|    case OSSL_OP_RAND:
  ------------------
  |  |  258|      2|# define OSSL_OP_RAND                                5
  ------------------
  |  Branch (532:5): [True: 2, False: 6.74k]
  ------------------
  533|      2|        return deflt_rands;
  534|    268|    case OSSL_OP_KEYMGMT:
  ------------------
  |  |  259|    268|# define OSSL_OP_KEYMGMT                            10
  ------------------
  |  Branch (534:5): [True: 268, False: 6.47k]
  ------------------
  535|    268|        return deflt_keymgmt;
  536|      0|    case OSSL_OP_KEYEXCH:
  ------------------
  |  |  260|      0|# define OSSL_OP_KEYEXCH                            11
  ------------------
  |  Branch (536:5): [True: 0, False: 6.74k]
  ------------------
  537|      0|        return deflt_keyexch;
  538|      0|    case OSSL_OP_SIGNATURE:
  ------------------
  |  |  261|      0|# define OSSL_OP_SIGNATURE                          12
  ------------------
  |  Branch (538:5): [True: 0, False: 6.74k]
  ------------------
  539|      0|        return deflt_signature;
  540|      0|    case OSSL_OP_ASYM_CIPHER:
  ------------------
  |  |  262|      0|# define OSSL_OP_ASYM_CIPHER                        13
  ------------------
  |  Branch (540:5): [True: 0, False: 6.74k]
  ------------------
  541|      0|        return deflt_asym_cipher;
  542|      0|    case OSSL_OP_KEM:
  ------------------
  |  |  263|      0|# define OSSL_OP_KEM                                14
  ------------------
  |  Branch (542:5): [True: 0, False: 6.74k]
  ------------------
  543|      0|        return deflt_asym_kem;
  544|  6.17k|    case OSSL_OP_ENCODER:
  ------------------
  |  |  265|  6.17k|# define OSSL_OP_ENCODER                            20
  ------------------
  |  Branch (544:5): [True: 6.17k, False: 568]
  ------------------
  545|  6.17k|        return deflt_encoder;
  546|    295|    case OSSL_OP_DECODER:
  ------------------
  |  |  266|    295|# define OSSL_OP_DECODER                            21
  ------------------
  |  Branch (546:5): [True: 295, False: 6.45k]
  ------------------
  547|    295|        return deflt_decoder;
  548|      0|    case OSSL_OP_STORE:
  ------------------
  |  |  267|      0|# define OSSL_OP_STORE                              22
  ------------------
  |  Branch (548:5): [True: 0, False: 6.74k]
  ------------------
  549|      0|        return deflt_store;
  550|  6.74k|    }
  551|      0|    return NULL;
  552|  6.74k|}

ossl_cipher_capable_aes_cbc_hmac_sha1:
   41|      2|{
   42|      2|    return AESNI_CBC_HMAC_SHA_CAPABLE;
  ------------------
  |  |  162|      2|#  define AESNI_CBC_HMAC_SHA_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  ------------------
   43|      2|}

ossl_cipher_capable_aes_cbc_hmac_sha256:
   41|      2|{
   42|      2|    return AESNI_CBC_HMAC_SHA_CAPABLE
  ------------------
  |  |  162|      4|#  define AESNI_CBC_HMAC_SHA_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32)))
  |  |  ------------------
  |  |  |  Branch (162:38): [True: 2, False: 0]
  |  |  ------------------
  ------------------
   43|      2|           && aesni_cbc_sha256_enc(NULL, NULL, 0, NULL, NULL, NULL, NULL);
  ------------------
  |  Branch (43:15): [True: 2, False: 0]
  ------------------
   44|      2|}

blake2_prov.c:blake2b512_get_params:
   94|      1|{
   95|      1|    return ossl_digest_default_get_params(params, BLAKE2B_BLOCKBYTES, 64, 0);
  ------------------
  |  |   25|      1|# define BLAKE2B_BLOCKBYTES    128
  ------------------
   96|      1|}

ossl_digest_default_get_params:
   16|     27|{
   17|     27|    OSSL_PARAM *p = NULL;
   18|       |
   19|     27|    p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_BLOCK_SIZE);
  ------------------
  |  |  195|     27|# define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize"
  ------------------
   20|     27|    if (p != NULL && !OSSL_PARAM_set_size_t(p, blksz)) {
  ------------------
  |  Branch (20:9): [True: 27, False: 0]
  |  Branch (20:22): [True: 0, False: 27]
  ------------------
   21|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   22|      0|        return 0;
   23|      0|    }
   24|     27|    p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_SIZE);
  ------------------
  |  |  198|     27|# define OSSL_DIGEST_PARAM_SIZE "size"
  ------------------
   25|     27|    if (p != NULL && !OSSL_PARAM_set_size_t(p, paramsz)) {
  ------------------
  |  Branch (25:9): [True: 27, False: 0]
  |  Branch (25:22): [True: 0, False: 27]
  ------------------
   26|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   27|      0|        return 0;
   28|      0|    }
   29|     27|    p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_XOF);
  ------------------
  |  |  200|     27|# define OSSL_DIGEST_PARAM_XOF "xof"
  ------------------
   30|     27|    if (p != NULL
  ------------------
  |  Branch (30:9): [True: 27, False: 0]
  ------------------
   31|     27|        && !OSSL_PARAM_set_int(p, (flags & PROV_DIGEST_FLAG_XOF) != 0)) {
  ------------------
  |  |   19|     27|#define PROV_DIGEST_FLAG_XOF             0x0001
  ------------------
  |  Branch (31:12): [True: 0, False: 27]
  ------------------
   32|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   33|      0|        return 0;
   34|      0|    }
   35|     27|    p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_ALGID_ABSENT);
  ------------------
  |  |  194|     27|# define OSSL_DIGEST_PARAM_ALGID_ABSENT "algid-absent"
  ------------------
   36|     27|    if (p != NULL
  ------------------
  |  Branch (36:9): [True: 27, False: 0]
  ------------------
   37|     27|        && !OSSL_PARAM_set_int(p, (flags & PROV_DIGEST_FLAG_ALGID_ABSENT) != 0)) {
  ------------------
  |  |   20|     27|#define PROV_DIGEST_FLAG_ALGID_ABSENT    0x0002
  ------------------
  |  Branch (37:12): [True: 0, False: 27]
  ------------------
   38|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   39|      0|        return 0;
   40|      0|    }
   41|     27|    return 1;
   42|     27|}

sha2_prov.c:sha1_set_ctx_params:
   43|  7.33k|{
   44|  7.33k|    const OSSL_PARAM *p;
   45|  7.33k|    SHA_CTX *ctx = (SHA_CTX *)vctx;
   46|       |
   47|  7.33k|    if (ctx == NULL)
  ------------------
  |  Branch (47:9): [True: 0, False: 7.33k]
  ------------------
   48|      0|        return 0;
   49|  7.33k|    if (params == NULL)
  ------------------
  |  Branch (49:9): [True: 7.33k, False: 0]
  ------------------
   50|  7.33k|        return 1;
   51|       |
   52|      0|    p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS);
  ------------------
  |  |  199|      0|# define OSSL_DIGEST_PARAM_SSL3_MS "ssl3-ms"
  ------------------
   53|      0|    if (p != NULL && p->data_type == OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|      0|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (53:9): [True: 0, False: 0]
  |  Branch (53:22): [True: 0, False: 0]
  ------------------
   54|      0|        return ossl_sha1_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET,
  ------------------
  |  |  406|      0|# define         EVP_CTRL_SSL3_MASTER_SECRET             0x1d
  ------------------
   55|      0|                              p->data_size, p->data);
   56|      0|    return 1;
   57|      0|}

sha3_prov.c:generic_sha3_absorb:
  124|      2|{
  125|      2|    KECCAK1600_CTX *ctx = vctx;
  126|       |
  127|      2|    return SHA3_absorb(ctx->A, inp, len, ctx->block_size);
  128|      2|}
sha3_prov.c:generic_sha3_final:
  131|      2|{
  132|      2|    return ossl_sha3_final(md, (KECCAK1600_CTX *)vctx);
  133|      2|}
sha3_prov.c:keccak_update:
   69|      2|{
   70|      2|    KECCAK1600_CTX *ctx = vctx;
   71|      2|    const size_t bsz = ctx->block_size;
   72|      2|    size_t num, rem;
   73|       |
   74|      2|    if (len == 0)
  ------------------
  |  Branch (74:9): [True: 0, False: 2]
  ------------------
   75|      0|        return 1;
   76|       |
   77|       |    /* Is there anything in the buffer already ? */
   78|      2|    if ((num = ctx->bufsz) != 0) {
  ------------------
  |  Branch (78:9): [True: 0, False: 2]
  ------------------
   79|       |        /* Calculate how much space is left in the buffer */
   80|      0|        rem = bsz - num;
   81|       |        /* If the new input does not fill the buffer then just add it */
   82|      0|        if (len < rem) {
  ------------------
  |  Branch (82:13): [True: 0, False: 0]
  ------------------
   83|      0|            memcpy(ctx->buf + num, inp, len);
   84|      0|            ctx->bufsz += len;
   85|      0|            return 1;
   86|      0|        }
   87|       |        /* otherwise fill up the buffer and absorb the buffer */
   88|      0|        memcpy(ctx->buf + num, inp, rem);
   89|       |        /* Update the input pointer */
   90|      0|        inp += rem;
   91|      0|        len -= rem;
   92|      0|        ctx->meth.absorb(ctx, ctx->buf, bsz);
   93|      0|        ctx->bufsz = 0;
   94|      0|    }
   95|       |    /* Absorb the input - rem = leftover part of the input < blocksize) */
   96|      2|    rem = ctx->meth.absorb(ctx, inp, len);
   97|       |    /* Copy the leftover bit of the input into the buffer */
   98|      2|    if (rem) {
  ------------------
  |  Branch (98:9): [True: 2, False: 0]
  ------------------
   99|      2|        memcpy(ctx->buf, inp + len - rem, rem);
  100|      2|        ctx->bufsz = rem;
  101|      2|    }
  102|      2|    return 1;
  103|      2|}
sha3_prov.c:keccak_final:
  107|      2|{
  108|      2|    int ret = 1;
  109|      2|    KECCAK1600_CTX *ctx = vctx;
  110|       |
  111|      2|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (111:9): [True: 0, False: 2]
  ------------------
  112|      0|        return 0;
  113|      2|    if (outsz > 0)
  ------------------
  |  Branch (113:9): [True: 2, False: 0]
  ------------------
  114|      2|        ret = ctx->meth.final(out, ctx);
  115|       |
  116|      2|    *outl = ctx->md_size;
  117|      2|    return ret;
  118|      2|}
sha3_prov.c:keccak_freectx:
  343|      2|{
  344|      2|    KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx;
  345|       |
  346|      2|    OPENSSL_clear_free(ctx,  sizeof(*ctx));
  ------------------
  |  |  105|      2|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  347|      2|}
sha3_prov.c:keccak_init:
   54|      2|{
   55|      2|    if (!ossl_prov_is_running())
  ------------------
  |  Branch (55:9): [True: 0, False: 2]
  ------------------
   56|      0|        return 0;
   57|       |    /* The newctx() handles most of the ctx fixed setup. */
   58|      2|    ossl_sha3_reset((KECCAK1600_CTX *)vctx);
   59|      2|    return 1;
   60|      2|}
sha3_prov.c:keccak_init_params:
   63|      2|{
   64|      2|    return keccak_init(vctx, NULL)
  ------------------
  |  Branch (64:12): [True: 2, False: 0]
  ------------------
   65|      2|            && shake_set_ctx_params(vctx, params);
  ------------------
  |  Branch (65:16): [True: 2, False: 0]
  ------------------
   66|      2|}
sha3_prov.c:shake_set_ctx_params:
  371|      4|{
  372|      4|    const OSSL_PARAM *p;
  373|      4|    KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx;
  374|       |
  375|      4|    if (ctx == NULL)
  ------------------
  |  Branch (375:9): [True: 0, False: 4]
  ------------------
  376|      0|        return 0;
  377|      4|    if (params == NULL)
  ------------------
  |  Branch (377:9): [True: 2, False: 2]
  ------------------
  378|      2|        return 1;
  379|       |
  380|      2|    p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_XOFLEN);
  ------------------
  |  |  201|      2|# define OSSL_DIGEST_PARAM_XOFLEN "xoflen"
  ------------------
  381|      2|    if (p != NULL && !OSSL_PARAM_get_size_t(p, &ctx->md_size)) {
  ------------------
  |  Branch (381:9): [True: 2, False: 0]
  |  Branch (381:22): [True: 0, False: 2]
  ------------------
  382|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  383|      0|        return 0;
  384|      0|    }
  385|      2|    return 1;
  386|      2|}
sha3_prov.c:shake_256_newctx:
  293|      2|static void *name##_newctx(void *provctx)                                      \
  294|      2|{                                                                              \
  295|      2|    KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (295:27): [True: 2, False: 0]
  ------------------
  296|      2|                                                : NULL;                        \
  297|      2|                                                                               \
  298|      2|    if (ctx == NULL)                                                           \
  ------------------
  |  Branch (298:9): [True: 0, False: 2]
  ------------------
  299|      2|        return NULL;                                                           \
  300|      2|    ossl_sha3_init(ctx, pad, bitlen);                                          \
  301|      2|    SHA3_SET_MD(uname, typ)                                                    \
  ------------------
  |  |  287|      2|# define SHA3_SET_MD(uname, typ) ctx->meth = sha3_generic_md;
  ------------------
  302|      2|    return ctx;                                                                \
  303|      2|}

decode_der2key.c:PrivateKeyInfo_der2dh_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:der2key_newctx:
  129|   266k|{
  130|   266k|    struct der2key_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|   266k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   266k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   266k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  131|       |
  132|   266k|    if (ctx != NULL) {
  ------------------
  |  Branch (132:9): [True: 266k, False: 0]
  ------------------
  133|   266k|        ctx->provctx = provctx;
  134|   266k|        ctx->desc = desc;
  135|   266k|    }
  136|   266k|    return ctx;
  137|   266k|}
decode_der2key.c:dh_d2i_PKCS8:
  367|  14.5k|{
  368|  14.5k|    return der2key_decode_p8(der, der_len, ctx,
  369|  14.5k|                             (key_from_pkcs8_t *)ossl_dh_key_from_pkcs8);
  370|  14.5k|}
decode_der2key.c:der2key_decode_p8:
  105|  81.3k|{
  106|  81.3k|    PKCS8_PRIV_KEY_INFO *p8inf = NULL;
  107|  81.3k|    const X509_ALGOR *alg = NULL;
  108|  81.3k|    void *key = NULL;
  109|       |
  110|  81.3k|    if ((p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, input_der, input_der_len)) != NULL
  ------------------
  |  Branch (110:9): [True: 800, False: 80.5k]
  ------------------
  111|  81.3k|        && PKCS8_pkey_get0(NULL, NULL, NULL, &alg, p8inf)
  ------------------
  |  Branch (111:12): [True: 800, False: 0]
  ------------------
  112|  81.3k|        && OBJ_obj2nid(alg->algorithm) == ctx->desc->evp_type)
  ------------------
  |  Branch (112:12): [True: 571, False: 229]
  ------------------
  113|    571|        key = key_from_pkcs8(p8inf, PROV_LIBCTX_OF(ctx->provctx), ctx->propq);
  ------------------
  |  |   29|    571|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  114|  81.3k|    PKCS8_PRIV_KEY_INFO_free(p8inf);
  115|       |
  116|  81.3k|    return key;
  117|  81.3k|}
decode_der2key.c:dh_adjust:
  377|     86|{
  378|     86|    ossl_dh_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
  ------------------
  |  |   29|     86|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  379|     86|}
decode_der2key.c:der2key_freectx:
  162|   266k|{
  163|   266k|    struct der2key_ctx_st *ctx = vctx;
  164|       |
  165|   266k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|   266k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   266k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   266k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  166|   266k|}
decode_der2key.c:PrivateKeyInfo_der2dh_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:der2key_check_selection:
  170|  8.84k|{
  171|       |    /*
  172|       |     * The selections are kinda sorta "levels", i.e. each selection given
  173|       |     * here is assumed to include those following.
  174|       |     */
  175|  8.84k|    int checks[] = {
  176|  8.84k|        OSSL_KEYMGMT_SELECT_PRIVATE_KEY,
  ------------------
  |  |  542|  8.84k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  177|  8.84k|        OSSL_KEYMGMT_SELECT_PUBLIC_KEY,
  ------------------
  |  |  543|  8.84k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  178|  8.84k|        OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
  ------------------
  |  |  549|  8.84k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  ------------------
  |  |  |  |  544|  8.84k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  |  |  550|  8.84k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  545|  8.84k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  ------------------
  ------------------
  179|  8.84k|    };
  180|  8.84k|    size_t i;
  181|       |
  182|       |    /* The decoder implementations made here support guessing */
  183|  8.84k|    if (selection == 0)
  ------------------
  |  Branch (183:9): [True: 0, False: 8.84k]
  ------------------
  184|      0|        return 1;
  185|       |
  186|  16.8k|    for (i = 0; i < OSSL_NELEM(checks); i++) {
  ------------------
  |  |   14|  16.8k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (186:17): [True: 16.8k, False: 0]
  ------------------
  187|  16.8k|        int check1 = (selection & checks[i]) != 0;
  188|  16.8k|        int check2 = (desc->selection_mask & checks[i]) != 0;
  189|       |
  190|       |        /*
  191|       |         * If the caller asked for the currently checked bit(s), return
  192|       |         * whether the decoder description says it's supported.
  193|       |         */
  194|  16.8k|        if (check1)
  ------------------
  |  Branch (194:13): [True: 8.84k, False: 7.98k]
  ------------------
  195|  8.84k|            return check2;
  196|  16.8k|    }
  197|       |
  198|       |    /* This should be dead code, but just to be safe... */
  199|      0|    return 0;
  200|  8.84k|}
decode_der2key.c:der2key_decode:
  205|   220k|{
  206|   220k|    struct der2key_ctx_st *ctx = vctx;
  207|   220k|    unsigned char *der = NULL;
  208|   220k|    const unsigned char *derp;
  209|   220k|    long der_len = 0;
  210|   220k|    void *key = NULL;
  211|   220k|    int ok = 0;
  212|       |
  213|   220k|    ctx->selection = selection;
  214|       |    /*
  215|       |     * The caller is allowed to specify 0 as a selection mark, to have the
  216|       |     * structure and key type guessed.  For type-specific structures, this
  217|       |     * is not recommended, as some structures are very similar.
  218|       |     * Note that 0 isn't the same as OSSL_KEYMGMT_SELECT_ALL, as the latter
  219|       |     * signifies a private key structure, where everything else is assumed
  220|       |     * to be present as well.
  221|       |     */
  222|   220k|    if (selection == 0)
  ------------------
  |  Branch (222:9): [True: 0, False: 220k]
  ------------------
  223|      0|        selection = ctx->desc->selection_mask;
  224|   220k|    if ((selection & ctx->desc->selection_mask) == 0) {
  ------------------
  |  Branch (224:9): [True: 0, False: 220k]
  ------------------
  225|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  226|      0|        return 0;
  227|      0|    }
  228|       |
  229|   220k|    ok = ossl_read_der(ctx->provctx, cin, &der, &der_len);
  230|   220k|    if (!ok)
  ------------------
  |  Branch (230:9): [True: 51.5k, False: 168k]
  ------------------
  231|  51.5k|        goto next;
  232|       |
  233|   168k|    ok = 0; /* Assume that we fail */
  234|       |
  235|   168k|    ERR_set_mark();
  236|   168k|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|   168k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (236:9): [True: 132k, False: 36.5k]
  ------------------
  237|   132k|        derp = der;
  238|   132k|        if (ctx->desc->d2i_PKCS8 != NULL) {
  ------------------
  |  Branch (238:13): [True: 81.3k, False: 51.0k]
  ------------------
  239|  81.3k|            key = ctx->desc->d2i_PKCS8(NULL, &derp, der_len, ctx);
  240|  81.3k|            if (ctx->flag_fatal) {
  ------------------
  |  Branch (240:17): [True: 0, False: 81.3k]
  ------------------
  241|      0|                ERR_clear_last_mark();
  242|      0|                goto end;
  243|      0|            }
  244|  81.3k|        } else if (ctx->desc->d2i_private_key != NULL) {
  ------------------
  |  Branch (244:20): [True: 51.0k, False: 0]
  ------------------
  245|  51.0k|            key = ctx->desc->d2i_private_key(NULL, &derp, der_len);
  246|  51.0k|        }
  247|   132k|        if (key == NULL && ctx->selection != 0) {
  ------------------
  |  Branch (247:13): [True: 130k, False: 1.97k]
  |  Branch (247:28): [True: 130k, False: 0]
  ------------------
  248|   130k|            ERR_clear_last_mark();
  249|   130k|            goto next;
  250|   130k|        }
  251|   132k|    }
  252|  38.5k|    if (key == NULL && (selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  543|  36.5k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (252:9): [True: 36.5k, False: 1.97k]
  |  Branch (252:24): [True: 36.5k, False: 0]
  ------------------
  253|  36.5k|        derp = der;
  254|  36.5k|        if (ctx->desc->d2i_PUBKEY != NULL)
  ------------------
  |  Branch (254:13): [True: 32.4k, False: 4.07k]
  ------------------
  255|  32.4k|            key = ctx->desc->d2i_PUBKEY(NULL, &derp, der_len);
  256|  4.07k|        else if (ctx->desc->d2i_public_key != NULL)
  ------------------
  |  Branch (256:18): [True: 4.07k, False: 0]
  ------------------
  257|  4.07k|            key = ctx->desc->d2i_public_key(NULL, &derp, der_len);
  258|  36.5k|        if (key == NULL && ctx->selection != 0) {
  ------------------
  |  Branch (258:13): [True: 23.0k, False: 13.5k]
  |  Branch (258:28): [True: 23.0k, False: 0]
  ------------------
  259|  23.0k|            ERR_clear_last_mark();
  260|  23.0k|            goto next;
  261|  23.0k|        }
  262|  36.5k|    }
  263|  15.5k|    if (key == NULL && (selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0) {
  ------------------
  |  |  549|      0|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  ------------------
  |  |  |  |  544|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  |  |  550|      0|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  545|      0|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  ------------------
  ------------------
  |  Branch (263:9): [True: 0, False: 15.5k]
  |  Branch (263:24): [True: 0, False: 0]
  ------------------
  264|      0|        derp = der;
  265|      0|        if (ctx->desc->d2i_key_params != NULL)
  ------------------
  |  Branch (265:13): [True: 0, False: 0]
  ------------------
  266|      0|            key = ctx->desc->d2i_key_params(NULL, &derp, der_len);
  267|      0|        if (key == NULL && ctx->selection != 0) {
  ------------------
  |  Branch (267:13): [True: 0, False: 0]
  |  Branch (267:28): [True: 0, False: 0]
  ------------------
  268|      0|            ERR_clear_last_mark();
  269|      0|            goto next;
  270|      0|        }
  271|      0|    }
  272|  15.5k|    if (key == NULL)
  ------------------
  |  Branch (272:9): [True: 0, False: 15.5k]
  ------------------
  273|      0|        ERR_clear_last_mark();
  274|  15.5k|    else
  275|  15.5k|        ERR_pop_to_mark();
  276|       |
  277|       |    /*
  278|       |     * Last minute check to see if this was the correct type of key.  This
  279|       |     * should never lead to a fatal error, i.e. the decoding itself was
  280|       |     * correct, it was just an unexpected key type.  This is generally for
  281|       |     * classes of key types that have subtle variants, like RSA-PSS keys as
  282|       |     * opposed to plain RSA keys.
  283|       |     */
  284|  15.5k|    if (key != NULL
  ------------------
  |  Branch (284:9): [True: 15.5k, False: 0]
  ------------------
  285|  15.5k|        && ctx->desc->check_key != NULL
  ------------------
  |  Branch (285:12): [True: 14.9k, False: 608]
  ------------------
  286|  15.5k|        && !ctx->desc->check_key(key, ctx)) {
  ------------------
  |  Branch (286:12): [True: 526, False: 14.4k]
  ------------------
  287|    526|        ctx->desc->free_key(key);
  288|    526|        key = NULL;
  289|    526|    }
  290|       |
  291|  15.5k|    if (key != NULL && ctx->desc->adjust_key != NULL)
  ------------------
  |  Branch (291:9): [True: 15.0k, False: 526]
  |  Branch (291:24): [True: 15.0k, False: 0]
  ------------------
  292|  15.0k|        ctx->desc->adjust_key(key, ctx);
  293|       |
  294|   220k| next:
  295|       |    /*
  296|       |     * Indicated that we successfully decoded something, or not at all.
  297|       |     * Ending up "empty handed" is not an error.
  298|       |     */
  299|   220k|    ok = 1;
  300|       |
  301|       |    /*
  302|       |     * We free memory here so it's not held up during the callback, because
  303|       |     * we know the process is recursive and the allocated chunks of memory
  304|       |     * add up.
  305|       |     */
  306|   220k|    OPENSSL_free(der);
  ------------------
  |  |  107|   220k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   220k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   220k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  307|   220k|    der = NULL;
  308|       |
  309|   220k|    if (key != NULL) {
  ------------------
  |  Branch (309:9): [True: 15.0k, False: 205k]
  ------------------
  310|  15.0k|        OSSL_PARAM params[4];
  311|  15.0k|        int object_type = OSSL_OBJECT_PKEY;
  ------------------
  |  |   29|  15.0k|# define OSSL_OBJECT_PKEY               2 /* EVP_PKEY * */
  ------------------
  312|       |
  313|  15.0k|        params[0] =
  314|  15.0k|            OSSL_PARAM_construct_int(OSSL_OBJECT_PARAM_TYPE, &object_type);
  ------------------
  |  |  314|  15.0k|# define OSSL_OBJECT_PARAM_TYPE "type"
  ------------------
  315|  15.0k|        params[1] =
  316|  15.0k|            OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE,
  ------------------
  |  |  311|  15.0k|# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
  ------------------
  317|  15.0k|                                             (char *)ctx->desc->keytype_name,
  318|  15.0k|                                             0);
  319|       |        /* The address of the key becomes the octet string */
  320|  15.0k|        params[2] =
  321|  15.0k|            OSSL_PARAM_construct_octet_string(OSSL_OBJECT_PARAM_REFERENCE,
  ------------------
  |  |  313|  15.0k|# define OSSL_OBJECT_PARAM_REFERENCE "reference"
  ------------------
  322|  15.0k|                                              &key, sizeof(key));
  323|  15.0k|        params[3] = OSSL_PARAM_construct_end();
  324|       |
  325|  15.0k|        ok = data_cb(params, data_cbarg);
  326|  15.0k|    }
  327|       |
  328|   220k| end:
  329|   220k|    ctx->desc->free_key(key);
  330|   220k|    OPENSSL_free(der);
  ------------------
  |  |  107|   220k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   220k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   220k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  331|       |
  332|   220k|    return ok;
  333|   220k|}
decode_der2key.c:SubjectPublicKeyInfo_der2dh_newctx:
  762|    138|    {                                                                   \
  763|    138|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|    138|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2dh_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:type_specific_params_der2dh_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:DH_der2dh_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2dhx_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2dhx_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2dhx_newctx:
  762|  2.81k|    {                                                                   \
  763|  2.81k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  2.81k|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2dhx_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:type_specific_params_der2dhx_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:DHX_der2dhx_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2dsa_newctx:
  762|  11.5k|    {                                                                   \
  763|  11.5k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.5k|    }                                                                   \
decode_der2key.c:dsa_d2i_PKCS8:
  402|  7.52k|{
  403|  7.52k|    return der2key_decode_p8(der, der_len, ctx,
  404|  7.52k|                             (key_from_pkcs8_t *)ossl_dsa_key_from_pkcs8);
  405|  7.52k|}
decode_der2key.c:dsa_adjust:
  412|    505|{
  413|    505|    ossl_dsa_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
  ------------------
  |  |   29|    505|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  414|    505|}
decode_der2key.c:PrivateKeyInfo_der2dsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2dsa_newctx:
  762|  4.30k|    {                                                                   \
  763|  4.30k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  4.30k|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2dsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:type_specific_der2dsa_newctx:
  762|  15.8k|    {                                                                   \
  763|  15.8k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  15.8k|    }                                                                   \
decode_der2key.c:type_specific_der2dsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:DSA_der2dsa_newctx:
  762|  15.8k|    {                                                                   \
  763|  15.8k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  15.8k|    }                                                                   \
decode_der2key.c:DSA_der2dsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2ec_newctx:
  762|  11.1k|    {                                                                   \
  763|  11.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.1k|    }                                                                   \
decode_der2key.c:ec_d2i_PKCS8:
  427|  7.08k|{
  428|  7.08k|    return der2key_decode_p8(der, der_len, ctx,
  429|  7.08k|                             (key_from_pkcs8_t *)ossl_ec_key_from_pkcs8);
  430|  7.08k|}
decode_der2key.c:ec_check:
  436|  10.9k|{
  437|       |    /* We're trying to be clever by comparing two truths */
  438|       |
  439|  10.9k|    int sm2 = (EC_KEY_get_flags(key) & EC_FLAG_SM2_RANGE) != 0;
  ------------------
  |  |  962|  10.9k|#  define EC_FLAG_SM2_RANGE              0x0004
  ------------------
  440|       |
  441|  10.9k|    return sm2 == (ctx->desc->evp_type == EVP_PKEY_SM2);
  ------------------
  |  |   70|  10.9k|# define EVP_PKEY_SM2    NID_sm2
  |  |  ------------------
  |  |  |  | 1228|  10.9k|#define NID_sm2         1172
  |  |  ------------------
  ------------------
  442|  10.9k|}
decode_der2key.c:ec_adjust:
  445|  10.4k|{
  446|  10.4k|    ossl_ec_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
  ------------------
  |  |   29|  10.4k|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  447|  10.4k|}
decode_der2key.c:PrivateKeyInfo_der2ec_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2ec_newctx:
  762|  17.1k|    {                                                                   \
  763|  17.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  17.1k|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2ec_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:type_specific_no_pub_der2ec_newctx:
  762|  11.1k|    {                                                                   \
  763|  11.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.1k|    }                                                                   \
decode_der2key.c:type_specific_no_pub_der2ec_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:EC_der2ec_newctx:
  762|  11.1k|    {                                                                   \
  763|  11.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.1k|    }                                                                   \
decode_der2key.c:EC_der2ec_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2x25519_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:ecx_d2i_PKCS8:
  457|  30.2k|{
  458|  30.2k|    return der2key_decode_p8(der, der_len, ctx,
  459|  30.2k|                             (key_from_pkcs8_t *)ossl_ecx_key_from_pkcs8);
  460|  30.2k|}
decode_der2key.c:ecx_key_adjust:
  463|     17|{
  464|     17|    ossl_ecx_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
  ------------------
  |  |   29|     17|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  465|     17|}
decode_der2key.c:PrivateKeyInfo_der2x25519_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2x25519_newctx:
  762|      8|    {                                                                   \
  763|      8|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|      8|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2x25519_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2x448_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2x448_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2x448_newctx:
  762|      7|    {                                                                   \
  763|      7|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|      7|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2x448_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2ed25519_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2ed25519_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2ed25519_newctx:
  762|     10|    {                                                                   \
  763|     10|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|     10|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2ed25519_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2ed448_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2ed448_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2ed448_newctx:
  762|      9|    {                                                                   \
  763|      9|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|      9|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2ed448_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2sm2_newctx:
  762|  11.1k|    {                                                                   \
  763|  11.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.1k|    }                                                                   \
decode_der2key.c:sm2_d2i_PKCS8:
  516|  7.61k|{
  517|  7.61k|    return der2key_decode_p8(der, der_len, ctx,
  518|  7.61k|                             (key_from_pkcs8_t *)ossl_ec_key_from_pkcs8);
  519|  7.61k|}
decode_der2key.c:PrivateKeyInfo_der2sm2_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2sm2_newctx:
  762|  17.1k|    {                                                                   \
  763|  17.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  17.1k|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2sm2_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:type_specific_no_pub_der2sm2_newctx:
  762|  11.1k|    {                                                                   \
  763|  11.1k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.1k|    }                                                                   \
decode_der2key.c:type_specific_no_pub_der2sm2_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2rsa_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:rsa_d2i_PKCS8:
  537|  14.2k|{
  538|  14.2k|    return der2key_decode_p8(der, der_len, ctx,
  539|  14.2k|                             (key_from_pkcs8_t *)ossl_rsa_key_from_pkcs8);
  540|  14.2k|}
decode_der2key.c:rsa_check:
  546|  3.98k|{
  547|  3.98k|    switch (RSA_test_flags(key, RSA_FLAG_TYPE_MASK)) {
  ------------------
  |  |  117|  3.98k|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  |  Branch (547:13): [True: 0, False: 3.98k]
  ------------------
  548|    510|    case RSA_FLAG_TYPE_RSA:
  ------------------
  |  |  118|    510|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
  |  Branch (548:5): [True: 510, False: 3.47k]
  ------------------
  549|    510|        return ctx->desc->evp_type == EVP_PKEY_RSA;
  ------------------
  |  |   59|    510|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|    510|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
  550|  3.47k|    case RSA_FLAG_TYPE_RSASSAPSS:
  ------------------
  |  |  119|  3.47k|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (550:5): [True: 3.47k, False: 510]
  ------------------
  551|  3.47k|        return ctx->desc->evp_type == EVP_PKEY_RSA_PSS;
  ------------------
  |  |   61|  3.47k|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|  3.47k|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  552|  3.98k|    }
  553|       |
  554|       |    /* Currently unsupported RSA key type */
  555|      0|    return 0;
  556|  3.98k|}
decode_der2key.c:rsa_adjust:
  559|  3.98k|{
  560|  3.98k|    ossl_rsa_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
  ------------------
  |  |   29|  3.98k|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
  561|  3.98k|}
decode_der2key.c:PrivateKeyInfo_der2rsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2rsa_newctx:
  762|  3.76k|    {                                                                   \
  763|  3.76k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  3.76k|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2rsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:type_specific_keypair_der2rsa_newctx:
  762|  14.8k|    {                                                                   \
  763|  14.8k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  14.8k|    }                                                                   \
decode_der2key.c:type_specific_keypair_der2rsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:RSA_der2rsa_newctx:
  762|  14.8k|    {                                                                   \
  763|  14.8k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  14.8k|    }                                                                   \
decode_der2key.c:RSA_der2rsa_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2rsapss_newctx:
  762|  11.0k|    {                                                                   \
  763|  11.0k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  11.0k|    }                                                                   \
decode_der2key.c:PrivateKeyInfo_der2rsapss_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2rsapss_newctx:
  762|  4.28k|    {                                                                   \
  763|  4.28k|        return der2key_newctx(provctx, &kind##_##keytype##_desc);       \
  764|  4.28k|    }                                                                   \
decode_der2key.c:SubjectPublicKeyInfo_der2rsapss_does_selection:
  767|    268|    {                                                                   \
  768|    268|        return der2key_check_selection(selection,                       \
  769|    268|                                       &kind##_##keytype##_desc);       \
  770|    268|    }                                                                   \

decode_epki2pki.c:epki2pki_newctx:
   41|  44.2k|{
   42|  44.2k|    struct epki2pki_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  44.2k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   43|       |
   44|  44.2k|    if (ctx != NULL)
  ------------------
  |  Branch (44:9): [True: 44.2k, False: 0]
  ------------------
   45|  44.2k|        ctx->provctx = provctx;
   46|  44.2k|    return ctx;
   47|  44.2k|}
decode_epki2pki.c:epki2pki_freectx:
   50|  44.2k|{
   51|  44.2k|    struct epki2pki_ctx_st *ctx = vctx;
   52|       |
   53|  44.2k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  44.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   54|  44.2k|}

decode_msblob2key.c:msblob2dsa_newctx:
  268|  15.8k|    {                                                                   \
  269|  15.8k|        return msblob2key_newctx(provctx, &mstype##2##keytype##_desc);  \
  270|  15.8k|    }                                                                   \
decode_msblob2key.c:msblob2key_newctx:
   65|  30.7k|{
   66|  30.7k|    struct msblob2key_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  30.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  30.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  30.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   67|       |
   68|  30.7k|    if (ctx != NULL) {
  ------------------
  |  Branch (68:9): [True: 30.7k, False: 0]
  ------------------
   69|  30.7k|        ctx->provctx = provctx;
   70|  30.7k|        ctx->desc = desc;
   71|  30.7k|    }
   72|  30.7k|    return ctx;
   73|  30.7k|}
decode_msblob2key.c:msblob2key_freectx:
   76|  30.7k|{
   77|  30.7k|    struct msblob2key_ctx_st *ctx = vctx;
   78|       |
   79|  30.7k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  30.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  30.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  30.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   80|  30.7k|}
decode_msblob2key.c:msblob2key_does_selection:
   83|    536|{
   84|    536|    if (selection == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 536]
  ------------------
   85|      0|        return 1;
   86|       |
   87|    536|    if ((selection & (OSSL_KEYMGMT_SELECT_PRIVATE_KEY
  ------------------
  |  |  542|    536|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (87:9): [True: 536, False: 0]
  ------------------
   88|    536|                      | OSSL_KEYMGMT_SELECT_PUBLIC_KEY))  != 0)
  ------------------
  |  |  543|    536|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
   89|    536|        return 1;
   90|       |
   91|      0|    return 0;
   92|    536|}
decode_msblob2key.c:msblob2rsa_newctx:
  268|  14.8k|    {                                                                   \
  269|  14.8k|        return msblob2key_newctx(provctx, &mstype##2##keytype##_desc);  \
  270|  14.8k|    }                                                                   \

decode_pem2der.c:pem2der_newctx:
   58|  44.2k|{
   59|  44.2k|    struct pem2der_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  44.2k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   60|       |
   61|  44.2k|    if (ctx != NULL)
  ------------------
  |  Branch (61:9): [True: 44.2k, False: 0]
  ------------------
   62|  44.2k|        ctx->provctx = provctx;
   63|  44.2k|    return ctx;
   64|  44.2k|}
decode_pem2der.c:pem2der_freectx:
   67|  44.2k|{
   68|  44.2k|    struct pem2der_ctx_st *ctx = vctx;
   69|       |
   70|  44.2k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  44.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   71|  44.2k|}

decode_pvk2key.c:pvk2dsa_newctx:
  262|  11.5k|    {                                                                   \
  263|  11.5k|        return pvk2key_newctx(provctx, &pvk2##keytype##_desc);          \
  264|  11.5k|    }                                                                   \
decode_pvk2key.c:pvk2key_newctx:
   69|  22.6k|{
   70|  22.6k|    struct pvk2key_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  22.6k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  22.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  22.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   71|       |
   72|  22.6k|    if (ctx != NULL) {
  ------------------
  |  Branch (72:9): [True: 22.6k, False: 0]
  ------------------
   73|  22.6k|        ctx->provctx = provctx;
   74|  22.6k|        ctx->desc = desc;
   75|  22.6k|    }
   76|  22.6k|    return ctx;
   77|  22.6k|}
decode_pvk2key.c:pvk2key_freectx:
   80|  22.6k|{
   81|  22.6k|    struct pvk2key_ctx_st *ctx = vctx;
   82|       |
   83|  22.6k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  22.6k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  22.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  22.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   84|  22.6k|}
decode_pvk2key.c:pvk2key_does_selection:
  109|    536|{
  110|    536|    if (selection == 0)
  ------------------
  |  Branch (110:9): [True: 0, False: 536]
  ------------------
  111|      0|        return 1;
  112|       |
  113|    536|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY)  != 0)
  ------------------
  |  |  542|    536|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (113:9): [True: 52, False: 484]
  ------------------
  114|     52|        return 1;
  115|       |
  116|    484|    return 0;
  117|    536|}
decode_pvk2key.c:pvk2rsa_newctx:
  262|  11.0k|    {                                                                   \
  263|  11.0k|        return pvk2key_newctx(provctx, &pvk2##keytype##_desc);          \
  264|  11.0k|    }                                                                   \

decode_spki2typespki.c:spki2typespki_newctx:
   39|  44.2k|{
   40|  44.2k|    struct spki2typespki_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  44.2k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   41|       |
   42|  44.2k|    if (ctx != NULL)
  ------------------
  |  Branch (42:9): [True: 44.2k, False: 0]
  ------------------
   43|  44.2k|        ctx->provctx = provctx;
   44|  44.2k|    return ctx;
   45|  44.2k|}
decode_spki2typespki.c:spki2typespki_freectx:
   48|  44.2k|{
   49|  44.2k|    struct spki2typespki_ctx_st *ctx = vctx;
   50|       |
   51|  44.2k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  44.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  44.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  44.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   52|  44.2k|}
decode_spki2typespki.c:spki2typespki_decode:
   79|  44.1k|{
   80|  44.1k|    struct spki2typespki_ctx_st *ctx = vctx;
   81|  44.1k|    unsigned char *der, *derp;
   82|  44.1k|    long len;
   83|  44.1k|    int ok = 0;
   84|  44.1k|    int objtype = OSSL_OBJECT_PKEY;
  ------------------
  |  |   29|  44.1k|# define OSSL_OBJECT_PKEY               2 /* EVP_PKEY * */
  ------------------
   85|  44.1k|    X509_PUBKEY *xpub = NULL;
   86|  44.1k|    X509_ALGOR *algor = NULL;
   87|  44.1k|    const ASN1_OBJECT *oid = NULL;
   88|  44.1k|    char dataname[OSSL_MAX_NAME_SIZE];
   89|  44.1k|    OSSL_PARAM params[5], *p = params;
   90|       |
   91|  44.1k|    if (!ossl_read_der(ctx->provctx, cin, &der, &len))
  ------------------
  |  Branch (91:9): [True: 2.87k, False: 41.3k]
  ------------------
   92|  2.87k|        return 1;
   93|  41.3k|    derp = der;
   94|  41.3k|    xpub = ossl_d2i_X509_PUBKEY_INTERNAL((const unsigned char **)&derp, len,
   95|  41.3k|                                         PROV_LIBCTX_OF(ctx->provctx),
  ------------------
  |  |   29|  41.3k|    ossl_prov_ctx_get0_libctx((provctx))
  ------------------
   96|  41.3k|                                         ctx->propq);
   97|       |
   98|  41.3k|    if (xpub == NULL) {
  ------------------
  |  Branch (98:9): [True: 10.2k, False: 31.0k]
  ------------------
   99|       |        /* We return "empty handed".  This is not an error. */
  100|  10.2k|        ok = 1;
  101|  10.2k|        goto end;
  102|  10.2k|    }
  103|       |
  104|  31.0k|    if (!X509_PUBKEY_get0_param(NULL, NULL, NULL, &algor, xpub))
  ------------------
  |  Branch (104:9): [True: 0, False: 31.0k]
  ------------------
  105|      0|        goto end;
  106|  31.0k|    X509_ALGOR_get0(&oid, NULL, NULL, algor);
  107|       |
  108|  31.0k|#ifndef OPENSSL_NO_EC
  109|       |    /* SM2 abuses the EC oid, so this could actually be SM2 */
  110|  31.0k|    if (OBJ_obj2nid(oid) == NID_X9_62_id_ecPublicKey
  ------------------
  |  |  178|  62.1k|#define NID_X9_62_id_ecPublicKey                408
  ------------------
  |  Branch (110:9): [True: 17.6k, False: 13.4k]
  ------------------
  111|  31.0k|            && ossl_x509_algor_is_sm2(algor))
  ------------------
  |  Branch (111:16): [True: 10, False: 17.6k]
  ------------------
  112|     10|        strcpy(dataname, "SM2");
  113|  31.0k|    else
  114|  31.0k|#endif
  115|  31.0k|    if (OBJ_obj2txt(dataname, sizeof(dataname), oid, 0) <= 0)
  ------------------
  |  Branch (115:9): [True: 0, False: 31.0k]
  ------------------
  116|      0|        goto end;
  117|       |
  118|  31.0k|    ossl_X509_PUBKEY_INTERNAL_free(xpub);
  119|  31.0k|    xpub = NULL;
  120|       |
  121|  31.0k|    *p++ =
  122|  31.0k|        OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE,
  ------------------
  |  |  311|  31.0k|# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
  ------------------
  123|  31.0k|                                            dataname, 0);
  124|       |
  125|  31.0k|    *p++ =
  126|  31.0k|        OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_STRUCTURE,
  ------------------
  |  |  310|  31.0k|# define OSSL_OBJECT_PARAM_DATA_STRUCTURE "data-structure"
  ------------------
  127|  31.0k|                                            "SubjectPublicKeyInfo",
  128|  31.0k|                                            0);
  129|  31.0k|    *p++ =
  130|  31.0k|        OSSL_PARAM_construct_octet_string(OSSL_OBJECT_PARAM_DATA, der, len);
  ------------------
  |  |  309|  31.0k|# define OSSL_OBJECT_PARAM_DATA "data"
  ------------------
  131|  31.0k|    *p++ =
  132|  31.0k|        OSSL_PARAM_construct_int(OSSL_OBJECT_PARAM_TYPE, &objtype);
  ------------------
  |  |  314|  31.0k|# define OSSL_OBJECT_PARAM_TYPE "type"
  ------------------
  133|       |
  134|  31.0k|    *p = OSSL_PARAM_construct_end();
  135|       |
  136|  31.0k|    ok = data_cb(params, data_cbarg);
  137|       |
  138|  41.3k| end:
  139|  41.3k|    ossl_X509_PUBKEY_INTERNAL_free(xpub);
  140|  41.3k|    OPENSSL_free(der);
  ------------------
  |  |  107|  41.3k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  41.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  41.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  141|  41.3k|    return ok;
  142|  31.0k|}

encode_key2any.c:key2any_newctx:
  936|  28.2k|{
  937|  28.2k|    struct key2any_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  28.2k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  28.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  28.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  938|       |
  939|  28.2k|    if (ctx != NULL) {
  ------------------
  |  Branch (939:9): [True: 28.2k, False: 0]
  ------------------
  940|  28.2k|        ctx->provctx = provctx;
  941|  28.2k|        ctx->save_parameters = 1;
  942|  28.2k|    }
  943|       |
  944|  28.2k|    return ctx;
  945|  28.2k|}
encode_key2any.c:key2any_freectx:
  948|  28.2k|{
  949|  28.2k|    struct key2any_ctx_st *ctx = vctx;
  950|       |
  951|  28.2k|    ossl_pw_clear_passphrase_data(&ctx->pwdata);
  952|  28.2k|    EVP_CIPHER_free(ctx->cipher);
  953|  28.2k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  28.2k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  28.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  28.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  954|  28.2k|}
encode_key2any.c:key2any_set_ctx_params:
  968|  28.2k|{
  969|  28.2k|    struct key2any_ctx_st *ctx = vctx;
  970|  28.2k|    OSSL_LIB_CTX *libctx = ossl_prov_ctx_get0_libctx(ctx->provctx);
  971|  28.2k|    const OSSL_PARAM *cipherp =
  972|  28.2k|        OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_CIPHER);
  ------------------
  |  |  223|  28.2k|# define OSSL_ENCODER_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
  |  |  ------------------
  |  |  |  |  112|  28.2k|# define OSSL_ALG_PARAM_CIPHER "cipher"
  |  |  ------------------
  ------------------
  973|  28.2k|    const OSSL_PARAM *propsp =
  974|  28.2k|        OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_PROPERTIES);
  ------------------
  |  |  225|  28.2k|# define OSSL_ENCODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
  |  |  ------------------
  |  |  |  |  116|  28.2k|# define OSSL_ALG_PARAM_PROPERTIES "properties"
  |  |  ------------------
  ------------------
  975|  28.2k|    const OSSL_PARAM *save_paramsp =
  976|  28.2k|        OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_SAVE_PARAMETERS);
  ------------------
  |  |  226|  28.2k|# define OSSL_ENCODER_PARAM_SAVE_PARAMETERS "save-parameters"
  ------------------
  977|       |
  978|  28.2k|    if (cipherp != NULL) {
  ------------------
  |  Branch (978:9): [True: 0, False: 28.2k]
  ------------------
  979|      0|        const char *ciphername = NULL;
  980|      0|        const char *props = NULL;
  981|       |
  982|      0|        if (!OSSL_PARAM_get_utf8_string_ptr(cipherp, &ciphername))
  ------------------
  |  Branch (982:13): [True: 0, False: 0]
  ------------------
  983|      0|            return 0;
  984|      0|        if (propsp != NULL && !OSSL_PARAM_get_utf8_string_ptr(propsp, &props))
  ------------------
  |  Branch (984:13): [True: 0, False: 0]
  |  Branch (984:31): [True: 0, False: 0]
  ------------------
  985|      0|            return 0;
  986|       |
  987|      0|        EVP_CIPHER_free(ctx->cipher);
  988|      0|        ctx->cipher = NULL;
  989|      0|        ctx->cipher_intent = ciphername != NULL;
  990|      0|        if (ciphername != NULL
  ------------------
  |  Branch (990:13): [True: 0, False: 0]
  ------------------
  991|      0|            && ((ctx->cipher =
  ------------------
  |  Branch (991:16): [True: 0, False: 0]
  ------------------
  992|      0|                 EVP_CIPHER_fetch(libctx, ciphername, props)) == NULL))
  993|      0|            return 0;
  994|      0|    }
  995|       |
  996|  28.2k|    if (save_paramsp != NULL) {
  ------------------
  |  Branch (996:9): [True: 28.2k, False: 0]
  ------------------
  997|  28.2k|        if (!OSSL_PARAM_get_int(save_paramsp, &ctx->save_parameters))
  ------------------
  |  Branch (997:13): [True: 0, False: 28.2k]
  ------------------
  998|      0|            return 0;
  999|  28.2k|    }
 1000|  28.2k|    return 1;
 1001|  28.2k|}
encode_key2any.c:rsa_to_type_specific_keypair_der_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:key2any_check_selection:
 1004|  73.8k|{
 1005|       |    /*
 1006|       |     * The selections are kinda sorta "levels", i.e. each selection given
 1007|       |     * here is assumed to include those following.
 1008|       |     */
 1009|  73.8k|    int checks[] = {
 1010|  73.8k|        OSSL_KEYMGMT_SELECT_PRIVATE_KEY,
  ------------------
  |  |  542|  73.8k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
 1011|  73.8k|        OSSL_KEYMGMT_SELECT_PUBLIC_KEY,
  ------------------
  |  |  543|  73.8k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
 1012|  73.8k|        OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
  ------------------
  |  |  549|  73.8k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  ------------------
  |  |  |  |  544|  73.8k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  |  |  550|  73.8k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  545|  73.8k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  ------------------
  ------------------
 1013|  73.8k|    };
 1014|  73.8k|    size_t i;
 1015|       |
 1016|       |    /* The decoder implementations made here support guessing */
 1017|  73.8k|    if (selection == 0)
  ------------------
  |  Branch (1017:9): [True: 0, False: 73.8k]
  ------------------
 1018|      0|        return 1;
 1019|       |
 1020|  73.8k|    for (i = 0; i < OSSL_NELEM(checks); i++) {
  ------------------
  |  |   14|  73.8k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (1020:17): [True: 73.8k, False: 0]
  ------------------
 1021|  73.8k|        int check1 = (selection & checks[i]) != 0;
 1022|  73.8k|        int check2 = (selection_mask & checks[i]) != 0;
 1023|       |
 1024|       |        /*
 1025|       |         * If the caller asked for the currently checked bit(s), return
 1026|       |         * whether the decoder description says it's supported.
 1027|       |         */
 1028|  73.8k|        if (check1)
  ------------------
  |  Branch (1028:13): [True: 73.8k, False: 0]
  ------------------
 1029|  73.8k|            return check2;
 1030|  73.8k|    }
 1031|       |
 1032|       |    /* This should be dead code, but just to be safe... */
 1033|      0|    return 0;
 1034|  73.8k|}
encode_key2any.c:rsa_to_type_specific_keypair_der_encode:
 1270|    362|    {                                                                       \
 1271|    362|        /* We don't deal with abstract objects */                           \
 1272|    362|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 362]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|    362|        DO_##kind(impl, type, output)                                       \
 1277|    362|                                                                            \
 1278|    362|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|    362|    }                                                                       \
encode_key2any.c:key2any_encode:
 1043|  1.60k|{
 1044|  1.60k|    int ret = 0;
 1045|       |
 1046|  1.60k|    if (key == NULL) {
  ------------------
  |  Branch (1046:9): [True: 0, False: 1.60k]
  ------------------
 1047|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1048|  1.60k|    } else if (writer != NULL
  ------------------
  |  Branch (1048:16): [True: 1.60k, False: 0]
  ------------------
 1049|  1.60k|               && (checker == NULL || checker(key, type))) {
  ------------------
  |  Branch (1049:20): [True: 1.21k, False: 388]
  |  Branch (1049:39): [True: 388, False: 0]
  ------------------
 1050|  1.60k|        BIO *out = ossl_bio_new_from_core_bio(ctx->provctx, cout);
 1051|       |
 1052|  1.60k|        if (out != NULL
  ------------------
  |  Branch (1052:13): [True: 1.60k, False: 0]
  ------------------
 1053|  1.60k|            && (pwcb == NULL
  ------------------
  |  Branch (1053:17): [True: 0, False: 1.60k]
  ------------------
 1054|  1.60k|                || ossl_pw_set_ossl_passphrase_cb(&ctx->pwdata, pwcb, pwcbarg)))
  ------------------
  |  Branch (1054:20): [True: 1.60k, False: 0]
  ------------------
 1055|  1.60k|            ret =
 1056|  1.60k|                writer(out, key, type, pemname, key2paramstring, key2der, ctx);
 1057|       |
 1058|  1.60k|        BIO_free(out);
 1059|  1.60k|    } else {
 1060|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1061|      0|    }
 1062|  1.60k|    return ret;
 1063|  1.60k|}
encode_key2any.c:rsa_check_key_type:
  911|    363|{
  912|    363|    switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
  ------------------
  |  |  117|    363|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  |  Branch (912:13): [True: 0, False: 363]
  ------------------
  913|    362|    case RSA_FLAG_TYPE_RSA:
  ------------------
  |  |  118|    362|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
  |  Branch (913:5): [True: 362, False: 1]
  ------------------
  914|    362|        return expected_type == EVP_PKEY_RSA;
  ------------------
  |  |   59|    362|# define EVP_PKEY_RSA    NID_rsaEncryption
  |  |  ------------------
  |  |  |  |  543|    362|#define NID_rsaEncryption               6
  |  |  ------------------
  ------------------
  915|      1|    case RSA_FLAG_TYPE_RSASSAPSS:
  ------------------
  |  |  119|      1|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (915:5): [True: 1, False: 362]
  ------------------
  916|      1|        return expected_type == EVP_PKEY_RSA_PSS;
  ------------------
  |  |   61|      1|# define EVP_PKEY_RSA_PSS NID_rsassaPss
  |  |  ------------------
  |  |  |  |  583|      1|#define NID_rsassaPss           912
  |  |  ------------------
  ------------------
  917|    363|    }
  918|       |
  919|       |    /* Currently unsupported RSA key type */
  920|      0|    return EVP_PKEY_NONE;
  ------------------
  |  |   58|      0|# define EVP_PKEY_NONE   NID_undef
  |  |  ------------------
  |  |  |  |   18|      0|#define NID_undef                       0
  |  |  ------------------
  ------------------
  921|    363|}
encode_key2any.c:key_to_type_specific_der_bio:
  377|  1.41k|{
  378|  1.41k|    unsigned char *der = NULL;
  379|  1.41k|    int derlen;
  380|  1.41k|    int ret;
  381|       |
  382|  1.41k|    if ((derlen = k2d(key, &der)) <= 0) {
  ------------------
  |  Branch (382:9): [True: 150, False: 1.26k]
  ------------------
  383|    150|        ERR_raise(ERR_LIB_PROV, ERR_R_PROV_LIB);
  ------------------
  |  |  401|    150|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    150|    (ERR_new(),                                                 \
  |  |  |  |  404|    150|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    150|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    150|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    150|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    150|     ERR_set_error)
  |  |  ------------------
  ------------------
  384|    150|        return 0;
  385|    150|    }
  386|       |
  387|  1.26k|    ret = BIO_write(out, der, derlen);
  388|  1.26k|    OPENSSL_free(der);
  ------------------
  |  |  107|  1.26k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.26k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.26k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  389|  1.26k|    return ret > 0;
  390|  1.41k|}
encode_key2any.c:prepare_rsa_params:
  829|      1|{
  830|      1|    const RSA_PSS_PARAMS_30 *pss = ossl_rsa_get0_pss_params_30((RSA *)rsa);
  831|       |
  832|      1|    *pstr = NULL;
  833|       |
  834|      1|    switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
  ------------------
  |  |  117|      1|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  |  Branch (834:13): [True: 0, False: 1]
  ------------------
  835|      0|    case RSA_FLAG_TYPE_RSA:
  ------------------
  |  |  118|      0|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
  |  Branch (835:5): [True: 0, False: 1]
  ------------------
  836|       |        /* If plain RSA, the parameters shall be NULL */
  837|      0|        *pstrtype = V_ASN1_NULL;
  ------------------
  |  |   67|      0|# define V_ASN1_NULL                     5
  ------------------
  838|      0|        return 1;
  839|      1|    case RSA_FLAG_TYPE_RSASSAPSS:
  ------------------
  |  |  119|      1|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (839:5): [True: 1, False: 0]
  ------------------
  840|      1|        if (ossl_rsa_pss_params_30_is_unrestricted(pss)) {
  ------------------
  |  Branch (840:13): [True: 0, False: 1]
  ------------------
  841|      0|            *pstrtype = V_ASN1_UNDEF;
  ------------------
  |  |   60|      0|# define V_ASN1_UNDEF                    -1
  ------------------
  842|      0|            return 1;
  843|      1|        } else {
  844|      1|            ASN1_STRING *astr = NULL;
  845|      1|            WPACKET pkt;
  846|      1|            unsigned char *str = NULL;
  847|      1|            size_t str_sz = 0;
  848|      1|            int i;
  849|       |
  850|      3|            for (i = 0; i < 2; i++) {
  ------------------
  |  Branch (850:25): [True: 2, False: 1]
  ------------------
  851|      2|                switch (i) {
  ------------------
  |  Branch (851:25): [True: 0, False: 2]
  ------------------
  852|      1|                case 0:
  ------------------
  |  Branch (852:17): [True: 1, False: 1]
  ------------------
  853|      1|                    if (!WPACKET_init_null_der(&pkt))
  ------------------
  |  Branch (853:25): [True: 0, False: 1]
  ------------------
  854|      0|                        goto err;
  855|      1|                    break;
  856|      1|                case 1:
  ------------------
  |  Branch (856:17): [True: 1, False: 1]
  ------------------
  857|      1|                    if ((str = OPENSSL_malloc(str_sz)) == NULL
  ------------------
  |  |   97|      1|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (857:25): [True: 0, False: 1]
  ------------------
  858|      1|                        || !WPACKET_init_der(&pkt, str, str_sz)) {
  ------------------
  |  Branch (858:28): [True: 0, False: 1]
  ------------------
  859|      0|                        WPACKET_cleanup(&pkt);
  860|      0|                        goto err;
  861|      0|                    }
  862|      1|                    break;
  863|      2|                }
  864|      2|                if (!ossl_DER_w_RSASSA_PSS_params(&pkt, -1, pss)
  ------------------
  |  Branch (864:21): [True: 0, False: 2]
  ------------------
  865|      2|                    || !WPACKET_finish(&pkt)
  ------------------
  |  Branch (865:24): [True: 0, False: 2]
  ------------------
  866|      2|                    || !WPACKET_get_total_written(&pkt, &str_sz)) {
  ------------------
  |  Branch (866:24): [True: 0, False: 2]
  ------------------
  867|      0|                    WPACKET_cleanup(&pkt);
  868|      0|                    goto err;
  869|      0|                }
  870|      2|                WPACKET_cleanup(&pkt);
  871|       |
  872|       |                /*
  873|       |                 * If no PSS parameters are going to be written, there's no
  874|       |                 * point going for another iteration.
  875|       |                 * This saves us from getting |str| allocated just to have it
  876|       |                 * immediately de-allocated.
  877|       |                 */
  878|      2|                if (str_sz == 0)
  ------------------
  |  Branch (878:21): [True: 0, False: 2]
  ------------------
  879|      0|                    break;
  880|      2|            }
  881|       |
  882|      1|            if ((astr = ASN1_STRING_new()) == NULL)
  ------------------
  |  Branch (882:17): [True: 0, False: 1]
  ------------------
  883|      0|                goto err;
  884|      1|            *pstrtype = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|      1|# define V_ASN1_SEQUENCE                 16
  ------------------
  885|      1|            ASN1_STRING_set0(astr, str, (int)str_sz);
  886|      1|            *pstr = astr;
  887|       |
  888|      1|            return 1;
  889|      0|         err:
  890|      0|            OPENSSL_free(str);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  891|      0|            return 0;
  892|      1|        }
  893|      1|    }
  894|       |
  895|       |    /* Currently unsupported RSA key type */
  896|      0|    return 0;
  897|      1|}
encode_key2any.c:dh_check_key_type:
  529|     25|{
  530|     25|    int type =
  531|     25|        DH_test_flags(dh, DH_FLAG_TYPE_DHX) ? EVP_PKEY_DHX : EVP_PKEY_DH;
  ------------------
  |  |  108|     25|#  define DH_FLAG_TYPE_DHX              0x1000
  ------------------
                      DH_test_flags(dh, DH_FLAG_TYPE_DHX) ? EVP_PKEY_DHX : EVP_PKEY_DH;
  ------------------
  |  |   68|     25|# define EVP_PKEY_DHX    NID_dhpublicnumber
  |  |  ------------------
  |  |  |  | 5295|     25|#define NID_dhpublicnumber              920
  |  |  ------------------
  ------------------
                      DH_test_flags(dh, DH_FLAG_TYPE_DHX) ? EVP_PKEY_DHX : EVP_PKEY_DH;
  ------------------
  |  |   67|      0|# define EVP_PKEY_DH     NID_dhKeyAgreement
  |  |  ------------------
  |  |  |  |  621|      0|#define NID_dhKeyAgreement              28
  |  |  ------------------
  ------------------
  |  Branch (531:9): [True: 25, False: 0]
  ------------------
  532|       |
  533|     25|    return type == expected_type;
  534|     25|}
encode_key2any.c:dhx_to_type_specific_params_der_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dsa_to_type_specific_der_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:dsa_to_type_specific_der_encode:
 1270|    495|    {                                                                       \
 1271|    495|        /* We don't deal with abstract objects */                           \
 1272|    495|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 495]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|    495|        DO_##kind(impl, type, output)                                       \
 1277|    495|                                                                            \
 1278|    495|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|    495|    }                                                                       \
encode_key2any.c:ec_to_type_specific_no_pub_der_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_to_type_specific_no_pub_der_encode:
 1270|    555|    {                                                                       \
 1271|    555|        /* We don't deal with abstract objects */                           \
 1272|    555|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 555]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|    555|        DO_##kind(impl, type, output)                                       \
 1277|    555|                                                                            \
 1278|    555|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|    555|    }                                                                       \
encode_key2any.c:prepare_ec_params:
  670|    150|{
  671|    150|    int curve_nid;
  672|    150|    const EC_GROUP *group = EC_KEY_get0_group(eckey);
  673|    150|    ASN1_OBJECT *params = NULL;
  674|       |
  675|    150|    if (group == NULL)
  ------------------
  |  Branch (675:9): [True: 0, False: 150]
  ------------------
  676|      0|        return 0;
  677|    150|    curve_nid = EC_GROUP_get_curve_name(group);
  678|    150|    if (curve_nid != NID_undef) {
  ------------------
  |  |   18|    150|#define NID_undef                       0
  ------------------
  |  Branch (678:9): [True: 97, False: 53]
  ------------------
  679|     97|        params = OBJ_nid2obj(curve_nid);
  680|     97|        if (params == NULL)
  ------------------
  |  Branch (680:13): [True: 0, False: 97]
  ------------------
  681|      0|            return 0;
  682|     97|    }
  683|       |
  684|    150|    if (curve_nid != NID_undef
  ------------------
  |  |   18|    300|#define NID_undef                       0
  ------------------
  |  Branch (684:9): [True: 97, False: 53]
  ------------------
  685|    150|        && (EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE)) {
  ------------------
  |  |   31|     97|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  |  Branch (685:12): [True: 97, False: 0]
  ------------------
  686|       |        /* The CHOICE came to namedCurve */
  687|     97|        if (OBJ_length(params) == 0) {
  ------------------
  |  Branch (687:13): [True: 0, False: 97]
  ------------------
  688|       |            /* Some curves might not have an associated OID */
  689|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_OID);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  690|      0|            ASN1_OBJECT_free(params);
  691|      0|            return 0;
  692|      0|        }
  693|     97|        *pstr = params;
  694|     97|        *pstrtype = V_ASN1_OBJECT;
  ------------------
  |  |   68|     97|# define V_ASN1_OBJECT                   6
  ------------------
  695|     97|        return 1;
  696|     97|    } else {
  697|       |        /* The CHOICE came to ecParameters */
  698|     53|        return prepare_ec_explicit_params(eckey, pstr, pstrtype);
  699|     53|    }
  700|    150|}
encode_key2any.c:prepare_ec_explicit_params:
  644|     53|{
  645|     53|    ASN1_STRING *params = ASN1_STRING_new();
  646|       |
  647|     53|    if (params == NULL) {
  ------------------
  |  Branch (647:9): [True: 0, False: 53]
  ------------------
  648|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  649|      0|        return 0;
  650|      0|    }
  651|       |
  652|     53|    params->length = i2d_ECParameters(eckey, &params->data);
  653|     53|    if (params->length <= 0) {
  ------------------
  |  Branch (653:9): [True: 0, False: 53]
  ------------------
  654|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  655|      0|        ASN1_STRING_free(params);
  656|      0|        return 0;
  657|      0|    }
  658|       |
  659|     53|    *pstrtype = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|     53|# define V_ASN1_SEQUENCE                 16
  ------------------
  660|     53|    *pstr = params;
  661|     53|    return 1;
  662|     53|}
encode_key2any.c:sm2_to_type_specific_no_pub_der_does_selection:
 1259|     11|    {                                                                       \
 1260|     11|        return key2any_check_selection(selection,                           \
 1261|     11|                                       DO_##kind##_selection_mask);         \
 1262|     11|    }                                                                       \
encode_key2any.c:sm2_to_type_specific_no_pub_der_encode:
 1270|      5|    {                                                                       \
 1271|      5|        /* We don't deal with abstract objects */                           \
 1272|      5|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 5]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      5|        DO_##kind(impl, type, output)                                       \
 1277|      5|                                                                            \
 1278|      5|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      5|    }                                                                       \
encode_key2any.c:rsa_to_type_specific_keypair_pem_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:dhx_to_type_specific_params_pem_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dsa_to_type_specific_pem_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:ec_to_type_specific_no_pub_pem_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:sm2_to_type_specific_no_pub_pem_does_selection:
 1259|     11|    {                                                                       \
 1260|     11|        return key2any_check_selection(selection,                           \
 1261|     11|                                       DO_##kind##_selection_mask);         \
 1262|     11|    }                                                                       \
encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:key_to_p8info:
   83|    185|{
   84|       |    /* der, derlen store the key DER output and its length */
   85|    185|    unsigned char *der = NULL;
   86|    185|    int derlen;
   87|       |    /* The final PKCS#8 info */
   88|    185|    PKCS8_PRIV_KEY_INFO *p8info = NULL;
   89|       |
   90|    185|    if ((p8info = PKCS8_PRIV_KEY_INFO_new()) == NULL
  ------------------
  |  Branch (90:9): [True: 0, False: 185]
  ------------------
   91|    185|        || (derlen = k2d(key, &der)) <= 0
  ------------------
  |  Branch (91:12): [True: 150, False: 35]
  ------------------
   92|    185|        || !PKCS8_pkey_set0(p8info, OBJ_nid2obj(key_nid), 0,
  ------------------
  |  Branch (92:12): [True: 0, False: 35]
  ------------------
   93|    150|                            params_type, params, der, derlen)) {
   94|    150|        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|    150|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|    150|    (ERR_new(),                                                 \
  |  |  |  |  404|    150|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|    150|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|    150|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|    150|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|    150|     ERR_set_error)
  |  |  ------------------
  ------------------
   95|    150|        PKCS8_PRIV_KEY_INFO_free(p8info);
   96|    150|        OPENSSL_free(der);
  ------------------
  |  |  107|    150|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    150|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    150|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   97|    150|        p8info = NULL;
   98|    150|    }
   99|       |
  100|    185|    return p8info;
  101|    185|}
encode_key2any.c:free_asn1_data:
   69|    150|{
   70|    150|    switch (type) {
  ------------------
  |  Branch (70:13): [True: 0, False: 150]
  ------------------
   71|     97|    case V_ASN1_OBJECT:
  ------------------
  |  |   68|     97|# define V_ASN1_OBJECT                   6
  ------------------
  |  Branch (71:5): [True: 97, False: 53]
  ------------------
   72|     97|        ASN1_OBJECT_free(data);
   73|     97|        break;
   74|     53|    case V_ASN1_SEQUENCE:
  ------------------
  |  |   74|     53|# define V_ASN1_SEQUENCE                 16
  ------------------
  |  Branch (74:5): [True: 53, False: 97]
  ------------------
   75|     53|        ASN1_STRING_free(data);
   76|     53|        break;
   77|    150|    }
   78|    150|}
encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:rsa_to_PrivateKeyInfo_der_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:key_to_pki_der_priv_bio:
  247|    185|{
  248|    185|    int ret = 0;
  249|    185|    void *str = NULL;
  250|    185|    int strtype = V_ASN1_UNDEF;
  ------------------
  |  |   60|    185|# define V_ASN1_UNDEF                    -1
  ------------------
  251|    185|    PKCS8_PRIV_KEY_INFO *p8info;
  252|       |
  253|    185|    if (ctx->cipher_intent)
  ------------------
  |  Branch (253:9): [True: 0, False: 185]
  ------------------
  254|      0|        return key_to_epki_der_priv_bio(out, key, key_nid, pemname,
  255|      0|                                        p2s, k2d, ctx);
  256|       |
  257|    185|    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters,
  ------------------
  |  Branch (257:9): [True: 176, False: 9]
  |  Branch (257:24): [True: 0, False: 176]
  ------------------
  258|    176|                            &str, &strtype))
  259|      0|        return 0;
  260|       |
  261|    185|    p8info = key_to_p8info(key, key_nid, str, strtype, k2d);
  262|       |
  263|    185|    if (p8info != NULL)
  ------------------
  |  Branch (263:9): [True: 35, False: 150]
  ------------------
  264|     35|        ret = i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8info);
  265|    150|    else
  266|    150|        free_asn1_data(strtype, str);
  267|       |
  268|    185|    PKCS8_PRIV_KEY_INFO_free(p8info);
  269|       |
  270|    185|    return ret;
  271|    185|}
encode_key2any.c:rsa_to_PrivateKeyInfo_pem_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:rsa_to_SubjectPublicKeyInfo_der_does_selection:
 1259|  2.89k|    {                                                                       \
 1260|  2.89k|        return key2any_check_selection(selection,                           \
 1261|  2.89k|                                       DO_##kind##_selection_mask);         \
 1262|  2.89k|    }                                                                       \
encode_key2any.c:rsa_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|  2.89k|    {                                                                       \
 1260|  2.89k|        return key2any_check_selection(selection,                           \
 1261|  2.89k|                                       DO_##kind##_selection_mask);         \
 1262|  2.89k|    }                                                                       \
encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:rsapss_to_PrivateKeyInfo_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:rsapss_to_PrivateKeyInfo_der_encode:
 1270|      1|    {                                                                       \
 1271|      1|        /* We don't deal with abstract objects */                           \
 1272|      1|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 1]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      1|        DO_##kind(impl, type, output)                                       \
 1277|      1|                                                                            \
 1278|      1|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      1|    }                                                                       \
encode_key2any.c:rsapss_to_PrivateKeyInfo_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_der_does_selection:
 1259|     12|    {                                                                       \
 1260|     12|        return key2any_check_selection(selection,                           \
 1261|     12|                                       DO_##kind##_selection_mask);         \
 1262|     12|    }                                                                       \
encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|     12|    {                                                                       \
 1260|     12|        return key2any_check_selection(selection,                           \
 1261|     12|                                       DO_##kind##_selection_mask);         \
 1262|     12|    }                                                                       \
encode_key2any.c:prepare_dh_params:
  445|     25|{
  446|     25|    ASN1_STRING *params = ASN1_STRING_new();
  447|       |
  448|     25|    if (params == NULL) {
  ------------------
  |  Branch (448:9): [True: 0, False: 25]
  ------------------
  449|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  450|      0|        return 0;
  451|      0|    }
  452|       |
  453|     25|    if (nid == EVP_PKEY_DHX)
  ------------------
  |  |   68|     25|# define EVP_PKEY_DHX    NID_dhpublicnumber
  |  |  ------------------
  |  |  |  | 5295|     25|#define NID_dhpublicnumber              920
  |  |  ------------------
  ------------------
  |  Branch (453:9): [True: 25, False: 0]
  ------------------
  454|     25|        params->length = i2d_DHxparams(dh, &params->data);
  455|      0|    else
  456|      0|        params->length = i2d_DHparams(dh, &params->data);
  457|       |
  458|     25|    if (params->length <= 0) {
  ------------------
  |  Branch (458:9): [True: 0, False: 25]
  ------------------
  459|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  460|      0|        ASN1_STRING_free(params);
  461|      0|        return 0;
  462|      0|    }
  463|     25|    params->type = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|     25|# define V_ASN1_SEQUENCE                 16
  ------------------
  464|       |
  465|     25|    *pstr = params;
  466|     25|    *pstrtype = V_ASN1_SEQUENCE;
  ------------------
  |  |   74|     25|# define V_ASN1_SEQUENCE                 16
  ------------------
  467|     25|    return 1;
  468|     25|}
encode_key2any.c:dh_pki_priv_to_der:
  492|     25|{
  493|     25|    const BIGNUM *bn = NULL;
  494|     25|    ASN1_INTEGER *priv_key = NULL;
  495|     25|    int ret;
  496|       |
  497|     25|    if ((bn = DH_get0_priv_key(dh)) == NULL) {
  ------------------
  |  Branch (497:9): [True: 0, False: 25]
  ------------------
  498|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  499|      0|        return 0;
  500|      0|    }
  501|     25|    if ((priv_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
  ------------------
  |  Branch (501:9): [True: 0, False: 25]
  ------------------
  502|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  503|      0|        return 0;
  504|      0|    }
  505|       |
  506|     25|    ret = i2d_ASN1_INTEGER(priv_key, pder);
  507|       |
  508|     25|    ASN1_STRING_clear_free(priv_key);
  509|     25|    return ret;
  510|     25|}
encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|     75|    {                                                                       \
 1260|     75|        return key2any_check_selection(selection,                           \
 1261|     75|                                       DO_##kind##_selection_mask);         \
 1262|     75|    }                                                                       \
encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|     75|    {                                                                       \
 1260|     75|        return key2any_check_selection(selection,                           \
 1261|     75|                                       DO_##kind##_selection_mask);         \
 1262|     75|    }                                                                       \
encode_key2any.c:dhx_to_PrivateKeyInfo_der_does_selection:
 1259|     75|    {                                                                       \
 1260|     75|        return key2any_check_selection(selection,                           \
 1261|     75|                                       DO_##kind##_selection_mask);         \
 1262|     75|    }                                                                       \
encode_key2any.c:dhx_to_PrivateKeyInfo_der_encode:
 1270|     25|    {                                                                       \
 1271|     25|        /* We don't deal with abstract objects */                           \
 1272|     25|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 25]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|     25|        DO_##kind(impl, type, output)                                       \
 1277|     25|                                                                            \
 1278|     25|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|     25|    }                                                                       \
encode_key2any.c:dhx_to_PrivateKeyInfo_pem_does_selection:
 1259|     75|    {                                                                       \
 1260|     75|        return key2any_check_selection(selection,                           \
 1261|     75|                                       DO_##kind##_selection_mask);         \
 1262|     75|    }                                                                       \
encode_key2any.c:dhx_to_SubjectPublicKeyInfo_der_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dhx_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:dsa_to_PrivateKeyInfo_der_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:dsa_to_PrivateKeyInfo_pem_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:dsa_to_SubjectPublicKeyInfo_der_does_selection:
 1259|  14.8k|    {                                                                       \
 1260|  14.8k|        return key2any_check_selection(selection,                           \
 1261|  14.8k|                                       DO_##kind##_selection_mask);         \
 1262|  14.8k|    }                                                                       \
encode_key2any.c:dsa_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|  14.8k|    {                                                                       \
 1260|  14.8k|        return key2any_check_selection(selection,                           \
 1261|  14.8k|                                       DO_##kind##_selection_mask);         \
 1262|  14.8k|    }                                                                       \
encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_pki_priv_to_der:
  712|    150|{
  713|    150|    EC_KEY *eckey = (EC_KEY *)veckey;
  714|    150|    unsigned int old_flags;
  715|    150|    int ret = 0;
  716|       |
  717|       |    /*
  718|       |     * For PKCS8 the curve name appears in the PKCS8_PRIV_KEY_INFO object
  719|       |     * as the pkeyalg->parameter field. (For a named curve this is an OID)
  720|       |     * The pkey field is an octet string that holds the encoded
  721|       |     * ECPrivateKey SEQUENCE with the optional parameters field omitted.
  722|       |     * We omit this by setting the EC_PKEY_NO_PARAMETERS flag.
  723|       |     */
  724|    150|    old_flags = EC_KEY_get_enc_flags(eckey); /* save old flags */
  725|    150|    EC_KEY_set_enc_flags(eckey, old_flags | EC_PKEY_NO_PARAMETERS);
  ------------------
  |  |  958|    150|#  define EC_PKEY_NO_PARAMETERS   0x001
  ------------------
  726|    150|    ret = i2d_ECPrivateKey(eckey, pder);
  727|    150|    EC_KEY_set_enc_flags(eckey, old_flags); /* restore old flags */
  728|    150|    return ret; /* return the length of the der encoded data */
  729|    150|}
encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_to_PrivateKeyInfo_der_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_to_PrivateKeyInfo_der_encode:
 1270|    149|    {                                                                       \
 1271|    149|        /* We don't deal with abstract objects */                           \
 1272|    149|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 149]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|    149|        DO_##kind(impl, type, output)                                       \
 1277|    149|                                                                            \
 1278|    149|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|    149|    }                                                                       \
encode_key2any.c:ec_to_PrivateKeyInfo_pem_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_to_SubjectPublicKeyInfo_der_does_selection:
 1259|  3.77k|    {                                                                       \
 1260|  3.77k|        return key2any_check_selection(selection,                           \
 1261|  3.77k|                                       DO_##kind##_selection_mask);         \
 1262|  3.77k|    }                                                                       \
encode_key2any.c:ec_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|  3.77k|    {                                                                       \
 1260|  3.77k|        return key2any_check_selection(selection,                           \
 1261|  3.77k|                                       DO_##kind##_selection_mask);         \
 1262|  3.77k|    }                                                                       \
encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|     11|    {                                                                       \
 1260|     11|        return key2any_check_selection(selection,                           \
 1261|     11|                                       DO_##kind##_selection_mask);         \
 1262|     11|    }                                                                       \
encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|     11|    {                                                                       \
 1260|     11|        return key2any_check_selection(selection,                           \
 1261|     11|                                       DO_##kind##_selection_mask);         \
 1262|     11|    }                                                                       \
encode_key2any.c:sm2_to_PrivateKeyInfo_der_does_selection:
 1259|     11|    {                                                                       \
 1260|     11|        return key2any_check_selection(selection,                           \
 1261|     11|                                       DO_##kind##_selection_mask);         \
 1262|     11|    }                                                                       \
encode_key2any.c:sm2_to_PrivateKeyInfo_der_encode:
 1270|      1|    {                                                                       \
 1271|      1|        /* We don't deal with abstract objects */                           \
 1272|      1|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 1]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      1|        DO_##kind(impl, type, output)                                       \
 1277|      1|                                                                            \
 1278|      1|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      1|    }                                                                       \
encode_key2any.c:sm2_to_PrivateKeyInfo_pem_does_selection:
 1259|     11|    {                                                                       \
 1260|     11|        return key2any_check_selection(selection,                           \
 1261|     11|                                       DO_##kind##_selection_mask);         \
 1262|     11|    }                                                                       \
encode_key2any.c:sm2_to_SubjectPublicKeyInfo_der_does_selection:
 1259|     22|    {                                                                       \
 1260|     22|        return key2any_check_selection(selection,                           \
 1261|     22|                                       DO_##kind##_selection_mask);         \
 1262|     22|    }                                                                       \
encode_key2any.c:sm2_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|     22|    {                                                                       \
 1260|     22|        return key2any_check_selection(selection,                           \
 1261|     22|                                       DO_##kind##_selection_mask);         \
 1262|     22|    }                                                                       \
encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:ecx_pki_priv_to_der:
  773|      9|{
  774|      9|    const ECX_KEY *ecxkey = vecxkey;
  775|      9|    ASN1_OCTET_STRING oct;
  776|      9|    int keybloblen;
  777|       |
  778|      9|    if (ecxkey == NULL || ecxkey->privkey == NULL) {
  ------------------
  |  Branch (778:9): [True: 0, False: 9]
  |  Branch (778:27): [True: 0, False: 9]
  ------------------
  779|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  780|      0|        return 0;
  781|      0|    }
  782|       |
  783|      9|    oct.data = ecxkey->privkey;
  784|      9|    oct.length = ecxkey->keylen;
  785|      9|    oct.flags = 0;
  786|       |
  787|      9|    keybloblen = i2d_ASN1_OCTET_STRING(&oct, pder);
  788|      9|    if (keybloblen < 0) {
  ------------------
  |  Branch (788:9): [True: 0, False: 9]
  ------------------
  789|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  790|      0|        return 0;
  791|      0|    }
  792|       |
  793|      9|    return keybloblen;
  794|      9|}
encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:ed25519_to_PrivateKeyInfo_der_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:ed25519_to_PrivateKeyInfo_der_encode:
 1270|      2|    {                                                                       \
 1271|      2|        /* We don't deal with abstract objects */                           \
 1272|      2|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 2]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      2|        DO_##kind(impl, type, output)                                       \
 1277|      2|                                                                            \
 1278|      2|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      2|    }                                                                       \
encode_key2any.c:ed25519_to_PrivateKeyInfo_pem_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_der_does_selection:
 1259|     12|    {                                                                       \
 1260|     12|        return key2any_check_selection(selection,                           \
 1261|     12|                                       DO_##kind##_selection_mask);         \
 1262|     12|    }                                                                       \
encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|     12|    {                                                                       \
 1260|     12|        return key2any_check_selection(selection,                           \
 1261|     12|                                       DO_##kind##_selection_mask);         \
 1262|     12|    }                                                                       \
encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:ed448_to_PrivateKeyInfo_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:ed448_to_PrivateKeyInfo_der_encode:
 1270|      1|    {                                                                       \
 1271|      1|        /* We don't deal with abstract objects */                           \
 1272|      1|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 1]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      1|        DO_##kind(impl, type, output)                                       \
 1277|      1|                                                                            \
 1278|      1|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      1|    }                                                                       \
encode_key2any.c:ed448_to_PrivateKeyInfo_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:ed448_to_SubjectPublicKeyInfo_der_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:ed448_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:x25519_to_PrivateKeyInfo_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:x25519_to_PrivateKeyInfo_der_encode:
 1270|      1|    {                                                                       \
 1271|      1|        /* We don't deal with abstract objects */                           \
 1272|      1|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 1]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      1|        DO_##kind(impl, type, output)                                       \
 1277|      1|                                                                            \
 1278|      1|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      1|    }                                                                       \
encode_key2any.c:x25519_to_PrivateKeyInfo_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:x25519_to_SubjectPublicKeyInfo_der_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:x25519_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|      6|    {                                                                       \
 1260|      6|        return key2any_check_selection(selection,                           \
 1261|      6|                                       DO_##kind##_selection_mask);         \
 1262|      6|    }                                                                       \
encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_der_does_selection:
 1259|     15|    {                                                                       \
 1260|     15|        return key2any_check_selection(selection,                           \
 1261|     15|                                       DO_##kind##_selection_mask);         \
 1262|     15|    }                                                                       \
encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_pem_does_selection:
 1259|     15|    {                                                                       \
 1260|     15|        return key2any_check_selection(selection,                           \
 1261|     15|                                       DO_##kind##_selection_mask);         \
 1262|     15|    }                                                                       \
encode_key2any.c:x448_to_PrivateKeyInfo_der_does_selection:
 1259|     15|    {                                                                       \
 1260|     15|        return key2any_check_selection(selection,                           \
 1261|     15|                                       DO_##kind##_selection_mask);         \
 1262|     15|    }                                                                       \
encode_key2any.c:x448_to_PrivateKeyInfo_der_encode:
 1270|      5|    {                                                                       \
 1271|      5|        /* We don't deal with abstract objects */                           \
 1272|      5|        if (key_abstract != NULL) {                                         \
  ------------------
  |  Branch (1272:13): [True: 0, False: 5]
  ------------------
 1273|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);         \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1274|      0|            return 0;                                                       \
 1275|      0|        }                                                                   \
 1276|      5|        DO_##kind(impl, type, output)                                       \
 1277|      5|                                                                            \
 1278|      5|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);             \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1279|      0|        return 0;                                                           \
 1280|      5|    }                                                                       \
encode_key2any.c:x448_to_PrivateKeyInfo_pem_does_selection:
 1259|     15|    {                                                                       \
 1260|     15|        return key2any_check_selection(selection,                           \
 1261|     15|                                       DO_##kind##_selection_mask);         \
 1262|     15|    }                                                                       \
encode_key2any.c:x448_to_SubjectPublicKeyInfo_der_does_selection:
 1259|     30|    {                                                                       \
 1260|     30|        return key2any_check_selection(selection,                           \
 1261|     30|                                       DO_##kind##_selection_mask);         \
 1262|     30|    }                                                                       \
encode_key2any.c:x448_to_SubjectPublicKeyInfo_pem_does_selection:
 1259|     30|    {                                                                       \
 1260|     30|        return key2any_check_selection(selection,                           \
 1261|     30|                                       DO_##kind##_selection_mask);         \
 1262|     30|    }                                                                       \
encode_key2any.c:rsa_to_RSA_der_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:rsa_to_RSA_pem_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:dhx_to_DHX_der_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dhx_to_DHX_pem_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dsa_to_DSA_der_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:dsa_to_DSA_pem_does_selection:
 1259|    990|    {                                                                       \
 1260|    990|        return key2any_check_selection(selection,                           \
 1261|    990|                                       DO_##kind##_selection_mask);         \
 1262|    990|    }                                                                       \
encode_key2any.c:ec_to_EC_der_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_to_EC_pem_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:rsa_to_PKCS1_der_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:rsa_to_PKCS1_pem_does_selection:
 1259|    724|    {                                                                       \
 1260|    724|        return key2any_check_selection(selection,                           \
 1261|    724|                                       DO_##kind##_selection_mask);         \
 1262|    724|    }                                                                       \
encode_key2any.c:rsapss_to_PKCS1_der_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:rsapss_to_PKCS1_pem_does_selection:
 1259|      3|    {                                                                       \
 1260|      3|        return key2any_check_selection(selection,                           \
 1261|      3|                                       DO_##kind##_selection_mask);         \
 1262|      3|    }                                                                       \
encode_key2any.c:dhx_to_X9_42_der_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:dhx_to_X9_42_pem_does_selection:
 1259|    300|    {                                                                       \
 1260|    300|        return key2any_check_selection(selection,                           \
 1261|    300|                                       DO_##kind##_selection_mask);         \
 1262|    300|    }                                                                       \
encode_key2any.c:ec_to_X9_62_der_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \
encode_key2any.c:ec_to_X9_62_pem_does_selection:
 1259|  1.25k|    {                                                                       \
 1260|  1.25k|        return key2any_check_selection(selection,                           \
 1261|  1.25k|                                       DO_##kind##_selection_mask);         \
 1262|  1.25k|    }                                                                       \

encode_key2blob.c:ec2blob_does_selection:
  140|  3.77k|    {                                                                   \
  141|  3.77k|        return key2blob_check_selection(selection,                      \
  142|  3.77k|                                        EVP_PKEY_##selection_name);     \
  143|  3.77k|    }                                                                   \
encode_key2blob.c:key2blob_check_selection:
   56|  3.79k|{
   57|       |    /*
   58|       |     * The selections are kinda sorta "levels", i.e. each selection given
   59|       |     * here is assumed to include those following.
   60|       |     */
   61|  3.79k|    int checks[] = {
   62|  3.79k|        OSSL_KEYMGMT_SELECT_PRIVATE_KEY,
  ------------------
  |  |  542|  3.79k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
   63|  3.79k|        OSSL_KEYMGMT_SELECT_PUBLIC_KEY,
  ------------------
  |  |  543|  3.79k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
   64|  3.79k|        OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
  ------------------
  |  |  549|  3.79k|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  ------------------
  |  |  |  |  544|  3.79k|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  |  |  550|  3.79k|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  545|  3.79k|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  ------------------
  ------------------
   65|  3.79k|    };
   66|  3.79k|    size_t i;
   67|       |
   68|       |    /* The decoder implementations made here support guessing */
   69|  3.79k|    if (selection == 0)
  ------------------
  |  Branch (69:9): [True: 0, False: 3.79k]
  ------------------
   70|      0|        return 1;
   71|       |
   72|  3.79k|    for (i = 0; i < OSSL_NELEM(checks); i++) {
  ------------------
  |  |   14|  3.79k|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (72:17): [True: 3.79k, False: 0]
  ------------------
   73|  3.79k|        int check1 = (selection & checks[i]) != 0;
   74|  3.79k|        int check2 = (selection_mask & checks[i]) != 0;
   75|       |
   76|       |        /*
   77|       |         * If the caller asked for the currently checked bit(s), return
   78|       |         * whether the decoder description says it's supported.
   79|       |         */
   80|  3.79k|        if (check1)
  ------------------
  |  Branch (80:13): [True: 3.79k, False: 0]
  ------------------
   81|  3.79k|            return check2;
   82|  3.79k|    }
   83|       |
   84|       |    /* This should be dead code, but just to be safe... */
   85|      0|    return 0;
   86|  3.79k|}
encode_key2blob.c:sm22blob_does_selection:
  140|     22|    {                                                                   \
  141|     22|        return key2blob_check_selection(selection,                      \
  142|     22|                                        EVP_PKEY_##selection_name);     \
  143|     22|    }                                                                   \

encode_key2ms.c:key2ms_newctx:
   72|  3.42k|{
   73|  3.42k|    struct key2ms_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
  ------------------
  |  |   99|  3.42k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.42k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.42k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   74|       |
   75|  3.42k|    if (ctx != NULL) {
  ------------------
  |  Branch (75:9): [True: 3.42k, False: 0]
  ------------------
   76|  3.42k|        ctx->provctx = provctx;
   77|       |        /* This is the strongest encryption level */
   78|  3.42k|        ctx->pvk_encr_level = 2;
   79|  3.42k|    }
   80|  3.42k|    return ctx;
   81|  3.42k|}
encode_key2ms.c:key2ms_freectx:
   84|  3.42k|{
   85|  3.42k|    struct key2ms_ctx_st *ctx = vctx;
   86|       |
   87|  3.42k|    ossl_pw_clear_passphrase_data(&ctx->pwdata);
   88|  3.42k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  3.42k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.42k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.42k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   89|  3.42k|}
encode_key2ms.c:key2pvk_set_ctx_params:
  102|  1.71k|{
  103|  1.71k|    struct key2ms_ctx_st *ctx = vctx;
  104|  1.71k|    const OSSL_PARAM *p;
  105|       |
  106|  1.71k|    p = OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_ENCRYPT_LEVEL);
  ------------------
  |  |  224|  1.71k|# define OSSL_ENCODER_PARAM_ENCRYPT_LEVEL "encrypt-level"
  ------------------
  107|  1.71k|    if (p != NULL && !OSSL_PARAM_get_int(p, &ctx->pvk_encr_level))
  ------------------
  |  Branch (107:9): [True: 0, False: 1.71k]
  |  Branch (107:22): [True: 0, False: 0]
  ------------------
  108|      0|        return 0;
  109|  1.71k|    return 1;
  110|  1.71k|}
encode_key2ms.c:key2ms_does_selection:
  113|  3.42k|{
  114|  3.42k|    return (selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0;
  ------------------
  |  |  552|  3.42k|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  542|  3.42k|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  543|  3.42k|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  115|  3.42k|}

encode_key2text.c:key2text_newctx:
  801|  3.08k|{
  802|  3.08k|    return provctx;
  803|  3.08k|}
encode_key2text.c:key2text_freectx:
  806|  3.08k|{
  807|  3.08k|}
encode_key2text.c:key2text_encode:
  814|  1.45k|{
  815|  1.45k|    BIO *out = ossl_bio_new_from_core_bio(vctx, cout);
  816|  1.45k|    int ret;
  817|       |
  818|  1.45k|    if (out == NULL)
  ------------------
  |  Branch (818:9): [True: 0, False: 1.45k]
  ------------------
  819|      0|        return 0;
  820|       |
  821|  1.45k|    ret = key2text(out, key, selection);
  822|  1.45k|    BIO_free(out);
  823|       |
  824|  1.45k|    return ret;
  825|  1.45k|}
encode_key2text.c:dh_to_text:
  217|     25|{
  218|     25|    const DH *dh = key;
  219|     25|    const char *type_label = NULL;
  220|     25|    const BIGNUM *priv_key = NULL, *pub_key = NULL;
  221|     25|    const FFC_PARAMS *params = NULL;
  222|     25|    const BIGNUM *p = NULL;
  223|     25|    long length;
  224|       |
  225|     25|    if (out == NULL || dh == NULL) {
  ------------------
  |  Branch (225:9): [True: 0, False: 25]
  |  Branch (225:24): [True: 0, False: 25]
  ------------------
  226|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  227|      0|        return 0;
  228|      0|    }
  229|       |
  230|     25|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|     25|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (230:9): [True: 25, False: 0]
  ------------------
  231|     25|        type_label = "DH Private-Key";
  232|      0|    else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (232:14): [True: 0, False: 0]
  ------------------
  233|      0|        type_label = "DH Public-Key";
  234|      0|    else if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (234:14): [True: 0, False: 0]
  ------------------
  235|      0|        type_label = "DH Parameters";
  236|       |
  237|     25|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|     25|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (237:9): [True: 25, False: 0]
  ------------------
  238|     25|        priv_key = DH_get0_priv_key(dh);
  239|     25|        if (priv_key == NULL) {
  ------------------
  |  Branch (239:13): [True: 0, False: 25]
  ------------------
  240|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  241|      0|            return 0;
  242|      0|        }
  243|     25|    }
  244|     25|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  543|     25|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (244:9): [True: 25, False: 0]
  ------------------
  245|     25|        pub_key = DH_get0_pub_key(dh);
  246|     25|        if (pub_key == NULL) {
  ------------------
  |  Branch (246:13): [True: 0, False: 25]
  ------------------
  247|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  248|      0|            return 0;
  249|      0|        }
  250|     25|    }
  251|     25|    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
  ------------------
  |  |  544|     25|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (251:9): [True: 25, False: 0]
  ------------------
  252|     25|        params = ossl_dh_get0_params((DH *)dh);
  253|     25|        if (params == NULL) {
  ------------------
  |  Branch (253:13): [True: 0, False: 25]
  ------------------
  254|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_PARAMETERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  255|      0|            return 0;
  256|      0|        }
  257|     25|    }
  258|       |
  259|     25|    p = DH_get0_p(dh);
  260|     25|    if (p == NULL) {
  ------------------
  |  Branch (260:9): [True: 0, False: 25]
  ------------------
  261|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  262|      0|        return 0;
  263|      0|    }
  264|       |
  265|     25|    if (BIO_printf(out, "%s: (%d bit)\n", type_label, BN_num_bits(p)) <= 0)
  ------------------
  |  Branch (265:9): [True: 0, False: 25]
  ------------------
  266|      0|        return 0;
  267|     25|    if (priv_key != NULL
  ------------------
  |  Branch (267:9): [True: 25, False: 0]
  ------------------
  268|     25|        && !print_labeled_bignum(out, "private-key:", priv_key))
  ------------------
  |  Branch (268:12): [True: 0, False: 25]
  ------------------
  269|      0|        return 0;
  270|     25|    if (pub_key != NULL
  ------------------
  |  Branch (270:9): [True: 25, False: 0]
  ------------------
  271|     25|        && !print_labeled_bignum(out, "public-key:", pub_key))
  ------------------
  |  Branch (271:12): [True: 0, False: 25]
  ------------------
  272|      0|        return 0;
  273|     25|    if (params != NULL
  ------------------
  |  Branch (273:9): [True: 25, False: 0]
  ------------------
  274|     25|        && !ffc_params_to_text(out, params))
  ------------------
  |  Branch (274:12): [True: 0, False: 25]
  ------------------
  275|      0|        return 0;
  276|     25|    length = DH_get_length(dh);
  277|     25|    if (length > 0
  ------------------
  |  Branch (277:9): [True: 0, False: 25]
  ------------------
  278|     25|        && BIO_printf(out, "recommended-private-length: %ld bits\n",
  ------------------
  |  Branch (278:12): [True: 0, False: 0]
  ------------------
  279|      0|                      length) <= 0)
  280|      0|        return 0;
  281|       |
  282|     25|    return 1;
  283|     25|}
encode_key2text.c:print_labeled_bignum:
   53|  48.9k|{
   54|  48.9k|    int ret = 0, use_sep = 0;
   55|  48.9k|    char *hex_str = NULL, *p;
   56|  48.9k|    const char spaces[] = "    ";
   57|  48.9k|    const char *post_label_spc = " ";
   58|       |
   59|  48.9k|    const char *neg = "";
   60|  48.9k|    int bytes;
   61|       |
   62|  48.9k|    if (bn == NULL)
  ------------------
  |  Branch (62:9): [True: 0, False: 48.9k]
  ------------------
   63|      0|        return 0;
   64|  48.9k|    if (label == NULL) {
  ------------------
  |  Branch (64:9): [True: 43.1k, False: 5.80k]
  ------------------
   65|  43.1k|        label = "";
   66|  43.1k|        post_label_spc = "";
   67|  43.1k|    }
   68|       |
   69|  48.9k|    if (BN_is_zero(bn))
  ------------------
  |  Branch (69:9): [True: 2.82k, False: 46.1k]
  ------------------
   70|  2.82k|        return BIO_printf(out, "%s%s0\n", label, post_label_spc);
   71|       |
   72|  46.1k|    if (BN_num_bytes(bn) <= BN_BYTES) {
  ------------------
  |  |  189|  46.1k|# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
  ------------------
                  if (BN_num_bytes(bn) <= BN_BYTES) {
  ------------------
  |  |   38|  46.1k|#  define BN_BYTES        8
  ------------------
  |  Branch (72:9): [True: 42.3k, False: 3.84k]
  ------------------
   73|  42.3k|        BN_ULONG *words = bn_get_words(bn);
  ------------------
  |  |   37|  42.3k|#  define BN_ULONG        unsigned long
  ------------------
   74|       |
   75|  42.3k|        if (BN_is_negative(bn))
  ------------------
  |  Branch (75:13): [True: 4, False: 42.3k]
  ------------------
   76|      4|            neg = "-";
   77|       |
   78|  42.3k|        return BIO_printf(out, "%s%s%s" BN_FMTu " (%s0x" BN_FMTx ")\n",
   79|  42.3k|                          label, post_label_spc, neg, words[0], neg, words[0]);
   80|  42.3k|    }
   81|       |
   82|  3.84k|    hex_str = BN_bn2hex(bn);
   83|  3.84k|    if (hex_str == NULL)
  ------------------
  |  Branch (83:9): [True: 0, False: 3.84k]
  ------------------
   84|      0|        return 0;
   85|       |
   86|  3.84k|    p = hex_str;
   87|  3.84k|    if (*p == '-') {
  ------------------
  |  Branch (87:9): [True: 1, False: 3.84k]
  ------------------
   88|      1|        ++p;
   89|      1|        neg = " (Negative)";
   90|      1|    }
   91|  3.84k|    if (BIO_printf(out, "%s%s\n", label, neg) <= 0)
  ------------------
  |  Branch (91:9): [True: 0, False: 3.84k]
  ------------------
   92|      0|        goto err;
   93|       |
   94|       |    /* Keep track of how many bytes we have printed out so far */
   95|  3.84k|    bytes = 0;
   96|       |
   97|  3.84k|    if (BIO_printf(out, "%s", spaces) <= 0)
  ------------------
  |  Branch (97:9): [True: 0, False: 3.84k]
  ------------------
   98|      0|        goto err;
   99|       |
  100|       |    /* Add a leading 00 if the top bit is set */
  101|  3.84k|    if (*p >= '8') {
  ------------------
  |  Branch (101:9): [True: 1.87k, False: 1.97k]
  ------------------
  102|  1.87k|        if (BIO_printf(out, "%02x", 0) <= 0)
  ------------------
  |  Branch (102:13): [True: 0, False: 1.87k]
  ------------------
  103|      0|            goto err;
  104|  1.87k|        ++bytes;
  105|  1.87k|        use_sep = 1;
  106|  1.87k|    }
  107|  1.20M|    while (*p != '\0') {
  ------------------
  |  Branch (107:12): [True: 1.20M, False: 3.84k]
  ------------------
  108|       |        /* Do a newline after every 15 hex bytes + add the space indent */
  109|  1.20M|        if ((bytes % 15) == 0 && bytes > 0) {
  ------------------
  |  Branch (109:13): [True: 80.5k, False: 1.12M]
  |  Branch (109:34): [True: 78.5k, False: 1.97k]
  ------------------
  110|  78.5k|            if (BIO_printf(out, ":\n%s", spaces) <= 0)
  ------------------
  |  Branch (110:17): [True: 0, False: 78.5k]
  ------------------
  111|      0|                goto err;
  112|  78.5k|            use_sep = 0; /* The first byte on the next line doesn't have a : */
  113|  78.5k|        }
  114|  1.20M|        if (BIO_printf(out, "%s%c%c", use_sep ? ":" : "",
  ------------------
  |  Branch (114:13): [True: 0, False: 1.20M]
  |  Branch (114:39): [True: 1.12M, False: 80.5k]
  ------------------
  115|  1.20M|                       tolower(p[0]), tolower(p[1])) <= 0)
  116|      0|            goto err;
  117|  1.20M|        ++bytes;
  118|  1.20M|        p += 2;
  119|  1.20M|        use_sep = 1;
  120|  1.20M|    }
  121|  3.84k|    if (BIO_printf(out, "\n") <= 0)
  ------------------
  |  Branch (121:9): [True: 0, False: 3.84k]
  ------------------
  122|      0|        goto err;
  123|  3.84k|    ret = 1;
  124|  3.84k|err:
  125|  3.84k|    OPENSSL_free(hex_str);
  ------------------
  |  |  107|  3.84k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.84k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.84k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  126|  3.84k|    return ret;
  127|  3.84k|}
encode_key2text.c:ffc_params_to_text:
  162|    520|{
  163|    520|    if (ffc->nid != NID_undef) {
  ------------------
  |  |   18|    520|#define NID_undef                       0
  ------------------
  |  Branch (163:9): [True: 0, False: 520]
  ------------------
  164|      0|#ifndef OPENSSL_NO_DH
  165|      0|        const DH_NAMED_GROUP *group = ossl_ffc_uid_to_dh_named_group(ffc->nid);
  166|      0|        const char *name = ossl_ffc_named_group_get_name(group);
  167|       |
  168|      0|        if (name == NULL)
  ------------------
  |  Branch (168:13): [True: 0, False: 0]
  ------------------
  169|      0|            goto err;
  170|      0|        if (BIO_printf(out, "GROUP: %s\n", name) <= 0)
  ------------------
  |  Branch (170:13): [True: 0, False: 0]
  ------------------
  171|      0|            goto err;
  172|      0|        return 1;
  173|       |#else
  174|       |        /* How could this be? We should not have a nid in a no-dh build. */
  175|       |        goto err;
  176|       |#endif
  177|      0|    }
  178|       |
  179|    520|    if (!print_labeled_bignum(out, "P:   ", ffc->p))
  ------------------
  |  Branch (179:9): [True: 0, False: 520]
  ------------------
  180|      0|        goto err;
  181|    520|    if (ffc->q != NULL) {
  ------------------
  |  Branch (181:9): [True: 520, False: 0]
  ------------------
  182|    520|        if (!print_labeled_bignum(out, "Q:   ", ffc->q))
  ------------------
  |  Branch (182:13): [True: 0, False: 520]
  ------------------
  183|      0|            goto err;
  184|    520|    }
  185|    520|    if (!print_labeled_bignum(out, "G:   ", ffc->g))
  ------------------
  |  Branch (185:9): [True: 0, False: 520]
  ------------------
  186|      0|        goto err;
  187|    520|    if (ffc->j != NULL) {
  ------------------
  |  Branch (187:9): [True: 13, False: 507]
  ------------------
  188|     13|        if (!print_labeled_bignum(out, "J:   ", ffc->j))
  ------------------
  |  Branch (188:13): [True: 0, False: 13]
  ------------------
  189|      0|            goto err;
  190|     13|    }
  191|    520|    if (ffc->seed != NULL) {
  ------------------
  |  Branch (191:9): [True: 0, False: 520]
  ------------------
  192|      0|        if (!print_labeled_buf(out, "SEED:", ffc->seed, ffc->seedlen))
  ------------------
  |  Branch (192:13): [True: 0, False: 0]
  ------------------
  193|      0|            goto err;
  194|      0|    }
  195|    520|    if (ffc->gindex != -1) {
  ------------------
  |  Branch (195:9): [True: 0, False: 520]
  ------------------
  196|      0|        if (BIO_printf(out, "gindex: %d\n", ffc->gindex) <= 0)
  ------------------
  |  Branch (196:13): [True: 0, False: 0]
  ------------------
  197|      0|            goto err;
  198|      0|    }
  199|    520|    if (ffc->pcounter != -1) {
  ------------------
  |  Branch (199:9): [True: 0, False: 520]
  ------------------
  200|      0|        if (BIO_printf(out, "pcounter: %d\n", ffc->pcounter) <= 0)
  ------------------
  |  Branch (200:13): [True: 0, False: 0]
  ------------------
  201|      0|            goto err;
  202|      0|    }
  203|    520|    if (ffc->h != 0) {
  ------------------
  |  Branch (203:9): [True: 0, False: 520]
  ------------------
  204|      0|        if (BIO_printf(out, "h: %d\n", ffc->h) <= 0)
  ------------------
  |  Branch (204:13): [True: 0, False: 0]
  ------------------
  205|      0|            goto err;
  206|      0|    }
  207|    520|    return 1;
  208|      0|err:
  209|      0|    return 0;
  210|    520|}
encode_key2text.c:print_labeled_buf:
  135|    909|{
  136|    909|    size_t i;
  137|       |
  138|    909|    if (BIO_printf(out, "%s\n", label) <= 0)
  ------------------
  |  Branch (138:9): [True: 0, False: 909]
  ------------------
  139|      0|        return 0;
  140|       |
  141|  33.1k|    for (i = 0; i < buflen; i++) {
  ------------------
  |  Branch (141:17): [True: 32.2k, False: 909]
  ------------------
  142|  32.2k|        if ((i % LABELED_BUF_PRINT_WIDTH) == 0) {
  ------------------
  |  |  130|  32.2k|#define LABELED_BUF_PRINT_WIDTH    15
  ------------------
  |  Branch (142:13): [True: 2.47k, False: 29.7k]
  ------------------
  143|  2.47k|            if (i > 0 && BIO_printf(out, "\n") <= 0)
  ------------------
  |  Branch (143:17): [True: 1.56k, False: 909]
  |  Branch (143:26): [True: 0, False: 1.56k]
  ------------------
  144|      0|                return 0;
  145|  2.47k|            if (BIO_printf(out, "    ") <= 0)
  ------------------
  |  Branch (145:17): [True: 0, False: 2.47k]
  ------------------
  146|      0|                return 0;
  147|  2.47k|        }
  148|       |
  149|  32.2k|        if (BIO_printf(out, "%02x%s", buf[i],
  ------------------
  |  Branch (149:13): [True: 0, False: 32.2k]
  ------------------
  150|  32.2k|                                 (i == buflen - 1) ? "" : ":") <= 0)
  ------------------
  |  Branch (150:34): [True: 909, False: 31.3k]
  ------------------
  151|      0|            return 0;
  152|  32.2k|    }
  153|    909|    if (BIO_printf(out, "\n") <= 0)
  ------------------
  |  Branch (153:9): [True: 0, False: 909]
  ------------------
  154|      0|        return 0;
  155|       |
  156|    909|    return 1;
  157|    909|}
encode_key2text.c:dhx2text_encode:
  850|     25|    {                                                                   \
  851|     25|        /* We don't deal with abstract objects */                       \
  852|     25|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 25]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|     25|        return key2text_encode(vctx, key, selection, cout,              \
  857|     25|                               type##_to_text, cb, cbarg);              \
  858|     25|    }                                                                   \
encode_key2text.c:dsa2text_encode:
  850|    495|    {                                                                   \
  851|    495|        /* We don't deal with abstract objects */                       \
  852|    495|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 495]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|    495|        return key2text_encode(vctx, key, selection, cout,              \
  857|    495|                               type##_to_text, cb, cbarg);              \
  858|    495|    }                                                                   \
encode_key2text.c:dsa_to_text:
  293|    495|{
  294|    495|    const DSA *dsa = key;
  295|    495|    const char *type_label = NULL;
  296|    495|    const BIGNUM *priv_key = NULL, *pub_key = NULL;
  297|    495|    const FFC_PARAMS *params = NULL;
  298|    495|    const BIGNUM *p = NULL;
  299|       |
  300|    495|    if (out == NULL || dsa == NULL) {
  ------------------
  |  Branch (300:9): [True: 0, False: 495]
  |  Branch (300:24): [True: 0, False: 495]
  ------------------
  301|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  302|      0|        return 0;
  303|      0|    }
  304|       |
  305|    495|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|    495|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (305:9): [True: 495, False: 0]
  ------------------
  306|    495|        type_label = "Private-Key";
  307|      0|    else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (307:14): [True: 0, False: 0]
  ------------------
  308|      0|        type_label = "Public-Key";
  309|      0|    else if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (309:14): [True: 0, False: 0]
  ------------------
  310|      0|        type_label = "DSA-Parameters";
  311|       |
  312|    495|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|    495|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (312:9): [True: 495, False: 0]
  ------------------
  313|    495|        priv_key = DSA_get0_priv_key(dsa);
  314|    495|        if (priv_key == NULL) {
  ------------------
  |  Branch (314:13): [True: 0, False: 495]
  ------------------
  315|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  316|      0|            return 0;
  317|      0|        }
  318|    495|    }
  319|    495|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  543|    495|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (319:9): [True: 495, False: 0]
  ------------------
  320|    495|        pub_key = DSA_get0_pub_key(dsa);
  321|    495|        if (pub_key == NULL) {
  ------------------
  |  Branch (321:13): [True: 0, False: 495]
  ------------------
  322|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  323|      0|            return 0;
  324|      0|        }
  325|    495|    }
  326|    495|    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
  ------------------
  |  |  544|    495|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (326:9): [True: 495, False: 0]
  ------------------
  327|    495|        params = ossl_dsa_get0_params((DSA *)dsa);
  328|    495|        if (params == NULL) {
  ------------------
  |  Branch (328:13): [True: 0, False: 495]
  ------------------
  329|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_PARAMETERS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  330|      0|            return 0;
  331|      0|        }
  332|    495|    }
  333|       |
  334|    495|    p = DSA_get0_p(dsa);
  335|    495|    if (p == NULL) {
  ------------------
  |  Branch (335:9): [True: 0, False: 495]
  ------------------
  336|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  337|      0|        return 0;
  338|      0|    }
  339|       |
  340|    495|    if (BIO_printf(out, "%s: (%d bit)\n", type_label, BN_num_bits(p)) <= 0)
  ------------------
  |  Branch (340:9): [True: 0, False: 495]
  ------------------
  341|      0|        return 0;
  342|    495|    if (priv_key != NULL
  ------------------
  |  Branch (342:9): [True: 495, False: 0]
  ------------------
  343|    495|        && !print_labeled_bignum(out, "priv:", priv_key))
  ------------------
  |  Branch (343:12): [True: 0, False: 495]
  ------------------
  344|      0|        return 0;
  345|    495|    if (pub_key != NULL
  ------------------
  |  Branch (345:9): [True: 495, False: 0]
  ------------------
  346|    495|        && !print_labeled_bignum(out, "pub: ", pub_key))
  ------------------
  |  Branch (346:12): [True: 0, False: 495]
  ------------------
  347|      0|        return 0;
  348|    495|    if (params != NULL
  ------------------
  |  Branch (348:9): [True: 495, False: 0]
  ------------------
  349|    495|        && !ffc_params_to_text(out, params))
  ------------------
  |  Branch (349:12): [True: 0, False: 495]
  ------------------
  350|      0|        return 0;
  351|       |
  352|    495|    return 1;
  353|    495|}
encode_key2text.c:ec2text_encode:
  850|    555|    {                                                                   \
  851|    555|        /* We don't deal with abstract objects */                       \
  852|    555|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 555]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|    555|        return key2text_encode(vctx, key, selection, cout,              \
  857|    555|                               type##_to_text, cb, cbarg);              \
  858|    555|    }                                                                   \
encode_key2text.c:ec_to_text:
  492|    560|{
  493|    560|    const EC_KEY *ec = key;
  494|    560|    const char *type_label = NULL;
  495|    560|    unsigned char *priv = NULL, *pub = NULL;
  496|    560|    size_t priv_len = 0, pub_len = 0;
  497|    560|    const EC_GROUP *group;
  498|    560|    int ret = 0;
  499|       |
  500|    560|    if (out == NULL || ec == NULL) {
  ------------------
  |  Branch (500:9): [True: 0, False: 560]
  |  Branch (500:24): [True: 0, False: 560]
  ------------------
  501|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  502|      0|        return 0;
  503|      0|    }
  504|       |
  505|    560|    if ((group = EC_KEY_get0_group(ec)) == NULL) {
  ------------------
  |  Branch (505:9): [True: 0, False: 560]
  ------------------
  506|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  507|      0|        return 0;
  508|      0|    }
  509|       |
  510|    560|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|    560|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (510:9): [True: 560, False: 0]
  ------------------
  511|    560|        type_label = "Private-Key";
  512|      0|    else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (512:14): [True: 0, False: 0]
  ------------------
  513|      0|        type_label = "Public-Key";
  514|      0|    else if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|      0|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (514:14): [True: 0, False: 0]
  ------------------
  515|      0|        if (EC_GROUP_get_curve_name(group) != NID_sm2)
  ------------------
  |  | 1228|      0|#define NID_sm2         1172
  ------------------
  |  Branch (515:13): [True: 0, False: 0]
  ------------------
  516|      0|            type_label = "EC-Parameters";
  517|       |
  518|    560|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|    560|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (518:9): [True: 560, False: 0]
  ------------------
  519|    560|        const BIGNUM *priv_key = EC_KEY_get0_private_key(ec);
  520|       |
  521|    560|        if (priv_key == NULL) {
  ------------------
  |  Branch (521:13): [True: 0, False: 560]
  ------------------
  522|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  523|      0|            goto err;
  524|      0|        }
  525|    560|        priv_len = EC_KEY_priv2buf(ec, &priv);
  526|    560|        if (priv_len == 0)
  ------------------
  |  Branch (526:13): [True: 147, False: 413]
  ------------------
  527|    147|            goto err;
  528|    560|    }
  529|    413|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  543|    413|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (529:9): [True: 413, False: 0]
  ------------------
  530|    413|        const EC_POINT *pub_pt = EC_KEY_get0_public_key(ec);
  531|       |
  532|    413|        if (pub_pt == NULL) {
  ------------------
  |  Branch (532:13): [True: 0, False: 413]
  ------------------
  533|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  534|      0|            goto err;
  535|      0|        }
  536|       |
  537|    413|        pub_len = EC_KEY_key2buf(ec, EC_KEY_get_conv_form(ec), &pub, NULL);
  538|    413|        if (pub_len == 0)
  ------------------
  |  Branch (538:13): [True: 3, False: 410]
  ------------------
  539|      3|            goto err;
  540|    413|    }
  541|       |
  542|    410|    if (type_label != NULL
  ------------------
  |  Branch (542:9): [True: 410, False: 0]
  ------------------
  543|    410|        && BIO_printf(out, "%s: (%d bit)\n", type_label,
  ------------------
  |  Branch (543:12): [True: 0, False: 410]
  ------------------
  544|    410|                      EC_GROUP_order_bits(group)) <= 0)
  545|      0|        goto err;
  546|    410|    if (priv != NULL
  ------------------
  |  Branch (546:9): [True: 410, False: 0]
  ------------------
  547|    410|        && !print_labeled_buf(out, "priv:", priv, priv_len))
  ------------------
  |  Branch (547:12): [True: 0, False: 410]
  ------------------
  548|      0|        goto err;
  549|    410|    if (pub != NULL
  ------------------
  |  Branch (549:9): [True: 410, False: 0]
  ------------------
  550|    410|        && !print_labeled_buf(out, "pub:", pub, pub_len))
  ------------------
  |  Branch (550:12): [True: 0, False: 410]
  ------------------
  551|      0|        goto err;
  552|    410|    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|    410|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (552:9): [True: 410, False: 0]
  ------------------
  553|    410|        ret = ec_param_to_text(out, group, ossl_ec_key_get_libctx(ec));
  554|    560|err:
  555|    560|    OPENSSL_clear_free(priv, priv_len);
  ------------------
  |  |  105|    560|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    560|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    560|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  556|    560|    OPENSSL_free(pub);
  ------------------
  |  |  107|    560|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    560|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    560|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  557|    560|    return ret;
  558|    410|}
encode_key2text.c:ec_param_to_text:
  471|    410|{
  472|    410|    if (EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE) {
  ------------------
  |  |   31|    410|# define OPENSSL_EC_NAMED_CURVE     0x001
  ------------------
  |  Branch (472:9): [True: 352, False: 58]
  ------------------
  473|    352|        const char *curve_name;
  474|    352|        int curve_nid = EC_GROUP_get_curve_name(group);
  475|       |
  476|       |        /* Explicit parameters */
  477|    352|        if (curve_nid == NID_undef)
  ------------------
  |  |   18|    352|#define NID_undef                       0
  ------------------
  |  Branch (477:13): [True: 0, False: 352]
  ------------------
  478|      0|            return 0;
  479|       |
  480|    352|        if (BIO_printf(out, "%s: %s\n", "ASN1 OID", OBJ_nid2sn(curve_nid)) <= 0)
  ------------------
  |  Branch (480:13): [True: 0, False: 352]
  ------------------
  481|      0|            return 0;
  482|       |
  483|    352|        curve_name = EC_curve_nid2nist(curve_nid);
  484|    352|        return (curve_name == NULL
  ------------------
  |  Branch (484:17): [True: 194, False: 158]
  ------------------
  485|    352|                || BIO_printf(out, "%s: %s\n", "NIST CURVE", curve_name) > 0);
  ------------------
  |  Branch (485:20): [True: 158, False: 0]
  ------------------
  486|    352|    } else {
  487|     58|        return ec_param_explicit_to_text(out, group, libctx);
  488|     58|    }
  489|    410|}
encode_key2text.c:ec_param_explicit_to_text:
  430|     58|{
  431|     58|    int ret = 0, tmp_nid;
  432|     58|    BN_CTX *ctx = NULL;
  433|     58|    const BIGNUM *order = NULL, *cofactor = NULL;
  434|     58|    const unsigned char *seed;
  435|     58|    size_t seed_len = 0;
  436|       |
  437|     58|    ctx = BN_CTX_new_ex(libctx);
  438|     58|    if (ctx == NULL)
  ------------------
  |  Branch (438:9): [True: 0, False: 58]
  ------------------
  439|      0|        return 0;
  440|     58|    BN_CTX_start(ctx);
  441|       |
  442|     58|    tmp_nid = EC_GROUP_get_field_type(group);
  443|     58|    order = EC_GROUP_get0_order(group);
  444|     58|    if (order == NULL)
  ------------------
  |  Branch (444:9): [True: 0, False: 58]
  ------------------
  445|      0|        goto err;
  446|       |
  447|     58|    seed = EC_GROUP_get0_seed(group);
  448|     58|    if (seed != NULL)
  ------------------
  |  Branch (448:9): [True: 13, False: 45]
  ------------------
  449|     13|        seed_len = EC_GROUP_get_seed_len(group);
  450|     58|    cofactor = EC_GROUP_get0_cofactor(group);
  451|       |
  452|       |    /* print the 'short name' of the field type */
  453|     58|    if (BIO_printf(out, "Field Type: %s\n", OBJ_nid2sn(tmp_nid)) <= 0
  ------------------
  |  Branch (453:9): [True: 0, False: 58]
  ------------------
  454|     58|        || !ec_param_explicit_curve_to_text(out, group, ctx)
  ------------------
  |  Branch (454:12): [True: 0, False: 58]
  ------------------
  455|     58|        || !ec_param_explicit_gen_to_text(out, group, ctx)
  ------------------
  |  Branch (455:12): [True: 0, False: 58]
  ------------------
  456|     58|        || !print_labeled_bignum(out, "Order: ", order)
  ------------------
  |  Branch (456:12): [True: 0, False: 58]
  ------------------
  457|     58|        || (cofactor != NULL
  ------------------
  |  Branch (457:13): [True: 58, False: 0]
  ------------------
  458|     58|            && !print_labeled_bignum(out, "Cofactor: ", cofactor))
  ------------------
  |  Branch (458:16): [True: 0, False: 58]
  ------------------
  459|     58|        || (seed != NULL
  ------------------
  |  Branch (459:13): [True: 13, False: 45]
  ------------------
  460|     58|            && !print_labeled_buf(out, "Seed:", seed, seed_len)))
  ------------------
  |  Branch (460:16): [True: 0, False: 13]
  ------------------
  461|      0|        goto err;
  462|     58|    ret = 1;
  463|     58|err:
  464|     58|    BN_CTX_end(ctx);
  465|     58|    BN_CTX_free(ctx);
  466|     58|    return ret;
  467|     58|}
encode_key2text.c:ec_param_explicit_curve_to_text:
  363|     58|{
  364|     58|    const char *plabel = "Prime:";
  365|     58|    BIGNUM *p = NULL, *a = NULL, *b = NULL;
  366|       |
  367|     58|    p = BN_CTX_get(ctx);
  368|     58|    a = BN_CTX_get(ctx);
  369|     58|    b = BN_CTX_get(ctx);
  370|     58|    if (b == NULL
  ------------------
  |  Branch (370:9): [True: 0, False: 58]
  ------------------
  371|     58|        || !EC_GROUP_get_curve(group, p, a, b, ctx))
  ------------------
  |  Branch (371:12): [True: 0, False: 58]
  ------------------
  372|      0|        return 0;
  373|       |
  374|     58|    if (EC_GROUP_get_field_type(group) == NID_X9_62_characteristic_two_field) {
  ------------------
  |  |  156|     58|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (374:9): [True: 0, False: 58]
  ------------------
  375|      0|        int basis_type = EC_GROUP_get_basis_type(group);
  376|       |
  377|       |        /* print the 'short name' of the base type OID */
  378|      0|        if (basis_type == NID_undef
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (378:13): [True: 0, False: 0]
  ------------------
  379|      0|            || BIO_printf(out, "Basis Type: %s\n", OBJ_nid2sn(basis_type)) <= 0)
  ------------------
  |  Branch (379:16): [True: 0, False: 0]
  ------------------
  380|      0|            return 0;
  381|      0|        plabel = "Polynomial:";
  382|      0|    }
  383|     58|    return print_labeled_bignum(out, plabel, p)
  ------------------
  |  Branch (383:12): [True: 58, False: 0]
  ------------------
  384|     58|        && print_labeled_bignum(out, "A:   ", a)
  ------------------
  |  Branch (384:12): [True: 58, False: 0]
  ------------------
  385|     58|        && print_labeled_bignum(out, "B:   ", b);
  ------------------
  |  Branch (385:12): [True: 58, False: 0]
  ------------------
  386|     58|}
encode_key2text.c:ec_param_explicit_gen_to_text:
  390|     58|{
  391|     58|    int ret;
  392|     58|    size_t buflen;
  393|     58|    point_conversion_form_t form;
  394|     58|    const EC_POINT *point = NULL;
  395|     58|    const char *glabel = NULL;
  396|     58|    unsigned char *buf = NULL;
  397|       |
  398|     58|    form = EC_GROUP_get_point_conversion_form(group);
  399|     58|    point = EC_GROUP_get0_generator(group);
  400|       |
  401|     58|    if (point == NULL)
  ------------------
  |  Branch (401:9): [True: 0, False: 58]
  ------------------
  402|      0|        return 0;
  403|       |
  404|     58|    switch (form) {
  405|     54|    case POINT_CONVERSION_COMPRESSED:
  ------------------
  |  Branch (405:5): [True: 54, False: 4]
  ------------------
  406|     54|       glabel = "Generator (compressed):";
  407|     54|       break;
  408|      2|    case POINT_CONVERSION_UNCOMPRESSED:
  ------------------
  |  Branch (408:5): [True: 2, False: 56]
  ------------------
  409|      2|        glabel = "Generator (uncompressed):";
  410|      2|        break;
  411|      2|    case POINT_CONVERSION_HYBRID:
  ------------------
  |  Branch (411:5): [True: 2, False: 56]
  ------------------
  412|      2|        glabel = "Generator (hybrid):";
  413|      2|        break;
  414|      0|    default:
  ------------------
  |  Branch (414:5): [True: 0, False: 58]
  ------------------
  415|      0|        return 0;
  416|     58|    }
  417|       |
  418|     58|    buflen = EC_POINT_point2buf(group, point, form, &buf, ctx);
  419|     58|    if (buflen == 0)
  ------------------
  |  Branch (419:9): [True: 0, False: 58]
  ------------------
  420|      0|        return 0;
  421|       |
  422|     58|    ret = print_labeled_buf(out, glabel, buf, buflen);
  423|     58|    OPENSSL_clear_free(buf, buflen);
  ------------------
  |  |  105|     58|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     58|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     58|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  424|     58|    return ret;
  425|     58|}
encode_key2text.c:sm22text_encode:
  850|      5|    {                                                                   \
  851|      5|        /* We don't deal with abstract objects */                       \
  852|      5|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 5]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|      5|        return key2text_encode(vctx, key, selection, cout,              \
  857|      5|                               type##_to_text, cb, cbarg);              \
  858|      5|    }                                                                   \
encode_key2text.c:ed255192text_encode:
  850|      2|    {                                                                   \
  851|      2|        /* We don't deal with abstract objects */                       \
  852|      2|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 2]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|      2|        return key2text_encode(vctx, key, selection, cout,              \
  857|      2|                               type##_to_text, cb, cbarg);              \
  858|      2|    }                                                                   \
encode_key2text.c:ecx_to_text:
  571|      9|{
  572|      9|    const ECX_KEY *ecx = key;
  573|      9|    const char *type_label = NULL;
  574|       |
  575|      9|    if (out == NULL || ecx == NULL) {
  ------------------
  |  Branch (575:9): [True: 0, False: 9]
  |  Branch (575:24): [True: 0, False: 9]
  ------------------
  576|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  577|      0|        return 0;
  578|      0|    }
  579|       |
  580|      9|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|      9|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (580:9): [True: 9, False: 0]
  ------------------
  581|      9|        if (ecx->privkey == NULL) {
  ------------------
  |  Branch (581:13): [True: 0, False: 9]
  ------------------
  582|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  583|      0|            return 0;
  584|      0|        }
  585|       |
  586|      9|        switch (ecx->type) {
  ------------------
  |  Branch (586:17): [True: 0, False: 9]
  ------------------
  587|      1|        case ECX_KEY_TYPE_X25519:
  ------------------
  |  Branch (587:9): [True: 1, False: 8]
  ------------------
  588|      1|            type_label = "X25519 Private-Key";
  589|      1|            break;
  590|      5|        case ECX_KEY_TYPE_X448:
  ------------------
  |  Branch (590:9): [True: 5, False: 4]
  ------------------
  591|      5|            type_label = "X448 Private-Key";
  592|      5|            break;
  593|      2|        case ECX_KEY_TYPE_ED25519:
  ------------------
  |  Branch (593:9): [True: 2, False: 7]
  ------------------
  594|      2|            type_label = "ED25519 Private-Key";
  595|      2|            break;
  596|      1|        case ECX_KEY_TYPE_ED448:
  ------------------
  |  Branch (596:9): [True: 1, False: 8]
  ------------------
  597|      1|            type_label = "ED448 Private-Key";
  598|      1|            break;
  599|      9|        }
  600|      9|    } else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (600:16): [True: 0, False: 0]
  ------------------
  601|       |        /* ecx->pubkey is an array, not a pointer... */
  602|      0|        if (!ecx->haspubkey) {
  ------------------
  |  Branch (602:13): [True: 0, False: 0]
  ------------------
  603|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  604|      0|            return 0;
  605|      0|        }
  606|       |
  607|      0|        switch (ecx->type) {
  ------------------
  |  Branch (607:17): [True: 0, False: 0]
  ------------------
  608|      0|        case ECX_KEY_TYPE_X25519:
  ------------------
  |  Branch (608:9): [True: 0, False: 0]
  ------------------
  609|      0|            type_label = "X25519 Public-Key";
  610|      0|            break;
  611|      0|        case ECX_KEY_TYPE_X448:
  ------------------
  |  Branch (611:9): [True: 0, False: 0]
  ------------------
  612|      0|            type_label = "X448 Public-Key";
  613|      0|            break;
  614|      0|        case ECX_KEY_TYPE_ED25519:
  ------------------
  |  Branch (614:9): [True: 0, False: 0]
  ------------------
  615|      0|            type_label = "ED25519 Public-Key";
  616|      0|            break;
  617|      0|        case ECX_KEY_TYPE_ED448:
  ------------------
  |  Branch (617:9): [True: 0, False: 0]
  ------------------
  618|      0|            type_label = "ED448 Public-Key";
  619|      0|            break;
  620|      0|        }
  621|      0|    }
  622|       |
  623|      9|    if (BIO_printf(out, "%s:\n", type_label) <= 0)
  ------------------
  |  Branch (623:9): [True: 0, False: 9]
  ------------------
  624|      0|        return 0;
  625|      9|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0
  ------------------
  |  |  542|      9|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (625:9): [True: 9, False: 0]
  ------------------
  626|      9|        && !print_labeled_buf(out, "priv:", ecx->privkey, ecx->keylen))
  ------------------
  |  Branch (626:12): [True: 0, False: 9]
  ------------------
  627|      0|        return 0;
  628|      9|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0
  ------------------
  |  |  543|      9|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (628:9): [True: 9, False: 0]
  ------------------
  629|      9|        && !print_labeled_buf(out, "pub:", ecx->pubkey, ecx->keylen))
  ------------------
  |  Branch (629:12): [True: 0, False: 9]
  ------------------
  630|      0|        return 0;
  631|       |
  632|      9|    return 1;
  633|      9|}
encode_key2text.c:ed4482text_encode:
  850|      1|    {                                                                   \
  851|      1|        /* We don't deal with abstract objects */                       \
  852|      1|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 1]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|      1|        return key2text_encode(vctx, key, selection, cout,              \
  857|      1|                               type##_to_text, cb, cbarg);              \
  858|      1|    }                                                                   \
encode_key2text.c:x255192text_encode:
  850|      1|    {                                                                   \
  851|      1|        /* We don't deal with abstract objects */                       \
  852|      1|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 1]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|      1|        return key2text_encode(vctx, key, selection, cout,              \
  857|      1|                               type##_to_text, cb, cbarg);              \
  858|      1|    }                                                                   \
encode_key2text.c:x4482text_encode:
  850|      5|    {                                                                   \
  851|      5|        /* We don't deal with abstract objects */                       \
  852|      5|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 5]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|      5|        return key2text_encode(vctx, key, selection, cout,              \
  857|      5|                               type##_to_text, cb, cbarg);              \
  858|      5|    }                                                                   \
encode_key2text.c:rsa2text_encode:
  850|    362|    {                                                                   \
  851|    362|        /* We don't deal with abstract objects */                       \
  852|    362|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 362]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|    362|        return key2text_encode(vctx, key, selection, cout,              \
  857|    362|                               type##_to_text, cb, cbarg);              \
  858|    362|    }                                                                   \
encode_key2text.c:rsa_to_text:
  644|    363|{
  645|    363|    const RSA *rsa = key;
  646|    363|    const char *type_label = "RSA key";
  647|    363|    const char *modulus_label = NULL;
  648|    363|    const char *exponent_label = NULL;
  649|    363|    const BIGNUM *rsa_d = NULL, *rsa_n = NULL, *rsa_e = NULL;
  650|    363|    STACK_OF(BIGNUM_const) *factors = NULL;
  ------------------
  |  |   31|    363|# define STACK_OF(type) struct stack_st_##type
  ------------------
  651|    363|    STACK_OF(BIGNUM_const) *exps = NULL;
  ------------------
  |  |   31|    363|# define STACK_OF(type) struct stack_st_##type
  ------------------
  652|    363|    STACK_OF(BIGNUM_const) *coeffs = NULL;
  ------------------
  |  |   31|    363|# define STACK_OF(type) struct stack_st_##type
  ------------------
  653|    363|    int primes;
  654|    363|    const RSA_PSS_PARAMS_30 *pss_params = ossl_rsa_get0_pss_params_30((RSA *)rsa);
  655|    363|    int ret = 0;
  656|       |
  657|    363|    if (out == NULL || rsa == NULL) {
  ------------------
  |  Branch (657:9): [True: 0, False: 363]
  |  Branch (657:24): [True: 0, False: 363]
  ------------------
  658|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  659|      0|        goto err;
  660|      0|    }
  661|       |
  662|    363|    factors = sk_BIGNUM_const_new_null();
  663|    363|    exps = sk_BIGNUM_const_new_null();
  664|    363|    coeffs = sk_BIGNUM_const_new_null();
  665|       |
  666|    363|    if (factors == NULL || exps == NULL || coeffs == NULL) {
  ------------------
  |  Branch (666:9): [True: 0, False: 363]
  |  Branch (666:28): [True: 0, False: 363]
  |  Branch (666:44): [True: 0, False: 363]
  ------------------
  667|      0|        ERR_raise(ERR_LIB_PROV, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  668|      0|        goto err;
  669|      0|    }
  670|       |
  671|    363|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|    363|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (671:9): [True: 363, False: 0]
  ------------------
  672|    363|        type_label = "Private-Key";
  673|    363|        modulus_label = "modulus:";
  674|    363|        exponent_label = "publicExponent:";
  675|    363|    } else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
  ------------------
  |  |  543|      0|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (675:16): [True: 0, False: 0]
  ------------------
  676|      0|        type_label = "Public-Key";
  677|      0|        modulus_label = "Modulus:";
  678|      0|        exponent_label = "Exponent:";
  679|      0|    }
  680|       |
  681|    363|    RSA_get0_key(rsa, &rsa_n, &rsa_e, &rsa_d);
  682|    363|    ossl_rsa_get0_all_params((RSA *)rsa, factors, exps, coeffs);
  683|    363|    primes = sk_BIGNUM_const_num(factors);
  684|       |
  685|    363|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|    363|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (685:9): [True: 363, False: 0]
  ------------------
  686|    363|        if (BIO_printf(out, "%s: (%d bit, %d primes)\n",
  ------------------
  |  Branch (686:13): [True: 0, False: 363]
  ------------------
  687|    363|                       type_label, BN_num_bits(rsa_n), primes) <= 0)
  688|      0|            goto err;
  689|    363|    } else {
  690|      0|        if (BIO_printf(out, "%s: (%d bit)\n",
  ------------------
  |  Branch (690:13): [True: 0, False: 0]
  ------------------
  691|      0|                       type_label, BN_num_bits(rsa_n)) <= 0)
  692|      0|            goto err;
  693|      0|    }
  694|       |
  695|    363|    if (!print_labeled_bignum(out, modulus_label, rsa_n))
  ------------------
  |  Branch (695:9): [True: 0, False: 363]
  ------------------
  696|      0|        goto err;
  697|    363|    if (!print_labeled_bignum(out, exponent_label, rsa_e))
  ------------------
  |  Branch (697:9): [True: 0, False: 363]
  ------------------
  698|      0|        goto err;
  699|    363|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
  ------------------
  |  |  542|    363|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (699:9): [True: 363, False: 0]
  ------------------
  700|    363|        int i;
  701|       |
  702|    363|        if (!print_labeled_bignum(out, "privateExponent:", rsa_d))
  ------------------
  |  Branch (702:13): [True: 0, False: 363]
  ------------------
  703|      0|            goto err;
  704|    363|        if (!print_labeled_bignum(out, "prime1:",
  ------------------
  |  Branch (704:13): [True: 0, False: 363]
  ------------------
  705|    363|                                  sk_BIGNUM_const_value(factors, 0)))
  706|      0|            goto err;
  707|    363|        if (!print_labeled_bignum(out, "prime2:",
  ------------------
  |  Branch (707:13): [True: 0, False: 363]
  ------------------
  708|    363|                                  sk_BIGNUM_const_value(factors, 1)))
  709|      0|            goto err;
  710|    363|        if (!print_labeled_bignum(out, "exponent1:",
  ------------------
  |  Branch (710:13): [True: 0, False: 363]
  ------------------
  711|    363|                                  sk_BIGNUM_const_value(exps, 0)))
  712|      0|            goto err;
  713|    363|        if (!print_labeled_bignum(out, "exponent2:",
  ------------------
  |  Branch (713:13): [True: 0, False: 363]
  ------------------
  714|    363|                                  sk_BIGNUM_const_value(exps, 1)))
  715|      0|            goto err;
  716|    363|        if (!print_labeled_bignum(out, "coefficient:",
  ------------------
  |  Branch (716:13): [True: 0, False: 363]
  ------------------
  717|    363|                                  sk_BIGNUM_const_value(coeffs, 0)))
  718|      0|            goto err;
  719|  14.7k|        for (i = 2; i < sk_BIGNUM_const_num(factors); i++) {
  ------------------
  |  Branch (719:21): [True: 14.3k, False: 363]
  ------------------
  720|  14.3k|            if (BIO_printf(out, "prime%d:", i + 1) <= 0)
  ------------------
  |  Branch (720:17): [True: 0, False: 14.3k]
  ------------------
  721|      0|                goto err;
  722|  14.3k|            if (!print_labeled_bignum(out, NULL,
  ------------------
  |  Branch (722:17): [True: 0, False: 14.3k]
  ------------------
  723|  14.3k|                                      sk_BIGNUM_const_value(factors, i)))
  724|      0|                goto err;
  725|  14.3k|            if (BIO_printf(out, "exponent%d:", i + 1) <= 0)
  ------------------
  |  Branch (725:17): [True: 0, False: 14.3k]
  ------------------
  726|      0|                goto err;
  727|  14.3k|            if (!print_labeled_bignum(out, NULL,
  ------------------
  |  Branch (727:17): [True: 0, False: 14.3k]
  ------------------
  728|  14.3k|                                      sk_BIGNUM_const_value(exps, i)))
  729|      0|                goto err;
  730|  14.3k|            if (BIO_printf(out, "coefficient%d:", i + 1) <= 0)
  ------------------
  |  Branch (730:17): [True: 0, False: 14.3k]
  ------------------
  731|      0|                goto err;
  732|  14.3k|            if (!print_labeled_bignum(out, NULL,
  ------------------
  |  Branch (732:17): [True: 0, False: 14.3k]
  ------------------
  733|  14.3k|                                      sk_BIGNUM_const_value(coeffs, i - 1)))
  734|      0|                goto err;
  735|  14.3k|        }
  736|    363|    }
  737|       |
  738|    363|    if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0) {
  ------------------
  |  |  545|    363|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  ------------------
  |  Branch (738:9): [True: 363, False: 0]
  ------------------
  739|    363|        switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
  ------------------
  |  |  117|    363|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  |  Branch (739:17): [True: 0, False: 363]
  ------------------
  740|    362|        case RSA_FLAG_TYPE_RSA:
  ------------------
  |  |  118|    362|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
  |  Branch (740:9): [True: 362, False: 1]
  ------------------
  741|    362|            if (!ossl_rsa_pss_params_30_is_unrestricted(pss_params)) {
  ------------------
  |  Branch (741:17): [True: 0, False: 362]
  ------------------
  742|      0|                if (BIO_printf(out, "(INVALID PSS PARAMETERS)\n") <= 0)
  ------------------
  |  Branch (742:21): [True: 0, False: 0]
  ------------------
  743|      0|                    goto err;
  744|      0|            }
  745|    362|            break;
  746|    362|        case RSA_FLAG_TYPE_RSASSAPSS:
  ------------------
  |  |  119|      1|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (746:9): [True: 1, False: 362]
  ------------------
  747|      1|            if (ossl_rsa_pss_params_30_is_unrestricted(pss_params)) {
  ------------------
  |  Branch (747:17): [True: 0, False: 1]
  ------------------
  748|      0|                if (BIO_printf(out, "No PSS parameter restrictions\n") <= 0)
  ------------------
  |  Branch (748:21): [True: 0, False: 0]
  ------------------
  749|      0|                    goto err;
  750|      1|            } else {
  751|      1|                int hashalg_nid = ossl_rsa_pss_params_30_hashalg(pss_params);
  752|      1|                int maskgenalg_nid =
  753|      1|                    ossl_rsa_pss_params_30_maskgenalg(pss_params);
  754|      1|                int maskgenhashalg_nid =
  755|      1|                    ossl_rsa_pss_params_30_maskgenhashalg(pss_params);
  756|      1|                int saltlen = ossl_rsa_pss_params_30_saltlen(pss_params);
  757|      1|                int trailerfield =
  758|      1|                    ossl_rsa_pss_params_30_trailerfield(pss_params);
  759|       |
  760|      1|                if (BIO_printf(out, "PSS parameter restrictions:\n") <= 0)
  ------------------
  |  Branch (760:21): [True: 0, False: 1]
  ------------------
  761|      0|                    goto err;
  762|      1|                if (BIO_printf(out, "  Hash Algorithm: %s%s\n",
  ------------------
  |  Branch (762:21): [True: 0, False: 1]
  ------------------
  763|      1|                               ossl_rsa_oaeppss_nid2name(hashalg_nid),
  764|      1|                               (hashalg_nid == NID_sha1
  ------------------
  |  | 2308|      1|#define NID_sha1                64
  ------------------
  |  Branch (764:33): [True: 1, False: 0]
  ------------------
  765|      1|                                ? " (default)" : "")) <= 0)
  766|      0|                    goto err;
  767|      1|                if (BIO_printf(out, "  Mask Algorithm: %s with %s%s\n",
  ------------------
  |  Branch (767:21): [True: 0, False: 1]
  ------------------
  768|      1|                               ossl_rsa_mgf_nid2name(maskgenalg_nid),
  769|      1|                               ossl_rsa_oaeppss_nid2name(maskgenhashalg_nid),
  770|      1|                               (maskgenalg_nid == NID_mgf1
  ------------------
  |  |  573|      2|#define NID_mgf1                911
  ------------------
  |  Branch (770:33): [True: 1, False: 0]
  ------------------
  771|      1|                                && maskgenhashalg_nid == NID_sha1
  ------------------
  |  | 2308|      1|#define NID_sha1                64
  ------------------
  |  Branch (771:36): [True: 1, False: 0]
  ------------------
  772|      1|                                ? " (default)" : "")) <= 0)
  773|      0|                    goto err;
  774|      1|                if (BIO_printf(out, "  Minimum Salt Length: %d%s\n",
  ------------------
  |  Branch (774:21): [True: 0, False: 1]
  ------------------
  775|      1|                               saltlen,
  776|      1|                               (saltlen == 20 ? " (default)" : "")) <= 0)
  ------------------
  |  Branch (776:33): [True: 1, False: 0]
  ------------------
  777|      0|                    goto err;
  778|      1|                if (BIO_printf(out, "  Trailer Field: 0x%x%s\n",
  ------------------
  |  Branch (778:21): [True: 0, False: 1]
  ------------------
  779|      1|                               trailerfield,
  780|      1|                               (trailerfield == 1 ? " (default)" : "")) <= 0)
  ------------------
  |  Branch (780:33): [True: 1, False: 0]
  ------------------
  781|      0|                    goto err;
  782|      1|            }
  783|      1|            break;
  784|    363|        }
  785|    363|    }
  786|       |
  787|    363|    ret = 1;
  788|    363| err:
  789|    363|    sk_BIGNUM_const_free(factors);
  790|    363|    sk_BIGNUM_const_free(exps);
  791|    363|    sk_BIGNUM_const_free(coeffs);
  792|    363|    return ret;
  793|    363|}
encode_key2text.c:rsapss2text_encode:
  850|      1|    {                                                                   \
  851|      1|        /* We don't deal with abstract objects */                       \
  852|      1|        if (key_abstract != NULL) {                                     \
  ------------------
  |  Branch (852:13): [True: 0, False: 1]
  ------------------
  853|      0|            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  854|      0|            return 0;                                                   \
  855|      0|        }                                                               \
  856|      1|        return key2text_encode(vctx, key, selection, cout,              \
  857|      1|                               type##_to_text, cb, cbarg);              \
  858|      1|    }                                                                   \

ossl_read_der:
   89|   264k|{
   90|   264k|    BUF_MEM *mem = NULL;
   91|   264k|    BIO *in = ossl_bio_new_from_core_bio(provctx, cin);
   92|   264k|    int ok;
   93|       |
   94|   264k|    if (in == NULL)
  ------------------
  |  Branch (94:9): [True: 0, False: 264k]
  ------------------
   95|      0|        return 0;
   96|   264k|    ok = (asn1_d2i_read_bio(in, &mem) >= 0);
   97|   264k|    if (ok) {
  ------------------
  |  Branch (97:9): [True: 210k, False: 54.4k]
  ------------------
   98|   210k|        *data = (unsigned char *)mem->data;
   99|   210k|        *len = (long)mem->length;
  100|   210k|        OPENSSL_free(mem);
  ------------------
  |  |  107|   210k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|   210k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|   210k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  101|   210k|    }
  102|   264k|    BIO_free(in);
  103|   264k|    return ok;
  104|   264k|}

blake2_prov.c:blake2s256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
md5_prov.c:md5_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
md5_sha1_prov.c:md5_sha1_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
null_prov.c:nullmd_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
ripemd_prov.c:ripemd160_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha1_newctx:
   55|  7.33k|static void *name##_newctx(void *prov_ctx)                                     \
   56|  7.33k|{                                                                              \
   57|  7.33k|    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
  ------------------
  |  |   99|  7.33k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  7.33k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  7.33k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (57:16): [True: 7.33k, False: 0]
  ------------------
   58|  7.33k|    return ctx;                                                                \
   59|  7.33k|}                                                                              \
sha2_prov.c:sha1_internal_final:
   41|  7.33k|                                 size_t outsz)                                 \
   42|  7.33k|{                                                                              \
   43|  7.33k|    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
  ------------------
  |  Branch (43:9): [True: 7.33k, False: 0]
  |  Branch (43:35): [True: 7.33k, False: 0]
  |  Branch (43:56): [True: 7.33k, False: 0]
  ------------------
   44|  7.33k|        *outl = dgstsize;                                                      \
   45|  7.33k|        return 1;                                                              \
   46|  7.33k|    }                                                                          \
   47|  7.33k|    return 0;                                                                  \
   48|  7.33k|}
sha2_prov.c:sha1_freectx:
   60|  7.33k|static void name##_freectx(void *vctx)                                         \
   61|  7.33k|{                                                                              \
   62|  7.33k|    CTX *ctx = (CTX *)vctx;                                                    \
   63|  7.33k|    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
  ------------------
  |  |  105|  7.33k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  7.33k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  7.33k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   64|  7.33k|}                                                                              \
sha2_prov.c:sha1_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha1_internal_init:
  104|  7.33k|static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
  105|  7.33k|{                                                                              \
  106|  7.33k|    return ossl_prov_is_running()                                              \
  ------------------
  |  Branch (106:12): [True: 7.33k, False: 0]
  ------------------
  107|  7.33k|           && init(ctx)                                                        \
  ------------------
  |  Branch (107:15): [True: 7.33k, False: 0]
  ------------------
  108|  7.33k|           && set_ctx_params(ctx, params);                                     \
  ------------------
  |  Branch (108:15): [True: 7.33k, False: 0]
  ------------------
  109|  7.33k|}                                                                              \
sha2_prov.c:sha224_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha256_192_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha384_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha512_newctx:
   55|      4|static void *name##_newctx(void *prov_ctx)                                     \
   56|      4|{                                                                              \
   57|      4|    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (57:16): [True: 4, False: 0]
  ------------------
   58|      4|    return ctx;                                                                \
   59|      4|}                                                                              \
sha2_prov.c:sha512_internal_final:
   41|      4|                                 size_t outsz)                                 \
   42|      4|{                                                                              \
   43|      4|    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
  ------------------
  |  Branch (43:9): [True: 4, False: 0]
  |  Branch (43:35): [True: 4, False: 0]
  |  Branch (43:56): [True: 4, False: 0]
  ------------------
   44|      4|        *outl = dgstsize;                                                      \
   45|      4|        return 1;                                                              \
   46|      4|    }                                                                          \
   47|      4|    return 0;                                                                  \
   48|      4|}
sha2_prov.c:sha512_freectx:
   60|      4|static void name##_freectx(void *vctx)                                         \
   61|      4|{                                                                              \
   62|      4|    CTX *ctx = (CTX *)vctx;                                                    \
   63|      4|    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
  ------------------
  |  |  105|      4|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   64|      4|}                                                                              \
sha2_prov.c:sha512_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha512_internal_init:
   91|      4|                                ossl_unused const OSSL_PARAM params[])         \
   92|      4|{                                                                              \
   93|      4|    return ossl_prov_is_running() && init(ctx);                                \
  ------------------
  |  Branch (93:12): [True: 4, False: 0]
  |  Branch (93:38): [True: 4, False: 0]
  ------------------
   94|      4|}                                                                              \
sha2_prov.c:sha512_224_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha2_prov.c:sha512_256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:sha3_224_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:sha3_256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:sha3_384_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:sha3_512_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:keccak_224_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:keccak_256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:keccak_384_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:keccak_512_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:shake_128_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:shake_256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:keccak_kmac_128_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sha3_prov.c:keccak_kmac_256_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}
sm3_prov.c:sm3_get_params:
   28|      1|static int name##_get_params(OSSL_PARAM params[])                              \
   29|      1|{                                                                              \
   30|      1|    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
   31|      1|}

dh_kmgmt.c:dh_load:
  804|     86|{
  805|     86|    DH *dh = NULL;
  806|       |
  807|     86|    if (ossl_prov_is_running() && reference_sz == sizeof(dh)) {
  ------------------
  |  Branch (807:9): [True: 86, False: 0]
  |  Branch (807:35): [True: 86, False: 0]
  ------------------
  808|       |        /* The contents of the reference is the address to our object */
  809|     86|        dh = *(DH **)reference;
  810|       |        /* We grabbed, so we detach it */
  811|     86|        *(DH **)reference = NULL;
  812|     86|        return dh;
  813|     86|    }
  814|      0|    return NULL;
  815|     86|}
dh_kmgmt.c:dh_freedata:
  125|     86|{
  126|     86|    DH_free(keydata);
  127|     86|}
dh_kmgmt.c:dh_get_params:
  315|     86|{
  316|     86|    DH *dh = key;
  317|     86|    OSSL_PARAM *p;
  318|       |
  319|     86|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL
  ------------------
  |  |  316|     86|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  |  Branch (319:9): [True: 86, False: 0]
  ------------------
  320|     86|        && !OSSL_PARAM_set_int(p, DH_bits(dh)))
  ------------------
  |  Branch (320:12): [True: 0, False: 86]
  ------------------
  321|      0|        return 0;
  322|     86|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL
  ------------------
  |  |  427|     86|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  |  Branch (322:9): [True: 86, False: 0]
  ------------------
  323|     86|        && !OSSL_PARAM_set_int(p, DH_security_bits(dh)))
  ------------------
  |  Branch (323:12): [True: 0, False: 86]
  ------------------
  324|      0|        return 0;
  325|     86|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL
  ------------------
  |  |  368|     86|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  |  Branch (325:9): [True: 86, False: 0]
  ------------------
  326|     86|        && !OSSL_PARAM_set_int(p, DH_size(dh)))
  ------------------
  |  Branch (326:12): [True: 0, False: 86]
  ------------------
  327|      0|        return 0;
  328|     86|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY)) != NULL) {
  ------------------
  |  |  346|     86|# define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY "encoded-pub-key"
  ------------------
  |  Branch (328:9): [True: 0, False: 86]
  ------------------
  329|      0|        if (p->data_type != OSSL_PARAM_OCTET_STRING)
  ------------------
  |  |  123|      0|# define OSSL_PARAM_OCTET_STRING         5
  ------------------
  |  Branch (329:13): [True: 0, False: 0]
  ------------------
  330|      0|            return 0;
  331|      0|        p->return_size = ossl_dh_key2buf(dh, (unsigned char **)&p->data,
  332|      0|                                         p->data_size, 0);
  333|      0|        if (p->return_size == 0)
  ------------------
  |  Branch (333:13): [True: 0, False: 0]
  ------------------
  334|      0|            return 0;
  335|      0|    }
  336|       |
  337|     86|    return ossl_dh_params_todata(dh, NULL, params)
  ------------------
  |  Branch (337:12): [True: 86, False: 0]
  ------------------
  338|     86|        && ossl_dh_key_todata(dh, NULL, params, 1);
  ------------------
  |  Branch (338:12): [True: 86, False: 0]
  ------------------
  339|     86|}
dh_kmgmt.c:dh_has:
  130|     25|{
  131|     25|    const DH *dh = keydata;
  132|     25|    int ok = 1;
  133|       |
  134|     25|    if (!ossl_prov_is_running() || dh == NULL)
  ------------------
  |  Branch (134:9): [True: 0, False: 25]
  |  Branch (134:36): [True: 0, False: 25]
  ------------------
  135|      0|        return 0;
  136|     25|    if ((selection & DH_POSSIBLE_SELECTIONS) == 0)
  ------------------
  |  |   51|     25|    (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS)
  |  |  ------------------
  |  |  |  |  552|     25|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|     25|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|     25|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS)
  |  |  ------------------
  |  |  |  |  544|     25|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  ------------------
  |  Branch (136:9): [True: 0, False: 25]
  ------------------
  137|      0|        return 1; /* the selection is not missing */
  138|       |
  139|     25|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|     25|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (139:9): [True: 0, False: 25]
  ------------------
  140|      0|        ok = ok && (DH_get0_pub_key(dh) != NULL);
  ------------------
  |  Branch (140:14): [True: 0, False: 0]
  |  Branch (140:20): [True: 0, False: 0]
  ------------------
  141|     25|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|     25|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (141:9): [True: 25, False: 0]
  ------------------
  142|     25|        ok = ok && (DH_get0_priv_key(dh) != NULL);
  ------------------
  |  Branch (142:14): [True: 25, False: 0]
  |  Branch (142:20): [True: 25, False: 0]
  ------------------
  143|     25|    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|     25|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (143:9): [True: 0, False: 25]
  ------------------
  144|      0|        ok = ok && (DH_get0_p(dh) != NULL && DH_get0_g(dh) != NULL);
  ------------------
  |  Branch (144:14): [True: 0, False: 0]
  |  Branch (144:21): [True: 0, False: 0]
  |  Branch (144:46): [True: 0, False: 0]
  ------------------
  145|     25|    return ok;
  146|     25|}

dsa_kmgmt.c:dsa_load:
  637|    505|{
  638|    505|    DSA *dsa = NULL;
  639|       |
  640|    505|    if (ossl_prov_is_running() && reference_sz == sizeof(dsa)) {
  ------------------
  |  Branch (640:9): [True: 505, False: 0]
  |  Branch (640:35): [True: 505, False: 0]
  ------------------
  641|       |        /* The contents of the reference is the address to our object */
  642|    505|        dsa = *(DSA **)reference;
  643|       |        /* We grabbed, so we detach it */
  644|    505|        *(DSA **)reference = NULL;
  645|    505|        return dsa;
  646|    505|    }
  647|      0|    return NULL;
  648|    505|}
dsa_kmgmt.c:dsa_freedata:
  126|    505|{
  127|    505|    DSA_free(keydata);
  128|    505|}
dsa_kmgmt.c:dsa_get_params:
  313|    505|{
  314|    505|    DSA *dsa = key;
  315|    505|    OSSL_PARAM *p;
  316|       |
  317|    505|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL
  ------------------
  |  |  316|    505|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  |  Branch (317:9): [True: 505, False: 0]
  ------------------
  318|    505|        && !OSSL_PARAM_set_int(p, DSA_bits(dsa)))
  ------------------
  |  Branch (318:12): [True: 0, False: 505]
  ------------------
  319|      0|        return 0;
  320|    505|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL
  ------------------
  |  |  427|    505|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  |  Branch (320:9): [True: 505, False: 0]
  ------------------
  321|    505|        && !OSSL_PARAM_set_int(p, DSA_security_bits(dsa)))
  ------------------
  |  Branch (321:12): [True: 0, False: 505]
  ------------------
  322|      0|        return 0;
  323|    505|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL
  ------------------
  |  |  368|    505|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  |  Branch (323:9): [True: 505, False: 0]
  ------------------
  324|    505|        && !OSSL_PARAM_set_int(p, DSA_size(dsa)))
  ------------------
  |  Branch (324:12): [True: 0, False: 505]
  ------------------
  325|      0|        return 0;
  326|    505|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL
  ------------------
  |  |  318|    505|# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest"
  ------------------
  |  Branch (326:9): [True: 0, False: 505]
  ------------------
  327|    505|        && !OSSL_PARAM_set_utf8_string(p, DSA_DEFAULT_MD))
  ------------------
  |  |   48|      0|#define DSA_DEFAULT_MD "SHA256"
  ------------------
  |  Branch (327:12): [True: 0, False: 0]
  ------------------
  328|      0|        return 0;
  329|    505|    return ossl_ffc_params_todata(ossl_dsa_get0_params(dsa), NULL, params)
  ------------------
  |  Branch (329:12): [True: 505, False: 0]
  ------------------
  330|    505|           && dsa_key_todata(dsa, NULL, params, 1);
  ------------------
  |  Branch (330:15): [True: 505, False: 0]
  ------------------
  331|    505|}
dsa_kmgmt.c:dsa_key_todata:
  100|    505|{
  101|    505|    const BIGNUM *priv = NULL, *pub = NULL;
  102|       |
  103|    505|    if (dsa == NULL)
  ------------------
  |  Branch (103:9): [True: 0, False: 505]
  ------------------
  104|      0|        return 0;
  105|       |
  106|    505|    DSA_get0_key(dsa, &pub, &priv);
  107|    505|    if (include_private
  ------------------
  |  Branch (107:9): [True: 505, False: 0]
  ------------------
  108|    505|        && priv != NULL
  ------------------
  |  Branch (108:12): [True: 495, False: 10]
  ------------------
  109|    505|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_PRIV_KEY, priv))
  ------------------
  |  |  372|    495|# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
  ------------------
  |  Branch (109:12): [True: 0, False: 495]
  ------------------
  110|      0|        return 0;
  111|    505|    if (pub != NULL
  ------------------
  |  Branch (111:9): [True: 505, False: 0]
  ------------------
  112|    505|        && !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_PUB_KEY, pub))
  ------------------
  |  |  374|    505|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  |  Branch (112:12): [True: 0, False: 505]
  ------------------
  113|      0|        return 0;
  114|       |
  115|    505|    return 1;
  116|    505|}
dsa_kmgmt.c:dsa_has:
  131|    495|{
  132|    495|    const DSA *dsa = keydata;
  133|    495|    int ok = 1;
  134|       |
  135|    495|    if (!ossl_prov_is_running() || dsa == NULL)
  ------------------
  |  Branch (135:9): [True: 0, False: 495]
  |  Branch (135:36): [True: 0, False: 495]
  ------------------
  136|      0|        return 0;
  137|    495|    if ((selection & DSA_POSSIBLE_SELECTIONS) == 0)
  ------------------
  |  |   50|    495|    (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS)
  |  |  ------------------
  |  |  |  |  552|    495|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|    495|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|    495|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS)
  |  |  ------------------
  |  |  |  |  544|    495|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  ------------------
  ------------------
  |  Branch (137:9): [True: 0, False: 495]
  ------------------
  138|      0|        return 1; /* the selection is not missing */
  139|       |
  140|    495|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|    495|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (140:9): [True: 0, False: 495]
  ------------------
  141|      0|        ok = ok && (DSA_get0_pub_key(dsa) != NULL);
  ------------------
  |  Branch (141:14): [True: 0, False: 0]
  |  Branch (141:20): [True: 0, False: 0]
  ------------------
  142|    495|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|    495|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (142:9): [True: 495, False: 0]
  ------------------
  143|    495|        ok = ok && (DSA_get0_priv_key(dsa) != NULL);
  ------------------
  |  Branch (143:14): [True: 495, False: 0]
  |  Branch (143:20): [True: 495, False: 0]
  ------------------
  144|    495|    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|    495|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (144:9): [True: 0, False: 495]
  ------------------
  145|      0|        ok = ok && (DSA_get0_p(dsa) != NULL && DSA_get0_g(dsa) != NULL);
  ------------------
  |  Branch (145:14): [True: 0, False: 0]
  |  Branch (145:21): [True: 0, False: 0]
  |  Branch (145:48): [True: 0, False: 0]
  ------------------
  146|    495|    return ok;
  147|    495|}

ec_kmgmt.c:ec_load:
 1401|  10.4k|{
 1402|  10.4k|    return common_load(reference, reference_sz, 0);
 1403|  10.4k|}
ec_kmgmt.c:common_load:
 1383|  10.4k|{
 1384|  10.4k|    EC_KEY *ec = NULL;
 1385|       |
 1386|  10.4k|    if (ossl_prov_is_running() && reference_sz == sizeof(ec)) {
  ------------------
  |  Branch (1386:9): [True: 10.4k, False: 0]
  |  Branch (1386:35): [True: 10.4k, False: 0]
  ------------------
 1387|       |        /* The contents of the reference is the address to our object */
 1388|  10.4k|        ec = *(EC_KEY **)reference;
 1389|       |
 1390|  10.4k|        if (!common_check_sm2(ec, sm2_wanted))
  ------------------
  |  Branch (1390:13): [True: 0, False: 10.4k]
  ------------------
 1391|      0|            return NULL;
 1392|       |
 1393|       |        /* We grabbed, so we detach it */
 1394|  10.4k|        *(EC_KEY **)reference = NULL;
 1395|  10.4k|        return ec;
 1396|  10.4k|    }
 1397|      0|    return NULL;
 1398|  10.4k|}
ec_kmgmt.c:common_check_sm2:
  376|  10.4k|{
  377|  10.4k|    const EC_GROUP *ecg = NULL;
  378|       |
  379|       |    /*
  380|       |     * sm2_wanted: import the keys or domparams only on SM2 Curve
  381|       |     * !sm2_wanted: import the keys or domparams only not on SM2 Curve
  382|       |     */
  383|  10.4k|    if ((ecg = EC_KEY_get0_group(ec)) == NULL
  ------------------
  |  Branch (383:9): [True: 0, False: 10.4k]
  ------------------
  384|  10.4k|        || (sm2_wanted ^ (EC_GROUP_get_curve_name(ecg) == NID_sm2)))
  ------------------
  |  | 1228|  10.4k|#define NID_sm2         1172
  ------------------
  |  Branch (384:12): [True: 0, False: 10.4k]
  ------------------
  385|      0|        return 0;
  386|  10.4k|    return 1;
  387|  10.4k|}
ec_kmgmt.c:ec_freedata:
  299|  10.4k|{
  300|  10.4k|    EC_KEY_free(keydata);
  301|  10.4k|}
ec_kmgmt.c:ec_get_params:
  768|  10.4k|{
  769|  10.4k|    return common_get_params(key, params, 0);
  770|  10.4k|}
ec_kmgmt.c:common_get_params:
  637|  10.4k|{
  638|  10.4k|    int ret = 0;
  639|  10.4k|    EC_KEY *eck = key;
  640|  10.4k|    const EC_GROUP *ecg = NULL;
  641|  10.4k|    OSSL_PARAM *p;
  642|  10.4k|    unsigned char *pub_key = NULL, *genbuf = NULL;
  643|  10.4k|    OSSL_LIB_CTX *libctx;
  644|  10.4k|    const char *propq;
  645|  10.4k|    BN_CTX *bnctx = NULL;
  646|       |
  647|  10.4k|    ecg = EC_KEY_get0_group(eck);
  648|  10.4k|    if (ecg == NULL) {
  ------------------
  |  Branch (648:9): [True: 0, False: 10.4k]
  ------------------
  649|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_NO_PARAMETERS_SET);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  650|      0|        return 0;
  651|      0|    }
  652|       |
  653|  10.4k|    libctx = ossl_ec_key_get_libctx(eck);
  654|  10.4k|    propq = ossl_ec_key_get0_propq(eck);
  655|       |
  656|  10.4k|    bnctx = BN_CTX_new_ex(libctx);
  657|  10.4k|    if (bnctx == NULL)
  ------------------
  |  Branch (657:9): [True: 0, False: 10.4k]
  ------------------
  658|      0|        return 0;
  659|  10.4k|    BN_CTX_start(bnctx);
  660|       |
  661|  10.4k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL
  ------------------
  |  |  368|  10.4k|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  |  Branch (661:9): [True: 10.4k, False: 0]
  ------------------
  662|  10.4k|        && !OSSL_PARAM_set_int(p, ECDSA_size(eck)))
  ------------------
  |  Branch (662:12): [True: 0, False: 10.4k]
  ------------------
  663|      0|        goto err;
  664|  10.4k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL
  ------------------
  |  |  316|  10.4k|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  |  Branch (664:9): [True: 10.4k, False: 0]
  ------------------
  665|  10.4k|        && !OSSL_PARAM_set_int(p, EC_GROUP_order_bits(ecg)))
  ------------------
  |  Branch (665:12): [True: 0, False: 10.4k]
  ------------------
  666|      0|        goto err;
  667|  10.4k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL) {
  ------------------
  |  |  427|  10.4k|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  |  Branch (667:9): [True: 10.4k, False: 0]
  ------------------
  668|  10.4k|        int ecbits, sec_bits;
  669|       |
  670|  10.4k|        ecbits = EC_GROUP_order_bits(ecg);
  671|       |
  672|       |        /*
  673|       |         * The following estimates are based on the values published
  674|       |         * in Table 2 of "NIST Special Publication 800-57 Part 1 Revision 4"
  675|       |         * at http://dx.doi.org/10.6028/NIST.SP.800-57pt1r4 .
  676|       |         *
  677|       |         * Note that the above reference explicitly categorizes algorithms in a
  678|       |         * discrete set of values {80, 112, 128, 192, 256}, and that it is
  679|       |         * relevant only for NIST approved Elliptic Curves, while OpenSSL
  680|       |         * applies the same logic also to other curves.
  681|       |         *
  682|       |         * Classifications produced by other standardazing bodies might differ,
  683|       |         * so the results provided for "bits of security" by this provider are
  684|       |         * to be considered merely indicative, and it is the users'
  685|       |         * responsibility to compare these values against the normative
  686|       |         * references that may be relevant for their intent and purposes.
  687|       |         */
  688|  10.4k|        if (ecbits >= 512)
  ------------------
  |  Branch (688:13): [True: 816, False: 9.60k]
  ------------------
  689|    816|            sec_bits = 256;
  690|  9.60k|        else if (ecbits >= 384)
  ------------------
  |  Branch (690:18): [True: 1.39k, False: 8.20k]
  ------------------
  691|  1.39k|            sec_bits = 192;
  692|  8.20k|        else if (ecbits >= 256)
  ------------------
  |  Branch (692:18): [True: 1.31k, False: 6.89k]
  ------------------
  693|  1.31k|            sec_bits = 128;
  694|  6.89k|        else if (ecbits >= 224)
  ------------------
  |  Branch (694:18): [True: 1.54k, False: 5.35k]
  ------------------
  695|  1.54k|            sec_bits = 112;
  696|  5.35k|        else if (ecbits >= 160)
  ------------------
  |  Branch (696:18): [True: 1.58k, False: 3.76k]
  ------------------
  697|  1.58k|            sec_bits = 80;
  698|  3.76k|        else
  699|  3.76k|            sec_bits = ecbits / 2;
  700|       |
  701|  10.4k|        if (!OSSL_PARAM_set_int(p, sec_bits))
  ------------------
  |  Branch (701:13): [True: 0, False: 10.4k]
  ------------------
  702|      0|            goto err;
  703|  10.4k|    }
  704|       |
  705|  10.4k|    if ((p = OSSL_PARAM_locate(params,
  ------------------
  |  Branch (705:9): [True: 0, False: 10.4k]
  ------------------
  706|  10.4k|                               OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS))
  ------------------
  |  |  334|  10.4k|# define OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS "decoded-from-explicit"
  ------------------
  707|  10.4k|            != NULL) {
  708|      0|        int explicitparams = EC_KEY_decoded_from_explicit_params(eck);
  709|       |
  710|      0|        if (explicitparams < 0
  ------------------
  |  Branch (710:13): [True: 0, False: 0]
  ------------------
  711|      0|             || !OSSL_PARAM_set_int(p, explicitparams))
  ------------------
  |  Branch (711:17): [True: 0, False: 0]
  ------------------
  712|      0|            goto err;
  713|      0|    }
  714|       |
  715|  10.4k|    if (!sm2) {
  ------------------
  |  Branch (715:9): [True: 10.4k, False: 15]
  ------------------
  716|  10.4k|        if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL
  ------------------
  |  |  318|  10.4k|# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest"
  ------------------
  |  Branch (716:13): [True: 0, False: 10.4k]
  ------------------
  717|  10.4k|                && !OSSL_PARAM_set_utf8_string(p, EC_DEFAULT_MD))
  ------------------
  |  |   72|      0|#define EC_DEFAULT_MD "SHA256"
  ------------------
  |  Branch (717:20): [True: 0, False: 0]
  ------------------
  718|      0|            goto err;
  719|  10.4k|    } else {
  720|     15|        if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL
  ------------------
  |  |  318|     15|# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest"
  ------------------
  |  Branch (720:13): [True: 0, False: 15]
  ------------------
  721|     15|                && !OSSL_PARAM_set_utf8_string(p, SM2_DEFAULT_MD))
  ------------------
  |  |   75|      0|#define SM2_DEFAULT_MD "SM3"
  ------------------
  |  Branch (721:20): [True: 0, False: 0]
  ------------------
  722|      0|            goto err;
  723|     15|    }
  724|       |
  725|       |    /* SM2 doesn't support this PARAM */
  726|  10.4k|    if (!sm2) {
  ------------------
  |  Branch (726:9): [True: 10.4k, False: 15]
  ------------------
  727|  10.4k|        p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH);
  ------------------
  |  |  428|  10.4k|# define OSSL_PKEY_PARAM_USE_COFACTOR_ECDH OSSL_PKEY_PARAM_USE_COFACTOR_FLAG
  |  |  ------------------
  |  |  |  |  429|  10.4k|# define OSSL_PKEY_PARAM_USE_COFACTOR_FLAG "use-cofactor-flag"
  |  |  ------------------
  ------------------
  728|  10.4k|        if (p != NULL) {
  ------------------
  |  Branch (728:13): [True: 0, False: 10.4k]
  ------------------
  729|      0|            int ecdh_cofactor_mode = 0;
  730|       |
  731|      0|            ecdh_cofactor_mode =
  732|      0|                (EC_KEY_get_flags(eck) & EC_FLAG_COFACTOR_ECDH) ? 1 : 0;
  ------------------
  |  |  963|      0|#  define EC_FLAG_COFACTOR_ECDH          0x1000
  ------------------
  |  Branch (732:17): [True: 0, False: 0]
  ------------------
  733|       |
  734|      0|            if (!OSSL_PARAM_set_int(p, ecdh_cofactor_mode))
  ------------------
  |  Branch (734:17): [True: 0, False: 0]
  ------------------
  735|      0|                goto err;
  736|      0|        }
  737|  10.4k|    }
  738|  10.4k|    if ((p = OSSL_PARAM_locate(params,
  ------------------
  |  Branch (738:9): [True: 0, False: 10.4k]
  ------------------
  739|  10.4k|                               OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY)) != NULL) {
  ------------------
  |  |  346|  10.4k|# define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY "encoded-pub-key"
  ------------------
  740|      0|        const EC_POINT *ecp = EC_KEY_get0_public_key(key);
  741|       |
  742|      0|        if (ecp == NULL) {
  ------------------
  |  Branch (742:13): [True: 0, False: 0]
  ------------------
  743|      0|            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  744|      0|            goto err;
  745|      0|        }
  746|      0|        p->return_size = EC_POINT_point2oct(ecg, ecp,
  747|      0|                                            POINT_CONVERSION_UNCOMPRESSED,
  748|      0|                                            p->data, p->data_size, bnctx);
  749|      0|        if (p->return_size == 0)
  ------------------
  |  Branch (749:13): [True: 0, False: 0]
  ------------------
  750|      0|            goto err;
  751|      0|    }
  752|       |
  753|  10.4k|    ret = ec_get_ecm_params(ecg, params)
  ------------------
  |  Branch (753:11): [True: 10.4k, False: 0]
  ------------------
  754|  10.4k|          && ossl_ec_group_todata(ecg, NULL, params, libctx, propq, bnctx,
  ------------------
  |  Branch (754:14): [True: 10.4k, False: 0]
  ------------------
  755|  10.4k|                                  &genbuf)
  756|  10.4k|          && key_to_params(eck, NULL, params, 1, &pub_key)
  ------------------
  |  Branch (756:14): [True: 10.4k, False: 0]
  ------------------
  757|  10.4k|          && otherparams_to_params(eck, NULL, params);
  ------------------
  |  Branch (757:14): [True: 10.4k, False: 0]
  ------------------
  758|  10.4k|err:
  759|  10.4k|    OPENSSL_free(genbuf);
  ------------------
  |  |  107|  10.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  10.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  10.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  760|  10.4k|    OPENSSL_free(pub_key);
  ------------------
  |  |  107|  10.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  10.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  10.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  761|  10.4k|    BN_CTX_end(bnctx);
  762|  10.4k|    BN_CTX_free(bnctx);
  763|  10.4k|    return ret;
  764|  10.4k|}
ec_kmgmt.c:ec_get_ecm_params:
  585|  10.4k|{
  586|       |#ifdef OPENSSL_NO_EC2M
  587|       |    return 1;
  588|       |#else
  589|  10.4k|    int ret = 0, m;
  590|  10.4k|    unsigned int k1 = 0, k2 = 0, k3 = 0;
  591|  10.4k|    int basis_nid;
  592|  10.4k|    const char *basis_name = NULL;
  593|  10.4k|    int fid = EC_GROUP_get_field_type(group);
  594|       |
  595|  10.4k|    if (fid != NID_X9_62_characteristic_two_field)
  ------------------
  |  |  156|  10.4k|#define NID_X9_62_characteristic_two_field              407
  ------------------
  |  Branch (595:9): [True: 4.35k, False: 6.06k]
  ------------------
  596|  4.35k|        return 1;
  597|       |
  598|  6.06k|    basis_nid = EC_GROUP_get_basis_type(group);
  599|  6.06k|    if (basis_nid == NID_X9_62_tpBasis)
  ------------------
  |  |  168|  6.06k|#define NID_X9_62_tpBasis               682
  ------------------
  |  Branch (599:9): [True: 3.61k, False: 2.45k]
  ------------------
  600|  3.61k|        basis_name = SN_X9_62_tpBasis;
  ------------------
  |  |  167|  3.61k|#define SN_X9_62_tpBasis                "tpBasis"
  ------------------
  601|  2.45k|    else if (basis_nid == NID_X9_62_ppBasis)
  ------------------
  |  |  172|  2.45k|#define NID_X9_62_ppBasis               683
  ------------------
  |  Branch (601:14): [True: 2.45k, False: 0]
  ------------------
  602|  2.45k|        basis_name = SN_X9_62_ppBasis;
  ------------------
  |  |  171|  2.45k|#define SN_X9_62_ppBasis                "ppBasis"
  ------------------
  603|      0|    else
  604|      0|        goto err;
  605|       |
  606|  6.06k|    m = EC_GROUP_get_degree(group);
  607|  6.06k|    if (!ossl_param_build_set_int(NULL, params, OSSL_PKEY_PARAM_EC_CHAR2_M, m)
  ------------------
  |  |  327|  6.06k|# define OSSL_PKEY_PARAM_EC_CHAR2_M "m"
  ------------------
  |  Branch (607:9): [True: 0, False: 6.06k]
  ------------------
  608|  6.06k|        || !ossl_param_build_set_utf8_string(NULL, params,
  ------------------
  |  Branch (608:12): [True: 0, False: 6.06k]
  ------------------
  609|  6.06k|                                             OSSL_PKEY_PARAM_EC_CHAR2_TYPE,
  ------------------
  |  |  332|  6.06k|# define OSSL_PKEY_PARAM_EC_CHAR2_TYPE "basis-type"
  ------------------
  610|  6.06k|                                             basis_name))
  611|      0|        goto err;
  612|       |
  613|  6.06k|    if (basis_nid == NID_X9_62_tpBasis) {
  ------------------
  |  |  168|  6.06k|#define NID_X9_62_tpBasis               682
  ------------------
  |  Branch (613:9): [True: 3.61k, False: 2.45k]
  ------------------
  614|  3.61k|        if (!EC_GROUP_get_trinomial_basis(group, &k1)
  ------------------
  |  Branch (614:13): [True: 0, False: 3.61k]
  ------------------
  615|  3.61k|            || !ossl_param_build_set_int(NULL, params,
  ------------------
  |  Branch (615:16): [True: 0, False: 3.61k]
  ------------------
  616|  3.61k|                                         OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS,
  ------------------
  |  |  331|  3.61k|# define OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS "tp"
  ------------------
  617|  3.61k|                                         (int)k1))
  618|      0|            goto err;
  619|  3.61k|    } else {
  620|  2.45k|        if (!EC_GROUP_get_pentanomial_basis(group, &k1, &k2, &k3)
  ------------------
  |  Branch (620:13): [True: 0, False: 2.45k]
  ------------------
  621|  2.45k|            || !ossl_param_build_set_int(NULL, params,
  ------------------
  |  Branch (621:16): [True: 0, False: 2.45k]
  ------------------
  622|  2.45k|                                         OSSL_PKEY_PARAM_EC_CHAR2_PP_K1, (int)k1)
  ------------------
  |  |  328|  2.45k|# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K1 "k1"
  ------------------
  623|  2.45k|            || !ossl_param_build_set_int(NULL, params,
  ------------------
  |  Branch (623:16): [True: 0, False: 2.45k]
  ------------------
  624|  2.45k|                                         OSSL_PKEY_PARAM_EC_CHAR2_PP_K2, (int)k2)
  ------------------
  |  |  329|  2.45k|# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K2 "k2"
  ------------------
  625|  2.45k|            || !ossl_param_build_set_int(NULL, params,
  ------------------
  |  Branch (625:16): [True: 0, False: 2.45k]
  ------------------
  626|  2.45k|                                         OSSL_PKEY_PARAM_EC_CHAR2_PP_K3, (int)k3))
  ------------------
  |  |  330|  2.45k|# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K3 "k3"
  ------------------
  627|      0|            goto err;
  628|  2.45k|    }
  629|  6.06k|    ret = 1;
  630|  6.06k|err:
  631|  6.06k|    return ret;
  632|  6.06k|#endif /* OPENSSL_NO_EC2M */
  633|  6.06k|}
ec_kmgmt.c:key_to_params:
  114|  10.4k|{
  115|  10.4k|    BIGNUM *x = NULL, *y = NULL;
  116|  10.4k|    const BIGNUM *priv_key = NULL;
  117|  10.4k|    const EC_POINT *pub_point = NULL;
  118|  10.4k|    const EC_GROUP *ecg = NULL;
  119|  10.4k|    size_t pub_key_len = 0;
  120|  10.4k|    int ret = 0;
  121|  10.4k|    BN_CTX *bnctx = NULL;
  122|       |
  123|  10.4k|    if (eckey == NULL
  ------------------
  |  Branch (123:9): [True: 0, False: 10.4k]
  ------------------
  124|  10.4k|        || (ecg = EC_KEY_get0_group(eckey)) == NULL)
  ------------------
  |  Branch (124:12): [True: 0, False: 10.4k]
  ------------------
  125|      0|        return 0;
  126|       |
  127|  10.4k|    priv_key = EC_KEY_get0_private_key(eckey);
  128|  10.4k|    pub_point = EC_KEY_get0_public_key(eckey);
  129|       |
  130|  10.4k|    if (pub_point != NULL) {
  ------------------
  |  Branch (130:9): [True: 10.4k, False: 0]
  ------------------
  131|  10.4k|        OSSL_PARAM *p = NULL, *px = NULL, *py = NULL;
  132|       |        /*
  133|       |         * EC_POINT_point2buf() can generate random numbers in some
  134|       |         * implementations so we need to ensure we use the correct libctx.
  135|       |         */
  136|  10.4k|        bnctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(eckey));
  137|  10.4k|        if (bnctx == NULL)
  ------------------
  |  Branch (137:13): [True: 0, False: 10.4k]
  ------------------
  138|      0|            goto err;
  139|       |
  140|       |
  141|       |        /* If we are doing a get then check first before decoding the point */
  142|  10.4k|        if (tmpl == NULL) {
  ------------------
  |  Branch (142:13): [True: 10.4k, False: 0]
  ------------------
  143|  10.4k|            p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_PUB_KEY);
  ------------------
  |  |  374|  10.4k|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  144|  10.4k|            px = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_EC_PUB_X);
  ------------------
  |  |  343|  10.4k|# define OSSL_PKEY_PARAM_EC_PUB_X "qx"
  ------------------
  145|  10.4k|            py = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_EC_PUB_Y);
  ------------------
  |  |  344|  10.4k|# define OSSL_PKEY_PARAM_EC_PUB_Y "qy"
  ------------------
  146|  10.4k|        }
  147|       |
  148|  10.4k|        if (p != NULL || tmpl != NULL) {
  ------------------
  |  Branch (148:13): [True: 0, False: 10.4k]
  |  Branch (148:26): [True: 0, False: 10.4k]
  ------------------
  149|       |            /* convert pub_point to a octet string according to the SECG standard */
  150|      0|            point_conversion_form_t format = EC_KEY_get_conv_form(eckey);
  151|       |
  152|      0|            if ((pub_key_len = EC_POINT_point2buf(ecg, pub_point,
  ------------------
  |  Branch (152:17): [True: 0, False: 0]
  ------------------
  153|      0|                                                  format,
  154|      0|                                                  pub_key, bnctx)) == 0
  155|      0|                || !ossl_param_build_set_octet_string(tmpl, p,
  ------------------
  |  Branch (155:20): [True: 0, False: 0]
  ------------------
  156|      0|                                                      OSSL_PKEY_PARAM_PUB_KEY,
  ------------------
  |  |  374|      0|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  157|      0|                                                      *pub_key, pub_key_len))
  158|      0|                goto err;
  159|      0|        }
  160|  10.4k|        if (px != NULL || py != NULL) {
  ------------------
  |  Branch (160:13): [True: 0, False: 10.4k]
  |  Branch (160:27): [True: 0, False: 10.4k]
  ------------------
  161|      0|            if (px != NULL) {
  ------------------
  |  Branch (161:17): [True: 0, False: 0]
  ------------------
  162|      0|                x = BN_CTX_get(bnctx);
  163|      0|                if (x == NULL)
  ------------------
  |  Branch (163:21): [True: 0, False: 0]
  ------------------
  164|      0|                    goto err;
  165|      0|            }
  166|      0|            if (py != NULL) {
  ------------------
  |  Branch (166:17): [True: 0, False: 0]
  ------------------
  167|      0|                y = BN_CTX_get(bnctx);
  168|      0|                if (y == NULL)
  ------------------
  |  Branch (168:21): [True: 0, False: 0]
  ------------------
  169|      0|                    goto err;
  170|      0|            }
  171|       |
  172|      0|            if (!EC_POINT_get_affine_coordinates(ecg, pub_point, x, y, bnctx))
  ------------------
  |  Branch (172:17): [True: 0, False: 0]
  ------------------
  173|      0|                goto err;
  174|      0|            if (px != NULL
  ------------------
  |  Branch (174:17): [True: 0, False: 0]
  ------------------
  175|      0|                && !ossl_param_build_set_bn(tmpl, px,
  ------------------
  |  Branch (175:20): [True: 0, False: 0]
  ------------------
  176|      0|                                            OSSL_PKEY_PARAM_EC_PUB_X, x))
  ------------------
  |  |  343|      0|# define OSSL_PKEY_PARAM_EC_PUB_X "qx"
  ------------------
  177|      0|                goto err;
  178|      0|            if (py != NULL
  ------------------
  |  Branch (178:17): [True: 0, False: 0]
  ------------------
  179|      0|                && !ossl_param_build_set_bn(tmpl, py,
  ------------------
  |  Branch (179:20): [True: 0, False: 0]
  ------------------
  180|      0|                                            OSSL_PKEY_PARAM_EC_PUB_Y, y))
  ------------------
  |  |  344|      0|# define OSSL_PKEY_PARAM_EC_PUB_Y "qy"
  ------------------
  181|      0|                goto err;
  182|      0|        }
  183|  10.4k|    }
  184|       |
  185|  10.4k|    if (priv_key != NULL && include_private) {
  ------------------
  |  Branch (185:9): [True: 560, False: 9.85k]
  |  Branch (185:29): [True: 560, False: 0]
  ------------------
  186|    560|        size_t sz;
  187|    560|        int ecbits;
  188|       |
  189|       |        /*
  190|       |         * Key import/export should never leak the bit length of the secret
  191|       |         * scalar in the key.
  192|       |         *
  193|       |         * For this reason, on export we use padded BIGNUMs with fixed length.
  194|       |         *
  195|       |         * When importing we also should make sure that, even if short lived,
  196|       |         * the newly created BIGNUM is marked with the BN_FLG_CONSTTIME flag as
  197|       |         * soon as possible, so that any processing of this BIGNUM might opt for
  198|       |         * constant time implementations in the backend.
  199|       |         *
  200|       |         * Setting the BN_FLG_CONSTTIME flag alone is never enough, we also have
  201|       |         * to preallocate the BIGNUM internal buffer to a fixed public size big
  202|       |         * enough that operations performed during the processing never trigger
  203|       |         * a realloc which would leak the size of the scalar through memory
  204|       |         * accesses.
  205|       |         *
  206|       |         * Fixed Length
  207|       |         * ------------
  208|       |         *
  209|       |         * The order of the large prime subgroup of the curve is our choice for
  210|       |         * a fixed public size, as that is generally the upper bound for
  211|       |         * generating a private key in EC cryptosystems and should fit all valid
  212|       |         * secret scalars.
  213|       |         *
  214|       |         * For padding on export we just use the bit length of the order
  215|       |         * converted to bytes (rounding up).
  216|       |         *
  217|       |         * For preallocating the BIGNUM storage we look at the number of "words"
  218|       |         * required for the internal representation of the order, and we
  219|       |         * preallocate 2 extra "words" in case any of the subsequent processing
  220|       |         * might temporarily overflow the order length.
  221|       |         */
  222|    560|        ecbits = EC_GROUP_order_bits(ecg);
  223|    560|        if (ecbits <= 0)
  ------------------
  |  Branch (223:13): [True: 0, False: 560]
  ------------------
  224|      0|            goto err;
  225|    560|        sz = (ecbits + 7) / 8;
  226|       |
  227|    560|        if (!ossl_param_build_set_bn_pad(tmpl, params,
  ------------------
  |  Branch (227:13): [True: 0, False: 560]
  ------------------
  228|    560|                                         OSSL_PKEY_PARAM_PRIV_KEY,
  ------------------
  |  |  372|    560|# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
  ------------------
  229|    560|                                         priv_key, sz))
  230|      0|            goto err;
  231|    560|    }
  232|  10.4k|    ret = 1;
  233|  10.4k| err:
  234|  10.4k|    BN_CTX_free(bnctx);
  235|  10.4k|    return ret;
  236|  10.4k|}
ec_kmgmt.c:otherparams_to_params:
  241|  10.4k|{
  242|  10.4k|    int ecdh_cofactor_mode = 0, group_check = 0;
  243|  10.4k|    const char *name = NULL;
  244|  10.4k|    point_conversion_form_t format;
  245|       |
  246|  10.4k|    if (ec == NULL)
  ------------------
  |  Branch (246:9): [True: 0, False: 10.4k]
  ------------------
  247|      0|        return 0;
  248|       |
  249|  10.4k|    format = EC_KEY_get_conv_form(ec);
  250|  10.4k|    name = ossl_ec_pt_format_id2name((int)format);
  251|  10.4k|    if (name != NULL
  ------------------
  |  Branch (251:9): [True: 8.87k, False: 1.53k]
  ------------------
  252|  10.4k|        && !ossl_param_build_set_utf8_string(tmpl, params,
  ------------------
  |  Branch (252:12): [True: 0, False: 8.87k]
  ------------------
  253|  8.87k|                                             OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT,
  ------------------
  |  |  342|  8.87k|# define OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT "point-format"
  ------------------
  254|  8.87k|                                             name))
  255|      0|        return 0;
  256|       |
  257|  10.4k|    group_check = EC_KEY_get_flags(ec) & EC_FLAG_CHECK_NAMED_GROUP_MASK;
  ------------------
  |  |  967|  10.4k|    (EC_FLAG_CHECK_NAMED_GROUP | EC_FLAG_CHECK_NAMED_GROUP_NIST)
  |  |  ------------------
  |  |  |  |  964|  10.4k|#  define EC_FLAG_CHECK_NAMED_GROUP      0x2000
  |  |  ------------------
  |  |                   (EC_FLAG_CHECK_NAMED_GROUP | EC_FLAG_CHECK_NAMED_GROUP_NIST)
  |  |  ------------------
  |  |  |  |  965|  10.4k|#  define EC_FLAG_CHECK_NAMED_GROUP_NIST 0x4000
  |  |  ------------------
  ------------------
  258|  10.4k|    name = ossl_ec_check_group_type_id2name(group_check);
  259|  10.4k|    if (name != NULL
  ------------------
  |  Branch (259:9): [True: 10.4k, False: 0]
  ------------------
  260|  10.4k|        && !ossl_param_build_set_utf8_string(tmpl, params,
  ------------------
  |  Branch (260:12): [True: 0, False: 10.4k]
  ------------------
  261|  10.4k|                                             OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE,
  ------------------
  |  |  338|  10.4k|# define OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE "group-check"
  ------------------
  262|  10.4k|                                             name))
  263|      0|        return 0;
  264|       |
  265|  10.4k|    if ((EC_KEY_get_enc_flags(ec) & EC_PKEY_NO_PUBKEY) != 0
  ------------------
  |  |  959|  10.4k|#  define EC_PKEY_NO_PUBKEY       0x002
  ------------------
  |  Branch (265:9): [True: 417, False: 10.0k]
  ------------------
  266|  10.4k|            && !ossl_param_build_set_int(tmpl, params,
  ------------------
  |  Branch (266:16): [True: 0, False: 417]
  ------------------
  267|    417|                                         OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 0))
  ------------------
  |  |  339|    417|# define OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC "include-public"
  ------------------
  268|      0|        return 0;
  269|       |
  270|  10.4k|    ecdh_cofactor_mode =
  271|  10.4k|        (EC_KEY_get_flags(ec) & EC_FLAG_COFACTOR_ECDH) ? 1 : 0;
  ------------------
  |  |  963|  10.4k|#  define EC_FLAG_COFACTOR_ECDH          0x1000
  ------------------
  |  Branch (271:9): [True: 0, False: 10.4k]
  ------------------
  272|  10.4k|    return ossl_param_build_set_int(tmpl, params,
  273|  10.4k|                                    OSSL_PKEY_PARAM_USE_COFACTOR_ECDH,
  ------------------
  |  |  428|  10.4k|# define OSSL_PKEY_PARAM_USE_COFACTOR_ECDH OSSL_PKEY_PARAM_USE_COFACTOR_FLAG
  |  |  ------------------
  |  |  |  |  429|  10.4k|# define OSSL_PKEY_PARAM_USE_COFACTOR_FLAG "use-cofactor-flag"
  |  |  ------------------
  ------------------
  274|  10.4k|                                    ecdh_cofactor_mode);
  275|  10.4k|}
ec_kmgmt.c:ec_has:
  305|    560|{
  306|    560|    const EC_KEY *ec = keydata;
  307|    560|    int ok = 1;
  308|       |
  309|    560|    if (!ossl_prov_is_running() || ec == NULL)
  ------------------
  |  Branch (309:9): [True: 0, False: 560]
  |  Branch (309:36): [True: 0, False: 560]
  ------------------
  310|      0|        return 0;
  311|    560|    if ((selection & EC_POSSIBLE_SELECTIONS) == 0)
  ------------------
  |  |   74|    560|    (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS)
  |  |  ------------------
  |  |  |  |  552|    560|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|    560|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|    560|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS)
  |  |  ------------------
  |  |  |  |  549|    560|    ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|    560|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  |  |  |  |  ------------------
  |  |  |  |  550|    560|      | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|    560|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (311:9): [True: 0, False: 560]
  ------------------
  312|      0|        return 1; /* the selection is not missing */
  313|       |
  314|    560|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|    560|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (314:9): [True: 0, False: 560]
  ------------------
  315|      0|        ok = ok && (EC_KEY_get0_public_key(ec) != NULL);
  ------------------
  |  Branch (315:14): [True: 0, False: 0]
  |  Branch (315:20): [True: 0, False: 0]
  ------------------
  316|    560|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|    560|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (316:9): [True: 560, False: 0]
  ------------------
  317|    560|        ok = ok && (EC_KEY_get0_private_key(ec) != NULL);
  ------------------
  |  Branch (317:14): [True: 560, False: 0]
  |  Branch (317:20): [True: 560, False: 0]
  ------------------
  318|    560|    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
  ------------------
  |  |  544|    560|# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS      0x04
  ------------------
  |  Branch (318:9): [True: 0, False: 560]
  ------------------
  319|      0|        ok = ok && (EC_KEY_get0_group(ec) != NULL);
  ------------------
  |  Branch (319:14): [True: 0, False: 0]
  |  Branch (319:20): [True: 0, False: 0]
  ------------------
  320|       |    /*
  321|       |     * We consider OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS to always be
  322|       |     * available, so no extra check is needed other than the previous one
  323|       |     * against EC_POSSIBLE_SELECTIONS.
  324|       |     */
  325|    560|    return ok;
  326|    560|}
ec_kmgmt.c:sm2_load:
 1408|     15|{
 1409|     15|    return common_load(reference, reference_sz, 1);
 1410|     15|}
ec_kmgmt.c:sm2_get_params:
  860|     15|{
  861|     15|    return common_get_params(key, params, 1);
  862|     15|}

ecx_kmgmt.c:x25519_get_params:
  321|      4|{
  322|      4|    return ecx_get_params(key, params, X25519_BITS, X25519_SECURITY_BITS,
  ------------------
  |  |   33|      4|#  define X25519_BITS           253
  ------------------
                  return ecx_get_params(key, params, X25519_BITS, X25519_SECURITY_BITS,
  ------------------
  |  |   34|      4|#  define X25519_SECURITY_BITS  128
  ------------------
  323|      4|                          X25519_KEYLEN);
  ------------------
  |  |   26|      4|#  define X25519_KEYLEN         32
  ------------------
  324|      4|}
ecx_kmgmt.c:ecx_get_params:
  286|     17|{
  287|     17|    ECX_KEY *ecx = key;
  288|     17|    OSSL_PARAM *p;
  289|       |
  290|     17|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL
  ------------------
  |  |  316|     17|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  |  Branch (290:9): [True: 17, False: 0]
  ------------------
  291|     17|        && !OSSL_PARAM_set_int(p, bits))
  ------------------
  |  Branch (291:12): [True: 0, False: 17]
  ------------------
  292|      0|        return 0;
  293|     17|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL
  ------------------
  |  |  427|     17|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  |  Branch (293:9): [True: 17, False: 0]
  ------------------
  294|     17|        && !OSSL_PARAM_set_int(p, secbits))
  ------------------
  |  Branch (294:12): [True: 0, False: 17]
  ------------------
  295|      0|        return 0;
  296|     17|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL
  ------------------
  |  |  368|     17|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  |  Branch (296:9): [True: 17, False: 0]
  ------------------
  297|     17|        && !OSSL_PARAM_set_int(p, size))
  ------------------
  |  Branch (297:12): [True: 0, False: 17]
  ------------------
  298|      0|        return 0;
  299|     17|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY)) != NULL
  ------------------
  |  |  346|     17|# define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY "encoded-pub-key"
  ------------------
  |  Branch (299:9): [True: 0, False: 17]
  ------------------
  300|     17|            && (ecx->type == ECX_KEY_TYPE_X25519
  ------------------
  |  Branch (300:17): [True: 0, False: 0]
  ------------------
  301|      0|                || ecx->type == ECX_KEY_TYPE_X448)) {
  ------------------
  |  Branch (301:20): [True: 0, False: 0]
  ------------------
  302|      0|        if (!OSSL_PARAM_set_octet_string(p, ecx->pubkey, ecx->keylen))
  ------------------
  |  Branch (302:13): [True: 0, False: 0]
  ------------------
  303|      0|            return 0;
  304|      0|    }
  305|       |
  306|     17|    return key_to_params(ecx, NULL, params, 1);
  307|     17|}
ecx_kmgmt.c:key_to_params:
  214|     17|{
  215|     17|    if (key == NULL)
  ------------------
  |  Branch (215:9): [True: 0, False: 17]
  ------------------
  216|      0|        return 0;
  217|       |
  218|     17|    if (!ossl_param_build_set_octet_string(tmpl, params,
  ------------------
  |  Branch (218:9): [True: 0, False: 17]
  ------------------
  219|     17|                                           OSSL_PKEY_PARAM_PUB_KEY,
  ------------------
  |  |  374|     17|# define OSSL_PKEY_PARAM_PUB_KEY "pub"
  ------------------
  220|     17|                                           key->pubkey, key->keylen))
  221|      0|        return 0;
  222|       |
  223|     17|    if (include_private
  ------------------
  |  Branch (223:9): [True: 17, False: 0]
  ------------------
  224|     17|        && key->privkey != NULL
  ------------------
  |  Branch (224:12): [True: 9, False: 8]
  ------------------
  225|     17|        && !ossl_param_build_set_octet_string(tmpl, params,
  ------------------
  |  Branch (225:12): [True: 0, False: 9]
  ------------------
  226|      9|                                              OSSL_PKEY_PARAM_PRIV_KEY,
  ------------------
  |  |  372|      9|# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
  ------------------
  227|      9|                                              key->privkey, key->keylen))
  228|      0|        return 0;
  229|       |
  230|     17|    return 1;
  231|     17|}
ecx_kmgmt.c:ecx_has:
  126|      9|{
  127|      9|    const ECX_KEY *key = keydata;
  128|      9|    int ok = 0;
  129|       |
  130|      9|    if (ossl_prov_is_running() && key != NULL) {
  ------------------
  |  Branch (130:9): [True: 9, False: 0]
  |  Branch (130:35): [True: 9, False: 0]
  ------------------
  131|       |        /*
  132|       |         * ECX keys always have all the parameters they need (i.e. none).
  133|       |         * Therefore we always return with 1, if asked about parameters.
  134|       |         */
  135|      9|        ok = 1;
  136|       |
  137|      9|        if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|      9|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (137:13): [True: 0, False: 9]
  ------------------
  138|      0|            ok = ok && key->haspubkey;
  ------------------
  |  Branch (138:18): [True: 0, False: 0]
  |  Branch (138:24): [True: 0, False: 0]
  ------------------
  139|       |
  140|      9|        if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|      9|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (140:13): [True: 9, False: 0]
  ------------------
  141|      9|            ok = ok && key->privkey != NULL;
  ------------------
  |  Branch (141:18): [True: 9, False: 0]
  |  Branch (141:24): [True: 9, False: 0]
  ------------------
  142|      9|    }
  143|      9|    return ok;
  144|      9|}
ecx_kmgmt.c:ecx_load:
  728|     17|{
  729|     17|    ECX_KEY *key = NULL;
  730|       |
  731|     17|    if (ossl_prov_is_running() && reference_sz == sizeof(key)) {
  ------------------
  |  Branch (731:9): [True: 17, False: 0]
  |  Branch (731:35): [True: 17, False: 0]
  ------------------
  732|       |        /* The contents of the reference is the address to our object */
  733|     17|        key = *(ECX_KEY **)reference;
  734|       |        /* We grabbed, so we detach it */
  735|     17|        *(ECX_KEY **)reference = NULL;
  736|     17|        return key;
  737|     17|    }
  738|      0|    return NULL;
  739|     17|}
ecx_kmgmt.c:x448_get_params:
  327|      6|{
  328|      6|    return ecx_get_params(key, params, X448_BITS, X448_SECURITY_BITS,
  ------------------
  |  |   36|      6|#  define X448_BITS             448
  ------------------
                  return ecx_get_params(key, params, X448_BITS, X448_SECURITY_BITS,
  ------------------
  |  |   37|      6|#  define X448_SECURITY_BITS    224
  ------------------
  329|      6|                          X448_KEYLEN);
  ------------------
  |  |   27|      6|#  define X448_KEYLEN           56
  ------------------
  330|      6|}
ecx_kmgmt.c:ed25519_get_params:
  333|      5|{
  334|      5|    return ecx_get_params(key, params, ED25519_BITS, ED25519_SECURITY_BITS,
  ------------------
  |  |   39|      5|#  define ED25519_BITS          256
  ------------------
                  return ecx_get_params(key, params, ED25519_BITS, ED25519_SECURITY_BITS,
  ------------------
  |  |   41|      5|#  define ED25519_SECURITY_BITS 128
  ------------------
  |  Branch (334:12): [True: 5, False: 0]
  ------------------
  335|      5|                          ED25519_SIGSIZE)
  ------------------
  |  |   42|      5|#  define ED25519_SIGSIZE       64
  ------------------
  336|      5|        && ed_get_params(key, params);
  ------------------
  |  Branch (336:12): [True: 5, False: 0]
  ------------------
  337|      5|}
ecx_kmgmt.c:ed_get_params:
  310|      7|{
  311|      7|    OSSL_PARAM *p;
  312|       |
  313|      7|    if ((p = OSSL_PARAM_locate(params,
  ------------------
  |  Branch (313:9): [True: 0, False: 7]
  ------------------
  314|      7|                               OSSL_PKEY_PARAM_MANDATORY_DIGEST)) != NULL
  ------------------
  |  |  366|      7|# define OSSL_PKEY_PARAM_MANDATORY_DIGEST "mandatory-digest"
  ------------------
  315|      7|        && !OSSL_PARAM_set_utf8_string(p, ""))
  ------------------
  |  Branch (315:12): [True: 0, False: 0]
  ------------------
  316|      0|        return 0;
  317|      7|    return 1;
  318|      7|}
ecx_kmgmt.c:ed448_get_params:
  340|      2|{
  341|      2|    return ecx_get_params(key, params, ED448_BITS, ED448_SECURITY_BITS,
  ------------------
  |  |   44|      2|#  define ED448_BITS            456
  ------------------
                  return ecx_get_params(key, params, ED448_BITS, ED448_SECURITY_BITS,
  ------------------
  |  |   46|      2|#  define ED448_SECURITY_BITS   224
  ------------------
  |  Branch (341:12): [True: 2, False: 0]
  ------------------
  342|      2|                          ED448_SIGSIZE)
  ------------------
  |  |   47|      2|#  define ED448_SIGSIZE         114
  ------------------
  343|      2|        && ed_get_params(key, params);
  ------------------
  |  Branch (343:12): [True: 2, False: 0]
  ------------------
  344|      2|}

rsa_kmgmt.c:rsa_load:
  673|    510|{
  674|    510|    return common_load(reference, reference_sz, RSA_FLAG_TYPE_RSA);
  ------------------
  |  |  118|    510|# define RSA_FLAG_TYPE_RSA             0x0000
  ------------------
  675|    510|}
rsa_kmgmt.c:common_load:
  655|  3.98k|{
  656|  3.98k|    RSA *rsa = NULL;
  657|       |
  658|  3.98k|    if (ossl_prov_is_running() && reference_sz == sizeof(rsa)) {
  ------------------
  |  Branch (658:9): [True: 3.98k, False: 0]
  |  Branch (658:35): [True: 3.98k, False: 0]
  ------------------
  659|       |        /* The contents of the reference is the address to our object */
  660|  3.98k|        rsa = *(RSA **)reference;
  661|       |
  662|  3.98k|        if (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK) != expected_rsa_type)
  ------------------
  |  |  117|  3.98k|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  |  Branch (662:13): [True: 0, False: 3.98k]
  ------------------
  663|      0|            return NULL;
  664|       |
  665|       |        /* We grabbed, so we detach it */
  666|  3.98k|        *(RSA **)reference = NULL;
  667|  3.98k|        return rsa;
  668|  3.98k|    }
  669|      0|    return NULL;
  670|  3.98k|}
rsa_kmgmt.c:rsa_freedata:
  111|  3.98k|{
  112|  3.98k|    RSA_free(keydata);
  113|  3.98k|}
rsa_kmgmt.c:rsa_get_params:
  331|  3.98k|{
  332|  3.98k|    RSA *rsa = key;
  333|  3.98k|    const RSA_PSS_PARAMS_30 *pss_params = ossl_rsa_get0_pss_params_30(rsa);
  334|  3.98k|    int rsa_type = RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK);
  ------------------
  |  |  117|  3.98k|# define RSA_FLAG_TYPE_MASK            0xF000
  ------------------
  335|  3.98k|    OSSL_PARAM *p;
  336|  3.98k|    int empty = RSA_get0_n(rsa) == NULL;
  337|       |
  338|  3.98k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL
  ------------------
  |  |  316|  3.98k|# define OSSL_PKEY_PARAM_BITS "bits"
  ------------------
  |  Branch (338:9): [True: 3.98k, False: 0]
  ------------------
  339|  3.98k|        && (empty || !OSSL_PARAM_set_int(p, RSA_bits(rsa))))
  ------------------
  |  Branch (339:13): [True: 0, False: 3.98k]
  |  Branch (339:22): [True: 0, False: 3.98k]
  ------------------
  340|      0|        return 0;
  341|  3.98k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL
  ------------------
  |  |  427|  3.98k|# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
  ------------------
  |  Branch (341:9): [True: 3.98k, False: 0]
  ------------------
  342|  3.98k|        && (empty || !OSSL_PARAM_set_int(p, RSA_security_bits(rsa))))
  ------------------
  |  Branch (342:13): [True: 0, False: 3.98k]
  |  Branch (342:22): [True: 0, False: 3.98k]
  ------------------
  343|      0|        return 0;
  344|  3.98k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL
  ------------------
  |  |  368|  3.98k|# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
  ------------------
  |  Branch (344:9): [True: 3.98k, False: 0]
  ------------------
  345|  3.98k|        && (empty || !OSSL_PARAM_set_int(p, RSA_size(rsa))))
  ------------------
  |  Branch (345:13): [True: 0, False: 3.98k]
  |  Branch (345:22): [True: 0, False: 3.98k]
  ------------------
  346|      0|        return 0;
  347|       |
  348|       |    /*
  349|       |     * For restricted RSA-PSS keys, we ignore the default digest request.
  350|       |     * With RSA-OAEP keys, this may need to be amended.
  351|       |     */
  352|  3.98k|    if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL
  ------------------
  |  |  318|  3.98k|# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest"
  ------------------
  |  Branch (352:9): [True: 0, False: 3.98k]
  ------------------
  353|  3.98k|        && (rsa_type != RSA_FLAG_TYPE_RSASSAPSS
  ------------------
  |  |  119|      0|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (353:13): [True: 0, False: 0]
  ------------------
  354|      0|            || ossl_rsa_pss_params_30_is_unrestricted(pss_params))) {
  ------------------
  |  Branch (354:16): [True: 0, False: 0]
  ------------------
  355|      0|        if (!OSSL_PARAM_set_utf8_string(p, RSA_DEFAULT_MD))
  ------------------
  |  |   54|      0|#define RSA_DEFAULT_MD "SHA256"
  ------------------
  |  Branch (355:13): [True: 0, False: 0]
  ------------------
  356|      0|            return 0;
  357|      0|    }
  358|       |
  359|       |    /*
  360|       |     * For non-RSA-PSS keys, we ignore the mandatory digest request.
  361|       |     * With RSA-OAEP keys, this may need to be amended.
  362|       |     */
  363|  3.98k|    if ((p = OSSL_PARAM_locate(params,
  ------------------
  |  Branch (363:9): [True: 0, False: 3.98k]
  ------------------
  364|  3.98k|                               OSSL_PKEY_PARAM_MANDATORY_DIGEST)) != NULL
  ------------------
  |  |  366|  3.98k|# define OSSL_PKEY_PARAM_MANDATORY_DIGEST "mandatory-digest"
  ------------------
  365|  3.98k|        && rsa_type == RSA_FLAG_TYPE_RSASSAPSS
  ------------------
  |  |  119|  3.98k|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (365:12): [True: 0, False: 0]
  ------------------
  366|  3.98k|        && !ossl_rsa_pss_params_30_is_unrestricted(pss_params)) {
  ------------------
  |  Branch (366:12): [True: 0, False: 0]
  ------------------
  367|      0|        const char *mdname =
  368|      0|            ossl_rsa_oaeppss_nid2name(ossl_rsa_pss_params_30_hashalg(pss_params));
  369|       |
  370|      0|        if (mdname == NULL || !OSSL_PARAM_set_utf8_string(p, mdname))
  ------------------
  |  Branch (370:13): [True: 0, False: 0]
  |  Branch (370:31): [True: 0, False: 0]
  ------------------
  371|      0|            return 0;
  372|      0|    }
  373|  3.98k|    return (rsa_type != RSA_FLAG_TYPE_RSASSAPSS
  ------------------
  |  |  119|  7.96k|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  |  Branch (373:13): [True: 510, False: 3.47k]
  ------------------
  374|  3.98k|            || ossl_rsa_pss_params_30_todata(pss_params, NULL, params))
  ------------------
  |  Branch (374:16): [True: 3.47k, False: 0]
  ------------------
  375|  3.98k|        && ossl_rsa_todata(rsa, NULL, params, 1);
  ------------------
  |  Branch (375:12): [True: 3.98k, False: 0]
  ------------------
  376|  3.98k|}
rsa_kmgmt.c:rsa_has:
  116|    363|{
  117|    363|    const RSA *rsa = keydata;
  118|    363|    int ok = 1;
  119|       |
  120|    363|    if (rsa == NULL || !ossl_prov_is_running())
  ------------------
  |  Branch (120:9): [True: 0, False: 363]
  |  Branch (120:24): [True: 0, False: 363]
  ------------------
  121|      0|        return 0;
  122|    363|    if ((selection & RSA_POSSIBLE_SELECTIONS) == 0)
  ------------------
  |  |   57|    363|    (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  552|    363|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|    363|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  |  |  ------------------
  |  |  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|    363|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
  |  |  ------------------
  |  |  |  |  545|    363|# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS       0x80
  |  |  ------------------
  ------------------
  |  Branch (122:9): [True: 0, False: 363]
  ------------------
  123|      0|        return 1; /* the selection is not missing */
  124|       |
  125|       |    /* OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS are always available even if empty */
  126|    363|    if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0)
  ------------------
  |  |  552|    363|    ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  542|    363|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  |  |  ------------------
  |  |                   ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
  |  |  ------------------
  |  |  |  |  543|    363|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  |  |  ------------------
  ------------------
  |  Branch (126:9): [True: 363, False: 0]
  ------------------
  127|    363|        ok = ok && (RSA_get0_n(rsa) != NULL);
  ------------------
  |  Branch (127:14): [True: 363, False: 0]
  |  Branch (127:20): [True: 363, False: 0]
  ------------------
  128|    363|    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
  ------------------
  |  |  543|    363|# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY             0x02
  ------------------
  |  Branch (128:9): [True: 0, False: 363]
  ------------------
  129|      0|        ok = ok && (RSA_get0_e(rsa) != NULL);
  ------------------
  |  Branch (129:14): [True: 0, False: 0]
  |  Branch (129:20): [True: 0, False: 0]
  ------------------
  130|    363|    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
  ------------------
  |  |  542|    363|# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY            0x01
  ------------------
  |  Branch (130:9): [True: 363, False: 0]
  ------------------
  131|    363|        ok = ok && (RSA_get0_d(rsa) != NULL);
  ------------------
  |  Branch (131:14): [True: 363, False: 0]
  |  Branch (131:20): [True: 363, False: 0]
  ------------------
  132|    363|    return ok;
  133|    363|}
rsa_kmgmt.c:rsapss_load:
  678|  3.47k|{
  679|  3.47k|    return common_load(reference, reference_sz, RSA_FLAG_TYPE_RSASSAPSS);
  ------------------
  |  |  119|  3.47k|# define RSA_FLAG_TYPE_RSASSAPSS       0x1000
  ------------------
  680|  3.47k|}

ossl_prov_drbg_nonce_ctx_new:
  277|      4|{
  278|      4|    PROV_DRBG_NONCE_GLOBAL *dngbl = OPENSSL_zalloc(sizeof(*dngbl));
  ------------------
  |  |   99|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  279|       |
  280|      4|    if (dngbl == NULL)
  ------------------
  |  Branch (280:9): [True: 0, False: 4]
  ------------------
  281|      0|        return NULL;
  282|       |
  283|      4|    dngbl->rand_nonce_lock = CRYPTO_THREAD_lock_new();
  284|      4|    if (dngbl->rand_nonce_lock == NULL) {
  ------------------
  |  Branch (284:9): [True: 0, False: 4]
  ------------------
  285|      0|        OPENSSL_free(dngbl);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  286|      0|        return NULL;
  287|      0|    }
  288|       |
  289|      4|    return dngbl;
  290|      4|}
ossl_prov_drbg_nonce_ctx_free:
  293|      2|{
  294|      2|    PROV_DRBG_NONCE_GLOBAL *dngbl = vdngbl;
  295|       |
  296|      2|    if (dngbl == NULL)
  ------------------
  |  Branch (296:9): [True: 0, False: 2]
  ------------------
  297|      0|        return;
  298|       |
  299|      2|    CRYPTO_THREAD_lock_free(dngbl->rand_nonce_lock);
  300|       |
  301|      2|    OPENSSL_free(dngbl);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  302|      2|}

seed_src.c:seed_src_new:
   47|      1|{
   48|      1|    PROV_SEED_SRC *s;
   49|       |
   50|      1|    if (parent != NULL) {
  ------------------
  |  Branch (50:9): [True: 0, False: 1]
  ------------------
   51|      0|        ERR_raise(ERR_LIB_PROV, PROV_R_SEED_SOURCES_MUST_NOT_HAVE_A_PARENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   52|      0|        return NULL;
   53|      0|    }
   54|       |
   55|      1|    s = OPENSSL_zalloc(sizeof(*s));
  ------------------
  |  |   99|      1|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      1|    if (s == NULL)
  ------------------
  |  Branch (56:9): [True: 0, False: 1]
  ------------------
   57|      0|        return NULL;
   58|       |
   59|      1|    s->provctx = provctx;
   60|      1|    s->state = EVP_RAND_STATE_UNINITIALISED;
  ------------------
  |  | 1292|      1|# define EVP_RAND_STATE_UNINITIALISED    0
  ------------------
   61|      1|    return s;
   62|      1|}
seed_src.c:seed_src_free:
   65|      1|{
   66|      1|    OPENSSL_free(vseed);
  ------------------
  |  |  107|      1|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   67|      1|}
seed_src.c:seed_src_instantiate:
   73|      1|{
   74|      1|    PROV_SEED_SRC *s = (PROV_SEED_SRC *)vseed;
   75|       |
   76|      1|    s->state = EVP_RAND_STATE_READY;
  ------------------
  |  | 1293|      1|# define EVP_RAND_STATE_READY            1
  ------------------
   77|      1|    return 1;
   78|      1|}
seed_src.c:seed_src_lock:
  221|      1|{
  222|      1|    return 1;
  223|      1|}
seed_src.c:seed_src_unlock:
  226|      1|{
  227|      1|}

ossl_rand_pool_init:
  568|      1|{
  569|      1|    size_t i;
  570|       |
  571|      5|    for (i = 0; i < OSSL_NELEM(random_devices); i++)
  ------------------
  |  |   14|      5|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (571:17): [True: 4, False: 1]
  ------------------
  572|      4|        random_devices[i].fd = -1;
  573|       |
  574|      1|    return 1;
  575|      1|}
ossl_rand_pool_cleanup:
  578|      1|{
  579|      1|    size_t i;
  580|       |
  581|      5|    for (i = 0; i < OSSL_NELEM(random_devices); i++)
  ------------------
  |  |   14|      5|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (581:17): [True: 4, False: 1]
  ------------------
  582|      4|        close_random_device(i);
  583|      1|}
rand_unix.c:close_random_device:
  559|      4|{
  560|      4|    struct random_device *rd = &random_devices[n];
  561|       |
  562|      4|    if (check_random_device(rd))
  ------------------
  |  Branch (562:9): [True: 0, False: 4]
  ------------------
  563|      0|        close(rd->fd);
  564|      4|    rd->fd = -1;
  565|      4|}
rand_unix.c:check_random_device:
  514|      4|{
  515|      4|    struct stat st;
  516|       |
  517|      4|    return rd->fd != -1
  ------------------
  |  Branch (517:12): [True: 0, False: 4]
  ------------------
  518|      4|           && fstat(rd->fd, &st) != -1
  ------------------
  |  Branch (518:15): [True: 0, False: 0]
  ------------------
  519|      4|           && rd->dev == st.st_dev
  ------------------
  |  Branch (519:15): [True: 0, False: 0]
  ------------------
  520|      4|           && rd->ino == st.st_ino
  ------------------
  |  Branch (520:15): [True: 0, False: 0]
  ------------------
  521|      4|           && ((rd->mode ^ st.st_mode) & ~(S_IRWXU | S_IRWXG | S_IRWXO)) == 0
  ------------------
  |  Branch (521:15): [True: 0, False: 0]
  ------------------
  522|      4|           && rd->rdev == st.st_rdev;
  ------------------
  |  Branch (522:15): [True: 0, False: 0]
  ------------------
  523|      4|}

ossl_prov_is_running:
   20|  38.4k|{
   21|  38.4k|    return 1;
   22|  38.4k|}

ssl_sort_cipher_list:
 3250|      2|{
 3251|      2|    qsort(tls13_ciphers, TLS13_NUM_CIPHERS, sizeof(tls13_ciphers[0]),
  ------------------
  |  |   24|      2|#define TLS13_NUM_CIPHERS       OSSL_NELEM(tls13_ciphers)
  |  |  ------------------
  |  |  |  |   14|      2|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
 3252|      2|          cipher_compare);
 3253|      2|    qsort(ssl3_ciphers, SSL3_NUM_CIPHERS, sizeof(ssl3_ciphers[0]),
  ------------------
  |  |   25|      2|#define SSL3_NUM_CIPHERS        OSSL_NELEM(ssl3_ciphers)
  |  |  ------------------
  |  |  |  |   14|      2|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
 3254|      2|          cipher_compare);
 3255|      2|    qsort(ssl3_scsvs, SSL3_NUM_SCSVS, sizeof(ssl3_scsvs[0]), cipher_compare);
  ------------------
  |  |   26|      2|#define SSL3_NUM_SCSVS          OSSL_NELEM(ssl3_scsvs)
  |  |  ------------------
  |  |  |  |   14|      2|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
 3256|      2|}
ssl3_get_cipher_by_id:
 4110|    377|{
 4111|    377|    SSL_CIPHER c;
 4112|    377|    const SSL_CIPHER *cp;
 4113|       |
 4114|    377|    c.id = id;
 4115|    377|    cp = OBJ_bsearch_ssl_cipher_id(&c, tls13_ciphers, TLS13_NUM_CIPHERS);
  ------------------
  |  |   24|    377|#define TLS13_NUM_CIPHERS       OSSL_NELEM(tls13_ciphers)
  |  |  ------------------
  |  |  |  |   14|    377|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
 4116|    377|    if (cp != NULL)
  ------------------
  |  Branch (4116:9): [True: 119, False: 258]
  ------------------
 4117|    119|        return cp;
 4118|    258|    cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS);
  ------------------
  |  |   25|    258|#define SSL3_NUM_CIPHERS        OSSL_NELEM(ssl3_ciphers)
  |  |  ------------------
  |  |  |  |   14|    258|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
 4119|    258|    if (cp != NULL)
  ------------------
  |  Branch (4119:9): [True: 249, False: 9]
  ------------------
 4120|    249|        return cp;
 4121|      9|    return OBJ_bsearch_ssl_cipher_id(&c, ssl3_scsvs, SSL3_NUM_SCSVS);
  ------------------
  |  |   26|      9|#define SSL3_NUM_SCSVS          OSSL_NELEM(ssl3_scsvs)
  |  |  ------------------
  |  |  |  |   14|      9|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
 4122|    258|}
s3_lib.c:cipher_compare:
 3240|  1.93k|{
 3241|  1.93k|    const SSL_CIPHER *ap = (const SSL_CIPHER *)a;
 3242|  1.93k|    const SSL_CIPHER *bp = (const SSL_CIPHER *)b;
 3243|       |
 3244|  1.93k|    if (ap->id == bp->id)
  ------------------
  |  Branch (3244:9): [True: 0, False: 1.93k]
  ------------------
 3245|      0|        return 0;
 3246|  1.93k|    return ap->id < bp->id ? -1 : 1;
  ------------------
  |  Branch (3246:12): [True: 1.24k, False: 694]
  ------------------
 3247|  1.93k|}

i2d_SSL_SESSION:
  110|    363|{
  111|       |
  112|    363|    SSL_SESSION_ASN1 as;
  113|       |
  114|    363|    ASN1_OCTET_STRING cipher;
  115|    363|    unsigned char cipher_data[2];
  116|    363|    ASN1_OCTET_STRING master_key, session_id, sid_ctx;
  117|       |
  118|    363|#ifndef OPENSSL_NO_COMP
  119|    363|    ASN1_OCTET_STRING comp_id;
  120|    363|    unsigned char comp_id_data;
  121|    363|#endif
  122|    363|    ASN1_OCTET_STRING tlsext_hostname, tlsext_tick;
  123|    363|#ifndef OPENSSL_NO_SRP
  124|    363|    ASN1_OCTET_STRING srp_username;
  125|    363|#endif
  126|    363|#ifndef OPENSSL_NO_PSK
  127|    363|    ASN1_OCTET_STRING psk_identity, psk_identity_hint;
  128|    363|#endif
  129|    363|    ASN1_OCTET_STRING alpn_selected;
  130|    363|    ASN1_OCTET_STRING ticket_appdata;
  131|    363|    ASN1_OCTET_STRING peer_rpk;
  132|       |
  133|    363|    long l;
  134|    363|    int ret;
  135|       |
  136|    363|    if ((in == NULL) || ((in->cipher == NULL) && (in->cipher_id == 0)))
  ------------------
  |  Branch (136:9): [True: 0, False: 363]
  |  Branch (136:26): [True: 0, False: 363]
  |  Branch (136:50): [True: 0, False: 0]
  ------------------
  137|      0|        return 0;
  138|       |
  139|    363|    memset(&as, 0, sizeof(as));
  140|       |
  141|    363|    as.version = SSL_SESSION_ASN1_VERSION;
  ------------------
  |  |   58|    363|# define SSL_SESSION_ASN1_VERSION 0x0001
  ------------------
  142|    363|    as.ssl_version = in->ssl_version;
  143|       |
  144|    363|    as.kex_group = in->kex_group;
  145|       |
  146|    363|    if (in->cipher == NULL)
  ------------------
  |  Branch (146:9): [True: 0, False: 363]
  ------------------
  147|      0|        l = in->cipher_id;
  148|    363|    else
  149|    363|        l = in->cipher->id;
  150|    363|    cipher_data[0] = ((unsigned char)(l >> 8L)) & 0xff;
  151|    363|    cipher_data[1] = ((unsigned char)(l)) & 0xff;
  152|       |
  153|    363|    ssl_session_oinit(&as.cipher, &cipher, cipher_data, 2);
  154|       |
  155|    363|#ifndef OPENSSL_NO_COMP
  156|    363|    if (in->compress_meth) {
  ------------------
  |  Branch (156:9): [True: 2, False: 361]
  ------------------
  157|      2|        comp_id_data = (unsigned char)in->compress_meth;
  158|      2|        ssl_session_oinit(&as.comp_id, &comp_id, &comp_id_data, 1);
  159|      2|    }
  160|    363|#endif
  161|       |
  162|    363|    ssl_session_oinit(&as.master_key, &master_key,
  163|    363|                      in->master_key, in->master_key_length);
  164|       |
  165|    363|    ssl_session_oinit(&as.session_id, &session_id,
  166|    363|                      in->session_id, in->session_id_length);
  167|       |
  168|    363|    ssl_session_oinit(&as.session_id_context, &sid_ctx,
  169|    363|                      in->sid_ctx, in->sid_ctx_length);
  170|       |
  171|    363|    as.time = (int64_t)ossl_time_to_time_t(in->time);
  172|    363|    as.timeout = (int64_t)ossl_time2seconds(in->timeout);
  ------------------
  |  |   42|    363|#define ossl_time2seconds(t) (ossl_time2ticks(t) / OSSL_TIME_SECOND)
  |  |  ------------------
  |  |  |  |   30|    363|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  ------------------
  ------------------
  173|    363|    as.verify_result = in->verify_result;
  174|       |
  175|    363|    as.peer = in->peer;
  176|       |
  177|    363|    as.peer_rpk = NULL;
  178|    363|    peer_rpk.data = NULL;
  179|    363|    if (in->peer_rpk != NULL) {
  ------------------
  |  Branch (179:9): [True: 0, False: 363]
  ------------------
  180|      0|        peer_rpk.length = i2d_PUBKEY(in->peer_rpk, &peer_rpk.data);
  181|      0|        if (peer_rpk.length > 0 && peer_rpk.data != NULL)
  ------------------
  |  Branch (181:13): [True: 0, False: 0]
  |  Branch (181:36): [True: 0, False: 0]
  ------------------
  182|      0|            as.peer_rpk = &peer_rpk;
  183|      0|    }
  184|       |
  185|    363|    ssl_session_sinit(&as.tlsext_hostname, &tlsext_hostname,
  186|    363|                      in->ext.hostname);
  187|    363|    if (in->ext.tick) {
  ------------------
  |  Branch (187:9): [True: 2, False: 361]
  ------------------
  188|      2|        ssl_session_oinit(&as.tlsext_tick, &tlsext_tick,
  189|      2|                          in->ext.tick, in->ext.ticklen);
  190|      2|    }
  191|    363|    if (in->ext.tick_lifetime_hint > 0)
  ------------------
  |  Branch (191:9): [True: 94, False: 269]
  ------------------
  192|     94|        as.tlsext_tick_lifetime_hint = in->ext.tick_lifetime_hint;
  193|    363|    as.tlsext_tick_age_add = in->ext.tick_age_add;
  194|    363|#ifndef OPENSSL_NO_PSK
  195|    363|    ssl_session_sinit(&as.psk_identity_hint, &psk_identity_hint,
  196|    363|                      in->psk_identity_hint);
  197|    363|    ssl_session_sinit(&as.psk_identity, &psk_identity, in->psk_identity);
  198|    363|#endif                          /* OPENSSL_NO_PSK */
  199|    363|#ifndef OPENSSL_NO_SRP
  200|    363|    ssl_session_sinit(&as.srp_username, &srp_username, in->srp_username);
  201|    363|#endif                          /* OPENSSL_NO_SRP */
  202|       |
  203|    363|    as.flags = in->flags;
  204|    363|    as.max_early_data = in->ext.max_early_data;
  205|       |
  206|    363|    if (in->ext.alpn_selected == NULL)
  ------------------
  |  Branch (206:9): [True: 362, False: 1]
  ------------------
  207|    362|        as.alpn_selected = NULL;
  208|      1|    else
  209|      1|        ssl_session_oinit(&as.alpn_selected, &alpn_selected,
  210|      1|                          in->ext.alpn_selected, in->ext.alpn_selected_len);
  211|       |
  212|    363|    as.tlsext_max_fragment_len_mode = in->ext.max_fragment_len_mode;
  213|       |
  214|    363|    if (in->ticket_appdata == NULL)
  ------------------
  |  Branch (214:9): [True: 362, False: 1]
  ------------------
  215|    362|        as.ticket_appdata = NULL;
  216|      1|    else
  217|      1|        ssl_session_oinit(&as.ticket_appdata, &ticket_appdata,
  218|      1|                          in->ticket_appdata, in->ticket_appdata_len);
  219|       |
  220|    363|    ret = i2d_SSL_SESSION_ASN1(&as, pp);
  221|    363|    OPENSSL_free(peer_rpk.data);
  ------------------
  |  |  107|    363|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    363|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    363|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  222|    363|    return ret;
  223|    363|}
d2i_SSL_SESSION:
  259|  11.7k|{
  260|  11.7k|    return d2i_SSL_SESSION_ex(a, pp, length, NULL, NULL);
  261|  11.7k|}
d2i_SSL_SESSION_ex:
  265|  11.7k|{
  266|  11.7k|    long id;
  267|  11.7k|    size_t tmpl;
  268|  11.7k|    const unsigned char *p = *pp;
  269|  11.7k|    SSL_SESSION_ASN1 *as = NULL;
  270|  11.7k|    SSL_SESSION *ret = NULL;
  271|       |
  272|  11.7k|    as = d2i_SSL_SESSION_ASN1(NULL, &p, length);
  273|       |    /* ASN.1 code returns suitable error */
  274|  11.7k|    if (as == NULL)
  ------------------
  |  Branch (274:9): [True: 11.2k, False: 434]
  ------------------
  275|  11.2k|        goto err;
  276|       |
  277|    434|    if (a == NULL || *a == NULL) {
  ------------------
  |  Branch (277:9): [True: 434, False: 0]
  |  Branch (277:22): [True: 0, False: 0]
  ------------------
  278|    434|        ret = SSL_SESSION_new();
  279|    434|        if (ret == NULL)
  ------------------
  |  Branch (279:13): [True: 0, False: 434]
  ------------------
  280|      0|            goto err;
  281|    434|    } else {
  282|      0|        ret = *a;
  283|      0|    }
  284|       |
  285|    434|    if (as->version != SSL_SESSION_ASN1_VERSION) {
  ------------------
  |  |   58|    434|# define SSL_SESSION_ASN1_VERSION 0x0001
  ------------------
  |  Branch (285:9): [True: 1, False: 433]
  ------------------
  286|      1|        ERR_raise(ERR_LIB_SSL, SSL_R_UNKNOWN_SSL_VERSION);
  ------------------
  |  |  401|      1|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
  287|      1|        goto err;
  288|      1|    }
  289|       |
  290|    433|    if ((as->ssl_version >> 8) != SSL3_VERSION_MAJOR
  ------------------
  |  |  216|    866|# define SSL3_VERSION_MAJOR              0x03
  ------------------
  |  Branch (290:9): [True: 101, False: 332]
  ------------------
  291|    433|        && (as->ssl_version >> 8) != DTLS1_VERSION_MAJOR
  ------------------
  |  |   32|    534|# define DTLS1_VERSION_MAJOR             0xFE
  ------------------
  |  Branch (291:12): [True: 58, False: 43]
  ------------------
  292|    433|        && as->ssl_version != DTLS1_BAD_VER) {
  ------------------
  |  |   30|     58|# define DTLS1_BAD_VER                   0x0100
  ------------------
  |  Branch (292:12): [True: 55, False: 3]
  ------------------
  293|     55|        ERR_raise(ERR_LIB_SSL, SSL_R_UNSUPPORTED_SSL_VERSION);
  ------------------
  |  |  401|     55|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|     55|    (ERR_new(),                                                 \
  |  |  |  |  404|     55|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|     55|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|     55|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|     55|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|     55|     ERR_set_error)
  |  |  ------------------
  ------------------
  294|     55|        goto err;
  295|     55|    }
  296|       |
  297|    378|    ret->ssl_version = (int)as->ssl_version;
  298|       |
  299|    378|    ret->kex_group = as->kex_group;
  300|       |
  301|    378|    if (as->cipher->length != 2) {
  ------------------
  |  Branch (301:9): [True: 1, False: 377]
  ------------------
  302|      1|        ERR_raise(ERR_LIB_SSL, SSL_R_CIPHER_CODE_WRONG_LENGTH);
  ------------------
  |  |  401|      1|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
  303|      1|        goto err;
  304|      1|    }
  305|       |
  306|    377|    id = 0x03000000L | ((unsigned long)as->cipher->data[0] << 8L)
  307|    377|                     | (unsigned long)as->cipher->data[1];
  308|       |
  309|    377|    ret->cipher_id = id;
  310|    377|    ret->cipher = ssl3_get_cipher_by_id(id);
  311|    377|    if (ret->cipher == NULL)
  ------------------
  |  Branch (311:9): [True: 8, False: 369]
  ------------------
  312|      8|        goto err;
  313|       |
  314|    369|    if (!ssl_session_memcpy(ret->session_id, &ret->session_id_length,
  ------------------
  |  Branch (314:9): [True: 1, False: 368]
  ------------------
  315|    369|                            as->session_id, SSL3_MAX_SSL_SESSION_ID_LENGTH))
  ------------------
  |  |  134|    369|# define SSL3_MAX_SSL_SESSION_ID_LENGTH          32
  ------------------
  316|      1|        goto err;
  317|       |
  318|    368|    if (!ssl_session_memcpy(ret->master_key, &tmpl,
  ------------------
  |  Branch (318:9): [True: 2, False: 366]
  ------------------
  319|    368|                            as->master_key, TLS13_MAX_RESUMPTION_PSK_LENGTH))
  ------------------
  |  |  464|    368|# define TLS13_MAX_RESUMPTION_PSK_LENGTH      512
  ------------------
  320|      2|        goto err;
  321|       |
  322|    366|    ret->master_key_length = tmpl;
  323|       |
  324|    366|    if (as->time != 0)
  ------------------
  |  Branch (324:9): [True: 157, False: 209]
  ------------------
  325|    157|        ret->time = ossl_time_from_time_t(as->time);
  326|    209|    else
  327|    209|        ret->time = ossl_time_now();
  328|       |
  329|    366|    if (as->timeout != 0)
  ------------------
  |  Branch (329:9): [True: 154, False: 212]
  ------------------
  330|    154|        ret->timeout = ossl_seconds2time(as->timeout);
  ------------------
  |  |   41|    154|#define ossl_seconds2time(s) ossl_ticks2time((s) * OSSL_TIME_SECOND)
  |  |  ------------------
  |  |  |  |   30|    154|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  ------------------
  ------------------
  331|    212|    else
  332|    212|        ret->timeout = ossl_seconds2time(3);
  ------------------
  |  |   41|    212|#define ossl_seconds2time(s) ossl_ticks2time((s) * OSSL_TIME_SECOND)
  |  |  ------------------
  |  |  |  |   30|    212|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  ------------------
  ------------------
  333|    366|    ssl_session_calculate_timeout(ret);
  334|       |
  335|    366|    X509_free(ret->peer);
  336|    366|    ret->peer = as->peer;
  337|    366|    as->peer = NULL;
  338|       |
  339|    366|    EVP_PKEY_free(ret->peer_rpk);
  340|    366|    ret->peer_rpk = NULL;
  341|    366|    if (as->peer_rpk != NULL) {
  ------------------
  |  Branch (341:9): [True: 1, False: 365]
  ------------------
  342|      1|        const unsigned char *data = as->peer_rpk->data;
  343|       |
  344|       |        /*
  345|       |         * |data| is incremented; we don't want to lose original ptr
  346|       |         */
  347|      1|        ret->peer_rpk = d2i_PUBKEY_ex(NULL, &data, as->peer_rpk->length, libctx, propq);
  348|      1|        if (ret->peer_rpk == NULL)
  ------------------
  |  Branch (348:13): [True: 1, False: 0]
  ------------------
  349|      1|            goto err;
  350|      1|    }
  351|       |
  352|    365|    if (!ssl_session_memcpy(ret->sid_ctx, &ret->sid_ctx_length,
  ------------------
  |  Branch (352:9): [True: 1, False: 364]
  ------------------
  353|    365|                            as->session_id_context, SSL_MAX_SID_CTX_LENGTH))
  ------------------
  |  |   61|    365|# define SSL_MAX_SID_CTX_LENGTH                  32
  ------------------
  354|      1|        goto err;
  355|       |
  356|       |    /* NB: this defaults to zero which is X509_V_OK */
  357|    364|    ret->verify_result = as->verify_result;
  358|       |
  359|    364|    if (!ssl_session_strndup(&ret->ext.hostname, as->tlsext_hostname))
  ------------------
  |  Branch (359:9): [True: 0, False: 364]
  ------------------
  360|      0|        goto err;
  361|       |
  362|    364|#ifndef OPENSSL_NO_PSK
  363|    364|    if (!ssl_session_strndup(&ret->psk_identity_hint, as->psk_identity_hint))
  ------------------
  |  Branch (363:9): [True: 0, False: 364]
  ------------------
  364|      0|        goto err;
  365|    364|    if (!ssl_session_strndup(&ret->psk_identity, as->psk_identity))
  ------------------
  |  Branch (365:9): [True: 0, False: 364]
  ------------------
  366|      0|        goto err;
  367|    364|#endif
  368|       |
  369|    364|    ret->ext.tick_lifetime_hint = (unsigned long)as->tlsext_tick_lifetime_hint;
  370|    364|    ret->ext.tick_age_add = as->tlsext_tick_age_add;
  371|    364|    OPENSSL_free(ret->ext.tick);
  ------------------
  |  |  107|    364|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    364|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    364|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  372|    364|    if (as->tlsext_tick != NULL) {
  ------------------
  |  Branch (372:9): [True: 2, False: 362]
  ------------------
  373|      2|        ret->ext.tick = as->tlsext_tick->data;
  374|      2|        ret->ext.ticklen = as->tlsext_tick->length;
  375|      2|        as->tlsext_tick->data = NULL;
  376|    362|    } else {
  377|    362|        ret->ext.tick = NULL;
  378|    362|    }
  379|    364|#ifndef OPENSSL_NO_COMP
  380|    364|    if (as->comp_id) {
  ------------------
  |  Branch (380:9): [True: 3, False: 361]
  ------------------
  381|      3|        if (as->comp_id->length != 1) {
  ------------------
  |  Branch (381:13): [True: 1, False: 2]
  ------------------
  382|      1|            ERR_raise(ERR_LIB_SSL, SSL_R_BAD_LENGTH);
  ------------------
  |  |  401|      1|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      1|    (ERR_new(),                                                 \
  |  |  |  |  404|      1|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      1|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      1|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      1|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      1|     ERR_set_error)
  |  |  ------------------
  ------------------
  383|      1|            goto err;
  384|      1|        }
  385|      2|        ret->compress_meth = as->comp_id->data[0];
  386|    361|    } else {
  387|    361|        ret->compress_meth = 0;
  388|    361|    }
  389|    363|#endif
  390|       |
  391|    363|#ifndef OPENSSL_NO_SRP
  392|    363|    if (!ssl_session_strndup(&ret->srp_username, as->srp_username))
  ------------------
  |  Branch (392:9): [True: 0, False: 363]
  ------------------
  393|      0|        goto err;
  394|    363|#endif                          /* OPENSSL_NO_SRP */
  395|       |    /* Flags defaults to zero which is fine */
  396|    363|    ret->flags = (int32_t)as->flags;
  397|    363|    ret->ext.max_early_data = as->max_early_data;
  398|       |
  399|    363|    OPENSSL_free(ret->ext.alpn_selected);
  ------------------
  |  |  107|    363|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    363|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    363|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  400|    363|    if (as->alpn_selected != NULL) {
  ------------------
  |  Branch (400:9): [True: 1, False: 362]
  ------------------
  401|      1|        ret->ext.alpn_selected = as->alpn_selected->data;
  402|      1|        ret->ext.alpn_selected_len = as->alpn_selected->length;
  403|      1|        as->alpn_selected->data = NULL;
  404|    362|    } else {
  405|    362|        ret->ext.alpn_selected = NULL;
  406|    362|        ret->ext.alpn_selected_len = 0;
  407|    362|    }
  408|       |
  409|    363|    ret->ext.max_fragment_len_mode = as->tlsext_max_fragment_len_mode;
  410|       |
  411|    363|    OPENSSL_free(ret->ticket_appdata);
  ------------------
  |  |  107|    363|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    363|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    363|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  412|    363|    if (as->ticket_appdata != NULL) {
  ------------------
  |  Branch (412:9): [True: 1, False: 362]
  ------------------
  413|      1|        ret->ticket_appdata = as->ticket_appdata->data;
  414|      1|        ret->ticket_appdata_len = as->ticket_appdata->length;
  415|      1|        as->ticket_appdata->data = NULL;
  416|    362|    } else {
  417|    362|        ret->ticket_appdata = NULL;
  418|    362|        ret->ticket_appdata_len = 0;
  419|    362|    }
  420|       |
  421|    363|    M_ASN1_free_of(as, SSL_SESSION_ASN1);
  ------------------
  |  |  929|    363|                ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
  |  |  ------------------
  |  |  |  |  364|    363|    ((void*) (1 ? p : (type*)0))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:15): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                               ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
  |  |  ------------------
  |  |  |  |  426|    363|# define ASN1_ITEM_rptr(ref) (ref##_it())
  |  |  ------------------
  ------------------
  422|       |
  423|    363|    if ((a != NULL) && (*a == NULL))
  ------------------
  |  Branch (423:9): [True: 0, False: 363]
  |  Branch (423:24): [True: 0, False: 0]
  ------------------
  424|      0|        *a = ret;
  425|    363|    *pp = p;
  426|    363|    return ret;
  427|       |
  428|  11.3k| err:
  429|  11.3k|    M_ASN1_free_of(as, SSL_SESSION_ASN1);
  ------------------
  |  |  929|  11.3k|                ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
  |  |  ------------------
  |  |  |  |  364|  11.3k|    ((void*) (1 ? p : (type*)0))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:15): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                               ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
  |  |  ------------------
  |  |  |  |  426|  11.3k|# define ASN1_ITEM_rptr(ref) (ref##_it())
  |  |  ------------------
  ------------------
  430|  11.3k|    if ((a == NULL) || (*a != ret))
  ------------------
  |  Branch (430:9): [True: 11.3k, False: 0]
  |  Branch (430:24): [True: 0, False: 0]
  ------------------
  431|  11.3k|        SSL_SESSION_free(ret);
  432|  11.3k|    return NULL;
  433|    363|}
ssl_asn1.c:ssl_session_oinit:
   92|  1.49k|{
   93|  1.49k|    os->data = (unsigned char *)data; /* justified cast: data is not modified */
   94|  1.49k|    os->length = (int)len;
   95|  1.49k|    os->flags = 0;
   96|  1.49k|    *dest = os;
   97|  1.49k|}
ssl_asn1.c:ssl_session_sinit:
  102|  1.45k|{
  103|  1.45k|    if (data != NULL)
  ------------------
  |  Branch (103:9): [True: 40, False: 1.41k]
  ------------------
  104|     40|        ssl_session_oinit(dest, os, (const unsigned char *)data, strlen(data));
  105|  1.41k|    else
  106|  1.41k|        *dest = NULL;
  107|  1.45k|}
ssl_asn1.c:ssl_session_memcpy:
  245|  1.10k|{
  246|  1.10k|    if (src == NULL || src->length == 0) {
  ------------------
  |  Branch (246:9): [True: 357, False: 745]
  |  Branch (246:24): [True: 597, False: 148]
  ------------------
  247|    954|        *pdstlen = 0;
  248|    954|        return 1;
  249|    954|    }
  250|    148|    if (src->length < 0 || src->length > (int)maxlen)
  ------------------
  |  Branch (250:9): [True: 0, False: 148]
  |  Branch (250:28): [True: 4, False: 144]
  ------------------
  251|      4|        return 0;
  252|    144|    memcpy(dst, src->data, src->length);
  253|    144|    *pdstlen = src->length;
  254|    144|    return 1;
  255|    148|}
ssl_asn1.c:ssl_session_strndup:
  230|  1.45k|{
  231|  1.45k|    OPENSSL_free(*pdst);
  ------------------
  |  |  107|  1.45k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.45k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.45k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  232|  1.45k|    *pdst = NULL;
  233|  1.45k|    if (src == NULL)
  ------------------
  |  Branch (233:9): [True: 1.41k, False: 40]
  ------------------
  234|  1.41k|        return 1;
  235|     40|    *pdst = OPENSSL_strndup((char *)src->data, src->length);
  ------------------
  |  |  113|     40|        CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     40|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     40|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  236|     40|    if (*pdst == NULL)
  ------------------
  |  Branch (236:9): [True: 0, False: 40]
  ------------------
  237|      0|        return 0;
  238|     40|    return 1;
  239|     40|}

ssl_cipher_get_evp:
  514|      2|{
  515|      2|    int i;
  516|      2|    const SSL_CIPHER *c;
  517|       |
  518|      2|    c = s->cipher;
  519|      2|    if (c == NULL)
  ------------------
  |  Branch (519:9): [True: 0, False: 2]
  ------------------
  520|      0|        return 0;
  521|      2|    if (comp != NULL) {
  ------------------
  |  Branch (521:9): [True: 2, False: 0]
  ------------------
  522|      2|        SSL_COMP ctmp;
  523|      2|#ifndef OPENSSL_NO_COMP
  524|      2|        if (!load_builtin_compressions()) {
  ------------------
  |  Branch (524:13): [True: 0, False: 2]
  ------------------
  525|       |            /*
  526|       |             * Currently don't care, since a failure only means that
  527|       |             * ssl_comp_methods is NULL, which is perfectly OK
  528|       |             */
  529|      0|        }
  530|      2|#endif
  531|      2|        *comp = NULL;
  532|      2|        ctmp.id = s->compress_meth;
  533|      2|        if (ssl_comp_methods != NULL) {
  ------------------
  |  Branch (533:13): [True: 2, False: 0]
  ------------------
  534|      2|            i = sk_SSL_COMP_find(ssl_comp_methods, &ctmp);
  ------------------
  |  | 1041|      2|#define sk_SSL_COMP_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
  ------------------
  535|      2|            if (i >= 0)
  ------------------
  |  Branch (535:17): [True: 0, False: 2]
  ------------------
  536|      0|                *comp = sk_SSL_COMP_value(ssl_comp_methods, i);
  ------------------
  |  | 1025|      0|#define sk_SSL_COMP_value(sk, idx) ((SSL_COMP *)OPENSSL_sk_value(ossl_check_const_SSL_COMP_sk_type(sk), (idx)))
  ------------------
  537|      2|        }
  538|       |        /* If were only interested in comp then return success */
  539|      2|        if ((enc == NULL) && (md == NULL))
  ------------------
  |  Branch (539:13): [True: 2, False: 0]
  |  Branch (539:30): [True: 2, False: 0]
  ------------------
  540|      2|            return 1;
  541|      2|    }
  542|       |
  543|      0|    if ((enc == NULL) || (md == NULL))
  ------------------
  |  Branch (543:9): [True: 0, False: 0]
  |  Branch (543:26): [True: 0, False: 0]
  ------------------
  544|      0|        return 0;
  545|       |
  546|      0|    if (!ssl_cipher_get_evp_cipher(ctx, c, enc))
  ------------------
  |  Branch (546:9): [True: 0, False: 0]
  ------------------
  547|      0|        return 0;
  548|       |
  549|      0|    i = ssl_cipher_info_lookup(ssl_cipher_table_mac, c->algorithm_mac);
  ------------------
  |  |  129|      0|    ssl_cipher_info_find(table, OSSL_NELEM(table), x)
  |  |  ------------------
  |  |  |  |   14|      0|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  |  |  ------------------
  ------------------
  550|      0|    if (i == -1) {
  ------------------
  |  Branch (550:9): [True: 0, False: 0]
  ------------------
  551|      0|        *md = NULL;
  552|      0|        if (mac_pkey_type != NULL)
  ------------------
  |  Branch (552:13): [True: 0, False: 0]
  ------------------
  553|      0|            *mac_pkey_type = NID_undef;
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  554|      0|        if (mac_secret_size != NULL)
  ------------------
  |  Branch (554:13): [True: 0, False: 0]
  ------------------
  555|      0|            *mac_secret_size = 0;
  556|      0|        if (c->algorithm_mac == SSL_AEAD)
  ------------------
  |  |  176|      0|# define SSL_AEAD                0x00000040U
  ------------------
  |  Branch (556:13): [True: 0, False: 0]
  ------------------
  557|      0|            mac_pkey_type = NULL;
  558|      0|    } else {
  559|      0|        const EVP_MD *digest = ctx->ssl_digest_methods[i];
  560|       |
  561|      0|        if (digest == NULL
  ------------------
  |  Branch (561:13): [True: 0, False: 0]
  ------------------
  562|      0|                || !ssl_evp_md_up_ref(digest)) {
  ------------------
  |  Branch (562:20): [True: 0, False: 0]
  ------------------
  563|      0|            ssl_evp_cipher_free(*enc);
  564|      0|            return 0;
  565|      0|        }
  566|      0|        *md = digest;
  567|      0|        if (mac_pkey_type != NULL)
  ------------------
  |  Branch (567:13): [True: 0, False: 0]
  ------------------
  568|      0|            *mac_pkey_type = ctx->ssl_mac_pkey_id[i];
  569|      0|        if (mac_secret_size != NULL)
  ------------------
  |  Branch (569:13): [True: 0, False: 0]
  ------------------
  570|      0|            *mac_secret_size = ctx->ssl_mac_secret_size[i];
  571|      0|    }
  572|       |
  573|      0|    if ((*enc != NULL)
  ------------------
  |  Branch (573:9): [True: 0, False: 0]
  ------------------
  574|      0|        && (*md != NULL 
  ------------------
  |  Branch (574:13): [True: 0, False: 0]
  ------------------
  575|      0|            || (EVP_CIPHER_get_flags(*enc) & EVP_CIPH_FLAG_AEAD_CIPHER))
  ------------------
  |  |  345|      0|# define         EVP_CIPH_FLAG_AEAD_CIPHER       0x200000
  ------------------
  |  Branch (575:16): [True: 0, False: 0]
  ------------------
  576|      0|        && (!mac_pkey_type || *mac_pkey_type != NID_undef)) {
  ------------------
  |  |   18|      0|#define NID_undef                       0
  ------------------
  |  Branch (576:13): [True: 0, False: 0]
  |  Branch (576:31): [True: 0, False: 0]
  ------------------
  577|      0|        const EVP_CIPHER *evp = NULL;
  578|       |
  579|      0|        if (use_etm
  ------------------
  |  Branch (579:13): [True: 0, False: 0]
  ------------------
  580|      0|                || s->ssl_version >> 8 != TLS1_VERSION_MAJOR
  ------------------
  |  |   42|      0|# define TLS1_VERSION_MAJOR              0x03
  ------------------
  |  Branch (580:20): [True: 0, False: 0]
  ------------------
  581|      0|                || s->ssl_version < TLS1_VERSION)
  ------------------
  |  |   24|      0|# define TLS1_VERSION                    0x0301
  ------------------
  |  Branch (581:20): [True: 0, False: 0]
  ------------------
  582|      0|            return 1;
  583|       |
  584|      0|        if (c->algorithm_enc == SSL_RC4
  ------------------
  |  |  133|      0|# define SSL_RC4                 0x00000004U
  ------------------
  |  Branch (584:13): [True: 0, False: 0]
  ------------------
  585|      0|                && c->algorithm_mac == SSL_MD5)
  ------------------
  |  |  169|      0|# define SSL_MD5                 0x00000001U
  ------------------
  |  Branch (585:20): [True: 0, False: 0]
  ------------------
  586|      0|            evp = ssl_evp_cipher_fetch(ctx->libctx, NID_rc4_hmac_md5,
  ------------------
  |  | 5259|      0|#define NID_rc4_hmac_md5                915
  ------------------
  587|      0|                                       ctx->propq);
  588|      0|        else if (c->algorithm_enc == SSL_AES128
  ------------------
  |  |  137|      0|# define SSL_AES128              0x00000040U
  ------------------
  |  Branch (588:18): [True: 0, False: 0]
  ------------------
  589|      0|                    && c->algorithm_mac == SSL_SHA1)
  ------------------
  |  |  170|      0|# define SSL_SHA1                0x00000002U
  ------------------
  |  Branch (589:24): [True: 0, False: 0]
  ------------------
  590|      0|            evp = ssl_evp_cipher_fetch(ctx->libctx,
  591|      0|                                       NID_aes_128_cbc_hmac_sha1,
  ------------------
  |  | 5263|      0|#define NID_aes_128_cbc_hmac_sha1               916
  ------------------
  592|      0|                                       ctx->propq);
  593|      0|        else if (c->algorithm_enc == SSL_AES256
  ------------------
  |  |  138|      0|# define SSL_AES256              0x00000080U
  ------------------
  |  Branch (593:18): [True: 0, False: 0]
  ------------------
  594|      0|                    && c->algorithm_mac == SSL_SHA1)
  ------------------
  |  |  170|      0|# define SSL_SHA1                0x00000002U
  ------------------
  |  Branch (594:24): [True: 0, False: 0]
  ------------------
  595|      0|             evp = ssl_evp_cipher_fetch(ctx->libctx,
  596|      0|                                        NID_aes_256_cbc_hmac_sha1,
  ------------------
  |  | 5271|      0|#define NID_aes_256_cbc_hmac_sha1               918
  ------------------
  597|      0|                                        ctx->propq);
  598|      0|        else if (c->algorithm_enc == SSL_AES128
  ------------------
  |  |  137|      0|# define SSL_AES128              0x00000040U
  ------------------
  |  Branch (598:18): [True: 0, False: 0]
  ------------------
  599|      0|                    && c->algorithm_mac == SSL_SHA256)
  ------------------
  |  |  173|      0|# define SSL_SHA256              0x00000010U
  ------------------
  |  Branch (599:24): [True: 0, False: 0]
  ------------------
  600|      0|            evp = ssl_evp_cipher_fetch(ctx->libctx,
  601|      0|                                       NID_aes_128_cbc_hmac_sha256,
  ------------------
  |  | 5275|      0|#define NID_aes_128_cbc_hmac_sha256             948
  ------------------
  602|      0|                                       ctx->propq);
  603|      0|        else if (c->algorithm_enc == SSL_AES256
  ------------------
  |  |  138|      0|# define SSL_AES256              0x00000080U
  ------------------
  |  Branch (603:18): [True: 0, False: 0]
  ------------------
  604|      0|                    && c->algorithm_mac == SSL_SHA256)
  ------------------
  |  |  173|      0|# define SSL_SHA256              0x00000010U
  ------------------
  |  Branch (604:24): [True: 0, False: 0]
  ------------------
  605|      0|            evp = ssl_evp_cipher_fetch(ctx->libctx,
  606|      0|                                       NID_aes_256_cbc_hmac_sha256,
  ------------------
  |  | 5283|      0|#define NID_aes_256_cbc_hmac_sha256             950
  ------------------
  607|      0|                                       ctx->propq);
  608|       |
  609|      0|        if (evp != NULL) {
  ------------------
  |  Branch (609:13): [True: 0, False: 0]
  ------------------
  610|      0|            ssl_evp_cipher_free(*enc);
  611|      0|            ssl_evp_md_free(*md);
  612|      0|            *enc = evp;
  613|      0|            *md = NULL;
  614|      0|        }
  615|      0|        return 1;
  616|      0|    }
  617|       |
  618|      0|    return 0;
  619|      0|}
SSL_COMP_get_compression_methods:
 2011|      2|{
 2012|      2|    load_builtin_compressions();
 2013|      2|    return ssl_comp_methods;
 2014|      2|}
ssl_comp_free_compression_methods_int:
 2030|      2|{
 2031|      2|    STACK_OF(SSL_COMP) *old_meths = ssl_comp_methods;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
 2032|      2|    ssl_comp_methods = NULL;
 2033|      2|    sk_SSL_COMP_pop_free(old_meths, cmeth_free);
  ------------------
  |  | 1038|      2|#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk),ossl_check_SSL_COMP_freefunc_type(freefunc))
  ------------------
 2034|      2|}
ssl_ciph.c:load_builtin_compressions:
  476|      4|{
  477|      4|    return RUN_ONCE(&ssl_load_builtin_comp_once, do_load_builtin_compressions);
  ------------------
  |  |  130|      4|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  478|      4|}
ssl_ciph.c:do_load_builtin_compressions:
  456|      2|{
  457|      2|    SSL_COMP *comp = NULL;
  458|      2|    COMP_METHOD *method = COMP_zlib();
  459|       |
  460|      2|    ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
  ------------------
  |  | 1026|      2|#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)))
  ------------------
  461|       |
  462|      2|    if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) {
  ------------------
  |  |   18|      4|#define NID_undef                       0
  ------------------
  |  Branch (462:9): [True: 0, False: 2]
  |  Branch (462:47): [True: 0, False: 0]
  ------------------
  463|      0|        comp = OPENSSL_malloc(sizeof(*comp));
  ------------------
  |  |   97|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  464|      0|        if (comp != NULL) {
  ------------------
  |  Branch (464:13): [True: 0, False: 0]
  ------------------
  465|      0|            comp->method = method;
  466|      0|            comp->id = SSL_COMP_ZLIB_IDX;
  ------------------
  |  |   61|      0|#define SSL_COMP_ZLIB_IDX       1
  ------------------
  467|      0|            comp->name = COMP_get_name(method);
  468|      0|            sk_SSL_COMP_push(ssl_comp_methods, comp);
  ------------------
  |  | 1034|      0|#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
  ------------------
  469|      0|            sk_SSL_COMP_sort(ssl_comp_methods);
  ------------------
  |  | 1044|      0|#define sk_SSL_COMP_sort(sk) OPENSSL_sk_sort(ossl_check_SSL_COMP_sk_type(sk))
  ------------------
  470|      0|        }
  471|      0|    }
  472|      2|    return 1;
  473|      2|}

ossl_err_load_SSL_strings:
  603|      2|{
  604|      2|#ifndef OPENSSL_NO_ERR
  605|      2|    if (ERR_reason_error_string(SSL_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (605:9): [True: 2, False: 0]
  ------------------
  606|      2|        ERR_load_strings_const(SSL_str_reasons);
  607|      2|#endif
  608|      2|    return 1;
  609|      2|}

OPENSSL_init_ssl:
   92|    436|{
   93|    436|    static int stoperrset = 0;
   94|       |
   95|    436|    if (stopped) {
  ------------------
  |  Branch (95:9): [True: 0, False: 436]
  ------------------
   96|      0|        if (!stoperrset) {
  ------------------
  |  Branch (96:13): [True: 0, False: 0]
  ------------------
   97|       |            /*
   98|       |             * We only ever set this once to avoid getting into an infinite
   99|       |             * loop where the error system keeps trying to init and fails so
  100|       |             * sets an error etc
  101|       |             */
  102|      0|            stoperrset = 1;
  103|      0|            ERR_raise(ERR_LIB_SSL, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  104|      0|        }
  105|      0|        return 0;
  106|      0|    }
  107|       |
  108|    436|    opts |= OPENSSL_INIT_ADD_ALL_CIPHERS
  ------------------
  |  |  451|    436|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  109|    436|         |  OPENSSL_INIT_ADD_ALL_DIGESTS;
  ------------------
  |  |  452|    436|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  110|    436|#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
  111|    436|    if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG) == 0)
  ------------------
  |  |  456|    436|# define OPENSSL_INIT_NO_LOAD_CONFIG         0x00000080L
  ------------------
  |  Branch (111:9): [True: 436, False: 0]
  ------------------
  112|    436|        opts |= OPENSSL_INIT_LOAD_CONFIG;
  ------------------
  |  |  455|    436|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  113|    436|#endif
  114|       |
  115|    436|    if (!OPENSSL_init_crypto(opts, settings))
  ------------------
  |  Branch (115:9): [True: 0, False: 436]
  ------------------
  116|      0|        return 0;
  117|       |
  118|    436|    if (!RUN_ONCE(&ssl_base, ossl_init_ssl_base))
  ------------------
  |  |  130|    436|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 436, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (118:9): [True: 0, False: 436]
  ------------------
  119|      0|        return 0;
  120|       |
  121|    436|    if ((opts & OPENSSL_INIT_NO_LOAD_SSL_STRINGS)
  ------------------
  |  | 2652|    436|# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS    0x00100000L
  ------------------
  |  Branch (121:9): [True: 0, False: 436]
  ------------------
  122|    436|        && !RUN_ONCE_ALT(&ssl_strings, ossl_init_no_load_ssl_strings,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (122:12): [True: 0, False: 0]
  ------------------
  123|    436|                         ossl_init_load_ssl_strings))
  124|      0|        return 0;
  125|       |
  126|    436|    if ((opts & OPENSSL_INIT_LOAD_SSL_STRINGS)
  ------------------
  |  | 2653|    436|# define OPENSSL_INIT_LOAD_SSL_STRINGS       0x00200000L
  ------------------
  |  Branch (126:9): [True: 436, False: 0]
  ------------------
  127|    436|        && !RUN_ONCE(&ssl_strings, ossl_init_load_ssl_strings))
  ------------------
  |  |  130|    436|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 436, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (127:12): [True: 0, False: 436]
  ------------------
  128|      0|        return 0;
  129|       |
  130|    436|    return 1;
  131|    436|}
ssl_init.c:ossl_init_ssl_base:
   27|      2|{
   28|      2|#ifndef OPENSSL_NO_COMP
   29|      2|    OSSL_TRACE(INIT, "ossl_init_ssl_base: "
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   30|      2|               "SSL_COMP_get_compression_methods()\n");
   31|       |    /*
   32|       |     * This will initialise the built-in compression algorithms. The value
   33|       |     * returned is a STACK_OF(SSL_COMP), but that can be discarded safely
   34|       |     */
   35|      2|    SSL_COMP_get_compression_methods();
   36|      2|#endif
   37|      2|    ssl_sort_cipher_list();
   38|      2|    OSSL_TRACE(INIT, "ossl_init_ssl_base: SSL_add_ssl_module()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   39|       |    /*
   40|       |     * We ignore an error return here. Not much we can do - but not that bad
   41|       |     * either. We can still safely continue.
   42|       |     */
   43|      2|    OPENSSL_atexit(ssl_library_stop);
   44|      2|    ssl_base_inited = 1;
   45|      2|    return 1;
   46|      2|}
ssl_init.c:ssl_library_stop:
   71|      2|{
   72|       |    /* Might be explicitly called and also by atexit */
   73|      2|    if (stopped)
  ------------------
  |  Branch (73:9): [True: 0, False: 2]
  ------------------
   74|      0|        return;
   75|      2|    stopped = 1;
   76|       |
   77|      2|    if (ssl_base_inited) {
  ------------------
  |  Branch (77:9): [True: 2, False: 0]
  ------------------
   78|      2|#ifndef OPENSSL_NO_COMP
   79|      2|        OSSL_TRACE(INIT, "ssl_library_stop: "
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   80|      2|                   "ssl_comp_free_compression_methods_int()\n");
   81|      2|        ssl_comp_free_compression_methods_int();
   82|      2|#endif
   83|      2|    }
   84|      2|}
ssl_init.c:ossl_init_load_ssl_strings:
   51|      2|{
   52|       |    /*
   53|       |     * OPENSSL_NO_AUTOERRINIT is provided here to prevent at compile time
   54|       |     * pulling in all the error strings during static linking
   55|       |     */
   56|      2|#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
   57|      2|    OSSL_TRACE(INIT, "ossl_init_load_ssl_strings: ossl_err_load_SSL_strings()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   58|      2|    ossl_err_load_SSL_strings();
   59|      2|#endif
   60|      2|    return 1;
   61|      2|}

ssl_cipher_id_cmp:
 3187|  2.53k|{
 3188|  2.53k|    if (a->id > b->id)
  ------------------
  |  Branch (3188:9): [True: 679, False: 1.85k]
  ------------------
 3189|    679|        return 1;
 3190|  1.85k|    if (a->id < b->id)
  ------------------
  |  Branch (3190:9): [True: 1.48k, False: 369]
  ------------------
 3191|  1.48k|        return -1;
 3192|    369|    return 0;
 3193|  1.85k|}
ssl_protocol_to_string:
 4796|    363|{
 4797|    363|    switch (version)
 4798|    363|    {
 4799|     12|    case TLS1_3_VERSION:
  ------------------
  |  |   27|     12|# define TLS1_3_VERSION                  0x0304
  ------------------
  |  Branch (4799:5): [True: 12, False: 351]
  ------------------
 4800|     12|        return "TLSv1.3";
 4801|       |
 4802|      8|    case TLS1_2_VERSION:
  ------------------
  |  |   26|      8|# define TLS1_2_VERSION                  0x0303
  ------------------
  |  Branch (4802:5): [True: 8, False: 355]
  ------------------
 4803|      8|        return "TLSv1.2";
 4804|       |
 4805|     32|    case TLS1_1_VERSION:
  ------------------
  |  |   25|     32|# define TLS1_1_VERSION                  0x0302
  ------------------
  |  Branch (4805:5): [True: 32, False: 331]
  ------------------
 4806|     32|        return "TLSv1.1";
 4807|       |
 4808|     17|    case TLS1_VERSION:
  ------------------
  |  |   24|     17|# define TLS1_VERSION                    0x0301
  ------------------
  |  Branch (4808:5): [True: 17, False: 346]
  ------------------
 4809|     17|        return "TLSv1";
 4810|       |
 4811|     14|    case SSL3_VERSION:
  ------------------
  |  |   23|     14|# define SSL3_VERSION                    0x0300
  ------------------
  |  Branch (4811:5): [True: 14, False: 349]
  ------------------
 4812|     14|        return "SSLv3";
 4813|       |
 4814|      2|    case DTLS1_BAD_VER:
  ------------------
  |  |   30|      2|# define DTLS1_BAD_VER                   0x0100
  ------------------
  |  Branch (4814:5): [True: 2, False: 361]
  ------------------
 4815|      2|        return "DTLSv0.9";
 4816|       |
 4817|      2|    case DTLS1_VERSION:
  ------------------
  |  |   28|      2|# define DTLS1_VERSION                   0xFEFF
  ------------------
  |  Branch (4817:5): [True: 2, False: 361]
  ------------------
 4818|      2|        return "DTLSv1";
 4819|       |
 4820|      3|    case DTLS1_2_VERSION:
  ------------------
  |  |   29|      3|# define DTLS1_2_VERSION                 0xFEFD
  ------------------
  |  Branch (4820:5): [True: 3, False: 360]
  ------------------
 4821|      3|        return "DTLSv1.2";
 4822|       |
 4823|    273|    default:
  ------------------
  |  Branch (4823:5): [True: 273, False: 90]
  ------------------
 4824|    273|        return "unknown";
 4825|    363|    }
 4826|    363|}

ssl_session_calculate_timeout:
   48|    800|{
   49|    800|    ss->calc_timeout = ossl_time_add(ss->time, ss->timeout);
   50|    800|}
SSL_SESSION_new:
  102|    434|{
  103|    434|    SSL_SESSION *ss;
  104|       |
  105|    434|    if (!OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL))
  ------------------
  |  | 2653|    434|# define OPENSSL_INIT_LOAD_SSL_STRINGS       0x00200000L
  ------------------
  |  Branch (105:9): [True: 0, False: 434]
  ------------------
  106|      0|        return NULL;
  107|       |
  108|    434|    ss = OPENSSL_zalloc(sizeof(*ss));
  ------------------
  |  |   99|    434|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  109|    434|    if (ss == NULL)
  ------------------
  |  Branch (109:9): [True: 0, False: 434]
  ------------------
  110|      0|        return NULL;
  111|       |
  112|    434|    ss->verify_result = 1;      /* avoid 0 (= X509_V_OK) just in case */
  113|       |   /* 5 minute timeout by default */
  114|    434|    ss->timeout = ossl_seconds2time(60 * 5 + 4);
  ------------------
  |  |   41|    434|#define ossl_seconds2time(s) ossl_ticks2time((s) * OSSL_TIME_SECOND)
  |  |  ------------------
  |  |  |  |   30|    434|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  ------------------
  ------------------
  115|    434|    ss->time = ossl_time_now();
  116|    434|    ssl_session_calculate_timeout(ss);
  117|    434|    if (!CRYPTO_NEW_REF(&ss->references, 1)) {
  ------------------
  |  Branch (117:9): [True: 0, False: 434]
  ------------------
  118|      0|        OPENSSL_free(ss);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  119|      0|        return NULL;
  120|      0|    }
  121|       |
  122|    434|    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data)) {
  ------------------
  |  |  220|    434|# define CRYPTO_EX_INDEX_SSL_SESSION      2
  ------------------
  |  Branch (122:9): [True: 0, False: 434]
  ------------------
  123|      0|        CRYPTO_FREE_REF(&ss->references);
  124|      0|        OPENSSL_free(ss);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  125|      0|        return NULL;
  126|      0|    }
  127|    434|    return ss;
  128|    434|}
SSL_SESSION_free:
  812|  11.7k|{
  813|  11.7k|    int i;
  814|       |
  815|  11.7k|    if (ss == NULL)
  ------------------
  |  Branch (815:9): [True: 11.2k, False: 434]
  ------------------
  816|  11.2k|        return;
  817|    434|    CRYPTO_DOWN_REF(&ss->references, &i);
  818|    434|    REF_PRINT_COUNT("SSL_SESSION", ss);
  ------------------
  |  |  289|    434|    REF_PRINT_EX(text, object->references.val, (void *)object)
  |  |  ------------------
  |  |  |  |  287|    434|    OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text));
  |  |  |  |  ------------------
  |  |  |  |  |  |  294|    434|    OSSL_TRACEV(category, (trc_out, format, arg1, arg2, arg3))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    434|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  819|    434|    if (i > 0)
  ------------------
  |  Branch (819:9): [True: 0, False: 434]
  ------------------
  820|      0|        return;
  821|    434|    REF_ASSERT_ISNT(i < 0);
  ------------------
  |  |  281|    434|    (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
  |  |  ------------------
  |  |  |  Branch (281:12): [True: 0, False: 434]
  |  |  ------------------
  ------------------
  822|       |
  823|    434|    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);
  ------------------
  |  |  220|    434|# define CRYPTO_EX_INDEX_SSL_SESSION      2
  ------------------
  824|       |
  825|    434|    OPENSSL_cleanse(ss->master_key, sizeof(ss->master_key));
  826|    434|    OPENSSL_cleanse(ss->session_id, sizeof(ss->session_id));
  827|    434|    X509_free(ss->peer);
  828|    434|    EVP_PKEY_free(ss->peer_rpk);
  829|    434|    OSSL_STACK_OF_X509_free(ss->peer_chain);
  830|    434|    OPENSSL_free(ss->ext.hostname);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  831|    434|    OPENSSL_free(ss->ext.tick);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  832|    434|#ifndef OPENSSL_NO_PSK
  833|    434|    OPENSSL_free(ss->psk_identity_hint);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  834|    434|    OPENSSL_free(ss->psk_identity);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  835|    434|#endif
  836|    434|#ifndef OPENSSL_NO_SRP
  837|    434|    OPENSSL_free(ss->srp_username);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  838|    434|#endif
  839|    434|    OPENSSL_free(ss->ext.alpn_selected);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  840|    434|    OPENSSL_free(ss->ticket_appdata);
  ------------------
  |  |  107|    434|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  841|    434|    CRYPTO_FREE_REF(&ss->references);
  842|    434|    OPENSSL_clear_free(ss, sizeof(*ss));
  ------------------
  |  |  105|    434|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|    434|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|    434|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  843|    434|}

SSL_SESSION_print:
   33|    363|{
   34|    363|    size_t i;
   35|    363|    const char *s;
   36|    363|    int istls13;
   37|       |
   38|    363|    if (x == NULL)
  ------------------
  |  Branch (38:9): [True: 0, False: 363]
  ------------------
   39|      0|        goto err;
   40|    363|    istls13 = (x->ssl_version == TLS1_3_VERSION);
  ------------------
  |  |   27|    363|# define TLS1_3_VERSION                  0x0304
  ------------------
   41|    363|    if (BIO_puts(bp, "SSL-Session:\n") <= 0)
  ------------------
  |  Branch (41:9): [True: 0, False: 363]
  ------------------
   42|      0|        goto err;
   43|    363|    s = ssl_protocol_to_string(x->ssl_version);
   44|    363|    if (BIO_printf(bp, "    Protocol  : %s\n", s) <= 0)
  ------------------
  |  Branch (44:9): [True: 0, False: 363]
  ------------------
   45|      0|        goto err;
   46|       |
   47|    363|    if (x->cipher == NULL) {
  ------------------
  |  Branch (47:9): [True: 0, False: 363]
  ------------------
   48|      0|        if (((x->cipher_id) & 0xff000000) == 0x02000000) {
  ------------------
  |  Branch (48:13): [True: 0, False: 0]
  ------------------
   49|      0|            if (BIO_printf(bp, "    Cipher    : %06lX\n",
  ------------------
  |  Branch (49:17): [True: 0, False: 0]
  ------------------
   50|      0|                           x->cipher_id & 0xffffff) <= 0)
   51|      0|                goto err;
   52|      0|        } else {
   53|      0|            if (BIO_printf(bp, "    Cipher    : %04lX\n",
  ------------------
  |  Branch (53:17): [True: 0, False: 0]
  ------------------
   54|      0|                           x->cipher_id & 0xffff) <= 0)
   55|      0|                goto err;
   56|      0|        }
   57|    363|    } else {
   58|    363|        if (BIO_printf(bp, "    Cipher    : %s\n",
  ------------------
  |  Branch (58:13): [True: 0, False: 363]
  ------------------
   59|    363|                       ((x->cipher->name == NULL) ? "unknown"
  ------------------
  |  Branch (59:25): [True: 0, False: 363]
  ------------------
   60|    363|                                                  : x->cipher->name)) <= 0)
   61|      0|            goto err;
   62|    363|    }
   63|    363|    if (BIO_puts(bp, "    Session-ID: ") <= 0)
  ------------------
  |  Branch (63:9): [True: 0, False: 363]
  ------------------
   64|      0|        goto err;
   65|    526|    for (i = 0; i < x->session_id_length; i++) {
  ------------------
  |  Branch (65:17): [True: 163, False: 363]
  ------------------
   66|    163|        if (BIO_printf(bp, "%02X", x->session_id[i]) <= 0)
  ------------------
  |  Branch (66:13): [True: 0, False: 163]
  ------------------
   67|      0|            goto err;
   68|    163|    }
   69|    363|    if (BIO_puts(bp, "\n    Session-ID-ctx: ") <= 0)
  ------------------
  |  Branch (69:9): [True: 0, False: 363]
  ------------------
   70|      0|        goto err;
   71|    425|    for (i = 0; i < x->sid_ctx_length; i++) {
  ------------------
  |  Branch (71:17): [True: 62, False: 363]
  ------------------
   72|     62|        if (BIO_printf(bp, "%02X", x->sid_ctx[i]) <= 0)
  ------------------
  |  Branch (72:13): [True: 0, False: 62]
  ------------------
   73|      0|            goto err;
   74|     62|    }
   75|    363|    if (istls13) {
  ------------------
  |  Branch (75:9): [True: 12, False: 351]
  ------------------
   76|     12|        if (BIO_puts(bp, "\n    Resumption PSK: ") <= 0)
  ------------------
  |  Branch (76:13): [True: 0, False: 12]
  ------------------
   77|      0|            goto err;
   78|    351|    } else if (BIO_puts(bp, "\n    Master-Key: ") <= 0)
  ------------------
  |  Branch (78:16): [True: 0, False: 351]
  ------------------
   79|      0|        goto err;
   80|  3.32k|    for (i = 0; i < x->master_key_length; i++) {
  ------------------
  |  Branch (80:17): [True: 2.96k, False: 363]
  ------------------
   81|  2.96k|        if (BIO_printf(bp, "%02X", x->master_key[i]) <= 0)
  ------------------
  |  Branch (81:13): [True: 0, False: 2.96k]
  ------------------
   82|      0|            goto err;
   83|  2.96k|    }
   84|    363|#ifndef OPENSSL_NO_PSK
   85|    363|    if (BIO_puts(bp, "\n    PSK identity: ") <= 0)
  ------------------
  |  Branch (85:9): [True: 0, False: 363]
  ------------------
   86|      0|        goto err;
   87|    363|    if (BIO_printf(bp, "%s", x->psk_identity ? x->psk_identity : "None") <= 0)
  ------------------
  |  Branch (87:9): [True: 1, False: 362]
  |  Branch (87:30): [True: 29, False: 334]
  ------------------
   88|      1|        goto err;
   89|    362|    if (BIO_puts(bp, "\n    PSK identity hint: ") <= 0)
  ------------------
  |  Branch (89:9): [True: 0, False: 362]
  ------------------
   90|      0|        goto err;
   91|    362|    if (BIO_printf
  ------------------
  |  Branch (91:9): [True: 1, False: 361]
  ------------------
   92|    362|        (bp, "%s", x->psk_identity_hint ? x->psk_identity_hint : "None") <= 0)
  ------------------
  |  Branch (92:20): [True: 7, False: 355]
  ------------------
   93|      1|        goto err;
   94|    361|#endif
   95|    361|#ifndef OPENSSL_NO_SRP
   96|    361|    if (BIO_puts(bp, "\n    SRP username: ") <= 0)
  ------------------
  |  Branch (96:9): [True: 0, False: 361]
  ------------------
   97|      0|        goto err;
   98|    361|    if (BIO_printf(bp, "%s", x->srp_username ? x->srp_username : "None") <= 0)
  ------------------
  |  Branch (98:9): [True: 1, False: 360]
  |  Branch (98:30): [True: 2, False: 359]
  ------------------
   99|      1|        goto err;
  100|    360|#endif
  101|    360|    if (x->ext.tick_lifetime_hint) {
  ------------------
  |  Branch (101:9): [True: 94, False: 266]
  ------------------
  102|     94|        if (BIO_printf(bp,
  ------------------
  |  Branch (102:13): [True: 0, False: 94]
  ------------------
  103|     94|                       "\n    TLS session ticket lifetime hint: %ld (seconds)",
  104|     94|                       x->ext.tick_lifetime_hint) <= 0)
  105|      0|            goto err;
  106|     94|    }
  107|    360|    if (x->ext.tick) {
  ------------------
  |  Branch (107:9): [True: 2, False: 358]
  ------------------
  108|      2|        if (BIO_puts(bp, "\n    TLS session ticket:\n") <= 0)
  ------------------
  |  Branch (108:13): [True: 0, False: 2]
  ------------------
  109|      0|            goto err;
  110|      2|        if (BIO_dump_indent
  ------------------
  |  Branch (110:13): [True: 1, False: 1]
  ------------------
  111|      2|            (bp, (const char *)x->ext.tick, (int)x->ext.ticklen, 4)
  112|      2|            <= 0)
  113|      1|            goto err;
  114|      2|    }
  115|    359|#ifndef OPENSSL_NO_COMP
  116|    359|    if (x->compress_meth != 0) {
  ------------------
  |  Branch (116:9): [True: 2, False: 357]
  ------------------
  117|      2|        SSL_COMP *comp = NULL;
  118|       |
  119|      2|        if (!ssl_cipher_get_evp(NULL, x, NULL, NULL, NULL, NULL, &comp, 0))
  ------------------
  |  Branch (119:13): [True: 0, False: 2]
  ------------------
  120|      0|            goto err;
  121|      2|        if (comp == NULL) {
  ------------------
  |  Branch (121:13): [True: 2, False: 0]
  ------------------
  122|      2|            if (BIO_printf(bp, "\n    Compression: %d", x->compress_meth) <= 0)
  ------------------
  |  Branch (122:17): [True: 0, False: 2]
  ------------------
  123|      0|                goto err;
  124|      2|        } else {
  125|      0|            if (BIO_printf(bp, "\n    Compression: %d (%s)", comp->id,
  ------------------
  |  Branch (125:17): [True: 0, False: 0]
  ------------------
  126|      0|                           comp->name) <= 0)
  127|      0|                goto err;
  128|      0|        }
  129|      2|    }
  130|    359|#endif
  131|    359|    if (!ossl_time_is_zero(x->time)) {
  ------------------
  |  Branch (131:9): [True: 358, False: 1]
  ------------------
  132|    358|        if (BIO_printf(bp, "\n    Start Time: %lld",
  ------------------
  |  Branch (132:13): [True: 0, False: 358]
  ------------------
  133|    358|                       (long long)ossl_time_to_time_t(x->time)) <= 0)
  134|      0|            goto err;
  135|    358|    }
  136|    359|    if (!ossl_time_is_zero(x->timeout)) {
  ------------------
  |  Branch (136:9): [True: 358, False: 1]
  ------------------
  137|    358|        if (BIO_printf(bp, "\n    Timeout   : %lld (sec)",
  ------------------
  |  Branch (137:13): [True: 0, False: 358]
  ------------------
  138|    358|                       (long long)ossl_time2seconds(x->timeout)) <= 0)
  ------------------
  |  |   42|    358|#define ossl_time2seconds(t) (ossl_time2ticks(t) / OSSL_TIME_SECOND)
  |  |  ------------------
  |  |  |  |   30|    358|# define OSSL_TIME_SECOND ((uint64_t)1000000000)
  |  |  ------------------
  ------------------
  139|      0|            goto err;
  140|    358|    }
  141|    359|    if (BIO_puts(bp, "\n") <= 0)
  ------------------
  |  Branch (141:9): [True: 0, False: 359]
  ------------------
  142|      0|        goto err;
  143|       |
  144|    359|    if (BIO_puts(bp, "    Verify return code: ") <= 0)
  ------------------
  |  Branch (144:9): [True: 0, False: 359]
  ------------------
  145|      0|        goto err;
  146|    359|    if (BIO_printf(bp, "%ld (%s)\n", x->verify_result,
  ------------------
  |  Branch (146:9): [True: 0, False: 359]
  ------------------
  147|    359|                   X509_verify_cert_error_string(x->verify_result)) <= 0)
  148|      0|        goto err;
  149|       |
  150|    359|    if (BIO_printf(bp, "    Extended master secret: %s\n",
  ------------------
  |  Branch (150:9): [True: 0, False: 359]
  ------------------
  151|    359|                   x->flags & SSL_SESS_FLAG_EXTMS ? "yes" : "no") <= 0)
  ------------------
  |  |  582|    359|# define SSL_SESS_FLAG_EXTMS             0x1
  ------------------
  |  Branch (151:20): [True: 0, False: 359]
  ------------------
  152|      0|        goto err;
  153|       |
  154|    359|    if (istls13) {
  ------------------
  |  Branch (154:9): [True: 12, False: 347]
  ------------------
  155|     12|        if (BIO_printf(bp, "    Max Early Data: %u\n",
  ------------------
  |  Branch (155:13): [True: 0, False: 12]
  ------------------
  156|     12|                       (unsigned int)x->ext.max_early_data) <= 0)
  157|      0|            goto err;
  158|     12|    }
  159|       |
  160|    359|    return 1;
  161|      4| err:
  162|      4|    return 0;
  163|    359|}

